https://mooseframework.inl.gov
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 
25 class PNGOutput : public FileOutput
26 {
27 public:
29 
31 
32 protected:
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 
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 
83 
88 
91 };
92 
93 #endif
unsigned int _nl_sys_num
What nonlinear system the variable is in.
Definition: PNGOutput.h:74
Real _min
Definition: PNGOutput.h:82
void makePNG()
Function that creates the PNG.
Definition: PNGOutput.C:362
std::unique_ptr< libMesh::MeshFunction > _mesh_function
Pointer to the libMesh::MeshFunction object in which the read data is stored.
Definition: PNGOutput.h:67
const MooseEnum _color
Way to specify color vs grayscale image creation.
Definition: PNGOutput.h:58
void makeMeshFunc()
Function to create the mesh_function.
Definition: PNGOutput.C:103
static InputParameters validParams()
Definition: PNGOutput.C:22
const bool _transparent_background
Indicates whether to make the background transparent.
Definition: PNGOutput.h:61
Real reverseScale(Real value_to_unscale)
Function for reversing the applyScale function.
Definition: PNGOutput.C:214
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
Real _out_bounds_shade
Value of the colors that are outside of the libmesh bounds.
Definition: PNGOutput.h:90
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void calculateRescalingValues()
Function to populate values to the variables used for scaling.
Definition: PNGOutput.C:163
Output class to create a 2D figure in PNG format.
Definition: PNGOutput.h:25
const unsigned int _resolution
Variable to determine the size, or resolution, of the image.
Definition: PNGOutput.h:55
const Real _transparency
Controls transparency level for the general image.
Definition: PNGOutput.h:64
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
Real _scaling_max
Definition: PNGOutput.h:86
Real _max
Variables that store the max and min of the values in the variable used.
Definition: PNGOutput.h:81
Real _shift_value
Definition: PNGOutput.h:87
Real applyScale(Real value_to_scale)
Function for applying scaling to given values.
Definition: PNGOutput.C:206
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real _scaling_min
Values used for rescaling the image.
Definition: PNGOutput.h:85
BoundingBox _box
The boundaries of the image.
Definition: PNGOutput.h:70
VariableName _variable
The name of the variable to use to create the png.
Definition: PNGOutput.h:77
PNGOutput(const InputParameters &parameters)
Definition: PNGOutput.C:84
An outputter with filename support.
Definition: FileOutput.h:20
void setRGB(png_byte *rgb, Real selection)
Method for assigning color values to the PNG.
Definition: PNGOutput.C:221
virtual void output()
Called to run the functions in this class.
Definition: PNGOutput.C:350