Blitz logo

Blitz Devel :

From: Todd Veldhuizen (tveldhui_at_[hidden])
Date: 1998-08-05 18:41:08


blitz-19980805.tar.gz is available.

It has a fairly complete implementation of indirection. Also, you
can see the documentation for indirection at

http://oonumerics.org/blitz/manual/blitz02.html#l84

I changed "list of subdomains" into "list of 1D strips".
This is easier to implement, and arguably equally efficient.
It is probably much easier to decompose arbitrary subdomains
into strips rather than rectangles, anyway.

Here's the list of strips example from the manual:

  const int N = 7;
  Array<int,2> A(N,N), B(N,N);
  typedef TinyVector<int,2> coord;

  A = 0;
  B = 1;

  double centre_i = (N-1)/2.0;
  double centre_j = (N-1)/2.0;
  double radius = 0.8 * N/2.0;

  // circle will contain a list of strips which represent a circular
  // subdomain.

  list<RectDomain<2> > circle;
  for (int i=0; i < N; ++i)
  {
    double jdist2 = pow2(radius) - pow2(i-centre_i);
    if (jdist2 < 0.0)
      continue;

    int jdist = int(sqrt(jdist2));
    coord startPos(i, int(centre_j - jdist));
    circle.push_back(strip(startPos, secondDim, int(centre_j + jdist)));
  }

  // Set only those points in the circle subdomain to 1
  A[circle] = B;

After this code, the A array contains:

  0 0 0 0 0 0 0
  0 0 1 1 1 0 0
  0 1 1 1 1 1 0
  0 1 1 1 1 1 0
  0 1 1 1 1 1 0
  0 0 1 1 1 0 0
  0 0 0 0 0 0 0

--------------------- blitz-dev list --------------------------------
* To subscribe/unsubscribe: mail to majordomo_at_[hidden], with
"subscribe blitz-dev" or "unsubscribe blitz-dev" in the body of the message
* Blitz++ web page: http://oonumerics.org/blitz/