brick_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-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// Common base class for all BrickMeshes
27
28#ifndef OOMPH_BRICKMESH_HEADER
29#define OOMPH_BRICKMESH_HEADER
30
31// Config header generated by autoconfig
32#ifdef HAVE_CONFIG_H
33#include <oomph-lib-config.h>
34#endif
35
36#ifdef OOMPH_HAS_MPI
37// mpi headers
38#include "mpi.h"
39#endif
40
41// oomphlib includes
42#include "Vector.h"
43#include "nodes.h"
44#include "matrices.h"
45#include "mesh.h"
46#include "Qelements.h"
47
48namespace oomph
49{
50 /// ////////////////////////////////////////////////////////////////////
51 /// ////////////////////////////////////////////////////////////////////
52 /// ////////////////////////////////////////////////////////////////////
53
54
55 //====================================================================
56 /// Helper namespace for generation of brick from tet mesh
57 //====================================================================
58 namespace BrickFromTetMeshHelper
59 {
60 /// Tolerance for mismatch during setup of boundary coordinates
61 extern double Face_position_tolerance;
62
63 } // namespace BrickFromTetMeshHelper
64
65
66 /// ////////////////////////////////////////////////////////////////
67 /// ////////////////////////////////////////////////////////////////
68 /// ////////////////////////////////////////////////////////////////
69
70
71 //======================================================================
72 /// Dummy QElement to interpolate local coordinates -- used in
73 /// construction of brickified tet mesh.
74 //======================================================================
75 class DummyBrickElement : public virtual QElement<3, 2>
76 {
77 public:
78 /// Constructor:
80
81 /// Broken copy constructor
82 DummyBrickElement(const DummyBrickElement& dummy) = delete;
83
84 /// Broken assignment operator
85 // Commented out broken assignment operator because this can lead to a
86 // conflict warning when used in the virtual inheritence hierarchy.
87 // Essentially the compiler doesn't realise that two separate
88 // implementations of the broken function are the same and so, quite
89 // rightly, it shouts.
90 /*void operator=(const DummyBrickElement&) = delete;*/
91
92
93 /// Required # of `values' (pinned or dofs)
94 /// at node n
95 inline unsigned required_nvalue(const unsigned& n) const
96 {
97 return 3;
98 }
99
100
101 /// Compute vector of FE interpolated local coordinate in tet,
102 /// s_tet, evaluated at local coordinate s in current element.
104 Vector<double>& s_tet) const
105 {
106 // Find number of nodes
107 unsigned n_node = nnode();
108
109 // Local shape function
110 Shape psi(n_node);
111
112 // Find values of shape function
113 shape(s, psi);
114
115 for (unsigned i = 0; i < 3; i++)
116 {
117 // Initialise value of u
118 s_tet[i] = 0.0;
119
120 // Loop over the local nodes and sum
121 for (unsigned l = 0; l < n_node; l++)
122 {
123 s_tet[i] += nodal_value(l, i) * psi[l];
124 }
125 }
126 }
127
128 /// Output interpolated tet local coordinates
129 void output(std::ostream& outfile, const unsigned& nplot = 5)
130 {
131 // Vector of local coordinates
132 Vector<double> s(3);
133 Vector<double> s_tet(3);
134
135 // Tecplot header info
136 outfile << tecplot_zone_string(nplot);
137
138 // Loop over plot points
139 unsigned num_plot_points = nplot_points(nplot);
140 for (unsigned iplot = 0; iplot < num_plot_points; iplot++)
141 {
142 // Get local coordinates of plot point
143 get_s_plot(iplot, nplot, s);
144
145 // Local coordinates in tet
146 interpolated_s_tet(s, s_tet);
147
148 // Coordinates
149 for (unsigned i = 0; i < 3; i++)
150 {
151 outfile << interpolated_x(s, i) << " ";
152 }
153
154 // Local coordinates in tet
155 for (unsigned i = 0; i < 3; i++)
156 {
157 outfile << s_tet[i] << " ";
158 }
159
160 outfile << std::endl;
161 }
162 outfile << std::endl;
163
164 // Write tecplot footer (e.g. FE connectivity lists)
165 write_tecplot_zone_footer(outfile, nplot);
166 }
167 };
168
169 /// ////////////////////////////////////////////////////////////////////////
170 /// ////////////////////////////////////////////////////////////////////////
171 /// ////////////////////////////////////////////////////////////////////////
172
173
174 //================================================================
175 /// Base class for brick meshes (meshes made of 3D brick elements).
176 //================================================================
177 class BrickMeshBase : public virtual Mesh
178 {
179 public:
180 /// Constructor (empty)
182
183
184 /// Broken copy constructor
185 BrickMeshBase(const BrickMeshBase&) = delete;
186
187 /// Broken assignment operator
188 /*void operator=(const BrickMeshBase&) = delete;*/
189
190 /// Destructor (empty)
191 virtual ~BrickMeshBase() {}
192
193 /// Setup lookup schemes which establish whic elements are located
194 /// next to mesh's boundaries (wrapper to suppress doc).
196 {
197 std::ofstream outfile;
199 }
200
201 /// Setup lookup schemes which establish whic elements are located
202 /// next to mesh's boundaries. Doc in outfile (if it's open).
203 void setup_boundary_element_info(std::ostream& outfile);
204 };
205
206} // namespace oomph
207
208#endif
static char t char * s
Definition: cfortran.h:568
cstr elem_len * i
Definition: cfortran.h:603
//////////////////////////////////////////////////////////////////////// ////////////////////////////...
Definition: brick_mesh.h:178
BrickMeshBase(const BrickMeshBase &)=delete
Broken copy constructor.
void setup_boundary_element_info()
Setup lookup schemes which establish whic elements are located next to mesh's boundaries (wrapper to ...
Definition: brick_mesh.h:195
BrickMeshBase()
Constructor (empty)
Definition: brick_mesh.h:181
virtual ~BrickMeshBase()
Broken assignment operator.
Definition: brick_mesh.h:191
//////////////////////////////////////////////////////////////// ////////////////////////////////////...
Definition: brick_mesh.h:76
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
Definition: brick_mesh.h:95
void interpolated_s_tet(const Vector< double > &s, Vector< double > &s_tet) const
Compute vector of FE interpolated local coordinate in tet, s_tet, evaluated at local coordinate s in ...
Definition: brick_mesh.h:103
DummyBrickElement(const DummyBrickElement &dummy)=delete
Broken copy constructor.
DummyBrickElement()
Constructor:
Definition: brick_mesh.h:79
void output(std::ostream &outfile, const unsigned &nplot=5)
Output interpolated tet local coordinates.
Definition: brick_mesh.h:129
A general mesh class.
Definition: mesh.h:67
/////////////////////////////////////////////////////////////////////// /////////////////////////////...
Definition: Qelements.h:459
A Class for shape functions. In simple cases, the shape functions have only one index that can be tho...
Definition: shape.h:76
double Face_position_tolerance
Tolerance for mismatch during setup of boundary coordinates.
Definition: brick_mesh.cc:37
void shape(const double &s, double *Psi)
Definition for 1D Lagrange shape functions. The value of all the shape functions at the local coordin...
Definition: shape.h:564
//////////////////////////////////////////////////////////////////// ////////////////////////////////...