Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::mesh::NgpAccessorExpr

Expression-template layer for NGP field operations. More...

Entity expression factories

template<typename ExecSpace = stk::ngp::ExecSpace>
auto mundy::mesh::make_entity_expr (stk::mesh::BulkData &bulk_data, const stk::mesh::Selector &selector, const stk::mesh::EntityRank &rank, const ExecSpace &exec_space=ExecSpace())
 Create an entity expression for iterating over entities of a given rank in a selector.
template<typename PairView, typename FMIExtractor, typename ExecSpace = stk::ngp::ExecSpace>
auto mundy::mesh::make_pairwise_entity_expr (stk::mesh::BulkData &bulk_data, const stk::mesh::EntityRank &left_rank, const stk::mesh::EntityRank &right_rank, const PairView &pair_view, const FMIExtractor &fmi_extractor, const ExecSpace &exec_space=ExecSpace())
 Create a pairwise entity expression for iterating over entity pairs defined by a pair view.

Value expressions

template<typename Func, typename... Args>
auto mundy::mesh::apply_expr (Func func, const Args &... args)
 Build a read-only value expression by applying a function object to expression arguments.

Sink expressions

template<typename Arg>
auto mundy::mesh::read_only (const Arg &arg)
 Wrap an argument as read-only for use with sink_expr().
template<typename Arg>
auto mundy::mesh::read_write (const Arg &arg)
 Wrap an argument as read-write for use with sink_expr().
template<typename Arg>
auto mundy::mesh::overwrite_all (const Arg &arg)
 Wrap an argument as overwrite-all for use with sink_expr().
template<typename Func, typename... Args>
void mundy::mesh::sink_expr (Func func, const Args &... args)
 Apply a mutating function object to expression arguments, executing immediately. Builds the sink expression, drives it to completion, and returns void.
template<typename... Args>
auto mundy::mesh::atomic_add (const Args &... args)
 Atomically add rhs to each element of the target expression.
template<typename... Args>
auto mundy::mesh::atomic_sub (const Args &... args)
 Atomically subtract rhs from each element of the target expression.
template<typename... Args>
auto mundy::mesh::atomic_mul (const Args &... args)
 Atomically multiply each element of the target expression by rhs.
template<typename... Args>
auto mundy::mesh::atomic_div (const Args &... args)
 Atomically divide each element of the target expression by rhs.

RNG factory functions

template<typename SeedExpr, typename CounterExpr, typename RNGType = openrand::Philox, RNGType(*)(size_t, size_t) make_counter_based_rng = make_philox>
auto mundy::mesh::rng (const SeedExpr &seed_expr, const CounterExpr &counter_expr)
 Create a counter-based random number generator using the given seed and counter. At least one of seed or counter must be an expression for this code to compile.

Fused assignment

template<typename... TrgSrcExprPairs>
void mundy::mesh::fused_assign (const TrgSrcExprPairs &... exprs)
 Evaluate all RHS expressions before writing any LHS—simultaneous multi-target assignment in one kernel.

Reduction operations

template<typename Expr, typename ReductionOp>
void mundy::mesh::reduce_local (Expr &&expr, ReductionOp &reduction)
 Reduces value of a given expression over all entities in the driver on this process.
template<typename Scalar, typename Expr>
auto mundy::mesh::reduce_local_sum (Expr &&expr)
 Reduce sum (process local).
template<typename Scalar, typename Expr>
auto mundy::mesh::reduce_local_max (Expr &&expr)
 Reduce max (process local).
template<typename Scalar, typename Expr>
auto mundy::mesh::reduce_local_min (Expr &&expr)
 Reduce min (process local).
template<typename Scalar, typename Expr>
auto mundy::mesh::all_reduce_sum (Expr &&expr)
 Reduces sum (all processes).
template<typename Scalar, typename Expr>
auto mundy::mesh::all_reduce_max (Expr &&expr)
 Reduces max (all processes).
template<typename Scalar, typename Expr>
auto mundy::mesh::all_reduce_min (Expr &&expr)
 Reduces min (all processes).

Detailed Description

Accessor expressions let you write mesh-field arithmetic against plain math objects without manually managing field synchronization, kernel boundaries, or per-entity loops. Expressions are lazy—nothing runs until an accessor expression appears as an lvalue or is passed to a reduction.

See the MundyMesh Primer for a full walkthrough, examples, and the complete function reference.

Function Documentation

◆ make_entity_expr()

template<typename ExecSpace = stk::ngp::ExecSpace>
auto mundy::mesh::make_entity_expr ( stk::mesh::BulkData & bulk_data,
const stk::mesh::Selector & selector,
const stk::mesh::EntityRank & rank,
const ExecSpace & exec_space = ExecSpace() )

◆ make_pairwise_entity_expr()

template<typename PairView, typename FMIExtractor, typename ExecSpace = stk::ngp::ExecSpace>
auto mundy::mesh::make_pairwise_entity_expr ( stk::mesh::BulkData & bulk_data,
const stk::mesh::EntityRank & left_rank,
const stk::mesh::EntityRank & right_rank,
const PairView & pair_view,
const FMIExtractor & fmi_extractor,
const ExecSpace & exec_space = ExecSpace() )

◆ apply_expr()

template<typename Func, typename... Args>
auto mundy::mesh::apply_expr ( Func func,
const Args &... args )

◆ read_only()

template<typename Arg>
auto mundy::mesh::read_only ( const Arg & arg)

◆ read_write()

template<typename Arg>
auto mundy::mesh::read_write ( const Arg & arg)

◆ overwrite_all()

template<typename Arg>
auto mundy::mesh::overwrite_all ( const Arg & arg)

◆ sink_expr()

template<typename Func, typename... Args>
void mundy::mesh::sink_expr ( Func func,
const Args &... args )

◆ atomic_add()

template<typename... Args>
auto mundy::mesh::atomic_add ( const Args &... args)

◆ atomic_sub()

template<typename... Args>
auto mundy::mesh::atomic_sub ( const Args &... args)

◆ atomic_mul()

template<typename... Args>
auto mundy::mesh::atomic_mul ( const Args &... args)

◆ atomic_div()

template<typename... Args>
auto mundy::mesh::atomic_div ( const Args &... args)

◆ rng()

template<typename SeedExpr, typename CounterExpr, typename RNGType = openrand::Philox, RNGType(*)(size_t, size_t) make_counter_based_rng = make_philox>
auto mundy::mesh::rng ( const SeedExpr & seed_expr,
const CounterExpr & counter_expr )

◆ fused_assign()

template<typename... TrgSrcExprPairs>
void mundy::mesh::fused_assign ( const TrgSrcExprPairs &... exprs)

◆ reduce_local()

template<typename Expr, typename ReductionOp>
void mundy::mesh::reduce_local ( Expr && expr,
ReductionOp & reduction )

◆ reduce_local_sum()

template<typename Scalar, typename Expr>
auto mundy::mesh::reduce_local_sum ( Expr && expr)

◆ reduce_local_max()

template<typename Scalar, typename Expr>
auto mundy::mesh::reduce_local_max ( Expr && expr)

◆ reduce_local_min()

template<typename Scalar, typename Expr>
auto mundy::mesh::reduce_local_min ( Expr && expr)

◆ all_reduce_sum()

template<typename Scalar, typename Expr>
auto mundy::mesh::all_reduce_sum ( Expr && expr)

◆ all_reduce_max()

template<typename Scalar, typename Expr>
auto mundy::mesh::all_reduce_max ( Expr && expr)

◆ all_reduce_min()

template<typename Scalar, typename Expr>
auto mundy::mesh::all_reduce_min ( Expr && expr)