BELFEM
0.9.0
Berkeley Lab Finite Element Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
cl_IF_ElementMapper.hpp
Go to the documentation of this file.
1
/*
2
* BELFEM -- The Berkeley Lab Finite Element Framework
3
* Copyright (c) 2026, The Regents of the University of California, through
4
* Lawrence Berkeley National Laboratory (subject to receipt of any required
5
* approvals from the U.S. Dept. of Energy). All rights reserved.
6
*
7
* Developers: Christian Messe, Gregory Giard
8
*
9
* See the top-level LICENSE file for the complete license and disclaimer.
10
*/
11
12
#ifndef BELFEM_CL_IF_ELEMENTMAPPER_HPP
13
#define BELFEM_CL_IF_ELEMENTMAPPER_HPP
14
15
#include "
cl_Element.hpp
"
16
#include "
cl_Map.hpp
"
17
#include "
cl_IF_InterpolationFunction.hpp
"
18
#include "
cl_IF_InterpolationFunctionFactory.hpp
"
19
20
namespace
belfem
21
{
22
namespace
fem
23
{
31
class
ElementMapper
32
{
33
//------------------------------------------------------------------------------
34
private
:
35
//------------------------------------------------------------------------------
36
37
ElementType
mElementType =
ElementType::UNDEFINED
;
38
39
InterpolationFunctionFactory
* mFactory ;
40
Map< ElementType, InterpolationFunction * >
mFunctions ;
41
42
Matrix< real >
mX ;
// node coordinates ( <num nodes> x <spatial dim> )
43
Matrix< real >
mJ ;
// jacobian ( <natural dim> x <natural dim> )
44
Matrix< real >
mInvJ ;
// jacobian inverse ( <natural dim> x <natural dim> )
45
Matrix< real >
mA ;
// bilinear quad coefficients
46
// rows = {x, y}; cols = {1, xi, eta, xi*eta}
47
Matrix< real >
mN ;
// shape values ( 1 x <num nodes> )
48
Matrix< real >
mNxi ;
// shape derivatives ( <natural dim> x <num nodes> )
49
50
Vector< real >
mXi0 ;
// centroid seed for Newton
51
Vector< real >
mRHS ;
// residual / right-hand side
52
bool
mIsAffin = false ;
53
54
uint
mDim = 0 ;
// spatial dim of mX; 0 = auto-detect from element
55
56
mesh::Element
* mElement = nullptr ;
57
InterpolationFunction
* mFunction = nullptr ;
58
59
// dispatch: closed-form solver, initial guess, in-domain predicate
60
bool (
ElementMapper
::* mFunEval )(
const
Vector< real >
& aX,
Vector< real >
& aXi ) =
nullptr
;
61
bool (
ElementMapper
::* mFunGuess )(
const
Vector< real >
& aX,
Vector< real >
& aXi ) =
nullptr
;
62
bool (
ElementMapper
::* mFunCheck )(
const
Vector< real >
& aXi )
const
=
nullptr
;
63
64
//------------------------------------------------------------------------------
65
public
:
66
//------------------------------------------------------------------------------
67
71
ElementMapper
();
72
73
//------------------------------------------------------------------------------
74
78
~ElementMapper
();
79
80
//------------------------------------------------------------------------------
81
86
ElementMapper
(
const
ElementMapper
& ) = delete ;
87
ElementMapper
&
operator=
(
const
ElementMapper
& ) = delete ;
88
89
//------------------------------------------------------------------------------
90
98
void
99
link
(
mesh::Element
* aElement );
100
101
//------------------------------------------------------------------------------
102
115
bool
116
evaluate
(
const
Vector< real >
& aX,
Vector< real >
& aXi );
117
118
//------------------------------------------------------------------------------
119
125
void
126
set_dimension
(
const
uint
aDim );
127
128
//------------------------------------------------------------------------------
129
135
void
136
weights
(
const
Vector< real >
& aXi,
Vector< real >
& aWeights );
137
138
//------------------------------------------------------------------------------
139
private
:
140
//------------------------------------------------------------------------------
141
148
bool
149
evaluate_tri3(
const
Vector< real >
& aX,
Vector< real >
& aXi );
150
151
//------------------------------------------------------------------------------
152
159
bool
160
evaluate_quad4(
const
Vector< real >
& aX,
Vector< real >
& aXi );
161
162
//------------------------------------------------------------------------------
163
167
bool
168
evaluate_tet4(
const
Vector< real >
& aX,
Vector< real >
& aXi );
169
170
//------------------------------------------------------------------------------
171
177
bool
178
evaluate_general(
const
Vector< real >
& aX,
Vector< real >
& aXi );
179
180
//------------------------------------------------------------------------------
181
187
bool
188
guess_general(
const
Vector< real >
& aX,
Vector< real >
& aXi );
189
190
//------------------------------------------------------------------------------
191
196
bool
197
inside_tri(
const
Vector< real >
& aXi )
const
;
198
199
//------------------------------------------------------------------------------
200
205
bool
206
inside_quad(
const
Vector< real >
& aXi )
const
;
207
208
//------------------------------------------------------------------------------
209
214
bool
215
inside_tet(
const
Vector< real >
& aXi )
const
;
216
217
//------------------------------------------------------------------------------
218
223
bool
224
inside_penta(
const
Vector< real >
& aXi )
const
;
225
226
//------------------------------------------------------------------------------
227
232
bool
233
inside_pyra(
const
Vector< real >
& aXi )
const
;
234
235
//------------------------------------------------------------------------------
236
241
bool
242
inside_hex(
const
Vector< real >
& aXi )
const
;
243
244
//------------------------------------------------------------------------------
245
};
246
//------------------------------------------------------------------------------
247
}
/* end namespace fem */
248
}
/* end namespace belfem */
249
#endif
//BELFEM_CL_IF_ELEMENTMAPPER_HPP
cl_Element.hpp
cl_IF_InterpolationFunction.hpp
cl_IF_InterpolationFunctionFactory.hpp
cl_Map.hpp
belfem::Map
Hash map (unordered key-value).
Definition
cl_Map.hpp:75
belfem::Matrix< real >
belfem::Vector< real >
belfem::fem::ElementMapper::evaluate
bool evaluate(const Vector< real > &aX, Vector< real > &aXi)
solves x(xi) = aX for xi.
Definition
cl_IF_ElementMapper.cpp:192
belfem::fem::ElementMapper::weights
void weights(const Vector< real > &aXi, Vector< real > &aWeights)
computes the weights by evaluating the shape function
Definition
cl_IF_ElementMapper.cpp:451
belfem::fem::ElementMapper::ElementMapper
ElementMapper(const ElementMapper &)=delete
non-copyable: the class owns raw pointers (mFactory, cached InterpolationFunction*); copying would do...
belfem::fem::ElementMapper::set_dimension
void set_dimension(const uint aDim)
sets the spatial dimension of the physical coordinates.
Definition
cl_IF_ElementMapper.cpp:36
belfem::fem::ElementMapper::ElementMapper
ElementMapper()
constructor; allocates the interpolation-function factory owned by this mapper
Definition
cl_IF_ElementMapper.cpp:21
belfem::fem::ElementMapper::link
void link(mesh::Element *aElement)
binds the mapper to an element.
Definition
cl_IF_ElementMapper.cpp:44
belfem::fem::ElementMapper::operator=
ElementMapper & operator=(const ElementMapper &)=delete
belfem::fem::InterpolationFunctionFactory
Creates shape functions by element and interpolation type.
Definition
cl_IF_InterpolationFunctionFactory.hpp:22
belfem::fem::InterpolationFunction
the shape function base class
Definition
cl_IF_InterpolationFunction.hpp:24
belfem::fem
Definition
cl_IFB_LINE3.hpp:21
belfem
USER GUIDES:
Definition
cl_Capacitor.cpp:16
belfem::uint
unsigned int uint
Definition
typedefs.hpp:30
belfem::ElementType
ElementType
Element types.
Definition
Mesh_Enums.hpp:27
belfem::ElementType::UNDEFINED
@ UNDEFINED
Definition
Mesh_Enums.hpp:64
mesh.Element
Definition
Element.py:1
src
fem
interpolation
cl_IF_ElementMapper.hpp
Generated by
1.18.0