SU2
primal_grid_structure.hpp
Go to the documentation of this file.
1 
35 #pragma once
36 
37 #include "./mpi_structure.hpp"
38 
39 #include <iostream>
40 #include <vector>
41 #include <cstdlib>
42 
43 #include "dual_grid_structure.hpp"
44 #include "config_structure.hpp"
45 
46 using namespace std;
47 
54 class CPrimalGrid {
55 protected:
56  unsigned long *Nodes;
57  unsigned long GlobalIndex;
59  su2double *Coord_CG;
60  su2double **Coord_FaceElems_CG;
62  static unsigned short nDim;
64  unsigned long DomainElement;
66  bool Divide;
68  su2double Volume;
70 public:
71 
75  CPrimalGrid(void);
76 
83  CPrimalGrid(unsigned short val_nNodes, unsigned short val_nFaces, unsigned short val_VTK_Type);
84 
88  virtual ~CPrimalGrid(void);
89 
95  long GetNeighbor_Elements(unsigned short val_face);
96 
102  void SetNeighbor_Elements(unsigned long val_elem, unsigned short val_face);
103 
108  void SetCoord_CG(su2double **val_coord);
109 
115  su2double GetCG(unsigned short val_dim);
116 
121  void SetVolume(su2double val_volume);
122 
128  su2double GetVolume(void);
129 
136  su2double GetFaceCG(unsigned short val_face, unsigned short val_dim);
137 
142  void GetAllNeighbor_Elements(void);
143 
148  void SetDivide(bool val_divide);
149 
154  bool GetDivide(void);
155 
160  unsigned long GetGlobalIndex(void);
161 
166  void SetGlobalIndex(unsigned long val_globalindex);
167 
172  virtual void SetDomainElement(unsigned long val_domainelement);
173 
178  virtual unsigned long GetDomainElement(void);
179 
183  virtual void Change_Orientation(void) = 0;
184 
189  virtual unsigned short GetVTK_Type(void) = 0;
190 
195  virtual unsigned short GetRotation_Type(void);
196 
201  virtual void SetRotation_Type(unsigned short val_rotation_type);
202 
208  virtual unsigned short GetnNeighbor_Nodes(unsigned short val_node) = 0;
209 
214  virtual unsigned short GetnNeighbor_Elements(void) = 0;
215 
220  virtual unsigned short GetnNodes(void) = 0;
221 
226  virtual unsigned short GetnFaces(void) = 0;
227 
233  virtual unsigned short GetnNodesFace(unsigned short val_face) = 0;
234 
239  virtual unsigned short GetMaxNodesFace(void) = 0;
240 
246  virtual unsigned long GetNode(unsigned short val_node) = 0;
247 
253  virtual void SetNode(unsigned short val_node, unsigned long val_point);
254 
261  virtual unsigned short GetFaces(unsigned short val_face, unsigned short val_index) = 0;
262 
270  virtual unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index) = 0;
271 };
272 
280 class CVertexMPI : public CPrimalGrid {
281 private:
282  static unsigned short nFaces;
283  static unsigned short nNodes;
284  static unsigned short VTK_Type;
285  unsigned short Rotation_Type;
287  static unsigned short maxNodesFace;
288  static unsigned short nNeighbor_Elements;
290 public:
291 
297  CVertexMPI(unsigned long val_point, unsigned short val_nDim);
298 
302  ~CVertexMPI(void);
303 
309  unsigned long GetNode(unsigned short val_node);
310 
316  void SetNode(unsigned short val_node, unsigned long val_point);
317 
322  unsigned short GetnNodes(void);
323 
328  unsigned short GetVTK_Type(void);
329 
334  unsigned short GetRotation_Type(void);
335 
340  void SetRotation_Type(unsigned short val_rotation_type);
341 
346  void Change_Orientation(void);
347 
352  unsigned short GetnNeighbor_Elements(void);
353 
358  unsigned short GetnNeighbor_Nodes(unsigned short val_node);
359 
364  unsigned short GetnFaces(void);
365 
370  unsigned short GetnNodesFace(unsigned short val_face);
371 
376  unsigned short GetMaxNodesFace(void);
377 
382  unsigned short GetFaces(unsigned short val_face, unsigned short val_index);
383 
388  unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index);
389 };
390 
397 class CLine : public CPrimalGrid {
398 private:
399  static unsigned short Faces[1][2];
400  static unsigned short Neighbor_Nodes[2][1];
401  static unsigned short nNodesFace[1];
402  static unsigned short nNeighbor_Nodes[2];
403  static unsigned short nFaces;
404  static unsigned short nNodes;
405  static unsigned short VTK_Type;
406  static unsigned short maxNodesFace;
407  static unsigned short nNeighbor_Elements;
409 public:
410 
417  CLine(unsigned long val_point_0, unsigned long val_point_1, unsigned short val_nDim);
418 
422  ~CLine(void);
423 
429  unsigned long GetNode(unsigned short val_node);
430 
436  void SetNode(unsigned short val_node, unsigned long val_point);
437 
444  unsigned short GetFaces(unsigned short val_face, unsigned short val_index);
445 
453  unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index);
454 
460  unsigned short GetnNeighbor_Nodes(unsigned short val_node);
461 
467  unsigned short GetnNodesFace(unsigned short val_face);
468 
473  unsigned short GetnNodes(void);
474 
479  unsigned short GetnFaces(void);
480 
485  unsigned short GetMaxNodesFace(void);
486 
491  unsigned short GetVTK_Type(void);
492 
497  unsigned short GetnNeighbor_Elements(void);
498 
503  void SetDomainElement(unsigned long val_domainelement);
504 
509  unsigned long GetDomainElement(void);
510 
514  void Change_Orientation(void);
515 };
516 
523 class CTriangle : public CPrimalGrid {
524 private:
525  static unsigned short Faces[3][2];
526  static unsigned short Neighbor_Nodes[3][2];
527  static unsigned short nNodesFace[3];
528  static unsigned short nNeighbor_Nodes[3];
529  static unsigned short nFaces;
530  static unsigned short nNodes;
531  static unsigned short VTK_Type;
532  static unsigned short maxNodesFace;
533  static unsigned short nNeighbor_Elements;
535 public:
536 
544  CTriangle(unsigned long val_point_0, unsigned long val_point_1,
545  unsigned long val_point_2, unsigned short val_nDim);
546 
550  ~CTriangle(void);
551 
557  unsigned long GetNode(unsigned short val_node);
558 
564  void SetNode(unsigned short val_node, unsigned long val_point);
565 
572  unsigned short GetFaces(unsigned short val_face, unsigned short val_index);
573 
581  unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index);
582 
588  unsigned short GetnNeighbor_Nodes(unsigned short val_node);
589 
595  unsigned short GetnNodesFace(unsigned short val_face);
596 
601  unsigned short GetnNodes(void);
602 
607  unsigned short GetnFaces(void);
608 
613  unsigned short GetMaxNodesFace(void);
614 
619  unsigned short GetVTK_Type(void);
620 
625  unsigned short GetnNeighbor_Elements(void);
626 
630  void Change_Orientation(void);
631 
636  void SetDomainElement(unsigned long val_domainelement);
637 
642  unsigned long GetDomainElement(void);
643 };
644 
651 class CQuadrilateral : public CPrimalGrid {
652 private:
653  static unsigned short Faces[4][2];
654  static unsigned short Neighbor_Nodes[4][2];
655  static unsigned short nNodesFace[4];
656  static unsigned short nNeighbor_Nodes[4];
657  static unsigned short nFaces;
658  static unsigned short nNodes;
659  static unsigned short VTK_Type;
660  static unsigned short maxNodesFace;
661  static unsigned short nNeighbor_Elements;
663 public:
664 
673  CQuadrilateral(unsigned long val_point_0, unsigned long val_point_1,
674  unsigned long val_point_2, unsigned long val_point_3, unsigned short val_nDim);
675 
679  ~CQuadrilateral(void);
680 
686  unsigned long GetNode(unsigned short val_node);
687 
693  void SetNode(unsigned short val_node, unsigned long val_point);
694 
701  unsigned short GetFaces(unsigned short val_face, unsigned short val_index);
702 
709  unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index);
710 
716  unsigned short GetnNeighbor_Nodes(unsigned short val_node);
717 
723  unsigned short GetnNodesFace(unsigned short val_face);
724 
729  unsigned short GetnNodes(void);
730 
735  unsigned short GetnFaces(void);
736 
741  unsigned short GetMaxNodesFace(void);
742 
747  unsigned short GetVTK_Type(void);
748 
753  unsigned short GetnNeighbor_Elements(void);
754 
758  void Change_Orientation(void);
759 
764  void SetDomainElement(unsigned long val_domainelement);
765 
770  unsigned long GetDomainElement(void);
771 };
772 
779 class CTetrahedron : public CPrimalGrid {
780 private:
781  static unsigned short Faces[4][3];
782  static unsigned short Neighbor_Nodes[4][3];
783  static unsigned short nNodesFace[4];
784  static unsigned short nNeighbor_Nodes[4];
785  static unsigned short nFaces;
786  static unsigned short nNodes;
787  static unsigned short VTK_Type;
788  static unsigned short maxNodesFace;
789  static unsigned short nNeighbor_Elements;
791 public:
792 
800  CTetrahedron(unsigned long val_point_0, unsigned long val_point_1,
801  unsigned long val_point_2, unsigned long val_point_3);
802 
806  ~CTetrahedron(void);
807 
813  unsigned long GetNode(unsigned short val_node);
814 
820  void SetNode(unsigned short val_node, unsigned long val_point);
821 
828  unsigned short GetFaces(unsigned short val_face, unsigned short val_index);
829 
836  unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index);
837 
843  unsigned short GetnNeighbor_Nodes(unsigned short val_node);
844 
850  unsigned short GetnNodesFace(unsigned short val_face);
851 
856  unsigned short GetnNodes(void);
857 
862  unsigned short GetnFaces(void);
863 
868  unsigned short GetMaxNodesFace(void);
869 
874  unsigned short GetVTK_Type(void);
875 
880  unsigned short GetnNeighbor_Elements(void);
881 
885  void Change_Orientation(void);
886 };
887 
894 class CHexahedron : public CPrimalGrid {
895 private:
896  static unsigned short Faces[6][4];
897  static unsigned short Neighbor_Nodes[8][3];
898  static unsigned short nNodesFace[6];
899  static unsigned short nNeighbor_Nodes[8];
900  static unsigned short nFaces;
901  static unsigned short nNodes;
902  static unsigned short VTK_Type;
903  static unsigned short maxNodesFace;
904  static unsigned short nNeighbor_Elements;
906 public:
907 
919  CHexahedron(unsigned long val_point_0, unsigned long val_point_1,
920  unsigned long val_point_2, unsigned long val_point_3,
921  unsigned long val_point_4, unsigned long val_point_5,
922  unsigned long val_point_6, unsigned long val_point_7);
923 
927  ~CHexahedron(void);
928 
934  unsigned long GetNode(unsigned short val_node);
935 
941  void SetNode(unsigned short val_node, unsigned long val_point);
942 
949  unsigned short GetFaces(unsigned short val_face, unsigned short val_index);
950 
958  unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index);
959 
965  unsigned short GetnNeighbor_Nodes(unsigned short val_node);
966 
972  unsigned short GetnNodesFace(unsigned short val_face);
973 
978  unsigned short GetnNodes(void);
979 
984  unsigned short GetnFaces(void);
985 
990  unsigned short GetMaxNodesFace(void);
991 
996  unsigned short GetVTK_Type(void);
997 
1002  unsigned short GetnNeighbor_Elements(void);
1003 
1007  void Change_Orientation(void);
1008 };
1009 
1016 class CPrism : public CPrimalGrid {
1017 private:
1018  static unsigned short Faces[5][4];
1019  static unsigned short Neighbor_Nodes[6][3];
1020  static unsigned short nNodesFace[5];
1021  static unsigned short nNeighbor_Nodes[6];
1022  static unsigned short nFaces;
1023  static unsigned short nNodes;
1024  static unsigned short VTK_Type;
1025  static unsigned short maxNodesFace;
1026  static unsigned short nNeighbor_Elements;
1028 public:
1029 
1039  CPrism(unsigned long val_point_0, unsigned long val_point_1,
1040  unsigned long val_point_2, unsigned long val_point_3,
1041  unsigned long val_point_4, unsigned long val_point_5);
1042 
1046  ~CPrism(void);
1047 
1053  unsigned long GetNode(unsigned short val_node);
1054 
1060  void SetNode(unsigned short val_node, unsigned long val_point);
1061 
1068  unsigned short GetFaces(unsigned short val_face, unsigned short val_index);
1069 
1076  unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index);
1077 
1083  unsigned short GetnNeighbor_Nodes(unsigned short val_node);
1084 
1090  unsigned short GetnNodesFace(unsigned short val_face);
1091 
1096  unsigned short GetnNodes(void);
1097 
1102  unsigned short GetnFaces(void);
1103 
1108  unsigned short GetMaxNodesFace(void);
1109 
1114  unsigned short GetVTK_Type(void);
1115 
1120  unsigned short GetnNeighbor_Elements(void);
1121 
1125  void Change_Orientation(void);
1126 };
1127 
1134 class CPyramid : public CPrimalGrid {
1135 private:
1136  static unsigned short Faces[5][4];
1137  static unsigned short Neighbor_Nodes[5][4];
1138  static unsigned short nNodesFace[5];
1139  static unsigned short nNeighbor_Nodes[5];
1140  static unsigned short nFaces;
1141  static unsigned short nNodes;
1142  static unsigned short VTK_Type;
1143  static unsigned short maxNodesFace;
1144  static unsigned short nNeighbor_Elements;
1146 public:
1147 
1156  CPyramid(unsigned long val_point_0, unsigned long val_point_1,
1157  unsigned long val_point_2, unsigned long val_point_3,
1158  unsigned long val_point_4);
1159 
1163  ~CPyramid(void);
1164 
1170  unsigned long GetNode(unsigned short val_node);
1171 
1177  void SetNode(unsigned short val_node, unsigned long val_point);
1178 
1185  unsigned short GetFaces(unsigned short val_face, unsigned short val_index);
1186 
1193  unsigned short GetNeighbor_Nodes(unsigned short val_node, unsigned short val_index);
1194 
1200  unsigned short GetnNeighbor_Nodes(unsigned short val_node);
1201 
1207  unsigned short GetnNodesFace(unsigned short val_face);
1208 
1213  unsigned short GetnNodes(void);
1214 
1219  unsigned short GetnFaces(void);
1220 
1225  unsigned short GetMaxNodesFace(void);
1226 
1231  unsigned short GetVTK_Type(void);
1232 
1237  unsigned short GetnNeighbor_Elements(void);
1238 
1242  void Change_Orientation(void);
1243 };
1244 
1245 #include "primal_grid_structure.inl"
su2double Volume
Volume of the element.
Definition: primal_grid_structure.hpp:68
In-Line subroutines of the primal_grid_structure.hpp file.
All the information about the definition of the physical problem. The subroutines and functions are i...
Class for triangle element definition.
Definition: primal_grid_structure.hpp:523
unsigned long * Nodes
Vector to store the global nodes of an element.
Definition: primal_grid_structure.hpp:56
Headers of the mpi interface for generalized datatypes. The subroutines and functions are in the mpi_...
Headers of the main subroutines for doing the complete dual grid structure. The subroutines and funct...
Class for tetrahedron element definition.
Definition: primal_grid_structure.hpp:779
long * Neighbor_Elements
Vector to store the elements surronding an element.
Definition: primal_grid_structure.hpp:58
Class for quadrilateral element definition.
Definition: primal_grid_structure.hpp:651
Class to define the numerical primal grid.
Definition: primal_grid_structure.hpp:54
static unsigned short nDim
Dimension of the element (2D or 3D) useful for triangles, quadrilateral and edges.
Definition: primal_grid_structure.hpp:62
Class for vertex element definition. This kind of element is used in the parallelization stuff...
Definition: primal_grid_structure.hpp:280
su2double ** Coord_FaceElems_CG
Coordinates of the center-of-gravity of the face of the elements.
Definition: primal_grid_structure.hpp:60
bool Divide
Marker used to know if we are going to divide this element in the adaptation proccess.
Definition: primal_grid_structure.hpp:66
Class for hexahedron element definition.
Definition: primal_grid_structure.hpp:894
su2double * Coord_CG
Coordinates of the center-of-gravity of the element.
Definition: primal_grid_structure.hpp:59
unsigned long GlobalIndex
The global index of an element.
Definition: primal_grid_structure.hpp:57
Class for prism element definition.
Definition: primal_grid_structure.hpp:1016
unsigned long DomainElement
Only for boundaries, in this variable the 3D elements which correspond with a boundary element is sto...
Definition: primal_grid_structure.hpp:64
Class for line element definition.
Definition: primal_grid_structure.hpp:397
Class for pyramid element definition.
Definition: primal_grid_structure.hpp:1134