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

BlockVTKwriter2D writes any BLockF2D to vtk-based output files. More...

#include <blockVtkWriter2D.h>

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

Public Member Functions

 BlockVTKwriter2D (std::string name, bool binary=true)
 
 ~BlockVTKwriter2D ()
 
void write (int iT=0)
 method calls preamble(), pointData(), data() and coresponding closing methods.
 
void write (BlockF2D< T > &f, int iT=0)
 writes given functor
 
void addFunctor (BlockF2D< 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::BlockVTKwriter2D< T >

BlockVTKwriter2D writes any BLockF2D 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 blockVtkWriter2D.h.

Constructor & Destructor Documentation

◆ BlockVTKwriter2D()

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

Definition at line 44 of file blockVtkWriter2D.hh.

45 : clout( std::cout,"BlockVTKwriter2D" ), _name(name), _binary(binary)
46{}

◆ ~BlockVTKwriter2D()

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

Definition at line 49 of file blockVtkWriter2D.hh.

50{
52}
void clearAddedFunctors()
to clear stored functors

Member Function Documentation

◆ addFunctor()

template<typename T >
void olb::BlockVTKwriter2D< T >::addFunctor ( BlockF2D< T > & f)

put functor to _pointerVec to simplify writing process of several functors

Definition at line 113 of file blockVtkWriter2D.hh.

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

◆ clearAddedFunctors()

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

to clear stored functors

Definition at line 119 of file blockVtkWriter2D.hh.

120{
121 _pointerVec.clear();
122}

◆ write() [1/2]

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

writes given functor

Definition at line 91 of file blockVtkWriter2D.hh.

92{
93 T originX = 0;
94 T originY = 0;
95 T originZ = 0;
96 int nx = f.getBlockStructure().getNx() -1;
97 int ny = f.getBlockStructure().getNy() -1;
98
99 std::string fullNameVti = singleton::directories().getVtkOutDir()
100 + createFileName( f.getName(), iT ) + ".vti";
101
102 preamble( fullNameVti, nx,ny, originX,originY,originZ );
103 if ( _binary ) {
104 writeRawDataBinary( fullNameVti, f, nx,ny );
105 }
106 else {
107 writeRawData( fullNameVti, f, nx,ny );
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::BlockF2D< T >::getBlockStructure(), olb::GenericF< T, S >::getName(), olb::BlockStructureD< D >::getNx(), olb::BlockStructureD< D >::getNy(), and olb::singleton::Directories::getVtkOutDir().

+ Here is the call graph for this function:

◆ write() [2/2]

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

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

writes functors stored at pointerVec

Definition at line 57 of file blockVtkWriter2D.hh.

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

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: