![]() |
Dune-Fufem 2.11-git
|
Loading...
Searching...
No Matches
portablepixelmap.hh
Go to the documentation of this file.
238 diff_col[j] = (keycolor->first != 0 ? int(color[j]) - int(colorkey_[(keycolor->first)-1][j]) : 255);
239 difff_col[j] = (keycolor->first != 255 ? int(color[j]) - int(colorkey_[(keycolor->first)+1][j]) : 255);
267 void exportColorMapGraphic(const std::string filename="colormap.ppm", IODataFormat df=Bin) const
274 ppmfile = new std::ofstream(filename.c_str(), std::ios::trunc | std::ios::out | std::ios::binary);
279 (*ppmfile) << (df==Bin ? "P6" : "P3") << std::endl << "# file created by PortablePixelMap (dune-fufem)" << std::endl << "# colormap" << std::endl << width << " " << height << std::endl << 255 << std::endl;
318 std::string extension = (filename.rfind(".")!=std::string::npos ? filename.substr(filename.rfind(".")) : "");
325 cmfile << "dune-fufem colorkey format" << std::endl << "# file created by ColorMap (dune-fufem)" << std::endl;
424 using FunctionType = Dune::Functions::DiscreteGlobalBasisFunction<Basis,CoeffType,Dune::Functions::HierarchicNodeToRangeMap,RangeType>;
466 using RangeFieldTypeFor = typename Dune::template FieldTraits<std::decay_t<std::invoke_result_t<Function, DomainType>>>::field_type;
479 PortablePixelMap(const DomainType::field_type xDomainMin, const DomainType::field_type xDomainMax,
501 PortablePixelMap(const RangeType fRangeMin, const RangeType fRangeMax, const ColorMap colormap):
526 void readPixelMap(const char* filename, const int width=-1, const int height=-1, const int xoffset=0, const int yoffset=0)
564 DUNE_THROW(Dune::Exception, "At the moment only PixelMaps with 8Bit/color channel, i.e. a maxval of 255 may be processed due to a restriction of ColorMap::CType to unsigned char.");
603 pixMapFunction_ = new FunctionType(Dune::Functions::makeDiscreteGlobalBasisFunction<RangeType>(*basis_, coeffs_));
691 DUNE_THROW(Dune::RangeError,"Domain has zero or negative extension or range interval has zero length or negative extension(thrown by PortablePixelMap::exportPixelMap.");
741 * assuming a linear transformation \f$ \Omega \longrightarrow [0,width_]\times[0,height_]\f$. The returnvalue is scaled
834 /* \brief provides access to the used maximal value in the (original and imported) pixelmap corresponding to white
#define DUNE_THROW(E,...)
constexpr Iterator end()
constexpr FieldTraits< value_type >::real_type one_norm() const
friend friend class Entity
GridViewEntitySet< GridView, 0 > EntitySet
void exportColorMapGraphic(const std::string filename="colormap.ppm", IODataFormat df=Bin) const
writes a ppm-file to harddisk as an illustration of the colormap
Definition portablepixelmap.hh:267
std::map< KeyType, Color > ColorKey
The actual type of the ColorKey.
Definition portablepixelmap.hh:77
void exportColorMap(std::string filename="colormap", ColorMapFileFormat format=CM)
writes the colorkey to a file in an own format (.cm)
Definition portablepixelmap.hh:314
double inv_map(const double fMin, const double fMax, const Color color)
maps a color to a scalar
Definition portablepixelmap.hh:202
ColorMap(const std::string filename)
Construction from dune-fufem colormap (.cm) File.
Definition portablepixelmap.hh:91
Dune::FieldVector< CType, 3 > Color
The type used to represent the color.
Definition portablepixelmap.hh:68
bool insertInColorKey(const KeyType key, const Color color)
insert keyvalues into the ColorKey
Definition portablepixelmap.hh:140
Color map(const double fMin, const double fMax, const double fVal) const
maps a scalar to a color
Definition portablepixelmap.hh:154
Class wrapping a portable pixmap (acquired from PPM files) providing it as a piecewise bi-linear Grid...
Definition portablepixelmap.hh:411
typename FunctionType::LocalFunction LocalFunction
Definition portablepixelmap.hh:426
Dune::FieldVector< double, 1 > RangeType
Definition portablepixelmap.hh:419
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.
Definition portablepixelmap.hh:479
PortablePixelMap(const RangeType fRangeMin, const RangeType fRangeMax, const ColorMap colormap)
Constructor.
Definition portablepixelmap.hh:501
Dune::Functions::LagrangeBasis< GridType::LeafGridView, 1 > Basis
Definition portablepixelmap.hh:421
Dune::Functions::DiscreteGlobalBasisFunction< Basis, CoeffType, Dune::Functions::HierarchicNodeToRangeMap, RangeType > FunctionType
Definition portablepixelmap.hh:424
RangeType operator()(const DomainType &x) const
Definition portablepixelmap.hh:747
void exportColormapGraphic(const std::string filename="colormap.ppm") const
Definition portablepixelmap.hh:844
friend LocalFunction localFunction(const PortablePixelMap &ppm)
Definition portablepixelmap.hh:760
GridType::Codim< 0 >::Geometry::LocalCoordinate LocalDomainType
Definition portablepixelmap.hh:415
typename GridType::template Codim< 0 >::Geometry::GlobalCoordinate DomainType
Definition portablepixelmap.hh:418
Dune::BlockVector< RangeType > CoeffType
Definition portablepixelmap.hh:423
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)
Definition portablepixelmap.hh:526
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
Definition portablepixelmap.hh:673
typename FunctionType::EntitySet EntitySet
Definition portablepixelmap.hh:427
T append(T... args)
T atoi(T... args)
T begin(T... args)
T c_str(T... args)
T close(T... args)
T empty(T... args)
T end(T... args)
T endl(T... args)
T eof(T... args)
T erase(T... args)
T fail(T... args)
T find_first_not_of(T... args)
T find(T... args)
T gcount(T... args)
T getline(T... args)
T ignore(T... args)
T insert(T... args)
T lower_bound(T... args)
T make_pair(T... args)
T min(T... args)
T open(T... args)
T push_back(T... args)
T rbegin(T... args)
T read(T... args)
T seekg(T... args)
T size(T... args)
T skipws(T... args)
T write(T... args)
