Domain< Dim, DT > Class Template Reference

Domain<Dim,DT> provides the bulk of the public interface for all domain objects. More...

#include <Domain.h>

Inheritance diagram for Domain< Dim, DT >:

Inheritance graph
[legend]
Collaboration diagram for Domain< Dim, DT >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef DT::Size_t Size_t
 Typedefs obtained from the DomainBase and DomainTraits.
typedef Base_t::Domain_t Domain_t
typedef DT::OneDomain_t OneDomain_t
typedef Base_t::const_iterator const_iterator
 Iterator typedefs.
typedef Base_t::iterator iterator
typedef Base_t::const_blockIterator const_blockIterator
 Block iterator typedefs.
typedef Base_t::blockIterator blockIterator

Public Member Functions

 Domain ()
 Domain has a default constructor, which only makes sure for now that the Dim parameter is consistent with the DT parameter.
 Domain (const Pooma::NoInit &d)
 If an Pooma::NoInit object is given in the constructor, we skip initialization of our array of 1D domains.
 ~Domain ()
const OneDomain_toperator[] (int d) const
 return the Nth element of this domain, using []
OneDomain_toperator[] (int d)
 return the Nth element of this domain, using []
Size_t size () const
 return the total size of the domain, which is the product of all the lengths of the 1D domains
bool empty () const
 return if this domain is empty, which reports whether any of the N 1-dimensional domains are empty.
bool initialized () const
 return whether this domain has been initialized.
Comparison operators ==, !=, <, >, <=, >=
template<class T >
bool operator== (const T &d2) const
template<class T >
bool operator< (const T &d2) const
template<class T >
bool operator!= (const T &d2) const
template<class T >
bool operator> (const T &d2) const
template<class T >
bool operator<= (const T &d2) const
template<class T >
bool operator>= (const T &d2) const
Increment/decrement operators
Domain_toperator++ ()
Domain_toperator-- ()
Arithmetic accumulation operators
These are only allowed to occur with domain objects which are single-valued and have the right number of dimensions (basically, Loc's and scalar's).

All return a reference to this object, but cast down to the derived type (e.g., Loc<N> instead of Domain<DomainTraits<Loc<N>>>

template<class T >
Domain_toperator+= (const T &d2)
template<class T >
Domain_toperator-= (const T &d2)
template<class T >
Domain_toperator*= (const T &d2)
template<class T >
Domain_toperator/= (const T &d2)


Detailed Description

template<int Dim, class DT>
class Domain< Dim, DT >

Domain<Dim,DT> provides the bulk of the public interface for all domain objects.

The first template parameter is a dimension that is used to specialize this class to 1-D objects. The second template parameter should be DomainTraits

, where DT is whatever Domain object is being set up (Loc<N>, Interval<N>, etc). DomainTraits is a traits class which must be specialized for the particular type of domain this Domain base class is setting up. DomainTraits must include a number of typedefs, static data, and static methods to specialize Domain to do the right thing for the different Domain objects.

When a Domain is created, it will initialize its storage if the default constructor is used. However, if you wish to avoid the work of initialization, you can use the constructor which takes a Pooma::NoInit object. In that case, storage space for the domain will be maintained, but it will not be initialized. This is useful if you know you will be changing the values later, and do not want to spend the extra time filling in zeros or something into the storage.

There is a general version of Domain, for an dimension N, and one partially specialized to the case where the dimension == 1. The 1D specialization adds extra functionality for 1D domain objects, which is not available for multidimensional objects. For example, Range<2> objects do not have first(), last(), length(), etc. methods, but Range<1> objects do.

Domain inherits from DomainBase

, regardless of the dimension; DomainBase provides the definition of all methods which do not depend on what the dimension is.

Domain<N,DT> defines the following operations for domain objects:

Note that if some operation is not defined for a particular type of domain (e.g., *=, which is not legal for Loc or Interval objects), the DomainTraits class will be missing the particular method needed to implement that operation, and a compile-time error will occur if the user tries to employ that disallowed operation. The error will be extremely cryptic, of course, but it will occur.

Domain<1,DT> defines, in addition to the Domain<N,DT> methods, these extra interface functions for just 1D domains:

The actual data for the domain (such as what the endpoints are) is kept in DomainBase. The DomainTraits class defines what the type of the storage should be. By putting that storage in the base class, we avoid the 'empty base class' penalty of many compilers. The storage object is named domain_m.


Member Typedef Documentation

template<int Dim, class DT>
typedef DT::Size_t Domain< Dim, DT >::Size_t

Typedefs obtained from the DomainBase and DomainTraits.

template<int Dim, class DT>
typedef Base_t::Domain_t Domain< Dim, DT >::Domain_t

template<int Dim, class DT>
typedef DT::OneDomain_t Domain< Dim, DT >::OneDomain_t

template<int Dim, class DT>
typedef Base_t::const_iterator Domain< Dim, DT >::const_iterator

Iterator typedefs.

An N-dimensional iterator is a forward iterator, it works only with operator++ (it does not have operator--).

Reimplemented from DomainBase< DT >.

Reimplemented in Grid< Dim >, Interval< Dim >, Loc< Dim >, Range< Dim >, Region< Dim, T >, Region< 1, T >, Interval< D >, Loc< Dim2 >, and Range< Dim2 >.

template<int Dim, class DT>
typedef Base_t::iterator Domain< Dim, DT >::iterator

template<int Dim, class DT>
typedef Base_t::const_blockIterator Domain< Dim, DT >::const_blockIterator

Block iterator typedefs.

All domains use the DomainBlockIterator class to iterate through blocks defined by the domain points. A block iterator is a forward iterator, it works only with operator++.

Reimplemented from DomainBase< DT >.

Reimplemented in Grid< Dim >, Interval< Dim >, Loc< Dim >, Range< Dim >, Region< Dim, T >, Region< 1, T >, Interval< D >, Loc< Dim2 >, and Range< Dim2 >.

template<int Dim, class DT>
typedef Base_t::blockIterator Domain< Dim, DT >::blockIterator


Constructor & Destructor Documentation

template<int Dim, class DT>
Domain< Dim, DT >::Domain (  )  [inline]

Domain has a default constructor, which only makes sure for now that the Dim parameter is consistent with the DT parameter.

The storage object is kept and initialized in DomainBase.

template<int Dim, class DT>
Domain< Dim, DT >::Domain ( const Pooma::NoInit d  )  [inline]

If an Pooma::NoInit object is given in the constructor, we skip initialization of our array of 1D domains.

template<int Dim, class DT>
Domain< Dim, DT >::~Domain (  )  [inline]


Member Function Documentation

template<int Dim, class DT>
const OneDomain_t& Domain< Dim, DT >::operator[] ( int  d  )  const [inline]

return the Nth element of this domain, using []

Reimplemented in Interval< 1 >, Loc< 1 >, Range< 1 >, and Region< 1, T >.

template<int Dim, class DT>
OneDomain_t& Domain< Dim, DT >::operator[] ( int  d  )  [inline]

return the Nth element of this domain, using []

Reimplemented in Interval< 1 >, Loc< 1 >, Range< 1 >, and Region< 1, T >.

template<int Dim, class DT>
Size_t Domain< Dim, DT >::size (  )  const [inline]

template<int Dim, class DT>
bool Domain< Dim, DT >::empty (  )  const [inline]

return if this domain is empty, which reports whether any of the N 1-dimensional domains are empty.

Referenced by Domain< 1, DT >::empty(), Domain< 1, DomainTraits< Grid< 1 > > >::empty(), Domain< 1, DT >::initialized(), and Domain< 1, DomainTraits< Grid< 1 > > >::initialized().

template<int Dim, class DT>
bool Domain< Dim, DT >::initialized (  )  const [inline]

return whether this domain has been initialized.

This is the same as saying it is not empty.

Referenced by DomainLayout< Dim >::initialized().

template<int Dim, class DT>
template<class T >
bool Domain< Dim, DT >::operator== ( const T &  d2  )  const [inline]

template<int Dim, class DT>
template<class T >
bool Domain< Dim, DT >::operator< ( const T &  d2  )  const [inline]

template<int Dim, class DT>
template<class T >
bool Domain< Dim, DT >::operator!= ( const T &  d2  )  const [inline]

template<int Dim, class DT>
template<class T >
bool Domain< Dim, DT >::operator> ( const T &  d2  )  const [inline]

template<int Dim, class DT>
template<class T >
bool Domain< Dim, DT >::operator<= ( const T &  d2  )  const [inline]

template<int Dim, class DT>
template<class T >
bool Domain< Dim, DT >::operator>= ( const T &  d2  )  const [inline]

template<int Dim, class DT>
Domain_t& Domain< Dim, DT >::operator++ (  )  [inline]

template<int Dim, class DT>
Domain_t& Domain< Dim, DT >::operator-- (  )  [inline]

template<int Dim, class DT>
template<class T >
Domain_t& Domain< Dim, DT >::operator+= ( const T &  d2  )  [inline]

template<int Dim, class DT>
template<class T >
Domain_t& Domain< Dim, DT >::operator-= ( const T &  d2  )  [inline]

template<int Dim, class DT>
template<class T >
Domain_t& Domain< Dim, DT >::operator*= ( const T &  d2  )  [inline]

template<int Dim, class DT>
template<class T >
Domain_t& Domain< Dim, DT >::operator/= ( const T &  d2  )  [inline]


The documentation for this class was generated from the following file:

Generated on Wed Mar 16 06:19:49 2011 for FreePOOMA by  doxygen 1.5.9