SPH
Public Member Functions | Protected Attributes | List of all members
TypedColorizer< Type > Class Template Reference

Default colorizer simply converting quantity value to color using defined palette. More...

#include <Colorizer.h>

Inheritance diagram for TypedColorizer< Type >:
IColorizer Polymorphic

Public Member Functions

 TypedColorizer (const QuantityId id, Palette palette)
 
virtual bool hasData (const Storage &storage) const override
 Checks if the storage constains all data necessary to initialize the colorizer. More...
 
virtual void initialize (const Storage &storage, const RefEnum ref) override
 Initialize the colorizer before by getting necessary quantities from storage. More...
 
virtual bool isInitialized () const override
 Checks if the colorizer has been initialized. More...
 
virtual Rgba evalColor (const Size idx) const override
 Returns the color of idx-th particle. More...
 
virtual Optional< float > evalScalar (const Size idx) const override
 
virtual Optional< VectorevalVector (const Size idx) const override
 
virtual Optional< ParticlegetParticle (const Size idx) const override
 Returns the original value of the displayed quantity. More...
 
virtual Optional< PalettegetPalette () const override
 Returns recommended palette for drawing this colorizer. More...
 
virtual void setPalette (const Palette &newPalette) override
 Modifies the palette used by ths colorizer. More...
 
virtual std::string name () const override
 Returns the name of the colorizer. More...
 
- Public Member Functions inherited from IColorizer
virtual Optional< float > evalScalar (const Size UNUSED(idx)) const
 Returns the scalar representation of the colorized quantity for idx-th particle. More...
 
virtual Optional< VectorevalVector (const Size UNUSED(idx)) const
 Returns the vector representation of the colorized quantity for idx-th particle. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Protected Attributes

QuantityId id
 
Palette palette
 
ArrayRef< const Type > values
 

Detailed Description

template<typename Type>
class TypedColorizer< Type >

Default colorizer simply converting quantity value to color using defined palette.

Vector and tensor quantities are converted to floats using suitable norm.

Definition at line 169 of file Colorizer.h.

Constructor & Destructor Documentation

◆ TypedColorizer()

template<typename Type >
TypedColorizer< Type >::TypedColorizer ( const QuantityId  id,
Palette  palette 
)
inline

Definition at line 176 of file Colorizer.h.

Member Function Documentation

◆ evalColor()

template<typename Type >
virtual Rgba TypedColorizer< Type >::evalColor ( const Size  idx) const
inlineoverridevirtual

Returns the color of idx-th particle.

Implements IColorizer.

Reimplemented in GravityColorizer, RadiusColorizer, and YieldReductionColorizer.

Definition at line 192 of file Colorizer.h.

◆ evalScalar()

template<typename Type >
virtual Optional<float> TypedColorizer< Type >::evalScalar ( const Size  idx) const
inlineoverridevirtual

Reimplemented in TemperatureColorizer.

Definition at line 196 of file Colorizer.h.

◆ evalVector()

template<typename Type >
virtual Optional<Vector> TypedColorizer< Type >::evalVector ( const Size  idx) const
inlineoverridevirtual

Reimplemented in VelocityColorizer.

Definition at line 201 of file Colorizer.h.

◆ getPalette()

template<typename Type >
virtual Optional<Palette> TypedColorizer< Type >::getPalette ( ) const
inlineoverridevirtual

Returns recommended palette for drawing this colorizer.

In case there is no palette, returns NOTHING.

Implements IColorizer.

Reimplemented in TemperatureColorizer.

Definition at line 209 of file Colorizer.h.

◆ getParticle()

template<typename Type >
virtual Optional<Particle> TypedColorizer< Type >::getParticle ( const Size  idx) const
inlineoverridevirtual

Returns the original value of the displayed quantity.

If no such value exists, returns NOTHING.

Implements IColorizer.

Reimplemented in RadiusColorizer, TemperatureColorizer, AccelerationColorizer, and VelocityColorizer.

Definition at line 205 of file Colorizer.h.

◆ hasData()

template<typename Type >
virtual bool TypedColorizer< Type >::hasData ( const Storage storage) const
inlineoverridevirtual

Checks if the storage constains all data necessary to initialize the colorizer.

Implements IColorizer.

Reimplemented in TemperatureColorizer, AccelerationColorizer, and VelocityColorizer.

Definition at line 180 of file Colorizer.h.

◆ initialize()

template<typename Type >
virtual void TypedColorizer< Type >::initialize ( const Storage storage,
const RefEnum  ref 
)
inlineoverridevirtual

Initialize the colorizer before by getting necessary quantities from storage.

Can only be called if hasData returns true. Must be called before evalColor is called, every time step as ArrayViews taken from storage might be invalidated.

Parameters
storageParticle storage containing source data to be drawn.
refSpecifies how the object refereneces the data required for evaluation; either the buffers are copied and stored in the colorizer, or only references to the the storage are kept.

Implements IColorizer.

Reimplemented in RadiusColorizer, TemperatureColorizer, AccelerationColorizer, and VelocityColorizer.

Definition at line 184 of file Colorizer.h.

◆ isInitialized()

template<typename Type >
virtual bool TypedColorizer< Type >::isInitialized ( ) const
inlineoverridevirtual

Checks if the colorizer has been initialized.

Implements IColorizer.

Reimplemented in GravityColorizer.

Definition at line 188 of file Colorizer.h.

◆ name()

template<typename Type >
virtual std::string TypedColorizer< Type >::name ( ) const
inlineoverridevirtual

Returns the name of the colorizer.

This is used when showing the colorizer in the window and as filename suffix.

Implements IColorizer.

Reimplemented in GravityColorizer, RadiusColorizer, YieldReductionColorizer, TemperatureColorizer, AccelerationColorizer, and VelocityColorizer.

Definition at line 217 of file Colorizer.h.

◆ setPalette()

template<typename Type >
virtual void TypedColorizer< Type >::setPalette ( const Palette newPalette)
inlineoverridevirtual

Modifies the palette used by ths colorizer.

Implements IColorizer.

Reimplemented in TemperatureColorizer.

Definition at line 213 of file Colorizer.h.

Member Data Documentation

◆ id

template<typename Type >
QuantityId TypedColorizer< Type >::id
protected

Definition at line 171 of file Colorizer.h.

◆ palette

template<typename Type >
Palette TypedColorizer< Type >::palette
protected

Definition at line 172 of file Colorizer.h.

◆ values

template<typename Type >
ArrayRef<const Type> TypedColorizer< Type >::values
protected

Definition at line 173 of file Colorizer.h.


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