eighth_sphere_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: 1097 $
7 //LIC//
8 //LIC// $LastChangedDate: 2015-12-17 11:53:17 +0000 (Thu, 17 Dec 2015) $
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 #ifndef OOMPH_EIGHTH_SPHERE_MESH_HEADER
31 #define OOMPH_EIGHTH_SPHERE_MESH_HEADER
32 
33 // Headers
34 #include "../generic/refineable_brick_mesh.h"
35 #include "../generic/macro_element.h"
36 #include "../generic/domain.h"
37 #include "../generic/algebraic_elements.h"
38 #include "../generic/brick_mesh.h"
39 
40 //Include the headers file for domain
41 #include "eighth_sphere_domain.h"
42 
43 namespace oomph
44 {
45 
46 
47 //======================================================================
48 /// Eight of a sphere brick mesh, based on the EightSphereDomain
49 /// Non-refineable version with four brick elements.
50 /// The eighth-sphere is located in the positive octant,
51 /// centred at the origin. The mesh boundaries are numbered
52 /// as follows:
53 /// - Boundary 0: Plane x=0
54 /// - Boundary 1: Plane y=0
55 /// - Boundary 2: Plane z=0
56 /// - Boundary 3: The surface of the sphere.
57 //======================================================================
58 template<class ELEMENT>
59 class EighthSphereMesh : public virtual BrickMeshBase
60 {
61 
62 public:
63 
64  /// \short Constructor: Pass radius and timestepper; defaults to
65  /// static default timestepper
66  EighthSphereMesh(const double& radius, TimeStepper* time_stepper_pt=
68 
69 
70 protected :
71 
72  /// Pointer to the domain
74 
75  /// Radius of the sphere
76  double Radius;
77 
78 };
79 
80 
81 
82 
83 
84 //======================================================================
85 /// Refineable version of the eight of a sphere brick mesh.
86 /// The eighth-sphere is located in the positive octant,
87 /// centred at the origin. The mesh boundaries are numbered
88 /// as follows:
89 /// - Boundary 0: Plane x=0
90 /// - Boundary 1: Plane y=0
91 /// - Boundary 2: Plane z=0
92 /// - Boundary 3: The surface of the sphere.
93 //======================================================================
94 template<class ELEMENT>
96  public virtual RefineableBrickMesh<ELEMENT>
97  {
98 
99 public:
100 
101  /// \short Constructor: Pass radius and timestepper; defaults to
102  /// static default timestepper
103  RefineableEighthSphereMesh(const double& radius, TimeStepper* time_stepper_pt=
105  EighthSphereMesh<ELEMENT>(radius,time_stepper_pt)
106  {
107 
108  // Loop over all elements and set macro element pointer
109  unsigned nel=this->nelement();
110  for (unsigned ielem=0;ielem<nel;ielem++)
111  {
112  dynamic_cast<RefineableQElement<3>*>(this->element_pt(ielem))->
113  set_macro_elem_pt(this->Domain_pt->macro_element_pt(ielem));
114  }
115 
116  // Associate the elements with octrees and plant in forest
117  Vector<TreeRoot*> tree_pt;
119  for (unsigned e = 0; e<nel; e++)
120  {
121  FiniteElement* el_pt=this->finite_element_pt(e);
122  ELEMENT* ref_el_pt=dynamic_cast<ELEMENT*>(el_pt);
123  OcTreeRoot* octree_root_pt=new OcTreeRoot(ref_el_pt);
124  tree_pt.push_back(octree_root_pt);
125  }
126 
127  //Plant in forest
128  this->Forest_pt=new OcTreeForest(tree_pt);
129 
130 #ifdef PARANOID
131  // Run self test on octree forest
132  dynamic_cast<OcTreeForest*>(this->Forest_pt)->self_test();
133 #endif
134 
135  }
136 
137 };
138 
139 }
140 
141 #endif
static void setup_static_data()
Setup the static data, rotation and reflection schemes, etc.
Definition: octree.cc:866
Domain * Domain_pt
Pointer to the domain.
EighthSphereMesh(const double &radius, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass radius and timestepper; defaults to static default timestepper. ...
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors. ...
Definition: mesh.h:85
Base class for brick meshes (meshes made of 3D brick elements).
Definition: brick_mesh.h:197
FiniteElement * finite_element_pt(const unsigned &e) const
Upcast (downcast?) to FiniteElement (needed to access FiniteElement member functions).
Definition: mesh.h:477
double Radius
Radius of the sphere.
A general Finite Element class.
Definition: elements.h:1271
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:100
unsigned self_test()
Self-test: Check elements and nodes. Return 0 for OK.
Definition: mesh.cc:715
e
Definition: cfortran.h:575
TreeForest * Forest_pt
Forest representation of the mesh.
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:587
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition: mesh.h:470
RefineableEighthSphereMesh(const double &radius, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass radius and timestepper; defaults to static default timestepper. ...
Base class for Domains with curvilinear and/or time-dependent boundaries. Domain boundaries are typic...
Definition: domain.h:71
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
Definition: timesteppers.h:219