BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_TensorMeshFactory.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,
4 * through 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_TENSORMESHFACTORY_HPP
13#define BELFEM_CL_TENSORMESHFACTORY_HPP
14
15#include "typedefs.hpp"
16#include "cl_Mesh.hpp"
17
18namespace belfem
19{
21 {
22 const TensorMeshConfig * mConfig = nullptr ;
23
24 Matrix< real > mTMatrix ;
25
26//------------------------------------------------------------------------------
27 public:
28//------------------------------------------------------------------------------
29
30 TensorMeshFactory() = default ;
31
32//------------------------------------------------------------------------------
33
34 ~TensorMeshFactory() = default ;
35
36//------------------------------------------------------------------------------
37
38 void
40 const TensorMeshConfig * aConfig,
41 Mesh * aMesh,
42 const proc_t aMasterProc = 0 );
43
44 void
46 const TensorMeshConfig * aConfig,
47 Matrix< index_t > & aTopology ) ;
48
49 void
51 const Vector< index_t > & aNumNodes,
52 const Vector< real > & aMinPoint,
53 const Vector< real > & aMaxPoint,
54 Matrix< real > & aGrid ) const ;
55
56 void
57 create_bsplines( Mesh * aMesh );
58
59 const Matrix< real > &
60 t_matrix( const TensorMeshConfig * aConfig = nullptr ) ;
61
62//------------------------------------------------------------------------------
63 private:
64//------------------------------------------------------------------------------
65
66 void
67 create_topology_quad4( const Vector< index_t > & aNumElems, Matrix< index_t > & aTopology ) const ;
68
69 void
70 create_topology_quad9( const Vector< index_t > & aNumElems, Matrix< index_t > & aTopology ) const ;
71
72 void
73 create_topology_quad16( const Vector< index_t > & aNumElems, Matrix< index_t > & aTopology ) const ;
74
75 void
76 create_topology_hex8( const Vector< index_t > & aNumElems, Matrix< index_t > & aTopology ) const ;
77
78 void
79 create_topology_hex27( const Vector< index_t > & aNumElems, Matrix< index_t > & aTopology ) const ;
80
81 void
82 create_topology_hex64( const Vector< index_t > & aNumElems, Matrix< index_t > & aTopology ) const;
83
84 void
85 create_bsplines_quad9( const TensorMeshConfig * aConfig, Cell< mesh::ControlPoint * > & aPoints );
86
87 void
88 create_bsplines_quad16( const TensorMeshConfig * aConfig, Cell< mesh::ControlPoint * > & aPoints );
89
90 void
91 create_bsplines_hex27( const TensorMeshConfig * aConfig, Cell< mesh::ControlPoint * > & aPoints );
92
93 void
94 create_bsplines_hex64( const TensorMeshConfig * aConfig, Cell< mesh::ControlPoint * > & aPoints );
95
96 void
97 link_bsplines_quad9(
98 const TensorMeshConfig * aConfig,
100 Cell< mesh::Element * > & aElements );
101
102 void
103 link_bsplines_quad16(
104 const TensorMeshConfig * aConfig,
106 Cell< mesh::Element * > & aElements );
107
108 void
109 link_bsplines_hex27(
110 const TensorMeshConfig * aConfig,
112 Cell< mesh::Element * > & aElements );
113
114 void
115 link_bsplines_hex64(
116 const TensorMeshConfig * aConfig,
118 Cell< mesh::Element * > & aElements );
119
120
121 index_t
122 nidx( const index_t i, const index_t j ) const;
123
124 index_t
125 nidx( const index_t i, const index_t j, const index_t k ) const;
126
127 index_t
128 bidx( const index_t p, const index_t q ) const;
129
130 index_t
131 bidx( const index_t p, const index_t q, const index_t r ) const;
132
133 void
134 compute_tmatrix_quad4();
135
136 void
137 compute_tmatrix_quad9();
138
139 void
140 compute_tmatrix_quad16();
141
142 void
143 compute_tmatrix_hex8();
144
145 void
146 compute_tmatrix_hex27();
147
148 void
149 compute_tmatrix_hex64();
150
151 void
152 bspline_quad( const real xi, Vector< real > & aResult );
153
154 void
155 bspline_cub( const real xi, Vector< real > & aResult );
156
157 void
158 connect_nodes_to_bsplines( Mesh * aMesh );
159
160 };
161
162 inline index_t
163 TensorMeshFactory::nidx( const index_t i, const index_t j ) const
164 {
165 return i * mConfig->num_nodes( 1 ) + j ;
166 }
167
168 inline index_t
169 TensorMeshFactory::nidx( const index_t i, const index_t j, const index_t k ) const
170 {
171 return mConfig->num_nodes( 2 ) *
172 ( i * mConfig->num_nodes( 1 ) + j ) + k ;
173 }
174
175 inline index_t
176 TensorMeshFactory::bidx( const index_t p, const index_t q ) const
177 {
178 return p * mConfig->num_control_points( 1 ) + q ;
179 }
180
181 inline index_t
182 TensorMeshFactory::bidx( const index_t p, const index_t q, const index_t r ) const
183 {
184 return mConfig->num_control_points( 2 ) *
185 ( p * mConfig->num_control_points( 1 ) + q ) + r ;
186 }
187
188}
189
190#endif //BELFEM_CL_TENSORMESHFACTORY_HPP
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
Definition cl_TensorMeshConfig.hpp:22
uint num_nodes(const uint aDimension=BELFEM_UINT_MAX) const
Definition cl_TensorMeshConfig.hpp:102
void create_topology(const TensorMeshConfig *aConfig, Matrix< index_t > &aTopology)
Definition cl_TensorMeshFactory.cpp:95
void create_grid(const Vector< index_t > &aNumNodes, const Vector< real > &aMinPoint, const Vector< real > &aMaxPoint, Matrix< real > &aGrid) const
Definition cl_TensorMeshFactory.cpp:139
void populate_tensor_mesh(const TensorMeshConfig *aConfig, Mesh *aMesh, const proc_t aMasterProc=0)
Definition cl_TensorMeshFactory.cpp:21
void create_bsplines(Mesh *aMesh)
Definition cl_TensorMeshFactory.cpp:207
const Matrix< real > & t_matrix(const TensorMeshConfig *aConfig=nullptr)
Definition cl_TensorMeshFactory.cpp:1264
USER GUIDES:
Definition cl_Capacitor.cpp:16
int proc_t
Definition commtypes.hpp:29
@ q
Definition cl_Material.hpp:176
uint32_t index_t
Definition typedefs.hpp:52
double real
Definition typedefs.hpp:36
r
Definition test_curve_frame.py:118
p
Definition test_curve_frame.py:64