stored_shape_function_elements.h
Go to the documentation of this file.
1 // LIC// ====================================================================
2 // LIC// This file forms part of oomph-lib, the object-oriented,
3 // LIC// multi-physics finite-element library, available
4 // LIC// at http://www.oomph-lib.org.
5 // LIC//
6 // LIC// Copyright (C) 2006-2022 Matthias Heil and Andrew Hazel
7 // LIC//
8 // LIC// This library is free software; you can redistribute it and/or
9 // LIC// modify it under the terms of the GNU Lesser General Public
10 // LIC// License as published by the Free Software Foundation; either
11 // LIC// version 2.1 of the License, or (at your option) any later version.
12 // LIC//
13 // LIC// This library is distributed in the hope that it will be useful,
14 // LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // LIC// Lesser General Public License for more details.
17 // LIC//
18 // LIC// You should have received a copy of the GNU Lesser General Public
19 // LIC// License along with this library; if not, write to the Free Software
20 // LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 // LIC// 02110-1301 USA.
22 // LIC//
23 // LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
24 // LIC//
25 // LIC//====================================================================
26 // Header file for classes that overload elements and implement
27 // stored shape functions.
28 
29 // Include guard to prevent multiple inclusions of the header
30 #ifndef OOMPH_STORED_SHAPE_FUNCTION_ELEMENTS_HEADER
31 #define OOMPH_STORED_SHAPE_FUNCTION_ELEMENTS_HEADER
32 
33 
34 // Config header generated by autoconfig
35 #ifdef HAVE_CONFIG_H
36 #include <oomph-lib-config.h>
37 #endif
38 
39 #include "elements.h"
40 
41 
42 namespace oomph
43 {
44 // Debugging flag
45 #define OOMPH_STORED_SHAPE_FUNCTIONS_VERBOSE
46 #undef OOMPH_STORED_SHAPE_FUNCTIONS_VERBOSE
47 
48 
49  //==========================================================================
53  //==========================================================================
54  class StorableShapeElementBase : public virtual FiniteElement
55  {
56  private:
59  // ALH: Note that the vector must be Shape* because we do not know,
60  // a priori, how much storage to allocate in each Shape object.
61  // N.B. This could in 99% of cases be static, but that would not
62  // permit individual elements to have different integration schemes.
63  // If this proves to be a problem, one can use the the function
64  // set_local_shape_stored_from_element(), which sets this pointer to
65  // point to the pointer allocated by another element.
67 
71 
76 
80 
84 
88 
92 
96 
97  public:
99  // By default the element can delete its own stored shape functions
101  : FiniteElement(),
102  Shape_stored_pt(0),
110  {
111  }
112 
117  virtual ~StorableShapeElementBase();
118 
121 
123  void operator=(const StorableShapeElementBase&) = delete;
124 
128 
131 
135 
139 
143 
147 
151 
155 
159  virtual void set_integration_scheme(Integral* const& integral_pt);
160 
164  {
165  return Shape_stored_pt;
166  }
167 
170  inline Vector<Shape*>* const& shape_stored_pt() const
171  {
172  return Shape_stored_pt;
173  }
174 
177  inline Shape*& shape_stored_pt(const unsigned& ipt)
178  {
179  return (*Shape_stored_pt)[ipt];
180  }
181 
184  inline Shape* const& shape_stored_pt(const unsigned& ipt) const
185  {
186  return (*Shape_stored_pt)[ipt];
187  }
188 
192  {
193  return DShape_local_stored_pt;
194  }
195 
200  {
201  return DShape_local_stored_pt;
202  }
203 
207  {
209  }
210 
215  {
217  }
218 
223  {
225  }
226 
231  {
233  }
234 
239  {
241  }
242 
247  {
249  }
250 
254  {
256  }
257 
262  {
264  }
265 
275  StorableShapeElementBase* const& element_pt);
276 
285  StorableShapeElementBase* const& element_pt);
286 
290 
293  void shape_at_knot(const unsigned& ipt, Shape& psi) const;
294 
298 
302  void dshape_local_at_knot(const unsigned& ipt,
303  Shape& psi,
304  DShape& dpsids) const;
305 
310 
315  void d2shape_local_at_knot(const unsigned& ipt,
316  Shape& psi,
317  DShape& dpsids,
318  DShape& d2psids) const;
319 
324 
327  double J_eulerian_at_knot(const unsigned& ipt) const;
328 
333 
338  double dshape_eulerian_at_knot(const unsigned& ipt,
339  Shape& psi,
340  DShape& dpsidx) const;
341 
342 
347 
352  double d2shape_eulerian_at_knot(const unsigned& ipt,
353  Shape& psi,
354  DShape& dpsidx,
355  DShape& d2psidx) const;
356 
357 
358  /* /// Diagnostic */
359  /* void tell_me() */
360  /* { */
361  /* oomph_info << "Diagnostic" << std::endl; */
362  /* oomph_info << Shape_stored_pt << " "; */
363  /* oomph_info << DShape_local_stored_pt << " "; */
364  /* oomph_info << D2Shape_local_stored_pt << " "; */
365  /* oomph_info << DShape_eulerian_stored_pt << " "; */
366  /* oomph_info << D2Shape_eulerian_stored_pt << " "; */
367  /* oomph_info << Jacobian_eulerian_stored_pt << std::endl; */
368  /* } */
369  };
370 
371 
372  //============================================================================
376  //============================================================================
378  public virtual SolidFiniteElement
379  {
380  private:
384 
388 
392 
396 
397  public:
406  {
407  }
408 
411  {
413  }
414 
417  delete;
418 
421 
425 
429 
433 
437 
441  {
443 
444  // If we are storing Lagrangian first and second derivatives, recompute
445  // them
447  {
449  }
450  // If we are storing Lagrangian first derivatives, recompute them
451  else if (DShape_lagrangian_stored_pt != 0)
452  {
454  }
455  }
456 
461  {
463  }
464 
469  {
471  }
472 
477  {
479  }
480 
485  {
487  }
488 
492  {
494  }
495 
500  {
502  }
503 
504 
509 
514  double dshape_lagrangian_at_knot(const unsigned& ipt,
515  Shape& psi,
516  DShape& dpsidxi) const;
517 
523 
529  double d2shape_lagrangian_at_knot(const unsigned& ipt,
530  Shape& psi,
531  DShape& dpsidxi,
532  DShape& d2psidxi) const;
533 
534 
543  StorableShapeSolidElementBase* const& element_pt);
544  };
545 
546 
547  //========================================================================
552  //========================================================================
553  template<class ELEMENT>
555  public virtual ELEMENT
556  {
557  public:
559  // By default the element can delete its own stored shape functions
561  {
562  // Reset the integration scheme and force a (re)compute of the
563  // the stored shape functions and their derivatives w.r.t. to the
564  // local coordinates.
565  this->set_integration_scheme(this->integral_pt());
566  }
567 
570 
573 
575  void operator=(const StorableShapeElement&) = delete;
576  };
577 
578 
582 
583 
584  //============================================================================
589  //============================================================================
590  template<class ELEMENT>
592  : public virtual StorableShapeSolidElementBase,
593  public virtual ELEMENT
594  {
595  public:
598  {
599  // Reset the integration scheme and force a (re-)computation
600  // of the shape functions and their derivatives w.r.t. to the
601  // local coordinates at the integration points.
602  this->set_integration_scheme(this->integral_pt());
603  }
604 
607 
608 
611 
613  void operator=(const StorableShapeSolidElement&) = delete;
614  };
615 
616 } // namespace oomph
617 
618 #endif
Definition: shape.h:278
Definition: elements.h:1313
Integral *const & integral_pt() const
Return the pointer to the integration scheme (const version)
Definition: elements.h:1963
Definition: integral.h:49
Definition: shape.h:76
Definition: elements.h:3561
Definition: stored_shape_function_elements.h:55
Shape *const & shape_stored_pt(const unsigned &ipt) const
Definition: stored_shape_function_elements.h:184
Vector< DShape * > *& dshape_eulerian_stored_pt()
Definition: stored_shape_function_elements.h:222
void shape_at_knot(const unsigned &ipt, Shape &psi) const
Definition: stored_shape_function_elements.cc:671
Vector< Shape * > *const & shape_stored_pt() const
Definition: stored_shape_function_elements.h:170
virtual void set_integration_scheme(Integral *const &integral_pt)
Definition: stored_shape_function_elements.cc:218
Vector< DShape * > *const & dshape_eulerian_stored_pt() const
Definition: stored_shape_function_elements.h:230
void delete_all_dshape_eulerian_stored()
Definition: stored_shape_function_elements.cc:129
Vector< DShape * > * DShape_local_stored_pt
Definition: stored_shape_function_elements.h:70
Vector< DShape * > * D2Shape_local_stored_pt
Definition: stored_shape_function_elements.h:75
virtual ~StorableShapeElementBase()
Definition: stored_shape_function_elements.cc:205
Vector< DShape * > * D2Shape_eulerian_stored_pt
Definition: stored_shape_function_elements.h:87
void delete_dshape_local_stored()
Definition: stored_shape_function_elements.cc:83
void delete_shape_local_stored()
Delete stored shape functions.
Definition: stored_shape_function_elements.cc:57
Vector< DShape * > *& dshape_local_stored_pt()
Definition: stored_shape_function_elements.h:191
void delete_d2shape_local_stored()
Definition: stored_shape_function_elements.cc:106
StorableShapeElementBase(const StorableShapeElementBase &)=delete
Broken copy constructor.
Vector< DShape * > *& d2shape_eulerian_stored_pt()
Definition: stored_shape_function_elements.h:238
double dshape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx) const
Definition: stored_shape_function_elements.cc:740
Vector< DShape * > *& d2shape_local_stored_pt()
Definition: stored_shape_function_elements.h:206
Vector< Shape * > * Shape_stored_pt
Definition: stored_shape_function_elements.h:66
void pre_compute_d2shape_eulerian_at_knots()
Definition: stored_shape_function_elements.cc:580
Vector< double > * Jacobian_eulerian_stored_pt
Definition: stored_shape_function_elements.h:91
void delete_d2shape_eulerian_stored()
Delete stored 2nd derivatives w.r.t. Eulerian coordinates.
Definition: stored_shape_function_elements.cc:163
void dshape_local_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsids) const
Definition: stored_shape_function_elements.cc:692
void pre_compute_dshape_eulerian_at_knots()
Definition: stored_shape_function_elements.cc:519
void set_shape_local_stored_from_element(StorableShapeElementBase *const &element_pt)
Definition: stored_shape_function_elements.cc:810
void pre_compute_J_eulerian_at_knots()
Definition: stored_shape_function_elements.cc:495
double d2shape_eulerian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidx, DShape &d2psidx) const
Definition: stored_shape_function_elements.cc:765
void set_dshape_eulerian_stored_from_element(StorableShapeElementBase *const &element_pt)
Definition: stored_shape_function_elements.cc:850
void delete_J_eulerian_stored()
Definition: stored_shape_function_elements.cc:188
Vector< DShape * > *const & d2shape_local_stored_pt() const
Definition: stored_shape_function_elements.h:214
void pre_compute_dshape_local_at_knots()
Definition: stored_shape_function_elements.cc:321
void delete_dshape_eulerian_stored()
Delete stored derivatives w.r.t. Eulerian coordinates.
Definition: stored_shape_function_elements.cc:139
bool Can_delete_dshape_eulerian_stored
Definition: stored_shape_function_elements.h:95
Vector< double > *const & jacobian_eulerian_stored_pt() const
Definition: stored_shape_function_elements.h:261
Vector< double > *& jacobian_eulerian_stored_pt()
Definition: stored_shape_function_elements.h:253
StorableShapeElementBase()
Constructor, set most storage pointers to NULL.
Definition: stored_shape_function_elements.h:100
bool Can_delete_shape_local_stored
Definition: stored_shape_function_elements.h:79
void pre_compute_shape_at_knots()
Definition: stored_shape_function_elements.cc:262
double J_eulerian_at_knot(const unsigned &ipt) const
Definition: stored_shape_function_elements.cc:789
Shape *& shape_stored_pt(const unsigned &ipt)
Definition: stored_shape_function_elements.h:177
Vector< DShape * > * DShape_eulerian_stored_pt
Definition: stored_shape_function_elements.h:83
void delete_all_shape_local_stored()
Definition: stored_shape_function_elements.cc:46
void pre_compute_d2shape_local_at_knots()
Definition: stored_shape_function_elements.cc:394
Vector< DShape * > *const & dshape_local_stored_pt() const
Definition: stored_shape_function_elements.h:199
void d2shape_local_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsids, DShape &d2psids) const
Definition: stored_shape_function_elements.cc:714
Vector< DShape * > *const & d2shape_eulerian_stored_pt() const
Definition: stored_shape_function_elements.h:246
Vector< Shape * > *& shape_stored_pt()
Definition: stored_shape_function_elements.h:163
void operator=(const StorableShapeElementBase &)=delete
Broken assignment operator.
Definition: stored_shape_function_elements.h:556
StorableShapeElement(const StorableShapeElement &)=delete
Broken copy constructor.
void operator=(const StorableShapeElement &)=delete
Broken assignment operator.
StorableShapeElement()
Constructor, set most storage pointers to zero.
Definition: stored_shape_function_elements.h:560
virtual ~StorableShapeElement()
Empty virtual destructor.
Definition: stored_shape_function_elements.h:569
Definition: stored_shape_function_elements.h:379
Vector< double > * Jacobian_lagrangian_stored_pt
Definition: stored_shape_function_elements.h:391
Vector< DShape * > *& dshape_lagrangian_stored_pt()
Definition: stored_shape_function_elements.h:460
virtual ~StorableShapeSolidElementBase()
Destructor to clean up any allocated memory.
Definition: stored_shape_function_elements.h:410
Vector< DShape * > *const & d2shape_lagrangian_stored_pt() const
Definition: stored_shape_function_elements.h:484
void pre_compute_d2shape_lagrangian_at_knots()
Definition: stored_shape_function_elements.cc:1023
void pre_compute_dshape_lagrangian_at_knots()
Definition: stored_shape_function_elements.cc:960
double d2shape_lagrangian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidxi, DShape &d2psidxi) const
Definition: stored_shape_function_elements.cc:1143
StorableShapeSolidElementBase(const StorableShapeSolidElementBase &)=delete
Broken copy constructor.
Vector< DShape * > * D2Shape_lagrangian_stored_pt
Definition: stored_shape_function_elements.h:387
double dshape_lagrangian_at_knot(const unsigned &ipt, Shape &psi, DShape &dpsidxi) const
Definition: stored_shape_function_elements.cc:1119
void delete_J_lagrangian_stored()
Definition: stored_shape_function_elements.cc:944
Vector< double > *const & jacobian_lagrangian_stored_pt() const
Definition: stored_shape_function_elements.h:499
Vector< DShape * > *& d2shape_lagrangian_stored_pt()
Definition: stored_shape_function_elements.h:476
StorableShapeSolidElementBase()
Constructor: Set defaults: Nothing is stored.
Definition: stored_shape_function_elements.h:399
Vector< DShape * > *const & dshape_lagrangian_stored_pt() const
Definition: stored_shape_function_elements.h:468
void delete_d2shape_lagrangian_stored()
Definition: stored_shape_function_elements.cc:920
bool Can_delete_dshape_lagrangian_stored
Definition: stored_shape_function_elements.h:395
void set_integration_scheme(Integral *const &integral_pt)
Definition: stored_shape_function_elements.h:440
void delete_all_dshape_lagrangian_stored()
Definition: stored_shape_function_elements.cc:883
void operator=(const StorableShapeSolidElementBase &)=delete
Broken assignment operator.
void delete_dshape_lagrangian_stored()
Definition: stored_shape_function_elements.cc:895
Vector< DShape * > * DShape_lagrangian_stored_pt
Definition: stored_shape_function_elements.h:383
Vector< double > *& jacobian_lagrangian_stored_pt()
Definition: stored_shape_function_elements.h:491
void set_dshape_lagrangian_stored_from_element(StorableShapeSolidElementBase *const &element_pt)
Definition: stored_shape_function_elements.cc:1173
Definition: stored_shape_function_elements.h:594
void operator=(const StorableShapeSolidElement &)=delete
Broken assignment operator.
StorableShapeSolidElement(const StorableShapeSolidElement &)=delete
Broken copy constructor.
StorableShapeSolidElement()
Constructor: Set defaults.
Definition: stored_shape_function_elements.h:597
virtual ~StorableShapeSolidElement()
Destructor to clean up any allocated memory.
Definition: stored_shape_function_elements.h:606
Definition: oomph-lib/src/generic/Vector.h:58
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10