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

Merge coordset points that are within a tolerance into the same point and provide information on how it was done. More...

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

Public Types

using value_type = typename CoordsetView::value_type
 

Public Member Functions

 MergeCoordsetPoints (const CoordsetView &coordsetView)
 Constructor. More...
 
void setAllocatorID (int allocator_id)
 Set the allocator id to use when allocating memory. More...
 
int getAllocatorID () const
 Get the allocator id to use when allocating memory. More...
 
bool execute (conduit::Node &n_coordset, const conduit::Node &n_options, axom::Array< axom::IndexType > &selectedIds, axom::Array< axom::IndexType > &old2new) const
 Merge the coordset points using a tolerance and pass out an array of the points that were selected from the original coordset since they can be used to slice nodal fields. More...
 
template<typename KeyType >
void createNames (axom::Array< KeyType > &coordNames, double tolerance) const
 Create names for the coordinates so we can merge them. More...
 
template<typename KeyType , typename Precision >
void createNamesInner (axom::Array< KeyType > &coordNames, double tolerance) const
 Create names for the coordinates so we can merge them. More...
 

Public Attributes

CoordsetView m_coordsetView
 
int m_allocator_id
 

Detailed Description

template<typename ExecSpace, typename CoordsetView>
class axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >

Merge coordset points that are within a tolerance into the same point and provide information on how it was done.

Template Parameters
ExecSpaceThe execution space where the algorithm runs.
CoordsetViewThe coordset view type.

Member Typedef Documentation

◆ value_type

template<typename ExecSpace , typename CoordsetView >
using axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::value_type = typename CoordsetView::value_type

Constructor & Destructor Documentation

◆ MergeCoordsetPoints()

template<typename ExecSpace , typename CoordsetView >
axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::MergeCoordsetPoints ( const CoordsetView &  coordsetView)
inline

Constructor.

Parameters
coordsetViewThe coordset view that wraps the coordset to be modified.

Member Function Documentation

◆ setAllocatorID()

template<typename ExecSpace , typename CoordsetView >
void axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::setAllocatorID ( int  allocator_id)
inline

Set the allocator id to use when allocating memory.

Parameters
allocator_idThe allocator id to use when allocating memory.

References axom::isValidAllocatorID(), axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::m_allocator_id, and SLIC_ERROR_IF.

◆ getAllocatorID()

template<typename ExecSpace , typename CoordsetView >
int axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::getAllocatorID ( ) const
inline

Get the allocator id to use when allocating memory.

Returns
The allocator id to use when allocating memory.

References axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::m_allocator_id.

◆ execute()

template<typename ExecSpace , typename CoordsetView >
bool axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::execute ( conduit::Node &  n_coordset,
const conduit::Node &  n_options,
axom::Array< axom::IndexType > &  selectedIds,
axom::Array< axom::IndexType > &  old2new 
) const
inline

Merge the coordset points using a tolerance and pass out an array of the points that were selected from the original coordset since they can be used to slice nodal fields.

Parameters
[in,out]n_coordsetThe Conduit node that contains the coordset. The coordset data will be replaced.
n_optionsA Conduit node that contains the supported options. At present, there is just a "tolerance" option that specifies how close points need to be in order to be matched.
[out]selectedIdsAn array containing the ids of the nodes that are selected from the old nodes.
[out]old2newAn array with nnodes elements that contains the new node id for each node in the old coordset. This can be useful in rewriting connectivity or fields.
Note
The algorithm eliminates a little precision on the input coordinates to make a hashed name for the point. Points that are close enough should have the same hashed name. The names are passed through a Unique filter to select a set of unique names. Multiple points could result in the same hash name so one of the points is selected as the new definition for the unique point (the selection arises from sorting the hash names). This means that among a bunch of points that are close enough to be grouped, one of them will be picked and it might not be the best one "esthetically". The points are output in sorted hash name order too, which is a bit random.
Returns
True if point merging happened; False if no point merging was needed.

References axom::utilities::abs(), AXOM_ANNOTATE_BEGIN, AXOM_ANNOTATE_END, AXOM_ANNOTATE_SCOPE, AXOM_LAMBDA, axom::utilities::binary_search(), axom::bump::Unique< ExecSpace, KeyType >::execute(), axom::bump::CoordsetSlicer< ExecSpace, CoordsetView >::execute(), axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::getAllocatorID(), axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::m_coordsetView, axom::bump::SliceData::m_indicesView, axom::bump::CoordsetSlicer< ExecSpace, CoordsetView >::setAllocatorID(), axom::Array< T, DIM, SPACE, StoragePolicy >::size(), SLIC_ASSERT, SLIC_ERROR, SLIC_INFO, and axom::Array< T, DIM, SPACE, StoragePolicy >::view().

◆ createNames()

template<typename ExecSpace , typename CoordsetView >
template<typename KeyType >
void axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::createNames ( axom::Array< KeyType > &  coordNames,
double  tolerance 
) const
inline

Create names for the coordinates so we can merge them.

Parameters
[out]coordNamesThe "names" of the coordinates that will be used when merging.
toleranceThe tolerance used to merge points.

◆ createNamesInner()

template<typename ExecSpace , typename CoordsetView >
template<typename KeyType , typename Precision >
void axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::createNamesInner ( axom::Array< KeyType > &  coordNames,
double  tolerance 
) const
inline

Create names for the coordinates so we can merge them.

Parameters
[out]coordNamesThe "names" of the coordinates that will be used when merging.
toleranceThe tolerance used to merge points.

References AXOM_ANNOTATE_SCOPE, AXOM_LAMBDA, axom::bump::detail::Rounder< value_type >::execute(), axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::getAllocatorID(), axom::utilities::hash_bytes(), axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::m_coordsetView, and axom::Array< T, DIM, SPACE, StoragePolicy >::view().

Member Data Documentation

◆ m_coordsetView

template<typename ExecSpace , typename CoordsetView >
CoordsetView axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::m_coordsetView

◆ m_allocator_id

template<typename ExecSpace , typename CoordsetView >
int axom::bump::MergeCoordsetPoints< ExecSpace, CoordsetView >::m_allocator_id

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