16 fprintf(stderr,
"Usage: XmlToTecplotWireFrame meshfile\n");
21 = LibUtilities::SessionReader::CreateInstance(argc, argv);
25 string meshfile(argv[argc-1]);
31 int expdim = mesh->GetMeshDimension();
41 string outname(strtok(argv[argc-1],
"."));
43 FILE *fp = fopen(outname.c_str(),
"w");
48 int nverts = mesh->GetNvertices();
50 fprintf(fp,
"Variables = x, y\n");
51 fprintf(fp,
"Zone,N=%d, E=%d,DATAPACKING=POINT,ZONETYPE=FEQUADRILATERAL\n",nverts,(
int)(trigeom.size()+quadgeom.size()));
53 for(
int i = 0; i < nverts; ++i)
55 mesh->GetVertex(i)->GetCoords(x,y,z);
56 fprintf(fp,
"%lf %lf\n",x,y);
60 for(triIter = trigeom.begin(); triIter != trigeom.end(); ++triIter)
62 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);
66 for(quadIter = quadgeom.begin(); quadIter != quadgeom.end(); ++quadIter)
68 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);
76 string outname(strtok(argv[argc-1],
"."));
78 FILE *fp = fopen(outname.c_str(),
"w");
90 int nverts = mesh->GetNvertices();
97 for(tetIter = tetgeom.begin(); tetIter != tetgeom.end(); ++tetIter)
99 for(i = 0; i < 4; ++i)
101 int vid = (tetIter->second)->GetVid(i);
102 if(vertid.count(vid) == 0)
104 vertord.push_back(vid);
110 for(pyrIter = pyrgeom.begin(); pyrIter != pyrgeom.end(); ++pyrIter)
112 for(i = 0; i < 5; ++i)
114 int vid = (pyrIter->second)->GetVid(i);
115 if(vertid.count(vid) == 0)
117 vertord.push_back(vid);
124 for(prismIter = prismgeom.begin(); prismIter != prismgeom.end(); ++prismIter)
126 for(i = 0; i < 5; ++i)
128 int vid = (prismIter->second)->GetVid(i);
129 if(vertid.count(vid) == 0)
131 vertord.push_back(vid);
137 for(hexIter = hexgeom.begin(); hexIter != hexgeom.end(); ++hexIter)
139 for(i = 0; i < 6; ++i)
141 int vid = (hexIter->second)->GetVid(i);
142 if(vertid.count(vid) == 0)
144 vertord.push_back(vid);
150 ASSERTL0(cnt == nverts,
"Vertex count did not match");
152 fprintf(fp,
"Variables = x, y, z\n");
153 fprintf(fp,
"Zone,N=%d, E=%d,DATAPACKING=POINT,ZONETYPE=FEBRICK\n",nverts,(
int)(tetgeom.size() + pyrgeom.size() + prismgeom.size() + hexgeom.size()));
158 for(i = 0; i < nverts; ++i)
160 mesh->GetVertex(vertord[i])->GetCoords(x,y,z);
161 fprintf(fp,
"%lf %lf %lf \n",x,y,z);
168 for(tetIter = tetgeom.begin(); tetIter != tetgeom.end(); ++tetIter)
171 fprintf(fp,
"%d %d %d %d %d %d %d %d\n",
172 vertid[(tetIter->second)->GetVid(0)]+1,
173 vertid[(tetIter->second)->GetVid(1)]+1,
174 vertid[(tetIter->second)->GetVid(2)]+1,
175 vertid[(tetIter->second)->GetVid(2)]+1,
176 vertid[(tetIter->second)->GetVid(3)]+1,
177 vertid[(tetIter->second)->GetVid(3)]+1,
178 vertid[(tetIter->second)->GetVid(3)]+1,
179 vertid[(tetIter->second)->GetVid(3)]+1);
183 for(pyrIter = pyrgeom.begin(); pyrIter != pyrgeom.end(); ++pyrIter)
185 fprintf(fp,
"%d %d %d %d %d %d %d %d\n",
186 vertid[(pyrIter->second)->GetVid(0)]+1,
187 vertid[(pyrIter->second)->GetVid(1)]+1,
188 vertid[(pyrIter->second)->GetVid(3)]+1,
189 vertid[(pyrIter->second)->GetVid(2)]+1,
190 vertid[(pyrIter->second)->GetVid(4)]+1,
191 vertid[(pyrIter->second)->GetVid(4)]+1,
192 vertid[(pyrIter->second)->GetVid(4)]+1,
193 vertid[(pyrIter->second)->GetVid(4)]+1);
196 for(prismIter = prismgeom.begin(); prismIter != prismgeom.end(); ++prismIter)
198 fprintf(fp,
"%d %d %d %d %d %d %d %d\n",
199 vertid[(prismIter->second)->GetVid(0)]+1,
200 vertid[(prismIter->second)->GetVid(1)]+1,
201 vertid[(prismIter->second)->GetVid(3)]+1,
202 vertid[(prismIter->second)->GetVid(2)]+1,
203 vertid[(prismIter->second)->GetVid(4)]+1,
204 vertid[(prismIter->second)->GetVid(4)]+1,
205 vertid[(prismIter->second)->GetVid(5)]+1,
206 vertid[(prismIter->second)->GetVid(5)]+1);
209 for(hexIter = hexgeom.begin(); hexIter != hexgeom.end(); ++hexIter)
211 fprintf(fp,
"%d %d %d %d %d %d %d %d\n",
212 vertid[(hexIter->second)->GetVid(0)]+1,
213 vertid[(hexIter->second)->GetVid(1)]+1,
214 vertid[(hexIter->second)->GetVid(3)]+1,
215 vertid[(hexIter->second)->GetVid(2)]+1,
216 vertid[(hexIter->second)->GetVid(4)]+1,
217 vertid[(hexIter->second)->GetVid(5)]+1,
218 vertid[(hexIter->second)->GetVid(7)]+1,
219 vertid[(hexIter->second)->GetVid(6)]+1);
226 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