#include <cassert>
#include <iomanip>
using namespace std;

#include <meshrect.h>

meshrect::meshrect(uintc M_, uintc N_)
  : M(M_), N(N_)
{
  mat = new pt3[M*N];
  assert(mat!=0);

  double const dx = 1.0/((double)M-1.0);
  double const dy = 1.0/((double)N-1.0);

  for (uint j=0; j<N; ++j)
  {
    for (uint i=0; i<M; ++i)
      pij(i,j) = pt3(dx*i,dy*(N-1-j),0.0);
  }
}

meshrect::~meshrect()
{
  delete[] mat;
}

void meshrect::print() const
{
  uint i;
  uint j=N;
  do
  {
    --j;
    for (i=0; i<M; ++i)
      cout << setw(10) << pij(i,j); 
    cout << endl;
  } while (j!=0);
}



