Go to the documentation of this file.
21 objectFile::READ_ALWAYS,
22 objectFile::WRITE_ALWAYS));
27 control.
time().
path() <<
" does not contain any pStructure data file."<<
44 auto posVec =
pStruct.pointPositionHost();
45 auto *pos = posVec.data();
47 REPORT(2) <<
">>> Writing pointStructure to vtk file with " <<
58 for (
const auto &file : fileList)
65 objectFile::READ_ALWAYS,
66 objectFile::WRITE_ALWAYS));
74 convertIntPointField<uint32>(vtk(), fieldHeader,
pStruct) ||
76 convertIntPointField<int32>(vtk(), fieldHeader,
pStruct) ||
84 WARNING <<
" This object type, " <<
85 fieldHeader.
objectType() <<
" is not supported" <<
109 objectFile::READ_ALWAYS,
110 objectFile::WRITE_ALWAYS));
116 " does not contain any pStructure data file."<<
133 auto posVec =
pStruct.pointPositionHost();
134 auto *pos = posVec.data();
136 REPORT(2) <<
">>> Writing pointStructure to vtk file with " <<
147 for (
const auto &fname : fieldsName)
155 objectFile::READ_ALWAYS,
156 objectFile::WRITE_ALWAYS));
164 convertIntPointField<uint32>(vtk(), fieldHeader,
pStruct) ||
166 convertIntPointField<int32>(vtk(), fieldHeader,
pStruct) ||
175 WARNING <<
" This object type, " <<
176 fieldHeader.
objectType() <<
" is not supported" <<
185 " does not exist." <<
endl;
206 os <<
"DATASET UNSTRUCTURED_GRID\n";
211 os <<
"POINTS " << numPoints <<
" float"<<
'\n';
214 for(
uint32 i=0; i<numPoints; i++)
216 float x =
byteSwaper(
static_cast<float>(position[i].x()));
217 float y =
byteSwaper(
static_cast<float>(position[i].y()));
218 float z =
byteSwaper(
static_cast<float>(position[i].z()));
219 os.
stdStream().write(
reinterpret_cast<const char*
>(&x),
sizeof(x));
220 os.
stdStream().write(
reinterpret_cast<const char*
>(&y),
sizeof(y));
221 os.
stdStream().write(
reinterpret_cast<const char*
>(&z),
sizeof(z));
224 os <<
"CELLS " << numPoints <<
' ' << 2 * numPoints<<
'\n';
227 for (
int i = 0; i < numPoints; i++)
230 os.
stdStream().write(
reinterpret_cast<const char*
>(&one_ro),
sizeof(one_ro));
231 os.
stdStream().write(
reinterpret_cast<const char*
>(&pN),
sizeof(pN));
234 os <<
"CELL_TYPES " << numPoints<<
'\n';
235 for (
int32 i = 0; i < numPoints; i++)
237 os.
stdStream().write(
reinterpret_cast<const char*
>(&one_ro),
sizeof(one_ro));
243 for (
uint32 i = 0; i < numPoints; i++)
245 os << position[i].
x() <<
246 ' ' << position[i].
y() <<
247 ' ' << position[i].
z() <<
'\n';
250 os <<
"CELLS " << numPoints <<
' ' << 2 * numPoints <<
'\n';
251 for (
uint32 i = 0; i < numPoints; i++)
253 os << 1 <<
' ' << i <<
'\n';
256 os <<
"CELL_TYPES " << numPoints <<
'\n';
258 for (
int32 i = 0; i < numPoints; i++)
265 os <<
"POINT_DATA " << numPoints <<
endl;
277 if (!checkFieldType<real>(objectType))
284 static_cast<real>(0));
286 real const *data = field.deviceViewAll().data();
305 if (!checkFieldType<realx3>(objectType))
314 realx3 const *data = field.deviceViewAll().data();
328 const word &fieldName,
335 os <<
"FIELD FieldData 1\n"
336 << fieldName <<
" 1 " << numData <<
" float\n";
339 for (
uint32 i = 0; i < numData; ++i)
341 float x =
byteSwaper(
static_cast<float>(field[i]));
342 os.
stdStream().write(
reinterpret_cast<const char*
>(&x),
sizeof(x));
347 for (
uint32 i = 0; i < numData; ++i)
349 os << field[i] <<
'\n';
359 const word &fieldName,
366 os <<
"FIELD FieldData 1\n"
367 << fieldName <<
" 3 " << numData <<
" float\n";
371 for(
uint32 i=0; i<numData; i++)
373 float x =
byteSwaper(
static_cast<float>(field[i].x()));
374 float y =
byteSwaper(
static_cast<float>(field[i].y()));
375 float z =
byteSwaper(
static_cast<float>(field[i].z()));
376 os.
stdStream().write(
reinterpret_cast<const char*
>(&x),
sizeof(x));
377 os.
stdStream().write(
reinterpret_cast<const char*
>(&y),
sizeof(y));
378 os.
stdStream().write(
reinterpret_cast<const char*
>(&z),
sizeof(z));
384 for (
uint32 i = 0; i < numData; ++i)
386 os << field[i].
x() <<
387 ' ' << field[i].
y() <<
388 ' ' << field[i].
z() <<
'\n';
398 std::regex match(
"pointField\\<([A-Za-z1-9_]*)\\,([A-Za-z1-9_]*)\\>");
401 if (!std::regex_match(fieldType, search1, match))
403 if (!std::regex_match(TYPENAME, search2, match))
405 if (search1.size() != 3)
407 if (search1.size() != search2.size())
409 return search1[1] == search2[1];
bool regexCheck(const word &TYPENAME, const word &fieldType)
bool convertTimeFolderPointFields(systemControl &control, const fileSystem &destPath, const word &bName, word &filename)
virtual fileSystem fileName() const
pointField_H< real > realPointField_H
fileSystemList containingFiles(const fileSystem &path)
A list of file paths that exist in the path.
iOstream & endl(iOstream &os)
Add newline and flush stream.
#define Yellow_Text(text)
INLINE_FUNCTION_HD T & y()
access component
Manages file pathes, manupulate and combines them.
const char *const pointStructureFile__
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
const char * defaultColor
char constants to alter output format and color
const Time & time() const
INLINE_FUNCTION_HD T & z()
access component
virtual fileSystem path() const
virtual std::ostream & stdStream()
Access to underlying std::ostream.
pointField_H< realx3 > realx3PointField_H
bool addUndstrcuturedGridField(Ostream &os, realx3 *position, uint32 numPoints)
bool convertTimeFolderPointFieldsSelected(systemControl &control, const fileSystem &destPath, const word &bName, const wordVector &fieldsName, bool mustExist, word &filename)
word wordPath() const
Path in word type.
INLINE_FUNCTION_HD T & x()
access component
bool convertRealTypePointField(Ostream &os, const IOfileHeader &header, pointStructure &pStruct)
bool convertRealx3TypePointField(Ostream &os, const IOfileHeader &header, pointStructure &pStruct)
Standard output stream for BINARY and ASCII formats.
bool addRealPointField(Ostream &os, const word &fieldName, const real *field, uint32 numData)
bool addRealx3PointField(Ostream &os, const word &fieldName, const realx3 *field, uint32 numData)