COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Shared.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #include "mesh/gmsh/Shared.hpp"
8 
10 
11 namespace cf3 {
12 namespace mesh {
13 namespace gmsh {
14 
16 
17 const Uint Shared::m_nodes_in_gmsh_elem[nb_gmsh_types] = { 0, 2, 3, 4, 4, 8, 6, 5, 3, 6, 9,
18  10, 27, 18, 14, 1, 8, 20, 15, 13, 9,
19  10, 12, 15, 15, 21, 4, 5, 6, 20, 35,
20  56, 34, 52, 0, 0, 16 };
21 
25  DIM_3D, DIM_3D, DIM_3D, DIM_3D, DIM_2D, DIM_3D, DIM_2D };
26 
27 const Uint Shared::m_gmsh_elem_order[nb_gmsh_types] = { 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
28  2, 2, 2, 2, 0, 2, 2, 2, 2, 3,
29  3, 4, 4, 5, 5, 3, 4, 5, 3, 4,
30  5, 4, 5, 0, 0, 3 };
31 
32 const std::string Shared::gmsh_elem_geo_name[nb_gmsh_types] = { "Empty", "Line" , "Triag" , "Quad" , "Tetra" ,
33  "Hexa" , "Prism", "Pyramid", "Line" , "Triag" ,
34  "Quad" , "Tetra", "Hexa" , "Prism", "Pyramid",
35  "Point", "Quad" , "Hexa" , "Prism", "Pyramid",
36  "Triag", "Triag", "Triag" , "Triag", "Triag" ,
37  "Triag", "Line" , "Line" , "Line" , "Tetra" ,
38  "Tetra", "Tetra", "Tetra" , "Tetra", "Polyg" ,
39  "Polyh", "Quad"
40  };
41 
42 const std::string Shared::dim_name[4] = { "0D", "1D", "2D", "3D" };
43 
44 
45 const std::string Shared::order_name[10] = { "P0", "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9" };
46 
47 
48 
49 
51 
53  m_nodes_cf_to_gmsh(nb_gmsh_types),
54  m_nodes_gmsh_to_cf(nb_gmsh_types)
55 {
56  m_supported_types.reserve(20);
57  m_supported_types.push_back("cf3.mesh.LagrangeP1.Line1D");
58  m_supported_types.push_back("cf3.mesh.LagrangeP1.Line2D");
59  m_supported_types.push_back("cf3.mesh.LagrangeP2.Line2D");
60  m_supported_types.push_back("cf3.mesh.LagrangeP3.Line2D");
61  m_supported_types.push_back("cf3.mesh.LagrangeP1.Line3D");
62  m_supported_types.push_back("cf3.mesh.LagrangeP1.Quad2D");
63  m_supported_types.push_back("cf3.mesh.LagrangeP2.Quad2D");
64  m_supported_types.push_back("cf3.mesh.LagrangeP3.Quad2D");
65  m_supported_types.push_back("cf3.mesh.LagrangeP1.Quad3D");
66  m_supported_types.push_back("cf3.mesh.LagrangeP1.Triag2D");
67  m_supported_types.push_back("cf3.mesh.LagrangeP2.Triag2D");
68  m_supported_types.push_back("cf3.mesh.LagrangeP3.Triag2D");
69  m_supported_types.push_back("cf3.mesh.LagrangeP1.Triag3D");
70  m_supported_types.push_back("cf3.mesh.LagrangeP1.Hexa3D");
71  m_supported_types.push_back("cf3.mesh.LagrangeP1.Tetra3D");
72  m_supported_types.push_back("cf3.mesh.LagrangeP0.Point1D");
73  m_supported_types.push_back("cf3.mesh.LagrangeP0.Point2D");
74  m_supported_types.push_back("cf3.mesh.LagrangeP0.Point3D");
75  m_supported_types.push_back("cf3.mesh.LagrangeP0.Prism3D");
76 
84 
85  // --------------------------------------------------- NODES
86 
87  // P1 line
88  m_nodes_cf_to_gmsh[P1LINE].resize(2);
91 
92  m_nodes_gmsh_to_cf[P1LINE].resize(2);
95 
96  // P1 quad
97  m_nodes_cf_to_gmsh[P1QUAD].resize(4);
102 
103  m_nodes_gmsh_to_cf[P1QUAD].resize(4);
108 
109  // P1 triag
110  m_nodes_cf_to_gmsh[P1TRIAG].resize(3);
114 
115  m_nodes_gmsh_to_cf[P1TRIAG].resize(3);
119 
120 
121  // P1 tetra
122  m_nodes_cf_to_gmsh[P1TETRA].resize(4);
127 
128  m_nodes_gmsh_to_cf[P1TETRA].resize(4);
133 
134 
135  // P1 hexa
136  m_nodes_cf_to_gmsh[P1HEXA].resize(8);
145 
146  m_nodes_gmsh_to_cf[P1HEXA].resize(8);
155 
156 
157  // P2 line
158  m_nodes_cf_to_gmsh[P2LINE].resize(3);
162 
163  m_nodes_gmsh_to_cf[P2LINE].resize(3);
167 
168  // P2 quad
169  m_nodes_cf_to_gmsh[P2QUAD].resize(9);
179 
180  m_nodes_gmsh_to_cf[P2QUAD].resize(9);
190 
191 
192  // P2 triag
193  m_nodes_cf_to_gmsh[P2TRIAG].resize(6);
200 
201  m_nodes_gmsh_to_cf[P2TRIAG].resize(6);
208 
209 
210  // P2 tetra
211  m_nodes_cf_to_gmsh[P2TETRA].resize(10);
222 
223  m_nodes_gmsh_to_cf[P2TETRA].resize(10);
234 
235 
236  // P2 hexa
237  m_nodes_cf_to_gmsh[P2HEXA].resize(27);
248  m_nodes_cf_to_gmsh[P2HEXA][10]=10;
249  m_nodes_cf_to_gmsh[P2HEXA][11]=11;
250  m_nodes_cf_to_gmsh[P2HEXA][12]=12;
251  m_nodes_cf_to_gmsh[P2HEXA][13]=13;
252  m_nodes_cf_to_gmsh[P2HEXA][14]=14;
253  m_nodes_cf_to_gmsh[P2HEXA][15]=15;
254  m_nodes_cf_to_gmsh[P2HEXA][16]=16;
255  m_nodes_cf_to_gmsh[P2HEXA][17]=17;
256  m_nodes_cf_to_gmsh[P2HEXA][18]=18;
257  m_nodes_cf_to_gmsh[P2HEXA][19]=19;
258  m_nodes_cf_to_gmsh[P2HEXA][20]=20;
259  m_nodes_cf_to_gmsh[P2HEXA][21]=21;
260  m_nodes_cf_to_gmsh[P2HEXA][22]=22;
261  m_nodes_cf_to_gmsh[P2HEXA][23]=23;
262  m_nodes_cf_to_gmsh[P2HEXA][24]=24;
263  m_nodes_cf_to_gmsh[P2HEXA][25]=25;
264  m_nodes_cf_to_gmsh[P2HEXA][26]=26;
265 
266  m_nodes_gmsh_to_cf[P2HEXA].resize(27);
277  m_nodes_gmsh_to_cf[P2HEXA][10]=10;
278  m_nodes_gmsh_to_cf[P2HEXA][11]=11;
279  m_nodes_gmsh_to_cf[P2HEXA][12]=12;
280  m_nodes_gmsh_to_cf[P2HEXA][13]=13;
281  m_nodes_gmsh_to_cf[P2HEXA][14]=14;
282  m_nodes_gmsh_to_cf[P2HEXA][15]=15;
283  m_nodes_gmsh_to_cf[P2HEXA][16]=16;
284  m_nodes_gmsh_to_cf[P2HEXA][17]=17;
285  m_nodes_gmsh_to_cf[P2HEXA][18]=18;
286  m_nodes_gmsh_to_cf[P2HEXA][19]=19;
287  m_nodes_gmsh_to_cf[P2HEXA][20]=20;
288  m_nodes_gmsh_to_cf[P2HEXA][21]=21;
289  m_nodes_gmsh_to_cf[P2HEXA][22]=22;
290  m_nodes_gmsh_to_cf[P2HEXA][23]=23;
291  m_nodes_gmsh_to_cf[P2HEXA][24]=24;
292  m_nodes_gmsh_to_cf[P2HEXA][25]=25;
293  m_nodes_gmsh_to_cf[P2HEXA][26]=26;
294 
295  //Point
296  m_nodes_gmsh_to_cf[P0POINT].resize(1);
298 
299  //P3 triag
300  m_nodes_cf_to_gmsh[P3TRIAG].resize(10);
301  m_nodes_cf_to_gmsh[P3TRIAG][0] = 0;
302  m_nodes_cf_to_gmsh[P3TRIAG][1] = 1;
303  m_nodes_cf_to_gmsh[P3TRIAG][2] = 2;
304  m_nodes_cf_to_gmsh[P3TRIAG][3] = 3;
305  m_nodes_cf_to_gmsh[P3TRIAG][4] = 4;
306  m_nodes_cf_to_gmsh[P3TRIAG][5] = 5;
307  m_nodes_cf_to_gmsh[P3TRIAG][6] = 6;
308  m_nodes_cf_to_gmsh[P3TRIAG][7] = 7;
309  m_nodes_cf_to_gmsh[P3TRIAG][8] = 8;
310  m_nodes_cf_to_gmsh[P3TRIAG][9] = 9;
311 
312 
313  m_nodes_gmsh_to_cf[P3TRIAG].resize(10);
314  m_nodes_gmsh_to_cf[P3TRIAG][0] = 0;
315  m_nodes_gmsh_to_cf[P3TRIAG][1] = 1;
316  m_nodes_gmsh_to_cf[P3TRIAG][2] = 2;
317  m_nodes_gmsh_to_cf[P3TRIAG][3] = 3;
318  m_nodes_gmsh_to_cf[P3TRIAG][4] = 4;
319  m_nodes_gmsh_to_cf[P3TRIAG][5] = 5;
320  m_nodes_gmsh_to_cf[P3TRIAG][6] = 6;
321  m_nodes_gmsh_to_cf[P3TRIAG][7] = 7;
322  m_nodes_gmsh_to_cf[P3TRIAG][8] = 8;
323  m_nodes_gmsh_to_cf[P3TRIAG][9] = 9;
324 
325  //P3 line
326  m_nodes_cf_to_gmsh[P3LINE].resize(4);
327  m_nodes_cf_to_gmsh[P3LINE][0] = 0;
328  m_nodes_cf_to_gmsh[P3LINE][1] = 1;
329  m_nodes_cf_to_gmsh[P3LINE][2] = 2;
330  m_nodes_cf_to_gmsh[P3LINE][3] = 3;
331 
332  m_nodes_gmsh_to_cf[P3LINE].resize(4);
333  m_nodes_gmsh_to_cf[P3LINE][0] = 0;
334  m_nodes_gmsh_to_cf[P3LINE][1] = 1;
335  m_nodes_gmsh_to_cf[P3LINE][2] = 2;
336  m_nodes_gmsh_to_cf[P3LINE][3] = 3;
337 
338  //P3 quad (16 nodes)
339  m_nodes_cf_to_gmsh[P3QUAD].resize(16);
340  m_nodes_cf_to_gmsh[P3QUAD][0] = 0;
341  m_nodes_cf_to_gmsh[P3QUAD][1] = 1;
342  m_nodes_cf_to_gmsh[P3QUAD][2] = 2;
343  m_nodes_cf_to_gmsh[P3QUAD][3] = 3;
344  m_nodes_cf_to_gmsh[P3QUAD][4] = 4;
345  m_nodes_cf_to_gmsh[P3QUAD][5] = 5;
346  m_nodes_cf_to_gmsh[P3QUAD][6] = 6;
347  m_nodes_cf_to_gmsh[P3QUAD][7] = 7;
348  m_nodes_cf_to_gmsh[P3QUAD][8] = 8;
349  m_nodes_cf_to_gmsh[P3QUAD][9] = 9;
350  m_nodes_cf_to_gmsh[P3QUAD][10] = 10;
351  m_nodes_cf_to_gmsh[P3QUAD][11] = 11;
352  m_nodes_cf_to_gmsh[P3QUAD][12] = 12;
353  m_nodes_cf_to_gmsh[P3QUAD][13] = 13;
354  m_nodes_cf_to_gmsh[P3QUAD][14] = 14;
355  m_nodes_cf_to_gmsh[P3QUAD][15] = 15;
356 
357  m_nodes_gmsh_to_cf[P3QUAD].resize(16);
358  m_nodes_gmsh_to_cf[P3QUAD][0] = 0;
359  m_nodes_gmsh_to_cf[P3QUAD][1] = 1;
360  m_nodes_gmsh_to_cf[P3QUAD][2] = 2;
361  m_nodes_gmsh_to_cf[P3QUAD][3] = 3;
362  m_nodes_gmsh_to_cf[P3QUAD][4] = 4;
363  m_nodes_gmsh_to_cf[P3QUAD][5] = 5;
364  m_nodes_gmsh_to_cf[P3QUAD][6] = 6;
365  m_nodes_gmsh_to_cf[P3QUAD][7] = 7;
366  m_nodes_gmsh_to_cf[P3QUAD][8] = 8;
367  m_nodes_gmsh_to_cf[P3QUAD][9] = 9;
368  m_nodes_gmsh_to_cf[P3QUAD][10] = 10;
369  m_nodes_gmsh_to_cf[P3QUAD][11] = 11;
370  m_nodes_gmsh_to_cf[P3QUAD][12] = 12;
371  m_nodes_gmsh_to_cf[P3QUAD][13] = 13;
372  m_nodes_gmsh_to_cf[P3QUAD][14] = 14;
373  m_nodes_gmsh_to_cf[P3QUAD][15] = 15;
374 
375  // prism
376  m_nodes_cf_to_gmsh[P1PRISM].resize(6);
383 
384  m_nodes_gmsh_to_cf[P1PRISM].resize(6);
391 
392 }
393 
394 
396 
397 std::string Shared::gmsh_name_to_cf_name(const Uint dim, const Uint gmsh_type)
398 {
399  //Compose the name of the form "cf3.mesh.LagrangeP1.Line1D"
400  const Uint order = m_gmsh_elem_order[gmsh_type];
401  std::string name = "cf3.mesh.Lagrange"+order_name[order]+"." + gmsh_elem_geo_name[gmsh_type] + dim_name[dim];
402  return name;
403 }
404 
406 
407 } // gmsh
408 } // mesh
409 } // cf3
static const Uint m_gmsh_elem_dim[nb_gmsh_types]
Definition: Shared.hpp:53
std::string name(ComponentWrapper &self)
Shared()
constructor
Definition: Shared.cpp:52
static const Uint m_nodes_in_gmsh_elem[nb_gmsh_types]
Definition: Shared.hpp:52
static std::string gmsh_name_to_cf_name(const Uint dim, const Uint gmsh_type)
Definition: Shared.cpp:397
static const std::string order_name[10]
Definition: Shared.hpp:57
std::vector< std::string > m_supported_types
Definition: Shared.hpp:64
static const std::string dim_name[4]
Definition: Shared.hpp:56
Top-level namespace for coolfluid.
Definition: Action.cpp:18
std::vector< std::vector< Uint > > m_nodes_gmsh_to_cf
Definition: Shared.hpp:71
unsigned int Uint
typedef for unsigned int
Definition: CF.hpp:90
std::vector< std::vector< Uint > > m_nodes_cf_to_gmsh
Faces are not defined in gmsh format.
Definition: Shared.hpp:70
std::map< GeoShape::Type, Uint > m_CFelement_to_GmshElement
Definition: Shared.hpp:63
static const Uint m_gmsh_elem_order[nb_gmsh_types]
Definition: Shared.hpp:54
static const std::string gmsh_elem_geo_name[nb_gmsh_types]
Definition: Shared.hpp:55
Send comments to:
COOLFluiD Web Admin