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

Metafunction for generating a discretization stencil with a memory pool (MP). More...

#include <stencil.hpp>

Inheritance diagram for bitpit::MPDiscreteStencil< weight_t, value_t >:
Inheritance graph
[legend]
Collaboration diagram for bitpit::MPDiscreteStencil< weight_t, value_t >:
Collaboration graph
[legend]

Public Types

typedef DiscreteStencilWeightPool< weight_t > weight_pool_type
 
- Public Types inherited from bitpit::DiscreteStencil< weight_t, value_t >
using value_type = value_t
 
using weight_manager_type = DiscreteStencilWeightManager<weight_t, value_t>
 
using weight_type = weight_t
 

Public Member Functions

 MPDiscreteStencil (const weight_t &zero=weight_t())
 
 MPDiscreteStencil (std::size_t nItems, const weight_t &zero=weight_t())
 
 MPDiscreteStencil (std::size_t size, const long *pattern, const weight_t &zero=weight_t())
 
 MPDiscreteStencil (std::size_t size, const long *pattern, const weight_t *weights, const weight_t &zero=weight_t())
 
void setWeightPool (weight_pool_type *pool)
 
- Public Member Functions inherited from bitpit::DiscreteStencil< weight_t, value_t >
 DiscreteStencil (const weight_t &zero=weight_t())
 
 DiscreteStencil (std::size_t nItems, const weight_t &zero=weight_t())
 
 DiscreteStencil (std::size_t size, const long *pattern, const weight_t &zero=weight_t())
 
 DiscreteStencil (std::size_t size, const long *pattern, const weight_t *weights, const weight_t &zero=weight_t())
 
void addComplementToZero (long id)
 
void appendItem (long id, const weight_t &weight)
 
void appendItem (long id, weight_t &&weight)
 
weight_t & at (long id)
 
const weight_t & at (long id) const
 
void clear (bool release=false)
 
void display (std::ostream &out, double factor=1.) const
 
size_t getBinarySize () const
 
weight_t & getConstant ()
 
const weight_t & getConstant () const
 
long & getPattern (std::size_t pos)
 
const long & getPattern (std::size_t pos) const
 
weight_t & getWeight (std::size_t pos)
 
const weight_t & getWeight (std::size_t pos) const
 
void initialize (const DiscreteStencil< weight_t, value_t > &other)
 
void initialize (std::size_t nItems, const weight_t &zero=weight_t())
 
void initialize (std::size_t size, const long *pattern, const weight_t &zero=weight_t())
 
void initialize (std::size_t size, const long *pattern, const weight_t *weights, const weight_t &zero=weight_t())
 
DiscreteStencil< weight_t, value_t > & operator*= (double factor)
 
DiscreteStencil< weight_t, value_t > & operator+= (const DiscreteStencil< weight_t, value_t > &other)
 
DiscreteStencil< weight_t, value_t > & operator-= (const DiscreteStencil< weight_t, value_t > &other)
 
DiscreteStencil< weight_t, value_t > & operator/= (double factor)
 
weight_t & operator[] (long id)
 
void optimize (double tolerance=1.e-12)
 
long * patternData ()
 
const long * patternData () const
 
template<typename Mapper >
void renumber (const Mapper &mapper)
 
void renumber (const std::unordered_map< long, long > &map)
 
void reserve (std::size_t nItems)
 
void resize (std::size_t nItems)
 
void setConstant (const weight_t &constant)
 
void setConstant (weight_t &&constant)
 
void setItem (std::size_t pos, long id, const weight_t &weight)
 
void setItem (std::size_t pos, long id, weight_t &&weight)
 
void setPattern (std::size_t pos, long id)
 
void setWeight (std::size_t pos, const weight_t &weight)
 
void setWeight (std::size_t pos, weight_t &&weight)
 
std::size_t size () const
 
void sum (const DiscreteStencil< weight_t, value_t > &other, double factor)
 
void sumConstant (const weight_t &constant, double factor=1.)
 
void sumItem (long id, const weight_t &weight, double factor=1.)
 
void sumWeight (std::size_t pos, const weight_t &weight, double factor=1.)
 
weight_t * weightData ()
 
const weight_t * weightData () const
 
void zero ()
 
void zeroConstant ()
 
void zeroWeight (std::size_t pos)
 

Protected Member Functions

void appendWeight (const weight_t &weight) override
 
void clearWeights (bool release) override
 
- Protected Member Functions inherited from bitpit::DiscreteStencil< weight_t, value_t >
virtual void appendWeight (weight_t &&weight)
 

Protected Attributes

weight_pool_typem_weightPool
 
- Protected Attributes inherited from bitpit::DiscreteStencil< weight_t, value_t >
weight_t m_constant
 
std::vector< long > m_pattern
 
std::vector< weight_t > m_weights
 
weight_t m_zero
 

Additional Inherited Members

- Static Public Member Functions inherited from bitpit::DiscreteStencil< weight_t, value_t >
static const weight_manager_typegetWeightManager ()
 
- Public Attributes inherited from bitpit::DiscreteStencil< weight_t, value_t >
long NULL_ID = - std::numeric_limits<long>::max()
 
- Static Protected Attributes inherited from bitpit::DiscreteStencil< weight_t, value_t >
static const weight_manager_type m_weightManager = typename DiscreteStencil<weight_t>::weight_manager_type()
 

Detailed Description

template<typename weight_t, typename value_t = typename DiscreteStencilWeightValueInfo<weight_t>::type>
class bitpit::MPDiscreteStencil< weight_t, value_t >

Metafunction for generating a discretization stencil with a memory pool (MP).

Template Parameters
weight_tis the type of the weights stored in the stencil

Definition at line 182 of file stencil.hpp.

Member Typedef Documentation

◆ weight_pool_type

template<typename weight_t , typename value_t = typename DiscreteStencilWeightValueInfo<weight_t>::type>
typedef DiscreteStencilWeightPool<weight_t> bitpit::MPDiscreteStencil< weight_t, value_t >::weight_pool_type

Definition at line 186 of file stencil.hpp.

Constructor & Destructor Documentation

◆ MPDiscreteStencil() [1/4]

template<typename weight_t , typename value_t >
bitpit::MPDiscreteStencil< weight_t, value_t >::MPDiscreteStencil ( const weight_t & zero = weight_t())

Constructor

Parameters
zerois the value to be used as zero

Definition at line 962 of file stencil.tpp.

◆ MPDiscreteStencil() [2/4]

template<typename weight_t , typename value_t >
bitpit::MPDiscreteStencil< weight_t, value_t >::MPDiscreteStencil ( std::size_t size,
const weight_t & zero = weight_t() )

Constructor

Parameters
sizeis the stencil size, expressed in number of elements
zerois the value to be used as zero

Definition at line 975 of file stencil.tpp.

◆ MPDiscreteStencil() [3/4]

template<typename weight_t , typename value_t >
bitpit::MPDiscreteStencil< weight_t, value_t >::MPDiscreteStencil ( std::size_t size,
const long * pattern,
const weight_t & zero = weight_t() )

Constructor

Parameters
sizeis the stencil size, expressed in number of elements
patternis the patterns of the stencil
zerois the value to be used as zero

Definition at line 989 of file stencil.tpp.

◆ MPDiscreteStencil() [4/4]

template<typename weight_t , typename value_t >
bitpit::MPDiscreteStencil< weight_t, value_t >::MPDiscreteStencil ( std::size_t size,
const long * pattern,
const weight_t * weights,
const weight_t & zero = weight_t() )

Constructor

Parameters
sizeis the stencil size, expressed in number of elements
patternis the patterns of the stencil
weightsare the weights of the stencil
zerois the value to be used as zero

Definition at line 1004 of file stencil.tpp.

Member Function Documentation

◆ appendWeight()

template<typename weight_t , typename value_t >
void bitpit::MPDiscreteStencil< weight_t, value_t >::appendWeight ( const weight_t & weight)
overrideprotectedvirtual

Append a weight to the stencil.

Parameters
weightis the weight that will be appended

Reimplemented from bitpit::DiscreteStencil< weight_t, value_t >.

Definition at line 1028 of file stencil.tpp.

◆ clearWeights()

template<typename weight_t , typename value_t >
void bitpit::MPDiscreteStencil< weight_t, value_t >::clearWeights ( bool release)
overrideprotectedvirtual

Clears the weights of the stencil.

Removes all weights from the stencil (which are destroyed), leaving the weight container with a size of 0.

Parameters
releaseif it's true the memory hold by the weight container will be released, otherwise the weight container will be cleared but its memory will not be relased

Reimplemented from bitpit::DiscreteStencil< weight_t, value_t >.

Definition at line 1049 of file stencil.tpp.

◆ setWeightPool()

template<typename weight_t , typename value_t = typename DiscreteStencilWeightValueInfo<weight_t>::type>
void bitpit::MPDiscreteStencil< weight_t, value_t >::setWeightPool ( weight_pool_type * pool)

Set the weight pool.

Parameters
poolis the weight pool that will be used

Definition at line 1017 of file stencil.tpp.

Member Data Documentation

◆ m_weightPool

template<typename weight_t , typename value_t = typename DiscreteStencilWeightValueInfo<weight_t>::type>
weight_pool_type* bitpit::MPDiscreteStencil< weight_t, value_t >::m_weightPool
protected

Definition at line 196 of file stencil.hpp.


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