File operatorstencil.hxx#
Classes describing the geometry of stencils used for differentiation operators. These can be used to determine how much memory to preallocate when constructing a sparse matrix to represent the operator.
Copyright 2019 C. MacMackin
Contact: Ben Dudson, bd512@york.ac.uk
This file is part of BOUT++.
BOUT++ is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
BOUT++ is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with BOUT++. If not, see http://www.gnu.org/licenses/.
Typedefs
-
using OffsetInd3D = IndexOffset<Ind3D>#
-
using OffsetInd2D = IndexOffset<Ind2D>#
-
using OffsetIndPerp = IndexOffset<IndPerp>#
Functions
-
template<class T>
inline bool operator==(const IndexOffset<T> &lhs, const IndexOffset<T> &rhs)#
-
template<class T>
inline bool operator!=(const IndexOffset<T> &lhs, const IndexOffset<T> &rhs)#
-
template<class T>
inline bool operator<(const IndexOffset<T> &lhs, const IndexOffset<T> &rhs)#
-
template<class T>
inline const IndexOffset<T> operator+(IndexOffset<T> lhs, const IndexOffset<T> &rhs)#
-
template<class T>
inline const IndexOffset<T> operator-(IndexOffset<T> lhs, const IndexOffset<T> &rhs)#
-
template<class T>
inline const T operator+(const T &lhs, const IndexOffset<T> &rhs)#
-
template<class T>
inline const T operator+(const IndexOffset<T> &lhs, const T &rhs)#
-
template<class T>
inline const T operator-(const T &lhs, const IndexOffset<T> &rhs)#
-
template<class T>
OperatorStencil<T> squareStencil(Mesh *localmesh)# Utility function to create a square stencil Used in both LaplaceXY2 and LaplaceXY2Hypre
Returns a stencil object which indicates that non-boundary cells depend on all of their neighbours to a depth of one, including corners.
-
template<class T>
OperatorStencil<T> starStencil(Mesh *localmesh)# Returns a stencil object which indicates that non-boundary cells depend on all of their neighbours to a depth of one, excluding corners.
-
template<class T>
struct IndexOffset# - #include <operatorstencil.hxx>
A representation of offsets for indices, which can be added and subtracted from them.
Public Functions
-
inline const IndexOffset xp(int delta_x = 1) const#
-
inline const IndexOffset xm(int delta_x = 1) const#
-
inline const IndexOffset yp(int delta_y = 1) const#
-
inline const IndexOffset ym(int delta_y = 1) const#
-
inline const IndexOffset zp(int delta_z = 1) const#
-
inline const IndexOffset zm(int delta_z = 1) const#
-
inline IndexOffset &operator+=(const IndexOffset &n)#
-
inline IndexOffset &operator-=(const IndexOffset &n)#
-
inline const IndexOffset xp(int delta_x = 1) const#
-
template<class T>
class OperatorStencil# - #include <operatorstencil.hxx>
A class which can be used to represent the shape of a stencil used to perform some operation. A stencil is made up of pairs of stencil-parts and stencil-tests. A stencil-part is a vector of OffsetIndices. When added to another index, the result is part of the stencil. A stencil-test indicates whether a particular stencil-part should be applied at a given index.
When trying to get the stencil part for an index, this class will iterate through the part/test pairs in the order which they were added, returning the first stencil-part with a test that passes. If no stencil-part is found with a passing test, then an error is thrown.
Public Types
-
using offset = IndexOffset<T>#
Public Functions
-
inline OperatorStencil<T> &add(stencil_test test, stencil_part stencil)#
Add a stencil test/part pair Returns this to allow chaining, inline definitions
-
inline const stencil_part &getStencilPart(int i) const#
Get the ith stencil-part to have been added.
-
inline const stencil_part &getStencilPart(const T &i) const#
Get the stencil-part to be used on this index. The method will iterate through the part/test pairs in the order which they were added, returning the first stencil-part with a test that passes. If no stencil-part is found with a passing test, then an error is thrown.
-
inline int getStencilSize(int i) const#
Get the number of elements in the ith stencil-part.
-
inline int getStencilSize(const T &i) const#
Get the number of elements in the stencil part to be used at this index.
-
inline int getNumParts() const#
Get the number of stencil-parts to have been added.
-
inline const std::vector<T> getIndicesWithStencilIncluding(const T &i) const#
Returns a list of indices for which the stencils contain the argument
-
inline const_iterator begin() const#
-
inline const_iterator cbegin() const#
-
inline const_iterator end() const#
-
inline const_iterator cend() const#
-
inline reverse_iterator rbegin()#
-
inline const_reverse_iterator rbegin() const#
-
inline const_reverse_iterator crbegin() const#
-
inline reverse_iterator rend()#
-
inline const_reverse_iterator rend() const#
-
inline const_reverse_iterator crend() const#
Private Functions
-
struct Stencil#
-
using offset = IndexOffset<T>#