![]() |
Dune-Fufem 2.11-git
|
Loading...
Searching...
No Matches
portablegreymap.hh
Go to the documentation of this file.
46 using FunctionType = Dune::Functions::DiscreteGlobalBasisFunction<Basis,CoeffType,Dune::Functions::HierarchicNodeToRangeMap,RangeType>;
85 using RangeFieldTypeFor = typename Dune::template FieldTraits<std::decay_t<std::invoke_result_t<Function, DomainType>>>::field_type;
98 PortableGreyMap(const DomainType::field_type xDomainMin, const DomainType::field_type xDomainMax,
120 PortableGreyMap(const RangeType fRangeMin=0, const RangeType fRangeMax=1, const ColorScheme colorscheme=DEFAULT):
144 void readGreyMap(const char* filename, const int width=-1, const int height=-1, const int xoffset=0, const int yoffset=0)
217 greyMapFunction_ = new FunctionType(Dune::Functions::makeDiscreteGlobalBasisFunction<RangeType>(*basis_, coeffs_));
283 DUNE_THROW(Dune::RangeError,"Domain has zero or negative extension or range interval has zero length or negative extension(thrown by PortableGreyMap::exportGreyMap.");
293 pgmfile << "P2" << std::endl << "# file created by PortableGreyMap (dune-fufem)" << std::endl << "# " << info << std::endl << height << " " << width << std::endl << maxGreyVal << std::endl;
305 // we transform the function value to the corresponding point in [0,maxGreyVal] and round to the next integer. According to the colorscheme (whether fRangeMin or fRangemax is white) we have to choose the greyvalue
306 int greyval = (colorscheme==DEFAULT ? std::floor((fval-fRangeMin)*tFactor+0.5) : maxGreyVal-std::floor((fval-fRangeMin)*tFactor+0.5) );
322 * assuming a linear transformation \f$ \Omega \longrightarrow [0,width_]\times[0,height_]\f$. The returnvalue is scaled
339 return fRangeMin_ + (colorscheme_==DEFAULT ? r/imgParams_[2] : (1-r/imgParams_[2]))*(fRangeMax_-fRangeMin_);
349 return pgm.fRangeMin_ + (pgm.colorscheme_==DEFAULT ? r/pgm.imgParams_[2] : (1-r/pgm.imgParams_[2]))*(pgm.fRangeMax_-pgm.fRangeMin_);
420 /* \brief provides access to the used maximal value in the (original and imported) greymap corresponding to white
#define DUNE_THROW(E,...)
friend friend class Entity
GridViewEntitySet< GridView, 0 > EntitySet
Class wrapping a greymap (acquired from PGM ASCII (P2)-files) providing it as a piecewise bi-linear G...
Definition portablegreymap.hh:33
RangeType operator()(const DomainType &x) const
Definition portablegreymap.hh:328
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)
Definition portablegreymap.hh:144
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.
Definition portablegreymap.hh:98
PortableGreyMap(const RangeType fRangeMin=0, const RangeType fRangeMax=1, const ColorScheme colorscheme=DEFAULT)
Constructor.
Definition portablegreymap.hh:120
friend auto localFunction(const PortableGreyMap &pgm)
Definition portablegreymap.hh:342
typename Dune::Functions::LagrangeBasis< GridType::LeafGridView, 1 > Basis
Definition portablegreymap.hh:43
Dune::Functions::DiscreteGlobalBasisFunction< Basis, CoeffType, Dune::Functions::HierarchicNodeToRangeMap, RangeType > FunctionType
Definition portablegreymap.hh:46
GridType::Codim< 0 >::Geometry::LocalCoordinate LocalDomainType
Definition portablegreymap.hh:37
typename FunctionType::EntitySet EntitySet
Definition portablegreymap.hh:48
typename Dune::BlockVector< RangeType > CoeffType
Definition portablegreymap.hh:45
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
Definition portablegreymap.hh:265
typename GridType::template Codim< 0 >::Geometry::GlobalCoordinate DomainType
Definition portablegreymap.hh:40
T atoi(T... args)
T close(T... args)
T endl(T... args)
T eof(T... args)
T floor(T... args)
T getline(T... args)
T ignore(T... args)
T min(T... args)
T open(T... args)
T push_back(T... args)
T skipws(T... args)
