Loading...
Searching...
No Matches
colourTable Class Reference

Base class for generating a colour table from node points. More...

#include <colourTable.H>

Collaboration diagram for colourTable:

Public Types

enum  interpolationType { RGB , HSV , DIVERGING }
 Internal interpolation type. More...
enum  predefinedType {
  COOL_WARM , COLD_HOT , FIRE , RAINBOW ,
  GREYSCALE , XRAY
}
 Enumeration of commonly used colour tables. More...
typedef Tuple2< scalar, vectorpair_type
 The data lookup type.

Public Member Functions

 colourTable (const List< Tuple2< scalar, vector > > &values, const interpolationType interp=interpolationType::RGB)
 Copy construct from table values.
 colourTable (List< Tuple2< scalar, vector > > &&values, const interpolationType interp=interpolationType::RGB)
 Copy construct from table values.
 colourTable (const dictionary &dict, const interpolationType interp=interpolationType::RGB)
 Read construct from dictionary.
virtual ~colourTable ()=default
 Destructor.
vector value (const scalar x) const
 Return the colour at x. The input is clipped to 0-1 range.
List< Tuple2< scalar, vector > > table (const label nColours) const
 Return a discrete lookup table of colours.
OstreamwriteDict (Ostream &os) const
 Write as dictionary format.

Static Public Member Functions

static const colourTableptr (const word &tableName)
 Look up pointer to colourTable by name, or nullptr on failure.
static const colourTableptr (const predefinedType tbl)
 Look up pointer to colourTable by type, or nullptr on failure.
static const colourTableref (const word &tableName)
 Look up pointer to colourTable by name. Fatal on failure.
static const colourTableref (const predefinedType tbl)
 Look up pointer to colourTable by type. Fatal on failure.
static autoPtr< colourTableNew (Istream &is)
 Read as dictionary content.
static const HashPtrTable< colourTable > & tables ()
 Predefined tables.

Static Public Attributes

static const Enum< interpolationTypeinterpolationTypeNames
 Enumeration names for interpolationType.
static const Enum< predefinedTypepredefinedNames
 Enumeration names for predefinedType.

Detailed Description

Base class for generating a colour table from node points.

Dictionary definition

Property Description Required Default
interpolate rgb/hsv/diverging no rgb
table Node points for the colour table yes

Predefined colour tables (in "etc/colourTables") include "coolToWarm", "coldAndHot", "fire", "rainbow", "greyscale", "xray".

Source files

Definition at line 75 of file colourTable.H.

Member Typedef Documentation

◆ pair_type

typedef Tuple2<scalar, vector> pair_type

The data lookup type.

Definition at line 118 of file colourTable.H.

Member Enumeration Documentation

◆ interpolationType

Internal interpolation type.

Enumerator
RGB 
HSV 
DIVERGING 

Definition at line 82 of file colourTable.H.

◆ predefinedType

Enumeration of commonly used colour tables.

The indices must match those in "etc/colourTables"

Enumerator
COOL_WARM 

"coolToWarm"

COLD_HOT 

"coldAndHot"

FIRE 

"fire" - ParaView "Black-Body Radiation"

RAINBOW 

"rainbow"

GREYSCALE 

greyscale - ParaView "Grayscale"

XRAY 

"xray" - ParaView "X Ray"

Definition at line 94 of file colourTable.H.

Constructor & Destructor Documentation

◆ colourTable() [1/3]

colourTable ( const List< Tuple2< scalar, vector > > & values,
const interpolationType interp = interpolationType::RGB )
explicit

Copy construct from table values.

Definition at line 41 of file colourTable.C.

Referenced by ptr(), and ref().

Here is the caller graph for this function:

◆ colourTable() [2/3]

colourTable ( List< Tuple2< scalar, vector > > && values,
const interpolationType interp = interpolationType::RGB )
explicit

Copy construct from table values.

Definition at line 52 of file colourTable.C.

◆ colourTable() [3/3]

colourTable ( const dictionary & dict,
const interpolationType interp = interpolationType::RGB )
explicit

Read construct from dictionary.

Definition at line 63 of file colourTable.C.

References dict, and interpolationTypeNames.

◆ ~colourTable()

virtual ~colourTable ( )
virtualdefault

Destructor.

References os(), and x.

Here is the call graph for this function:

Member Function Documentation

◆ ptr() [1/2]

const Foam::colourTable * ptr ( const word & tableName)
static

Look up pointer to colourTable by name, or nullptr on failure.

Definition at line 81 of file colourTables.C.

References colourTable(), and p.

Referenced by ptr(), and ref().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ptr() [2/2]

const Foam::colourTable * ptr ( const predefinedType tbl)
static

Look up pointer to colourTable by type, or nullptr on failure.

Definition at line 100 of file colourTables.C.

References predefinedNames, and ptr().

Here is the call graph for this function:

◆ ref() [1/2]

const Foam::colourTable & ref ( const word & tableName)
static

Look up pointer to colourTable by name. Fatal on failure.

Definition at line 106 of file colourTables.C.

References colourTable(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, p, and ptr().

Here is the call graph for this function:

◆ ref() [2/2]

const Foam::colourTable & ref ( const predefinedType tbl)
static

Look up pointer to colourTable by type. Fatal on failure.

Definition at line 121 of file colourTables.C.

References predefinedNames, and ref().

Here is the call graph for this function:

◆ New()

Foam::autoPtr< Foam::colourTable > New ( Istream & is)
static

Read as dictionary content.

Definition at line 79 of file colourTable.C.

References dictionary, and autoPtr< T >::New().

Here is the call graph for this function:

◆ tables()

const Foam::HashPtrTable< Foam::colourTable > & tables ( )
static

Predefined tables.

Definition at line 70 of file colourTables.C.

◆ value()

Foam::vector value ( const scalar x) const

Return the colour at x. The input is clipped to 0-1 range.

Definition at line 87 of file colourTable.C.

References DIVERGING, Foam::findLower(), Tuple2< T1, T2 >::first(), HSV, Foam::colourTools::interpolateDiverging(), Foam::colourTools::interpolateHSV(), Foam::colourTools::interpolateRGB(), s(), and x.

Referenced by Foam::getAnimationColour(), Foam::getBoundedColours(), and table().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ table()

Foam::List< Foam::Tuple2< Foam::scalar, Foam::vector > > table ( const label nColours) const

Return a discrete lookup table of colours.

Definition at line 143 of file colourTable.C.

References value(), and x.

Here is the call graph for this function:

◆ writeDict()

Foam::Ostream & writeDict ( Ostream & os) const

Write as dictionary format.

Definition at line 158 of file colourTable.C.

References interpolationTypeNames, and os().

Referenced by Foam::operator<<().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ interpolationTypeNames

const Foam::Enum< Foam::colourTable::interpolationType > interpolationTypeNames
static

Enumeration names for interpolationType.

Definition at line 108 of file colourTable.H.

Referenced by colourTable(), and writeDict().

◆ predefinedNames

const Foam::Enum< Foam::colourTable::predefinedType > predefinedNames
static

Enumeration names for predefinedType.

Definition at line 113 of file colourTable.H.

Referenced by ptr(), and ref().


The documentation for this class was generated from the following files: