Binary conversion from pointFiled files to vtk format

- all vtk files are stored in the /particles/ folder
- terminal output is modified
- time series file are added. files with extntions .vtk.series can be loaded into paraview
This commit is contained in:
HRN
2025-01-09 19:16:18 +03:30
parent d39e1ec27b
commit 66c3cda39e
17 changed files with 530 additions and 106 deletions

View File

@ -6,10 +6,15 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFields(
systemControl &control,
const fileSystem &destPath,
const word &bName,
bool separate)
bool separate,
wordList& surfNames,
wordList& fileNames)
{
auto timeFolder = control.geometry().path();
surfNames.clear();
fileNames.clear();
// check if pointStructure exist in this folder
IOfileHeader triSurfaeHeader(
@ -40,7 +45,9 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFields(
triSurfaceObj,
destPath,
control.time().currentTime(),
bName);
bName,
surfNames,
fileNames);
}
else
{
@ -48,12 +55,14 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFields(
triSurfaceObj,
destPath,
control.time().currentTime(),
bName );
bName,
surfNames,
fileNames );
}
}
bool pFlow::TSFtoVTK::triSurfaceToVTK(
iOstream &os,
Ostream &os,
const realx3 *points,
const uint32x3 *vertices,
const subSurface &subSurf)
@ -97,7 +106,7 @@ bool pFlow::TSFtoVTK::triSurfaceToVTK(
}
bool pFlow::TSFtoVTK::triSurfaceToVTK(
iOstream &os,
Ostream &os,
const realx3 *points,
const uint32x3 *vertices,
uint32 numPoints,
@ -143,10 +152,12 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSingle
multiTriSurface &surface,
const fileSystem &destPath,
real time,
const word &bName
const word &bName,
wordList& surfNames,
wordList& fileNames
)
{
vtkFile vtk(destPath, bName, time);
vtkFile vtk(destPath, bName, time, false);
if (!vtk)
return false;
@ -157,7 +168,7 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSingle
realx3 const* pData = hPoints.data();
uint32x3 const* vData = hVertices.data();
REPORT(1) << "Wrting triSurface geometry to vtk file "<<
REPORT(2) << "Wrting surface to "<<
Green_Text(vtk.fileName()) << END_REPORT;
if (! triSurfaceToVTK(
@ -189,6 +200,9 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSingle
convertRealx3TypetriSurfaceField(vtk(), fieldHeader, surface);
}
}
surfNames.push_back(bName);
fileNames.push_back(vtk.fileName().wordPath());
output<<endl;
return true;
@ -198,7 +212,9 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSeparate(
multiTriSurface &surface,
const fileSystem &destPath,
real time,
const word &bName)
const word &bName,
wordList& surfNames,
wordList& fileNames)
{
auto hPoints = surface.points().hostView();
@ -210,17 +226,23 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSeparate(
REPORT(1) << "Wrting triSurface geometry to vtk file . . ."<<
END_REPORT;
wordList sNames, fNames;
auto nSurf = surface.numSurfaces();
for(auto nS=0; nS<nSurf; nS++)
{
auto sName = surface.subSurfaceName(nS);
vtkFile vtk(destPath, groupNames(bName,sName), time);
auto sName = surface.subSurfaceName(nS);
word fName = groupNames(bName,sName,'_');
vtkFile vtk(destPath, fName, time, false);
REPORT(2) << "Wrting sub-surface to "<<
Green_Text(vtk.fileName())<<END_REPORT;
if (!vtk)
return false;
fNames.push_back(vtk.fileName().wordPath());
sNames.push_back(fName);
if (! triSurfaceToVTK(
vtk(),
pData,
@ -257,13 +279,15 @@ bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSeparate(
}
fileNames = fNames;
surfNames = sNames;
output<<endl;
return true;
}
bool pFlow::TSFtoVTK::convertRealx3TypetriSurfaceField(
iOstream& os,
Ostream& os,
const IOfileHeader& header,
multiTriSurface& tSurface)
{
@ -325,7 +349,7 @@ bool pFlow::TSFtoVTK::convertRealx3TypetriSurfaceFieldSeparate
auto& subSurf = tSurface.subSurfaces()[nS];
auto sName = subSurf.name();
vtkFile vtk(destPath, groupNames(bName,sName), time, true);
vtkFile vtk(destPath, groupNames(bName,sName,'_'), time, false, true);
REPORT(2) << "Wrting sub-surface to "<<
Green_Text(vtk.fileName())<<END_REPORT;