Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/csg/identify.hpp
3206 views
1
2
#ifndef FILE_IDENTIFY
3
#define FILE_IDENTIFY
4
5
/**************************************************************************/
6
/* File: identify.hh */
7
/* Author: Joachim Schoeberl */
8
/* Date: 1. Aug. 99 */
9
/**************************************************************************/
10
11
/**
12
Identify surfaces for periodic b.c. or
13
thin domains
14
*/
15
16
17
class SpecialPoint;
18
class Identification
19
{
20
protected:
21
const CSGeometry & geom;
22
// identified faces, index sorted
23
INDEX_2_HASHTABLE<int> identfaces;
24
int nr;
25
26
public:
27
Identification (int anr, const CSGeometry & ageom);
28
virtual ~Identification ();
29
virtual void Print (ostream & ost) const = 0;
30
virtual void GetData (ostream & ost) const = 0;
31
32
/// obsolete
33
// virtual void IdentifySpecialPoints (ARRAY<class SpecialPoint> & points);
34
35
/// can identify both special points (fixed direction)
36
/// (identified points, same tangent)
37
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
38
const TABLE<int> & specpoint2solid,
39
const TABLE<int> & specpoint2surface) const;
40
///
41
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
42
/// is it possible to identify sp1 with some other ?
43
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
44
45
/// are points (if connected) by a short edge (direction anyhow) ?
46
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
47
48
/// add entries in mesh identification tables
49
virtual void IdentifyPoints (class Mesh & mesh);
50
51
/// add entries to identified faces (based on segment infos)
52
virtual void IdentifyFaces (class Mesh & mesh);
53
54
/// get point on other surface, add entry in mesh identifications
55
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
56
57
/// copy surfaces, or fill rectangles
58
virtual void BuildSurfaceElements (ARRAY<class Segment> & segs,
59
class Mesh & mesh,
60
const Surface * surf);
61
62
/// insert volume elements in thin layers
63
virtual void BuildVolumeElements (ARRAY<class Element2d> & surfels,
64
class Mesh & mesh);
65
66
/// get list of identified faces
67
virtual void GetIdentifiedFaces (ARRAY<INDEX_2> & idfaces) const;
68
69
friend ostream & operator<< (ostream & ost, Identification & ident);
70
};
71
72
73
class PeriodicIdentification : public Identification
74
{
75
const Surface * s1;
76
const Surface * s2;
77
public:
78
PeriodicIdentification (int anr,
79
const CSGeometry & ageom,
80
const Surface * as1,
81
const Surface * as2);
82
virtual ~PeriodicIdentification ();
83
virtual void Print (ostream & ost) const;
84
virtual void GetData (ostream & ost) const;
85
86
87
// virtual void IdentifySpecialPoints (ARRAY<class SpecialPoint> & points);
88
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
89
const TABLE<int> & specpoint2solid,
90
const TABLE<int> & specpoint2surface) const;
91
92
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
93
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
94
virtual void IdentifyPoints (class Mesh & mesh);
95
virtual void IdentifyFaces (class Mesh & mesh);
96
virtual void BuildSurfaceElements (ARRAY<class Segment> & segs,
97
class Mesh & mesh,
98
const Surface * surf);
99
};
100
101
102
///
103
class TopLevelObject;
104
class CloseSurfaceIdentification : public Identification
105
{
106
const Surface * s1;
107
const Surface * s2;
108
const TopLevelObject * domain;
109
///
110
int dom_nr;
111
/// number of refinement levels (in Z-refinement)
112
int ref_levels;
113
/// number of refinement levels for layer next to s1 (in Z-refinement)
114
int ref_levels_s1;
115
/// number of refinement levels for layer next to s2 (in Z-refinement)
116
int ref_levels_s2;
117
///
118
double eps_n;
119
ARRAY<double> slices;
120
/// used only for domain-local identification:
121
ARRAY<int> domain_surfaces;
122
///
123
bool dom_surf_valid;
124
125
///
126
Vec<3> direction;
127
///
128
bool usedirection;
129
public:
130
CloseSurfaceIdentification (int anr,
131
const CSGeometry & ageom,
132
const Surface * as1,
133
const Surface * as2,
134
const TopLevelObject * adomain,
135
const Flags & flags);
136
virtual ~CloseSurfaceIdentification ();
137
138
virtual void Print (ostream & ost) const;
139
virtual void GetData (ostream & ost) const;
140
141
142
// virtual void IdentifySpecialPoints (ARRAY<class SpecialPoint> & points);
143
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
144
const TABLE<int> & specpoint2solid,
145
const TABLE<int> & specpoint2surface) const;
146
virtual int Identifyable (const Point<3> & p1, const Point<3> & sp2) const;
147
virtual int IdentifyableCandidate (const SpecialPoint & sp1) const;
148
virtual int ShortEdge (const SpecialPoint & sp1, const SpecialPoint & sp2) const;
149
virtual int GetIdentifiedPoint (class Mesh & mesh, int pi1);
150
const ARRAY<double> & GetSlices () const { return slices; }
151
virtual void IdentifyPoints (class Mesh & mesh);
152
virtual void IdentifyFaces (class Mesh & mesh);
153
virtual void BuildSurfaceElements (ARRAY<class Segment> & segs,
154
class Mesh & mesh,
155
const Surface * surf);
156
void BuildSurfaceElements2 (ARRAY<class Segment> & segs,
157
class Mesh & mesh,
158
const Surface * surf);
159
160
virtual void BuildVolumeElements (ARRAY<class Element2d> & surfels,
161
class Mesh & mesh);
162
163
int RefLevels () const { return ref_levels; }
164
int RefLevels1 () const { return ref_levels_s1; }
165
int RefLevels2 () const { return ref_levels_s2; }
166
167
bool IsSkewIdentification(void) const {return usedirection;}
168
const Vec<3> & GetDirection(void) const {return direction;}
169
170
const Surface & GetSurface1(void) const
171
{ return *s1;}
172
const Surface & GetSurface2(void) const
173
{ return *s2;}
174
};
175
176
177
class CloseEdgesIdentification : public Identification
178
{
179
const Surface * facet;
180
const Surface * s1;
181
const Surface * s2;
182
public:
183
CloseEdgesIdentification (int anr,
184
const CSGeometry & ageom,
185
const Surface * afacet,
186
const Surface * as1,
187
const Surface * as2);
188
virtual ~CloseEdgesIdentification ();
189
virtual void Print (ostream & ost) const;
190
virtual void GetData (ostream & ost) const;
191
192
// virtual void IdentifySpecialPoints (ARRAY<class SpecialPoint> & points);
193
virtual int Identifyable (const SpecialPoint & sp1, const SpecialPoint & sp2,
194
const TABLE<int> & specpoint2solid,
195
const TABLE<int> & specpoint2surface) const;
196
197
198
virtual void IdentifyPoints (class Mesh & mesh);
199
virtual void BuildSurfaceElements (ARRAY<class Segment> & segs,
200
class Mesh & mesh,
201
const Surface * surf);
202
};
203
204
#endif
205
206