BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_FEM_KernelParameters.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_FEM_KERNELPARAMETERS_HPP
13#define BELFEM_CL_FEM_KERNELPARAMETERS_HPP
14
15#include "typedefs.hpp"
16#include "cl_Mesh.hpp"
18#include "en_SolverEnums.hpp"
19
20namespace belfem
21{
22 namespace fem
23 {
24//------------------------------------------------------------------------------
25
26 class Kernel ;
27
29 {
30 // rank of this proc
31 const proc_t mCommRank;
32 const proc_t mCommSize;
33
34 Kernel * mKernel ;
35
36 // the mesh that is associated with this kernel
37 Mesh * mMesh ;
38
39 // List of Blocks that contribute to this Kernel ( Block Indices ) ( default: all )
40 Vector< index_t > mBlockIndices;
41
42 // List of Sidesets that contribute to this Kernel ( Side Indices ) ( default: none )
43 Vector< index_t > mSidesetIndices ;
44
45 // ids of blocks that contribute to this kernel ( default : none -- set by select_blocks(); only the indices above default to all )
46 Vector< id_t > mBlockIDs ;
47
48 Vector< id_t > mSideSetIDs ;
49
50 const uint mZero = 0 ;
51
52 // default integration scheme for quad and hex elements
53 IntegrationScheme mIntegrationScheme = IntegrationScheme::GAUSS ;
54
55 // must be set to SCOTCH or METIS
56 ReorderingMethod mReorderingMethod = ReorderingMethod::METIS ;
57
58 // flag telling if we use metis to create the partitioning
59 bool mAutoPartition = true ;
60
61//------------------------------------------------------------------------------
62 public:
63//------------------------------------------------------------------------------
64
65 KernelParameters( Mesh & aMesh );
66
67//------------------------------------------------------------------------------
68
69 KernelParameters( Mesh * aMesh );
70
71//------------------------------------------------------------------------------
72
73 KernelParameters( Kernel * aKernel );
74
75//------------------------------------------------------------------------------
76
77 ~KernelParameters() = default;
78
79//------------------------------------------------------------------------------
80
84 Mesh *
85 mesh();
86
87//------------------------------------------------------------------------------
88
92 proc_t
93 number_of_procs() const;
94
95//------------------------------------------------------------------------------
96
100 const proc_t &
101 master();
102
103//------------------------------------------------------------------------------
104
111 void
112 select_blocks( const Vector< id_t > & aBlockIDs );
113
114 void
115 select_blocks( const Cell< id_t > & aBlockIDs );
116
117 void
118 select_sidesets( const Vector< id_t > & aSidesetIDs );
119
120 void
121 select_sidesets( const Cell< id_t > & aSidesetIDs );
122
123//------------------------------------------------------------------------------
124
128 const Vector< index_t > &
129 block_indices() const ;
130
131//------------------------------------------------------------------------------
132
136 const Vector< id_t > &
137 selected_blocks() const ;
138
139 //------------------------------------------------------------------------------
140
144 const Vector< index_t > &
145 sideset_indices() const ;
146
147//------------------------------------------------------------------------------
148
152 const Vector< id_t > &
153 selected_sidesets() const ;
154
155//------------------------------------------------------------------------------
156
157 void
158 set_integration_scheme( const IntegrationScheme & aIntegrationScheme ) ;
159
160//------------------------------------------------------------------------------
161
162 const IntegrationScheme &
163 integration_scheme() const ;
164
165//------------------------------------------------------------------------------
166
167 bool
168 auto_partition() const ;
169
170//------------------------------------------------------------------------------
171
172 void
173 set_auto_partition( const bool aFlag );
174
175//------------------------------------------------------------------------------
176
177 Kernel *
178 kernel() ;
179
180//------------------------------------------------------------------------------
181
183 reordering_method() const ;
184
185 void
187
188//------------------------------------------------------------------------------
189 private:
190//------------------------------------------------------------------------------
191
196 void
197 init_defaults();
198
199//------------------------------------------------------------------------------
200 };
201//------------------------------------------------------------------------------
202
203
204 inline proc_t
206 {
207 return mCommSize;
208 }
209
210//------------------------------------------------------------------------------
211
212 inline const proc_t &
214 {
215 return mMesh->master();
216 }
217
218//------------------------------------------------------------------------------
219
220 inline const Vector< index_t > &
222 {
223 return mBlockIndices ;
224 }
225
226//------------------------------------------------------------------------------
227
228 inline const Vector< id_t > &
230 {
231 return mBlockIDs ;
232 }
233
234 inline const Vector< index_t > &
236 {
237 return mSidesetIndices ;
238 }
239
240//------------------------------------------------------------------------------
241
242 inline const Vector< id_t > &
244 {
245 return mSideSetIDs ;
246 }
247
248//------------------------------------------------------------------------------
249
250 inline const IntegrationScheme &
252 {
253 return mIntegrationScheme ;
254 }
255
256//------------------------------------------------------------------------------
257
258 inline bool
260 {
261 return mAutoPartition ;
262 }
263
264//------------------------------------------------------------------------------
265
266 inline ReorderingMethod
268 {
269 return mReorderingMethod ;
270 }
271
272//------------------------------------------------------------------------------
273 }
274}
275#endif //BELFEM_CL_FEM_KERNELPARAMETERS_HPP
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
Top-level orchestrator; owns the mesh, materials, boundary conditions and DOF managers.
Definition cl_FEM_Kernel.hpp:50
const Vector< index_t > & block_indices() const
return the indices of the selected blocks
Definition cl_FEM_KernelParameters.hpp:221
Kernel * kernel()
Definition cl_FEM_KernelParameters.cpp:200
const Vector< id_t > & selected_blocks() const
return the ids of the selected blocks
Definition cl_FEM_KernelParameters.hpp:229
void select_blocks(const Vector< id_t > &aBlockIDs)
Select the IDs of the blocks that are to be used.
Definition cl_FEM_KernelParameters.cpp:77
KernelParameters(Mesh &aMesh)
Definition cl_FEM_KernelParameters.cpp:24
bool auto_partition() const
Definition cl_FEM_KernelParameters.hpp:259
ReorderingMethod reordering_method() const
Definition cl_FEM_KernelParameters.hpp:267
proc_t number_of_procs() const
return the number of procs that contribute to this kernel
Definition cl_FEM_KernelParameters.hpp:205
void set_reordering_method(const ReorderingMethod aMethod)
Definition cl_FEM_KernelParameters.cpp:184
const proc_t & master()
return the id of the master proc
Definition cl_FEM_KernelParameters.hpp:213
const IntegrationScheme & integration_scheme() const
Definition cl_FEM_KernelParameters.hpp:251
void set_auto_partition(const bool aFlag)
Definition cl_FEM_KernelParameters.cpp:192
void set_integration_scheme(const IntegrationScheme &aIntegrationScheme)
Definition cl_FEM_KernelParameters.cpp:176
const Vector< id_t > & selected_sidesets() const
return the ids of the selected sidesets
Definition cl_FEM_KernelParameters.hpp:243
void select_sidesets(const Vector< id_t > &aSidesetIDs)
Definition cl_FEM_KernelParameters.cpp:126
const Vector< index_t > & sideset_indices() const
return the indices of the selected sidesets
Definition cl_FEM_KernelParameters.hpp:235
Definition cl_IFB_LINE3.hpp:21
USER GUIDES:
Definition cl_Capacitor.cpp:16
IntegrationScheme
Definition en_IntegrationScheme.hpp:22
@ GAUSS
Definition en_IntegrationScheme.hpp:23
unsigned int uint
Definition typedefs.hpp:30
int proc_t
Definition commtypes.hpp:29
ReorderingMethod
Definition en_SolverEnums.hpp:116
@ METIS
Definition en_SolverEnums.hpp:118
Definition __init__.py:1