24#ifndef GNUPLOT_HEATMAP_WRITER_HH
25#define GNUPLOT_HEATMAP_WRITER_HH
57 const std::vector<T>& valueArea,
const plotParam<T>& plot)
62 std::cout <<
"HeatMap Error: Functor targetDim is not 1. " << std::endl;
76 if (plot.
name ==
"") {
91 for (std::size_t pos = 0; pos < param.
plotFilePath.length(); pos++) {
108 T base = std::min(param.
nx, param.
ny);
134 std::ofstream foutMatrix( param.
matrixPath.c_str() );
137 for (i[1] = param.
ny * param.
zoomMin[1]; i[1] < param.
ny * param.
zoomMax[1]; i[1]++) {
138 for (i[0] = param.
nx * param.
zoomMin[0]; i[0] < param.
nx * param.
zoomMax[0]; i[0]++) {
141 foutMatrix << BaseType<T>(evaluated[0]) <<
" ";
142 if (i[0] ==
int(param.
nx * param.
zoomMax[0]) - 1) {
150 if (param.
plot->writeCSV) {
151 std::ofstream foutCSV( param.
csvPath.c_str() );
152 for (i[1] = 0; i[1] < param.
ny; i[1]++) {
153 for (i[0] = 0; i[0] < param.
nx; i[0]++) {
157 foutCSV << physPoint[0] <<
" " << physPoint[1] <<
" " << physPoint[2] <<
" " << evaluated[0] <<
"\n";
173 fout <<
"if (strstrt(GPVAL_TERMINALS, 'jpeg') > 0) {";
174 fout <<
"set terminal jpeg " <<
"size " << param.
canvasX <<
"," << param.
canvasY <<
"font \",25\"" <<
"\n";
175 fout <<
"set output '"<< param.
jpegPath <<
"'"<<
"\n";
177 fout <<
"set terminal png " <<
"size " << param.
canvasX <<
"," << param.
canvasY <<
"font \",25\"" <<
"\n";
178 fout <<
"set output '"<< param.
pngPath <<
"'"<<
"\n";
180 fout <<
"set pm3d map" <<
"\n";
181 fout <<
"unset key" <<
"\n";
183 if (param.
plot->fullScreenPlot) {
184 fout <<
"unset xtics" <<
"\n";
185 fout <<
"unset ytics" <<
"\n";
186 fout <<
"unset border"<<
"\n";
188 fout <<
"set xtics out" <<
"\n";
189 fout <<
"set ytics out" <<
"\n";
190 fout <<
"set xtics nomirror" <<
"\n";
191 fout <<
"set ytics nomirror" <<
"\n";
196 fout <<
"set pm3d interpolate 0,0" <<
"\n";
198 if (param.
plot->fullScreenPlot) {
200 fout <<
"set lmargin at screen 0" <<
"\n";
201 fout <<
"set rmargin at screen 1" <<
"\n";
202 fout <<
"set tmargin at screen 0" <<
"\n";
203 fout <<
"set bmargin at screen 1" <<
"\n";
206 fout <<
"set size ratio -1" <<
"\n";
207 fout <<
"set size 0.925,1.0" <<
"\n";
211 if( param.
plot->fullScreenPlot ==
false || param.
plot->activateFullScreenPlotColorBox ==
true ) {
212 fout <<
"set colorbox vertical user origin 0.85,0.1 size " << 0.025/
BaseType<T>(param.
cbXscaling) <<
" ,0.8" <<
"\n";
216 fout <<
"set xlabel \"x-axis in m \"" <<
"\n"
217 <<
"set ylabel \"y-axis in m \"" <<
"\n";
220 fout <<
"set xlabel \"x-axis in m \"" <<
"\n"
221 <<
"set ylabel \"z-axis in m \"" <<
"\n";
225 fout <<
"set xlabel \"y-axis in m \"" <<
"\n"
226 <<
"set ylabel \"z-axis in m \"" <<
"\n";
231 fout <<
"set xlabel \"width in m \"" <<
"\n"
232 <<
"set ylabel \"height in m \"" <<
"\n";
236 if (param.
plot->contourlevel > 0) {
237 fout <<
"set contour base" <<
"\n";
238 fout <<
"set cntrparam levels " << param.
plot->contourlevel <<
"\n";
239 fout <<
"set cntrparam bspline" <<
"\n";
240 fout <<
"do for [i=1:"<< param.
plot->contourlevel <<
"] {" <<
"\n";
241 fout <<
"set linetype i lc rgb \"black\""<<
"\n";
245 fout <<
"set cblabel offset 0.5 \"" <<param.
quantityname;
247 fout <<
" in m/s\"" <<
"\n";
250 fout <<
" in Pa\"" <<
"\n";
260 if (valueArea.empty()) {
261 fout <<
"set autoscale fix" <<
"\n";
263 else if (valueArea[0] < valueArea[1]) {
270 if (param.
plot->colour ==
"grey") {
271 fout <<
"set palette grey" <<
"\n";
273 else if (param.
plot->colour ==
"pm3d") {
276 else if (param.
plot->colour ==
"blackbody") {
277 fout <<
"set palette defined ( 0 \"black\", 1 \"red\", 2 \"yellow\")" <<
"\n";
280 fout <<
"set palette defined ( 0 \"blue\", 1 \"green\", 2 \"yellow\", 3 \"orange\", 4 \"red\" )" <<
"\n";
288template<
typename T >
292 std::cout <<
"We could not find a gnuplot distribution at your system." << std::endl;
293 std::cout <<
"We still write the data files s.t. you can plot the data yourself." << std::endl;
297 if (!system(
nullptr)) {
300 const std::string command =
"gnuplot "+ param.
plotFilePath +
" > /dev/null &";
301 if ( system(command.c_str()) ) {
302 std::cout <<
"Error at GnuplotWriter" << std::endl;
313 return (! system(
"which gnuplot >/dev/null 2>/dev/null"));
represents all functors that operate on a cuboid in general, mother class of BlockLatticeF,...
BlockReduction2D2D interpolates the data of a SuperF2D functor in a given resolution.
HyperplaneLattice3D< T > getPlaneDiscretizationIn3D() const
Returns embedding of the discretized plane in 3D space.
BlockReduction3D2D reduces the data of a SuperF3D functor to the intersection between a given hyperpl...
int getTargetDim() const
read only access to member variable _n
Parametrization of a hyperplane lattice.
std::string getImageOutDir() const
void writeHeatMapDataFile(detailParam< T > ¶m)
void genericHeatMapInterface(const HyperplaneLattice3D< T > &hyperPlane, BlockF2D< T > &blockData, int iT, const std::vector< T > &valueArea, const plotParam< T > ¶m)
void executeGnuplot(detailParam< T > ¶m)
void writeHeatMapPlotFile(detailParam< T > ¶m, const std::vector< T > &valueArea)
void write(BlockReduction3D2D< T > &blockReduction, int iT, const plotParam< T > param={}, const std::vector< T > &valueArea=std::vector< T >())
This function is used to plot heat maps as jpeg files.
Directories & directories()
bool nearZero(const ADf< T, DIM > &a)
Top level namespace for all of OpenLB.
std::string createFileName(std::string name)
for .pvd masterFile
typename util::BaseTypeHelper< T >::type BaseType
constexpr Vector< T, 3 > crossProduct3D(const ScalarVector< T, 3, IMPL > &a, const ScalarVector< T, 3, IMPL_ > &b) any_platform
Definition of singletons: global, publicly available information.
const plotParam< T > * plot
BlockF2D< T > * blockData
const HyperplaneLattice3D< T > * hyperPlane
Vector< T, 2u > zoomExtend
Vector< T, 2u > zoomOrigin