BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_CutFactory.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_CUTFACTORY_HPP
13#define BELFEM_CL_CUTFACTORY_HPP
14
15#include "commtools.hpp"
16#include "typedefs.hpp"
17#include "cl_Mesh.hpp"
19#include "cl_Cohomology.hpp"
20#include "cl_Homology.hpp"
21
22#include "en_CutAlgorithm.hpp"
24#include "cl_Topology.hpp"
26namespace belfem
27{
28 namespace mesh
29 {
30//-----------------------------------------------------------------------------
31
39 {
40 const proc_t mCommRank ;
41 Mesh * mMesh ;
42 id_t mMaxID = 0 ;
43
44 Topology * mTopology ;
45 PeriodicityFactory * mPeriodicFactory ;
46 const Vector< id_t > & mThinShellSidesets ;
47
48 Cell< Node * > & mAbstractNodes ;
49 Cell< Node * > & mOrphanedNodes ;
50 Cell< Protoshell * > & mProtoshells ;
51
52 const CutAlgorithm mAlgorithm ;
53 const bool mUseEnrichment ;
54
55 Vector< id_t > mThinShellBoundaryIDs ;
56
57 Cell< SideSet * > mThinShellBoundaries ;
58 Cell< SideSet * > mCuts ;
59 Cell< SideSet * > mTemporaryThinShellSidesets ;
60
61 //Cell<Cell< id_t >> mCurrentTerminals ;
62 Cell<Cell< id_t >> mTerminals ;
63 Cell< id_t > mThinShellIndices; //Indices of thin shell terminals in mTerminals ;
64
65 Vector< id_t> mOuterBoundaries ;
66
67 SimplicialComplex * mSimplicialComplex = nullptr ;
68 Cohomology * mCohomology = nullptr ;
69 Homology * mRelativeHomology = nullptr ;
70
71
72 Cell< Node * > mThinShellDuplicates ;
73 Cell< Node * > mThinShellMasterNodes ;
74 Cell< Node * > mThinShellSlaveNodes ;
75
76 Map< id_t, Vector< index_t > * > mIndicesOfOriginalTerminalNodes ;
77
78 //Map< id_t, DynamicBitset * > mNodesOnOriginalTerminalSidesets ;
79
80 // this matrix lists the cuts based on the cohomologies
81 //Vector< id_t > mTriBlocks ;
82 //Vector< id_t > mTetBlocks ;
83 //Vector< id_t > mPyraBlocks ;
84
85 //Map< id_t, Element * > mElementMap ;
86 //Map< id_t, Node * > mNodeMap ;
87
88
89
90 // future user settings
91 bool mSuggestHomologies = true ; // this needs to be turned on for the incidence matrix to work!
92
93 // poisson gives prettier cuts, but is slower
94 bool mUsePoissonInsteadOfRcm = false ;
95
96
97//-----------------------------------------------------------------------------
98 public:
99//-----------------------------------------------------------------------------
100
102 Mesh * aMesh,
103 Topology * aTopology,
104 Cell< Protoshell * > & aProtoshells,
105 const CutAlgorithm aAlgorithm,
106 const bool aUseEnrichment );
107
108//-----------------------------------------------------------------------------
109
110 ~CutFactory();
111
112//-----------------------------------------------------------------------------
113
114 void
115 set_terminals( const Cell<Cell< id_t >> & aTerminals, const Cell<id_t> & aThinShellIndices );
116
117//-----------------------------------------------------------------------------
118
119 void
120 set_periodicity( PeriodicityFactory * aPeriodicFactory );
121
122//-----------------------------------------------------------------------------
123
124 void
125 run();
126
127//-----------------------------------------------------------------------------
128
129 // returns the abstract nodes that represent the dof for the cuts
132
133//-----------------------------------------------------------------------------
134
135 // returns the orphaned nodes if they exist
138
139//-----------------------------------------------------------------------------
140
142 cuts();
143
144//-----------------------------------------------------------------------------
145
146 bool
148
149//-----------------------------------------------------------------------------
150
151 void
153
154 void
156
157 void
159
160 void
162
163 void
165
166//-----------------------------------------------------------------------------
167
168 void
170
171 void
173 SideSet * aSideSet,
174 Vector< real > & aWorkA,
175 Vector< real > & aWorkB,
176 Vector< real > & aN );
177
178 void
180
181//-----------------------------------------------------------------------------
182
183 void
185
186//-----------------------------------------------------------------------------
187
188 inline Vector< id_t > &
190 {
191 return mThinShellBoundaryIDs ;
192 }
193
194//-----------------------------------------------------------------------------
195
198 {
199 return mTemporaryThinShellSidesets( aID )->facets();
200 }
201
202//-----------------------------------------------------------------------------
203
206 {
207 return mThinShellMasterNodes ;
208 }
209
210//-----------------------------------------------------------------------------
211
214 {
215 return mThinShellSlaveNodes ;
216 }
217
218//-----------------------------------------------------------------------------
219 private:
220//-----------------------------------------------------------------------------
221
222
223 void
224 link_node_duplicates_and_originals();
225
226//-----------------------------------------------------------------------------
227
228 void
229 collect_orphan_nodes();
230
231//-----------------------------------------------------------------------------
232 void
233 collect_nodes_and_elements_on_blocks(
234 const Vector< id_t > & aBlockIDs,
235 Cell< Element * > & aElements,
236 Cell< Node * > & aNodes );
237
238//-----------------------------------------------------------------------------
239
240 void
241 compute_rcm_problem();
242
243//-----------------------------------------------------------------------------
244
245 void
246 compute_cohomologies();
247
248//-----------------------------------------------------------------------------
249
250 void
251 compute_thin_cuts_and_duplicate_interface_nodes();
252
253//-----------------------------------------------------------------------------
254
255 void
256 restore_thin_shell_sidesets();
257
258//-----------------------------------------------------------------------------
259
260 void
261 write_debug_cohomology( Homology * aSuggestedHomology ) ;
262
263//-----------------------------------------------------------------------------
264
265 void
266 create_curves_for_thinshells();
267
268 void
269 create_side_curves_for_thinshells_3d();
270
271 void
272 collect_boundary_sidesets( Vector< id_t > & aIDs );
273
274//-----------------------------------------------------------------------------
275
277 check_element_types() ;
278
279//-----------------------------------------------------------------------------
280
281 // for debugging
282 void
283 save_edges( const uint aIndex );
284
285
286//-----------------------------------------------------------------------------
287
288 SideSet *
289 create_cut_sideset_2d(
290 const uint aIndex,
291 const ElementType aType,
292 Cell< Element * > & aElements,
293 const Vector< int > & aCases );
294
295//-----------------------------------------------------------------------------
296
297 SideSet *
298 create_cut_sideset_3d(
299 const uint aIndex,
300 const ElementType aType,
301 Cell< Element * > & aElements,
302 const Vector< int > & aCases );
303
304//-----------------------------------------------------------------------------
305
306
307 void
308 flag_nodes_and_facets_of_tape_sidesets( Cell< Node * > & aNodes ) ;
309
310//-----------------------------------------------------------------------------
311
312 Facet *
313 create_facet( Element * aElement, Cell< Element * > & aCandidates );
314
315//-----------------------------------------------------------------------------
316
317 bool
318 connect_facet_to_slave( Facet * aFacet );
319
320//-----------------------------------------------------------------------------
321
322 void
323 unflag_symmetry_sidesets();
324
325//-----------------------------------------------------------------------------
326
327 void
328 compute_element_adjacencies();
329
330//-----------------------------------------------------------------------------
331
332 void
333 compute_poisson_problem();
334
335 };
336 }
337}
338#endif //BELFEM_CL_CUTFACTORY_HPP
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
Hash map (unordered key-value).
Definition cl_Map.hpp:75
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
Computes the cohomology groups H^k of a mesh complex.
Definition cl_Cohomology.hpp:37
void set_periodicity(PeriodicityFactory *aPeriodicFactory)
Definition cl_CutFactory.cpp:105
Cell< Node * > & abstract_nodes()
Definition cl_CutFactory.cpp:2314
void orient_terminal_curves_sub(SideSet *aSideSet, Vector< real > &aWorkA, Vector< real > &aWorkB, Vector< real > &aN)
Definition cl_CutFactory.cpp:1888
void duplicate_and_relink_facets()
Definition cl_CutFactory.cpp:1586
Vector< id_t > & thin_shell_boundaries()
Definition cl_CutFactory.hpp:189
Cell< Node * > & orphaned_nodes()
Definition cl_CutFactory.cpp:2322
Cell< Node * > & thin_shell_master_nodes()
Definition cl_CutFactory.hpp:205
void orient_terminal_curves()
Definition cl_CutFactory.cpp:1828
CutFactory(Mesh *aMesh, Topology *aTopology, Cell< Protoshell * > &aProtoshells, const CutAlgorithm aAlgorithm, const bool aUseEnrichment)
Definition cl_CutFactory.cpp:42
void duplicate_nodes_on_face_sidesets()
Definition cl_CutFactory.cpp:1262
void relink_non_thinshell_facets()
Definition cl_CutFactory.cpp:1643
void orient_terminal_curves_2D()
Definition cl_CutFactory.cpp:1929
void run()
Definition cl_CutFactory.cpp:114
void set_terminals(const Cell< Cell< id_t > > &aTerminals, const Cell< id_t > &aThinShellIndices)
Definition cl_CutFactory.cpp:97
Cell< SideSet * > & cuts()
Definition cl_CutFactory.cpp:2330
Cell< Facet * > & thin_shell_facets(const id_t aID)
Definition cl_CutFactory.hpp:197
Cell< Node * > & thin_shell_slave_nodes()
Definition cl_CutFactory.hpp:213
void relink_slave_elements_with_duplicate_nodes()
Definition cl_CutFactory.cpp:1503
bool create_thin_shell_cuts()
Definition cl_CutFactory.cpp:1211
void close_terminal_loops()
Definition cl_CutFactory.cpp:1681
void save_curve_debug_meshes()
Definition cl_CutFactory.cpp:2535
Lagrange Element baseclass.
Definition cl_Element.hpp:35
Definition cl_Facet.hpp:24
Computes the homology groups H_k of a mesh complex.
Definition cl_Homology.hpp:36
Creates a Periodicity object by matching nodes on two periodic boundary planes.
Definition cl_Mesh_PeriodicityFactory.hpp:34
Definition cl_SideSet.hpp:29
Simplicial complex reduction engine underlying the homology and cohomology computation.
Definition cl_SimplicialComplex.hpp:37
Analyzes and classifies mesh topology for finite element simulations.
Definition cl_Topology.hpp:44
Definition cl_EF_EdgeFunction.hpp:17
CutAlgorithm
Definition en_CutAlgorithm.hpp:22
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
unsigned int id_t
Definition typedefs.hpp:41
int proc_t
Definition commtypes.hpp:29
ElementType
Element types.
Definition Mesh_Enums.hpp:27