tube_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 #ifndef OOMPH_TUBE_MESH_HEADER
27 #define OOMPH_TUBE_MESH_HEADER
28 
29 // Headers
30 #include "../generic/refineable_brick_mesh.h"
31 #include "../generic/macro_element.h"
32 #include "../generic/domain.h"
33 #include "../generic/algebraic_elements.h"
34 #include "../generic/brick_mesh.h"
35 #include "../generic/macro_element_node_update_element.h"
36 
37 
38 // Include the headers file for domain
39 #include "tube_domain.h"
40 
41 namespace oomph
42 {
43  //====================================================================
54  //====================================================================
55  template<class ELEMENT>
56  class TubeMesh : public virtual BrickMeshBase
57  {
58  public:
66  TubeMesh(GeomObject* wall_pt,
67  const Vector<double>& centreline_limits,
68  const Vector<double>& theta_positions,
69  const Vector<double>& radius_box,
70  const unsigned& nlayer,
71  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
72 
74  virtual ~TubeMesh()
75  {
76  delete Domain_pt;
77  }
78 
81  {
82  return Volume_pt;
83  }
84 
87  {
88  return Domain_pt;
89  }
90 
93  {
94  return Domain_pt;
95  }
96 
97  protected:
100 
103  };
104 
105 
109 
110 
111  //=============================================================
122  //=============================================================
123  template<class ELEMENT>
124  class RefineableTubeMesh : public TubeMesh<ELEMENT>,
125  public RefineableBrickMesh<ELEMENT>
126 
127  {
128  public:
138  GeomObject* wall_pt,
139  const Vector<double>& centreline_limits,
140  const Vector<double>& theta_positions,
141  const Vector<double>& radius_box,
142  const unsigned& nlayer,
143  TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
144  : TubeMesh<ELEMENT>(wall_pt,
145  centreline_limits,
146  theta_positions,
147  radius_box,
148  nlayer,
149  time_stepper_pt)
150  {
151  // Loop over all elements and set macro element pointer
152  for (unsigned ielem = 0; ielem < TubeMesh<ELEMENT>::nelement(); ielem++)
153  {
154  dynamic_cast<RefineableQElement<3>*>(
156  ->set_macro_elem_pt(this->Domain_pt->macro_element_pt(ielem));
157  }
158 
159 
160  // Setup Octree forest: Turn elements into individual octrees
161  // and plant in forest
162  Vector<TreeRoot*> trees_pt;
163  for (unsigned iel = 0; iel < TubeMesh<ELEMENT>::nelement(); iel++)
164  {
166  ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
167  OcTreeRoot* octree_root_pt = new OcTreeRoot(ref_el_pt);
168  trees_pt.push_back(octree_root_pt);
169  }
170  this->Forest_pt = new OcTreeForest(trees_pt);
171 
172 #ifdef PARANOID
173  // Run self test
174  unsigned success_flag =
175  dynamic_cast<OcTreeForest*>(this->Forest_pt)->self_test();
176  if (success_flag == 0)
177  {
178  oomph_info << "Successfully built octree forest " << std::endl;
179  }
180  else
181  {
182  throw OomphLibError("Trouble in building octree forest ",
185  }
186 #endif
187  }
188 
190  virtual ~RefineableTubeMesh() {}
191  };
192 
193 } // namespace oomph
194 #endif
Base class for brick meshes (meshes made of 3D brick elements).
Definition: brick_mesh.h:178
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:116
Definition: elements.h:1313
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: octree.h:928
Definition: octree.h:611
Definition: oomph_definitions.h:222
Definition: refineable_brick_mesh.h:61
Definition: refineable_brick_element.h:68
Definition: tube_mesh.template.h:127
RefineableTubeMesh(GeomObject *wall_pt, const Vector< double > &centreline_limits, const Vector< double > &theta_positions, const Vector< double > &radius_box, const unsigned &nlayer, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: tube_mesh.template.h:137
virtual ~RefineableTubeMesh()
Destructor: empty.
Definition: tube_mesh.template.h:190
Definition: timesteppers.h:231
TreeForest * Forest_pt
Forest representation of the mesh.
Definition: refineable_mesh.h:768
Definition: tube_domain.h:70
Definition: tube_mesh.template.h:57
GeomObject *& volume_pt()
Access function to GeomObject representing wall.
Definition: tube_mesh.template.h:80
TubeDomain * domain_pt() const
Access function to underlying domain.
Definition: tube_mesh.template.h:92
GeomObject * Volume_pt
Pointer to the geometric object that represents the curved wall.
Definition: tube_mesh.template.h:102
TubeMesh(GeomObject *wall_pt, const Vector< double > &centreline_limits, const Vector< double > &theta_positions, const Vector< double > &radius_box, const unsigned &nlayer, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Definition: tube_mesh.template.cc:40
TubeDomain * domain_pt()
Access function to domain.
Definition: tube_mesh.template.h:86
TubeDomain * Domain_pt
Pointer to domain.
Definition: tube_mesh.template.h:99
virtual ~TubeMesh()
Destructor: empty.
Definition: tube_mesh.template.h:74
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