Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::search::RebuildOnEntityChange< MemorySpace > Class Template Reference

Rebuilder that triggers when the target or source entity sequence changes. More...

#include <NeighborListRebuilder.hpp>

Public Types

Aliases
using memory_space = MemorySpace
using execution_space = typename MemorySpace::execution_space

Public Member Functions

Constructors
 RebuildOnEntityChange ()=default
Rebuild policy
void setup (const stk::mesh::BulkData &, const stk::mesh::Selector &, const stk::mesh::Selector &) noexcept
 No per-update setup needed; entities are enumerated on demand from each input's selector.
template<typename TargetInput, typename SourceInput>
bool needs_rebuild (const stk::mesh::BulkData &bulk, const TargetInput &targets, const SourceInput &sources)
 Return true if the entity sequence differs from the snapshot at the last build.
template<typename TargetInput, typename SourceInput>
void snapshot (const stk::mesh::BulkData &bulk, const TargetInput &targets, const SourceInput &sources)
 Snapshot the current entity sequences into device-resident storage.
Chaining
template<RebuilderType Next>
RebuilderChain< RebuildOnEntityChange, Next > rebuild_if (const Next &next) const
 Return a chain of this rebuilder OR-combined with next.
template<RebuilderType Next>
RebuilderChain< RebuildOnEntityChange, Next > operator| (const Next &next) const

Detailed Description

template<typename MemorySpace = stk::ngp::MemSpace>
class mundy::search::RebuildOnEntityChange< MemorySpace >

After each build, snapshot() records the ordered entity sequences for both inputs (and the mesh's synchronized_count() at that point). needs_rebuild() reports a rebuild when that sequence changes — a different count, a different entity at any position, or a changed ordering. When the mesh has not been modified since the snapshot (unchanged synchronized_count()), it short-circuits to false without enumerating or comparing; otherwise the element-wise compare runs on device.

This is stricter than a count-only check: an add-one / remove-one swap at constant count is detected because the entity at some index will differ. It is also stricter than an unordered set check: reordering the same entities triggers a rebuild because the ordinal-to-entity mapping embedded in the neighbor list has changed.

Member Typedef Documentation

◆ memory_space

template<typename MemorySpace = stk::ngp::MemSpace>
using mundy::search::RebuildOnEntityChange< MemorySpace >::memory_space = MemorySpace

◆ execution_space

template<typename MemorySpace = stk::ngp::MemSpace>
using mundy::search::RebuildOnEntityChange< MemorySpace >::execution_space = typename MemorySpace::execution_space

Constructor & Destructor Documentation

◆ RebuildOnEntityChange()

template<typename MemorySpace = stk::ngp::MemSpace>
mundy::search::RebuildOnEntityChange< MemorySpace >::RebuildOnEntityChange ( )
default

Member Function Documentation

◆ setup()

template<typename MemorySpace = stk::ngp::MemSpace>
void mundy::search::RebuildOnEntityChange< MemorySpace >::setup ( const stk::mesh::BulkData & ,
const stk::mesh::Selector & ,
const stk::mesh::Selector &  )
inlinenoexcept

◆ needs_rebuild()

template<typename MemorySpace = stk::ngp::MemSpace>
template<typename TargetInput, typename SourceInput>
bool mundy::search::RebuildOnEntityChange< MemorySpace >::needs_rebuild ( const stk::mesh::BulkData & bulk,
const TargetInput & targets,
const SourceInput & sources )
inline

On the first call (no snapshot yet), always returns true.

◆ snapshot()

template<typename MemorySpace = stk::ngp::MemSpace>
template<typename TargetInput, typename SourceInput>
void mundy::search::RebuildOnEntityChange< MemorySpace >::snapshot ( const stk::mesh::BulkData & bulk,
const TargetInput & targets,
const SourceInput & sources )
inline

◆ rebuild_if()

template<typename MemorySpace = stk::ngp::MemSpace>
template<RebuilderType Next>
RebuilderChain< RebuildOnEntityChange, Next > mundy::search::RebuildOnEntityChange< MemorySpace >::rebuild_if ( const Next & next) const
inline

◆ operator|()

template<typename MemorySpace = stk::ngp::MemSpace>
template<RebuilderType Next>
RebuilderChain< RebuildOnEntityChange, Next > mundy::search::RebuildOnEntityChange< MemorySpace >::operator| ( const Next & next) const
inline