full_circle_mesh.template.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-2024 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 
27 #ifndef OOMPH_FULL_CIRCLE_MESH_HEADER
28 #define OOMPH_FULL_CIRCLE_MESH_HEADER
29 
30 // Headers
31 #include "../generic/refineable_quad_mesh.h"
32 
33 // Include the headers file for domain
34 #include "full_circle_domain.h"
35 
36 namespace oomph
37 {
38  //====================================================================
39  /// Full circle mesh class.
40  /// The domain is specified by the GeomObject that identifies
41  /// the entire area. Non-refineable base version!
42  ///
43  /// The mesh boundaries are numbered as follows:
44  /// - Boundary 0: The outer wall, represented by \f$\xi_1 = 1\f$.
45  /// .
46  ///
47  //====================================================================
48  template<class ELEMENT>
49  class FullCircleMesh : public virtual QuadMeshBase
50  {
51  public:
52  /// Constructor: Pass pointer to geometric object that
53  /// specifies the area; values of theta at which dividing lines
54  /// are to be placed, fractions of the radius for the central box
55  /// at the dividing lines and the timestepper.
56  /// Timestepper defaults to Steady dummy timestepper.
57  FullCircleMesh(GeomObject* wall_pt,
58  const Vector<double>& theta_positions,
59  const Vector<double>& radius_box,
60  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
61 
62  /// Destructor: empty
63  virtual ~FullCircleMesh()
64  {
65  delete Domain_pt;
66  }
67 
68  /// Access function to GeomObject representing wall
70  {
71  return Area_pt;
72  }
73 
74  /// Access function to domain
76  {
77  return Domain_pt;
78  }
79 
80  /// Access function to underlying domain
82  {
83  return Domain_pt;
84  }
85 
86  protected:
87  /// Pointer to domain
89 
90  /// Pointer to the geometric object that represents the entire domain
92  };
93 
94 
95  /// /////////////////////////////////////////////////////////////////
96  /// /////////////////////////////////////////////////////////////////
97  /// /////////////////////////////////////////////////////////////////
98 
99 
100  //=============================================================
101  /// Adaptative version of the FullCircleMesh base mesh.
102  /// The domain is specified by the GeomObject that identifies
103  /// the entire area
104  ///
105  /// The mesh boundaries are numbered as follows:
106  /// - Boundary 1: The outer wall, represetned by \f$\xi_1 = 1\f$.
107  /// .
108  ///
109  //=============================================================
110  template<class ELEMENT>
111  class RefineableFullCircleMesh : public FullCircleMesh<ELEMENT>,
112  public RefineableQuadMesh<ELEMENT>
113 
114  {
115  public:
116  /// Constructor for adaptive deformable quarter tube mesh class.
117  /// Pass pointer to geometric object that
118  /// specifies the volume, start and end coordinates for the centreline
119  /// on the geometric object. Values of theta at which dividing lines
120  /// are to be placed, fractions of the radius for the central box
121  /// at the dividing lines, the number of layers
122  /// and the timestepper.
123  /// Timestepper defaults to Steady dummy timestepper.
125  GeomObject* wall_pt,
126  const Vector<double>& theta_positions,
127  const Vector<double>& radius_box,
128  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
129  : FullCircleMesh<ELEMENT>(
130  wall_pt, theta_positions, radius_box, time_stepper_pt)
131  {
132  // Loop over all elements and set macro element pointer
133  for (unsigned ielem = 0; ielem < FullCircleMesh<ELEMENT>::nelement();
134  ielem++)
135  {
136  dynamic_cast<RefineableQElement<2>*>(
138  ->set_macro_elem_pt(this->Domain_pt->macro_element_pt(ielem));
139  }
140 
141 
142  // Setup Quadtree forest: Turn elements into individual octrees
143  // and plant in forest
144  Vector<TreeRoot*> trees_pt;
145  for (unsigned iel = 0; iel < FullCircleMesh<ELEMENT>::nelement(); iel++)
146  {
148  ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
149  QuadTreeRoot* quadtree_root_pt = new QuadTreeRoot(ref_el_pt);
150  trees_pt.push_back(quadtree_root_pt);
151  }
152 
153  this->Forest_pt = new QuadTreeForest(trees_pt);
154 
155 #ifdef PARANOID
156  // Run self test
157  unsigned success_flag =
158  dynamic_cast<QuadTreeForest*>(this->Forest_pt)->self_test();
159  if (success_flag == 0)
160  {
161  oomph_info << "Successfully built quadtree forest " << std::endl;
162  }
163  else
164  {
165  throw OomphLibError("Trouble in building quadtree forest ",
166  OOMPH_CURRENT_FUNCTION,
167  OOMPH_EXCEPTION_LOCATION);
168  }
169 #endif
170  }
171 
172  /// Destructor: empty
174  };
175 
176 } // namespace oomph
177 #endif
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:116
A general Finite Element class.
Definition: elements.h:1317
Topologically circular domain, e.g. a tube cross section. The entire domain must be defined by a Geom...
Full circle mesh class. The domain is specified by the GeomObject that identifies the entire area....
FullCircleDomain * Domain_pt
Pointer to domain.
GeomObject * Area_pt
Pointer to the geometric object that represents the entire domain.
GeomObject *& area_pt()
Access function to GeomObject representing wall.
virtual ~FullCircleMesh()
Destructor: empty.
FullCircleDomain * domain_pt()
Access function to domain.
FullCircleMesh(GeomObject *wall_pt, const Vector< double > &theta_positions, const Vector< double > &radius_box, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass pointer to geometric object that specifies the area; values of theta at which divid...
FullCircleDomain * domain_pt() const
Access function to underlying domain.
/////////////////////////////////////////////////////////////////////
Definition: geom_objects.h:101
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
Definition: mesh.h:75
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Definition: mesh.h:473
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:460
unsigned self_test()
Self-test: Check elements and nodes. Return 0 for OK.
Definition: mesh.cc:778
An OomphLibError object which should be thrown when an run-time error is encountered....
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition: quad_mesh.h:57
A QuadTreeForest consists of a collection of QuadTreeRoots. Each member tree can have neighbours to i...
Definition: quadtree.h:409
QuadTreeRoot is a QuadTree that forms the root of a (recursive) quadtree. The "root node" is special ...
Definition: quadtree.h:293
///////////////////////////////////////////////////////////////// ///////////////////////////////////...
RefineableFullCircleMesh(GeomObject *wall_pt, const Vector< double > &theta_positions, const Vector< double > &radius_box, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor for adaptive deformable quarter tube mesh class. Pass pointer to geometric object that sp...
virtual ~RefineableFullCircleMesh()
Destructor: empty.
Refineable version of QElement<2,NNODE_1D>.
Intermediate mesh class that implements the mesh adaptation functions specified in the TreeBasedRefin...
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Definition: timesteppers.h:231
TreeForest * Forest_pt
Forest representation of the mesh.
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...