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// 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_EIGHTH_SPHERE_MESH_HEADER
27#define OOMPH_EIGHTH_SPHERE_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
36// Include the headers file for domain
38
39namespace oomph
40{
41 //======================================================================
42 /// Eight of a sphere brick mesh, based on the EightSphereDomain
43 /// Non-refineable version with four brick elements.
44 /// The eighth-sphere is located in the positive octant,
45 /// centred at the origin. The mesh boundaries are numbered
46 /// as follows:
47 /// - Boundary 0: Plane x=0
48 /// - Boundary 1: Plane y=0
49 /// - Boundary 2: Plane z=0
50 /// - Boundary 3: The surface of the sphere.
51 //======================================================================
52 template<class ELEMENT>
53 class EighthSphereMesh : public virtual BrickMeshBase
54 {
55 public:
56 /// Constructor: Pass radius and timestepper; defaults to
57 /// static default timestepper
58 EighthSphereMesh(const double& radius,
59 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
60
61
62 /// Destructor
64 {
65 delete Domain_pt;
66 Domain_pt = 0;
67 }
68
69 protected:
70 /// Pointer to the domain
72
73 /// Radius of the sphere
74 double Radius;
75 };
76
77
78 //======================================================================
79 /// Refineable version of the eight of a sphere brick mesh.
80 /// The eighth-sphere is located in the positive octant,
81 /// centred at the origin. The mesh boundaries are numbered
82 /// as follows:
83 /// - Boundary 0: Plane x=0
84 /// - Boundary 1: Plane y=0
85 /// - Boundary 2: Plane z=0
86 /// - Boundary 3: The surface of the sphere.
87 //======================================================================
88 template<class ELEMENT>
90 public virtual RefineableBrickMesh<ELEMENT>
91 {
92 public:
93 /// Constructor: Pass radius and timestepper; defaults to
94 /// static default timestepper
96 const double& radius,
97 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
98 : EighthSphereMesh<ELEMENT>(radius, time_stepper_pt)
99 {
100 // Loop over all elements and set macro element pointer
101 unsigned nel = this->nelement();
102 for (unsigned ielem = 0; ielem < nel; ielem++)
103 {
104 dynamic_cast<RefineableQElement<3>*>(this->element_pt(ielem))
105 ->set_macro_elem_pt(this->Domain_pt->macro_element_pt(ielem));
106 }
107
108 // Associate the elements with octrees and plant in forest
109 Vector<TreeRoot*> tree_pt;
111 for (unsigned e = 0; e < nel; e++)
112 {
113 FiniteElement* el_pt = this->finite_element_pt(e);
114 ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
115 OcTreeRoot* octree_root_pt = new OcTreeRoot(ref_el_pt);
116 tree_pt.push_back(octree_root_pt);
117 }
118
119 // Plant in forest
120 this->Forest_pt = new OcTreeForest(tree_pt);
121
122#ifdef PARANOID
123 // Run self test on octree forest
124 dynamic_cast<OcTreeForest*>(this->Forest_pt)->self_test();
125#endif
126 }
127 };
128
129} // namespace oomph
130
131#endif
e
Definition: cfortran.h:571
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
Definition: brick_mesh.h:178
Base class for Domains with curvilinear and/or time-dependent boundaries. Domain boundaries are typic...
Definition: domain.h:67
MacroElement * macro_element_pt(const unsigned &i)
Access to i-th macro element.
Definition: domain.h:116
Eight of a sphere brick mesh, based on the EightSphereDomain Non-refineable version with four brick e...
EighthSphereMesh(const double &radius, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass radius and timestepper; defaults to static default timestepper.
Domain * Domain_pt
Pointer to the domain.
double Radius
Radius of the sphere.
A general Finite Element class.
Definition: elements.h:1313
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
unsigned long nelement() const
Return number of elements in the mesh.
Definition: mesh.h:590
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Definition: octree.h:928
OcTreeRoot is a OcTree that forms the root of a (recursive) octree. The "root node" is special as it ...
Definition: octree.h:611
static void setup_static_data()
Setup the static data, rotation and reflection schemes, etc.
Definition: octree.cc:1040
Intermediate mesh class that implements the mesh adaptation functions specified in the TreeBasedRefin...
Refineable version of the eight of a sphere brick mesh. The eighth-sphere is located in the positive ...
RefineableEighthSphereMesh(const double &radius, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass radius and timestepper; defaults to static default timestepper.
Refineable version of QElement<3,NNODE_1D>.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Definition: timesteppers.h:231
TreeForest * Forest_pt
Forest representation of the mesh.
A slight extension to the standard template vector class so that we can include "graceful" array rang...
Definition: Vector.h:58
//////////////////////////////////////////////////////////////////// ////////////////////////////////...