eighth_sphere_mesh.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-2025 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
32#include "generic/domain.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 /// Destructor
63 {
64 delete Domain_pt;
65 Domain_pt = 0;
66 }
67
68 protected:
69 /// Pointer to the domain
71
72 /// Radius of the sphere
73 double Radius;
74 };
75
76 //======================================================================
77 /// Refineable version of the eight of a sphere brick mesh.
78 /// The eighth-sphere is located in the positive octant,
79 /// centred at the origin. The mesh boundaries are numbered
80 /// as follows:
81 /// - Boundary 0: Plane x=0
82 /// - Boundary 1: Plane y=0
83 /// - Boundary 2: Plane z=0
84 /// - Boundary 3: The surface of the sphere.
85 //======================================================================
86 template<class ELEMENT>
88 public virtual RefineableBrickMesh<ELEMENT>
89 {
90 public:
91 /// Constructor: Pass radius and timestepper; defaults to
92 /// static default timestepper
94 const double& radius,
95 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
96 : EighthSphereMesh<ELEMENT>(radius, time_stepper_pt)
97 {
98 // Loop over all elements and set macro element pointer
99 unsigned nel = this->nelement();
100 for (unsigned ielem = 0; ielem < nel; ielem++)
101 {
102 dynamic_cast<RefineableQElement<3>*>(this->element_pt(ielem))
103 ->set_macro_elem_pt(this->Domain_pt->macro_element_pt(ielem));
104 }
105
106 // Associate the elements with octrees and plant in forest
107 Vector<TreeRoot*> tree_pt;
109 for (unsigned e = 0; e < nel; e++)
110 {
112 ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(el_pt);
114 tree_pt.push_back(octree_root_pt);
115 }
116
117 // Plant in forest
118 this->Forest_pt = new OcTreeForest(tree_pt);
119
120#ifdef PARANOID
121 // Run self test on octree forest
122 dynamic_cast<OcTreeForest*>(this->Forest_pt)->self_test();
123#endif
124 }
125 };
126
127} // namespace oomph
128
130#endif
e
Definition cfortran.h:571
Base class for brick meshes (meshes made of 3D brick elements).
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...
Domain * Domain_pt
Pointer to the domain.
double Radius
Radius of the sphere.
A general Finite Element class.
Definition elements.h:1317
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:477
const Vector< GeneralisedElement * > & element_pt() const
Return reference to the Vector of elements.
Definition mesh.h:464
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:598
An OcTreeForest consists of a collection of OcTreeRoots. Each member tree can have neighbours to its ...
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.
TAdvectionDiffusionReactionElement<NREAGENT,DIM,NNODE_1D> elements are isoparametric triangular DIM-d...
Base class for time-stepping schemes. Timestepper provides an approximation of the temporal derivativ...
TreeForest * Forest_pt
Forest representation of the mesh.
DRAIG: Change all instances of (SPATIAL_DIM) to (DIM-1).