# PhasicFlow: utilities/pFlowToVTK/geometric.hpp Source File

geometric.hpp
Go to the documentation of this file.
/*------------------------------- 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__
pFlow::vtkFile
Definition: vtkFile.hpp:33
pFlow::IOfileHeader::objectType
const word & objectType() const
Definition: IOfileHeader.hpp:72
endREPORT
#define endREPORT
Definition: streams.hpp:41
pFlow::real
float real
Definition: builtinTypes.hpp:46
fatalExit
#define fatalExit
Definition: error.hpp:57
IOobject.hpp
REPORT
#define REPORT(n)
Definition: streams.hpp:40
pFlow::geomObjectToVTK
bool geomObjectToVTK(IOfileHeader &header, real time, fileSystem destPath, word bName)
Definition: geometric.hpp:35
pFlow::word
std::string word
Definition: builtinTypes.hpp:63
pFlow::endl
iOstream & endl(iOstream &os)
Definition: iOstream.hpp:312
pFlow
Definition: demComponent.hpp:28
pFlow::fileSystem
Definition: fileSystem.hpp:63
fatalErrorInFunction
#define fatalErrorInFunction
Definition: error.hpp:42
multiTriSurface.hpp
pFlow::IOfileHeader
Definition: IOfileHeader.hpp:35
pFlow::dataToVTK
bool dataToVTK(vtkFile &vtk, const Type &dataEntity)
Definition: geometric.hpp:61
triSurface.hpp
vtkFile.hpp