Toggle navigation
Documentation
Big picture
The finite element method
The data structure
Not-so-quick guide
Optimisation
Order of action functions
Example codes and tutorials
List of example codes and tutorials
Meshing
Solvers
MPI parallel processing
Post-processing/visualisation
Other
Change log
Creating documentation
Coding conventions
Index
FAQ
Get it
Installation guide
Get code from subversion repository
Get code as tar file
Copyright
About
People
Contact/Get involved
Publications
Acknowledgements
Picture show
Go
src
generic
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// 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
// Common base class for all BrickMeshes
31
32
#ifndef OOMPH_BRICKMESH_HEADER
33
#define OOMPH_BRICKMESH_HEADER
34
35
// Config header generated by autoconfig
36
#ifdef HAVE_CONFIG_H
37
#include <oomph-lib-config.h>
38
#endif
39
40
#ifdef OOMPH_HAS_MPI
41
//mpi headers
42
#include "mpi.h"
43
#endif
44
45
//oomphlib includes
46
#include "
Vector.h
"
47
#include "
nodes.h
"
48
#include "
matrices.h
"
49
#include "
mesh.h
"
50
#include "
Qelements.h
"
51
52
namespace
oomph
53
{
54
55
///////////////////////////////////////////////////////////////////////
56
///////////////////////////////////////////////////////////////////////
57
///////////////////////////////////////////////////////////////////////
58
59
60
//====================================================================
61
/// Helper namespace for generation of brick from tet mesh
62
//====================================================================
63
namespace
BrickFromTetMeshHelper
64
{
65
66
/// Tolerance for mismatch during setup of boundary coordinates
67
extern
double
Face_position_tolerance
;
68
69
}
70
71
72
///////////////////////////////////////////////////////////////////
73
///////////////////////////////////////////////////////////////////
74
///////////////////////////////////////////////////////////////////
75
76
77
78
//======================================================================
79
/// Dummy QElement to interpolate local coordinates -- used in
80
/// construction of brickified tet mesh.
81
//======================================================================
82
class
DummyBrickElement
:
public
virtual
QElement
<3,2>
83
{
84
85
public
:
86
87
88
///\short Constructor:
89
DummyBrickElement
() :
QElement
<3,2>()
90
{}
91
92
/// Broken copy constructor
93
DummyBrickElement
(
const
DummyBrickElement
& dummy)
94
{
95
BrokenCopy::broken_copy
(
"DummyElement"
);
96
}
97
98
/// Broken assignment operator
99
//Commented out broken assignment operator because this can lead to a conflict warning
100
//when used in the virtual inheritence hierarchy. Essentially the compiler doesn't
101
//realise that two separate implementations of the broken function are the same and so,
102
//quite rightly, it shouts.
103
/*void operator=(const DummyBrickElement&)
104
{
105
BrokenCopy::broken_assign("DummyBrickElement");
106
}*/
107
108
109
/// \short Required # of `values' (pinned or dofs)
110
/// at node n
111
inline
unsigned
required_nvalue
(
const
unsigned
&n)
const
112
{
return
3;}
113
114
115
/// \short Compute vector of FE interpolated local coordinate in tet,
116
/// s_tet, evaluated at local coordinate s in current element.
117
void
interpolated_s_tet
(
const
Vector<double>
&
s
,
Vector<double>
& s_tet)
const
118
{
119
//Find number of nodes
120
unsigned
n_node = nnode();
121
122
//Local shape function
123
Shape
psi(n_node);
124
125
//Find values of shape function
126
shape
(s,psi);
127
128
for
(
unsigned
i
=0;
i
<3;
i
++)
129
{
130
//Initialise value of u
131
s_tet[
i
] = 0.0;
132
133
//Loop over the local nodes and sum
134
for
(
unsigned
l=0;l<n_node;l++)
135
{
136
s_tet[
i
] += nodal_value(l,
i
)*psi[l];
137
}
138
}
139
}
140
141
/// Output interpolated tet local coordinates
142
void
output
(std::ostream &outfile,
const
unsigned
&nplot=5)
143
{
144
//Vector of local coordinates
145
Vector<double>
s
(3);
146
Vector<double>
s_tet(3);
147
148
// Tecplot header info
149
outfile << tecplot_zone_string(nplot);
150
151
// Loop over plot points
152
unsigned
num_plot_points=nplot_points(nplot);
153
for
(
unsigned
iplot=0;iplot<num_plot_points;iplot++)
154
{
155
156
// Get local coordinates of plot point
157
get_s_plot(iplot,nplot,s);
158
159
// Local coordinates in tet
160
interpolated_s_tet(s,s_tet);
161
162
// Coordinates
163
for
(
unsigned
i
=0;
i
<3;
i
++)
164
{
165
outfile << interpolated_x(s,
i
) <<
" "
;
166
}
167
168
// Local coordinates in tet
169
for
(
unsigned
i
=0;
i
<3;
i
++)
170
{
171
outfile << s_tet[
i
] <<
" "
;
172
}
173
174
outfile << std::endl;
175
}
176
outfile << std::endl;
177
178
// Write tecplot footer (e.g. FE connectivity lists)
179
write_tecplot_zone_footer(outfile,nplot);
180
181
}
182
183
184
185
186
};
187
188
///////////////////////////////////////////////////////////////////////////
189
///////////////////////////////////////////////////////////////////////////
190
///////////////////////////////////////////////////////////////////////////
191
192
193
194
//================================================================
195
/// Base class for brick meshes (meshes made of 3D brick elements).
196
//================================================================
197
class
BrickMeshBase
:
public
virtual
Mesh
198
{
199
200
public
:
201
202
/// Constructor (empty)
203
BrickMeshBase
() {}
204
205
206
/// Broken copy constructor
207
BrickMeshBase
(
const
BrickMeshBase
&)
208
{
209
BrokenCopy::broken_copy
(
"BrickMeshBase"
);
210
}
211
212
/// Broken assignment operator
213
/*void operator=(const BrickMeshBase&)
214
{
215
BrokenCopy::broken_assign("BrickMeshBase");
216
}*/
217
218
/// Destructor (empty)
219
virtual
~BrickMeshBase
(){}
220
221
/// Setup lookup schemes which establish whic elements are located
222
/// next to mesh's boundaries (wrapper to suppress doc).
223
void
setup_boundary_element_info
()
224
{
225
std::ofstream outfile;
226
setup_boundary_element_info(outfile);
227
}
228
229
/// \short Setup lookup schemes which establish whic elements are located
230
/// next to mesh's boundaries. Doc in outfile (if it's open).
231
void
setup_boundary_element_info(std::ostream &outfile);
232
233
};
234
235
}
236
237
#endif
238
matrices.h
oomph::BrickMeshBase::~BrickMeshBase
virtual ~BrickMeshBase()
Broken assignment operator.
Definition:
brick_mesh.h:219
oomph::BrickMeshBase::setup_boundary_element_info
void setup_boundary_element_info()
Definition:
brick_mesh.h:223
oomph::BrickMeshBase::BrickMeshBase
BrickMeshBase()
Constructor (empty)
Definition:
brick_mesh.h:203
oomph::BrokenCopy::broken_copy
void broken_copy(const std::string &class_name)
Issue error message and terminate execution.
Definition:
oomph_utilities.cc:107
oomph::BrickMeshBase::BrickMeshBase
BrickMeshBase(const BrickMeshBase &)
Broken copy constructor.
Definition:
brick_mesh.h:207
oomph::DummyBrickElement::DummyBrickElement
DummyBrickElement()
Constructor:
Definition:
brick_mesh.h:89
oomph::BrickMeshBase
Base class for brick meshes (meshes made of 3D brick elements).
Definition:
brick_mesh.h:197
i
cstr elem_len * i
Definition:
cfortran.h:607
oomph::DummyBrickElement
Definition:
brick_mesh.h:82
mesh.h
oomph::DummyBrickElement::required_nvalue
unsigned required_nvalue(const unsigned &n) const
Broken assignment operator.
Definition:
brick_mesh.h:111
oomph::DummyBrickElement::interpolated_s_tet
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:117
oomph
Definition:
advection_diffusion_elements.cc:33
oomph::Vector< double >
oomph::Shape
Definition:
shape.h:81
s
static char t char * s
Definition:
cfortran.h:572
oomph::OneDimLagrange::shape
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:549
Vector.h
nodes.h
Qelements.h
oomph::BrickFromTetMeshHelper::Face_position_tolerance
double Face_position_tolerance
Tolerance for mismatch during setup of boundary coordinates.
Definition:
brick_mesh.cc:43
oomph::DummyBrickElement::output
void output(std::ostream &outfile, const unsigned &nplot=5)
Output interpolated tet local coordinates.
Definition:
brick_mesh.h:142
oomph::QElement
Definition:
Qelements.h:485
oomph::DummyBrickElement::DummyBrickElement
DummyBrickElement(const DummyBrickElement &dummy)
Broken copy constructor.
Definition:
brick_mesh.h:93
oomph::Mesh
A general mesh class.
Definition:
mesh.h:74