15 fprintf(stderr,
"Usage: XmlToTecplotWireFrame meshfile\n");
20 = LibUtilities::SessionReader::CreateInstance(argc, argv);
24 string meshfile(argv[argc-1]);
30 int expdim = mesh->GetMeshDimension();
40 string outname(strtok(argv[argc-1],
"."));
42 FILE *fp = fopen(outname.c_str(),
"w");
47 int nverts = mesh->GetNvertices();
49 fprintf(fp,
"Variables = x, y\n");
50 fprintf(fp,
"Zone,N=%d, E=%d,DATAPACKING=POINT,ZONETYPE=FEQUADRILATERAL\n",nverts,(
int)(trigeom.size()+quadgeom.size()));
52 for(
int i = 0; i < nverts; ++i)
54 mesh->GetVertex(i)->GetCoords(x,y,z);
55 fprintf(fp,
"%lf %lf\n",x,y);
59 for(triIter = trigeom.begin(); triIter != trigeom.end(); ++triIter)
61 fprintf(fp,
"%d %d %d %d\n",(triIter->second)->GetVid(0)+1,(triIter->second)->GetVid(1)+1,(triIter->second)->GetVid(2)+1,(triIter->second)->GetVid(2)+1);
65 for(quadIter = quadgeom.begin(); quadIter != quadgeom.end(); ++quadIter)
67 fprintf(fp,
"%d %d %d %d\n",(quadIter->second)->GetVid(0)+1,(quadIter->second)->GetVid(1)+1,(quadIter->second)->GetVid(2)+1,(quadIter->second)->GetVid(3)+1);
75 string outname(strtok(argv[argc-1],
"."));
77 FILE *fp = fopen(outname.c_str(),
"w");
89 int nverts = mesh->GetNvertices();
96 for(tetIter = tetgeom.begin(); tetIter != tetgeom.end(); ++tetIter)
98 for(i = 0; i < 4; ++i)
100 int vid = (tetIter->second)->GetVid(i);
101 if(vertid.count(vid) == 0)
103 vertord.push_back(vid);
109 for(pyrIter = pyrgeom.begin(); pyrIter != pyrgeom.end(); ++pyrIter)
111 for(i = 0; i < 5; ++i)
113 int vid = (pyrIter->second)->GetVid(i);
114 if(vertid.count(vid) == 0)
116 vertord.push_back(vid);
123 for(prismIter = prismgeom.begin(); prismIter != prismgeom.end(); ++prismIter)
125 for(i = 0; i < 5; ++i)
127 int vid = (prismIter->second)->GetVid(i);
128 if(vertid.count(vid) == 0)
130 vertord.push_back(vid);
136 for(hexIter = hexgeom.begin(); hexIter != hexgeom.end(); ++hexIter)
138 for(i = 0; i < 6; ++i)
140 int vid = (hexIter->second)->GetVid(i);
141 if(vertid.count(vid) == 0)
143 vertord.push_back(vid);
149 ASSERTL0(cnt == nverts,
"Vertex count did not match");
151 fprintf(fp,
"Variables = x, y, z\n");
152 fprintf(fp,
"Zone,N=%d, E=%d,DATAPACKING=POINT,ZONETYPE=FEBRICK\n",nverts,(
int)(tetgeom.size() + pyrgeom.size() + prismgeom.size() + hexgeom.size()));
157 for(i = 0; i < nverts; ++i)
159 mesh->GetVertex(vertord[i])->GetCoords(x,y,z);
160 fprintf(fp,
"%lf %lf %lf \n",x,y,z);
167 for(tetIter = tetgeom.begin(); tetIter != tetgeom.end(); ++tetIter)
170 fprintf(fp,
"%d %d %d %d %d %d %d %d\n",
171 vertid[(tetIter->second)->GetVid(0)]+1,
172 vertid[(tetIter->second)->GetVid(1)]+1,
173 vertid[(tetIter->second)->GetVid(2)]+1,
174 vertid[(tetIter->second)->GetVid(2)]+1,
175 vertid[(tetIter->second)->GetVid(3)]+1,
176 vertid[(tetIter->second)->GetVid(3)]+1,
177 vertid[(tetIter->second)->GetVid(3)]+1,
178 vertid[(tetIter->second)->GetVid(3)]+1);
182 for(pyrIter = pyrgeom.begin(); pyrIter != pyrgeom.end(); ++pyrIter)
184 fprintf(fp,
"%d %d %d %d %d %d %d %d\n",
185 vertid[(pyrIter->second)->GetVid(0)]+1,
186 vertid[(pyrIter->second)->GetVid(1)]+1,
187 vertid[(pyrIter->second)->GetVid(3)]+1,
188 vertid[(pyrIter->second)->GetVid(2)]+1,
189 vertid[(pyrIter->second)->GetVid(4)]+1,
190 vertid[(pyrIter->second)->GetVid(4)]+1,
191 vertid[(pyrIter->second)->GetVid(4)]+1,
192 vertid[(pyrIter->second)->GetVid(4)]+1);
195 for(prismIter = prismgeom.begin(); prismIter != prismgeom.end(); ++prismIter)
197 fprintf(fp,
"%d %d %d %d %d %d %d %d\n",
198 vertid[(prismIter->second)->GetVid(0)]+1,
199 vertid[(prismIter->second)->GetVid(1)]+1,
200 vertid[(prismIter->second)->GetVid(3)]+1,
201 vertid[(prismIter->second)->GetVid(2)]+1,
202 vertid[(prismIter->second)->GetVid(4)]+1,
203 vertid[(prismIter->second)->GetVid(4)]+1,
204 vertid[(prismIter->second)->GetVid(5)]+1,
205 vertid[(prismIter->second)->GetVid(5)]+1);
208 for(hexIter = hexgeom.begin(); hexIter != hexgeom.end(); ++hexIter)
210 fprintf(fp,
"%d %d %d %d %d %d %d %d\n",
211 vertid[(hexIter->second)->GetVid(0)]+1,
212 vertid[(hexIter->second)->GetVid(1)]+1,
213 vertid[(hexIter->second)->GetVid(3)]+1,
214 vertid[(hexIter->second)->GetVid(2)]+1,
215 vertid[(hexIter->second)->GetVid(4)]+1,
216 vertid[(hexIter->second)->GetVid(5)]+1,
217 vertid[(hexIter->second)->GetVid(7)]+1,
218 vertid[(hexIter->second)->GetVid(6)]+1);
225 ASSERTL0(
false,
"Expansion dimension not recognised");
#define ASSERTL0(condition, msg)
std::map< int, PrismGeomSharedPtr > PrismGeomMap
std::map< int, PyrGeomSharedPtr > PyrGeomMap
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
std::map< int, TetGeomSharedPtr > TetGeomMap
std::map< int, TriGeomSharedPtr > TriGeomMap
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
std::map< int, QuadGeomSharedPtr > QuadGeomMap
boost::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::map< int, HexGeomSharedPtr > HexGeomMap