freepooma-devel
[Top][All Lists]
Advanced

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

[PATCH] Streamline Engine types


From: Richard Guenther
Subject: [PATCH] Streamline Engine types
Date: Fri, 21 Feb 2003 20:31:47 +0100 (CET)

Hi!

The following patch adds layout() accessors to engines missing one and
adds some inline qualifiers to methods that have one in other engines.

Ok?

Richard.


2003Feb21  Richard Guenther <address@hidden>

        * src/Engine/ViewEngine.h: add layout() accessor, mark small
        methods inline.
        src/Engine/Stencil.h: add layout() accessor, make domain()
        return const reference.
        src/Engine/DynamicEngine.h: mark small methods inline.
        src/Engine/ForwardingEngine.h: correct Layout_t, add layout()
        accessor, mark small methods inline.


diff -Nru a/r2/src/Engine/DynamicEngine.h b/r2/src/Engine/DynamicEngine.h
--- a/r2/src/Engine/DynamicEngine.h     Fri Feb 21 20:26:06 2003
+++ b/r2/src/Engine/DynamicEngine.h     Fri Feb 21 20:26:06 2003
@@ -235,11 +235,11 @@

   // Create a layout and return a copy.

-  inline const Layout_t layout() const { return Layout_t(domain_m); }
+  inline Layout_t layout() const { return Layout_t(domain_m); }

   // Return whether the block controlled by this engine is shared.

-  bool isShared() const { return data_m.isValid() && data_m.count() > 1; }
+  inline bool isShared() const { return data_m.isValid() && data_m.count() > 
1; }

   // Get a private copy of data viewed by this Engine.

@@ -247,14 +247,14 @@

   // Provide access to the data object.

-  Pooma::DataObject_t *dataObject() const { return data_m.dataObject(); }
+  inline Pooma::DataObject_t *dataObject() const { return data_m.dataObject(); 
}

   // Return access to our internal data block.  This is ref-counted,
   // so a copy is fine.  But you should really know what you're doing
   // if you call this method.

-  const DataBlockPtr<T> & dataBlock() const { return data_m; }
-  DataBlockPtr<T>         dataBlock()       { return data_m; }
+  inline const DataBlockPtr<T> & dataBlock() const { return data_m; }
+  inline DataBlockPtr<T>         dataBlock()       { return data_m; }

   //============================================================
   // Dynamic interface methods.
@@ -308,7 +308,7 @@
   // sync() function is a no-op for a single-patch engine.
   // This version of sync() may be called via the DynamicArray interface.

-  void sync() { }
+  inline void sync() { }

   // Modify the domain (but not the size) of this engine.
   // This version of sync() may be called by MultiPatchEngine on its patches.
@@ -318,19 +318,19 @@
 #if POOMA_CHEETAH

   template <class Dom>
-  int packSize(const Dom &) const
+  inline int packSize(const Dom &) const
   {
     PInsist(false,"packSize() called on non-remote Dynamic Engine!!");
     return 0;
   }

-  int pack(const IndirectionList<int> &, char *, bool = true) const
+  inline int pack(const IndirectionList<int> &, char *, bool = true) const
   {
     PInsist(false,"pack() called on non-remote Dynamic Engine!!");
     return 0;
   }

-  int unpack(const Interval<1> &, char *, bool = true)
+  inline int unpack(const Interval<1> &, char *, bool = true)
   {
     PInsist(false,"unpack() called on non-remote Dynamic Engine!!");
     return 0;
@@ -509,26 +509,26 @@

   // Return the domain:

-  const Domain_t &domain() const { return domain_m; }
+  inline const Domain_t &domain() const { return domain_m; }

   // Return a DomainLayout built from our domain

-  const Layout_t layout() const { return Layout_t(domain_m); }
+  inline Layout_t layout() const { return Layout_t(domain_m); }

   // Return the stride.

-  int stride() const { return stride_m; }
+  inline int stride() const { return stride_m; }

   // Provide access to the data object.

-  Pooma::DataObject_t *dataObject() const { return data_m.dataObject(); }
+  inline Pooma::DataObject_t *dataObject() const { return data_m.dataObject(); 
}

   // Return access to our internal data block.  This is ref-counted,
   // so a copy is fine.  But you should really know what you're doing
   // if you call this method.

-  const DataBlockPtr<T> & dataBlock() const { return data_m; }
-  DataBlockPtr<T>         dataBlock()       { return data_m; }
+  inline const DataBlockPtr<T> & dataBlock() const { return data_m; }
+  inline DataBlockPtr<T>         dataBlock()       { return data_m; }

 private:

diff -Nru a/r2/src/Engine/Stencil.h b/r2/src/Engine/Stencil.h
--- a/r2/src/Engine/Stencil.h   Fri Feb 21 20:26:06 2003
+++ b/r2/src/Engine/Stencil.h   Fri Feb 21 20:26:06 2003
@@ -400,7 +400,13 @@
   // Return the output domain.
   //============================================================

-  inline Domain_t domain() const { return domain_m; }
+  inline const Domain_t &domain() const { return domain_m; }
+
+  //============================================================
+  // Return the output layout.
+  //============================================================
+
+  inline Layout_t layout() const { return Layout_t(domain_m); }

   //============================================================
   // Return the first output index value for the specified direction
diff -Nru a/r2/src/Engine/ViewEngine.h b/r2/src/Engine/ViewEngine.h
--- a/r2/src/Engine/ViewEngine.h        Fri Feb 21 20:26:06 2003
+++ b/r2/src/Engine/ViewEngine.h        Fri Feb 21 20:26:06 2003
@@ -263,7 +263,12 @@
   //---------------------------------------------------------------------------
   // Return the domain.

-  const Domain_t &domain() const { return indexer_m.domain(); }
+  inline const Domain_t &domain() const { return indexer_m.domain(); }
+
+  //---------------------------------------------------------------------------
+  // Return the layout.
+
+  inline Layout_t layout() const { return Layout_t(domain()); }

   //---------------------------------------------------------------------------
   // Return the first value for the specified direction (always zero since this
@@ -278,8 +283,8 @@
   //---------------------------------------------------------------------------
   // Accessors.

-  const ViewedEngine_t &viewedEngine() const { return eng_m; }
-  const Indexer_t &indexer() const { return indexer_m; }
+  inline const ViewedEngine_t &viewedEngine() const { return eng_m; }
+  inline const Indexer_t &indexer() const { return indexer_m; }

   //---------------------------------------------------------------------------
   // Need to pass lock requests to the contained engine.
diff -Nru a/r2/src/Engine/ForwardingEngine.h b/r2/src/Engine/ForwardingEngine.h
--- a/r2/src/Engine/ForwardingEngine.h  Fri Feb 21 20:28:10 2003
+++ b/r2/src/Engine/ForwardingEngine.h  Fri Feb 21 20:28:10 2003
@@ -96,7 +96,7 @@
   typedef typename CompAccess_t::ElementRef_t  ElementRef_t;
   typedef typename Eng::Domain_t Domain_t;
   typedef CompFwd<Eng, Components> Tag_t;
-  typedef DomainLayout<Dim> Layout_t;
+  typedef typename Eng::Layout_t Layout_t;

   //---------------------------------------------------------------------------
   // required constants
@@ -251,9 +251,22 @@
   }

   //---------------------------------------------------------------------------
+  // Returns the layout, which is acquired from the contained engine.
+
+  inline const Layout_t& layout() const
+  {
+    return elemEngine().layout();
+  }
+
+  inline Layout_t& layout()
+  {
+    return elemEngine().layout();
+  }
+
+  //---------------------------------------------------------------------------
   // Returns the domain, which is acquired from the contained engine.

-  Domain_t domain() const { return elemEngine().domain(); }
+  inline const Domain_t& domain() const { return elemEngine().domain(); }

   //---------------------------------------------------------------------------
   // Return the first value for the specified direction.

reply via email to

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