![]() |
Dune-Fufem 2.11-git
|
Class wrapping a portable pixmap (acquired from PPM files) providing it as a piecewise bi-linear GridFunction. More...
#include <dune/fufem/functions/portablepixelmap.hh>
Public Types | |
| enum | IODataFormat { ASCII , Bin } |
| typedef Dune::YaspGrid< 2 > | GridType |
| typedef GridType::Codim< 0 >::Geometry::LocalCoordinate | LocalDomainType |
| typedef GridType::Codim< 0 >::Entity | Element |
| using | DomainType = typename GridType::template Codim< 0 >::Geometry::GlobalCoordinate |
| using | RangeType = Dune::FieldVector< double, 1 > |
| using | Basis = Dune::Functions::LagrangeBasis< GridType::LeafGridView, 1 > |
| using | CoeffType = Dune::BlockVector< RangeType > |
| using | FunctionType = Dune::Functions::DiscreteGlobalBasisFunction< Basis, CoeffType, Dune::Functions::HierarchicNodeToRangeMap, RangeType > |
| using | LocalFunction = typename FunctionType::LocalFunction |
| using | EntitySet = typename FunctionType::EntitySet |
Public Member Functions | |
| PortablePixelMap (const DomainType::field_type xDomainMin, const DomainType::field_type xDomainMax, const DomainType::field_type yDomainMin, const DomainType::field_type yDomainMax, const RangeType fRangeMin, const RangeType fRangeMax, const ColorMap colormap) | |
| Constructor. | |
| PortablePixelMap (const RangeType fRangeMin, const RangeType fRangeMax, const ColorMap colormap) | |
| Constructor. | |
| void | readPixelMap (const char *filename, const int width=-1, const int height=-1, const int xoffset=0, const int yoffset=0) |
| reads the specified rectangular section of a pixelmap (PPM) | |
| RangeType | operator() (const DomainType &x) const |
| const EntitySet & | entitySet () const |
| const CoeffType & | getCoeffs () const |
| const GridType & | getGrid () const |
| unsigned int | getWidth () const |
| unsigned int | getHeight () const |
| unsigned int | getImgWidth () const |
| unsigned int | getImgHeight () const |
| unsigned int | getWhiteValue () const |
| void | exportColormapGraphic (const std::string filename="colormap.ppm") const |
| ~PortablePixelMap () | |
Static Public Member Functions | |
| template<typename FType > | |
| static void | exportPixelMap (const char *filename, const FType &function, RangeFieldTypeFor< FType > fRangeMin, RangeFieldTypeFor< FType > fRangeMax, const DomainFieldType xDomainMin, const DomainFieldType xDomainMax, const DomainFieldType yDomainMin, const DomainFieldType yDomainMax, const unsigned int width, const unsigned int height, const std::string info, const ColorMap colormap, IODataFormat df=Bin) |
| creates a PPM (P3) file from a given scalar function | |
Friends | |
| LocalFunction | localFunction (const PortablePixelMap &ppm) |
Detailed Description
Class wrapping a portable pixmap (acquired from PPM files) providing it as a piecewise bi-linear GridFunction.
A static function is provided to write ppm graphics from some function
A rectangular domain \( \Omega=[xDomainMin,xDomainMax]\times[yDomainMin,yDomainMax] \) is assumed.
Member Typedef Documentation
◆ Basis
◆ CoeffType
◆ DomainType
| using PortablePixelMap::DomainType = typename GridType::template Codim<0>::Geometry::GlobalCoordinate |
◆ Element
| typedef GridType::Codim<0>::Entity PortablePixelMap::Element |
◆ EntitySet
| using PortablePixelMap::EntitySet = typename FunctionType::EntitySet |
◆ FunctionType
| using PortablePixelMap::FunctionType = Dune::Functions::DiscreteGlobalBasisFunction<Basis,CoeffType,Dune::Functions::HierarchicNodeToRangeMap,RangeType> |
◆ GridType
| typedef Dune::YaspGrid<2> PortablePixelMap::GridType |
◆ LocalDomainType
| typedef GridType::Codim<0>::Geometry::LocalCoordinate PortablePixelMap::LocalDomainType |
◆ LocalFunction
| using PortablePixelMap::LocalFunction = typename FunctionType::LocalFunction |
◆ RangeType
| using PortablePixelMap::RangeType = Dune::FieldVector<double, 1> |
Member Enumeration Documentation
◆ IODataFormat
Constructor & Destructor Documentation
◆ PortablePixelMap() [1/2]
|
inline |
Constructor.
- Parameters
-
xDomainMin lower x-interval boundary of computational domain xDomainMax upper x-interval boundary of computational domain yDomainMin lower y-interval boundary of computational domain yDomainMax upper y-interval boundary of computational domain fRangeMin lowest function value that shall be mapped to a color value; DEFAULT = 0 fRangeMax largest function value that shall be mapped to a color value; DEFAULT = 1 colormap the employed PortablePixelMap::ColorMap; DEFAULT = DEFAULT
◆ PortablePixelMap() [2/2]
|
inline |
Constructor.
- Parameters
-
fRangeMin lowest function value that shall be mapped to a color value; DEFAULT = 0 fRangeMax largest function value that shall be mapped to a color value; DEFAULT = 1 colormap the employed PortablePixelMap::ColorMap; DEFAULT = DEFAULT
◆ ~PortablePixelMap()
|
inline |
Member Function Documentation
◆ entitySet()
|
inline |
◆ exportColormapGraphic()
|
inline |
◆ exportPixelMap()
|
inlinestatic |
creates a PPM (P3) file from a given scalar function
Method creates a pixelmap (PPM P3) with width times height pixels whose color values correspond to the given function's domain, range, and values.
- Parameters
-
filename the name of the PPM file to be read function the function to be converted to a pixelmap fRangeMin lower range interval boundary (function value that will correspond to black (white)); lower function values will be "cut off" fRangeMax upper range interval boundary (function value that will correspond to white (black)); larger function values will be "cut off" xDomainMin lower x-interval boundary of function's domain (or rather the part of it to be exported as PixelMap) xDomainMax upper x-interval boundary of function's domain (or rather the part of it to be exported as PixelMap) yDomainMin lower y-interval boundary of function's domain (or rather the part of it to be exported as PixelMap) yDomainMax upper y-interval boundary of function's domain (or rather the part of it to be exported as PixelMap) width the horizontal resolution (absolute number of pixels) of the pixelmap to be created height the vertical resolution (absolute number of pixels) of the pixelmap to be created info some information concerning the function; colormap the employed PortablePixelMap::ColorMap; df the employed output data format (Bin or ASCII);
◆ getCoeffs()
|
inline |
◆ getGrid()
|
inline |
◆ getHeight()
|
inline |
◆ getImgHeight()
|
inline |
◆ getImgWidth()
|
inline |
◆ getWhiteValue()
|
inline |
◆ getWidth()
|
inline |
◆ operator()()
|
inline |
◆ readPixelMap()
|
inline |
reads the specified rectangular section of a pixelmap (PPM)
Method creates a YaspGrid<2> (structured rectangular grid) with width times height nodes. The colorvalues of the corresponding pixels are taken to be the nodal values of a Q1Function on this grid. Thus we get a pixel centered linear interpolation of the pixelmap section.
- Parameters
-
filename the name of the PPM file to be read width the width (pixels) of the section to be imported (for negative values the width of the imported image is assumed); DEFAULT=-1 height the height (pixels) of the section to be imported (for negative values the height of the imported image is assumed); DEFAULT=-1 xoffset the x-position (in pixels) of the upper left corner of the importsection in the pixelmap counted from upper left; DEFAULT=0 yoffset the y-position (in pixels) of the upper left corner of the importsection in the pixelmap counted from upper left; DEFAULT=0
Friends And Related Symbol Documentation
◆ localFunction
|
friend |
The documentation for this class was generated from the following file:
