The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings MMD
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

877dc9f59cd21d855b137e56b7d94cdf9653a9a6
1 #ifndef INIT_H
2 #define INIT_H
4 #include <stdio.h>
5 #include <stdlib.h>
7 #include <math.h>
8 #include <quadmath.h>
10 #include <malloc.h>
11 #include <memory.h>
13 #include <time.h>
15 #include <vtkCellType.h>
17 #define NBAFFICHE 10
19 #define DIM3D 3
22 //typedef __float128 dataType; // attention aux opérations
23 typedef double dataType;
24 typedef unsigned char connectivity_short;
25 typedef unsigned long connectivity_int;
26 typedef unsigned long count_int;
28 static dataType SMALL   = 1.0E-16;
29 static dataType VSMALL  = 1.0E-30;
32 #define ZEROVECTOR  {0.0, 0.0, 0.0}
33 #define ZEROSCALAR    0.0
36 #define HEXAHEDRON 8
37 #define HEXAHEDRON_FACES 6
38 #define HEXAHEDRON_DUAL_FACE_POINT 4
39 #define HEXAHEDRON_SEGMENTS 12
40 #define QUAD 4
41 #define SEGMENTVERTEX 2
42 #define MAXSIZECONNECTIVITYVECTOR 1024
44 extern connectivity_int  hexaedron_localNodeList[HEXAHEDRON_FACES][QUAD];
46 extern connectivity_int  hexaedron_localNodeListNumbers[HEXAHEDRON_FACES];
48 extern connectivity_int  hexaedron_localSegmentList[HEXAHEDRON_SEGMENTS][SEGMENTVERTEX];
50 extern connectivity_int  hexaedron_localSegmentsListNumbers[HEXAHEDRON_SEGMENTS];
52 struct dualMesh {
54   connectivity_int    internalDualFacesNumber;
55   dataType         ***internalDualFaces;
56   dataType          **internalDualFaceCentres;
57   dataType          **internalDualFaceArea;
58   
59   connectivity_int ** segmentToInternalDualFace;
60   connectivity_int *  segmentToInternalDualFaceNumber;
61   
62   
63 };
65 struct primalMesh {
68     // structrured Mesh
69     connectivity_int M; dataType L;
70     connectivity_int N; dataType l;
71     connectivity_int P; dataType H;
73     // Element Number
74     connectivity_int vertexNumber;  // vertex number
75     connectivity_int segmentNumber;  // segment number
76     connectivity_int faceNumber; //surface number
77     connectivity_int cellNumber;  // cell number
79     // Cells
80     connectivity_int            **         cellToCells; // done
81     connectivity_int            *          cellToCellsNumbers; // done
84     // Vertex
85     dataType                    **         vertex;
86     connectivity_int            **         cellToVertex; // done
87     connectivity_int            **         vertexToCells;
88     connectivity_int            *          vertexToCellNumbers;
90     connectivity_int            **         vertexToSegments; // done
91     connectivity_int            *          vertexToSegmentNumber; // done
92     connectivity_int            *          cellToVertexNumber; // done
96     // Segments
97     connectivity_int **     segmentToVertex;
98     connectivity_int **     faceToSegment;
100     connectivity_int **     segments;
103     // Surfaces
104     connectivity_int **     faces;
105     connectivity_int **     cellToFaces;
106     connectivity_int *      cellToFacesNumber;
107     connectivity_int **     cellToFacesOwner;
108     connectivity_int **     cellToFacesNeighbour;
109     connectivity_int *      cellToFacesOwnerNumber;
110     connectivity_int *      cellToFacesNeighbourNumber;
111     connectivity_int **     cellToSegmentOwner;
112     connectivity_int *      cellToSegmentOwnerNumber;
113     connectivity_int **     cellToSegmentNeighbour;
114     connectivity_int *      cellToSegmentNeighbourNumber;
115     
116     connectivity_int **     vertexToFaces;
117     connectivity_int *      vertexToFacesNumber;
118     connectivity_int **     vertexToSegmentOwner;
119     connectivity_int *      vertexToSegmentOwnerNumber;
120     connectivity_int **     vertexToSegmentNeighbour;
121     connectivity_int *      vertexToSegmentNeighbourNumber;
123     connectivity_int **     segmentToFaceOwner;
124     connectivity_int *      segmentToFaceOwnerNumber;
125     connectivity_int **     segmentToFaceNeighbour;
126     connectivity_int *      segmentToFaceNeighbourNumber;
127     dataType       **       segmentCentres;
130     connectivity_int *      faceToVertexNumber; // done
131     connectivity_int *      faceToCellsNumber; // done
132     connectivity_int **     faceToVertex; // vertexToFaces -> facesTo
133     connectivity_int **     faceToSegments;
134     connectivity_int **     faceToCells;
135     dataType       **       faceCentres;
136     dataType       **       faceAreas;
139     dataType       **   volumeCentroid;
140     dataType        *   volume;
142     // boundaries
144 };
149 struct simulationData {
151     char *      simulationName;
152     connectivity_int    iteration;
153     double      time;
154     int         dimension;
155 };
158 struct readWriteVTK {
159     char *      fileName;
160     FILE *      handle;
161     int         binary;
162     char *      dataName;
164     struct simulationData * mySimulationData;
166 };
169 #ifdef DEBUG
170 #define DEBUG_TEST 1
171 #else
172 #define DEBUG_TEST 0
173 #endif // DEBUG
176 //#define debug_print(...) \
177 //    do { if (DEBUG_TEST) fprintf(stderr, __VA_ARGS__); fflush(stderr);fflush(stdout);} while (0)
179 //#define release_print(...) \
180 //    do {  printf( __VA_ARGS__); fflush(stderr);fflush(stdout);} while (0)
182 #define debug_print(...) \
183     do { if (DEBUG_TEST) fprintf(stderr, __VA_ARGS__); } while (0)
185 #define release_print(...) \
186     do {  printf( __VA_ARGS__); } while (0)
188 /*
189 #define debug_print(...) \
190     { if (DEBUG_TEST) printf( __VA_ARGS__); }
191 */
192 /*
193 #define debug_print(fmt, ...) \
194         do { if (DEBUG) fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
195                                 __LINE__, __func__, __VA_ARGS__); } while (0)
196 */
198 #define ERROR_TEST(x) \
199 { \
200     do { \
201     if (!x) { \
202     fprintf(stderr, "Internal error ERROR_TEST: FILE %s at LINE %d in FUNCTION %s : " x "\n", __FILE__, __LINE__, __FUNCTION__); \
203     exit(1);\
204     } \
205     } while (0)
207 #define affiche(...) \
208  do {  printf( __VA_ARGS__); } while (0)
212 #endif // INIT_H