BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_CurveFactory.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_CURVEFACTORY_HPP
13#define CL_CURVEFACTORY_HPP
14
15#include "typedefs.hpp"
16#include "cl_Cell.hpp"
17#include "cl_Curve.hpp"
18#include "cl_Mesh.hpp"
19#include "cl_Segment.hpp"
20#include "cl_SideSet.hpp"
21
22namespace belfem
23{
24 namespace mesh
25 {
27 {
28 const proc_t mCommRank ;
29 Mesh * mMesh ;
30 id_t mMaxElementID ;
31 id_t mMaxCurveID ;
32
33 struct ProtoCurve
34 {
35 Cell< Node * > mNodes ;
36 Cell< Edge * > mEdges ;
37 };
38
39//------------------------------------------------------------------------------
40 public:
41//------------------------------------------------------------------------------
42
43 CurveFactory( Mesh * aMesh ) ;
44
45 ~CurveFactory() = default ;
46
47 /*
48 * This function just checks if two sidesets intersect
49 */
50 bool
51 intersection_exists( const id_t aSideSetA, const id_t aSideSetB ) ;
52
53 /*
54 * This function creates a curve from an intersection between
55 * two surfaces. The intersection must be continuous.
56 */
57 Curve *
58 intersect( const id_t aSideSetA, const id_t aSideSetB, id_t aID ) ;
59
60 /*
61 * This function creates a curve from an intersection between
62 * two surfaces. The intersection must be continuous.
63 */
64 Curve *
65 intersect( const id_t aThinShellSideSet, const id_t aBoundarySideSet, DynamicBitset & aBoundaryNodeBitset );
66
67 /*
68 * This function creates a curve from a 1D sideset
69 */
70 Curve *
71 from_2d_sidesets( const Vector< id_t > & aSideSets, id_t aID ) ;
72
74 thin_shell_side_curves( const Vector< id_t > & aThinShellSideSets, const Vector< id_t > & aDomainBoundaries );
75
76 id_t &
78
79 void
80 collect_nodes( Curve * aCurve );
81
82 void
83 compute_coordinates( Curve * aCurve );
84
85//------------------------------------------------------------------------------
86 private:
87//------------------------------------------------------------------------------
88
89 void
90 collect_end_nodes_from_intersection(
91 SideSet * aSidesetA,
92 SideSet * aSideSetB,
93 Cell< Node * > & aEndNodes );
94
95
96 void
97 create_pairs( Cell< Node * > & aEndNodes,
98 Cell< std::pair< Node *, Node * > > & aPairs );
99
100 void
101 collect_midnodes( Cell< std::pair< Node *, Node * > > & aPairs, Cell< Node * > & aMidNodes );
102
103 void
104 create_segments( Curve * aCurve, Cell< std::pair< Node *, Node * > > & aPairs, Cell< Node * > & aMidNodes );
105
106 void
107 sort_end_nodes( Curve * aCurve, Matrix< index_t > & aAdjacency, Cell< Node * > & aEndNodes );
108
109 Node *
110 next( const Matrix< index_t > & aAdjacency, Cell< Segment * > & aSegments, const Node * aNode );
111
112 void
113 orient_segments( Cell< Node * > & aEndNodes, Cell< Segment * > & aSegments );
114
115 void
116 sort_segments( Node * aStart, const Matrix< index_t > & aAdjacency, Cell< Segment * > & aSegments );
117
118 Segment *
119 next( const Matrix< index_t > & aAdjacency, Cell< Segment * > & aSegments, Segment * aSegment );
120
121
122 void
123 collect_nodes( const Vector< id_t > & aSideSets, Cell< Node * > & aNodes );
124
125 void
126 create_edges_on_sidesets(
127 const Vector< id_t > & aSideSets ,
128 Cell< Node * > & aNodes,
129 Cell< Edge * > & aEdges,
130 Map< key_t, Edge * > & aMap );
131
132 void
133 connect_facets_to_edges(
134 const Vector< id_t > & aSideSets,
135 const key_t aNumNodes,
136 Cell< Edge * > & aEdges,
137 Map< key_t, Edge * > & aMap );
138
139 void
140 select_edges(
141 const Vector< id_t > & aThinShellSideSets,
142 const Vector< id_t > & aDomainBoundaries,
143 Cell< Edge * > & aAllEdges,
144 Cell< Edge * > & aSelectedEdges );
145
146 void
147 select_node_subset( Cell< Edge * > & aEdges, Cell< Node * > & aNodes );
148
149 void
150 connect_edges_to_nodes( Cell< Edge * > & aEdges, Cell< Node * > & aNodes );
151
152 index_t
153 identify_subchains( Cell< Node * > & aNodes );
154
155 void
156 create_protocurves( Cell< Node * > & aNodes, Cell< Edge * > & aEdges, Cell< ProtoCurve * > & aProtoCurves );
157
158
159
160 };
161
162 inline id_t &
164 {
165 return mMaxElementID ;
166 }
167
168 }
169}
170
171#endif //CL_CURVEFACTORY_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
Hash map (unordered key-value).
Definition cl_Map.hpp:75
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
void compute_coordinates(Curve *aCurve)
Definition cl_CurveFactory.cpp:1458
void collect_nodes(Curve *aCurve)
Definition cl_CurveFactory.cpp:1371
Cell< Curve * > thin_shell_side_curves(const Vector< id_t > &aThinShellSideSets, const Vector< id_t > &aDomainBoundaries)
Definition cl_CurveFactory.cpp:74
Curve * intersect(const id_t aSideSetA, const id_t aSideSetB, id_t aID)
Definition cl_CurveFactory.cpp:561
Curve * from_2d_sidesets(const Vector< id_t > &aSideSets, id_t aID)
Definition cl_CurveFactory.cpp:732
id_t & max_segment_id()
Definition cl_CurveFactory.hpp:163
bool intersection_exists(const id_t aSideSetA, const id_t aSideSetB)
Definition cl_CurveFactory.cpp:44
CurveFactory(Mesh *aMesh)
Definition cl_CurveFactory.cpp:32
Definition cl_Curve.hpp:27
Definition cl_Node.hpp:30
Definition cl_Segment.hpp:24
Definition cl_SideSet.hpp:29
Definition cl_EF_EdgeFunction.hpp:17
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int id_t
Definition typedefs.hpp:41
int proc_t
Definition commtypes.hpp:29
long long unsigned int key_t
Definition typedefs.hpp:43
uint32_t index_t
Definition typedefs.hpp:52