1 // GetDP - Copyright (C) 1997-2021 P. Dular and C. Geuzaine, University of Liege
2 //
3 // See the LICENSE.txt file for license information. Please report all
4 // issues on https://gitlab.onelab.info/getdp/getdp/issues.
5 
6 #ifndef GEO_DATA_H
7 #define GEO_DATA_H
8 
9 #include "ListUtils.h"
10 #include "TreeUtils.h"
11 
12 struct Grid{
13   int     Init;
14   List_T  * Bricks;
15   double  Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
16   int     Nx, Ny, Nz;
17 };
18 
19 struct GeoData {
20   int     Num ;
21   char    * Name ;
22   List_T  * Nodes, * Elements ;
23   int     NbrElementsWithEdges, NbrElementsWithFacets ;
24   int     NumCurrentEdge,  NumCurrentFacet ;
25   Tree_T  * EdgesXNodes ,  * FacetsXEdges ;
26 
27   Tree_T  * NodesXElements ;
28   Tree_T  * Normals ;
29 
30   List_T  * GroupForPRE ;
31 
32   double  Xmin, Xmax, Ymin, Ymax, Zmin, Zmax ;
33   double  Dimension, CharacteristicLength ;
34 
35   struct Grid Grid;
36 
37   double  * H, * P ;
38 
39   List_T  * PeriodicNodes;
40 } ;
41 
42 int  Geo_AddGeoData(List_T * GeoData_L,
43 		    char * Name_MshFile, char * Name_DefaultMshFile,
44 		    char * Name_AdaptFile, char * Name_DefaultAdaptFile) ;
45 void  Geo_InitGeoData(struct GeoData * GeoData_P, int Num, char * Name) ;
46 void  Geo_FreeGeoData(struct GeoData * GeoData_P) ;
47 
48 void  Geo_SetCurrentGeoData(struct GeoData * GeoData_P) ;
49 
50 void  Geo_OpenFile(char * Name, const char * Mode) ;
51 void  Geo_CloseFile(void) ;
52 void  Geo_ReadFile(struct GeoData * GeoData_P) ;
53 void  Geo_ReadFileAdapt(struct GeoData * GeoData_P) ;
54 
55 void  Geo_SaveMesh(struct GeoData * GeoData_P, List_T * InitialList, char * FileName) ;
56 
57 int  Geo_GetNbrGeoElements(void) ;
58 struct Geo_Element  * Geo_GetGeoElement(int Index_Element) ;
59 int Geo_GetGeoElementIndex(struct Geo_Element * GeoElement) ;
60 struct Geo_Element  * Geo_GetGeoElementOfNum(int Num_Element) ;
61 
62 int  Geo_GetNbrGeoNodes(void) ;
63 struct Geo_Node  * Geo_GetGeoNode(int Index_Node) ;
64 struct Geo_Node  * Geo_GetGeoNodeOfNum(int Num_Node) ;
65 
66 void Geo_GetNodesCoordinates(int Nbr_Node, int * Num_Node,
67 			     double * x, double * y, double * z) ;
68 void Geo_SetNodesCoordinates(int Nbr_Node, int * Num_Node,
69 			     double * x, double * y, double * z) ;
70 
71 void Geo_SetNodesCoordinatesX(int Nbr_Node, int * Num_Node,
72 			     double * x) ;
73 void Geo_SetNodesCoordinatesY(int Nbr_Node, int * Num_Node,
74 			     double * y) ;
75 void Geo_SetNodesCoordinatesZ(int Nbr_Node, int * Num_Node,
76 			     double * z) ;
77 
78 double * Geo_GetNodes_uvw(int Type, int *nbn) ;
79 double * Geo_GetBarycenter_uvw(int Type) ;
80 
81 void  Geo_CreateEdgesOfElement(struct Geo_Element * Geo_Element) ;
82 int  * Geo_GetNodesOfEdgeInElement(struct Geo_Element * Geo_Element, int Num_Edge) ;
83 void  Geo_CreateFacetsOfElement(struct Geo_Element * Geo_Element) ;
84 int  * Geo_GetNodesOfFacetInElement(struct Geo_Element * Geo_Element, int Num_Facet) ;
85 
86 int  * Geo_GetIM_Den(int Type_Element, int * Nbe) ;
87 int  * Geo_GetIM_Dfe(int Type_Element, int * Nbf) ;
88 int  * Geo_GetIM_Dfn(int Type_Element, int * Nbf) ;
89 int  * Geo_GetIM_Den_Xp(int Type_Element, int *Nbe, int *Nbn) ;
90 int  * Geo_GetIM_Dfe_Xp(int Type_Element, int *Nbf, int *Nbe) ;
91 
92 void  Geo_CreateEntitiesOfElement
93   (int Nbr_Entities2, int * D_Element,
94    int   Geo_Element_NbrEntities1, int  * Geo_Element_NumEntities1,
95    int * Geo_Element_NbrEntities2, int ** Geo_Element_NumEntities2,
96    int * Geo_NbrElementsWithEntities2,
97    int * Geo_NumCurrentEntity2, Tree_T * Geo_Entities2XEntities1) ;
98 
99 void Geo_GenerateEdgesOfTree(List_T * InitialList, bool isInitialListEL,
100                              List_T * InitialSuppList, bool isInitialSuppListEL,
101                              List_T * InitialSuppList2, bool isInitialSuppList2EL,
102                              int SuppListType2, List_T ** ExtendedList);
103 void  Geo_GenerateFacetsOfTree(List_T * InitialList, List_T * InitialSuppList,
104                                List_T * InitialSuppList2,
105 			       List_T ** ExtendedList) ;
106 
107 int  fcmp_GeoData_Name(const void * a, const void * b) ;
108 int  fcmp_Elm(const void * a, const void * b) ;
109 int  fcmp_Nod(const void * a, const void * b) ;
110 int  fcmp_E2XE1(const void * a, const void * b) ;
111 void free_E2XE1(void * a, void * b) ;
112 int  fcmp_EXVector(const void * a, const void * b) ;
113 
114 void  Geo_WriteFilePRE(struct GeoData * GeoData_P, List_T * Group_L) ;
115 void  Geo_ReadFilePRE(struct GeoData * GeoData_P, int NbrGeoData, List_T * Group_L) ;
116 
117 void  Geo_WriteEntities2XEntities1(void * a, void * b) ;
118 
119 void  Geo_AddGroupForPRE(int Num) ;
120 
121 void  Geo_CreateNodesXElements(int NumNode, int InIndex,
122 			       int *NbrElements, int **NumElements) ;
123 
124 void  Geo_CreateNormal(int Type, double *x, double *y, double *z, double *N) ;
125 
126 void  Geo_CreateNormalOfElement(struct Geo_Element *GeoElement, double *Normal) ;
127 
128 
129 #endif
130