simple_cubic_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_SIMPLE_CUBIC_MESH_HEADER
27#define OOMPH_SIMPLE_CUBIC_MESH_HEADER
28
29// Config header generated by autoconfig
30#ifdef HAVE_CONFIG_H
31#include <oomph-lib-config.h>
32#endif
33
34// Include the OOMPH-LIB header files
35#include "../generic/mesh.h"
36#include "../generic/matrices.h"
37#include "../generic/brick_mesh.h"
38#include "../generic/refineable_brick_mesh.h"
39
40namespace oomph
41{
42 //=======================================================================
43 /// Simple cubic 3D Brick mesh class.
44 //=======================================================================
45 template<class ELEMENT>
46 class SimpleCubicMesh : public virtual BrickMeshBase
47 {
48 public:
49 /// Constructor: Pass number of elements in the x, y, and z
50 /// directions, and the corresponding dimensions. Assume that the back lower
51 /// left corner is located at (0,0,0) Timestepper defaults to Steady.
52 SimpleCubicMesh(const unsigned& nx,
53 const unsigned& ny,
54 const unsigned& nz,
55 const double& lx,
56 const double& ly,
57 const double& lz,
58 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
59 : Nx(nx),
60 Ny(ny),
61 Nz(nz),
62 Xmin(0.0),
63 Xmax(lx),
64 Ymin(0.0),
65 Ymax(ly),
66 Zmin(0.0),
67 Zmax(lz)
68 {
69 // Mesh can only be built with 3D Qelements.
70 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(3);
71
72 // Call the generic build function
73 build_mesh(time_stepper_pt);
74 }
75
76 /// Constructor: Pass the number of elements in the x,y and z
77 /// directions and the correspoding minimum and maximum values of the
78 /// coordinates in each direction
79 SimpleCubicMesh(const unsigned& nx,
80 const unsigned& ny,
81 const unsigned& nz,
82 const double& xmin,
83 const double& xmax,
84 const double& ymin,
85 const double& ymax,
86 const double& zmin,
87 const double& zmax,
88 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
89 : Nx(nx),
90 Ny(ny),
91 Nz(nz),
92 Xmin(xmin),
93 Xmax(xmax),
94 Ymin(ymin),
95 Ymax(ymax),
96 Zmin(zmin),
97 Zmax(zmax)
98 {
99 // Mesh can only be built with 3D Qelements.
100 MeshChecker::assert_geometric_element<QElementGeometricBase, ELEMENT>(3);
101
102 // Call the generic mesh constructor
103 build_mesh(time_stepper_pt);
104 }
105
106
107 /// Access function for number of elements in x directions
108 const unsigned& nx() const
109 {
110 return Nx;
111 }
112
113 /// Access function for number of elements in y directions
114 const unsigned& ny() const
115 {
116 return Ny;
117 }
118
119 /// Access function for number of elements in y directions
120 const unsigned& nz() const
121 {
122 return Nz;
123 }
124
125 protected:
126 /// Number of elements in x direction
127 unsigned Nx;
128
129 /// Number of elements in y direction
130 unsigned Ny;
131
132 /// Number of elements in y direction
133 unsigned Nz;
134
135 /// Minimum value of x coordinate
136 double Xmin;
137
138 /// Maximum value of x coordinate
139 double Xmax;
140
141 /// Minimum value of y coordinate
142 double Ymin;
143
144 /// Minimum value of y coordinate
145 double Ymax;
146
147 /// Minimum value of z coordinate
148 double Zmin;
149
150 /// Maximum value of z coordinate
151 double Zmax;
152
153 /// Generic mesh construction function: contains all the hard work
154 void build_mesh(TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper);
155 };
156
157
158 /// /////////////////////////////////////////////////////////////////////////
159 /// /////////////////////////////////////////////////////////////////////////
160 /// /////////////////////////////////////////////////////////////////////////
161
162
163 //=======================================================================
164 /// Refineable version of simple cubic 3D Brick mesh class.
165 //=======================================================================
166 template<class ELEMENT>
167 class RefineableSimpleCubicMesh : public virtual SimpleCubicMesh<ELEMENT>,
168 public virtual RefineableBrickMesh<ELEMENT>
169 {
170 public:
171 /// Constructor: Pass number of elements in the x, y, and z
172 /// directions, and the corresponding dimensions. Assume that the back lower
173 /// left corner is located at (0,0,0) Timestepper defaults to Steady.
175 const unsigned& nx,
176 const unsigned& ny,
177 const unsigned& nz,
178 const double& lx,
179 const double& ly,
180 const double& lz,
181 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
182 : SimpleCubicMesh<ELEMENT>(nx, ny, nz, lx, ly, lz, time_stepper_pt)
183 {
184 // Nodal positions etc. were created in constructor for
185 // base class Only need to setup octree forest
186 this->setup_octree_forest();
187 }
188
189
190 /// Constructor: Pass the number of elements in the x,y and z
191 /// directions and the correspoding minimum and maximum values of the
192 /// coordinates in each direction.
194 const unsigned& nx,
195 const unsigned& ny,
196 const unsigned& nz,
197 const double& xmin,
198 const double& xmax,
199 const double& ymin,
200 const double& ymax,
201 const double& zmin,
202 const double& zmax,
203 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
204 : SimpleCubicMesh<ELEMENT>(
205 nx, ny, nz, xmin, xmax, ymin, ymax, zmin, zmax, time_stepper_pt)
206 {
207 // Nodal positions etc. were created in constructor for
208 // base class Only need to setup octree forest
209 this->setup_octree_forest();
210 }
211 };
212
213
214} // namespace oomph
215
216#endif
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
Definition: brick_mesh.h:178
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
Definition: mesh.h:75
Intermediate mesh class that implements the mesh adaptation functions specified in the TreeBasedRefin...
void setup_octree_forest()
Do what it says...
///////////////////////////////////////////////////////////////////////// ///////////////////////////...
RefineableSimpleCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const double &zmin, const double &zmax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass the number of elements in the x,y and z directions and the correspoding minimum and...
RefineableSimpleCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &lx, const double &ly, const double &lz, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in the x, y, and z directions, and the corresponding dimensions....
Simple cubic 3D Brick mesh class.
unsigned Ny
Number of elements in y direction.
const unsigned & nx() const
Access function for number of elements in x directions.
SimpleCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &xmin, const double &xmax, const double &ymin, const double &ymax, const double &zmin, const double &zmax, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass the number of elements in the x,y and z directions and the correspoding minimum and...
const unsigned & nz() const
Access function for number of elements in y directions.
unsigned Nz
Number of elements in y direction.
SimpleCubicMesh(const unsigned &nx, const unsigned &ny, const unsigned &nz, const double &lx, const double &ly, const double &lz, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of elements in the x, y, and z directions, and the corresponding dimensions....
double Ymax
Minimum value of y coordinate.
double Ymin
Minimum value of y coordinate.
const unsigned & ny() const
Access function for number of elements in y directions.
unsigned Nx
Number of elements in x direction.
double Xmin
Minimum value of x coordinate.
void build_mesh(TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Generic mesh construction function: contains all the hard work.
double Zmax
Maximum value of z coordinate.
double Zmin
Minimum value of z coordinate.
double Xmax
Maximum value of x coordinate.
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Definition: timesteppers.h:231
//////////////////////////////////////////////////////////////////// ////////////////////////////////...