AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::bump::SelectedZones< ExecSpace > Class Template Reference

This class creates a view containing sorted selected zones, given an optional list of selected zones. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/main/src/axom/bump/SelectedZones.hpp>

Public Member Functions

 SelectedZones (axom::IndexType nzones, const conduit::Node &n_options, const std::string &selection_key=std::string("selectedZones"), int allocator_id=axom::execution_space< ExecSpace >::allocatorID())
 Constructor. More...
 
void setSorted (bool sorted)
 Set whether we need to sort the selected zone ids. More...
 
const axom::ArrayView< axom::IndexTypeview () const
 Return a view that contains the list of selected zone ids for the mesh. More...
 
const std::string & selectionKey () const
 Return the selection key for the options. More...
 

Protected Member Functions

void buildSelectedZones (axom::IndexType nzones, const conduit::Node &n_options)
 The options may contain a "selectedZones" (or other provided name) member that is a list of zones on which to operate. If such an array is present, copy and sort it. If the zone list is not present, make an array that selects every zone. More...
 
template<typename ZonesViewType >
int buildSelectedZones (ZonesViewType zones_view, axom::IndexType nzones)
 Help build the selected zones, converting them to axom::IndexType and sorting them. More...
 

Protected Attributes

std::string m_selectionKey
 
axom::Array< axom::IndexTypem_selectedZones
 
axom::ArrayView< axom::IndexTypem_selectedZonesView
 
bool m_sorted
 
int m_allocator_id
 

Detailed Description

template<typename ExecSpace>
class axom::bump::SelectedZones< ExecSpace >

This class creates a view containing sorted selected zones, given an optional list of selected zones.

Template Parameters
ExecSpaceThe execution space where the algorithm will run.

Constructor & Destructor Documentation

◆ SelectedZones()

template<typename ExecSpace >
axom::bump::SelectedZones< ExecSpace >::SelectedZones ( axom::IndexType  nzones,
const conduit::Node &  n_options,
const std::string &  selection_key = std::string("selectedZones"),
int  allocator_id = axom::execution_space<ExecSpace>::allocatorID() 
)
inline

Constructor.

Parameters
nzonesThe total number of zones in the associated topology.
n_optionsThe node that contains the options.
selection_keyThe name of the node with the selection data in the options.

The n_options node contains options that influence how the class runs. The options can contain a "selectedZones" node that contains an array of zone ids that will be processed. The array should exist in the memory space that is appropriate for the execution space. If this node is not present then all zones will be selected.

selectedZones: [0,1,2,3...]

References axom::bump::SelectedZones< ExecSpace >::buildSelectedZones().

Member Function Documentation

◆ setSorted()

template<typename ExecSpace >
void axom::bump::SelectedZones< ExecSpace >::setSorted ( bool  sorted)
inline

Set whether we need to sort the selected zone ids.

Parameters
sortedWhether the ids need to be sorted.

References axom::bump::SelectedZones< ExecSpace >::m_sorted.

◆ view()

template<typename ExecSpace >
const axom::ArrayView<axom::IndexType> axom::bump::SelectedZones< ExecSpace >::view ( ) const
inline

Return a view that contains the list of selected zone ids for the mesh.

Returns
A view that contains the list of selected zone ids for the mesh.
Note
Return a copy of the view.

References axom::bump::SelectedZones< ExecSpace >::m_selectedZonesView.

◆ selectionKey()

template<typename ExecSpace >
const std::string& axom::bump::SelectedZones< ExecSpace >::selectionKey ( ) const
inline

Return the selection key for the options.

Returns
The name of the key in the options that this class looks for.

References axom::bump::SelectedZones< ExecSpace >::m_selectionKey.

◆ buildSelectedZones() [1/2]

template<typename ExecSpace >
void axom::bump::SelectedZones< ExecSpace >::buildSelectedZones ( axom::IndexType  nzones,
const conduit::Node &  n_options 
)
inlineprotected

The options may contain a "selectedZones" (or other provided name) member that is a list of zones on which to operate. If such an array is present, copy and sort it. If the zone list is not present, make an array that selects every zone.

Parameters
nzonesThe total number of zones that are possible.
n_optionsA Conduit node that contains the selection.
Note
selectedZones should contain local zone numbers, which in the case of strided-structured indexing are the [0..n) zone numbers that exist only within the selected window.

References AXOM_LAMBDA, axom::bump::SelectedZones< ExecSpace >::m_allocator_id, axom::bump::SelectedZones< ExecSpace >::m_selectedZones, axom::bump::SelectedZones< ExecSpace >::m_selectedZonesView, axom::bump::SelectedZones< ExecSpace >::m_selectionKey, SLIC_ASSERT, SLIC_ERROR, and axom::Array< T, DIM, SPACE, StoragePolicy >::view().

◆ buildSelectedZones() [2/2]

template<typename ExecSpace >
template<typename ZonesViewType >
int axom::bump::SelectedZones< ExecSpace >::buildSelectedZones ( ZonesViewType  zones_view,
axom::IndexType  nzones 
)
inlineprotected

Help build the selected zones, converting them to axom::IndexType and sorting them.

Parameters
zones_viewThe view that contains the source zone ids.
nzonesThe number of zones in the mesh.
Returns
The number of invalid zone ids.
Note
This method was broken out into a template member method since nvcc would not instantiate the lambda for axom::for_all() from an anonymous lambda.

References AXOM_LAMBDA, axom::bump::SelectedZones< ExecSpace >::m_allocator_id, axom::bump::SelectedZones< ExecSpace >::m_selectedZones, axom::bump::SelectedZones< ExecSpace >::m_selectedZonesView, axom::bump::SelectedZones< ExecSpace >::m_sorted, and axom::Array< T, DIM, SPACE, StoragePolicy >::view().

Member Data Documentation

◆ m_selectionKey

template<typename ExecSpace >
std::string axom::bump::SelectedZones< ExecSpace >::m_selectionKey
protected

◆ m_selectedZones

template<typename ExecSpace >
axom::Array<axom::IndexType> axom::bump::SelectedZones< ExecSpace >::m_selectedZones
protected

◆ m_selectedZonesView

template<typename ExecSpace >
axom::ArrayView<axom::IndexType> axom::bump::SelectedZones< ExecSpace >::m_selectedZonesView
protected

◆ m_sorted

template<typename ExecSpace >
bool axom::bump::SelectedZones< ExecSpace >::m_sorted
protected

◆ m_allocator_id

template<typename ExecSpace >
int axom::bump::SelectedZones< ExecSpace >::m_allocator_id
protected

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