Diffpack Documentation


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

GridLattice Class Reference

finite difference grid with constant partition. More...

#include <GridLattice.h>

Inheritance diagram for GridLattice::

GridWithPts Grid HandleId GridLatticeB GridLatticeC List of all members.

Public Types

enum  Gridtype { UNIFORM, NONUNIFORM }
enum  Component {
  none = -1, p, u, v,
  w
}

Public Methods

void setComponent (GridLattice::Component comp)
 GridLattice (int nsd=1, enum Gridtype gtype=GridLattice::UNIFORM)
 ~GridLattice ()
bool ok () const
bool redim (int nsd)
bool notEqual (const GridLattice &grid) const
bool isUniform () const
void copy (const GridLattice &grid)
void operator= (const GridLattice &grid)
void initBoInds ()
void initBoInds (int nbind)
real& xMin (int i)
real xMin (int i) const
const Ptv(real)& xMin () const
real& xMax (int i)
real xMax (int i) const
const Ptv(real)& xMax () const
real Delta (int dir) const
real Delta (int dir, int node) const
const Ptv(real) Delta (const Ptv(int) &node) const
real Delta (int dir, int node, int fict_boundary) const
const Ptv(real) Delta (const Ptv(int) &node, int fict_boundary) const
int getDivisions (int i) const
const Ptv(int)& getDivisions () const
Ptv(int) getNoGridPoints () const
int getNoBoInds () const
void fillCoords (int component, const VecSimple(real) &coords)
void fillSpacing (int component, const VecSimple(real) &spacing)
void setDivisions (int ndiv, int i)
void setDivisions (const Ptv(int) &ndiv)
void setDivisions (const VecSimple(real) &coords, int i)
void setBase (int base_value)
int getBase (int i) const
const Ptv(int)& getBase () const
int getMaxI (int i) const
Ptv(int) getMaxI () const
const Ptv(int)& single2multiple (int single, bool points=true) const
int multiple2single (const Ptv(int) &multiple, bool points=true) const
Ptv(real) getPt (const Ptv(int) &index) const
real getPt (int dir, int index) const
Ptv(real) getPtCellCenter (const Ptv(int) &index) const
real getPtCellCenter (int dir, int index) const
void getMinMaxCellCoord (const Ptv(int) &index, Ptv(real)&mincoord, Ptv(real)&maxcoord) const
bool& scalarInHalfIndex ()
bool scalarInHalfIndex () const
Ptv(int)& halfShiftInMax ()
const Ptv(int)& halfShiftInMax () const
Ptv(int)& halfShiftInMin ()
const Ptv(int)& halfShiftInMin () const
bool wholeIndex (real i) const
bool halfIndex (real i) const
virtual void setIndexBase ()
virtual real& indexBase (int i)
virtual real indexBase (int i) const
virtual const Ptv(real)& indexBase () const
String getBoIndName (int indno) const
bool boNode (int node, int indno) const
bool boNode (int node) const
bool boInd (int ind)
void putBoIndName (const String &name, int indno)
const IndicatorsboundaryData () const
IndicatorsboundaryData ()
void attach (const Indicators &boinds)
void redefineBoInds (Is is)
void addBoIndNodes (Is is, bool add=ON)
void setBoInd (int node, int indno)
void clearBoInd (int node, int indno)
void clearBoInds ()
IndexSetcreateIndexSetInnerNodes ()
IndexSetcreateIndexSet (int ind)
IndexSetcreateIndexSet (const VecSimple(int) &ind)
IndexSetCollectioncreateIndexSetCollection ()
bool insideDomain (const Ptv(real) &x, int fict_boundary=0) const
bool insideDomain (const Ptv(int) &ind, int fict_boundary=0) const
bool getCell (const Ptv(real) &x, Ptv(int) &index) const
void findElmAndLocPt (const Ptv(real) &glob_pt, int &element, Ptv(real) &loc_pt, int &node, bool triangular_element=false) const
Ptv(int) nearestIndex (const Ptv(real) &point, real &distance, bool &exact, const int fict_boundary=0) const
virtual int nearestPoint (const Ptv(real) &point, real &distance, bool &exact)
virtual int getNoPoints () const
virtual int getNoSpaceDim () const
String print () const
virtual void print (Os os) const
virtual void scan (Is is)
virtual void scale ()
virtual void unscale ()
virtual void startIterator ()
void startIterator (const Ptv(int) &index1, const Ptv(int) &index2)
virtual bool nextPt (Ptv(real) &x)
bool nextPt (Ptv(int) &index)
bool nextPt (Ptv(real) &x, Ptv(int) &index)
virtual void getMinMaxCoord (Ptv(real) &mincoord, Ptv(real) &maxcoord) const
virtual void indexCheckOk (real i) const
virtual void indexCheckOk (real i, real j) const
virtual void indexCheckOk (real i, real j, real k) const
virtual void changeGridSize ()
virtual void flipAroundSymmetryPlane (int dir, real plane)

Public Attributes

enum GridLattice::Component  comp_in_staggered_grid

Protected Methods

IndexSetfindObstacles (const Ptv(int) &indicators, const Ptv(int) &bmin, const Ptv(int) &bmax)

Protected Attributes

int nbind
Handle(Indicatorsbind

Detailed Description

finite difference grid with constant partition.

NAME: GridLattice - finite difference grid with constant partition

DESCRIPTION:

"GridLattice" enables the programmer to define and manipulate a rectangle/box shaped grid in any number of space dimensions. One may specify UNIFORM or NONUNIFORM in the constructor, depending on the required gridtype. A grid is only UNIFORM when it has uniform partition in all space directions.


Member Enumeration Documentation

enum GridLattice::Component
 

Enumeration values:
none  
p  
u  
v  
w  

enum GridLattice::Gridtype
 

Enumeration values:
UNIFORM  
NONUNIFORM  


Constructor & Destructor Documentation

GridLattice::GridLattice ( int nsd = 1,
enum Gridtype gtype = GridLattice :: UNIFORM )
 

The only constructor available has two arguments indicating the size of internal arrays (ie. the number of space dimensions) and the type of grid (UNIFORM or NONUNIFORM). The constructor can be called with no arguments. The correct dimensions will anyway be set by "redim" or by "scan." The latter function is the usual tool to initialize a "GridLattice" object. Here is an example:

    GridLattice g;
    g.scan ("d=2 [0,1]x[1,3] index:[0:20]x[0:56]");

All grid parameters must either be set by the "scan" function or the programmer must use the "redim" function and then the functions "xMin", "xMax" and "setDivisions" (and perhaps "setBase").

GridLattice::~GridLattice ( )
 


Member Function Documentation

const Ptv(real) GridLattice::Delta ( const Ptv(int) & node,
int fict_boundary ) const
 

See documentation of one of the overloaded functions.

real GridLattice::Delta ( int dir,
int node,
int fict_boundary ) const
 

See documentation of one of the overloaded functions.

const Ptv(real) GridLattice::Delta ( const Ptv(int) & node ) const
 

See documentation of one of the overloaded functions.

real GridLattice::Delta ( int dir,
int node ) const
 

See documentation of one of the overloaded functions.

real GridLattice::Delta ( int dir ) const
 

various versions of this function is implemented. The one that takes one integer argument may only be used if the grid is uniform and returns the spacing in the given direction. The version that takes two integer arguments returns the spacing $x_{i+1}-x_i$ in the given direction, where $i$ is the supplied node number. The version that takes a "Ptv(int)" argument, is the same as the previous version, except it returns the spacing in all space directions.

The two functions that also takes an integer specifying a fictional boundary is used if the "FieldLattice" object that uses this grid has a ghost-boundary. This means that one is allowed to request the spacing between nodes that either are inside the grid or outside the grid, but inside the ghost-boundary. The spacings returned for nodes in the ghost-boundary is the value of the corresponding spacings on the grid, symmetrical to the edge of the grid. See class "FieldLattice" for more info on ghost-boundaries.

void GridLattice::addBoIndNodes ( Is is,
bool add = ON )
 

makes it possible to mark new nodes with one of the exisiting boundary indicators. New nodes are given as a domain (hypercube), and the function will process all nodes that are inside this domain. Here is an example of an input string to the function.

         "n=2 b1=[0,0]x[1,1] b4=[1,4]x[2,2]"
First the number of boundary indicators that are to be modified (extended) must be given, it is 2 in this example. Then each boundary indicator number of interest is preceeded by a ""b"" and then its number, then an equal sign, and finally a tensor product of intervals that defines the domain. All nodes inside this domain (""inside"" is determined by some tolerance, see "Interval.inWithTolerance", the tolerance equals the global variable "comparison_tolerance" that is set in the "initDiffpack" function if the command line argument "+tolerance" appears) are marked with the boundary indicator. Here the point (0,1) will be marked with indicator 1 and all nodes along the line `$y=2$`, between `$x=1$` and `$x=4$` will be marked with indicator 4. Sometimes one wants to mark just the nodes inside the domain that are already marked by an indicator. This is achieved by putting a capital B 'before' the hypercubes:

         "n=2 b1=B[0,0]x[1,1] b4=B[1,4]x[2,2]"
The "B" option is useful for curved boundaries since it enables only the nodes on the curved boundary to be marked, and not internal nodes as well.

The main application of this routine is when simple indication of boundary indicators were made in the preprocessor, for example, only the different sides of the domain were marked, and the user wants to assign boundary conditions to single nodes or to parts of a side. Often the "redefineBoInds" function is called first to extend the number of indicators. The new indicators can then be filled using "addBoIndNodes." It can often be convenient to introduce an indicator that is not used in computations, but only for marking the (whole) boundary. This makes it easier to use the capital B option in front of the hypercubes (the boundary is then already marked, and "addBoIndNodes" sets correct additional markers for computational purposes). (In the input string, the first "=", the "b" and the "=" are the significant characters, strange errors may occur if these characters are missing).

The final argument, "bool add", can be given "false" or "OFF" as value. In that case the indicators are turned off instead of on. Often one must make two calls to "addBoIndNodes", first turning some indicators on and then turning other indicators off.

void GridLattice::attach ( const Indicators & boinds )
 

attach a set of boundary indicators to the grid.

bool GridLattice::boInd ( int ind )
 

returns true if at least one node in the grid is marked with the given boundary indicator.

bool GridLattice::boNode ( int node ) const
 

See documentation of one of the overloaded functions.

bool GridLattice::boNode ( int node,
int indno ) const [inline]
 

the version with two arguments returns true if the given node is marked with the given boundary indicator and false otherwise, and the other version of this function returns true if the node is marked with at least one indicator.

Indicators & GridLattice::boundaryData ( ) [inline]
 

See documentation of one of the overloaded functions.

const Indicators & GridLattice::boundaryData ( ) const [inline]
 

return a reference to the internal boundary indicator management object.

void GridLattice::changeGridSize ( ) [inline, virtual]
 

see classes "GridLatticeB" and "GridLatticeC"

Reimplemented in GridLatticeB, and GridLatticeC.

void GridLattice::clearBoInd ( int node,
int indno ) [inline]
 

turn off a particular boundary indicator at a node ("OFF" mode).

void GridLattice::clearBoInds ( ) [inline]
 

void GridLattice::copy ( const GridLattice & grid )
 

help function for "operator="

IndexSet & GridLattice::createIndexSet ( const VecSimple(int) & ind )
 

See documentation of one of the overloaded functions.

IndexSet & GridLattice::createIndexSet ( int ind )
 

creates an instance of the class "IndexSetBoxObstacles" that contains all the nodes that has the specified/supplied boundary indicator(s) set, but none other than these set. The function also fills the description string of the indexset with information on which boundary indicators the indexset is generated from.

IndexSetCollection & GridLattice::createIndexSetCollection ( )
 

creates "IndexSetCollection" that contains one indexset for each combination of boundary indicators, plus one for the inner nodes. The IndexSetCollection is generated by iterating through the grid with "startIterator" and "nextPt". This iteration is done such that 'i' is the fastest varying index, then 'j' and finally 'k' as the slowest varying index (in 3D). Equivalently, in 2D, we have that for each index 'j', we run through all the 'i'-indices. (Here i, j and k are indices in direction 1, 2 and 3 respectively.) The "IndexSet"'s organization are determined by the order in which the boundary indicators are found in the grid through this iteration. For each point in the grid iteration, the boundary indicators set on this point are examined. For each new combination found, a new indexset is added to the collection, where this and future points that have this particular combination are stored, hence the indexsets are stored in the order the boundary indicator-combinations are found in the grid. The indexset covering the inner nodes are always the last indexset in the collection. Remember that one can always use the "getDescription" function in each "IndexSet" for a description of which boundary indicators that where the basis of the index set.

IndexSet & GridLattice::createIndexSetInnerNodes ( )
 

creates an instance of the class "IndexSetBoxObstacles" that contains all the nodes that does not have any boundary indicators set.

void GridLattice::fillCoords ( int component,
const VecSimple(real) & coords )
 

fills the supplied coordinates into the datastructure for the given space direction. The number of coordinates and xMin and xMax values must coinside with the previously set values.

void GridLattice::fillSpacing ( int component,
const VecSimple(real) & spacing )
 

builds the coordinates in the given direction on basis of the supplied spacings. Error messages are issued if the number of spacings is incorrect or if the built coordinates do not coinside with the previously set xMax value.

void GridLattice::findElmAndLocPt ( const Ptv(real) & glob_pt,
int & element,
Ptv(real) & loc_pt,
int & node,
bool triangular_element = false ) const
 

finds the cell and a local point in the cell corresponding to a given spatial point. There are similar functions in class "GridFE", but the present version is much more efficient since "GridLattice" is a grid with a very rigid geometric structure. The cells in the "GridLattice" grid are treated as tensor product elements of first order (i.e., bilinear elements in 2D). There is also an optional argument for triangular elements (only in 2D), the diagonal in the cell is then assumed to go from the lower right to the upper left corner (this is compatible with meshes generated by class "PreproBox"). The "findElmAndLocPt" function first checks if the spatial point is a node, if it is the corresponding element is chosen as the element that has the point in the upper right corner. Hence the local element coordinates of the point is typically (1,) (in 2D). If the spatial point is on the lower boundary, "x=xMin(i)", the local point is of course adjusted correspondingly. If the spatial point is not a node, one computes the element and local coordinates from a formula. The "findElmAndLocPt" function is automatically called from "GridFE findElmAndLocPt" if the finite element grid is actually a lattice.

IndexSet & GridLattice::findObstacles ( const Ptv(int) & indicators,
const Ptv(int) & bmin,
const Ptv(int) & bmax ) [protected]
 

void GridLattice::flipAroundSymmetryPlane ( int dir,
real plane ) [virtual]
 

Reimplemented from Grid.

const Ptv(int) & GridLattice::getBase ( ) const [inline]
 

See documentation of one of the overloaded functions.

int GridLattice::getBase ( int i ) const [inline]
 

get the base of the indices counters.

String GridLattice::getBoIndName ( int indno ) const [inline]
 

get the name of the boundary indicator

bool GridLattice::getCell ( const Ptv(real) & x,
Ptv(int) & index ) const
 

returns the d-dimensional index of the cell containing the given spatial point.

const Ptv(int) & GridLattice::getDivisions ( ) const [inline]
 

See documentation of one of the overloaded functions.

int GridLattice::getDivisions ( int i ) const [inline]
 

returns the number of divisions (""cells"") in a given or all spatial direction.

Ptv(int) GridLattice::getMaxI ( ) const
 

See documentation of one of the overloaded functions.

int GridLattice::getMaxI ( int i ) const [inline]
 

returns the upper limit of a loop from the base to the maximum number of grid points in a particular direction. For example, in a 2D grid we may easily construct a loop over the grid points:

      int i0 = grid.getBase(1);  int j0 = grid.getBase(2);
      int in = grid.getMaxI(1);  int jn = grid.getMaxI(2);
      int i,j;
      for (i = i0; i <= in; i++)
        for (j = 1; j <= jn; j++)
          // do something with point (i,j), e.g.

void GridLattice::getMinMaxCellCoord ( const Ptv(int) & index,
Ptv(real)& mincoord,
Ptv(real)& maxcoord ) const
 

returns the minimun and maximum coordinates of the specified cell.

void GridLattice::getMinMaxCoord ( Ptv(real) & mincoord,
Ptv(real) & maxcoord ) const [virtual]
 

returns the hypercube (with respect to the Cartesian coordinate system where the grid coordinates are defined) that encloses the grid. This function is only meaningful if the grid represents some kind of geometry in the problem.

Reimplemented from GridWithPts.

int GridLattice::getNoBoInds ( ) const [inline]
 

returns the number of boundary indicators.

Ptv(int) GridLattice::getNoGridPoints ( ) const
 

returns the number of grid points in each spatial direction.

int GridLattice::getNoPoints ( ) const [virtual]
 

Reimplemented from GridWithPts.

int GridLattice::getNoSpaceDim ( ) const [inline, virtual]
 

returns the number of space dimensions associated with the grid.

Reimplemented from GridWithPts.

real GridLattice::getPt ( int dir,
int index ) const
 

See documentation of one of the overloaded functions.

Ptv(real) GridLattice::getPt ( const Ptv(int) & index ) const
 

returns the coordinates of point. The point is specified by its index. An overloaded version avoids the use of a "Ptv(int)" for the index, instead one can give a direction and the index in that direction.

real GridLattice::getPtCellCenter ( int dir,
int index ) const
 

See documentation of one of the overloaded functions.

Ptv(real) GridLattice::getPtCellCenter ( const Ptv(int) & index ) const
 

returns the coordinate of the center/centroid of the cell corresponding to the given index. The numbering of the cells starts at the base and ends with "getMaxI" minus one, in each direction.

bool GridLattice::halfIndex ( real i ) const
 

true if the index "i" is an integer plus one half.

const Ptv(int) & GridLattice::halfShiftInMax ( ) const [inline]
 

See documentation of one of the overloaded functions.

Ptv(int) & GridLattice::halfShiftInMax ( ) [inline]
 

same as "halfShiftInMin" but the half grid cell is removed at the end of the grid in the given grid direction.

const Ptv(int) & GridLattice::halfShiftInMin ( ) const [inline]
 

See documentation of one of the overloaded functions.

Ptv(int) & GridLattice::halfShiftInMin ( ) [inline]
 

the "half_shift_in_min" variable is 0 by default, i.e no half shift, a half shift is introduced by setting the value 1 in the desired direction. The value must then be specified in all directions by setting 0 in the directions that should not have a half shift. This half shift removes the first half grid cell in the given direction. This is convenient when we have for instance the scalar value given at one end of the grid and a velocity component given at the other end of the grid.

const Ptv(real) & GridLattice::indexBase ( ) const [inline, virtual]
 

See documentation of one of the overloaded functions.

real GridLattice::indexBase ( int i ) const [inline, virtual]
 

See documentation of one of the overloaded functions.

real & GridLattice::indexBase ( int i ) [inline, virtual]
 

various functions returning the index base.

void GridLattice::indexCheckOk ( real i,
real j,
real k ) const [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in GridLatticeB, and GridLatticeC.

void GridLattice::indexCheckOk ( real i,
real j ) const [virtual]
 

See documentation of one of the overloaded functions.

Reimplemented in GridLatticeB, and GridLatticeC.

void GridLattice::indexCheckOk ( real i ) const [virtual]
 

checks if the given indices are integers or integers pluss one half, depending on the type of staggered grid given.

Reimplemented in GridLatticeB, and GridLatticeC.

void GridLattice::initBoInds ( int nbind )
 

See documentation of one of the overloaded functions.

void GridLattice::initBoInds ( )
 

the version witch takes no argument sets up a set of default boundary indicators along the edge of the grid, numbered such that the first indicator is set on the top edge in the first space-direction, the next at the top edge in the second space direction and so on for all nsd, then the next indicator is set on the lower edge in the first space direction, the next on the lower edge of the second and so on. The version that takes an integer argument does not set any indicators, it just allocates space for the given number of boundary indicators, which must later be set by the function addBoIndNodes.

bool GridLattice::insideDomain ( const Ptv(int) & ind,
int fict_boundary = 0 ) const
 

See documentation of one of the overloaded functions.

bool GridLattice::insideDomain ( const Ptv(real) & x,
int fict_boundary = 0 ) const
 

checks if the given point (or the given indices) is inside the grid. The optional argument "fict_boundary" should be used when the corresponding "FieldLattice" object has a fictitious boundary (ghost boundary) around the grid, and one wishes to find out if the point/indices are inside the grid and the imaginary boundary around the grid. See class "FieldLattice" for more info on the effect of fictitious boundary (ghost boundary).

bool GridLattice::isUniform ( ) const [inline]
 

returns true if the lattice grid has uniform partition.

int GridLattice::multiple2single ( const Ptv(int) & multiple,
bool points = true ) const
 

returns the single index corresponding to the supplied multiple index. See the function "single2multiple" for more information.

Ptv(int) GridLattice::nearestIndex ( const Ptv(real) & point,
real & distance,
bool & exact,
const int fict_boundary = 0 ) const
 

a la "nearestPoint" (see class "GridWithPts"), but computes the index of the point that is nearest the specified point. The index is an n-tuple (represented as usual by a "Ptv(int)" object).

int GridLattice::nearestPoint ( const Ptv(real) & point,
real & distance,
bool & exact ) [inline, virtual]
 

computes the grid point that is nearest to an arbitrarily given point. The input argument is the specified point, while the output arguments are the distance to the point and a boolean variable indicating if the given point coincides with one of the grid points. If the boolean value is true, the distance to the point is zero. The return value is the point number of the point that is nearest to the specified point. There are some overloaded versions of "nearestPoint". These are aimed at various search algorithms required by "valuePt" in finite element meshes.

Reimplemented from GridWithPts.

bool GridLattice::nextPt ( Ptv(real) & x,
Ptv(int) & index )
 

bool GridLattice::nextPt ( Ptv(int) & index )
 

bool GridLattice::nextPt ( Ptv(real) & x ) [virtual]
 

gives the coordinates of the next point in the grid. The return value is false when there are no more points in the grid. Here is an example on iteration over the grid points:

      grid.startIterator(); 
      while (grid.nextPt(p)) 
        { .... }

Reimplemented from GridWithPts.

bool GridLattice::notEqual ( const GridLattice & grid ) const
 

returns false if the two grids are equal, otherwise returns true.

bool GridLattice::ok ( ) const
 

void GridLattice::operator= ( const GridLattice & lattice )
 

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

prints the grid (usually in ascii format).

Reimplemented from Grid.

String GridLattice::print ( ) const
 

void GridLattice::putBoIndName ( const String & name,
int indno ) [inline]
 

assign a name to a boundary indicator.

void GridLattice::redefineBoInds ( Is is ) [inline]
 

makes it possible to redefine the boundary indicators, that is, define a mapping between old and new boundary indicators. Assume that we have three boundary indicators and that we want to map these three indicators over to a new set of four indicators. The new indicator 1 consists of nodes subjected to old indicator 1 or 3, the new indicator 2 should be empty, the new indicator three is identical to old indicator three, while the new indicator four should consist of all the old indicators. Let the names of the new indicators be "green", "blue", "red" and "black". The mapping is defined by the following string which can be sent as argument to "redefine".

      nbind=4, names= green blue red black  1=(1 3) 2=() 3=(3) 4=(1 2 3)
The names must be surrounded by blanks, only the two first equality signs and the parenthesis are significant in the scan process (thus the commands nbind, names, 1, 2 and 3 are never checked). Old indicator numbers must be inside parenthesis and separated by blanks. A equivalent string is

      =4 =green blue red black (1 3 ()(3)(1) 2 3)
but less readable.

bool GridLattice::redim ( int nsd )
 

bool GridLattice::scalarInHalfIndex ( ) const [inline]
 

See documentation of one of the overloaded functions.

bool & GridLattice::scalarInHalfIndex ( ) [inline]
 

"true" if the scalar ("p") is located in the centriod of the grid cell in the staggered grid, "false" if the scalar value is evaluated in the vertices of the cells. Where the vecocity components are evaluated is determined by the evaluation point for the scalar value and by the type of staggered grid (B-grid or C-grid). See classes "GridLatticeB" and "GridLatticeC" for more detailes.

void GridLattice::scale ( ) [virtual]
 

Reimplemented from GridWithPts.

void GridLattice::scan ( Is is ) [virtual]
 

The "scan" function reads an "Is" (string, stream, file) on the following format for uniform partition

      grid, d=3, [-1,1]x[0,1]x[0,1] indices=[0:10]x[1:8]x[-6:6]
This gives a 3D grid where `$`-1\leq x\leq 1`$`, `$`0\leq y\leq 1`$` and `$`0\leq z\leq 1`$`. The grid points are numbered from 0 to 10 in the `$`x`$`-direction, hence there are 11 points in the `$`x`$`-direction. In the `$`y`$`- and `$`z`$`-directions there are 8 and 13 points respectively.

For a NONUNIFORM grid, the "scan" string is as follows:

      grid, d=2  domain = [0,1]x[0,1]  grid points = [0:5]x[1:10]
      spacing=NONUNIFORM  0.0 0.2 0.4 0.6 0.8 1.0;
      0.0 0.15 0.2 0.25 0.3 0.35 0.4 0.6 0.8 1.0;
The "startIterator" and "nextPt" functions enables the programmer to run through all points in the grid or through only a subset of the grid points. To initialize the iteration over points, call "startIterator." Without arguments, "startIterator" initializes the iteration over all grid points. In an overloaded version indices for the starting and stopping point in the grid can be given.

Reimplemented from Grid.

void GridLattice::setBase ( int base_value ) [inline]
 

set the base of the indices counters (usually 0 or 1, 1 is default).

void GridLattice::setBoInd ( int node,
int indno ) [inline]
 

set a particular boundary indicator at a node ("ON" mode).

void GridLattice::setComponent ( GridLattice::Component comp )
 

void GridLattice::setDivisions ( const VecSimple(real) & coords,
int i )
 

See documentation of one of the overloaded functions.

void GridLattice::setDivisions ( const Ptv(int) & ndiv )
 

See documentation of one of the overloaded functions.

void GridLattice::setDivisions ( int ndiv,
int i )
 

sets the number of grid points in one or all spatial direction depending on which version of the function is called. This function then reinitializes the internal datamembers that depend upon the number of divisions. The simplest version of this function taking two integers can only be called for uniform grids. The version that takes a "Ptv(int)" can be used for both uniform and non-uniform grids, but if this function is called for a non-uniform grid, it will initialize the coordinates as if the grid was uniform. The default coordinates can then be changed using "fillCoords" or "fillSpacings". The version that takes a "VecSimple(real)" coordinate vector may be used for both uniform and non-uniform grids, but it will set a uniform grid to be non-uniform and use the supplied coordinates in the given direction. An error message is issued if the supplied coordinates do not coinside with the previously set "xMin" and "xMax" values.

void GridLattice::setIndexBase ( ) [virtual]
 

will usually not need to be called explicitly by the user. Sets the "index_base" to the given values, depending on the location of the various unknowns in the staggered grid. The "index_base" is set such that if its value in the desired direction is subtracted from the users supplied index, the resulting index will always be an integer, allowing the correct array value to be accessed. That is, if the staggered grid is such that a value is evaluated in the center of the grid cell in a given direction, the "index_base" is set to 0.5 in that same direction, otherwise the index_base is set to 0.0.

Reimplemented in GridLatticeB, and GridLatticeC.

const Ptv(int) & GridLattice::single2multiple ( int single,
bool points = true ) const
 

returns the index represented as a "Ptv" corresponding to the single index supplied to the function. If the second argument, ""points"" is true, the indices refer to points/nodes in the grid, if the argument is false, the indices refer to grid cells.

void GridLattice::startIterator ( const Ptv(int) & index1,
const Ptv(int) & index2 )
 

void GridLattice::startIterator ( ) [virtual]
 

initializes an iteration over the grid points.

Reimplemented from GridWithPts.

void GridLattice::unscale ( ) [virtual]
 

Reimplemented from GridWithPts.

bool GridLattice::wholeIndex ( real i ) const
 

true if the index "i" is an integer.

const Ptv(real) & GridLattice::xMax ( ) const [inline]
 

See documentation of one of the overloaded functions.

real GridLattice::xMax ( int i ) const [inline]
 

See documentation of one of the overloaded functions.

real & GridLattice::xMax ( int i ) [inline]
 

gives the maximum coordinates of the grid.

const Ptv(real) & GridLattice::xMin ( ) const [inline]
 

See documentation of one of the overloaded functions.

real GridLattice::xMin ( int i ) const [inline]
 

See documentation of one of the overloaded functions.

real & GridLattice::xMin ( int i ) [inline]
 

gives the minimum coordinates of the grid.


Friends And Related Function Documentation

class FieldLattice [friend]
 

class GridFE [friend]
 

class GridLatticeB [friend]
 

class GridLatticeC [friend]
 

class MathLinkInterface [friend]
 


Member Data Documentation

Handle(Indicators) GridLattice::bind [protected]
 

enum GridLattice::Component GridLattice::comp_in_staggered_grid
 

int GridLattice::nbind [protected]
 


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