[PATCH] Add missing methods to DomainLayout

Jeffrey D. Oldham oldham at codesourcery.com
Wed Dec 3 23:04:25 UTC 2003


Richard Guenther wrote:
> Hi!
> 
> For interoperability, the methods first(int) and blocks() need to be added
> to DomainLayout. This also (unrelated) moves the touches() method out of
> line.
> 
> Tested by being in my tree for a long time.
> 
> Ok?

Yes.

> Richard.
> 
> 
> 2003Dec03  Richard Guenther <richard.guenther at uni-tuebingen.de>
> 
> 	* src/Layout/DomainLayout.h: add first(int) and blocks().
> 	Move touches() out of line.
> 
> Index: DomainLayout.h
> ===================================================================
> RCS file: /home/pooma/Repository/r2/src/Layout/DomainLayout.h,v
> retrieving revision 1.29
> diff -u -u -r1.29 DomainLayout.h
> --- DomainLayout.h	26 Oct 2003 11:28:11 -0000	1.29
> +++ DomainLayout.h	3 Dec 2003 20:42:50 -0000
> @@ -193,6 +193,10 @@
>        return domain().initialized();
>      }
> 
> +  // d'th component of the lower left of the inner domain.
> +
> +  inline int first(int d) const { return innerDomain()[d].first(); }
> +
>    // A reference to our node object
> 
>    inline Value_t &node()
> @@ -205,6 +209,10 @@
>        return node_m;
>      }
> 
> +  // Number of blocks in each dimension.
> +
> +  inline Loc<Dim> blocks() const { return Loc<Dim>(1); }
> +
>    // Return the global domain.
> 
>    inline const Domain_t &domain() const
> @@ -436,37 +444,7 @@
>    // either pointers or objects.
> 
>    template<class OtherDomain, class OutIter, class ConstructTag>
> -  int touches(const OtherDomain &d, OutIter o, ConstructTag ctag) const
> -    {
> -      int i, count = 0;
> -
> -      // type of output elements
> -
> -      typedef typename IntersectReturnType<Domain_t,OtherDomain>::Type_t
> -        OutDomain_t;
> -      typedef Node<OutDomain_t> OutNode_t;
> -
> -      // find the intersection of our domain and the given one
> -
> -      OutDomain_t outDomain = intersect(d, domain());
> -
> -      // add in touching domain if there is anything that intersects
> -
> -      if (!outDomain.empty())
> -        {
> -          ++count;
> -          *o = touchesConstruct(outDomain,
> -		                node().affinity(),
> -		                node().context(),
> -		                node().globalID(),
> -		                node().localID(),
> -                                ctag);
> -        }
> -
> -      // return the number of non-empty domains we found
> -
> -      return count;
> -    }
> +  int touches(const OtherDomain &d, OutIter o, ConstructTag ctag) const;
> 
>    // Find local subdomains that touch on a given domain, and insert the
>    // intersection of these subdomains into the given output iterator.  Return
> @@ -535,6 +513,41 @@
> 
>    Value_t node_m;
>  };
> +
> +template<int Dim>
> +template<class OtherDomain, class OutIter, class ConstructTag>
> +int DomainLayout<Dim>::touches(const OtherDomain &d, OutIter o,
> +			       ConstructTag ctag) const
> +{
> +  int i, count = 0;
> +
> +  // type of output elements
> +
> +  typedef typename IntersectReturnType<Domain_t,OtherDomain>::Type_t
> +    OutDomain_t;
> +  typedef Node<OutDomain_t> OutNode_t;
> +
> +  // find the intersection of our domain and the given one
> +
> +  OutDomain_t outDomain = intersect(d, domain());
> +
> +  // add in touching domain if there is anything that intersects
> +
> +  if (!outDomain.empty())
> +    {
> +      ++count;
> +      *o = touchesConstruct(outDomain,
> +			    node().affinity(),
> +			    node().context(),
> +			    node().globalID(),
> +			    node().localID(),
> +			    ctag);
> +    }
> +
> +  // return the number of non-empty domains we found
> +
> +  return count;
> +}
> 
> 
>  template <int Dim>


-- 
Jeffrey D. Oldham
oldham at codesourcery.com




More information about the pooma-dev mailing list