freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Move print() methods ool


From: Richard Guenther
Subject: [PATCH] Move print() methods ool
Date: Wed, 3 Dec 2003 21:53:42 +0100 (CET)

Hi!

The following patch moves print() methods out of the class bodies of
GridLayout and UniformGridLayout. It also moves out of line code to the
appropriate .cpp file instead of cluttering the header.

Ok?

Richard.

Index: GridLayout.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Layout/GridLayout.cpp,v
retrieving revision 1.89
diff -u -u -r1.89 GridLayout.cpp
--- GridLayout.cpp      11 Mar 2003 21:30:44 -0000      1.89
+++ GridLayout.cpp      3 Dec 2003 20:45:42 -0000
@@ -97,6 +97,13 @@
 }

 template<int Dim>
+GridLayoutData<Dim>::~GridLayoutData()
+{
+  for (typename List_t::iterator a = this->all_m.begin(); a != 
this->all_m.end(); ++a)
+    delete (*a);
+}
+
+template<int Dim>
 template <class Partitioner>
 inline void GridLayoutData<Dim>::initialize(const Grid<Dim> &gdom,
                       const Partitioner &gpar,
@@ -1127,6 +1134,33 @@
   return count;
 }

+template<int Dim>
+template<class Out>
+void GridLayoutData<Dim>::print(Out & ostr)
+{
+  int i;
+  ostr << " hasInternalGuards_m, hasExternalGuards_m "
+       << this->hasInternalGuards_m << ' ' << this->hasExternalGuards_m
+       << "\n internalGuards_m ";
+  for (i=0; i<Dim; ++i)
+    ostr << this->internalGuards_m.upper(i) << '-'
+        << this->internalGuards_m.lower(i) << ' ';
+  ostr << "\n externalGuards_m ";
+  for (i=0; i<Dim; ++i)
+    ostr << this->externalGuards_m.upper(i) << '-'
+        << this->externalGuards_m.lower(i) << ' ';
+  ostr << '\n';
+  FillIterator_t gstart = this->gcFillList_m.begin();
+  FillIterator_t gend = this->gcFillList_m.end();
+  ostr << " this->gcFillList_m\n";
+  for(; gstart!=gend; ++gstart)
+    ostr << "       "
+        << gstart->domain_m << ' '
+        << gstart->ownedID_m << ' '
+        << gstart->guardID_m << '\n';
+  ostr << std::flush;
+}
+


 //============================================================
@@ -1732,6 +1766,47 @@
 {
   this->pdata_m->initialize(gdom, gpar, cmap);
 }
+
+template <int Dim>
+template <class Ostream>
+void GridLayout<Dim>::print(Ostream &ostr) const
+{
+  ostr << "GridLayout " << this->ID() << " on global domain "
+       << this->domain() << ":" << '\n';
+  ostr << "   Total subdomains: " << this->sizeGlobal() << '\n';
+  ostr << "   Local subdomains: " << this->sizeLocal() << '\n';
+  ostr << "  Remote subdomains: " << this->sizeRemote() << '\n';
+  ostr << "        Grid blocks: " << this->blocks() << '\n';
+  typename GridLayout<Dim>::const_iterator a;
+  for (a = this->beginGlobal(); a != this->endGlobal(); ++a)
+    ostr << "  Global subdomain = " << *a << '\n';
+  for (a = this->beginLocal(); a != this->endLocal(); ++a)
+    ostr << "   Local subdomain = " << *a << '\n';
+  for (a = this->beginRemote(); a != this->endRemote(); ++a)
+    ostr << "  Remote subdomain = " << *a << '\n';
+  this->pdata_m->print(ostr);
+}
+
+template<int Dim, int Dim2>
+template <class Ostream>
+void GridLayoutView<Dim, Dim2>::print(Ostream &ostr) const
+{
+  ostr << "GridLayoutView " << this->ID() << " on global domain "
+       << this->domain() << ':' << '\n';
+  ostr << "   Base ID:          " << this->baseID() << '\n';
+  ostr << "   Base domain:      " << this->baseDomain() << '\n';
+  ostr << "   Total subdomains: " << this->sizeGlobal() << '\n';
+  ostr << "   Local subdomains: " << this->sizeLocal() << '\n';
+  ostr << "  Remote subdomains: " << this->sizeRemote() << '\n';
+  const_iterator a;
+  for (a = this->beginGlobal(); a != this->endGlobal(); ++a)
+    ostr << "  Global subdomain = " << *a << '\n';
+  for (a = this->beginLocal(); a != this->endLocal(); ++a)
+    ostr << "   Local subdomain = " << *a << '\n';
+  for (a = this->beginRemote(); a != this->endRemote(); ++a)
+    ostr << "  Remote subdomain = " << *a << '\n';
+}
+

 // } // namespace POOMA

Index: GridLayout.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Layout/GridLayout.h,v
retrieving revision 1.110
diff -u -u -r1.110 GridLayout.h
--- GridLayout.h        26 Oct 2003 11:28:11 -0000      1.110
+++ GridLayout.h        3 Dec 2003 20:45:44 -0000
@@ -207,11 +207,7 @@
   /// which case we need to delete our nodes. The Observable destructor
   /// will broadcast messages up to all observers of the Layout.

-  ~GridLayoutData()
-    {
-      for (typename List_t::iterator a = this->all_m.begin(); a != 
this->all_m.end(); ++a)
-       delete (*a);
-    }
+  ~GridLayoutData();

   //============================================================
   // Mutators
@@ -307,34 +303,13 @@
   /// can build either pointers or objects.

   template <class OtherDomain, class OutIter, class ConstructTag>
-    int touchesAlloc(const OtherDomain &fulld, OutIter o,
-                    const ConstructTag &ctag) const;
+  int touchesAlloc(const OtherDomain &fulld, OutIter o,
+                  const ConstructTag &ctag) const;

   void sync();

   template<class Out>
-  void print(Out & ostr)
-  {
-    int i;
-    ostr << " hasInternalGuards_m, hasExternalGuards_m " <<
-      this->hasInternalGuards_m <<" " << this->hasExternalGuards_m <<std::endl;
-    ostr << " internalGuards_m " ;
-    for ( i=0;i<Dim;++i)
-      ostr << 
this->internalGuards_m.upper(i)<<"-"<<this->internalGuards_m.lower(i)<<" ";
-    ostr <<std::endl;
-    ostr << " externalGuards_m " ;
-    for ( i=0;i<Dim;++i)
-      ostr << 
this->externalGuards_m.upper(i)<<"-"<<this->externalGuards_m.lower(i)<<" ";
-    ostr <<std::endl;
-    FillIterator_t gstart = this->gcFillList_m.begin();
-    FillIterator_t gend = this->gcFillList_m.end();
-    ostr<< " this->gcFillList_m " <<std::endl;
-    for( ; gstart!=gend ; ++gstart)
-      ostr<<"       "
-         <<gstart->domain_m<<" "
-         <<gstart->ownedID_m<<" "
-         <<gstart->guardID_m<<std::endl;
-  }
+  void print(Out & ostr);

 private:
   //============================================================
@@ -765,22 +740,7 @@
   /// Print a GridLayout on an output stream

   template <class Ostream>
-  void print(Ostream &ostr) const {
-    ostr << "GridLayout " << this->ID() << " on global domain "
-      << this->domain() << ":" << '\n';
-    ostr << "   Total subdomains: " << this->sizeGlobal() << '\n';
-    ostr << "   Local subdomains: " << this->sizeLocal() << '\n';
-    ostr << "  Remote subdomains: " << this->sizeRemote() << '\n';
-    ostr << "        Grid blocks: " << this->blocks() << '\n';
-    typename GridLayout<Dim>::const_iterator a;
-    for (a = this->beginGlobal(); a != this->endGlobal(); ++a)
-      ostr << "  Global subdomain = " << *a << '\n';
-    for (a = this->beginLocal(); a != this->endLocal(); ++a)
-      ostr << "   Local subdomain = " << *a << '\n';
-    for (a = this->beginRemote(); a != this->endRemote(); ++a)
-      ostr << "  Remote subdomain = " << *a << '\n';
-    this->pdata_m->print(ostr);
-  }
+  void print(Ostream &ostr) const;

 #if !POOMA_NO_TEMPLATE_FRIENDS

@@ -1041,23 +1001,7 @@
   // Print a GridLayoutView on an output stream

   template <class Ostream>
-  void print(Ostream &ostr) const
-  {
-    ostr << "GridLayoutView " << this->ID() << " on global domain "
-      << this->domain() << ":" << '\n';
-    ostr << "   Base ID:          " << this->baseID() << '\n';
-    ostr << "   Base domain:      " << this->baseDomain() << '\n';
-    ostr << "   Total subdomains: " << this->sizeGlobal() << '\n';
-    ostr << "   Local subdomains: " << this->sizeLocal() << '\n';
-    ostr << "  Remote subdomains: " << this->sizeRemote() << '\n';
-    const_iterator a;
-    for (a = this->beginGlobal(); a != this->endGlobal(); ++a)
-      ostr << "  Global subdomain = " << *a << '\n';
-    for (a = this->beginLocal(); a != this->endLocal(); ++a)
-      ostr << "   Local subdomain = " << *a << '\n';
-    for (a = this->beginRemote(); a != this->endRemote(); ++a)
-      ostr << "  Remote subdomain = " << *a << '\n';
-  }
+  void print(Ostream &ostr) const;

 #if !POOMA_NO_TEMPLATE_FRIENDS

Index: UniformGridLayout.cpp
===================================================================
RCS file: /home/pooma/Repository/r2/src/Layout/UniformGridLayout.cpp,v
retrieving revision 1.40
diff -u -u -r1.40 UniformGridLayout.cpp
--- UniformGridLayout.cpp       11 Mar 2003 21:30:44 -0000      1.40
+++ UniformGridLayout.cpp       3 Dec 2003 20:45:49 -0000
@@ -279,7 +279,7 @@
 //-----------------------------------------------------------------------------
 //
 // template <int Dim>
-// void UniformGridLayout<Dim>::calcGCFillList()
+// void UniformGridLayoutData<Dim>::calcGCFillList()
 //
 // Calculates the cached information needed by MultiPatch Engine to
 // fill the guard cells.
@@ -1182,6 +1182,950 @@
   // Return the number of non-empty domains we found.

   return count;
+}
+
+
+//=============================================================================
+// UniformGridLayout & UniformGridLayoutData inline method definitions
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+//
+// Constructors and Initialize methods
+//
+//-----------------------------------------------------------------------------
+
+// See comments in class definition above.
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout()
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t()),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const DistributedTag& t)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,
+                     UniformGridPartition<Dim>(),
+                     DistributedMapper<Dim>(UniformGridPartition<Dim>()))),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const ReplicatedTag & t)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,
+                     UniformGridPartition<Dim>(),
+                     LocalMapper<Dim>())),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const GuardLayers_t &gcs,
+                 const DistributedTag &)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,
+                     UniformGridPartition<Dim>(gcs),
+                     DistributedMapper<Dim>(UniformGridPartition<Dim>(gcs)))),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const GuardLayers_t &gcs,
+                 const ReplicatedTag & )
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,
+                     UniformGridPartition<Dim>(gcs),
+                     LocalMapper<Dim>())),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const Loc<Dim> &blocks,
+                 const DistributedTag & )
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,
+                     UniformGridPartition<Dim>(blocks),
+                     DistributedMapper<Dim>(
+                       UniformGridPartition<Dim>(blocks)))),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const Loc<Dim> &blocks,
+                 const ReplicatedTag & t)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,
+                     UniformGridPartition<Dim>(blocks),
+                     LocalMapper<Dim>())),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                  const Loc<Dim> &blocks,
+                  const GuardLayers_t &igcs,
+                 const DistributedTag &)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+   (new LayoutData_t(gdom,
+                    UniformGridPartition<Dim>(blocks,igcs),
+                    DistributedMapper<Dim>(
+                     UniformGridPartition<Dim>(blocks,igcs)))),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                  const Loc<Dim> &blocks,
+                  const GuardLayers_t &igcs,
+                 const ReplicatedTag &)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+     (new LayoutData_t(gdom,
+                      UniformGridPartition<Dim>(blocks,igcs),
+                      LocalMapper<Dim>())),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                  const Loc<Dim> &blocks,
+                  const GuardLayers_t &igcs,
+                  const GuardLayers_t &egcs,
+                 const DistributedTag &)
+
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,
+                     UniformGridPartition<Dim>(blocks,igcs,egcs),
+                     DistributedMapper<Dim>(
+                       UniformGridPartition<Dim>(blocks,igcs,egcs)))),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                  const Loc<Dim> &blocks,
+                  const GuardLayers_t &igcs,
+                  const GuardLayers_t &egcs,
+                 const ReplicatedTag &t)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,
+                     UniformGridPartition<Dim>(blocks,igcs,egcs),
+                     LocalMapper<Dim>())),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+template <class Partitioner>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const Partitioner &gpar,
+                 const DistributedTag & )
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+   (new LayoutData_t(gdom,gpar,DistributedMapper<Dim>(gpar))),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+template <class Partitioner>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const Partitioner &gpar,
+                 const ReplicatedTag &)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+   (new LayoutData_t(gdom,gpar,LocalMapper<Dim>())),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+template <class Partitioner>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const Domain_t &gdom,
+                 const Partitioner &gpar,
+                 const ContextMapper<Dim> & cmap)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >
+    (new LayoutData_t(gdom,gpar,cmap)),
+  Observable<This_t>(*this)
+{
+  this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim>::
+UniformGridLayout(const This_t &model)
+: LayoutBase<Dim,UniformGridLayoutData<Dim> >(model.pdata_m),
+  Observable<This_t>(*this)
+{
+   this->pdata_m->attach(*this);
+}
+
+template <int Dim>
+inline UniformGridLayout<Dim> & UniformGridLayout<Dim>::
+operator=(const This_t &model)
+{
+  if (this != &model)
+    {
+      this->pdata_m->detach(*this);
+      this->pdata_m = model.pdata_m;
+      this->pdata_m->attach(*this);
+    }
+  return *this;
+}
+
+// Initialize methods...
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+          const DistributedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(),
+                    DistributedMapper<Dim>(UniformGridPartition<Dim>()));
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+          const ReplicatedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(),
+                    LocalMapper<Dim>());
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+          const GuardLayers_t &gcs,
+          const DistributedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(gcs),
+                    DistributedMapper<Dim>(UniformGridPartition<Dim>(gcs) ));
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+          const GuardLayers_t &gcs,
+          const ReplicatedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(gcs),
+                    LocalMapper<Dim>());
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+          const Loc<Dim> &blocks,
+          const DistributedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(blocks),
+                   DistributedMapper<Dim>(UniformGridPartition<Dim>(blocks)));
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+          const Loc<Dim> &blocks,
+          const ReplicatedTag &)
+{
+  PAssert(!this->initialized());
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(blocks),
+                    LocalMapper<Dim>());
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+           const Loc<Dim> &blocks,
+           const GuardLayers_t &gcs,
+          const DistributedTag &)
+{
+  PAssert(!this->initialized());
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(blocks, gcs),
+                    DistributedMapper<Dim>(
+                      UniformGridPartition<Dim>(blocks, gcs)));
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+           const Loc<Dim> &blocks,
+           const GuardLayers_t &gcs,
+          const ReplicatedTag &)
+{
+  PAssert(!this->initialized());
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(blocks, gcs),
+                    LocalMapper<Dim>());
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+           const Loc<Dim> &blocks,
+           const GuardLayers_t &igcs,
+           const GuardLayers_t &egcs,
+          const DistributedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->partition(UniformGridPartition<Dim>(blocks, igcs, egcs),
+                    DistributedMapper<Dim>(
+                      UniformGridPartition<Dim>(blocks, igcs, egcs)));
+}
+
+template <int Dim>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+           const Loc<Dim> &blocks,
+           const GuardLayers_t &igcs,
+           const GuardLayers_t &egcs,
+          const ReplicatedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->blocks_m = blocks;
+  this->pdata_m->partition(UniformGridPartition<Dim>(blocks, igcs, egcs),
+                    LocalMapper<Dim>());
+}
+
+
+template <int Dim>
+template <class Partitioner>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+           const Partitioner &p,
+          const DistributedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->blocks_m = p.blocks();
+  this->pdata_m->partition(p,DistributedMapper<Dim>(p));
+}
+
+template <int Dim>
+template <class Partitioner>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+           const Partitioner &p,
+          const ReplicatedTag &)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->blocks_m = p.blocks();
+  this->pdata_m->partition(p,LocalMapper<Dim>());
+}
+template <int Dim>
+template <class Partitioner>
+inline void
+UniformGridLayout<Dim>::
+initialize(const Domain_t &gdom,
+           const Partitioner &p,
+          const ContextMapper<Dim> &cmap)
+{
+  PAssert(!this->initialized());
+
+  // Initialize our global domain, and then do the partitioning.
+
+  this->pdata_m->innerdomain_m = gdom;
+  this->pdata_m->domain_m = gdom;
+  this->pdata_m->blocks_m = p.blocks();
+  this->pdata_m->partition(p,cmap);
+}
+
+// This initializer is intented to be used by the I/O system
+
+template <int Dim>
+void UniformGridLayout<Dim>::initialize(const Domain_t& idom,
+                                const List_t& nodes,
+                                const Loc<Dim>& blocks,
+                                bool hasIG, bool hasEG,
+                                const GuardLayers_t& ig,
+                                const GuardLayers_t& eg)
+{
+  this->pdata_m->initialize(idom,nodes,blocks,hasIG,hasEG,ig,eg);
+}
+
+// Here are the implementations for globalID:
+
+template <int Dim>
+inline int
+UniformGridLayoutData<Dim>::globalID(const Loc<Dim> &loc) const
+{
+  // Make sure the point is in our domain.
+  PAssert(contains(this->domain_m, loc));
+  int currloc;
+
+  if (!this->hasExternalGuards_m)
+    {
+      currloc = (loc[0].first() - this->firsti_m[0]) / blocksizes_m[0];
+      for (int d = 1; d < Dim; ++d)
+        currloc += blockstride_m[d] *
+          ((loc[d].first() - this->firsti_m[d]) / blocksizes_m[d]);
+    }
+  else
+    {
+      currloc = 0;
+      for (int d = 0; d < Dim; ++d)
+        {
+          int l = loc[d].first();
+
+          // If l < this->firsti_m[0], currloc is unchanged.
+
+          if (l >= this->firsti_m[d])
+            {
+              if (l <= this->innerdomain_m[d].last())
+                {
+                  // The usual expression in this direction.
+
+                  currloc += blockstride_m[d] *
+                    ((l - this->firsti_m[d]) / blocksizes_m[d]);
+                }
+              else
+                {
+                  // Must be in the last block in this direction.
+
+                  currloc += blockstride_m[d] * allDomain_m[d].last();
+                }
+            }
+        }
+    }
+
+  // Return the globalID for the currloc's node
+
+  PAssert(currloc >= 0 && currloc < this->all_m.size());
+  return currloc;
+}
+
+template <int Dim>
+inline int
+UniformGridLayoutData<Dim>::globalID(int i0) const
+{
+  PAssert(Dim == 1);
+  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
+
+  // Compute fortran-order index from position in block grid
+  // See the Loc<Dim> version for comments.
+
+  int currloc;
+  if (!this->hasExternalGuards_m)
+    {
+      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
+    }
+  else
+    {
+      currloc = 0;
+      if (i0 >= this->firsti_m[0]) {
+        if (i0 <= this->innerdomain_m[0].last())
+          currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
+        else
+          currloc = allDomain_m[0].last();
+      }
+    }
+
+  // Return the globalID for the currloc's node.
+
+  PAssert(currloc >= 0 && currloc < this->all_m.size());
+  return currloc;
+}
+
+template <int Dim>
+inline int
+UniformGridLayoutData<Dim>::globalID(int i0, int i1) const
+{
+  PAssert(Dim == 2);
+  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
+  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
+
+  // Compute fortran-order index from position in block grid
+
+  int currloc;
+  if (!this->hasExternalGuards_m)
+    {
+      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
+              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
+    }
+  else
+    {
+      currloc = 0;
+      if (i0 >= this->firsti_m[0]) {
+        if (i0 <= this->innerdomain_m[0].last())
+          currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
+        else
+          currloc = allDomain_m[0].last();
+      }
+      if (i1 >= this->firsti_m[1]) {
+        if (i1 <= this->innerdomain_m[1].last())
+          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
+        else
+          currloc += blockstride_m[1] * allDomain_m[1].last();
+      }
+    }
+
+  // Return the globalID for the currloc's node
+
+  PAssert(currloc >= 0 && currloc < this->all_m.size());
+  return currloc;
+}
+
+template <int Dim>
+inline int
+UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2) const
+{
+  PAssert(Dim == 3);
+  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
+  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
+  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
+
+  // Compute fortran-order index from position in block grid
+
+  int currloc;
+  if (!this->hasExternalGuards_m)
+    {
+      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
+              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
+              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
+    }
+  else
+    {
+      currloc = 0;
+      if (i0 >= this->firsti_m[0]) {
+        if (i0 <= this->innerdomain_m[0].last())
+          currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
+        else
+          currloc = allDomain_m[0].last();
+      }
+      if (i1 >= this->firsti_m[1]) {
+        if (i1 <= this->innerdomain_m[1].last())
+          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
+        else
+          currloc += blockstride_m[1] * allDomain_m[1].last();
+      }
+      if (i2 >= this->firsti_m[2]) {
+        if (i2 <= this->innerdomain_m[2].last())
+          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
+        else
+          currloc += blockstride_m[2] * allDomain_m[2].last();
+      }
+    }
+
+  // Return the globalID for the currloc's node
+
+  PAssert(currloc >= 0 && currloc < this->all_m.size());
+  return currloc;
+}
+
+template <int Dim>
+inline int
+UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2, int i3) const
+{
+  PAssert(Dim == 4);
+  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
+  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
+  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
+  PAssert(i3 >= this->domain_m[3].first() && i3 <= this->domain_m[3].last());
+
+  // Compute fortran-order index from position in block grid
+
+  int currloc;
+  if (!this->hasExternalGuards_m)
+    {
+      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
+              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
+              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / blocksizes_m[2])
+              + blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
+    }
+  else
+    {
+      currloc = 0;
+      if (i0 >= this->firsti_m[0]) {
+        if (i0 <= this->innerdomain_m[0].last())
+           currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
+        else
+           currloc = allDomain_m[0].last();
+      }
+      if (i1 >= this->firsti_m[1]) {
+        if (i1 <= this->innerdomain_m[1].last())
+          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
+        else
+          currloc += blockstride_m[1] * allDomain_m[1].last();
+      }
+      if (i2 >= this->firsti_m[2]) {
+        if (i2 <= this->innerdomain_m[2].last())
+          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
+        else
+          currloc += blockstride_m[2] * allDomain_m[2].last();
+      }
+      if (i3 >= this->firsti_m[3]) {
+        if (i3 <= this->innerdomain_m[3].last())
+          currloc += blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
+        else
+          currloc += blockstride_m[3] * allDomain_m[3].last();
+      }
+    }
+
+  // Return the globalID for the currloc's node
+
+  PAssert(currloc >= 0 && currloc < this->all_m.size());
+  return currloc;
+}
+
+template <int Dim>
+inline int
+UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2, int i3,
+                                     int i4) const
+{
+  PAssert(Dim == 5);
+  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
+  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
+  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
+  PAssert(i3 >= this->domain_m[3].first() && i3 <= this->domain_m[3].last());
+  PAssert(i4 >= this->domain_m[4].first() && i4 <= this->domain_m[4].last());
+
+  // Compute fortran-order index from position in block grid
+
+  int currloc;
+  if (!this->hasExternalGuards_m)
+    {
+      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
+              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
+              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / blocksizes_m[2])
+              + blockstride_m[3] * ((i3 - this->firsti_m[3]) / blocksizes_m[3])
+              + blockstride_m[4] * ((i4 - this->firsti_m[4]) / 
blocksizes_m[4]);
+    }
+  else
+    {
+      currloc = 0;
+      if (i0 >= this->firsti_m[0]) {
+        if (i0 <= this->innerdomain_m[0].last())
+           currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
+        else
+           currloc = allDomain_m[0].last();
+      }
+      if (i1 >= this->firsti_m[1]) {
+        if (i1 <= this->innerdomain_m[1].last())
+          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
+        else
+          currloc += blockstride_m[1] * allDomain_m[1].last();
+      }
+      if (i2 >= this->firsti_m[2]) {
+        if (i2 <= this->innerdomain_m[2].last())
+          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
+        else
+          currloc += blockstride_m[2] * allDomain_m[2].last();
+      }
+      if (i3 >= this->firsti_m[3]) {
+        if (i3 <= this->innerdomain_m[3].last())
+          currloc += blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
+        else
+          currloc += blockstride_m[3] * allDomain_m[3].last();
+      }
+      if (i4 >= this->firsti_m[4]) {
+        if (i4 <= this->innerdomain_m[4].last())
+          currloc += blockstride_m[4] * ((i4 - this->firsti_m[4]) / 
blocksizes_m[4]);
+        else
+          currloc += blockstride_m[4] * allDomain_m[4].last();
+      }
+    }
+
+  // Return the globalID for the currloc's node
+
+  PAssert(currloc >= 0 && currloc < this->all_m.size());
+  return currloc;
+}
+
+template <int Dim>
+inline int
+UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2, int i3,
+                                     int i4, int i5) const
+{
+  PAssert(Dim == 6);
+  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
+  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
+  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
+  PAssert(i3 >= this->domain_m[3].first() && i3 <= this->domain_m[3].last());
+  PAssert(i4 >= this->domain_m[4].first() && i4 <= this->domain_m[4].last());
+  PAssert(i5 >= this->domain_m[5].first() && i5 <= this->domain_m[5].last());
+
+  // Compute fortran-order index from position in block grid
+
+  int currloc;
+  if (!this->hasExternalGuards_m)
+    {
+      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
+              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
+              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / blocksizes_m[2])
+              + blockstride_m[3] * ((i3 - this->firsti_m[3]) / blocksizes_m[3])
+              + blockstride_m[4] * ((i4 - this->firsti_m[4]) / blocksizes_m[4])
+              + blockstride_m[5] * ((i5 - this->firsti_m[5]) / 
blocksizes_m[5]);
+    }
+  else
+    {
+      currloc = 0;
+      if (i0 >= this->firsti_m[0]) {
+        if (i0 <= this->innerdomain_m[0].last())
+           currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
+        else
+           currloc = allDomain_m[0].last();
+      }
+      if (i1 >= this->firsti_m[1]) {
+        if (i1 <= this->innerdomain_m[1].last())
+          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
+        else
+          currloc += blockstride_m[1] * allDomain_m[1].last();
+      }
+      if (i2 >= this->firsti_m[2]) {
+        if (i2 <= this->innerdomain_m[2].last())
+          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
+        else
+          currloc += blockstride_m[2] * allDomain_m[2].last();
+      }
+      if (i3 >= this->firsti_m[3]) {
+        if (i3 <= this->innerdomain_m[3].last())
+          currloc += blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
+        else
+          currloc += blockstride_m[3] * allDomain_m[3].last();
+      }
+      if (i4 >= this->firsti_m[4]) {
+        if (i4 <= this->innerdomain_m[4].last())
+          currloc += blockstride_m[4] * ((i4 - this->firsti_m[4]) / 
blocksizes_m[4]);
+        else
+          currloc += blockstride_m[4] * allDomain_m[4].last();
+      }
+      if (i5 >= this->firsti_m[5]) {
+        if (i5 <= this->innerdomain_m[5].last())
+          currloc += blockstride_m[5] * ((i5 - this->firsti_m[5]) / 
blocksizes_m[5]);
+        else
+          currloc += blockstride_m[5] * allDomain_m[5].last();
+      }
+    }
+
+  // Return the globalID for the currloc's node
+
+  PAssert(currloc >= 0 && currloc < this->all_m.size());
+  return currloc;
+}
+
+template <int Dim>
+inline int
+UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2, int i3,
+                                     int i4, int i5, int i6) const
+{
+  PAssert(Dim == 7);
+  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
+  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
+  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
+  PAssert(i3 >= this->domain_m[3].first() && i3 <= this->domain_m[3].last());
+  PAssert(i4 >= this->domain_m[4].first() && i4 <= this->domain_m[4].last());
+  PAssert(i5 >= this->domain_m[5].first() && i5 <= this->domain_m[5].last());
+  PAssert(i6 >= this->domain_m[6].first() && i6 <= this->domain_m[6].last());
+
+  // Compute fortran-order index from position in block grid
+
+  int currloc;
+  if (!this->hasExternalGuards_m)
+    {
+      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
+              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
+              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / blocksizes_m[2])
+              + blockstride_m[3] * ((i3 - this->firsti_m[3]) / blocksizes_m[3])
+              + blockstride_m[4] * ((i4 - this->firsti_m[4]) / blocksizes_m[4])
+              + blockstride_m[5] * ((i5 - this->firsti_m[5]) / blocksizes_m[5])
+              + blockstride_m[6] * ((i6 - this->firsti_m[6]) / 
blocksizes_m[6]);
+    }
+  else
+    {
+      currloc = 0;
+      if (i0 >= this->firsti_m[0]) {
+        if (i0 <= this->innerdomain_m[0].last())
+           currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
+        else
+           currloc = allDomain_m[0].last();
+      }
+      if (i1 >= this->firsti_m[1]) {
+        if (i1 <= this->innerdomain_m[1].last())
+          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
+        else
+          currloc += blockstride_m[1] * allDomain_m[1].last();
+      }
+      if (i2 >= this->firsti_m[2]) {
+        if (i2 <= this->innerdomain_m[2].last())
+          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
+        else
+          currloc += blockstride_m[2] * allDomain_m[2].last();
+      }
+      if (i3 >= this->firsti_m[3]) {
+        if (i3 <= this->innerdomain_m[3].last())
+          currloc += blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
+        else
+          currloc += blockstride_m[3] * allDomain_m[3].last();
+      }
+      if (i4 >= this->firsti_m[4]) {
+        if (i4 <= this->innerdomain_m[4].last())
+          currloc += blockstride_m[4] * ((i4 - this->firsti_m[4]) / 
blocksizes_m[4]);
+        else
+          currloc += blockstride_m[4] * allDomain_m[4].last();
+      }
+      if (i5 >= this->firsti_m[5]) {
+        if (i5 <= this->innerdomain_m[5].last())
+          currloc += blockstride_m[5] * ((i5 - this->firsti_m[5]) / 
blocksizes_m[5]);
+        else
+          currloc += blockstride_m[5] * allDomain_m[5].last();
+      }
+      if (i6 >= this->firsti_m[6]) {
+        if (i6 <= this->innerdomain_m[6].last())
+          currloc += blockstride_m[6] * ((i6 - this->firsti_m[6]) / 
blocksizes_m[6]);
+        else
+          currloc += blockstride_m[6] * allDomain_m[6].last();
+      }
+    }
+
+  // Return the globalID for the currloc's node
+
+  PAssert(currloc >= 0 && currloc < this->all_m.size());
+  return currloc;
+}
+
+
+template <int Dim>
+template <class Ostream>
+void UniformGridLayout<Dim>::print(Ostream &ostr) const
+{
+  ostr << "UniformGridLayout " << this->ID() << " on global domain "
+       << this->domain() << ":" << '\n';
+  ostr << "   Total subdomains: " << this->sizeGlobal() << '\n';
+  ostr << "   Local subdomains: " << this->sizeLocal() << '\n';
+  ostr << "  Remote subdomains: " << this->sizeRemote() << '\n';
+  ostr << "        Grid blocks: " << this->blocks() << '\n';
+  typename UniformGridLayout<Dim>::const_iterator a;
+  for (a = this->beginGlobal(); a != this->endGlobal(); ++a)
+    ostr << "  Global subdomain = " << *a << '\n';
+  for (a = this->beginLocal(); a != this->endLocal(); ++a)
+    ostr << "   Local subdomain = " << *a << '\n';
+  for (a = this->beginRemote(); a != this->endRemote(); ++a)
+    ostr << "  Remote subdomain = " << *a << '\n';
+}
+
+template <int Dim, int Dim2>
+template <class Ostream>
+void UniformGridLayoutView<Dim, Dim2>::print(Ostream &ostr) const
+{
+  ostr << "UniformGridLayoutView " << this->ID() << " on global domain "
+       << this->domain() << ":" << '\n';
+  ostr << "   Base ID:          " << this->baseID() << '\n';
+  ostr << "   Base domain:      " << this->baseDomain() << '\n';
+  ostr << "   Total subdomains: " << this->sizeGlobal() << '\n';
+  ostr << "   Local subdomains: " << this->sizeLocal() << '\n';
+  ostr << "  Remote subdomains: " << this->sizeRemote() << '\n';
+  const_iterator a;
+  for (a = this->beginGlobal(); a != this->endGlobal(); ++a)
+    ostr << "  Global subdomain = " << *a << '\n';
+  for (a = this->beginLocal(); a != this->endLocal(); ++a)
+    ostr << "   Local subdomain = " << *a << '\n';
+  for (a = this->beginRemote(); a != this->endRemote(); ++a)
+    ostr << "  Remote subdomain = " << *a << '\n';
 }


Index: UniformGridLayout.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Layout/UniformGridLayout.h,v
retrieving revision 1.87
diff -u -u -r1.87 UniformGridLayout.h
--- UniformGridLayout.h 26 Oct 2003 11:28:11 -0000      1.87
+++ UniformGridLayout.h 3 Dec 2003 20:45:51 -0000
@@ -596,21 +596,7 @@
   // Print a UniformGridLayout on an output stream

   template <class Ostream>
-  void print(Ostream &ostr) const {
-    ostr << "UniformGridLayout " << this->ID() << " on global domain "
-      << this->domain() << ":" << '\n';
-    ostr << "   Total subdomains: " << this->sizeGlobal() << '\n';
-    ostr << "   Local subdomains: " << this->sizeLocal() << '\n';
-    ostr << "  Remote subdomains: " << this->sizeRemote() << '\n';
-    ostr << "        Grid blocks: " << this->blocks() << '\n';
-    typename UniformGridLayout<Dim>::const_iterator a;
-    for (a = this->beginGlobal(); a != this->endGlobal(); ++a)
-      ostr << "  Global subdomain = " << *a << '\n';
-    for (a = this->beginLocal(); a != this->endLocal(); ++a)
-      ostr << "   Local subdomain = " << *a << '\n';
-    for (a = this->beginRemote(); a != this->endRemote(); ++a)
-      ostr << "  Remote subdomain = " << *a << '\n';
-  }
+  void print(Ostream &ostr) const;


 #if !POOMA_NO_TEMPLATE_FRIENDS
@@ -881,23 +867,7 @@
   // Print a UniformGridLayoutView on an output stream

   template <class Ostream>
-  void print(Ostream &ostr) const
-  {
-    ostr << "UniformGridLayoutView " << this->ID() << " on global domain "
-      << this->domain() << ":" << '\n';
-    ostr << "   Base ID:          " << this->baseID() << '\n';
-    ostr << "   Base domain:      " << this->baseDomain() << '\n';
-    ostr << "   Total subdomains: " << this->sizeGlobal() << '\n';
-    ostr << "   Local subdomains: " << this->sizeLocal() << '\n';
-    ostr << "  Remote subdomains: " << this->sizeRemote() << '\n';
-    const_iterator a;
-    for (a = this->beginGlobal(); a != this->endGlobal(); ++a)
-      ostr << "  Global subdomain = " << *a << '\n';
-    for (a = this->beginLocal(); a != this->endLocal(); ++a)
-      ostr << "   Local subdomain = " << *a << '\n';
-    for (a = this->beginRemote(); a != this->endRemote(); ++a)
-      ostr << "  Remote subdomain = " << *a << '\n';
-  }
+  void print(Ostream &ostr) const;

 #if !POOMA_NO_TEMPLATE_FRIENDS

@@ -922,909 +892,6 @@

 };

-
-//=============================================================================
-// UniformGridLayout & UniformGridLayoutData inline method definitions
-//=============================================================================
-
-//-----------------------------------------------------------------------------
-//
-// Constructors and Initialize methods
-//
-//-----------------------------------------------------------------------------
-
-// See comments in class definition above.
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout()
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t()),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const DistributedTag& t)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,
-                     UniformGridPartition<Dim>(),
-                     DistributedMapper<Dim>(UniformGridPartition<Dim>()))),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const ReplicatedTag & t)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,
-                     UniformGridPartition<Dim>(),
-                     LocalMapper<Dim>())),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const GuardLayers_t &gcs,
-                 const DistributedTag &)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,
-                     UniformGridPartition<Dim>(gcs),
-                     DistributedMapper<Dim>(UniformGridPartition<Dim>(gcs)))),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const GuardLayers_t &gcs,
-                 const ReplicatedTag & )
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,
-                     UniformGridPartition<Dim>(gcs),
-                     LocalMapper<Dim>())),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const Loc<Dim> &blocks,
-                 const DistributedTag & )
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,
-                     UniformGridPartition<Dim>(blocks),
-                     DistributedMapper<Dim>(
-                       UniformGridPartition<Dim>(blocks)))),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const Loc<Dim> &blocks,
-                 const ReplicatedTag & t)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,
-                     UniformGridPartition<Dim>(blocks),
-                     LocalMapper<Dim>())),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                  const Loc<Dim> &blocks,
-                  const GuardLayers_t &igcs,
-                 const DistributedTag &)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-   (new LayoutData_t(gdom,
-                    UniformGridPartition<Dim>(blocks,igcs),
-                    DistributedMapper<Dim>(
-                     UniformGridPartition<Dim>(blocks,igcs)))),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                  const Loc<Dim> &blocks,
-                  const GuardLayers_t &igcs,
-                 const ReplicatedTag &)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-     (new LayoutData_t(gdom,
-                      UniformGridPartition<Dim>(blocks,igcs),
-                      LocalMapper<Dim>())),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                  const Loc<Dim> &blocks,
-                  const GuardLayers_t &igcs,
-                  const GuardLayers_t &egcs,
-                 const DistributedTag &)
-
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,
-                     UniformGridPartition<Dim>(blocks,igcs,egcs),
-                     DistributedMapper<Dim>(
-                       UniformGridPartition<Dim>(blocks,igcs,egcs)))),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                  const Loc<Dim> &blocks,
-                  const GuardLayers_t &igcs,
-                  const GuardLayers_t &egcs,
-                 const ReplicatedTag &t)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,
-                     UniformGridPartition<Dim>(blocks,igcs,egcs),
-                     LocalMapper<Dim>())),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-template <class Partitioner>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const Partitioner &gpar,
-                 const DistributedTag & )
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-   (new LayoutData_t(gdom,gpar,DistributedMapper<Dim>(gpar))),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-template <class Partitioner>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const Partitioner &gpar,
-                 const ReplicatedTag &)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-   (new LayoutData_t(gdom,gpar,LocalMapper<Dim>())),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-template <class Partitioner>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const Domain_t &gdom,
-                 const Partitioner &gpar,
-                 const ContextMapper<Dim> & cmap)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >
-    (new LayoutData_t(gdom,gpar,cmap)),
-  Observable<This_t>(*this)
-{
-  this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim>::
-UniformGridLayout(const This_t &model)
-: LayoutBase<Dim,UniformGridLayoutData<Dim> >(model.pdata_m),
-  Observable<This_t>(*this)
-{
-   this->pdata_m->attach(*this);
-}
-
-template <int Dim>
-inline UniformGridLayout<Dim> & UniformGridLayout<Dim>::
-operator=(const This_t &model)
-{
-  if (this != &model)
-    {
-      this->pdata_m->detach(*this);
-      this->pdata_m = model.pdata_m;
-      this->pdata_m->attach(*this);
-    }
-  return *this;
-}
-
-// Initialize methods...
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-          const DistributedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(),
-                    DistributedMapper<Dim>(UniformGridPartition<Dim>()));
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-          const ReplicatedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(),
-                    LocalMapper<Dim>());
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-          const GuardLayers_t &gcs,
-          const DistributedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(gcs),
-                    DistributedMapper<Dim>(UniformGridPartition<Dim>(gcs) ));
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-          const GuardLayers_t &gcs,
-          const ReplicatedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(gcs),
-                    LocalMapper<Dim>());
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-          const Loc<Dim> &blocks,
-          const DistributedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(blocks),
-                   DistributedMapper<Dim>(UniformGridPartition<Dim>(blocks)));
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-          const Loc<Dim> &blocks,
-          const ReplicatedTag &)
-{
-  PAssert(!this->initialized());
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(blocks),
-                    LocalMapper<Dim>());
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-           const Loc<Dim> &blocks,
-           const GuardLayers_t &gcs,
-          const DistributedTag &)
-{
-  PAssert(!this->initialized());
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(blocks, gcs),
-                    DistributedMapper<Dim>(
-                      UniformGridPartition<Dim>(blocks, gcs)));
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-           const Loc<Dim> &blocks,
-           const GuardLayers_t &gcs,
-          const ReplicatedTag &)
-{
-  PAssert(!this->initialized());
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(blocks, gcs),
-                    LocalMapper<Dim>());
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-           const Loc<Dim> &blocks,
-           const GuardLayers_t &igcs,
-           const GuardLayers_t &egcs,
-          const DistributedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->partition(UniformGridPartition<Dim>(blocks, igcs, egcs),
-                    DistributedMapper<Dim>(
-                      UniformGridPartition<Dim>(blocks, igcs, egcs)));
-}
-
-template <int Dim>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-           const Loc<Dim> &blocks,
-           const GuardLayers_t &igcs,
-           const GuardLayers_t &egcs,
-          const ReplicatedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->blocks_m = blocks;
-  this->pdata_m->partition(UniformGridPartition<Dim>(blocks, igcs, egcs),
-                    LocalMapper<Dim>());
-}
-
-
-template <int Dim>
-template <class Partitioner>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-           const Partitioner &p,
-          const DistributedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->blocks_m = p.blocks();
-  this->pdata_m->partition(p,DistributedMapper<Dim>(p));
-}
-
-template <int Dim>
-template <class Partitioner>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-           const Partitioner &p,
-          const ReplicatedTag &)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->blocks_m = p.blocks();
-  this->pdata_m->partition(p,LocalMapper<Dim>());
-}
-template <int Dim>
-template <class Partitioner>
-inline void
-UniformGridLayout<Dim>::
-initialize(const Domain_t &gdom,
-           const Partitioner &p,
-          const ContextMapper<Dim> &cmap)
-{
-  PAssert(!this->initialized());
-
-  // Initialize our global domain, and then do the partitioning.
-
-  this->pdata_m->innerdomain_m = gdom;
-  this->pdata_m->domain_m = gdom;
-  this->pdata_m->blocks_m = p.blocks();
-  this->pdata_m->partition(p,cmap);
-}
-
-// This initializer is intented to be used by the I/O system
-
-template <int Dim>
-void UniformGridLayout<Dim>::initialize(const Domain_t& idom,
-                                const List_t& nodes,
-                                const Loc<Dim>& blocks,
-                                bool hasIG, bool hasEG,
-                                const GuardLayers_t& ig,
-                                const GuardLayers_t& eg)
-{
-  this->pdata_m->initialize(idom,nodes,blocks,hasIG,hasEG,ig,eg);
-}
-
-// Here are the implementations for globalID:
-
-template <int Dim>
-inline int
-UniformGridLayoutData<Dim>::globalID(const Loc<Dim> &loc) const
-{
-  // Make sure the point is in our domain.
-  PAssert(contains(this->domain_m, loc));
-  int currloc;
-
-  if (!this->hasExternalGuards_m)
-    {
-      currloc = (loc[0].first() - this->firsti_m[0]) / blocksizes_m[0];
-      for (int d = 1; d < Dim; ++d)
-        currloc += blockstride_m[d] *
-          ((loc[d].first() - this->firsti_m[d]) / blocksizes_m[d]);
-    }
-  else
-    {
-      currloc = 0;
-      for (int d = 0; d < Dim; ++d)
-        {
-          int l = loc[d].first();
-
-          // If l < this->firsti_m[0], currloc is unchanged.
-
-          if (l >= this->firsti_m[d])
-            {
-              if (l <= this->innerdomain_m[d].last())
-                {
-                  // The usual expression in this direction.
-
-                  currloc += blockstride_m[d] *
-                    ((l - this->firsti_m[d]) / blocksizes_m[d]);
-                }
-              else
-                {
-                  // Must be in the last block in this direction.
-
-                  currloc += blockstride_m[d] * allDomain_m[d].last();
-                }
-            }
-        }
-    }
-
-  // Return the globalID for the currloc's node
-
-  PAssert(currloc >= 0 && currloc < this->all_m.size());
-  return currloc;
-}
-
-template <int Dim>
-inline int
-UniformGridLayoutData<Dim>::globalID(int i0) const
-{
-  PAssert(Dim == 1);
-  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
-
-  // Compute fortran-order index from position in block grid
-  // See the Loc<Dim> version for comments.
-
-  int currloc;
-  if (!this->hasExternalGuards_m)
-    {
-      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
-    }
-  else
-    {
-      currloc = 0;
-      if (i0 >= this->firsti_m[0]) {
-        if (i0 <= this->innerdomain_m[0].last())
-          currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
-        else
-          currloc = allDomain_m[0].last();
-      }
-    }
-
-  // Return the globalID for the currloc's node.
-
-  PAssert(currloc >= 0 && currloc < this->all_m.size());
-  return currloc;
-}
-
-template <int Dim>
-inline int
-UniformGridLayoutData<Dim>::globalID(int i0, int i1) const
-{
-  PAssert(Dim == 2);
-  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
-  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
-
-  // Compute fortran-order index from position in block grid
-
-  int currloc;
-  if (!this->hasExternalGuards_m)
-    {
-      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
-              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
-    }
-  else
-    {
-      currloc = 0;
-      if (i0 >= this->firsti_m[0]) {
-        if (i0 <= this->innerdomain_m[0].last())
-          currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
-        else
-          currloc = allDomain_m[0].last();
-      }
-      if (i1 >= this->firsti_m[1]) {
-        if (i1 <= this->innerdomain_m[1].last())
-          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
-        else
-          currloc += blockstride_m[1] * allDomain_m[1].last();
-      }
-    }
-
-  // Return the globalID for the currloc's node
-
-  PAssert(currloc >= 0 && currloc < this->all_m.size());
-  return currloc;
-}
-
-template <int Dim>
-inline int
-UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2) const
-{
-  PAssert(Dim == 3);
-  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
-  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
-  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
-
-  // Compute fortran-order index from position in block grid
-
-  int currloc;
-  if (!this->hasExternalGuards_m)
-    {
-      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
-              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
-              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
-    }
-  else
-    {
-      currloc = 0;
-      if (i0 >= this->firsti_m[0]) {
-        if (i0 <= this->innerdomain_m[0].last())
-          currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
-        else
-          currloc = allDomain_m[0].last();
-      }
-      if (i1 >= this->firsti_m[1]) {
-        if (i1 <= this->innerdomain_m[1].last())
-          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
-        else
-          currloc += blockstride_m[1] * allDomain_m[1].last();
-      }
-      if (i2 >= this->firsti_m[2]) {
-        if (i2 <= this->innerdomain_m[2].last())
-          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
-        else
-          currloc += blockstride_m[2] * allDomain_m[2].last();
-      }
-    }
-
-  // Return the globalID for the currloc's node
-
-  PAssert(currloc >= 0 && currloc < this->all_m.size());
-  return currloc;
-}
-
-template <int Dim>
-inline int
-UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2, int i3) const
-{
-  PAssert(Dim == 4);
-  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
-  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
-  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
-  PAssert(i3 >= this->domain_m[3].first() && i3 <= this->domain_m[3].last());
-
-  // Compute fortran-order index from position in block grid
-
-  int currloc;
-  if (!this->hasExternalGuards_m)
-    {
-      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
-              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
-              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / blocksizes_m[2])
-              + blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
-    }
-  else
-    {
-      currloc = 0;
-      if (i0 >= this->firsti_m[0]) {
-        if (i0 <= this->innerdomain_m[0].last())
-           currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
-        else
-           currloc = allDomain_m[0].last();
-      }
-      if (i1 >= this->firsti_m[1]) {
-        if (i1 <= this->innerdomain_m[1].last())
-          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
-        else
-          currloc += blockstride_m[1] * allDomain_m[1].last();
-      }
-      if (i2 >= this->firsti_m[2]) {
-        if (i2 <= this->innerdomain_m[2].last())
-          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
-        else
-          currloc += blockstride_m[2] * allDomain_m[2].last();
-      }
-      if (i3 >= this->firsti_m[3]) {
-        if (i3 <= this->innerdomain_m[3].last())
-          currloc += blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
-        else
-          currloc += blockstride_m[3] * allDomain_m[3].last();
-      }
-    }
-
-  // Return the globalID for the currloc's node
-
-  PAssert(currloc >= 0 && currloc < this->all_m.size());
-  return currloc;
-}
-
-template <int Dim>
-inline int
-UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2, int i3,
-                                     int i4) const
-{
-  PAssert(Dim == 5);
-  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
-  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
-  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
-  PAssert(i3 >= this->domain_m[3].first() && i3 <= this->domain_m[3].last());
-  PAssert(i4 >= this->domain_m[4].first() && i4 <= this->domain_m[4].last());
-
-  // Compute fortran-order index from position in block grid
-
-  int currloc;
-  if (!this->hasExternalGuards_m)
-    {
-      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
-              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
-              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / blocksizes_m[2])
-              + blockstride_m[3] * ((i3 - this->firsti_m[3]) / blocksizes_m[3])
-              + blockstride_m[4] * ((i4 - this->firsti_m[4]) / 
blocksizes_m[4]);
-    }
-  else
-    {
-      currloc = 0;
-      if (i0 >= this->firsti_m[0]) {
-        if (i0 <= this->innerdomain_m[0].last())
-           currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
-        else
-           currloc = allDomain_m[0].last();
-      }
-      if (i1 >= this->firsti_m[1]) {
-        if (i1 <= this->innerdomain_m[1].last())
-          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
-        else
-          currloc += blockstride_m[1] * allDomain_m[1].last();
-      }
-      if (i2 >= this->firsti_m[2]) {
-        if (i2 <= this->innerdomain_m[2].last())
-          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
-        else
-          currloc += blockstride_m[2] * allDomain_m[2].last();
-      }
-      if (i3 >= this->firsti_m[3]) {
-        if (i3 <= this->innerdomain_m[3].last())
-          currloc += blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
-        else
-          currloc += blockstride_m[3] * allDomain_m[3].last();
-      }
-      if (i4 >= this->firsti_m[4]) {
-        if (i4 <= this->innerdomain_m[4].last())
-          currloc += blockstride_m[4] * ((i4 - this->firsti_m[4]) / 
blocksizes_m[4]);
-        else
-          currloc += blockstride_m[4] * allDomain_m[4].last();
-      }
-    }
-
-  // Return the globalID for the currloc's node
-
-  PAssert(currloc >= 0 && currloc < this->all_m.size());
-  return currloc;
-}
-
-template <int Dim>
-inline int
-UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2, int i3,
-                                     int i4, int i5) const
-{
-  PAssert(Dim == 6);
-  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
-  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
-  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
-  PAssert(i3 >= this->domain_m[3].first() && i3 <= this->domain_m[3].last());
-  PAssert(i4 >= this->domain_m[4].first() && i4 <= this->domain_m[4].last());
-  PAssert(i5 >= this->domain_m[5].first() && i5 <= this->domain_m[5].last());
-
-  // Compute fortran-order index from position in block grid
-
-  int currloc;
-  if (!this->hasExternalGuards_m)
-    {
-      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
-              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
-              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / blocksizes_m[2])
-              + blockstride_m[3] * ((i3 - this->firsti_m[3]) / blocksizes_m[3])
-              + blockstride_m[4] * ((i4 - this->firsti_m[4]) / blocksizes_m[4])
-              + blockstride_m[5] * ((i5 - this->firsti_m[5]) / 
blocksizes_m[5]);
-    }
-  else
-    {
-      currloc = 0;
-      if (i0 >= this->firsti_m[0]) {
-        if (i0 <= this->innerdomain_m[0].last())
-           currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
-        else
-           currloc = allDomain_m[0].last();
-      }
-      if (i1 >= this->firsti_m[1]) {
-        if (i1 <= this->innerdomain_m[1].last())
-          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
-        else
-          currloc += blockstride_m[1] * allDomain_m[1].last();
-      }
-      if (i2 >= this->firsti_m[2]) {
-        if (i2 <= this->innerdomain_m[2].last())
-          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
-        else
-          currloc += blockstride_m[2] * allDomain_m[2].last();
-      }
-      if (i3 >= this->firsti_m[3]) {
-        if (i3 <= this->innerdomain_m[3].last())
-          currloc += blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
-        else
-          currloc += blockstride_m[3] * allDomain_m[3].last();
-      }
-      if (i4 >= this->firsti_m[4]) {
-        if (i4 <= this->innerdomain_m[4].last())
-          currloc += blockstride_m[4] * ((i4 - this->firsti_m[4]) / 
blocksizes_m[4]);
-        else
-          currloc += blockstride_m[4] * allDomain_m[4].last();
-      }
-      if (i5 >= this->firsti_m[5]) {
-        if (i5 <= this->innerdomain_m[5].last())
-          currloc += blockstride_m[5] * ((i5 - this->firsti_m[5]) / 
blocksizes_m[5]);
-        else
-          currloc += blockstride_m[5] * allDomain_m[5].last();
-      }
-    }
-
-  // Return the globalID for the currloc's node
-
-  PAssert(currloc >= 0 && currloc < this->all_m.size());
-  return currloc;
-}
-
-template <int Dim>
-inline int
-UniformGridLayoutData<Dim>::globalID(int i0, int i1, int i2, int i3,
-                                     int i4, int i5, int i6) const
-{
-  PAssert(Dim == 7);
-  PAssert(i0 >= this->domain_m[0].first() && i0 <= this->domain_m[0].last());
-  PAssert(i1 >= this->domain_m[1].first() && i1 <= this->domain_m[1].last());
-  PAssert(i2 >= this->domain_m[2].first() && i2 <= this->domain_m[2].last());
-  PAssert(i3 >= this->domain_m[3].first() && i3 <= this->domain_m[3].last());
-  PAssert(i4 >= this->domain_m[4].first() && i4 <= this->domain_m[4].last());
-  PAssert(i5 >= this->domain_m[5].first() && i5 <= this->domain_m[5].last());
-  PAssert(i6 >= this->domain_m[6].first() && i6 <= this->domain_m[6].last());
-
-  // Compute fortran-order index from position in block grid
-
-  int currloc;
-  if (!this->hasExternalGuards_m)
-    {
-      currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0]
-              + blockstride_m[1] * ((i1 - this->firsti_m[1]) / blocksizes_m[1])
-              + blockstride_m[2] * ((i2 - this->firsti_m[2]) / blocksizes_m[2])
-              + blockstride_m[3] * ((i3 - this->firsti_m[3]) / blocksizes_m[3])
-              + blockstride_m[4] * ((i4 - this->firsti_m[4]) / blocksizes_m[4])
-              + blockstride_m[5] * ((i5 - this->firsti_m[5]) / blocksizes_m[5])
-              + blockstride_m[6] * ((i6 - this->firsti_m[6]) / 
blocksizes_m[6]);
-    }
-  else
-    {
-      currloc = 0;
-      if (i0 >= this->firsti_m[0]) {
-        if (i0 <= this->innerdomain_m[0].last())
-           currloc = (i0 - this->firsti_m[0]) / blocksizes_m[0];
-        else
-           currloc = allDomain_m[0].last();
-      }
-      if (i1 >= this->firsti_m[1]) {
-        if (i1 <= this->innerdomain_m[1].last())
-          currloc += blockstride_m[1] * ((i1 - this->firsti_m[1]) / 
blocksizes_m[1]);
-        else
-          currloc += blockstride_m[1] * allDomain_m[1].last();
-      }
-      if (i2 >= this->firsti_m[2]) {
-        if (i2 <= this->innerdomain_m[2].last())
-          currloc += blockstride_m[2] * ((i2 - this->firsti_m[2]) / 
blocksizes_m[2]);
-        else
-          currloc += blockstride_m[2] * allDomain_m[2].last();
-      }
-      if (i3 >= this->firsti_m[3]) {
-        if (i3 <= this->innerdomain_m[3].last())
-          currloc += blockstride_m[3] * ((i3 - this->firsti_m[3]) / 
blocksizes_m[3]);
-        else
-          currloc += blockstride_m[3] * allDomain_m[3].last();
-      }
-      if (i4 >= this->firsti_m[4]) {
-        if (i4 <= this->innerdomain_m[4].last())
-          currloc += blockstride_m[4] * ((i4 - this->firsti_m[4]) / 
blocksizes_m[4]);
-        else
-          currloc += blockstride_m[4] * allDomain_m[4].last();
-      }
-      if (i5 >= this->firsti_m[5]) {
-        if (i5 <= this->innerdomain_m[5].last())
-          currloc += blockstride_m[5] * ((i5 - this->firsti_m[5]) / 
blocksizes_m[5]);
-        else
-          currloc += blockstride_m[5] * allDomain_m[5].last();
-      }
-      if (i6 >= this->firsti_m[6]) {
-        if (i6 <= this->innerdomain_m[6].last())
-          currloc += blockstride_m[6] * ((i6 - this->firsti_m[6]) / 
blocksizes_m[6]);
-        else
-          currloc += blockstride_m[6] * allDomain_m[6].last();
-      }
-    }
-
-  // Return the globalID for the currloc's node
-
-  PAssert(currloc >= 0 && currloc < this->all_m.size());
-  return currloc;
-}

 //============================================================
 // NewDomain1 traits classes for UniformGridLayout and

reply via email to

[Prev in Thread] Current Thread [Next in Thread]