#include <Domain.h>
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_t & | operator[] (int d) const |
return the Nth element of this domain, using [] | |
OneDomain_t & | operator[] (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_t & | operator++ () |
Domain_t & | operator-- () |
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_t & | operator+= (const T &d2) |
template<class T > | |
Domain_t & | operator-= (const T &d2) |
template<class T > | |
Domain_t & | operator*= (const T &d2) |
template<class T > | |
Domain_t & | operator/= (const T &d2) |
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.
Typedefs obtained from the DomainBase and DomainTraits.
typedef Base_t::Domain_t Domain< Dim, DT >::Domain_t |
Reimplemented from DomainBase< DT >.
Reimplemented in Grid< Dim >, Grid< 1 >, Interval< Dim >, Interval< 1 >, Loc< Dim >, Loc< 1 >, Range< Dim >, Range< 1 >, Region< Dim, T >, Region< 1, T >, Interval< D >, Loc< Dim2 >, and Range< Dim2 >.
typedef DT::OneDomain_t Domain< Dim, DT >::OneDomain_t |
Reimplemented in Grid< Dim >, Grid< 1 >, Interval< Dim >, Interval< 1 >, Loc< Dim >, Loc< 1 >, Range< Dim >, Range< 1 >, Region< Dim, T >, Region< 1, T >, Interval< D >, Loc< Dim2 >, and Range< Dim2 >.
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 >.
typedef Base_t::iterator Domain< Dim, DT >::iterator |
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 >.
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 >.
typedef Base_t::blockIterator Domain< Dim, DT >::blockIterator |
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 >.
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.
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.
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 >.
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 >.
return the total size of the domain, which is the product of all the lengths of the 1D domains
Referenced by DynamicLayoutData::copy(), DynamicLayoutData::destroy(), RangeIterator::done(), TilePartition< Dim >::partition(), GridPartition< Dim >::partition(), RectilinearMeshData< Dim, T >::RectilinearMeshData(), Domain< 1, DomainTraits< Grid< 1 > > >::size(), and Rho::volume().
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().
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().
bool Domain< Dim, DT >::operator== | ( | const T & | d2 | ) | const [inline] |
bool Domain< Dim, DT >::operator< | ( | const T & | d2 | ) | const [inline] |
bool Domain< Dim, DT >::operator!= | ( | const T & | d2 | ) | const [inline] |
bool Domain< Dim, DT >::operator> | ( | const T & | d2 | ) | const [inline] |
bool Domain< Dim, DT >::operator<= | ( | const T & | d2 | ) | const [inline] |
bool Domain< Dim, DT >::operator>= | ( | const T & | d2 | ) | const [inline] |
Domain_t& Domain< Dim, DT >::operator+= | ( | const T & | d2 | ) | [inline] |
Domain_t& Domain< Dim, DT >::operator-= | ( | const T & | d2 | ) | [inline] |
Domain_t& Domain< Dim, DT >::operator*= | ( | const T & | d2 | ) | [inline] |
Domain_t& Domain< Dim, DT >::operator/= | ( | const T & | d2 | ) | [inline] |