17 #include <SphereTessellatorCLP.h> 24 main (
int argc,
char *argv[])
28 typedef double TElement;
32 TessellatorPointer tessellator = TessellatorType::New();
34 if ( _BasicShape ==
"TETRAHEDRON" )
35 tessellator->SetBasicShape(TessellatorType::TETRAHEDRON);
36 if ( _BasicShape ==
"OCTAHEDRON" )
37 tessellator->SetBasicShape(TessellatorType::OCTAHEDRON);
38 if ( _BasicShape ==
"ICOSAHEDRON" )
39 tessellator->SetBasicShape(TessellatorType::ICOSAHEDRON);
41 tessellator->SetOrder(_Order);
42 tessellator->TessellateSphere();
44 unsigned int numberOfVertices = tessellator->GetNumberOfVertices();
45 unsigned int numberOfFaces = tessellator->GetNumberOfFaces();
46 unsigned int numberOfEdges = tessellator->GetNumberOfEdges();
50 ofs.open ( _OutputFile.c_str() );
51 utlAssert (ofs,
"\nERROR : failed to open output file " << _OutputFile );
53 TessellatorType::PointsMatrixType points = tessellator->GetPointsMatrix();
54 TessellatorType::CellsMatrixType cells = tessellator->GetCellsMatrix();
83 if (_NumberOfDirectionsArg.isSet() && !_HemisphereArg.isSet())
84 ofs << numberOfVertices <<
" " << numberOfFaces <<
" " << numberOfEdges <<
"\n";
85 if (_NumberOfDirectionsArg.isSet() && _HemisphereArg.isSet())
86 ofs << numberOfVertices/2 <<
"\n";
88 if (!_HemisphereArg.isSet())
90 for (
int i = 0; i < numberOfVertices; i += 1 )
91 ofs << points(i,0) <<
" " << points(i,1) <<
" " << points(i,2) <<
"\n";
95 for (
int i = 0; i < numberOfVertices; i += 1 )
98 || (
std::abs(points(i,2))<1e-20 && points(i,1)<0)
99 || (
std::abs(points(i,2))<1e-20 &&
std::abs(points(i,1))<1e-20 && points(i,0)>0))
100 ofs << points(i,0) <<
" " << points(i,1) <<
" " << points(i,2) <<
"\n";
104 if (_CellArg.isSet() && !_HemisphereArg.isSet())
106 for (
int i = 0; i <numberOfFaces; i += 1 )
107 ofs << cells(i,0) <<
" " << cells(i,1) <<
" " << cells(i,2) <<
"\n";
helper functions specifically used in dmritool
T abs(const T x)
template version of the fabs function
#define utlAssert(cond, expout)
SmartPointer< Self > Pointer
Tesselates a sphere via subdivision of tetrahedron, octahedron, or icosahedron.
int main(int argc, char *argv[])