SpatialOps
SpatialOps::SpatialMask< FieldType > Class Template Reference

Abstracts a mask. More...

#include <SpatialMask.h>

Public Member Functions

 SpatialMask (const MemoryWindow &window, const BoundaryCellInfo &bc, const GhostData &ghosts, const std::vector< IntVec > &points)
 Construct a SpatialMask. More...
 
 SpatialMask (const FieldType &prototype, const std::vector< IntVec > &points)
 Construct a SpatialMask. More...
 
 SpatialMask (const SpatialMask &other)
 Shallow copy constructor. This results in two fields that share the same underlying memory.
 
 SpatialMask (const MemoryWindow &window, const SpatialMask &other)
 Shallow copy constructor with new window.
 
const std::vector< IntVec > & points (void) const
 return reference to list of points in given list NOTE: Not supported for external field types
 
bool operator() (const size_t i, const size_t j, const size_t k) const
 Given an index in this mask, return whether or not index is a mask point. WARNING: slow! NOTE: Not supported for external field types.
 
bool operator() (const IntVec &ijk) const
 Given an index in this mask, return whether or not index is a mask point. WARNING: slow! NOTE: Not supported for external field types.
 
const_iterator begin () const
 Iterator constructs for traversing memory windows. Note: Iteration is not directly supported for external field types.
 
mask_type reshape (const IntVec &extentModify, const IntVec &shift) const
 Obtain a child field that is reshaped. More...
 

Detailed Description

template<typename FieldType>
class SpatialOps::SpatialMask< FieldType >

Abstracts a mask.

Use SpatialMask when using masks with Nebo.

SpatialMasks can be used in Nebo cond. See structured/test/testMask.cpp for examples.

Constructing a SpatialMask requires a prototype field and a list of (IntVec) points.

The valid ghost cells of the SpatialMask match its prototype field.

Points are indexed from the interior of the MemoryWindow (does not include ghost cells). Ghost cells on negative faces therefore have negative indices. Thus, if there is at least one valid ghost on every face, then the point (-1,-1,-1) is valid.

The points in the list become the mask points (return true). All valid points not in the list are not mask points (return false).

SpatialMask supports Nebo GPU execution. However, every SpatialMask currently must be constructed on the CPU and explicitly copied to the GPU with the add_consumer() method.

Template Parameters
FieldType- the underlying fieldtype of the mask
Related classes:

Definition at line 70 of file SpatialMask.h.

Constructor & Destructor Documentation

◆ SpatialMask() [1/2]

template<typename FieldType>
SpatialOps::SpatialMask< FieldType >::SpatialMask ( const MemoryWindow window,
const BoundaryCellInfo bc,
const GhostData ghosts,
const std::vector< IntVec > &  points 
)
inline

Construct a SpatialMask.

Parameters
windowthe MemoryWindow that specifies this field including ghost cells.
bcinformation on boundary treatment for this field
ghostsinformation on ghost cells for this field
pointspoints in the mask

Definition at line 101 of file SpatialMask.h.

Referenced by SpatialOps::SpatialMask< FieldType >::SpatialMask().

Here is the caller graph for this function:

◆ SpatialMask() [2/2]

template<typename FieldType>
SpatialOps::SpatialMask< FieldType >::SpatialMask ( const FieldType &  prototype,
const std::vector< IntVec > &  points 
)
inline

Construct a SpatialMask.

Parameters
prototypefield to copy size information from
pointspoints in the mask

Definition at line 121 of file SpatialMask.h.

Member Function Documentation

◆ reshape()

template<typename FieldType>
mask_type SpatialOps::SpatialMask< FieldType >::reshape ( const IntVec extentModify,
const IntVec shift 
) const
inline

Obtain a child field that is reshaped.

Parameters
extentModifythe amount to modify the extent of the current field by
shiftthe number of grid points to shift the current field by
Returns
the reshaped child field

The memory is the same as the parent field, but windowed differently. Note that a reshaped field is considered read-only and you cannot obtain interior iterators for these fields.

Definition at line 259 of file SpatialMask.h.


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