Index

NAME

IndexSetBoxItOrder - box shaped index set in 1D, 2D, 3D and MD


INCLUDE

include "IndexSetBoxItOrder.h"

SYNTAX

 //-----------------------------------------------------------------------------
 class IndexSetBoxItOrder : public IndexSetBox
 //-----------------------------------------------------------------------------
 {
 private :

   Ptv(int) order;

 protected :

   virtual int getLineNumber (const Ptv(int)& pt) const;

   virtual void specialStartIterator();
   virtual void specialReverseStartIterator();

 public :

   IndexSetBoxItOrder () {}
   IndexSetBoxItOrder (int nsd);
   IndexSetBoxItOrder (const Ptv(int)& min_ind_,
                       const Ptv(int)& max_ind_,
                       const Ptv(int)& order_);
   IndexSetBoxItOrder (const IndexSetBoxItOrder& b);
   IndexSetBoxItOrder (const IndexSet_prm& pm);
   virtual ~IndexSetBoxItOrder () {}

   IndexSetBoxItOrder& operator= (const IndexSetBoxItOrder& b);

   bool redim (const Ptv(int)& min_ind_,
                  const Ptv(int)& max_ind_,
                  const Ptv(int)& Order);

   virtual bool redim (const Ptv(int)& min_ind_,
                       const Ptv(int)& max_ind_);

   virtual void getIndexIterator (Handle(IndexSet)& I)  const;

   // get a new index line:
   virtual void specialIterate ();
   virtual void specialReverseIterate ();

   virtual void scan (Is is);
   virtual void print (Os os) const;

   CLASS_INFO

   VIRTUAL_CAST(IndexSetBoxItOrder)

 };



KEYWORDS

index set , box shape , iteration order




DESCRIPTION

The  class  is  derived  from IndexSetBox. In addition this class
ables the user to specify the  iteration  order  of  the  spatial
dimensions.



CONSTRUCTORS AND INITIALIZATION

The  specialized constructor takes three Ptv(int) objects, speci­
fying the lower and upper index of  the  set  and  the  iteration
order.   If  order(1)=2 and order(2)=1, then the second dimension
of the index set will iterate faster then the first dimension.

Note that the scan function can be used to initalize an object.


MEMBER FUNCTIONS

Please note that the inherited member functions  from  the  class
IndexSet are described  within the documentation of IndexSet.



bool redim - redimensions the index set, specifying the lower and
upper index of the set and the iteration order.

void getIndexIterator - rebinds a new object similar to  this  to
the argument.

operator= - puts a IndexSetBoxItOrder object equal to another.

specialIterate  - will push the next index line of the set to the
base class IndexSet.

specialReverseIterate - same as specialIterate but the  iteration
order is in reverse.

void  scan  -  reads three Ptv(int) objects base,top and order by
calling the Ptv(int) objects own scan  function,  the  object  is
initialized  by  redim(base,top,order).   There are three formats
which scan understand, depending on the first character  that  is
read. See the example below.


print - print information about the index set.






EXAMPLE

#include <IndexSetBoxItOrder.h>

void main()
{
  Ptv(int) b(1,1,1) , t(3,3,3), o(2,1,3);
  IndexSetBoxItOrder box(b,t,o);
  Ptv(int) index(3);
  box.startIterator(index);         //  index  is  not set to the
first index
  while ( box.iterate() )          // index is iterated
   {s_o<<" < "<< index <<" > "; }

  s_o << "SIZE :" << box.size() << "0;  // the total size


  box.scan("(1,1,1) (4,4,4) (3,1,2)");      //  box :
                                    //  [1,1,1]x[4,4,4]  ,  order
3,1,2
  box.scan("2(1,1) (2,2) (2,1)");

  // this format must be used if the class IndexSet_prm
  // is used to collect the parameters of the index set
  box.scan(">index_set_storage = IndexSetBoxItOrder >nsd = 2 "
           ">index_set_string = { (1,1)X(2,2) order=(2,1) }" );
}




SEE ALSO

class IndexSet, class IndexSetBox, class ArrayGenSel(Type).


DEVELOPED BY

Numerical Objects AS


AUTHOR

Are Magnus Bruaset, Numerical Objects AS