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-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 
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  //====================================================================
47  //====================================================================
48  template<class ELEMENT>
49  class FullCircleMesh : public virtual QuadMeshBase
50  {
51  public:
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 
63  virtual ~FullCircleMesh()
64  {
65  delete Domain_pt;
66  }
67 
70  {
71  return Area_pt;
72  }
73 
76  {
77  return Domain_pt;
78  }
79 
82  {
83  return Domain_pt;
84  }
85 
86  protected:
89 
92  };
93 
94 
98 
99 
100  //=============================================================
109  //=============================================================
110  template<class ELEMENT>
111  class RefineableFullCircleMesh : public FullCircleMesh<ELEMENT>,
112  public RefineableQuadMesh<ELEMENT>
113 
114  {
115  public:
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 ",
168  }
169 #endif
170  }
171 
174  };
175 
176 } // namespace oomph
177 #endif
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:116
Definition: elements.h:1313
Definition: full_circle_domain.h:69
Definition: full_circle_mesh.template.h:50
FullCircleDomain * Domain_pt
Pointer to domain.
Definition: full_circle_mesh.template.h:88
GeomObject * Area_pt
Pointer to the geometric object that represents the entire domain.
Definition: full_circle_mesh.template.h:91
GeomObject *& area_pt()
Access function to GeomObject representing wall.
Definition: full_circle_mesh.template.h:69
virtual ~FullCircleMesh()
Destructor: empty.
Definition: full_circle_mesh.template.h:63
FullCircleDomain * domain_pt()
Access function to domain.
Definition: full_circle_mesh.template.h:75
FullCircleMesh(GeomObject *wall_pt, const Vector< double > &theta_positions, const Vector< double > &radius_box, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: full_circle_mesh.template.cc:40
FullCircleDomain * domain_pt() const
Access function to underlying domain.
Definition: full_circle_mesh.template.h:81
Definition: geom_objects.h:101
static Steady< 0 > Default_TimeStepper
The Steady Timestepper.
Definition: mesh.h:75
FiniteElement * finite_element_pt(const unsigned &e) const
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
Definition: oomph_definitions.h:222
Base class for quad meshes (meshes made of 2D quad elements).
Definition: quad_mesh.h:57
Definition: quadtree.h:409
Definition: quadtree.h:293
Definition: full_circle_mesh.template.h:114
RefineableFullCircleMesh(GeomObject *wall_pt, const Vector< double > &theta_positions, const Vector< double > &radius_box, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: full_circle_mesh.template.h:124
virtual ~RefineableFullCircleMesh()
Destructor: empty.
Definition: full_circle_mesh.template.h:173
Definition: refineable_quad_element.h:71
Definition: refineable_quad_mesh.h:53
Definition: timesteppers.h:231
TreeForest * Forest_pt
Forest representation of the mesh.
Definition: refineable_mesh.h:768
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).
Definition: AnisotropicHookean.h:10
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86