24#ifndef BLOCK_GIF_WRITER_HH
25#define BLOCK_GIF_WRITER_HH
42 : clout(std::cout,
"BlockGifWriter"), _colorRange(1024), _numColors(1024),
43 _colorMap(graphics::mapGenerators::generateMap<T>(map)), _minValue(0),
49 std::string
const& name)
53 clout <<
"Error: Functor targetDim is not 1. " << std::endl;
58 std::string fullNamePpm;
59 if ( name ==
"emptyName") {
67 fullNamePpm = fullNamePpm +
".ppm" ;
68 std::ofstream fout( fullNamePpm.c_str() );
76 fout << (_colorRange - 1) <<
"\n";
84 evaluated[0] = (minValue - evaluated[0]) / (minValue - maxValue);
86 if ( evaluated[0] >= T(1) ) {
90 fout << (int)(color.
r * (_colorRange - 1)) <<
" "
91 << (
int)(color.
g * (_colorRange - 1)) <<
" "
92 << (int)(color.
b * (_colorRange - 1)) <<
"\n";
100template<
typename T >
114 if (valueTmp[0] < minValue[0]) {
115 minValue[0] = valueTmp[0];
117 if (valueTmp[0] > maxValue[0]) {
118 maxValue[0] = valueTmp[0];
122 if (maxValue[0] <= minValue[0]) {
127 write(f, minValue[0], maxValue[0], iT, name);
132template<
typename T >
135 if ( _pointerVec.empty() ) {
137 clout <<
"Error: Please add functor via addFunctor()";
141 for (
auto it = _pointerVec.cbegin(); it != _pointerVec.cend(); ++it, ++i) {
143 write(**it, iT, _name[i]);
146 write(**it, _minValue[i], _maxValue[i], iT, _name[i]);
152template<
typename T >
155 _pointerVec.push_back(&f);
157 if ( name ==
"emptyName") {
160 _name.push_back(name);
162 _autoScale.push_back(
true);
163 _minValue.push_back(T());
164 _maxValue.push_back(T());
167template<
typename T >
169 std::string
const& name)
171 _pointerVec.push_back(&f);
173 if ( name ==
"emptyName") {
176 _name.push_back(name);
178 _autoScale.push_back(
false);
179 _minValue.push_back(minValue);
180 _maxValue.push_back(maxValue);
represents all functors that operate on a cuboid in general, mother class of BlockLatticeF,...
virtual BlockStructureD< 2 > & getBlockStructure()
virtual destructor for defined behaviour
void write(BlockF2D< T > &f, T minValue, T maxValue, int iT=0, std::string const &name="emptyName")
writes functor values normed to interval [0,1].
void addFunctor(BlockF2D< T > &f, std::string const &name="emptyName")
put functor to _pointerVec, to simplify writing process of several functors
BlockGifWriter(std::string const &map="leeloo")
int getNy() const
Read only access to block height.
int getNx() const
Read only access to block width.
int getTargetDim() const
read only access to member variable _n
std::string & getName()
read and write access to name
These functions help you to create file names.
Wrapper functions that simplify the use of MPI.
Directories & directories()
Top level namespace for all of OpenLB.
std::string createFileName(std::string name)
for .pvd masterFile
Definition of singletons: global, publicly available information.