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