OpenLB 1.7
Loading...
Searching...
No Matches
Public Member Functions | List of all members
olb::BlockVTKwriter3D< T > Class Template Reference

BlockVTKwriter3D writes any BLockF3D to vtk-based output files. More...

#include <blockVtkWriter3D.h>

+ Collaboration diagram for olb::BlockVTKwriter3D< T >:

Public Member Functions

 BlockVTKwriter3D (std::string name, bool binary=true)
 
 ~BlockVTKwriter3D ()
 
void write (BlockF3D< T > &f, int iT=0)
 method calls preamble(), pointData(), data() and coresponding closing methods.
 
void write (int iT=0)
 writes functors stored at pointerVec
 
void addFunctor (BlockF3D< T > &f)
 put functor to _pointerVec to simplify writing process of several functors
 
void clearAddedFunctors ()
 to clear stored functors
 

Detailed Description

template<typename T>
class olb::BlockVTKwriter3D< T >

BlockVTKwriter3D writes any BLockF3D to vtk-based output files.

One can add functors via addFunctors. To write added functors call write(int iT=0).

To write a functor without adding him, call call write(BlockF3D<T>& f, int iT).

Default output type is binary, to change it have a look on the constructor.

Definition at line 49 of file blockVtkWriter3D.h.

Constructor & Destructor Documentation

◆ BlockVTKwriter3D()

template<typename T >
olb::BlockVTKwriter3D< T >::BlockVTKwriter3D ( std::string name,
bool binary = true )

Definition at line 43 of file blockVtkWriter3D.hh.

44 : clout( std::cout,"BlockVTKwriter3D" ), _name(name), _binary(binary)
45{}

◆ ~BlockVTKwriter3D()

template<typename T >
olb::BlockVTKwriter3D< T >::~BlockVTKwriter3D ( )

Definition at line 48 of file blockVtkWriter3D.hh.

49{
51}
void clearAddedFunctors()
to clear stored functors

Member Function Documentation

◆ addFunctor()

template<typename T >
void olb::BlockVTKwriter3D< T >::addFunctor ( BlockF3D< T > & f)

put functor to _pointerVec to simplify writing process of several functors

Definition at line 113 of file blockVtkWriter3D.hh.

114{
115 _pointerVec.push_back(&f);
116}

◆ clearAddedFunctors()

template<typename T >
void olb::BlockVTKwriter3D< T >::clearAddedFunctors ( )

to clear stored functors

Definition at line 119 of file blockVtkWriter3D.hh.

120{
121 _pointerVec.clear();
122}

◆ write() [1/2]

template<typename T >
void olb::BlockVTKwriter3D< T >::write ( BlockF3D< T > & f,
int iT = 0 )

method calls preamble(), pointData(), data() and coresponding closing methods.

writes given functor

Definition at line 90 of file blockVtkWriter3D.hh.

91{
92 T originX = 0;
93 T originY = 0;
94 T originZ = 0;
95 int nx = f.getBlockStructure().getNx() -1;
96 int ny = f.getBlockStructure().getNy() -1;
97 int nz = f.getBlockStructure().getNz() -1;
98
99 std::string fullNameVti = singleton::directories().getVtkOutDir()
100 + createFileName( f.getName(), iT ) + ".vti";
101
102 preamble( fullNameVti, nx,ny,nz, originX,originY,originZ );
103 if ( _binary ) {
104 writeRawData( fullNameVti, f, nx,ny,nz );
105 }
106 else {
107 writeRawDataBinary( fullNameVti, f, nx,ny,nz );
108 }
109 closePreamble( fullNameVti );
110}
std::string getVtkOutDir() const
Definition singleton.h:97
Directories & directories()
Definition singleton.h:150
std::string createFileName(std::string name)
for .pvd masterFile
Definition fileName.hh:34

References olb::createFileName(), olb::singleton::directories(), olb::BlockF3D< T >::getBlockStructure(), olb::GenericF< T, S >::getName(), olb::BlockStructureD< D >::getNx(), olb::BlockStructureD< D >::getNy(), olb::BlockStructureD< D >::getNz(), and olb::singleton::Directories::getVtkOutDir().

+ Here is the call graph for this function:

◆ write() [2/2]

template<typename T >
void olb::BlockVTKwriter3D< T >::write ( int iT = 0)

writes functors stored at pointerVec

Definition at line 54 of file blockVtkWriter3D.hh.

55{
56 if ( _pointerVec.empty() ) {
57 clout << "Error: Please add functor via addFunctor()";
58 }
59 else {
60 // get first functor
61 auto it = _pointerVec.cbegin();
62
63 T originX = 0;
64 T originY = 0;
65 T originZ = 0;
66 int nx = (**it).getBlockStructure().getNx() -1;
67 int ny = (**it).getBlockStructure().getNy() -1;
68 int nz = (**it).getBlockStructure().getNz() -1;
69
70 std::string fullNameVti = singleton::directories().getVtkOutDir()
71 + createFileName( _name, iT ) + ".vti";
72
73 preamble( fullNameVti, nx,ny,nz, originX,originY,originZ );
74 if ( _binary ) {
75 // iterate on functors
76 for ( auto functor = _pointerVec.cbegin(); functor != _pointerVec.cend(); ++functor) {
77 writeRawDataBinary( fullNameVti, **functor, nx, ny, nz);
78 }
79 }
80 else {
81 for ( auto functor = _pointerVec.cbegin(); functor != _pointerVec.cend(); ++functor) {
82 writeRawData( fullNameVti, **functor, nx, ny, nz);
83 }
84 }
85 closePreamble( fullNameVti );
86 }
87}

References olb::createFileName(), olb::singleton::directories(), and olb::singleton::Directories::getVtkOutDir().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: