meshImport2Dgeneral.hh

Go to the documentation of this file.
1 
9 #ifndef meshImport2Dgeneral_hh
10 #define meshImport2Dgeneral_hh
11 
12 #include "toolbox/inputOutput.hh"
13 #include "meshImport2D.hh"
14 #include "elementMaps.hh"
15 
16 namespace concepts {
17 
18  // ****************************************************************** File **
19 
21  class File {
22  public:
24  File(const std::string file_name, enum types file_type);
25  File(const File& file);
26  const enum types type() const { return type_; }
27  const std::string name() const { return name_; }
28  protected:
29  enum types type_;
30  std::string name_;
31  };
32 
33  class AttributesFile : public File {
34  public:
35  AttributesFile(const std::string file_name);
36  };
37 
38  class EdgCorrFile : public File {
39  public:
40  EdgCorrFile(const std::string file_name);
41  };
42 
43  class EdgRadiaFile : public File {
44  public:
45  EdgRadiaFile(const std::string file_name);
46  };
47 
48  class DefFile : public File {
49  public:
50  DefFile(const std::string file_name);
51  };
52 
53  //******************************************************Import2DMeshGeneral**
54 
55  /* Imports 2D mesh with triangles and quadrilaterals (possibly mixed).
56 
57  The class can import the same meshes like Import2DMesh, but
58  allowes also additional properties. For the notation of
59  coordinates, elements and attributes respectivly boundary files
60  see Import2DMesh. Note that despite using edge correlations you have to
61  specify the attributes for every edge / node, also for all of the
62  periodic ones. Assigning different attributes to periodic objects in the
63  attribute file will randomly pick one of the attributes. Be carefull to
64  be consistent since there is no assertion for this case !
65 
66  PERIODIC BOUNDARY = topological edge correlation
67 
68  If you want to read in periodic boundary conditions in the sense
69  that opposite edges on the boundary are identified, you have to use
70  this routine with an EdgCorr file. The routine is not made for the
71  case, where "only" vertices on the boundary are identified, because
72  this could lead to problems with edge identification.
73 
74  For this an additional file has to be provided, in which the
75  edges have to be identified. In the first column is a counter.
76  The following four columns contain the number of nodes of two
77  identified edges.
78 
79  The order of the endpoints of the edges is important, e.g.
80  <pre>1 1 2 5 6</pre>
81  means a identification of vertices 1-6 and 2-5.
82 
83  <pre>
84  6 5 4
85  ----------------------------
86  | | |
87  | | |
88  | | |
89  | | |
90  | | |
91  ----------------------------
92  1 2 3</pre>
93 
94  The identification of the horizontal edges in the sketch above is
95  achieved by the following file.
96 
97  <pre>1 1 2 5 6
98  2 2 3 4 5</pre>
99 
100  If we want to identify the left boundary edge with the right boundary
101  edge, we will have to write:
102  <pre>3 1 6 4 3</pre>
103  or
104  <pre>3 6 1 3 4</pre>
105  or
106  <pre>3 3 4 6 1</pre>
107  or
108  <pre>3 4 3 1 6</pre>
109 
110  but not
111  <pre>3 1 6 3 4</pre>
112  or
113  <pre>3 6 1 4 3</pre>.
114 
115  CURVED EDGES (circular arc)
116 
117  It is also possible to create cells (only quads) with circular
118  edges. The edges and the corresponding radia have to be listed in
119  a "EdgRadia" file. In the first column stands a counter. The
120  following two columns contain the edge and the fourth one the
121  radius, e.g.
122 
123  <pre>1 1 2 34.342</pre>
124 
125  This means that the edge with vertices 1 and 2 will be the segment of
126  a circle of radius 34.342. The orientation of the curvature is
127  indicated by the order of the vertices and the sign of the radius.
128 
129  r > 0 means, the arc is on the right side of line from 1st to 2nd
130  vertex. This is like in the above example (the length of the
131  vertical line corresponds to the radius):
132 
133  <pre>
134  |
135  |
136  |
137  1 - | - 2
138  - | -
139  - | -
140  --</pre>
141 
142  To get the circle bended on the other side one should write:
143 
144  <pre>2 1 34.342</pre>
145  or
146  <pre>1 2 -34.342</pre>
147 
148  The circle is determined geometrically by drawing a circle of radius
149  34.342 around the first vertex and around the second vertex and then
150  (depending on orientation) declare one of the two intersecting points
151  as the middle point of the circle of which the edge will be a segment.
152  This implies that the radius must be bigger than half the distance of
153  the two vertices.
154 
155  One word of caution: The Edgecorrelation routine gives back results
156  for a special class of meshes which should not be further used.
157  For the class of meshes with no inner cells (i.e. no cells which have
158  all their edges in the interior of the mesh), you will impose further
159  periodicity conditions in the interior by applying edgcorrelation. Here
160  is an example:
161 
162  <pre>
163  7 6 5
164  ----------------------------
165  | | |
166  | 9 | |
167  8 |----------|---------------| 4
168  | | |
169  | | |
170  ----------------------------
171  1 2 3</pre>
172 
173  By identifying (1,2) <--> (6,7), (2,3) <--> (5,6), (3,4) <--> (8,1) and
174  (4,5) <--> (7,8) you will automatically identify (8,9) with (9,4) and
175  (2,9) with (9,6). Thus for proper results you must only use meshes with
176  at least one inner cell when applying edgecorrelation.
177 
178 
179 
180  @author Peter Kauf, 2005
181  @test test::MeshImp2DTest
182  @ingroup geometry
183 
184  */
185 
187  public:
198  Import2dMeshGeneral(const std::string coord, const std::string elms,
199  const File file, const uint idxStart = 1);
200  Import2dMeshGeneral(const std::string coord, const std::string elms,
201  const File file_1, const File file_2,
202  const uint idxStart = 1);
203  Import2dMeshGeneral(const std::string coord, const std::string elms,
204  const File file_1, const File file_2,
205  const File file_3, const uint idxStart = 1);
207 
208  void addInfiniteQuad(const InOutParameters input);
209  protected:
210  virtual std::ostream& info(std::ostream& os) const;
212  void construct_(const Array<const File*> files);
214  void delete_();
220  std::multimap<uint, uint> VtxCorr_;
221  std::vector<uint> KeyVector_;
222  // belongs to the insert algorithm:
223  bool is_paired_(const uint key, const uint a) const;
224  // belongs to the insert algorithm:
225  void add_(uint a, uint b);
226  // belongs to the insert algorithm:
227  void complete_(uint a, uint b);
228  // belongs to the insert algorithm:
229  bool build_(uint a, uint b);
230  // putting the correlations of a and b and all implied correlations
231  // into VtxCorr_
232  void insert_(uint a, uint b);
233  void vtxcorr_(const std::string vtxcorr);
234  void edgcorr_(const std::string edgcorr);
235  // different Vertex generation routine!
236  virtual void createEntity_(const MultiIndex<1>& idx);
237  // different Edge generation routine!
238  virtual void createEntity_(const MultiIndex<2>& idx);
239  virtual void createEntity_(const MultiIndex<3>& idx)
242  virtual void createEntity_(const MultiIndex<4>& idx)
248  void edgradia_(std::string edgradia);
250  std::vector<MappingEdge2d*> edges_vec_;
252  virtual void createCell_(const MultiIndex<3>& idx)
255  virtual void createCell_(const MultiIndex<4>& idx)
257  }; // Import2dMeshGeneral
258 
259  // ****************************************** import2dMeshGeneralFromInput **
260 
286  bool verbose = false);
287 
288 
289 } // namespace concepts
290 
291 #endif //meshImport2Dgeneral.hh
EdgCorrFile(const std::string file_name)
virtual void createEntity_(const MultiIndex< 1 > &idx)
Creation of topological entities.
Import2dMeshGeneral * import2dMeshGeneralFromInput(const InOutParameters input, bool verbose=false)
Loads a mesh from a paramater list.
bool is_paired_(const uint key, const uint a) const
virtual void createCell_(const MultiIndex< 4 > &idx)
Creation of geometrical cells with element mapping.
MultiArray< 2, Real > EdgRadia_
Mapping from edge to the radius of arcs.
File(const std::string file_name, enum types file_type)
void insert_(uint a, uint b)
virtual void createEntity_(const MultiIndex< 2 > &idx)
Holds parameters in hashes.
Definition: inputOutput.hh:75
Base class for File type recognition.
void vtxcorr_(const std::string vtxcorr)
AttributesFile(const std::string file_name)
bool has_EdgCorr_
Flags for special properties.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Import2dMeshGeneral(const std::string coord, const std::string elms, const File file, const uint idxStart=1)
Constructors.
void complete_(uint a, uint b)
void addInfiniteQuad(const InOutParameters input)
void add_(uint a, uint b)
EdgRadiaFile(const std::string file_name)
An array of objects.
Definition: bilinearForm.hh:23
MultiArray< 2, MappingEdge2d * > Edges_
const std::string name() const
Container typename for multidimensional Array which is based on std::map.
Definition: multiArray.hh:33
virtual void createCell_(const MultiIndex< 3 > &idx)
Creation of geometrical cells with element mapping.
void edgradia_(std::string edgradia)
Reads edge radia file and writes to EdgRadia_.
bool build_(uint a, uint b)
void delete_()
Clears indermediate data after construction of the mesh.
Exception class to express a missing feature.
Definition: exceptions.hh:206
virtual void createEntity_(const MultiIndex< 1 > &idx)
Creation of topological entities.
Definition: meshImport2D.hh:62
std::multimap< uint, uint > VtxCorr_
Mapping from vertex to correlated ones, could be more.
Import2dMeshGeneral(const std::string coord, const std::string elms, const File file_1, const File file_2, const File file_3, const uint idxStart=1)
MultiArray< 2, MultiIndex< 2 > > EdgCorr_
Mapping from edge to correlated one.
enum types type() const
Import2dMeshGeneral(const std::string coord, const std::string elms, const File file_1, const File file_2, const uint idxStart=1)
void construct_(const Array< const File * > files)
Reads the special files.
virtual void createEntity_(const MultiIndex< 4 > &idx)
void edgcorr_(const std::string edgcorr)
Imports 2D mesh with triangles and quadrilaterals (possibly mixed).
Definition: meshImport2D.hh:32
std::vector< MappingEdge2d * > edges_vec_
DefFile(const std::string file_name)
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
virtual void createEntity_(const MultiIndex< 3 > &idx)
Creation of topological entities.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich