SPH
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
IMaterial Class Referenceabstract

Material settings and functions specific for one material. More...

#include <IMaterial.h>

Inheritance diagram for IMaterial:
Polymorphic EosMaterial NullMaterial SolidMaterial CustomMaterial

Public Member Functions

 IMaterial (const BodySettings &settings)
 
template<typename TValue >
INLINE IMaterialsetParam (const BodySettingsId paramIdx, TValue &&value)
 
template<typename TValue >
INLINE TValue getParam (const BodySettingsId paramIdx) const
 Returns a parameter associated with given particle. More...
 
INLINE const BodySettingsgetParams () const
 Returns settings containing material parameters. More...
 
void setRange (const QuantityId id, const Interval &range, const Float minimal)
 Sets the timestepping parameters of given quantity. More...
 
INLINE void setRange (const QuantityId id, const BodySettingsId rangeId, const BodySettingsId minimalId)
 Sets the timestepping parameters of given quantity. More...
 
INLINE Float minimal (const QuantityId id) const
 Returns the scale value of the quantity. More...
 
INLINE const Interval range (const QuantityId id) const
 Returns the range of allowed quantity values. More...
 
virtual void create (Storage &storage, const MaterialInitialContext &context)=0
 Create all quantities needed by the material. More...
 
virtual void initialize (IScheduler &scheduler, Storage &storage, const IndexSequence sequence)=0
 Initialize all quantities and material parameters. More...
 
virtual void finalize (IScheduler &scheduler, Storage &storage, const IndexSequence sequence)=0
 Finalizes the material for the time step. More...
 
- Public Member Functions inherited from Polymorphic
virtual ~Polymorphic ()
 

Protected Attributes

BodySettings params
 Per-material parameters. More...
 
FlatMap< QuantityId, Floatminimals
 Minimal values used in timestepping, do not affect values of quantities themselves. More...
 
FlatMap< QuantityId, Intervalranges
 Allowed range of quantities. More...
 

Static Protected Attributes

static const Interval DEFAULT_RANGE = Interval::unbounded()
 Default values. More...
 
static const Float DEFAULT_MINIMAL = 0._f
 

Detailed Description

Material settings and functions specific for one material.

Contains all parameters needed during runtime that can differ for individual materials.

Definition at line 110 of file IMaterial.h.

Constructor & Destructor Documentation

◆ IMaterial()

IMaterial::IMaterial ( const BodySettings settings)
inlineexplicit

Definition at line 126 of file IMaterial.h.

Member Function Documentation

◆ create()

virtual void IMaterial::create ( Storage storage,
const MaterialInitialContext context 
)
pure virtual

Create all quantities needed by the material.

Implemented in SolidMaterial, and EosMaterial.

◆ finalize()

virtual void IMaterial::finalize ( IScheduler scheduler,
Storage storage,
const IndexSequence  sequence 
)
pure virtual

Finalizes the material for the time step.

Called after derivatives are computed.

Parameters
schedulerScheduler potentially used for parallelization
storageStorage containing the particles and materials
sequenceIndex sequence of the particles with this material

Implemented in SolidMaterial.

◆ getParam()

template<typename TValue >
INLINE TValue IMaterial::getParam ( const BodySettingsId  paramIdx) const
inline

Returns a parameter associated with given particle.

Definition at line 137 of file IMaterial.h.

◆ getParams()

INLINE const BodySettings& IMaterial::getParams ( ) const
inline

Returns settings containing material parameters.

Definition at line 142 of file IMaterial.h.

◆ initialize()

virtual void IMaterial::initialize ( IScheduler scheduler,
Storage storage,
const IndexSequence  sequence 
)
pure virtual

Initialize all quantities and material parameters.

Called once every step before loop.

Parameters
schedulerScheduler potentially used for parallelization
storageStorage containing the particles and materials
sequenceIndex sequence of the particles with this material

Implemented in SolidMaterial, and EosMaterial.

◆ minimal()

INLINE Float IMaterial::minimal ( const QuantityId  id) const
inline

Returns the scale value of the quantity.

This value is used by timestepping algorithms to determine the time step. The value can be specified by setRange; if no value is specified, the fuction defaults to 0.

Definition at line 163 of file IMaterial.h.

◆ range()

INLINE const Interval IMaterial::range ( const QuantityId  id) const
inline

Returns the range of allowed quantity values.

This range is enforced by timestetting algorithms, i.e. quantities do not have to be clamped by the solver or elsewhere. The range can be specified by setRange; if no range is specified, the function defaults to unbounded interval.

Definition at line 172 of file IMaterial.h.

◆ setParam()

template<typename TValue >
INLINE IMaterial& IMaterial::setParam ( const BodySettingsId  paramIdx,
TValue &&  value 
)
inline

Definition at line 130 of file IMaterial.h.

◆ setRange() [1/2]

INLINE void IMaterial::setRange ( const QuantityId  id,
const BodySettingsId  rangeId,
const BodySettingsId  minimalId 
)
inline

Sets the timestepping parameters of given quantity.

Syntactic sugar, using BodySettingsIds to retrieve the values from body settings of the material.

Definition at line 155 of file IMaterial.h.

◆ setRange() [2/2]

void IMaterial::setRange ( const QuantityId  id,
const Interval range,
const Float  minimal 
)

Sets the timestepping parameters of given quantity.

Note that the function is not thread-safe and has to be synchronized when used in parallel context.

Definition at line 17 of file IMaterial.cpp.

Member Data Documentation

◆ DEFAULT_MINIMAL

const Float IMaterial::DEFAULT_MINIMAL = 0._f
staticprotected

Definition at line 123 of file IMaterial.h.

◆ DEFAULT_RANGE

NAMESPACE_SPH_BEGIN const Interval IMaterial::DEFAULT_RANGE = Interval::unbounded()
staticprotected

Default values.

Definition at line 122 of file IMaterial.h.

◆ minimals

FlatMap<QuantityId, Float> IMaterial::minimals
protected

Minimal values used in timestepping, do not affect values of quantities themselves.

Definition at line 116 of file IMaterial.h.

◆ params

BodySettings IMaterial::params
protected

Per-material parameters.

Definition at line 113 of file IMaterial.h.

◆ ranges

FlatMap<QuantityId, Interval> IMaterial::ranges
protected

Allowed range of quantities.

Definition at line 119 of file IMaterial.h.


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