Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

Stencil Class Reference

base class for finite difference stencils. More...

#include <Stencil.h>

Inheritance diagram for Stencil::

HandleId StencilUnion List of all members.

Public Methods

 Stencil ()
 Stencil (int nsd, int maxoffset)
 Stencil (const Stencil &p)
 ~Stencil ()
bool redim (int nsd, int maxoffset)
int getNoSpaceDim () const
virtual int size ()
virtual int maxoff () const
Stencil& operator= (const Stencil &p)
virtual void fill (NUMT val)
virtual void fill (StencilWeightFunc &)
virtual void fillAll (NUMT val)
virtual void fillAll (StencilWeightFunc &)
StencilWeightoperator() (int r)
StencilWeightoperator() (int r, int s)
StencilWeightoperator() (int r, int s, int t)
StencilWeightoperator() (const Ptv(int) &i)
const StencilWeightoperator() (int r) const
const StencilWeightoperator() (int r, int s) const
const StencilWeightoperator() (int r, int s, int t) const
const StencilWeightoperator() (const Ptv(int) &i) const
void startIterator (const StencilWeight &allocation)
void stopIterator ()
virtual bool iterate ()
bool isIterating ()
virtual void setNodeDof (int d)
virtual void setDefaultNodeDof (int d)
virtual int getNodeDof () const
void attach (const FieldLattice &f)
virtual NUMT apply (const Ptv(int) &index)
void setDescription (const String &info_)
String getDescription () const
virtual IndexSetgetOffset ()
bool ok () const
virtual void print (Os os) const

Protected Methods

virtual void specialStartIterator ()
virtual void specialIterate ()

Protected Attributes

int nsd
int maxoffset
int node_dof
bool iteration_flag
ArrayGenSimple(StencilWeightpd
StencilWeightwptr
StencilWeight dummy_weight
Ptv(int) itidx
Handle(IndexSetoffset_idxset
String info
Handle(FieldLatticeapply_field

Detailed Description

base class for finite difference stencils.

NAME: Stencil - base class for finite difference stencils

DESCRIPTION:

Stencils arise e.g. in finite difference methods. The class "Stencil" implements a point operator as a "nsd" dimensional array of "StencilWeight" objects. Each "StencilWeight" object corresponds to a (local) point in the point operator. The point operator has indices and they are relative to a point "(i,j)". The center point has always the local indices `$`(0,0,`\ldots` )`$`. (The standard five point Laplacian operator in 2D has the indices "(-1,0)", "(0,0)", "(1,0)", "(0,-1)" and "(0,1)". All points have then the constant value -1 while the center point "(0,0)" has the constant value `$`4`$`).


Constructor & Destructor Documentation

Stencil::Stencil ( )
 

There are several constructors:

One constructor that requires the number of space dimensions (of the grid associated with the point operator) and a non-negative number "maxoff" specifying the maximum offset from the center of the point operator. There is also an empty constructor that requires a call to the redim function, and a copy constructor.

Recall that each point is represented as a "StencilWeight" object, and these objects can be filled by a number (constant value) or by a "StencilWeightFunc" functor (typically when having variable coefficients in the point operator).

Stencil::Stencil ( int nsd,
int maxoffset )
 

See documentation of one of the overloaded constructor.

Stencil::Stencil ( const Stencil & p )
 

See documentation of one of the overloaded constructor.

Stencil::~Stencil ( ) [inline]
 


Member Function Documentation

NUMT Stencil::apply ( const Ptv(int) & index ) [virtual]
 

apply the stencil on a field, that is return the sum of the contributions from each stencil weight applied on the field. The field values must first be attached to the stencil through the attach function. In the case that no field values have been attached, the function will return the value in the stencil weight itself. This is only legal if the stencil has maxoffset 0, that is only one node (the center node). The version that takes a "Ptv(int)" is used in lattice stencils, while the other version is used in general cases.

Reimplemented in StencilUnion.

void Stencil::attach ( const FieldLattice & f ) [inline]
 

attach a "FieldWithPtValues" object to the stencil, e.g. in order to apply the stencil on a field. (See description for "apply")

void Stencil::fill ( StencilWeightFunc & ) [virtual]
 

See documentation of one of the overloaded functions.

void Stencil::fill ( NUMT val ) [virtual]
 

fills all the activated weights with the supplied constant or variable coefficient.

void Stencil::fillAll ( StencilWeightFunc & ) [virtual]
 

See documentation of one of the overloaded functions.

void Stencil::fillAll ( NUMT val ) [virtual]
 

fills all the weights in the with the supplied constant or variable coefficient regardless of whether they are active or not. Activates all the stencil weights when filling them.

String Stencil::getDescription ( ) const
 

returns the verbose description for this stencil.

int Stencil::getNoSpaceDim ( ) const [inline]
 

returns the number of space dimensions of the stencil.

int Stencil::getNodeDof ( ) const [virtual]
 

return the node dof of the stencil.

Reimplemented in StencilUnion.

IndexSet & Stencil::getOffset ( ) [virtual]
 

bool Stencil::isIterating ( ) [inline]
 

returns true is an iteration is in progress.

bool Stencil::iterate ( ) [virtual]
 

iterate one step, set the externally allocated "StencilWeight" to the correct weight object / node value. Returns true if iteration was successful, and false if the iteration is finished.

int Stencil::maxoff ( ) const [inline, virtual]
 

returns the value of "maxoffset".

Reimplemented in StencilUnion.

bool Stencil::ok ( ) const
 

const StencilWeight & Stencil::operator() ( const Ptv(int) & i ) const
 

const StencilWeight & Stencil::operator() ( int r,
int s,
int t ) const
 

const StencilWeight & Stencil::operator() ( int r,
int s ) const
 

const StencilWeight & Stencil::operator() ( int r ) const
 

StencilWeight & Stencil::operator() ( const Ptv(int) & i )
 

StencilWeight & Stencil::operator() ( int r,
int s,
int t )
 

StencilWeight & Stencil::operator() ( int r,
int s )
 

StencilWeight & Stencil::operator() ( int r )
 

Stencil & Stencil::operator= ( const Stencil & p )
 

void Stencil::print ( Os os ) const [virtual]
 

Reimplemented in StencilUnion.

bool Stencil::redim ( int no_equations,
int no_couplings )
 

redimensions the point operator.

void Stencil::setDefaultNodeDof ( int d ) [virtual]
 

set the node dof of the stencil to the specified value only if the value has not been set by the user, that is, if the value of "node_dof" is less than 1, the value will be updated, otherwise nothing will be done. Used by "StencilCollection" when inserting a stencil into the collection.

Reimplemented in StencilUnion.

void Stencil::setDescription ( const String & info_ )
 

defines a verbose description of the stencil and its purpose, used for information purposes only.

void Stencil::setNodeDof ( int d ) [inline, virtual]
 

set the node dof of the stencil to a specified value.

Reimplemented in StencilUnion.

int Stencil::size ( ) [virtual]
 

return the number of non-empty / active entries in the stencil.

Reimplemented in StencilUnion.

void Stencil::specialIterate ( ) [protected, virtual]
 

implements the code of the iteration functions (the class specific parts). The function is usually not called explicitly by the user, it is only used by the iterator functions in the base class.

Reimplemented in StencilUnion.

void Stencil::specialStartIterator ( ) [protected, virtual]
 

Reimplemented in StencilUnion.

void Stencil::startIterator ( const StencilWeight & allocation )
 

The function takes a "StencilWeight" to initialize the iterator function. During iteration this stencil weight is always the "current" weight in the iteration.

void Stencil::stopIterator ( )
 

sets the iterator flag to false and removes the pointer to the externally allocated "StencilWeight" and "integer" objects.


Friends And Related Function Documentation

class StencilUnion [friend]
 


Member Data Documentation

Handle(FieldLattice) Stencil::apply_field [protected]
 

StencilWeight Stencil::dummy_weight [protected]
 

String Stencil::info [protected]
 

bool Stencil::iteration_flag [protected]
 

Ptv(int) Stencil::itidx [protected]
 

int Stencil::maxoffset [protected]
 

int Stencil::node_dof [protected]
 

int Stencil::nsd [protected]
 

Handle(IndexSet) Stencil::offset_idxset [protected]
 

ArrayGenSimple(StencilWeight) Stencil::pd [protected]
 

StencilWeight * Stencil::wptr [protected]
 


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.