simple_cubic_tet_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_TET_MESH_HEADER
27#define OOMPH_SIMPLE_CUBIC_TET_MESH_HEADER
28
29#include "../generic/Telements.h"
30#include "../generic/tet_mesh.h"
31#include "../generic/simple_cubic_scaffold_tet_mesh.h"
32
33namespace oomph
34{
35 //===================================================================
36 /// MySimple 3D tet mesh for TElements
37 //===================================================================
38 template<class ELEMENT>
40 {
41 public:
42 /// Constructor: Pass number of element blocks
43 /// in the x, y and z directions and the corresponding dimensions.
44 /// Timestepper defaults to Steady.
46 const unsigned& n_x,
47 const unsigned& n_y,
48 const unsigned& n_z,
49 const double& l_x,
50 const double& l_y,
51 const double& l_z,
52 TimeStepper* time_stepper_pt = &Mesh::Default_TimeStepper)
53 {
54 // Mesh can only be built with 3D Telements.
55 MeshChecker::assert_geometric_element<TElementGeometricBase, ELEMENT>(3);
56
57
58 std::ostringstream warn_message;
59 warn_message
60 << "Note: The SimpleCubicTetMesh() is quite inefficient.\n"
61 << " If your code takes a long time in the constructor\n"
62 << " consider using another tet mesh\n";
63 OomphLibWarning(warn_message.str(),
64 "SimpleCubicTetMesh::SimpleCubicTetMesh()",
65 OOMPH_EXCEPTION_LOCATION);
66 oomph_info << "Starting mesh construction..." << std::endl;
67 double start_t = TimingHelpers::timer();
68
69 // Build scaffold mesh
71 new SimpleCubicScaffoldTetMesh(n_x, n_y, n_z, l_x, l_y, l_z);
72
73 // Build actual mesh from scaffold mesh
74 build_from_scaffold(time_stepper_pt);
75
76 delete Tmp_mesh_pt;
77
78 double end_t = TimingHelpers::timer();
79 oomph_info << "...finished mesh construction. Total time [sec] "
80 << end_t - start_t << std::endl;
81 }
82
83
84 private:
85 /// Build mesh from scaffold mesh
86 void build_from_scaffold(TimeStepper* time_stepper_pt);
87
88 /// Temporary scaffold mesh
90 };
91
92} // namespace oomph
93
94#endif
A general mesh class.
Definition: mesh.h:67
static Steady< 0 > Default_TimeStepper
Default Steady Timestepper, to be used in default arguments to Mesh constructors.
Definition: mesh.h:75
An OomphLibWarning object which should be created as a temporary object to issue a warning....
MySimple 3D tet mesh for TElements.
Mesh * Tmp_mesh_pt
Temporary scaffold mesh.
void build_from_scaffold(TimeStepper *time_stepper_pt)
Build mesh from scaffold mesh.
SimpleCubicTetMesh(const unsigned &n_x, const unsigned &n_y, const unsigned &n_z, const double &l_x, const double &l_y, const double &l_z, TimeStepper *time_stepper_pt=&Mesh::Default_TimeStepper)
Constructor: Pass number of element blocks in the x, y and z directions and the corresponding dimensi...
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
Definition: tet_mesh.h:661
////////////////////////////////////////////////////////////////////// //////////////////////////////...
Definition: timesteppers.h:231
double timer()
returns the time in seconds after some point in past
//////////////////////////////////////////////////////////////////// ////////////////////////////////...
OomphInfo oomph_info
Single (global) instantiation of the OomphInfo object – this is used throughout the library as a "rep...