NAME
Grid - base class for grids
INCLUDE
include "Grid.h"
SYNTAX
class Grid : public HandleId
{
protected:
Grid ();
public:
virtual ~Grid ();
virtual void print (Os os) const =0;
virtual void scan (Is is) =0;
virtual int getNoSpaceDim () const =0;
virtual void getMinMaxCoord
(Ptv(real)& mincoord, Ptv(real)& maxcoord) const =0;
// data and functions used primarily by FieldReader/FieldWriter classes
private:
// list of id's for stored grids equal to this
dataset_grid_id* firstmember_idlist;
dataset_grid_id* lastmember_idlist;
int num_members;
static int checknum;
void empty_idList ();
void add_to_idList
(
const String& datasetname,
const int gridnumber,
const int checknumber
);
public:
static int getNewChecknumber () { checknum++; return checknum; }
int getNoMembers_idList ()
{ return num_members; }
bool getMember_idList
(
const int refno,
String& datasetname,
int& gridnumber,
int& checknumber
);
// marks that grid is/will be changed before next load/unload operation
virtual void isToBeChanged ();
void loadData // calls scan and updates id list
(
Is is,
const String& datasetname,
const int gridnumber,
const int checknumber
);
void unloadData // calls print and updates id list
(
Os os,
const String& datasetname,
const int gridnumber,
const int checknumber
);
CLASS_INFO
// virtual cast functions:
DEF_VIRTUAL_CAST(GridWithPts)
DEF_VIRTUAL_CAST(GridFE)
DEF_VIRTUAL_CAST(GridFEAdB)
DEF_VIRTUAL_CAST(GridFEAdT)
DEF_VIRTUAL_CAST(BasisFuncGrid)
DEF_VIRTUAL_CAST(GridLattice)
DEF_VIRTUAL_CAST(GridScatPt)
};
KEYWORDS
abstract grid
DESCRIPTION
The class serves as base class for all types of grids. It
defines a set of virtual functions, mainly used by the tools
FieldReader, FieldWriter and SimResFile for storing fields and
their corresponding grids in a compact format. For example, sev
eral fields may use the same grid and this must be reflected in
the storage. Necessary data for the book-keeping of grids are
included in class Grid.
CONSTRUCTORS AND INITIALIZATION
The constructor takes no arguments. No further initialization is
necessary.
MEMBER FUNCTIONS
print - prints the grid (usually in ascii format).
scan - reads the grid (usually in ascii format -- seldom used).
getNoSpaceDim -returns the number of space dimensions associated
with the grid.
getMinMaxCoord - 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.
isToBeChanged - indicates that the grid is to be changed and that
the grid must be stored on the grid file (see class SimResFile or
class FieldWriter) next time a field referencing this grid is
dumped to file. The function is typically used when the grid is
moved or refined.
loadData - load the grid from a SimRes grid file. This is the
standard way of reading a grid in Diffpack. The function is used
by the FieldReader and SimResFile classes. For simple input/out
put coded by a user, the scan function is usually the preferred
function for reading the grid (loadData may be somewhat special
ized for reading a grid associated with a field).
unloadData - write the grid to a SimRes grid file. This is the
standard way of writing a grid in Diffpack. The function is used
by the FieldWriter and SimResFile classes. For simple input/out
put coded by a user, the print function is usually the preferred
function for writing the grid (unloadData may be somewhat spe
cialized for writing a grid associated with a field).
DEVELOPED BY
SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway
AUTHOR
Hans Petter Langtangen, SINTEF/UiO