![]() |
Dune-Fufem 2.11-git
|
Class wrapping a greymap (acquired from PGM ASCII (P2)-files) providing it as a piecewise bi-linear GridFunction. More...
#include <dune/fufem/functions/portablegreymap.hh>
Public Types | |
| enum | ColorScheme { DEFAULT , REVERSE } |
| 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 = typename Dune::Functions::LagrangeBasis< GridType::LeafGridView, 1 > |
| using | CoeffType = typename Dune::BlockVector< RangeType > |
| using | FunctionType = Dune::Functions::DiscreteGlobalBasisFunction< Basis, CoeffType, Dune::Functions::HierarchicNodeToRangeMap, RangeType > |
| using | EntitySet = typename FunctionType::EntitySet |
Public Member Functions | |
| PortableGreyMap (const DomainType::field_type xDomainMin, const DomainType::field_type xDomainMax, const DomainType::field_type yDomainMin, const DomainType::field_type yDomainMax, const RangeType fRangeMin=0, const RangeType fRangeMax=1, const ColorScheme colorscheme=DEFAULT) | |
| Constructor. | |
| PortableGreyMap (const RangeType fRangeMin=0, const RangeType fRangeMax=1, const ColorScheme colorscheme=DEFAULT) | |
| Constructor. | |
| void | readGreyMap (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 greymap (PGM-ASCII) | |
| 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 |
| ~PortableGreyMap () | |
Static Public Member Functions | |
| template<typename FType > | |
| static void | exportGreyMap (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 unsigned int maxGreyVal=255, const ColorScheme colorscheme=DEFAULT) |
| creates a PGM (P2) file from a given scalar function | |
Friends | |
| auto | localFunction (const PortableGreyMap &pgm) |
Detailed Description
Class wrapping a greymap (acquired from PGM ASCII (P2)-files) providing it as a piecewise bi-linear GridFunction.
A rectangular domain \( \Omega=[xDomainMin,xDomainMax]\times[yDomainMin,yDomainMax] \) is assumed.
- add support for binary read/write
- unify PPM,PGM -> PAM
Member Typedef Documentation
◆ Basis
| using PortableGreyMap::Basis = typename Dune::Functions::LagrangeBasis<GridType::LeafGridView, 1> |
◆ CoeffType
| using PortableGreyMap::CoeffType = typename Dune::BlockVector<RangeType> |
◆ DomainType
| using PortableGreyMap::DomainType = typename GridType::template Codim<0>::Geometry::GlobalCoordinate |
◆ Element
| typedef GridType::Codim<0>::Entity PortableGreyMap::Element |
◆ EntitySet
| using PortableGreyMap::EntitySet = typename FunctionType::EntitySet |
◆ FunctionType
| using PortableGreyMap::FunctionType = Dune::Functions::DiscreteGlobalBasisFunction<Basis,CoeffType,Dune::Functions::HierarchicNodeToRangeMap,RangeType> |
◆ GridType
| typedef Dune::YaspGrid<2> PortableGreyMap::GridType |
◆ LocalDomainType
| typedef GridType::Codim<0>::Geometry::LocalCoordinate PortableGreyMap::LocalDomainType |
◆ RangeType
| using PortableGreyMap::RangeType = Dune::FieldVector<double, 1> |
Member Enumeration Documentation
◆ ColorScheme
Constructor & Destructor Documentation
◆ PortableGreyMap() [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 grey value; DEFAULT = 0 fRangeMax largest function value that shall be mapped to a grey value; DEFAULT = 1 colorscheme the employed PortableGreyMap::ColorScheme; DEFAULT = DEFAULT
◆ PortableGreyMap() [2/2]
|
inline |
Constructor.
- Parameters
-
fRangeMin lowest function value that shall be mapped to a grey value; DEFAULT = 0 fRangeMax largest function value that shall be mapped to a grey value; DEFAULT = 1 colorscheme the employed PortableGreyMap::ColorScheme; DEFAULT = DEFAULT
◆ ~PortableGreyMap()
|
inline |
Member Function Documentation
◆ entitySet()
|
inline |
◆ exportGreyMap()
|
inlinestatic |
creates a PGM (P2) file from a given scalar function
Method creates a greymap (PGM P2) with width times height pixels whose grey values correspond to the given function's domain, range, and values.
- Parameters
-
filename the name of the PGM file to be read function the function to be converted to a greymap 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 GreyMap) xDomainMax upper x-interval boundary of function's domain (or rather the part of it to be exported as GreyMap) yDomainMin lower y-interval boundary of function's domain (or rather the part of it to be exported as GreyMap) yDomainMax upper y-interval boundary of function's domain (or rather the part of it to be exported as GreyMap) width the horizontal resolution (absolute number of pixels) of the greymap to be created height the vertical resolution (absolute number of pixels) of the greymap to be created info some information concerning the function; DEFAULT="" maxGreyVal the value that shall correspond to white in the PGM (0 is black), has to satisfy 0 < maxGreyVal < 65536; determines the number of greyshades used for the greymap; DEFAULT = 255 colorscheme the employed PortableGreyMap::ColorScheme; DEFAULT = DEFAULT
◆ getCoeffs()
|
inline |
◆ getGrid()
|
inline |
◆ getHeight()
|
inline |
◆ getImgHeight()
|
inline |
◆ getImgWidth()
|
inline |
◆ getWhiteValue()
|
inline |
◆ getWidth()
|
inline |
◆ operator()()
|
inline |
◆ readGreyMap()
|
inline |
reads the specified rectangular section of a greymap (PGM-ASCII)
Method creates a YaspGrid<2> (structured rectangular grid) with width times height nodes. The greyvalues 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 greymap section.
- Parameters
-
filename the name of the PGM 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 greymap counted from upper left; DEFAULT=0 yoffset the y-position (in pixels) of the upper left corner of the importsection in the greymap counted from upper left; DEFAULT=0
Friends And Related Symbol Documentation
◆ localFunction
|
friend |
The documentation for this class was generated from the following file:
