pFlowToVTK finalized and tested

- geometry conversion now can handle separate vtk files.
This commit is contained in:
Hamidreza Norouzi 2024-03-30 08:35:16 -07:00
parent 815b134e1e
commit ef0e752929
13 changed files with 460 additions and 382 deletions

View File

@ -33,7 +33,6 @@ bool pFlow::fileSystem::checkFileName(const word& name)
"Invalid file name supplied " << name <<
"the following characters are not allowd: " <<
notPermittedCharsFile << endl;
fatalExit;
return false;
}
@ -57,9 +56,9 @@ pFlow::fileSystem::fileSystem( const word& dir, const word& file)
{
isDir_ = file.empty();
if( !isDir_)
if( !isDir_ && !checkFileName(file))
{
checkFileName(file);
fatalExit;
}
try
@ -240,7 +239,10 @@ pFlow::fileSystem pFlow::fileSystem::operator()
void pFlow::fileSystem::operator += (const word& fileName)
{
checkFileName(fileName);
if(!checkFileName(fileName))
{
fatalExit;
}
if( isDir())
{

View File

@ -69,14 +69,31 @@ void pFlow::fileStream::openOutFile
}
if(binary_)
{
if(append_)
{
outStream_ = makeUnique< std::ofstream>(
path.wordPath(), std::ios_base::out| std::ios::binary|std::ios::app);
}
else
{
outStream_ = makeUnique< std::ofstream>(
path.wordPath(), std::ios_base::out| std::ios::binary);
}
}
else
{
if(append_)
{
outStream_ = makeUnique< std::ofstream>(
path.wordPath(), std::ios_base::out|std::ios::app);
}
else
{
outStream_ = makeUnique< std::ofstream>(
path.wordPath(), std::ios_base::out);
}
}
if(!outStream_->is_open())
{
@ -103,12 +120,14 @@ pFlow::fileStream::fileStream
(
const fileSystem& path,
bool outStream,
bool binary
bool binary,
bool append
)
:
inStream_(nullptr),
outStream_(nullptr),
binary_(binary)
binary_(binary),
append_(append)
{
if(outStream)

View File

@ -52,6 +52,8 @@ protected:
bool binary_ = false;
bool append_ = false;
/// open input file
void openInFile(const fileSystem& path);
@ -66,7 +68,7 @@ public:
//// - Constructors
/// From file path and input type and format.
fileStream( const fileSystem& path, bool outStream = false, bool binary = false);
fileStream( const fileSystem& path, bool outStream = false, bool binary = false, bool append = false);
/// No copy
fileStream(const fileStream&)= delete;

View File

@ -22,9 +22,9 @@ Licence:
#include "oFstream.hpp"
pFlow::oFstream::oFstream (const fileSystem& path, bool binary)
pFlow::oFstream::oFstream (const fileSystem& path, bool binary, bool append)
:
fileStream(path, true, binary),
fileStream(path, true, binary, append),
Ostream
(
fileStream::outStream(),

View File

@ -45,7 +45,7 @@ public:
//// - Constructors
/// From file path and format
oFstream (const fileSystem& path, bool binary = false);
oFstream (const fileSystem& path, bool binary = false, bool append = false);
/// No copy constructor
oFstream( const oFstream& src) = delete;

View File

@ -21,11 +21,14 @@ Licence:
#include "vtkFile.hpp"
bool pFlow::vtkFile::openStream()
bool pFlow::vtkFile::openStream(bool wHeader)
{
oStream_ = makeUnique<oFstream>( fileName() );
oStream_ = makeUnique<oFstream>( fileName(), false, append_ );
if( !oStream_ )return false;
if(wHeader)
return writeHeader();
else
return true;
}
bool pFlow::vtkFile::vtkFile::writeHeader()
@ -49,15 +52,17 @@ pFlow::vtkFile::vtkFile
(
const fileSystem dir,
const word& bName,
real time
real time,
bool append
)
:
dirPath_(dir),
baseName_(bName),
time_(time)
time_(time),
append_(append)
{
if(!openStream())
if(!openStream(!append))
{
fatalErrorInFunction <<
" error in creating vtkFile "<<fileName()<<endl;

View File

@ -40,15 +40,21 @@ protected:
real time_ = 0.0;
bool append_=false;
uniquePtr<oFstream> oStream_= nullptr;
bool openStream();
bool openStream(bool wHeader);
virtual bool writeHeader();
public:
vtkFile(const fileSystem dir, const word& bName, real time);
vtkFile(
const fileSystem dir,
const word& bName,
real time,
bool append = false);
virtual ~vtkFile() = default;
@ -56,7 +62,7 @@ public:
{
if(!oStream_)
{
if(!openStream())
if(!openStream(!append_))
{
fatalErrorInFunction<<
" error in opening vtkFile "<< fileName() <<endl;

View File

@ -1,6 +1,7 @@
set(source_files
pointFieldToVTK.cpp
triSurfaceFieldToVTK.cpp
pFlowToVTK.cpp
#geometric.cpp
)

View File

@ -1,87 +0,0 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#include "geometric.hpp"
template<>
bool pFlow::dataToVTK( vtkFile& vtk, const triSurface& surface )
{
auto nP = surface.numPoints();
auto hPoints = surface.points().hostVector();
vtk() << "DATASET POLYDATA" << endl;
vtk() << "POINTS " << nP << " float" << endl;
for ( auto i=0; i<nP; i++ )
{
vtk() << hPoints[i].x() << " " << hPoints[i].y() << " " << hPoints[i].z() << endl;
if (!vtk) return false;
}
auto nV = surface.numTriangles();
auto hVertices = surface.vertices().hostVector();
vtk() << "POLYGONS " << nV << " " << 4*nV << endl;
for(auto i=0; i<nV; i++)
{
vtk()<< 3 <<" "<< hVertices[i].x() << " " << hVertices[i].y() <<" "<<hVertices[i].z()<<endl;
if (!vtk) return false;
}
return true;
}
template<>
bool pFlow::dataToVTK( vtkFile& vtk, const multiTriSurface& surface )
{
auto nP = surface.numPoints();
auto hPoints = surface.points().hostVector();
vtk() << "DATASET POLYDATA" << endl;
vtk() << "POINTS " << nP << " float" << endl;
for ( auto i=0; i<nP; i++ )
{
vtk() << hPoints[i].x() << " " << hPoints[i].y() << " " << hPoints[i].z() << endl;
if (!vtk) return false;
}
auto nV = surface.numTriangles();
auto hVertices = surface.vertices().hostVector();
vtk() << "POLYGONS " << nV << " " << 4*nV << endl;
for(auto i=0; i<nV; i++)
{
vtk()<< 3 <<" "<< hVertices[i].x() << " " << hVertices[i].y() <<" "<<hVertices[i].z()<<endl;
if (!vtk) return false;
}
return true;
}

View File

@ -1,78 +0,0 @@
/*------------------------------- phasicFlow ---------------------------------
O C enter of
O O E ngineering and
O O M ultiscale modeling of
OOOOOOO F luid flow
------------------------------------------------------------------------------
Copyright (C): www.cemf.ir
email: hamid.r.norouzi AT gmail.com
------------------------------------------------------------------------------
Licence:
This file is part of phasicFlow code. It is a free software for simulating
granular and multiphase flows. You can redistribute it and/or modify it under
the terms of GNU General Public License v3 or any other later versions.
phasicFlow is distributed to help others in their research in the field of
granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-----------------------------------------------------------------------------*/
#ifndef __geometric_hpp__
#define __geometric_hpp__
#include "vtkFile.hpp"
#include "triSurface.hpp"
#include "multiTriSurface.hpp"
#include "IOobject.hpp"
namespace pFlow
{
template<typename ObjType>
bool geomObjectToVTK(IOfileHeader& header, real time, fileSystem destPath, word bName)
{
if( ObjType::TYPENAME() != header.objectType() )return false;
auto ioObjPtr = IOobject::make<ObjType>(header);
auto& data = ioObjPtr().template getObject<ObjType>();
vtkFile vtk(destPath, bName, time);
if(!vtk) return false;
REPORT(1)<<"Converting geometry to vtk."<<endREPORT;
if(!dataToVTK(vtk, data) )
{
fatalErrorInFunction<<
" error in writing object "<<ioObjPtr().typeName() << " to folder " << destPath<<endl;
fatalExit;
}
return true;
}
template<typename Type>
bool dataToVTK(vtkFile& vtk, const Type& dataEntity)
{
fatalErrorInFunction<<
"not implemented function!";
fatalExit;
return false;
}
template<>
bool dataToVTK( vtkFile& vtk, const triSurface& surface );
template<>
bool dataToVTK( vtkFile& vtk, const multiTriSurface& surface );
}
#endif //__geometric_hpp__

View File

@ -26,7 +26,7 @@ Licence:
#include "Vectors.hpp"
#include "phasicFlowKokkos.hpp"
#include "pointFieldToVTK.hpp"
//#include "triSurfaceFieldToVTK.hpp"
#include "triSurfaceFieldToVTK.hpp"
//#include "readControlDict.hpp"
@ -60,10 +60,10 @@ int main(int argc, char** argv )
"path");
bool separateSurfaces = false;
cmds.addOption(
cmds.add_flag(
"-s,--separate-surfaces",
separateSurfaces,
"surfaces in the geometry are converted separatedly");
"use this when you want to have sub-surfaces in separate files");
wordVector fields;
bool allFields = true;
@ -117,15 +117,16 @@ int main(int argc, char** argv )
if( !validRange.isMember( folders.time() ) )continue;
output<< "time: " << Cyan_Text( folders.time() )<<" s" <<endl;
/*if(!noGoem)
if(!noGoem)
{
fileSystem geomFolder = folders.folder()/geometryFolder__;
if(!pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFields(geomFolder, folders.time(), destFolder, "surface"))
if(!pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFields(
Control, destFolder, "surface", separateSurfaces))
{
fatalExit;
return 1;
}
}*/
}
if(!noParticle)
{

View File

@ -0,0 +1,349 @@
#include "vocabs.hpp"
#include "vtkFile.hpp"
#include "triSurfaceFieldToVTK.hpp"
bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFields(
systemControl &control,
const fileSystem &destPath,
const word &bName,
bool separate)
{
auto timeFolder = control.geometry().path();
// check if pointStructure exist in this folder
IOfileHeader triSurfaeHeader(
objectFile(
triSurfaceFile__,
timeFolder,
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS));
if (!triSurfaeHeader.headerOk(true))
{
WARNING << "Time folder " << timeFolder << " does not contain any triSurface data file."
<< " Skipping this folder . . ." << END_WARNING;
return true;
}
auto triSurfaceObj = multiTriSurface(
objectFile(
triSurfaceFile__,
"",
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS),
&control.geometry());
if(separate)
{
return convertTimeFolderTriSurfaceFieldsSeparate(
triSurfaceObj,
destPath,
control.time().currentTime(),
bName);
}
else
{
return convertTimeFolderTriSurfaceFieldsSingle(
triSurfaceObj,
destPath,
control.time().currentTime(),
bName );
}
}
bool pFlow::TSFtoVTK::triSurfaceToVTK(
iOstream &os,
const realx3 *points,
const uint32x3 *vertices,
const subSurface &subSurf)
{
auto nP = subSurf.numPoints();
os << "DATASET UNSTRUCTURED_GRID" << endl;
os << "POINTS " << nP << " float" << endl;
for ( auto i=subSurf.pointStart(); i<subSurf.pointEnd(); i++ )
{
os << points[i].x() <<
" " << points[i].y() <<
" " << points[i].z() << endl;
if (!os) return false;
}
auto nTri = subSurf.size();
os << "CELLS " << nTri << " " << 4*nTri << endl;
for(auto i=subSurf.start(); i<subSurf.end(); i++)
{
os<< 3 <<
" "<< vertices[i].x()-subSurf.pointStart() <<
" "<< vertices[i].y()-subSurf.pointStart() <<
" "<< vertices[i].z()-subSurf.pointStart()<<endl;
if (!os) return false;
}
os<<"CELL_TYPES "<< nTri<<'\n';
for(uint32 i=0; i<nTri; i++)
{
os<< 5 <<'\n';
}
os << "CELL_DATA " << nTri << endl;
return true;
}
bool pFlow::TSFtoVTK::triSurfaceToVTK(
iOstream &os,
const realx3 *points,
const uint32x3 *vertices,
uint32 numPoints,
uint32 numTris)
{
os << "DATASET UNSTRUCTURED_GRID" << endl;
os << "POINTS " << numPoints << " float" << endl;
for ( auto i=0; i<numPoints; i++ )
{
os << points[i].x() <<
" " << points[i].y() <<
" " << points[i].z() << endl;
if (!os) return false;
}
os << "CELLS " << numTris << " " << 4*numTris << endl;
for(auto i=0; i<numTris; i++)
{
os<< 3 <<
" "<< vertices[i].x()<<
" "<< vertices[i].y()<<
" "<< vertices[i].z()<<endl;
if (!os) return false;
}
os<<"CELL_TYPES "<< numTris<<'\n';
for(uint32 i=0; i<numTris; i++)
{
os<< 5 <<'\n';
}
os << "CELL_DATA " << numTris << endl;
return true;
}
bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSingle
(
multiTriSurface &surface,
const fileSystem &destPath,
real time,
const word &bName
)
{
vtkFile vtk(destPath, bName, time);
if (!vtk)
return false;
auto hPoints = surface.points().hostView();
auto hVertices = surface.vertices().hostView();
realx3 const* pData = hPoints.data();
uint32x3 const* vData = hVertices.data();
REPORT(1) << "Wrting triSurface geometry to vtk file "<<
Green_Text(vtk.fileName()) << END_REPORT;
if (! triSurfaceToVTK(
vtk(),
pData,
vData,
surface.numPoints(),
surface.size()))
{
fatalErrorInFunction <<
"error in writing triSurface data to vtk file " <<
vtk.fileName() << endl;
return false;
}
auto fileList = containingFiles(surface.path().dirPath());
for(const auto& file:fileList)
{
IOfileHeader fieldHeader(
objectFile(
file.fileName(),
file.dirPath(),
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS) );
if( fieldHeader.headerOk(true) )
{
convertRealx3TypetriSurfaceField(vtk(), fieldHeader, surface);
}
}
output<<endl;
return true;
}
bool pFlow::TSFtoVTK::convertTimeFolderTriSurfaceFieldsSeparate(
multiTriSurface &surface,
const fileSystem &destPath,
real time,
const word &bName)
{
auto hPoints = surface.points().hostView();
auto hVertices = surface.vertices().hostView();
realx3 const* pData = hPoints.data();
uint32x3 const* vData = hVertices.data();
REPORT(1) << "Wrting triSurface geometry to vtk file . . ."<<
END_REPORT;
auto nSurf = surface.numSurfaces();
for(auto nS=0; nS<nSurf; nS++)
{
auto sName = surface.subSurfaceName(nS);
vtkFile vtk(destPath, groupNames(bName,sName), time);
REPORT(2) << "Wrting sub-surface to "<<
Green_Text(vtk.fileName())<<END_REPORT;
if (!vtk)
return false;
if (! triSurfaceToVTK(
vtk(),
pData,
vData,
surface.subSurfaces()[nS]) )
{
fatalErrorInFunction <<
"error in writing triSurface data to vtk file " <<
vtk.fileName() << endl;
return false;
}
}
auto fileList = containingFiles(surface.path().dirPath());
for(const auto& file:fileList)
{
IOfileHeader fieldHeader(
objectFile(
file.fileName(),
file.dirPath(),
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS) );
if( fieldHeader.headerOk(true) )
{
convertRealx3TypetriSurfaceFieldSeparate(
destPath,
fieldHeader,
surface,
bName,
time);
}
}
output<<endl;
return true;
}
bool pFlow::TSFtoVTK::convertRealx3TypetriSurfaceField(
iOstream& os,
const IOfileHeader& header,
multiTriSurface& tSurface)
{
word objectType = header.objectType();
if(!checkTriFieldType<realx3>(objectType))return false;
auto field = realx3TriSurfaceField_H
(
header,
tSurface,
static_cast<real>(0)
);
const realx3* data = field.deviceViewAll().data();
REPORT(1)<<"writing "<< greenColor <<header.objectName()<<
defaultColor<<" field to vtk."<<END_REPORT;
return pFlow::PFtoVTK::addRealx3PointField
(
os,
header.objectName(),
data,
field.size()
);
}
bool pFlow::TSFtoVTK::convertRealx3TypetriSurfaceFieldSeparate
(
const fileSystem& destPath,
const IOfileHeader& header,
multiTriSurface& tSurface,
const word& bName,
real time
)
{
word objectType = header.objectType();
if(!checkTriFieldType<realx3>(objectType))return false;
auto field = realx3TriSurfaceField_H
(
header,
tSurface,
static_cast<real>(0)
);
const realx3* data = field.deviceViewAll().data();
/*REPORT(1)<<"writing "<< greenColor <<header.objectName()<<
defaultColor<<" field to vtk."<<END_REPORT;*/
auto nSurf = tSurface.numSurfaces();
for(auto nS=0; nS<nSurf; nS++)
{
auto& subSurf = tSurface.subSurfaces()[nS];
auto sName = subSurf.name();
vtkFile vtk(destPath, groupNames(bName,sName), time, true);
REPORT(2) << "Wrting sub-surface to "<<
Green_Text(vtk.fileName())<<END_REPORT;
pFlow::PFtoVTK::addRealx3PointField
(
vtk(),
header.objectName(),
data+subSurf.start(),
subSurf.size()
);
}
return true;
/*return pFlow::PFtoVTK::addRealx3PointField
(
os,
header.objectName(),
data,
field.size()
);*/
}

View File

@ -24,19 +24,51 @@ Licence:
#include <regex>
#include "vtkFile.hpp"
#include "pointFieldToVTK.hpp"
#include "triSurface.hpp"
#include "multiTriSurface.hpp"
#include "triSurfaceFields.hpp"
#include "IOobject.hpp"
namespace pFlow::TSFtoVTK
{
bool regexCheck(word TYPENAME, word fieldType)
bool convertTimeFolderTriSurfaceFields(
systemControl& control,
const fileSystem& destPath,
const word& bName,
bool separate);
bool triSurfaceToVTK(iOstream &os,
const realx3 *points,
const uint32x3 *vertices,
const subSurface &subSurf);
bool triSurfaceToVTK(iOstream &os,
const realx3* points,
const uint32x3* vertices,
uint32 numPoints,
uint32 numTris);
bool convertTimeFolderTriSurfaceFieldsSingle(
multiTriSurface& surface,
const fileSystem& destPath,
real time,
const word& bName);
bool convertTimeFolderTriSurfaceFieldsSeparate(
multiTriSurface& surface,
const fileSystem& destPath,
real time,
const word& bName);
inline
bool regexCheck(const word& TYPENAME, const word& fieldType)
{
std::regex match("triSurfaceField\\<([A-Za-z1-9_]*)\\,([A-Za-z1-9_]*)\\>");
std::smatch search1, search2;
std::smatch search1;
std::smatch search2;
if(!std::regex_match(fieldType, search1, match))return false;
if(!std::regex_match(TYPENAME, search2, match))return false;
if(search1.size()!=3)return false;
@ -45,201 +77,27 @@ bool regexCheck(word TYPENAME, word fieldType)
}
template<typename Type>
bool checkFieldType(word objectType)
inline
bool checkTriFieldType(word objectType)
{
//if( pointField<VectorSingle,Type>::TYPENAME() == objectType )return true;
//if( pointField<VectorSingle,Type, HostSpace>::TYPENAME() == objectType ) return true;
//if( pointField<VectorDual, Type>::TYPENAME() == objectType )return true;
return regexCheck(triSurfaceField<VectorSingle,Type>::TYPENAME(), objectType);
}
template<typename Type>
bool triDataToVTK(iOstream& os, const Type& dataEntity)
{
fatalErrorInFunction<<
"not implemented function!";
fatalExit;
return false;
}
template<>
bool triDataToVTK(iOstream& os, const triSurface& surface )
{
auto nP = surface.numPoints();
auto hPoints = surface.points().hostVector();
os << "DATASET POLYDATA" << endl;
os << "POINTS " << nP << " float" << endl;
for ( auto i=0; i<nP; i++ )
{
os << hPoints[i].x() << " " << hPoints[i].y() << " " << hPoints[i].z() << endl;
}
auto nV = surface.numTriangles();
auto hVertices = surface.vertices().hostVector();
os << "POLYGONS " << nV << " " << 4*nV << endl;
for(auto i=0; i<nV; i++)
{
os<< 3 <<" "<< hVertices[i].x() << " " << hVertices[i].y() <<" "<<hVertices[i].z()<<endl;
}
return true;
}
template<>
bool triDataToVTK(iOstream& os, const multiTriSurface& surface )
{
auto nP = surface.numPoints();
auto hPoints = surface.points().hostVector();
os << "DATASET UNSTRUCTURED_GRID" << endl;
os << "POINTS " << nP << " float" << endl;
for ( auto i=0; i<nP; i++ )
{
os << hPoints[i].x() << " " << hPoints[i].y() << " " << hPoints[i].z() << endl;
}
auto nV = surface.numTriangles();
auto hVertices = surface.vertices().hostVector();
os<<"CELLS "<< nV<<' '<< 4*nV<<'\n';
//os << "POLYGONS " << nV << " " << 4*nV << endl;
for(auto i=0; i<nV; i++)
{
os<< 3 <<" "<< hVertices[i].x() << " " << hVertices[i].y() <<" "<<hVertices[i].z()<<endl;
}
os<<"CELL_TYPES "<< nV<<'\n';
for(int32 i=0; i<nV; i++)
{
os<< 5 <<'\n';
}
os << "CELL_DATA " << nV << endl;
return true;
}
bool addRealx3TriSurfaceField(
iOstream& os,
word fieldName,
int32 size,
realx3* field )
{
if(size==0) return true;
os << "FIELD FieldData 1\n"<<
fieldName << " 3 " << size << " float\n";
for(int32 i=0; i<size; ++i)
{
os<< field[i].x()<<' '<< field[i].y()<<' '<<field[i].z()<<'\n';
}
return true;
return regexCheck(triSurfaceField<Type>::TYPENAME(), objectType);
}
bool convertRealx3TypetriSurfaceField(
iOstream& os,
const IOfileHeader& header,
const multiTriSurface& tSurface)
{
word objectType = header.objectType();
multiTriSurface& tSurface);
if(!checkFieldType<realx3>(objectType))return false;
auto objField = IOobject::make<realx3TriSurfaceField_H>
(
header,
tSurface,
static_cast<real>(0)
);
auto& Field = objField().getObject<realx3TriSurfaceField_H>();
realx3* data = Field.hostVectorAll().data();
REPORT(2)<<"writing "<< greenColor <<header.objectName()<<defaultColor<<" field to vtk."<<endREPORT;
return addRealx3TriSurfaceField(
os,
header.objectName(),
tSurface.size(),
data );
}
bool convertTimeFolderTriSurfaceFields(
fileSystem timeFolder,
real time,
fileSystem destPath,
word bName)
{
// check if pointStructure exist in this folder
IOfileHeader triSurfaeHeader(
objectFile(
triSurfaceFile__,
timeFolder,
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS)
);
if( !triSurfaeHeader.headerOk(true) )
{
output<<yellowText("Time folder "<< timeFolder <<
" does not contain any triSurface data file. Skipping this folder . . ."
)<<nl;
return true;
}
vtkFile vtk(destPath, bName, time);
if(!vtk) return false;
auto triSurfaceObjPtr = IOobject::make<multiTriSurface>(triSurfaeHeader);
auto& tSurface = triSurfaceObjPtr().getObject<multiTriSurface>();
// get a list of files in this timeFolder;
REPORT(1)<<"Wrting triSurface mesh/Geometry to vtk file."<<endREPORT;
if(!triDataToVTK(vtk(), tSurface))
{
fatalErrorInFunction<<
"error in writing triSurface data to vtk file "<< vtk.fileName()<<endl;
return false;
}
bool convertRealx3TypetriSurfaceFieldSeparate(
const fileSystem& destPath,
const IOfileHeader& header,
multiTriSurface& tSurface,
const word& bName,
real time);
auto fileList = containingFiles(timeFolder);
for(auto& file:fileList)
{
IOfileHeader fieldHeader(
objectFile(
file.wordPath(),
"",
objectFile::READ_ALWAYS,
objectFile::WRITE_ALWAYS) );
if( fieldHeader.headerOk(true) )
{
//output<<"object file type is "<<fieldHeader.objectType()<<endl;
convertRealx3TypetriSurfaceField(vtk(), fieldHeader, tSurface);
}
}
return true;
}
}
#endif