hp_refineable_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 define hp-refineable element objects
27 
28 // Include guard to prevent multiple inclusions of the header
29 #ifndef OOMPH_HP_REFINEABLE_ELEMENTS_HEADER
30 #define OOMPH_HP_REFINEABLE_ELEMENTS_HEADER
31 
32 // Config header generated by autoconfig
33 #ifdef HAVE_CONFIG_H
34 #include <oomph-lib-config.h>
35 #endif
36 
37 #include "refineable_elements.h"
41 #include "mesh.h"
42 
43 namespace oomph
44 {
45  //======================================================================
48  //======================================================================
49  template<unsigned INITIAL_NNODE_1D>
50  class PRefineableQElement<1, INITIAL_NNODE_1D>
51  : public RefineableQElement<1>,
52  public virtual QElement<1, INITIAL_NNODE_1D>,
53  public virtual PRefineableElement
54  {
55  public:
58 
60  virtual ~PRefineableQElement() {}
61 
65  void initial_setup(Tree* const& adopted_father_pt = 0,
66  const unsigned& initial_p_order = 0);
67 
70  void pre_build(Mesh*& mesh_pt, Vector<Node*>& new_node_pt);
71 
73  void p_refine(const int& inc,
74  Mesh* const& mesh_pt,
75  GeneralisedElement* const& clone_pt);
76 
78  void shape(const Vector<double>& s, Shape& psi) const;
79 
80  void dshape_local(const Vector<double>& s, Shape& psi, DShape& dpsi) const;
81 
82  void d2shape_local(const Vector<double>& s,
83  Shape& psi,
84  DShape& dpsids,
85  DShape& d2psids) const;
86 
91 
95  unsigned nnode_1d() const
96  {
97  return this->p_order();
98  }
99 
101  unsigned initial_p_order() const
102  {
103  return INITIAL_NNODE_1D;
104  }
105 
106  // Overloaded from QElement<1,NNODE_1D> to use nnode_1d() instead of
107  // template argument.
108  Node* get_node_at_local_coordinate(const Vector<double>& s) const;
109 
110  Node* node_created_by_son_of_neighbour(const Vector<double>& s_fraction,
111  bool& is_periodic);
112 
113  // Overload nodal positions -- these elements have GLL-spaced nodes.
115  void local_coordinate_of_node(const unsigned& n, Vector<double>& s) const;
116 
118  void local_fraction_of_node(const unsigned& n, Vector<double>& s_fraction);
119 
121  double local_one_d_fraction_of_node(const unsigned& n1d, const unsigned& i);
122 
125  void rebuild_from_sons(Mesh*& mesh_pt);
126 
129  void check_integrity(double& max_error);
130 
131  protected:
133  void binary_hang_helper(const int& value_id,
134  const int& my_edge,
135  std::ofstream& output_hangfile);
136  };
137 
138  //=======================================================================
140  //=======================================================================
141  template<unsigned INITIAL_NNODE_1D>
142  class PRefineableQElement<2, INITIAL_NNODE_1D>
143  : public RefineableQElement<2>,
144  public virtual QElement<2, INITIAL_NNODE_1D>,
145  public virtual PRefineableElement
146  {
147  public:
150 
152  virtual ~PRefineableQElement() {}
153 
157  void initial_setup(Tree* const& adopted_father_pt = 0,
158  const unsigned& initial_p_order = 0);
159 
162  void pre_build(Mesh*& mesh_pt, Vector<Node*>& new_node_pt);
163 
165  void p_refine(const int& inc,
166  Mesh* const& mesh_pt,
167  GeneralisedElement* const& clone_pt);
168 
170  void shape(const Vector<double>& s, Shape& psi) const;
171 
172  void dshape_local(const Vector<double>& s, Shape& psi, DShape& dpsi) const;
173 
174  void d2shape_local(const Vector<double>& s,
175  Shape& psi,
176  DShape& dpsids,
177  DShape& d2psids) const;
178 
183 
187  unsigned nnode_1d() const
188  {
189  return this->p_order();
190  }
191 
193  unsigned initial_p_order() const
194  {
195  return INITIAL_NNODE_1D;
196  }
197 
198  // Overloaded from QElement<2,NNODE_1D> to use nnode_1d() instead of
199  // template argument.
200  Node* get_node_at_local_coordinate(const Vector<double>& s) const;
201 
202  Node* node_created_by_neighbour(const Vector<double>& s_fraction,
203  bool& is_periodic);
204 
205  Node* node_created_by_son_of_neighbour(const Vector<double>& s_fraction,
206  bool& is_periodic);
207 
208  // Overload nodal positions -- these elements have GLL-spaced nodes.
210  void local_coordinate_of_node(const unsigned& n, Vector<double>& s) const;
211 
213  void local_fraction_of_node(const unsigned& n, Vector<double>& s_fraction);
214 
216  double local_one_d_fraction_of_node(const unsigned& n1d, const unsigned& i);
217 
220  void rebuild_from_sons(Mesh*& mesh_pt);
221 
227  void check_integrity(double& max_error);
228 
229  protected:
234  void quad_hang_helper(const int& value_id,
235  const int& my_edge,
236  std::ofstream& output_hangfile);
237  };
238 
239  //=======================================================================
241  //=======================================================================
242  template<unsigned INITIAL_NNODE_1D>
243  class PRefineableQElement<3, INITIAL_NNODE_1D>
244  : public RefineableQElement<3>,
245  public virtual QElement<3, INITIAL_NNODE_1D>,
246  public virtual PRefineableElement
247  {
248  public:
251 
253  virtual ~PRefineableQElement() {}
254 
258  void initial_setup(Tree* const& adopted_father_pt = 0,
259  const unsigned& initial_p_order = 0);
260 
263  void pre_build(Mesh*& mesh_pt, Vector<Node*>& new_node_pt);
264 
266  void p_refine(const int& inc,
267  Mesh* const& mesh_pt,
268  GeneralisedElement* const& clone_pt);
269 
271  void shape(const Vector<double>& s, Shape& psi) const;
272 
273  void dshape_local(const Vector<double>& s, Shape& psi, DShape& dpsi) const;
274 
275  void d2shape_local(const Vector<double>& s,
276  Shape& psi,
277  DShape& dpsids,
278  DShape& d2psids) const;
279 
284 
288  unsigned nnode_1d() const
289  {
290  return this->p_order();
291  }
292 
294  unsigned initial_p_order() const
295  {
296  return INITIAL_NNODE_1D;
297  }
298 
299  // Overloaded from QElement<3,NNODE_1D> to use nnode_1d() instead of
300  // template argument.
301  Node* get_node_at_local_coordinate(const Vector<double>& s) const;
302 
303  Node* node_created_by_neighbour(const Vector<double>& s_fraction,
304  bool& is_periodic);
305 
306  Node* node_created_by_son_of_neighbour(const Vector<double>& s_fraction,
307  bool& is_periodic);
308 
309  // Overload nodal positions -- these elements have GLL-spaced nodes.
311  void local_coordinate_of_node(const unsigned& n, Vector<double>& s) const;
312 
314  void local_fraction_of_node(const unsigned& n, Vector<double>& s_fraction);
315 
317  double local_one_d_fraction_of_node(const unsigned& n1d, const unsigned& i);
318 
321  void rebuild_from_sons(Mesh*& mesh_pt);
322 
328  void check_integrity(double& max_error);
329 
330  protected:
335  void oc_hang_helper(const int& value_id,
336  const int& my_face,
337  std::ofstream& output_hangfile);
338  };
339 
340 } // namespace oomph
341 
342 #endif
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
Definition: shape.h:278
Definition: elements.h:73
Definition: mesh.h:67
Definition: nodes.h:906
p-refineable version of RefineableElement
Definition: refineable_elements.h:652
unsigned initial_p_order() const
Get the initial P_order.
Definition: hp_refineable_elements.h:101
virtual ~PRefineableQElement()
Destructor.
Definition: hp_refineable_elements.h:60
void further_setup_hanging_nodes()
Definition: hp_refineable_elements.h:90
unsigned nnode_1d() const
Definition: hp_refineable_elements.h:95
PRefineableQElement()
Constructor.
Definition: hp_refineable_elements.h:57
virtual ~PRefineableQElement()
Destructor.
Definition: hp_refineable_elements.h:152
void further_setup_hanging_nodes()
Definition: hp_refineable_elements.h:182
PRefineableQElement()
Constructor.
Definition: hp_refineable_elements.h:149
unsigned nnode_1d() const
Definition: hp_refineable_elements.h:187
unsigned initial_p_order() const
Get the initial P_order.
Definition: hp_refineable_elements.h:193
virtual ~PRefineableQElement()
Destructor.
Definition: hp_refineable_elements.h:253
void further_setup_hanging_nodes()
Definition: hp_refineable_elements.h:283
unsigned initial_p_order() const
Get the initial P_order.
Definition: hp_refineable_elements.h:294
unsigned nnode_1d() const
Definition: hp_refineable_elements.h:288
PRefineableQElement()
Constructor.
Definition: hp_refineable_elements.h:250
Definition: Qelements.h:2274
Definition: Qelements.h:459
Definition: Qelements.h:2259
Definition: shape.h:76
Definition: tree.h:74
RealScalar s
Definition: level1_cplx_impl.h:130
double max_error
Definition: MortaringCantileverCompareToNonMortaring.cpp:188
void shape(const double &s, double *Psi)
Definition: shape.h:564
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10