https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PNGOutput.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9#pragma once
10
11#ifdef MOOSE_HAVE_LIBPNG
12
13// pnglib includes
14#include <png.h>
15// MOOSE includes
16#include "FileOutput.h"
17#include "MooseEnum.h"
18// libmesh includes
19#include "libmesh/mesh_function.h"
20#include "libmesh/bounding_box.h"
21
25class PNGOutput : public FileOutput
26{
27public:
29
31
32protected:
34 void setRGB(png_byte * rgb, Real selection);
35
37 void makeMeshFunc();
38
41
43 Real applyScale(Real value_to_scale);
44
46 Real reverseScale(Real value_to_unscale);
47
49 void makePNG();
50
52 virtual void output();
53
55 const unsigned int _resolution;
56
59
62
64 const Real _transparency;
65
67 std::unique_ptr<libMesh::MeshFunction> _mesh_function;
68
70 BoundingBox _box;
71
74 unsigned int _nl_sys_num;
75
77 VariableName _variable;
78
81 Real _max;
82 Real _min;
83
88
91};
92
93#endif
An outputter with filename support.
Definition FileOutput.h:21
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
Output class to create a 2D figure in PNG format.
Definition PNGOutput.h:26
virtual void output()
Called to run the functions in this class.
Definition PNGOutput.C:350
Real applyScale(Real value_to_scale)
Function for applying scaling to given values.
Definition PNGOutput.C:206
Real _shift_value
Definition PNGOutput.h:87
static InputParameters validParams()
Definition PNGOutput.C:22
const bool _transparent_background
Indicates whether to make the background transparent.
Definition PNGOutput.h:61
void calculateRescalingValues()
Function to populate values to the variables used for scaling.
Definition PNGOutput.C:163
Real _scaling_min
Values used for rescaling the image.
Definition PNGOutput.h:85
void setRGB(png_byte *rgb, Real selection)
Method for assigning color values to the PNG.
Definition PNGOutput.C:221
Real _out_bounds_shade
Value of the colors that are outside of the libmesh bounds.
Definition PNGOutput.h:90
Real _scaling_max
Definition PNGOutput.h:86
void makePNG()
Function that creates the PNG.
Definition PNGOutput.C:362
Real _max
Variables that store the max and min of the values in the variable used.
Definition PNGOutput.h:81
const Real _transparency
Controls transparency level for the general image.
Definition PNGOutput.h:64
BoundingBox _box
The boundaries of the image.
Definition PNGOutput.h:70
Real reverseScale(Real value_to_unscale)
Function for reversing the applyScale function.
Definition PNGOutput.C:214
std::unique_ptr< libMesh::MeshFunction > _mesh_function
Pointer to the libMesh::MeshFunction object in which the read data is stored.
Definition PNGOutput.h:67
unsigned int _nl_sys_num
What nonlinear system the variable is in.
Definition PNGOutput.h:74
const MooseEnum _color
Way to specify color vs grayscale image creation.
Definition PNGOutput.h:58
Real _min
Definition PNGOutput.h:82
VariableName _variable
The name of the variable to use to create the png.
Definition PNGOutput.h:77
void makeMeshFunc()
Function to create the mesh_function.
Definition PNGOutput.C:103
const unsigned int _resolution
Variable to determine the size, or resolution, of the image.
Definition PNGOutput.h:55