20 #ifndef GEOS_FINITEVOLUME_STENCILBASE_HPP_
21 #define GEOS_FINITEVOLUME_STENCILBASE_HPP_
24 #include "codingUtilities/Utilities.hpp"
37 template<
template<
typename ... >
class CONTAINER,
59 static constexpr
localIndex maxNumPointsInFlux = MAX_NUM_POINTS_IN_FLUX;
62 static constexpr
localIndex maxStencilSize = MAX_STENCIL_SIZE;
65 static constexpr
localIndex maxNumConnections = MAX_NUM_CONNECTIONS;
79 template<
typename TRAITS >
92 typename TRAITS::IndexContainerType
const & elementSubRegionIndices,
93 typename TRAITS::IndexContainerType
const & elementIndices,
94 typename TRAITS::WeightContainerType
const & weights ):
105 typename TRAITS::IndexContainerViewConstType
112 typename TRAITS::IndexContainerViewConstType
119 typename TRAITS::IndexContainerViewConstType
126 typename TRAITS::WeightContainerViewConstType
150 template<
typename TRAITS,
typename LEAFCLASS >
174 virtual void move( LvArray::MemorySpace
const space );
187 localIndex const *
const elementRegionIndices,
188 localIndex const *
const elementSubRegionIndices,
190 real64 const *
const weights,
217 typename TRAITS::IndexContainerViewConstType
224 typename TRAITS::IndexContainerViewConstType
231 typename TRAITS::IndexContainerViewConstType
238 typename TRAITS::WeightContainerViewConstType
261 template<
typename LEAFCLASSTRAITS,
typename LEAFCLASS >
264 m_elementRegionIndices.reserve( size * 2 );
265 m_elementSubRegionIndices.reserve( size * 2 );
266 m_elementIndices.reserve( size * 2 );
267 m_weights.reserve( size * 2 );
271 template<
typename LEAFCLASSTRAITS,
typename LEAFCLASS >
275 executeOnMapValue( m_connectorIndices, connectorIndex, [&](
localIndex const connectionListIndex )
277 for(
localIndex i = 0; i < static_cast< LEAFCLASS * >(
this)->stencilSize( connectorIndex ); ++i )
279 m_weights[connectionListIndex][i] = 0;
284 template<
typename LEAFCLASSTRAITS,
typename LEAFCLASS >
287 m_elementRegionIndices.setName( name +
"/elementRegionIndices" );
288 m_elementSubRegionIndices.setName( name +
"/elementSubRegionIndices" );
289 m_elementIndices.setName( name +
"/elementIndices" );
290 m_weights.setName( name +
"/weights" );
293 template<
typename LEAFCLASSTRAITS,
typename LEAFCLASS >
296 m_elementRegionIndices.move( space,
true );
297 m_elementSubRegionIndices.move( space,
true );
298 m_elementIndices.move( space,
true );
299 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.
GEOS_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.