OGS
DataHolderLib Namespace Reference

Classes

class  BoundaryCondition
 
class  ColorLookupTable
 
class  FemCondition
 Base class for boundary conditions, initial conditions and source terms. More...
 
struct  ProcessVariable
 
class  Project
 
class  SourceTerm
 Managing data associated with a source term. More...
 

Typedefs

using Color = std::array<unsigned char, 4>
 

Enumerations

enum class  LUTType { NONE = 0 , LINEAR = 1 , EXPONENTIAL = 2 , SIGMOID = 3 }
 Interpolation methods. More...
 
enum class  BaseObjType { MESH = 0 , GEOMETRY = 1 }
 
enum class  ParameterType { NONE = 0 , CONSTANT , FUNCTION }
 

Functions

Color createColor (unsigned char r, unsigned char g, unsigned char b, unsigned char a)
 
Color getRandomColor ()
 Returns a random RGB colour.
 
Color getColor (const std::string &id, std::map< std::string, Color > &colors)
 
Color getColor (const std::string &id, std::map< std::string, DataHolderLib::Color > &colors)
 

Typedef Documentation

◆ Color

using DataHolderLib::Color = std::array<unsigned char, 4>

Definition at line 24 of file Color.h.

Enumeration Type Documentation

◆ BaseObjType

enum class DataHolderLib::BaseObjType
strong
Enumerator
MESH 
GEOMETRY 

Definition at line 25 of file FemCondition.h.

◆ LUTType

enum class DataHolderLib::LUTType
strong

Interpolation methods.

Enumerator
NONE 
LINEAR 
EXPONENTIAL 
SIGMOID 

Definition at line 24 of file ColorLookupTable.h.

24 {
25 NONE = 0,
26 LINEAR = 1,
27 EXPONENTIAL = 2,
28 SIGMOID = 3 // not yet implemented
29};

◆ ParameterType

enum class DataHolderLib::ParameterType
strong
Enumerator
NONE 
CONSTANT 
FUNCTION 

Definition at line 31 of file FemCondition.h.

Function Documentation

◆ createColor()

Color DataHolderLib::createColor ( unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a )

Definition at line 21 of file Color.cpp.

25{
26 return Color{{r, g, b, a}};
27}
std::array< unsigned char, 4 > Color
Definition Color.h:24

Referenced by getRandomColor(), and FileIO::XmlLutReader::readFromFile().

◆ getColor() [1/2]

Color DataHolderLib::getColor ( const std::string & id,
std::map< std::string, Color > & colors )

Definition at line 36 of file Color.cpp.

37{
38 auto it = colors.find(id);
39
40 if (it == end(colors))
41 {
42 WARN("Key '{:s}' not found in color lookup table.", id);
43 it = colors.insert({id, getRandomColor()}).first;
44 }
45
46 return it->second;
47}
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:40
Color getRandomColor()
Returns a random RGB colour.
Definition Color.cpp:29

References getRandomColor(), and WARN().

Referenced by StratBar::paint().

◆ getColor() [2/2]

Color DataHolderLib::getColor ( const std::string & id,
std::map< std::string, DataHolderLib::Color > & colors )

Uses a color-lookup-table (in form of a map) to return a colour for a specified name. If the name is not in the colortable a new entry is created with the new name and a random colour.

◆ getRandomColor()

Color DataHolderLib::getRandomColor ( )

Returns a random RGB colour.

Definition at line 29 of file Color.cpp.

30{
31 return createColor(static_cast<unsigned char>((rand() % 5) * 50),
32 static_cast<unsigned char>((rand() % 5) * 50),
33 static_cast<unsigned char>((rand() % 5) * 50));
34}
Color createColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition Color.cpp:21

References createColor().

Referenced by VtkPointsSource::VtkPointsSource(), VtkPolylinesSource::VtkPolylinesSource(), VtkStationSource::VtkStationSource(), VtkSurfacesSource::VtkSurfacesSource(), DetailWindow::addList(), and getColor().