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-2023 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
71 Domain* Domain_pt;
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)
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
110 OcTreeRoot::setup_static_data();
111 for (unsigned e = 0; e < nel; e++)
112 {
114 ELEMENT* ref_el_pt = dynamic_cast<ELEMENT*>(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
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.
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.
/////////////////////////////////////////////////////////////////// /////////////////////////////////...
////////////////////////////////////////////////////////////////////// //////////////////////////////...