SPH
Public Types | Public Member Functions | List of all members
BoundaryColorizer Class Reference

Shows boundary of bodies in the simulation. More...

#include <Colorizer.h>

Inheritance diagram for BoundaryColorizer:
IColorizer Polymorphic

Public Types

enum class  Detection { NEIGBOUR_THRESHOLD , NORMAL_BASED }
 

Public Member Functions

 BoundaryColorizer (const Detection detection, const Float threshold=15._f)
 
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< ParticlegetParticle (const Size UNUSED(idx)) const override
 
virtual Optional< PalettegetPalette () const override
 Returns recommended palette for drawing this colorizer. More...
 
virtual void setPalette (const Palette &UNUSED(newPalette)) override
 
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...
 
virtual Optional< ParticlegetParticle (const Size idx) const =0
 Returns the original value of the displayed quantity. More...
 
virtual void setPalette (const Palette &newPalette)=0
 Modifies the palette used by ths colorizer. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Detailed Description

Shows boundary of bodies in the simulation.

Definition at line 809 of file Colorizer.h.

Member Enumeration Documentation

◆ Detection

Enumerator
NEIGBOUR_THRESHOLD 

Particles with fewer neighbours are considered boundary. Not suitable if number of neighbours is enforced by adapting smoothing length. Note that increasing the threshold adds more particles into the boundary.

NORMAL_BASED 

Boundary is determined by relative position vectors approximating surface normal. Has higher overhead, but does not depend sensitively on number of neighbours. Here, increasing the threshold leads to fewer boundary particles.

Definition at line 811 of file Colorizer.h.

Constructor & Destructor Documentation

◆ BoundaryColorizer()

BoundaryColorizer::BoundaryColorizer ( const Detection  detection,
const Float  threshold = 15._f 
)

Definition at line 113 of file Colorizer.cpp.

Member Function Documentation

◆ evalColor()

Rgba BoundaryColorizer::evalColor ( const Size  idx) const
overridevirtual

Returns the color of idx-th particle.

Implements IColorizer.

Definition at line 143 of file Colorizer.cpp.

◆ getPalette()

virtual Optional<Palette> BoundaryColorizer::getPalette ( ) const
inlineoverridevirtual

Returns recommended palette for drawing this colorizer.

In case there is no palette, returns NOTHING.

Implements IColorizer.

Definition at line 852 of file Colorizer.h.

◆ getParticle()

virtual Optional<Particle> BoundaryColorizer::getParticle ( const Size   UNUSEDidx) const
inlineoverridevirtual

Definition at line 847 of file Colorizer.h.

◆ hasData()

bool BoundaryColorizer::hasData ( const Storage storage) const
overridevirtual

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

Implements IColorizer.

Definition at line 122 of file Colorizer.cpp.

◆ initialize()

void BoundaryColorizer::initialize ( const Storage storage,
const RefEnum  ref 
)
overridevirtual

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.

Definition at line 130 of file Colorizer.cpp.

◆ isInitialized()

bool BoundaryColorizer::isInitialized ( ) const
overridevirtual

Checks if the colorizer has been initialized.

Implements IColorizer.

Definition at line 138 of file Colorizer.cpp.

◆ name()

virtual std::string BoundaryColorizer::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.

Definition at line 858 of file Colorizer.h.

◆ setPalette()

virtual void BoundaryColorizer::setPalette ( const Palette UNUSEDnewPalette)
inlineoverridevirtual

Definition at line 856 of file Colorizer.h.

Member Data Documentation

◆ threshold [1/2]

Float BoundaryColorizer::threshold

Definition at line 828 of file Colorizer.h.

◆ threshold [2/2]

Size BoundaryColorizer::threshold

Definition at line 833 of file Colorizer.h.

◆ values [1/2]

ArrayRef<const Vector> BoundaryColorizer::values

Definition at line 827 of file Colorizer.h.

◆ values [2/2]

ArrayRef<const Size> BoundaryColorizer::values

Definition at line 832 of file Colorizer.h.


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