DUNE PDELab (git)

Default options class to write SVG matrices. More...

#include <dune/istl/io.hh>

Public Member Functions

template<class RowPrefix , class ColPrefix >
std::string blockStyleClass (const RowPrefix &row_prefix, const ColPrefix &col_prefix) const
 Helper function that returns an style class for a given prefix. More...
 
template<class Stream , class RowPrefix , class ColPrefix , class Block >
void writeBlockTitle (Stream &out, const RowPrefix &row_prefix, const ColPrefix &col_prefix, const Block &block) const
 Helper function writes a title for a given block and prefix. More...
 
template<class Stream , class RowPrefix , class ColPrefix , class Block >
void writeSVGBlock (Stream &out, const RowPrefix &row_prefix, const ColPrefix &col_prefix, const Block block, const std::array< std::size_t, 4 > &svg_box) const
 Write an SVG object for a given block/value in the matrix. More...
 

Public Attributes

std::size_t block_size = 10
 size (pixels) of the deepst block/value of the matrix
 
std::size_t interspace = 5
 size (pixels) of the interspace between blocks
 
std::size_t width = 500
 Final width size (pixels) of the SVG header. If 0, size is automatic.
 
std::size_t height = 0
 Final height size (pixels) of the SVG header. If 0, size is automatic.
 
bool write_header = true
 Whether to write the SVG header.
 
std::string style
 CSS style block to write in header.
 
std::function< std::string(const double &)> color_fill
 Color fill for default options. More...
 
bool write_block_title = true
 (Helper) Whether to write a title on the rectangle value
 

Detailed Description

Default options class to write SVG matrices.

This object is intended customize the output of the SVG writer for matrices writeSVGMatrix.

Member Function Documentation

◆ blockStyleClass()

template<class RowPrefix , class ColPrefix >
std::string Dune::DefaultSVGMatrixOptions::blockStyleClass ( const RowPrefix &  row_prefix,
const ColPrefix &  col_prefix 
) const
inline

Helper function that returns an style class for a given prefix.

Note
This function is only a helper to the default writeSVGBlock and is not required for custom options classes.

Referenced by writeSVGBlock().

◆ writeBlockTitle()

template<class Stream , class RowPrefix , class ColPrefix , class Block >
void Dune::DefaultSVGMatrixOptions::writeBlockTitle ( Stream &  out,
const RowPrefix &  row_prefix,
const ColPrefix &  col_prefix,
const Block &  block 
) const
inline

Helper function writes a title for a given block and prefix.

Note
This function is only a helper to the default writeSVGBlock and is not required for custom options classes.

Referenced by writeSVGBlock().

◆ writeSVGBlock()

template<class Stream , class RowPrefix , class ColPrefix , class Block >
void Dune::DefaultSVGMatrixOptions::writeSVGBlock ( Stream &  out,
const RowPrefix &  row_prefix,
const ColPrefix &  col_prefix,
const Block  block,
const std::array< std::size_t, 4 > &  svg_box 
) const
inline

Write an SVG object for a given block/value in the matrix.

This function is called for every matrix block; that includes root and intermediate nested blocks of matrices. SVG blocks are written from outer to inner matrix blocks, this means that in case of overlaps in the SVG objects, the more nested blocks take precedence.

Warning
If the SVG bounding box is not respected, the content may be omitted in the final SVG view.
Note
This function signature is required for any custom options class.
Template Parameters
StreamAn ostream type (possibly a NullStream!)
RowPrefixA ReservedVector
ColPrefixA ReservedVector
BlockThe type of the current block
Parameters
outAn stream to send SVG object to
row_prefixA multindex of indices to access current row
col_prefixA multindex of indices to access current column
blockThe current matrix/sub-block/value
svg_boxSVG object bounding box (position and sizes).

References blockStyleClass(), color_fill, height, width, and writeBlockTitle().

Member Data Documentation

◆ color_fill

std::function<std::string(const double&)> Dune::DefaultSVGMatrixOptions::color_fill

Color fill for default options.

Example:

opts.color_fill = [max,min](const double& val){
auto percentage = (val-min)/(max-min)*100;
return "hsl(348, " + std::to_string(percentage) + "%, 41%)";};
};
constexpr auto max
Function object that returns the greater of the given values.
Definition: hybridutilities.hh:484
constexpr auto min
Function object that returns the smaller of the given values.
Definition: hybridutilities.hh:506

Referenced by writeSVGBlock().


The documentation for this struct was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)