45 std::string stringTemp;
46 FileName = FiletoRead;
51 int64_t numelements=0;
52 int64_t elements3DT=0;
53 int64_t elements3DH=0;
54 int64_t elements2DT=0;
55 int64_t elements2DQ=0;
60 int64_t NumEntitiestoRead;
65 std::ifstream
read (FileName.c_str());
66 if (!
read.is_open())
return 0;
67 std::string FlagString;
72 read.getline(buf, 1024);
74 flag = str.find(
"---");
78 if(str !=
"--- ELEMENTS ---" && str !=
"--- ELEMENTS ---\r")
83 if(str ==
"LINEAR" || str ==
"LINEAR\r" )
87 if(str ==
"TRIANGLE" || str ==
"TRIANGLE\r")
91 if(str ==
"QUADRILATERAL" || str ==
"QUADRILATERAL\r")
95 if(str ==
"TETRAHEDRA" || str ==
"TETRAHEDRA\r")
99 if(str ==
"HEXAHEDRA" || str ==
"HEXAHEDRA\r")
106 FlagString =
"EndReading";
110 NumEntitiestoRead = SentinelString.
size();
116 std::ifstream
read (FileName.c_str());
117 std::string FlagString;
123 read.getline(buf, 1024);
124 std::string str(buf);
127 if(str == SentinelString[cont])
131 if(SentinelString[cont] ==
"" || SentinelString[cont] ==
"\r")
136 if(SentinelString[cont] ==
"EndReading")
141 if( (str !=
"" || str !=
"\r") && FlagString == SentinelString[cont])
146 read.getline(buftemp, 1024);
147 std::string strtemp(buftemp);
149 if(strtemp ==
"" || strtemp ==
"\r")
165 for (int64_t i = 0 ; i < NumEntitiestoRead; i++ )
167 if(SentinelString[i] ==
"--- USED MATERIALS ---" || SentinelString[i] ==
"--- USED MATERIALS ---\r")
169 nMats=GeneralData[i];
172 if(SentinelString[i] ==
"--- CONDITIONS OVER NODES ---" || SentinelString[i] ==
"--- CONDITIONS OVER NODES ---\r")
174 if(GeneralData[i] !=0)
177 elements0D=GeneralData[i];
186 if(SentinelString[i] ==
"--- NODES ---" || SentinelString[i] ==
"--- NODES ---\r")
188 numnodes=GeneralData[i];
191 if(SentinelString[i] ==
"LINEAR" || SentinelString[i] ==
"LINEAR\r")
193 elements1D=GeneralData[i];
196 if(SentinelString[i] ==
"TRIANGLE" || SentinelString[i] ==
"TRIANGLE\r")
198 elements2DT=GeneralData[i];
201 if(SentinelString[i] ==
"QUADRILATERAL" || SentinelString[i] ==
"QUADRILATERAL\r")
203 elements2DQ=GeneralData[i];
206 if(SentinelString[i] ==
"TETRAHEDRA" || SentinelString[i] ==
"TETRAHEDRA\r")
208 elements3DT=GeneralData[i];
211 if(SentinelString[i] ==
"HEXAHEDRA" || SentinelString[i] ==
"HEXAHEDRA\r")
213 elements3DH=GeneralData[i];
219 numelements=elements3DT+elements3DH+elements2DT+elements2DQ+elements1D+elements0D;
224 gmesh -> NodeVec().Resize(numnodes);
226 const int64_t Tnodes = numnodes;
229 double nodecoordX , nodecoordY , nodecoordZ ;
230 int64_t elementId = 0;
234 int64_t ContNode = 0;
235 int64_t ContPoint = 0;
236 int64_t ContLine = 0;
237 int64_t ContTrian = 0;
238 int64_t ContQuad = 0;
252 std::ifstream
read (FileName.c_str());
253 std::string FlagString;
260 read.getline(buf, 1024);
261 std::string str(buf);
262 std::string strtemp=
"InitialState";
265 if(str == SentinelString[cont])
270 if(SentinelString[cont] ==
"" || SentinelString[cont] ==
"\r")
275 if(SentinelString[cont] ==
"EndReading")
280 if( (str !=
"" || str !=
"\r" )&& FlagString == SentinelString[cont])
285 switch (DataToProcess[cont]) {
289 if (GeneralData[cont] != 0)
292 read.getline(buf, 1024);
293 int64_t spacecont = 0;
311 else if(spacecont==1)
314 if(*p==
'D' || *p==
'd')
348 if(ContMats == nMats)
358 if (GeneralData[cont] != 0)
362 read.getline(buf, 1024);
366 read >> TopolPoint[0];
368 read.getline(buf, 1024);
374 if(ContPoint == elements0D)
382 if (GeneralData[cont] != 0)
388 read.getline(buf, 1024);
389 int64_t spacecont = 0;
398 if(spacecont==0) nodeId = atoi(p);
399 else if(spacecont==1) Layerid = atoi(p);
400 else if(spacecont==2) nodecoordX = atof(p);
401 else if(spacecont==3) nodecoordY = atof(p);
411 nodecoordY = atof(p);
418 nodecoordZ = atof(p);
437 Node[nodeId-1].SetNodeId(nodeid);
441 gmesh->
NodeVec()[nodeid] = Node[nodeId-1];
444 if(ContNode == numnodes)
453 if (GeneralData[cont] != 0)
458 read >> TopolLine[0];
459 read >> TopolLine[1];
466 if(ContLine == elements1D)
474 if (GeneralData[cont] != 0)
480 read >> TopolTriangle[0];
481 read >> TopolTriangle[1];
482 read >> TopolTriangle[2];
490 if(ContTrian == elements2DT)
499 if (GeneralData[cont] != 0)
504 read >> TopolQuad[0];
505 read >> TopolQuad[1];
506 read >> TopolQuad[2];
507 read >> TopolQuad[3];
516 if(ContQuad == elements2DQ)
525 if (GeneralData[cont] != 0)
542 if(ContTet == elements3DT)
551 if (GeneralData[cont] != 0)
576 if(ContHex == elements3DH)
589 if(strtemp ==
"" || strtemp ==
"\r")
603 std::cout <<
"Read General Mesh Data -> done!" << std::endl;
605 std::cout <<
"Geometric Mesh Connectivity -> done!" << std::endl;
int64_t CreateUniqueNodeId()
Returns ++fNodeMaxId.
Contains declaration of TPZGeoElSide class which represents an element and its side, and TPZGeoElSideIndex class which represents an TPZGeoElSide index.
Contains the TPZReadGIDGrid class which implement the interface between TPZGeoMesh and the files in d...
This class implements a simple vector storage scheme for a templated class T. Utility.
void SetfDimensionlessL(REAL fDimensionlessLValue)
Max domain dimension for dimensionless geometry.
int BCNumber
Number of Boundary Conditions.
int64_t size() const
Returns the number of elements of the vector.
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
void Push(const T object)
Pushes a copy of the object on the stack.
TPZStack< MaterialDataV > fMaterialDataVec
MaterialVec.
Implements a generic geometric element which is refined according to a generic refinement pattern...
Contains the TPZGeoBlend class which implements a blending map from curved boundaries to the interior...
Contains the TPZGeoTetrahedra class which implements the geometry of a tetrahedral element...
int fProblemDimension
Mesh Dimension.
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Contains the TPZGenGrid class which implements the generation of a multilayered geometric grid (two-d...
Contains declaration of TPZGeoElRefPattern class which implements a generic geometric element which i...
Contains the TPZRefPattern class which defines the topology of the current refinement pattern to a me...
TPZGeoMesh * GeometricGIDMesh(std::string FiletoRead)
Convert GID Dump files in a TPZGeoMesh object.
Contains the TPZGeoCube class which implements the geometry of hexahedra element. ...
Contains the TPZGeoPoint class which implements the geometry of a point element or 0-D element...
void BuildConnectivity()
Build the connectivity of the grid.
Contains the TPZArc3D class which implements three dimensional arc.
This class implements a geometric mesh for the pz environment. Geometry.
This class implements a stack object. Utility.
TPZStack< REAL > fProperties
TPZStack< MaterialDataV > fBCMaterialDataVec
Contains the TPZCube class which defines the topology of the hexahedron element.
int MatNumber
Number of Materials.
Contains the TPZVTKGeoMesh class which implements the graphical mesh to VTK environment to geometric ...
void push_back(const T object)
REAL fDimensionlessL
Mesh Dimension.