Proto
|
A Linear Stencil Operation. More...
#include <Proto_Stencil.H>
Data Structures | |
struct | coeff_holder |
Public Member Functions | |
template<unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E> | |
void | apply (const BoxData< T, C, MEMTYPE, D, E > &a_src, BoxData< T, C, MEMTYPE, D, E > &a_dest, const Box &a_bx, bool a_initToZero=false, const T a_scale=1) const |
Apply Stencil Helper function. More... | |
Constructors | |
Stencil () | |
Default Constructor. | |
Stencil (Shift a_shift, T a_coef, Point a_destRefratio=Point::Ones(), Point a_destShift=Point::Zeros(), Point a_srcRefratio=Point::Ones()) | |
General Constructor. More... | |
Operators | |
Stencil< T > | operator* (const Stencil< T > &a_stencil) const |
Stencil Composition. More... | |
Stencil< T > | operator* (const T a_coef) const |
Scalar Multiplication. More... | |
void | operator*= (const Stencil< T > &a_stencil) |
In Place Stencil Composition. More... | |
void | operator*= (const T a_coef) |
In Place Scalar Multiplication. | |
Stencil< T > | operator+ (const Stencil< T > &a_stencil) const |
Stencil Addition. More... | |
Stencil< T > | operator- (const Stencil< T > &a_stencil) const |
Stencil Subtraction (Convenience) More... | |
void | operator+= (const Stencil< T > &a_stencil) |
In Place Stencil Addition. More... | |
void | operator-= (const Stencil< T > &a_stencil) |
In Place Stencil Subtraction. More... | |
Stencil Binding and Application | |
template<unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E> | |
LazyStencil< T, C, MEMTYPE, D, E > | operator() (const BoxData< T, C, MEMTYPE, D, E > &a_src, T a_scale=1) const |
Operate on BoxData. More... | |
template<unsigned int C, MemType MEMTYPE, unsigned char D, unsigned char E> | |
LazyStencil< T, C, MEMTYPE, D, E > | operator() (const BoxData< T, C, MEMTYPE, D, E > &a_src, Box a_box, T a_scale=1) const |
Operate on BoxData (Overload with Box Input) More... | |
Utility | |
void | invert (int a_dir) |
Invert Stencil. More... | |
void | transpose (unsigned char a, unsigned char b) |
Transpose Stencil. More... | |
Box | indexRange (Box a_domain) const |
Get Max Index Range. More... | |
Box | indexDomain (Box a_range) const |
Get Max Index Domain. More... | |
Box | range (Box a_domain) const |
Get Max Range Box. More... | |
Box | domain (Box a_range) const |
Get Min Domain Box. More... | |
T | diagonalValue () const |
Get Diagonal Value. More... | |
void | print () const |
Print. More... | |
Static Public Member Functions | |
Stencil Library | |
static Stencil< T > | Derivative (int a_n, int a_dir=0, int a_order=2) |
Stencil Library: Derivative. More... | |
static Stencil< T > | Laplacian () |
Stencil Library: Laplacian. More... | |
static Stencil< T > | LaplacianFace (int a_dir, int a_order=2) |
Stencil Library: Perpendicular Laplacian. More... | |
static Stencil< T > | CellToEdge (int a_dir, int a_order=4) |
Stencil Library: Cell to Edge Deconvolution. More... | |
static Stencil< T > | DiffCellToEdge (int a_dir, int a_order=4) |
Stencil Library: Cell to Edge Differentiation. More... | |
static Stencil< T > | EdgeToCell (int a_dir, int a_order=4) |
Stencil Library: Edge to Cell Convolution. More... | |
static Stencil< T > | CellToEdgeL (int a_dir, int a_order=5) |
Stencil Library: Downwind Cell to Edge Deconvolution. More... | |
static Stencil< T > | CellToEdgeH (int a_dir, int a_order=5) |
Stencil Library: Upwind Cell to Edge Deconvolution. More... | |
static Stencil< T > | AvgDown (int a_refRatio=2) |
Stencil Library: Simple Average. More... | |
static Stencil< T > | AvgDownEdge (int a_dir, int a_refRatio=2) |
Stencil Library: Simple Average over an Edge. More... | |
static Stencil< T > | FluxDivergence (int a_dir) |
Stencil Library: Flux Divergence. More... | |
Accessors and Queries | |
bool | operator== (Stencil< T > &a_stencil) const |
bool | operator!= (Stencil< T > &a_stencil) const |
Inquality Operator. More... | |
const std::vector< T > & | coefs () const |
Get Vector of Coefficients. More... | |
const T * | devCoefs () const |
Get Vector of Coefficients. More... | |
const Point * | devOffsets () const |
Get Vector of Offsets. More... | |
const std::vector< Point > & | offsets () const |
Get Vector of Offsets. More... | |
unsigned long long int | size () const |
Size. More... | |
Box | span () const |
Span. More... | |
Point | spanPoint () const |
Span. More... | |
Point | ghost () const |
Ghost. More... | |
Point & | srcRatio () |
Get Source Refinement Ratio. More... | |
const Point & | srcRatio () const |
Get Source Refinement Ratio (Const) | |
Point & | destRatio () |
Get Destination Refinement Ratio. More... | |
const Point & | destRatio () const |
Get Destination Refinement Ratio (Const) | |
Point & | destShift () |
Get Destination Shift. More... | |
const Point & | destShift () const |
Get Destination Shift (Const) | |
A Linear Stencil Operation.
Encapsulates a linear stencil operation where coefficients are of type T. Stencil objects are built and used in a way that conforms to their nature as operators. For illustrative usage examples, refer to the following code snippets:
Examples: Build a Stencil from Shifts and coefficients:
Apply a Stencil with no Source / Dest Refinement to a BoxData:
The above examples illustrate the usage of Stencil to do computations in which the source and destination arrays are at the same refinement. Stencil is also capable of "prolong" and "restrict" type operations in which the destination and source respectively are refined. This functionality is useful for operations such as averaging and interpolation, or for algorithms like Red-Black Gauss Seidel Iteration in which it is necessary to evaluate a Stencil on "every other cell".
To facilitate these more exotic operations, the Stencil API allows the user to designate a source and/or destination refinement ratio. If these values are different from (1,...,1), then input Box object will be interpreted as an "index range" instead of a physical Box domain. The following code snippets illustrate some examples of this functionality.
Examples: Non-Trivial Source Refinement Ratio
Non-Trivial Destination Refinement Ratio
In the case of non-trivial destination refinement, an array of refRatio^DIM Stencils is often needed to fully populate the output. Proto provides a convenience structure called InterpStencil which is designed to mitigate this form of pedantry. See the associated documentation for additional information and example usage.