Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
bitpit::DiscreteStencilWeightManager< weight_t, value_t > Class Template Reference

#include <stencil_weight.hpp>

Public Types

using value_type = value_t
 
using weight_type = weight_t
 

Public Member Functions

template<typename W = weight_t, typename V , std::size_t D = std::tuple_size<W>::value, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * = nullptr>
value_t & at (const std::array< V, D > &weight, std::size_t index)
 
template<typename W = weight_t, typename V , std::size_t D = std::tuple_size<W>::value, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * = nullptr>
const value_t & at (const std::array< V, D > &weight, std::size_t index) const
 
template<typename W = weight_t, typename V , typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * = nullptr>
const value_t & at (const std::vector< V > &weight, int index) const
 
template<typename W = weight_t, typename V , typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * = nullptr>
value_t & at (const std::vector< V > &weight, std::size_t index)
 
template<typename W >
value_t & at (const W &weight, std::size_t index)
 
template<typename W >
const value_t & at (const W &weight, std::size_t index) const
 
template<typename W = weight_t, typename V = value_t, std::size_t D = std::tuple_size<W>::value, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * = nullptr>
void copy (const std::array< V, D > &weight, std::array< V, D > *target) const
 
template<typename W = weight_t, typename V = value_t, typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * = nullptr>
void copy (const std::vector< V > &weight, std::vector< V > *target) const
 
template<typename W >
void copy (const W &weight, W *target) const
 
template<typename W = weight_t, typename V = value_t, std::size_t D = std::tuple_size<W>::value, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * = nullptr>
bool isNegligible (const std::array< V, D > &weight, const weight_t &zero, double tolerance=1e-12) const
 
template<typename W = weight_t, typename V = value_t, typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * = nullptr>
bool isNegligible (const std::vector< V > &weight, const weight_t &zero, double tolerance=1e-12) const
 
template<typename W >
bool isNegligible (const W &weight, const weight_t &zero, double tolerance=1e-12) const
 
template<typename W >
void move (W &&weight, W *target) const
 
template<typename W = weight_t, typename V = value_t, std::size_t D = std::tuple_size<W>::value, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * = nullptr>
void sum (const std::array< V, D > &weight, double factor, std::array< V, D > *target) const
 
template<typename W = weight_t, typename V = value_t, typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * = nullptr>
void sum (const std::vector< V > &weight, double factor, std::vector< V > *target) const
 
template<typename W >
void sum (const W &weight, double factor, W *target) const
 

Detailed Description

template<typename weight_t, typename value_t>
class bitpit::DiscreteStencilWeightManager< weight_t, value_t >

Helper class to handle weights.

Definition at line 82 of file stencil_weight.hpp.

Member Typedef Documentation

◆ value_type

template<typename weight_t , typename value_t >
using bitpit::DiscreteStencilWeightManager< weight_t, value_t >::value_type = value_t

Definition at line 86 of file stencil_weight.hpp.

◆ weight_type

template<typename weight_t , typename value_t >
using bitpit::DiscreteStencilWeightManager< weight_t, value_t >::weight_type = weight_t

Definition at line 85 of file stencil_weight.hpp.

Member Function Documentation

◆ at() [1/6]

template<typename weight_t , typename value_t >
template<typename W , typename V , std::size_t D, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * >
value_t & bitpit::DiscreteStencilWeightManager< weight_t, value_t >::at ( const std::array< V, D > & weight,
std::size_t index )

Get the specified value.

Parameters
indexis the position of the requested value
Returns
A reference to the specified value.

Definition at line 369 of file stencil_weight.tpp.

◆ at() [2/6]

template<typename weight_t , typename value_t >
template<typename W , typename V , std::size_t D, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * >
const value_t & bitpit::DiscreteStencilWeightManager< weight_t, value_t >::at ( const std::array< V, D > & weight,
std::size_t index ) const

Get the specified value.

Parameters
indexis the position of the requested value
Returns
A reference to the specified value.

Definition at line 382 of file stencil_weight.tpp.

◆ at() [3/6]

template<typename weight_t , typename value_t >
template<typename W , typename V , typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * >
const value_t & bitpit::DiscreteStencilWeightManager< weight_t, value_t >::at ( const std::vector< V > & weight,
int index ) const

Get the specified value.

Parameters
indexis the position of the requested value
Returns
A reference to the specified value.

Definition at line 408 of file stencil_weight.tpp.

◆ at() [4/6]

template<typename weight_t , typename value_t >
template<typename W , typename V , typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * >
value_t & bitpit::DiscreteStencilWeightManager< weight_t, value_t >::at ( const std::vector< V > & weight,
std::size_t index )

Get the specified value.

Parameters
indexis the position of the requested value
Returns
A reference to the specified value.

Definition at line 395 of file stencil_weight.tpp.

◆ at() [5/6]

template<typename weight_t , typename value_t >
template<typename W >
value_t & bitpit::DiscreteStencilWeightManager< weight_t, value_t >::at ( const W & weight,
std::size_t index )

Get the specified value.

Parameters
indexis the position of the requested value
Returns
A reference to the specified value.

Definition at line 341 of file stencil_weight.tpp.

◆ at() [6/6]

template<typename weight_t , typename value_t >
template<typename W >
const value_t & bitpit::DiscreteStencilWeightManager< weight_t, value_t >::at ( const W & weight,
std::size_t index ) const

Get the specified value.

Parameters
indexis the position of the requested value
Returns
A reference to the specified value.

Definition at line 354 of file stencil_weight.tpp.

◆ copy() [1/3]

template<typename weight_t , typename value_t >
template<typename W , typename V , std::size_t D, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * >
void bitpit::DiscreteStencilWeightManager< weight_t, value_t >::copy ( const std::array< V, D > & weight,
std::array< V, D > * target ) const

Copy the specified weight into the target.

Parameters
weightis the weight that will be copied
[out]targeton output will contain a copy of the weight

Definition at line 290 of file stencil_weight.tpp.

◆ copy() [2/3]

template<typename weight_t , typename value_t >
template<typename W , typename V , typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * >
void bitpit::DiscreteStencilWeightManager< weight_t, value_t >::copy ( const std::vector< V > & weight,
std::vector< V > * target ) const

Copy the specified weight into the target.

The target will be resized to match the size of the specified weight.

Parameters
weightis the weight that will be copied
[out]targeton output will contain a copy of the weight

Definition at line 305 of file stencil_weight.tpp.

◆ copy() [3/3]

template<typename weight_t , typename value_t >
template<typename W >
void bitpit::DiscreteStencilWeightManager< weight_t, value_t >::copy ( const W & weight,
W * target ) const

Copy the specified weight into the target.

Parameters
weightis the weight that will be copied
[out]targeton output will contain a copy of the weight

Definition at line 277 of file stencil_weight.tpp.

◆ isNegligible() [1/3]

template<typename weight_t , typename value_t >
template<typename W , typename V , std::size_t D, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * >
bool bitpit::DiscreteStencilWeightManager< weight_t, value_t >::isNegligible ( const std::array< V, D > & weight,
const weight_t & zero,
double tolerance = 1e-12 ) const

Check if the specified weight is negligible.

Parameters
weightis the weight to be checked
zerois the weight to be used as zero
toleranceis the tolerance that will be used for the check
Returns
Returns true if the whole weight is negligible

Definition at line 166 of file stencil_weight.tpp.

◆ isNegligible() [2/3]

template<typename weight_t , typename value_t >
template<typename W , typename V , typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * >
bool bitpit::DiscreteStencilWeightManager< weight_t, value_t >::isNegligible ( const std::vector< V > & weight,
const weight_t & zero,
double tolerance = 1e-12 ) const

Check if the specified weight is negligible.

Parameters
weightis the weight to be checked
zerois the weight to be used as zero
toleranceis the tolerance that will be used for the check
Returns
Returns true if the whole weight is negligible

Definition at line 187 of file stencil_weight.tpp.

◆ isNegligible() [3/3]

template<typename weight_t , typename value_t >
template<typename W >
bool bitpit::DiscreteStencilWeightManager< weight_t, value_t >::isNegligible ( const W & weight,
const weight_t & zero,
double tolerance = 1e-12 ) const

Check if the specified weight is negligible.

Parameters
weightis the weight to be checked
zerois the weight to be used as zero
toleranceis the tolerance that will be used for the check
Returns
Returns true if the whole weight is negligible

Definition at line 151 of file stencil_weight.tpp.

◆ move()

template<typename weight_t , typename value_t >
template<typename W >
void bitpit::DiscreteStencilWeightManager< weight_t, value_t >::move ( W && weight,
W * target ) const

Move the specified weight into the target.

Parameters
weightis the weight that will be moved
[out]targeton output will contain the moved weight

Definition at line 328 of file stencil_weight.tpp.

◆ sum() [1/3]

template<typename weight_t , typename value_t >
template<typename W , typename V , std::size_t D, typename std::enable_if< std::is_same< std::array< V, D >, W >::value >::type * >
void bitpit::DiscreteStencilWeightManager< weight_t, value_t >::sum ( const std::array< V, D > & weight,
double factor,
std::array< V, D > * target ) const

Sum the specified weight to the target.

Parameters
weightis the weight that will be summed
factoris the factor the weight will be multiplied with
targeton output will contain the original target plus the weight multiplied by the specified factor

Definition at line 225 of file stencil_weight.tpp.

◆ sum() [2/3]

template<typename weight_t , typename value_t >
template<typename W , typename V , typename std::enable_if< std::is_same< std::vector< V >, W >::value >::type * >
void bitpit::DiscreteStencilWeightManager< weight_t, value_t >::sum ( const std::vector< V > & weight,
double factor,
std::vector< V > * target ) const

Sum the specified weight to the target.

The target will be resized to match the size of the weight to be summed. If the weight size is greater that the target size, missing target elements will be initialized to zero before summing the specified weight.

Parameters
weightis the weight that will be summed
factoris the factor the weight will be multiplied with
targeton output will contain the original target plus the weight multiplied by the specified factor

Definition at line 246 of file stencil_weight.tpp.

◆ sum() [3/3]

template<typename weight_t , typename value_t >
template<typename W >
void bitpit::DiscreteStencilWeightManager< weight_t, value_t >::sum ( const W & weight,
double factor,
W * target ) const

Sum the specified weight to the target.

Parameters
weightis the weight that will be summed
factoris the factor the weight will be multiplied with
targeton output will contain the original target plus the weight multiplied by the specified factor

Definition at line 210 of file stencil_weight.tpp.


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