Index

NAME

GridScatPt - grid consisting of arbitrary discrete points


INCLUDE

include "GridScatPt.h"

SYNTAX

 class GridScatPt : public GridWithPts
 {
   int              nsd;     // number of space dimensions
   int              npoints; // number of grid points
   MatSimple(real)  coor;    // coordinates of grid points
   Ptv(real)        scratch; // used for returning Ptv(real)& from functions
   int              current_pt; // help for startIterator and nextPt

 public:
   GridScatPt ();
  ~GridScatPt () {}

   bool redim (int nsd, int npoints);
   bool ok () const;
   virtual void scan (Is is);             // scan, redim and fill object

   Ptv(real) getPt (int i) const;
   void      setPt (int i, const Ptv(real) ptcoor);

   virtual void print (Os os) const;
   virtual int nearestPoint
     (const Ptv(real)& point, real& distance, bool& exact);
   virtual int  getNoPoints () const;
   virtual void startIterator ();
   virtual bool nextPt (Ptv(real)& x);
   virtual int  getNoSpaceDim () const;
   virtual void getMinMaxCoord
     (Ptv(real)& mincoord, Ptv(real)& maxcoord) const;

   virtual void   scale ();  //   scale the point coordinates
   virtual void unscale ();  // unscale the point coordinates

   CLASS_INFO
   VIRTUAL_CAST(GridScatPt)
 };



KEYWORDS

point collection, discrete points, grid



DESCRIPTION

The  class  represents a collection of scattered points in space.
Together with class FieldScatPt the grid  is  used  to  represent
fields over scattered points.

The  application of the class is not limited to fields over scat­
tered points. If one  needs  to  specify  a  set  of  "arbitrary"
points, e.g., chosen by the user at run time, GridScatPt can read
and hold the point  data.  For  example,  it  is  used  in  class
Store4Plotting  for  reading and holding at set of spatial points
at which the time evolution of fields are to be plotted.




CONSTRUCTORS AND INITIALIZATION

The constructor takes no arguments. To initialize the  object  it
is  necessary  to  call redim and give the proper number of scat­
tered points that make up the grid. After  redim  is  called,  ok
will return a true value.  The coordinates of the points are read
by the scan function in a compact format.



MEMBER FUNCTIONS

redim - redimensions the internal data  structure.  The  argument
reflects the number of points in the grid.

scan - reads the coordinates of the grid points. The input syntax
is as follows. First d=2 is given to indicate the number of space
dimensions  (d=2 imply 2D points). Then the number of grid points
is given as n=4. Thereafter each grid point is given in the stan­
dard Ptv(real) scan format. Here is a possible string:
d=3 n=2 (1,-1,0) (8,1.1,-9)

getPt  -  returns  the  coordinates of a grid point. The point is
given by its point number.

setPt - assigns coordinates to a grid point. See getPt.



DEVELOPED BY

SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway


AUTHOR

Hans Petter Langtangen, SINTEF/UiO