19 #ifndef GEOS_FINITEVOLUME_STENCILBASE_HPP_
20 #define GEOS_FINITEVOLUME_STENCILBASE_HPP_
23 #include "codingUtilities/Utilities.hpp"
36 template<
template<
typename ... >
class CONTAINER,
58 static constexpr
localIndex maxNumPointsInFlux = MAX_NUM_POINTS_IN_FLUX;
61 static constexpr
localIndex maxStencilSize = MAX_STENCIL_SIZE;
64 static constexpr
localIndex maxNumConnections = MAX_NUM_CONNECTIONS;
78 template<
typename TRAITS >
91 typename TRAITS::IndexContainerType
const & elementSubRegionIndices,
92 typename TRAITS::IndexContainerType
const & elementIndices,
93 typename TRAITS::WeightContainerType
const & weights ):
104 typename TRAITS::IndexContainerViewConstType
111 typename TRAITS::IndexContainerViewConstType
118 typename TRAITS::IndexContainerViewConstType
125 typename TRAITS::WeightContainerViewConstType
149 template<
typename TRAITS,
typename LEAFCLASS >
173 virtual void move( LvArray::MemorySpace
const space );
186 localIndex const *
const elementRegionIndices,
187 localIndex const *
const elementSubRegionIndices,
189 real64 const *
const weights,
216 typename TRAITS::IndexContainerViewConstType
223 typename TRAITS::IndexContainerViewConstType
230 typename TRAITS::IndexContainerViewConstType
237 typename TRAITS::WeightContainerViewConstType
260 template<
typename LEAFCLASSTRAITS,
typename LEAFCLASS >
263 m_elementRegionIndices.reserve( size * 2 );
264 m_elementSubRegionIndices.reserve( size * 2 );
265 m_elementIndices.reserve( size * 2 );
266 m_weights.reserve( size * 2 );
270 template<
typename LEAFCLASSTRAITS,
typename LEAFCLASS >
274 executeOnMapValue( m_connectorIndices, connectorIndex, [&](
localIndex const connectionListIndex )
276 for(
localIndex i = 0; i < static_cast< LEAFCLASS * >(
this)->stencilSize( connectorIndex ); ++i )
278 m_weights[connectionListIndex][i] = 0;
283 template<
typename LEAFCLASSTRAITS,
typename LEAFCLASS >
286 m_elementRegionIndices.setName( name +
"/elementRegionIndices" );
287 m_elementSubRegionIndices.setName( name +
"/elementSubRegionIndices" );
288 m_elementIndices.setName( name +
"/elementIndices" );
289 m_weights.setName( name +
"/weights" );
292 template<
typename LEAFCLASSTRAITS,
typename LEAFCLASS >
295 m_elementRegionIndices.move( space,
true );
296 m_elementSubRegionIndices.move( space,
true );
297 m_elementIndices.move( space,
true );
298 m_weights.move( space,
true );
Provides management of the interior stencil points when using Two-Point flux approximation.
TRAITS::IndexContainerViewConstType getElementSubRegionIndices() const
Const access to the element subregions indices.
TRAITS::IndexContainerType m_elementRegionIndices
The container for the element region indices for each point in each stencil.
virtual ~StencilBase()=default
Destructor.
TRAITS::IndexContainerType m_elementSubRegionIndices
The container for the element sub region indices for each point in each stencil.
TRAITS::WeightContainerType m_weights
The container for the weights for each point in each stencil.
TRAITS::IndexContainerViewConstType getElementIndices() const
Const access to the element indices.
virtual localIndex size() const =0
Give the number of stencil entries.
virtual void add(localIndex const numPts, localIndex const *const elementRegionIndices, localIndex const *const elementSubRegionIndices, localIndex const *const elementIndices, real64 const *const weights, localIndex const connectorIndex)=0
Add an entry to the stencil.
unordered_map< localIndex, localIndex > m_connectorIndices
The map that provides the stencil index given the index of the underlying connector object.
TRAITS::WeightContainerViewConstType getWeights() const
Const access to the stencil weights.
void setName(string const &name)
Set the name used in data movement logging callbacks.
TRAITS::IndexContainerViewConstType getElementRegionIndices() const
Const access to the element regions indices.
virtual bool zero(localIndex const connectorIndex)
Zero weights for a stencil entry.
TRAITS::IndexContainerType m_elementIndices
The container for the element indices for each point in each stencil.
virtual void move(LvArray::MemorySpace const space)
Move the data arrays associated with the stencil to a specified memory space.
virtual void reserve(localIndex const size)
Reserve the size of the stencil.
TRAITS::IndexContainerViewConstType getElementIndices() const
Const access to the element indices.
TRAITS::IndexContainerViewConstType m_elementRegionIndices
The container for the element region indices for each point in each stencil.
TRAITS::WeightContainerViewConstType getWeights() const
Const access to the stencil weights.
TRAITS::IndexContainerViewConstType getElementSubRegionIndices() const
Const access to the element subregions indices.
StencilWrapperBase(typename TRAITS::IndexContainerType const &elementRegionIndices, typename TRAITS::IndexContainerType const &elementSubRegionIndices, typename TRAITS::IndexContainerType const &elementIndices, typename TRAITS::WeightContainerType const &weights)
Constructor.
TRAITS::IndexContainerViewConstType getElementRegionIndices() const
Const access to the element regions indices.
TRAITS::IndexContainerViewConstType m_elementSubRegionIndices
The container for the element sub region indices for each point in each stencil.
TRAITS::WeightContainerViewType m_weights
The container for the weights for each point in each stencil.
TRAITS::IndexContainerViewConstType m_elementIndices
The container for the element indices for each point in each stencil.
Base template for ordered and unordered maps.
double real64
64-bit floating point type.
GEOSX_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
A collection of properties of a stencil type.
LvArray::typeManipulation::NestedViewType< WeightContainerType > WeightContainerViewType
The array view to type for the stencil weights.
CONTAINER< localIndex > IndexContainerType
The array type that will be used to store the indices of the stencil contributors.
LvArray::typeManipulation::NestedViewTypeConst< IndexContainerType > IndexContainerViewConstType
The array view to const type for the stencil indices.
CONTAINER< real64 > WeightContainerType
The array type that is used to store the weights of the stencil contributors.
LvArray::typeManipulation::NestedViewTypeConst< WeightContainerType > WeightContainerViewConstType
The array view to const type for the stencil weights.