BELFEM 0.9.3
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_CutData.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 CL_CUT_DATA_HPP
13#define CL_CUT_DATA_HPP
14
15
16#include "typedefs.hpp"
17#include "cl_Cell.hpp"
18#include "cl_Vector.hpp"
19#include "cl_Map.hpp"
20#include "cl_DynamicBitset.hpp"
21#include "cl_Mesh.hpp"
22#include "cl_Cohomology.hpp"
23
24namespace belfem
25{
26 namespace mesh
27 {
34 class CutData
35 {
36 Mesh * mMesh ;
37 Cochain * mCochain ;
38
39 const index_t mIndex ;
40 const id_t mID ;
41
42 const uint mNumberOfCuts ;
43
44 Cell< Edge * > mCohomologyEdges ;
45
46 // needed for weight computation, for each edge
47 DynamicBitset * mCohomologyPlus = nullptr ;
48 DynamicBitset * mCohomologyMinus = nullptr ;
49
50 Cell< Element * > mCutElements ; // elements that contribute to this cut
51 Vector< int > mCutCases ;
52 Map< id_t, int > mCutCaseMap ;
53 Cell< Edge * > mThinCutEdges ; // edges of the thin cut (2D): define the nodes to duplicate and the emitted cut sideset
54 Cell< Face * > mThinCutFaces ; // faces of the thin cut (3D): define the nodes to duplicate and the emitted cut sideset
55
56//-----------------------------------------------------------------------------
57 public:
58//-----------------------------------------------------------------------------
59
60 CutData(
61 Mesh * aMesh,
62 Cohomology * aCohomology,
63 const index_t aCohomologyIndex );
64
65 ~CutData();
66
67 void
68 add_thin_cut_sidesets_to_mesh( id_t & aMaxSideSetID, id_t & aMaxElementID );
69
71 elements();
72
75
76 int
77 weight( const Edge * aEdge );
78
79 int
80 cut_case( const index_t aLocalElementIndex );
81
82 void
83 collect_coefficients( const index_t aNumEdges );
84
85 void
86 collect_elements( const Vector< id_t > & aNonPhiDomains );
87
88 void
90
91 Mesh *
93
94//-----------------------------------------------------------------------------
95
96 void
97 flag_nodes();
98
99//-----------------------------------------------------------------------------
100
103
104//-----------------------------------------------------------------------------
105
108
109//-----------------------------------------------------------------------------
110
111 index_t
112 index() const ;
113
114//-----------------------------------------------------------------------------
115
116 void
118
119//-----------------------------------------------------------------------------
120
121 void
123
124//-----------------------------------------------------------------------------
125 private:
126//-----------------------------------------------------------------------------
127
128
129
130 int
131 determine_cut_case_2d( Element * aElement );
132
133 int
134 determine_cut_case_3d( Element * aElement );
135
136 };
137
138//-----------------------------------------------------------------------------
139
140 inline int
141 CutData::weight( const Edge * aEdge )
142 {
143 index_t tIndex = aEdge->index();
144 if ( mCohomologyPlus->test( tIndex ) )
145 {
146 return 1;
147 }
148 if ( mCohomologyMinus->test( tIndex ) )
149 {
150 return -1;
151 }
152 return 0;
153 }
154
155//-----------------------------------------------------------------------------
156
157 inline int
158 CutData::cut_case( const index_t aLocalElementIndex )
159 {
160 return mCutCases( aLocalElementIndex );
161 }
162
163//-----------------------------------------------------------------------------
164
165 inline
168 {
169 return mCutElements;
170 }
171
172//-----------------------------------------------------------------------------
173
174 inline
177 {
178 return mCohomologyEdges;
179 }
180
181//-----------------------------------------------------------------------------
182
183 inline
186 {
187 return mThinCutEdges ;
188 }
189
190//-----------------------------------------------------------------------------
191
192 inline
195 {
196 return mThinCutFaces ;
197 }
198
199//-----------------------------------------------------------------------------
200
201 inline index_t
203 {
204 return mIndex;
205 }
206
207//-----------------------------------------------------------------------------
208 }
209}
210
211
212#endif // CL_CUT_DATA_HPP
A bounds-checked wrapper around std::vector.
Definition cl_Cell.hpp:45
Runtime-sized bitset; one bit per flag, packed into 64-bit words.
Definition cl_DynamicBitset.hpp:33
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
virtual index_t index() const
Definition cl_Graph_Vertex.hpp:234
Cochain: a functional on chains (cohomology).
Definition cl_Cochain.hpp:37
Computes the cohomology groups H^k of a mesh complex.
Definition cl_Cohomology.hpp:37
void collect_elements(const Vector< id_t > &aNonPhiDomains)
Definition cl_CutData.cpp:277
Cell< Element * > & elements()
Definition cl_CutData.hpp:167
void unflag_all_elements()
Definition cl_CutData.cpp:851
void flag_nodes()
Definition cl_CutData.cpp:683
void collect_coefficients(const index_t aNumEdges)
Definition cl_CutData.cpp:231
Cell< Edge * > & thin_cut_edges()
Definition cl_CutData.hpp:185
void flag_all_elements()
Definition cl_CutData.cpp:862
index_t index() const
Definition cl_CutData.hpp:202
int weight(const Edge *aEdge)
Definition cl_CutData.hpp:141
CutData(Mesh *aMesh, Cohomology *aCohomology, const index_t aCohomologyIndex)
Definition cl_CutData.cpp:25
void add_thin_cut_sidesets_to_mesh(id_t &aMaxSideSetID, id_t &aMaxElementID)
Definition cl_CutData.cpp:55
void collect_edges()
Definition cl_CutData.cpp:186
int cut_case(const index_t aLocalElementIndex)
Definition cl_CutData.hpp:158
Mesh * create_debug_mesh()
Definition cl_CutData.cpp:740
Cell< Face * > & thin_cut_faces()
Definition cl_CutData.hpp:194
Cell< Edge * > & cohomology_edges()
Definition cl_CutData.hpp:176
Special Edge class for NEDELEC-Type elements.
Definition cl_Edge.hpp:30
Lagrange Element baseclass.
Definition cl_Element.hpp:35
Definition cl_EF_EdgeFunction.hpp:24
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
unsigned int id_t
Definition typedefs.hpp:41
uint32_t index_t
Definition typedefs.hpp:52