Go to the documentation of this file.
22 #ifndef __triSurfaceFieldToVTK_hpp__
23 #define __triSurfaceFieldToVTK_hpp__
38 std::regex match(
"triSurfaceField\\<([A-Za-z1-9_]*)\\,([A-Za-z1-9_]*)\\>");
39 std::smatch search1, search2;
40 if(!std::regex_match(fieldType, search1, match))
return false;
41 if(!std::regex_match(TYPENAME, search2, match))
return false;
42 if(search1.size()!=3)
return false;
43 if(search1.size()!=search2.size())
return false;
44 return search1[1] == search2[1];
47 template<
typename Type>
57 template<
typename Type>
61 "not implemented function!";
72 os <<
"DATASET POLYDATA" <<
endl;
73 os <<
"POINTS " << nP <<
" float" <<
endl;
76 for (
auto i=0; i<nP; i++ )
78 os << hPoints[i].x() <<
" " << hPoints[i].y() <<
" " << hPoints[i].z() <<
endl;
84 os <<
"POLYGONS " << nV <<
" " << 4*nV <<
endl;
86 for(
auto i=0; i<nV; i++)
88 os<< 3 <<
" "<< hVertices[i].x() <<
" " << hVertices[i].y() <<
" "<<hVertices[i].z()<<
endl;
100 os <<
"DATASET UNSTRUCTURED_GRID" <<
endl;
101 os <<
"POINTS " << nP <<
" float" <<
endl;
104 for (
auto i=0; i<nP; i++ )
106 os << hPoints[i].x() <<
" " << hPoints[i].y() <<
" " << hPoints[i].z() <<
endl;
112 os<<
"CELLS "<< nV<<
' '<< 4*nV<<
'\n';
115 for(
auto i=0; i<nV; i++)
117 os<< 3 <<
" "<< hVertices[i].x() <<
" " << hVertices[i].y() <<
" "<<hVertices[i].z()<<
endl;
120 os<<
"CELL_TYPES "<< nV<<
'\n';
122 for(
int32 i=0; i<nV; i++)
127 os <<
"CELL_DATA " << nV <<
endl;
138 if(size==0)
return true;
141 os <<
"FIELD FieldData 1\n"<<
142 fieldName <<
" 3 " << size <<
" float\n";
143 for(
int32 i=0; i<size; ++i)
145 os<< field[i].
x()<<
' '<< field[i].
y()<<
' '<<field[i].
z()<<
'\n';
158 if(!checkFieldType<realx3>(objectType))
return false;
160 auto objField = IOobject::make<realx3TriSurfaceField_H>
196 if( !triSurfaeHeader.
headerOk(
true) )
199 " does not contain any triSurface data file. Skipping this folder . . ."
204 vtkFile vtk(destPath, bName, time);
206 if(!vtk)
return false;
208 auto triSurfaceObjPtr = IOobject::make<multiTriSurface>(triSurfaeHeader);
216 "error in writing triSurface data to vtk file "<< vtk.
fileName()<<
endl;
224 for(
auto& file:fileList)
const INLINE_FUNCTION_H auto hostVector() const
const char * triSurfaceFile__
virtual fileSystem fileName() const
bool convertTimeFolderTriSurfaceFields(fileSystem timeFolder, real time, fileSystem destPath, word bName)
fileSystemList containingFiles(const fileSystem &path)
bool triDataToVTK(iOstream &os, const Type &dataEntity)
iOstream & endl(iOstream &os)
INLINE_FUNCTION_HD T & y()
const realx3Vector_D & points() const
#define fatalErrorInFunction
bool regexCheck(word TYPENAME, word fieldType)
const char * defaultColor
size_t numTriangles() const
bool convertRealx3TypetriSurfaceField(iOstream &os, const IOfileHeader &header, const multiTriSurface &tSurface)
bool checkFieldType(word objectType)
INLINE_FUNCTION_HD T & z()
bool addRealx3TriSurfaceField(iOstream &os, word fieldName, int32 size, realx3 *field)
const int32x3Vector_D & vertices() const
INLINE_FUNCTION_HD T & x()