18 size_t numTri = iTriangles.size();
22 file.open( iName.data() );
25 file <<
"# vtk DataFile Version 2.0\n";
26 file <<
"Geometry of a PolygonLine\n";
29 file <<
"DATASET UNSTRUCTURED_GRID\n";
31 int numPoints = numTri * 3;
33 file <<
"POINTS " << numPoints <<
"double\n";
35 for (
size_t i = 0; i < numTri; i++ ) {
36 for (
int j = 1; j <= 3; j++ ) {
37 const double &x = iTriangles.at(i).giveVertex(j).at(1);
38 const double &y = iTriangles.at(i).giveVertex(j).at(2);
39 file << x <<
" " << y <<
" 0.0\n";
45 file <<
"CELLS " << numTri <<
" " << numTri * 4 <<
"\n";
47 for (
size_t i = 0; i < numTri; i++ ) {
48 file << 3 <<
" " << 3 * i <<
" " << 3 * i + 1 <<
" " << 3 * i + 2 <<
"\n";
53 file <<
"CELL_TYPES " << numTri <<
"\n";
55 for (
size_t i = 0; i < numTri; i++ ) {
56 file << vtkCellType <<
"\n";
68 file.open( iName.data() );
71 file <<
"# vtk DataFile Version 2.0\n";
72 file <<
"Gauss points\n";
75 file <<
"DATASET UNSTRUCTURED_GRID\n";
77 int numPoints = iPoints.size();
79 file <<
"POINTS " << numPoints <<
" double\n";
81 for (
int i = 1; i <= numPoints; i++ ) {
83 const double &x = iPoints [ i - 1 ].at(1);
84 const double &y = iPoints [ i - 1 ].at(2);
86 if ( iPoints [ i - 1 ].giveSize() == 3 ) {
87 z = iPoints [ i - 1 ].at(3);
90 file << x <<
" " << y <<
" " << z <<
"\n";
96 file <<
"CELLS " << numPoints <<
" " << numPoints * 2 <<
"\n";
98 for (
int i = 0; i < numPoints; i++ ) {
99 file << 1 <<
" " << i <<
"\n";
104 file <<
"CELL_TYPES " << numPoints <<
"\n";
106 for (
int i = 0; i < numPoints; i++ ) {
107 file << vtkCellType <<
"\n";
115 std :: ofstream file;
116 file.open( iName.data() );
120 for (
size_t i = 0; i < iX.size(); i++ ) {
121 file << iX [ i ] <<
"\n";
130 for (
size_t i = 0; i < iY.size(); i++ ) {
131 file << iY [ i ] <<
"\n";
141 if ( iX.size() != iY.size() ) {
143 printf(
"Warning: iX.size() != iY.size()\n");
147 std :: ofstream file;
148 file.open( iName.data() );
151 file << std :: scientific;
155 for (
size_t i = 0; i < iX.size(); i++ ) {
156 file << iX [ i ] <<
" " << iY [ i ] <<
"\n";
the oofem namespace is to define a context or scope in which all oofem names are defined.