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// Version 1.0; svn revision $LastChangedRevision$
7 //LIC//
8 //LIC// $LastChangedDate$
9 //LIC//
10 //LIC// Copyright (C) 2006-2016 Matthias Heil and Andrew Hazel
11 //LIC//
12 //LIC// This library is free software; you can redistribute it and/or
13 //LIC// modify it under the terms of the GNU Lesser General Public
14 //LIC// License as published by the Free Software Foundation; either
15 //LIC// version 2.1 of the License, or (at your option) any later version.
16 //LIC//
17 //LIC// This library is distributed in the hope that it will be useful,
18 //LIC// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 //LIC// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 //LIC// Lesser General Public License for more details.
21 //LIC//
22 //LIC// You should have received a copy of the GNU Lesser General Public
23 //LIC// License along with this library; if not, write to the Free Software
24 //LIC// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 //LIC// 02110-1301 USA.
26 //LIC//
27 //LIC// The authors may be contacted at oomph-lib@maths.man.ac.uk.
28 //LIC//
29 //LIC//====================================================================
30 
31 #ifndef OOMPH_FULL_CIRCLE_MESH_HEADER
32 #define OOMPH_FULL_CIRCLE_MESH_HEADER
33 
34 // Headers
35 #include "../generic/refineable_quad_mesh.h"
36 
37 //Include the headers file for domain
38 #include "full_circle_domain.h"
39 
40 namespace oomph
41 {
42 
43 //====================================================================
44 /// \short Full circle mesh class.
45 /// The domain is specified by the GeomObject that identifies
46 /// the entire area. Non-refineable base version!
47 ///
48 /// The mesh boundaries are numbered as follows:
49 /// - Boundary 0: The outer wall, represented by \f$\xi_1 = 1\f$.
50 /// .
51 ///
52 //====================================================================
53 template <class ELEMENT>
54 class FullCircleMesh : public virtual QuadMeshBase
55 {
56 public:
57 
58  /// \short Constructor: Pass pointer to geometric object that
59  /// specifies the area; values of theta at which dividing lines
60  /// are to be placed, fractions of the radius for the central box
61  /// at the dividing lines and the timestepper.
62  /// Timestepper defaults to Steady dummy timestepper.
63  FullCircleMesh(GeomObject* wall_pt,
64  const Vector<double> &theta_positions,
65  const Vector<double> &radius_box,
66  TimeStepper* time_stepper_pt=
68 
69  /// \short Destructor: empty
70  virtual ~FullCircleMesh()
71  {
72  delete Domain_pt;
73  }
74 
75  /// Access function to GeomObject representing wall
76  GeomObject*& area_pt(){return Area_pt;}
77 
78  /// Access function to domain
80 
81  /// Access function to underlying domain
83 
84 protected:
85 
86  /// Pointer to domain
88 
89  /// Pointer to the geometric object that represents the entire domain
91 
92 };
93 
94 
95 
96 
97 ////////////////////////////////////////////////////////////////////
98 ////////////////////////////////////////////////////////////////////
99 ////////////////////////////////////////////////////////////////////
100 
101 
102 
103 
104 
105 //=============================================================
106 /// Adaptative version of the FullCircleMesh base mesh.
107 /// The domain is specified by the GeomObject that identifies
108 /// the entire area
109 ///
110 /// The mesh boundaries are numbered as follows:
111 /// - Boundary 1: The outer wall, represetned by \f$\xi_1 = 1\f$.
112 /// .
113 ///
114 //=============================================================
115 template<class ELEMENT>
116 class RefineableFullCircleMesh : public FullCircleMesh<ELEMENT>,
117  public RefineableQuadMesh<ELEMENT>
118 
119 {
120 
121 public :
122 
123 /// \short Constructor for adaptive deformable quarter tube mesh class.
124 /// Pass pointer to geometric object that
125 /// specifies the volume, start and end coordinates for the centreline
126 /// on the geometric object. Values of theta at which dividing lines
127 /// are to be placed, fractions of the radius for the central box
128 /// at the dividing lines, the number of layers
129 /// and the timestepper.
130 /// Timestepper defaults to Steady dummy timestepper.
132  const Vector<double> &theta_positions,
133  const Vector<double> &radius_box,
134  TimeStepper* time_stepper_pt=
136  FullCircleMesh<ELEMENT>(wall_pt,theta_positions,
137  radius_box,time_stepper_pt)
138  {
139  // Loop over all elements and set macro element pointer
140  for (unsigned ielem=0;ielem<FullCircleMesh<ELEMENT>::nelement();ielem++)
141  {
142  dynamic_cast<RefineableQElement<2>*>(
144  set_macro_elem_pt(this->Domain_pt->macro_element_pt(ielem));
145  }
146 
147 
148  // Setup Quadtree forest: Turn elements into individual octrees
149  // and plant in forest
150  Vector<TreeRoot*> trees_pt;
151  for (unsigned iel=0;iel<FullCircleMesh<ELEMENT>::nelement();iel++)
152  {
154  ELEMENT* ref_el_pt=dynamic_cast<ELEMENT*>(el_pt);
155  QuadTreeRoot* quadtree_root_pt=new QuadTreeRoot(ref_el_pt);
156  trees_pt.push_back(quadtree_root_pt);
157  }
158 
159  this->Forest_pt = new QuadTreeForest(trees_pt);
160 
161 #ifdef PARANOID
162  // Run self test
163  unsigned success_flag=
164  dynamic_cast<QuadTreeForest*>(this->Forest_pt)->self_test();
165  if (success_flag==0)
166  {
167  oomph_info << "Successfully built quadtree forest " << std::endl;
168  }
169  else
170  {
171  throw OomphLibError(
172  "Trouble in building quadtree forest ",
173  OOMPH_CURRENT_FUNCTION,
174  OOMPH_EXCEPTION_LOCATION);
175  }
176 #endif
177 
178  }
179 
180  /// \short Destructor: empty
182 
183 };
184 
185 }
186 #endif
virtual ~RefineableFullCircleMesh()
Destructor: empty.
Topologically circular domain, e.g. a tube cross section. The entire domain must be defined by a Geom...
virtual ~FullCircleMesh()
Destructor: empty.
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors. ...
Definition: mesh.h:85
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...
A general Finite Element class.
Definition: elements.h:1274
GeomObject * Area_pt
Pointer to the geometric object that represents the entire domain.
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:100
FullCircleDomain * Domain_pt
Pointer to domain.
unsigned self_test()
Self-test: Check elements and nodes. Return 0 for OK.
Definition: mesh.cc:715
OomphInfo oomph_info
Full circle mesh class. The domain is specified by the GeomObject that identifies the entire area...
FullCircleDomain * domain_pt() const
Access function to underlying domain.
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Definition: mesh.h:477
Base class for quad meshes (meshes made of 2D quad elements).
Definition: quad_mesh.h:61
GeomObject *& area_pt()
Access function to GeomObject representing wall.
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:470
FullCircleDomain * domain_pt()
Access function to domain.
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Definition: timesteppers.h:219
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...