geometric.hpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 
22 #ifndef __geometric_hpp__
23 #define __geometric_hpp__
24 
25 #include "vtkFile.hpp"
26 #include "triSurface.hpp"
27 #include "multiTriSurface.hpp"
28 #include "IOobject.hpp"
29 
30 namespace pFlow
31 {
32 
33 
34 template<typename ObjType>
35 bool geomObjectToVTK(IOfileHeader& header, real time, fileSystem destPath, word bName)
36 {
37 
38  if( ObjType::TYPENAME() != header.objectType() )return false;
39 
40  auto ioObjPtr = IOobject::make<ObjType>(header);
41 
42  auto& data = ioObjPtr().template getObject<ObjType>();
43 
44  vtkFile vtk(destPath, bName, time);
45 
46  if(!vtk) return false;
47 
48  REPORT(1)<<"Converting geometry to vtk."<<endREPORT;
49 
50  if(!dataToVTK(vtk, data) )
51  {
53  " error in writing object "<<ioObjPtr().typeName() << " to folder " << destPath<<endl;
54  fatalExit;
55  }
56 
57  return true;
58 }
59 
60 template<typename Type>
61 bool dataToVTK(vtkFile& vtk, const Type& dataEntity)
62 {
64  "not implemented function!";
65  fatalExit;
66  return false;
67 }
68 
69 template<>
70 bool dataToVTK( vtkFile& vtk, const triSurface& surface );
71 
72 template<>
73 bool dataToVTK( vtkFile& vtk, const multiTriSurface& surface );
74 
75 
76 }
77 
78 #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