BELFEM 0.9.0
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 //void
130 //flag_elements_on_cuts( const Vector< id_t > & aNonPhiDomains );
131
132 int
133 determine_cut_case_2d( Element * aElement );
134
135 int
136 determine_cut_case_3d( Element * aElement );
137
138 };
139
140//-----------------------------------------------------------------------------
141
142 inline int
143 CutData::weight( const Edge * aEdge )
144 {
145 index_t tIndex = aEdge->index();
146 if ( mCohomologyPlus->test( tIndex ) )
147 {
148 return 1;
149 }
150 if ( mCohomologyMinus->test( tIndex ) )
151 {
152 return -1;
153 }
154 return 0;
155 }
156
157//-----------------------------------------------------------------------------
158
159 inline int
160 CutData::cut_case( const index_t aLocalElementIndex )
161 {
162 return mCutCases( aLocalElementIndex );
163 }
164
165//-----------------------------------------------------------------------------
166
167 inline
170 {
171 return mCutElements;
172 }
173
174//-----------------------------------------------------------------------------
175
176 inline
179 {
180 return mCohomologyEdges;
181 }
182
183//-----------------------------------------------------------------------------
184
185 inline
188 {
189 return mThinCutEdges ;
190 }
191
192//-----------------------------------------------------------------------------
193
194 inline
197 {
198 return mThinCutFaces ;
199 }
200
201//-----------------------------------------------------------------------------
202
203 inline index_t
205 {
206 return mIndex;
207 }
208
209//-----------------------------------------------------------------------------
210 }
211}
212
213
214#endif // CL_CUT_DATA_HPP
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
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:264
Cell< Element * > & elements()
Definition cl_CutData.hpp:169
void unflag_all_elements()
Definition cl_CutData.cpp:838
void flag_nodes()
Definition cl_CutData.cpp:670
void collect_coefficients(const index_t aNumEdges)
Definition cl_CutData.cpp:231
Cell< Edge * > & thin_cut_edges()
Definition cl_CutData.hpp:187
void flag_all_elements()
Definition cl_CutData.cpp:849
index_t index() const
Definition cl_CutData.hpp:204
int weight(const Edge *aEdge)
Definition cl_CutData.hpp:143
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:160
Mesh * create_debug_mesh()
Definition cl_CutData.cpp:727
Cell< Face * > & thin_cut_faces()
Definition cl_CutData.hpp:196
Cell< Edge * > & cohomology_edges()
Definition cl_CutData.hpp:178
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:17
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