PLaSK library
Loading...
Searching...
No Matches
plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType > Struct Template Reference

Template for implementation of field provider class which holds vector of values and mesh inside. More...

#include <plask/provider/providerfor.hpp>

Inheritance diagram for plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >:
[legend]
Collaboration diagram for plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >:
[legend]

Public Types

typedef shared_ptr< MeshType > MeshPointerType
 Type of mesh pointer.
 
typedef ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::ProvidedType ProvidedType
 Type of provided value.
 
typedef DataVector< const ValueTypeHeldType
 Type that is used to store value.
 
- Public Types inherited from plask::ProviderFor< PropertyT, SpaceT >
typedef PropertyT PropertyTag
 
typedef SpaceT SpaceType
 

Public Member Functions

auto getMesh () -> decltype(*mesh_ptr)
 Get mesh.
 
auto getMesh () const -> decltype(*mesh_ptr)
 Get mesh (const).
 
void setMesh (MeshPointerType mesh_p)
 Set a new Mesh.
 
void invalidate ()
 Reset values to uninitialized state (nullptr data).
 
void allocate (size_t num)
 Reserve memory for n values using mesh size.
 
void push_back (const HeldType &value)
 Add new value.
 
size_t size () const override
 Get number of values.
 
bool hasCorrectValue (size_t n) const
 Check if this has values of the right size.
 
bool hasCorrectValues () const
 Check if this has values of the right size.
 
void ensureHasCorrectValue (size_t n) const
 Throw NoValue exception if value is not initialized and BadMesh exception if the mesh and values sizes mismatch.
 
void ensureHasCorrectValues () const
 Throw NoValue exception if value is not initialized and BadMesh exception if the mesh and values sizes mismatch.
 
void onMeshChange (const Mesh::Event &PLASK_UNUSED(evt))
 This method is called when mesh was changed.
 
 WithValue (HeldType values, MeshPointerType mesh_ptr=nullptr, InterpolationMethod default_interpolation=INTERPOLATION_LINEAR)
 
 WithValue (const std::initializer_list< HeldType > &values, MeshPointerType mesh_ptr=nullptr, InterpolationMethod default_interpolation=INTERPOLATION_LINEAR)
 
template<typename Iterator >
 WithValue (const Iterator &begin, const Iterator &end, MeshPointerType mesh_ptr=nullptr, InterpolationMethod default_interpolation=INTERPOLATION_LINEAR)
 
 WithValue (MeshPointerType mesh_ptr=nullptr, const InterpolationMethod &default_interpolation=INTERPOLATION_LINEAR)
 
 ~WithValue ()
 
HeldTypeoperator() (size_t n)
 Get provided value in points described by this->mesh.
 
const HeldTypeoperator() (size_t n) const
 Get provided value in points described by this->mesh.
 
ProvidedType operator() (EnumType num, shared_ptr< const MeshD< SpaceT::DIM > > dst_mesh, _ExtraParams..., InterpolationMethod method=INTERPOLATION_DEFAULT) const override
 Calculate interpolated values using plask::interpolate.
 
- Public Member Functions inherited from plask::ProviderFor< PropertyT, SpaceT >
 ProviderFor (Args &&... params)
 Delegate all constructors to parent class.
 

Public Attributes

std::vector< HeldTypevalues
 Provided values. Values in points described by this->mesh.
 

Protected Attributes

MeshPointerType mesh_ptr
 Mesh which describes in which points there are this->values.
 
InterpolationMethod default_interpolation
 Default interpolation method.
 

Detailed Description

template<typename PropertyT, typename SpaceT, typename... _ExtraParams>
template<typename MeshType>
struct plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >

Template for implementation of field provider class which holds vector of values and mesh inside.

operator() call plask::interpolate.

Template Parameters
MeshPtrTypetype of pointer (shared_ptr or unique_ptr) to mesh which is used for calculation and which describe places of data points

Definition at line 1287 of file providerfor.hpp.

Member Typedef Documentation

◆ HeldType

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
typedef DataVector<const ValueType> plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::HeldType

Type that is used to store value.

Definition at line 1296 of file providerfor.hpp.

◆ MeshPointerType

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
typedef shared_ptr<MeshType> plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::MeshPointerType

Type of mesh pointer.

Definition at line 1290 of file providerfor.hpp.

◆ ProvidedType

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
typedef ProviderImpl<PropertyT,MULTI_FIELD_PROPERTY,SpaceT,VariadicTemplateTypesHolder<_ExtraParams...>>::ProvidedType plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::ProvidedType

Type of provided value.

Definition at line 1293 of file providerfor.hpp.

Constructor & Destructor Documentation

◆ WithValue() [1/4]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::WithValue ( HeldType  values,
MeshPointerType  mesh_ptr = nullptr,
InterpolationMethod  default_interpolation = INTERPOLATION_LINEAR 
)
inlineexplicit
Parameters
valuessingle (first) provided value
mesh_ptrpointer to mesh which describes in which points there are this->values
default_interpolationdefault interpolation method for this provider

Definition at line 1413 of file providerfor.hpp.

◆ WithValue() [2/4]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::WithValue ( const std::initializer_list< HeldType > &  values,
MeshPointerType  mesh_ptr = nullptr,
InterpolationMethod  default_interpolation = INTERPOLATION_LINEAR 
)
inlineexplicit
Parameters
valuesprovided values list
mesh_ptrpointer to mesh which describes in which points there are this->values
default_interpolationdefault interpolation method for this provider

Definition at line 1423 of file providerfor.hpp.

◆ WithValue() [3/4]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
template<typename Iterator >
plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::WithValue ( const Iterator &  begin,
const Iterator &  end,
MeshPointerType  mesh_ptr = nullptr,
InterpolationMethod  default_interpolation = INTERPOLATION_LINEAR 
)
inlineexplicit
Parameters
begin,enditerators to range to construct values from
mesh_ptrpointer to mesh which describes in which points there are this->values
default_interpolationdefault interpolation method for this provider

Definition at line 1434 of file providerfor.hpp.

◆ WithValue() [4/4]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::WithValue ( MeshPointerType  mesh_ptr = nullptr,
const InterpolationMethod default_interpolation = INTERPOLATION_LINEAR 
)
inlineexplicit
Parameters
mesh_ptrpointer to mesh which describes in which points there are this->values
default_interpolationtype of interpolation to use as default

Definition at line 1443 of file providerfor.hpp.

◆ ~WithValue()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::~WithValue ( )
inline

Definition at line 1448 of file providerfor.hpp.

Member Function Documentation

◆ allocate()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
void plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::allocate ( size_t  num)
inline

Reserve memory for n values using mesh size.

Parameters
numnumber of values

Definition at line 1339 of file providerfor.hpp.

◆ ensureHasCorrectValue()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
void plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::ensureHasCorrectValue ( size_t  n) const
inline

Throw NoValue exception if value is not initialized and BadMesh exception if the mesh and values sizes mismatch.

Parameters
nvalue index

Definition at line 1384 of file providerfor.hpp.

◆ ensureHasCorrectValues()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
void plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::ensureHasCorrectValues ( ) const
inline

Throw NoValue exception if value is not initialized and BadMesh exception if the mesh and values sizes mismatch.

Definition at line 1391 of file providerfor.hpp.

◆ getMesh() [1/2]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
auto plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::getMesh ( ) -> decltype(*mesh_ptr)
inline

Get mesh.

Returns
*mesh_ptr

Definition at line 1315 of file providerfor.hpp.

◆ getMesh() [2/2]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
auto plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::getMesh ( ) const -> decltype(*mesh_ptr)
inline

Get mesh (const).

Returns
*mesh_ptr

Definition at line 1321 of file providerfor.hpp.

◆ hasCorrectValue()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
bool plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::hasCorrectValue ( size_t  n) const
inline

Check if this has values of the right size.

Parameters
nvalue index
Returns
true only if this is initialized (has value)

Definition at line 1365 of file providerfor.hpp.

◆ hasCorrectValues()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
bool plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::hasCorrectValues ( ) const
inline

Check if this has values of the right size.

Returns
true only if this is initialized (has value)

Definition at line 1373 of file providerfor.hpp.

◆ invalidate()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
void plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::invalidate ( )
inline

Reset values to uninitialized state (nullptr data).

Definition at line 1334 of file providerfor.hpp.

◆ onMeshChange()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
void plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::onMeshChange ( const Mesh::Event PLASK_UNUSEDevt)
inline

This method is called when mesh was changed.

It's just call invalidate()

Parameters
evtinformation about mesh changes

Definition at line 1403 of file providerfor.hpp.

◆ operator()() [1/3]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
ProvidedType plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::operator() ( EnumType  num,
shared_ptr< const MeshD< SpaceT::DIM > >  dst_mesh,
_ExtraParams...  ,
InterpolationMethod  method = INTERPOLATION_DEFAULT 
) const
inlineoverride

Calculate interpolated values using plask::interpolate.

Parameters
numvalue index
dst_meshset of requested points
methodmethod which should be use to do interpolation
Returns
values in points described by mesh dst_mesh

Definition at line 1479 of file providerfor.hpp.

◆ operator()() [2/3]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
HeldType & plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::operator() ( size_t  n)
inline

Get provided value in points described by this->mesh.

Parameters
nvalue index
Returns
provided value in points described by this->mesh

Definition at line 1457 of file providerfor.hpp.

◆ operator()() [3/3]

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
const HeldType & plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::operator() ( size_t  n) const
inline

Get provided value in points described by this->mesh.

Parameters
nvalue index
Returns
provided value in points described by this->mesh

Definition at line 1467 of file providerfor.hpp.

◆ push_back()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
void plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::push_back ( const HeldType value)
inline

Add new value.

Parameters
valnew value

Definition at line 1348 of file providerfor.hpp.

◆ setMesh()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
void plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::setMesh ( MeshPointerType  mesh_p)
inline

Set a new Mesh.

Parameters
mesh_ppointer to the new mesh

Definition at line 1327 of file providerfor.hpp.

◆ size()

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
size_t plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::size ( ) const
inlineoverride

Get number of values.

Returns
number of values

Definition at line 1356 of file providerfor.hpp.

Member Data Documentation

◆ default_interpolation

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
InterpolationMethod plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::default_interpolation
protected

Default interpolation method.

Definition at line 1307 of file providerfor.hpp.

◆ mesh_ptr

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
MeshPointerType plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::mesh_ptr
protected

Mesh which describes in which points there are this->values.

Definition at line 1304 of file providerfor.hpp.

◆ values

template<typename PropertyT , typename SpaceT , typename... _ExtraParams>
template<typename MeshType >
std::vector<HeldType> plask::ProviderImpl< PropertyT, MULTI_FIELD_PROPERTY, SpaceT, VariadicTemplateTypesHolder< _ExtraParams... > >::WithValue< MeshType >::values

Provided values. Values in points described by this->mesh.

Definition at line 1299 of file providerfor.hpp.


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