FreePOOMA
2.4.1
|
A DynamicArray is a read-write array with extra create/destroy methods. More...
#include <DynamicArray.h>
Public Types | |
enum | { dynamic = Engine_t::dynamic } |
typedef Array< 1, T, EngineTag > | Base_t |
typedef DynamicArray< T, EngineTag > | This_t |
This_t is a convenience typedef referring to this class. | |
typedef Base_t::Engine_t | Engine_t |
Engine_t is a typedef that maps the EngineTag to the Engine type. | |
typedef Base_t::Element_t | Element_t |
Element_t is the type of elements managed by this array's engine. | |
typedef Base_t::ElementRef_t | ElementRef_t |
ElementRef_t is the type that is used to write to a single element. | |
typedef Base_t::Domain_t | Domain_t |
The typedef Domain_t gives the type of domain this array is defined on. | |
typedef Engine_t::Layout_t | Layout_t |
typedef Layout_t::PatchID_t | PatchID_t |
typedef Layout_t::CreateSize_t | CreateSize_t |
typedef EngineTag | EngineTag_t |
Engine Tag_t is this tag type, exported to other classes. | |
Public Member Functions | |
DynamicArray () | |
Default constructor for DynamicArray. | |
DynamicArray (const Engine_t &modelEngine) | |
template<class T2 , class EngineTag2 > | |
DynamicArray (const Engine< 1, T2, EngineTag2 > &engine) | |
template<class T2 , class EngineTag2 , class Initializer > | |
DynamicArray (const Engine< 1, T2, EngineTag2 > &engine, const Initializer &init) | |
DynamicArray (const This_t &model) | |
One way for a user to construct a DynamicArray is to use another as a model. | |
template<class OtherT , class OtherEngineTag , class OtherDomain > | |
DynamicArray (const DynamicArray< OtherT, OtherEngineTag > &model, const OtherDomain &domain) | |
template<class Sub1 > | |
DynamicArray (const Sub1 &s1) | |
All of these constructors pass domain information to the engine. | |
template<class Sub1 > | |
DynamicArray (const Sub1 &s1, const ModelElement< Element_t > &model) | |
All of these constructors pass domain information to the engine along with a model element, which is used to initialize all array elements. | |
~DynamicArray () | |
Base_t & | array () |
Get a reference to this same object, but cast to the Array base class. | |
const Base_t & | array () const |
Base_t & | arrayAll () |
const Base_t & | arrayAll () const |
Layout_t | layout () const |
Return a reference to the layout for this array. | |
This_t & | operator= (const DynamicArray< T, EngineTag > &rhs) |
const This_t & | operator= (const DynamicArray< T, EngineTag > &rhs) const |
template<class T1 > | |
const This_t & | operator= (const T1 &rhs) const |
template<class OtherT , class OtherETag > | |
const This_t & | operator+= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator+= (const T1 &rhs) const |
Addition. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator-= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator-= (const T1 &rhs) const |
Subtraction. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator*= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator*= (const T1 &rhs) const |
Multiplication. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator/= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator/= (const T1 &rhs) const |
Division. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator%= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator%= (const T1 &rhs) const |
Modulus. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator|= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator|= (const T1 &rhs) const |
Bitwise-Or. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator&= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator&= (const T1 &rhs) const |
Bitwise-And. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator^= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator^= (const T1 &rhs) const |
Bitwise-Xor. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator<<= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator<<= (const T1 &rhs) const |
Left shift. | |
template<class OtherT , class OtherETag > | |
const This_t & | operator>>= (const DynamicArray< OtherT, OtherETag > &rhs) const |
template<class T1 > | |
const This_t & | operator>>= (const T1 &rhs) const |
Right shift. | |
Dynamic interface methods | |
Dynamic interface methods are used to create or destroy elements in the array (this is what makes this class dynamic). These operations are passed on to the engine, so this class must be used with engines that support dynamic operations. These operations will modify the domain of the array, and will rearrange values, but will not erase the values of existing elements that are meant to remain after the create/destroy operations. NOTE: Create/destroy operations only properly update the domain information for patches that are on the local context. If the user needs to have all contexts have correct layout information about the dynamic array following create/destroy operations, they must call the sync() method, in an SPMD operations (that is, all contexts must call sync() at the same general time). | |
void | create (CreateSize_t num) |
Create new elements for a DynamicArray, by extending the current domain on the local context by the requested number of elements, or the specified local patch. | |
void | create (CreateSize_t num, PatchID_t patch) |
template<class Dom > | |
void | destroy (const Dom &killlist, BackFill method) |
Delete the elements within our domain specified by the given Range, using either a backfill mechanism or a shift-up mechanism to delete the data. | |
template<class Dom > | |
void | destroy (const Dom &killlist, ShiftUp method) |
template<class Dom > | |
void | destroy (const Dom &killlist) |
Use the default destroy method, BackFill. | |
template<class Iter > | |
void | destroy (Iter begin, Iter end, BackFill method) |
Versions that take a pair of random-access iterators. | |
template<class Iter > | |
void | destroy (Iter begin, Iter end, ShiftUp method) |
template<class Iter > | |
void | destroy (Iter begin, Iter end) |
template<class Dom > | |
void | destroy (const Dom &killlist, PatchID_t frompatch, BackFill method) |
Delete the elements within the specific local domain for the given patch. | |
template<class Dom > | |
void | destroy (const Dom &killlist, PatchID_t frompatch, ShiftUp method) |
template<class Dom > | |
void | destroy (const Dom &killlist, PatchID_t frompatch) |
template<class Iter > | |
void | destroy (Iter begin, Iter end, PatchID_t frompatch, BackFill method) |
For the patch-specific destroy operations, the iterators must be convertible to "const int *" iterators as that is the type for which the underlying DynamicEventDomain objects are specialized. | |
template<class Iter > | |
void | destroy (Iter begin, Iter end, PatchID_t frompatch, ShiftUp method) |
template<class Iter > | |
void | destroy (Iter begin, Iter end, PatchID_t frompatch) |
template<class Dom > | |
void | copy (const Dom ©list) |
Copy all elements of domain n to the end of the last patch or to the end of the specified patch. | |
template<class Dom > | |
void | copy (const Dom ©list, PatchID_t patch) |
template<class Dom > | |
void | copy (const Dom ©list, PatchID_t frompatch, PatchID_t topatch) |
Copy all elements from the specified local patch to the end of the local to-patch. | |
void | sync () |
Synchronize all the contexts to update their domain information. |
A DynamicArray is a read-write array with extra create/destroy methods.
It can act just like a regular Array, but can have a dynamically-changing domain. Create and destroy methods will preserve the values of elements that remain after these operations. It is by definition 1-Dimensional, and so it does not have a Dim parameter. It provides the following extra interface, beyond that of the standard Array class:
BackFill and ShiftUp are tag classes used to indicate how elements should be deleted - either by back-filling (moving elements from the bottom up) or shift-up (just like the "erase" method in the STL vector class).
shrink() will make sure the engine within a DynamicArray is not using any more memory than necessary.
sync() is something that a user should call if they perform some dynamic create/destroy operations, and then want to use the DynamicArray in expressions that will require knowledge of the global domain of the system. Normally, create/destroy ops only modify the domain information for the patches within the engine that are local to a context. sync() will syncronize with other contexts to make sure all contexts have up-to-date domain information for the whole domain and all the patches, even those that are on another context.
typedef Array<1, T, EngineTag> DynamicArray< T, EngineTag >::Base_t |
typedef DynamicArray<T, EngineTag> DynamicArray< T, EngineTag >::This_t |
This_t is a convenience typedef referring to this class.
Reimplemented from Array< 1, T, EngineTag >.
typedef Base_t::Engine_t DynamicArray< T, EngineTag >::Engine_t |
Engine_t is a typedef that maps the EngineTag to the Engine type.
Reimplemented from Array< 1, T, EngineTag >.
typedef Base_t::Element_t DynamicArray< T, EngineTag >::Element_t |
Element_t is the type of elements managed by this array's engine.
Reimplemented from Array< 1, T, EngineTag >.
typedef Base_t::ElementRef_t DynamicArray< T, EngineTag >::ElementRef_t |
ElementRef_t is the type that is used to write to a single element.
Reimplemented from Array< 1, T, EngineTag >.
typedef Base_t::Domain_t DynamicArray< T, EngineTag >::Domain_t |
The typedef Domain_t gives the type of domain this array is defined on.
Reimplemented from Array< 1, T, EngineTag >.
typedef Engine_t::Layout_t DynamicArray< T, EngineTag >::Layout_t |
Reimplemented from Array< 1, T, EngineTag >.
typedef Layout_t::PatchID_t DynamicArray< T, EngineTag >::PatchID_t |
typedef Layout_t::CreateSize_t DynamicArray< T, EngineTag >::CreateSize_t |
typedef EngineTag DynamicArray< T, EngineTag >::EngineTag_t |
Engine Tag_t is this tag type, exported to other classes.
Reimplemented from Array< 1, T, EngineTag >.
anonymous enum |
DynamicArray< T, EngineTag >::DynamicArray | ( | ) | [inline] |
Default constructor for DynamicArray.
Exists so this can be resized or given another layout.
DynamicArray< T, EngineTag >::DynamicArray | ( | const Engine_t & | modelEngine | ) | [inline, explicit] |
DynamicArray< T, EngineTag >::DynamicArray | ( | const Engine< 1, T2, EngineTag2 > & | engine | ) | [inline, explicit] |
DynamicArray< T, EngineTag >::DynamicArray | ( | const Engine< 1, T2, EngineTag2 > & | engine, |
const Initializer & | init | ||
) | [inline] |
DynamicArray< T, EngineTag >::DynamicArray | ( | const This_t & | model | ) | [inline] |
One way for a user to construct a DynamicArray is to use another as a model.
The non-templated version is the copy constructor. For the templated versions to work, Engine_t must possess a constructor that takes an OtherEngine and, perhaps, an OtherDomain.
DynamicArray< T, EngineTag >::DynamicArray | ( | const DynamicArray< OtherT, OtherEngineTag > & | model, |
const OtherDomain & | domain | ||
) | [inline] |
DynamicArray< T, EngineTag >::DynamicArray | ( | const Sub1 & | s1 | ) | [inline, explicit] |
All of these constructors pass domain information to the engine.
Since DynamicArray is by definition 1-D, we only need the one-argument version. These constructors call the default constructor for Element_t.
DynamicArray< T, EngineTag >::DynamicArray | ( | const Sub1 & | s1, |
const ModelElement< Element_t > & | model | ||
) | [inline] |
All of these constructors pass domain information to the engine along with a model element, which is used to initialize all array elements.
Therefore, it is assumed that Element_t either has deep-copy semantics by default, or can be made to have it using a wrapper class. Since DynamicArray is by definition 1-D, we only need the one-argument version.
DynamicArray< T, EngineTag >::~DynamicArray | ( | ) | [inline] |
Base_t& DynamicArray< T, EngineTag >::array | ( | ) | [inline] |
Get a reference to this same object, but cast to the Array base class.
Referenced by Connector< DynamicArray< T, EngineTag >, Paws >::resize().
const Base_t& DynamicArray< T, EngineTag >::array | ( | ) | const [inline] |
Base_t& DynamicArray< T, EngineTag >::arrayAll | ( | ) | [inline] |
const Base_t& DynamicArray< T, EngineTag >::arrayAll | ( | ) | const [inline] |
Layout_t DynamicArray< T, EngineTag >::layout | ( | ) | const [inline] |
Return a reference to the layout for this array.
Reimplemented from Array< 1, T, EngineTag >.
Referenced by Interpolator< Dim, T, NGP >::gatherCache(), Interpolator< Dim, T, CIC >::gatherCache(), Interpolator< Dim, T, SUDS >::gatherCache(), Interpolator< Dim, T, NGP >::scatterCache(), Interpolator< Dim, T, CIC >::scatterCache(), Interpolator< Dim, T, SUDS >::scatterCache(), Interpolator< Dim, T, NGP >::scatterValueCache(), Interpolator< Dim, T, CIC >::scatterValueCache(), and Interpolator< Dim, T, SUDS >::scatterValueCache().
void DynamicArray< T, EngineTag >::create | ( | CreateSize_t | num | ) | [inline] |
Create new elements for a DynamicArray, by extending the current domain on the local context by the requested number of elements, or the specified local patch.
'local' means on this same context. The patch is refered to by local index, from 0 ... # local patches - 1.
void DynamicArray< T, EngineTag >::create | ( | CreateSize_t | num, |
PatchID_t | patch | ||
) | [inline] |
void DynamicArray< T, EngineTag >::destroy | ( | const Dom & | killlist, |
BackFill | method | ||
) | [inline] |
Delete the elements within our domain specified by the given Range, using either a backfill mechanism or a shift-up mechanism to delete the data.
The second argument should be one of the following types:
void DynamicArray< T, EngineTag >::destroy | ( | const Dom & | killlist, |
ShiftUp | method | ||
) | [inline] |
void DynamicArray< T, EngineTag >::destroy | ( | const Dom & | killlist | ) | [inline] |
Use the default destroy method, BackFill.
void DynamicArray< T, EngineTag >::destroy | ( | Iter | begin, |
Iter | end, | ||
BackFill | method | ||
) | [inline] |
Versions that take a pair of random-access iterators.
void DynamicArray< T, EngineTag >::destroy | ( | Iter | begin, |
Iter | end, | ||
ShiftUp | method | ||
) | [inline] |
void DynamicArray< T, EngineTag >::destroy | ( | Iter | begin, |
Iter | end | ||
) | [inline] |
void DynamicArray< T, EngineTag >::destroy | ( | const Dom & | killlist, |
PatchID_t | frompatch, | ||
BackFill | method | ||
) | [inline] |
Delete the elements within the specific local domain for the given patch.
The domain values in this case should all be zero-based, so that they are relative to the first element of the specified local patch. The domain values should all be contained within the specified local patch as well. To perform cross-patch destroy's, use the form where you do not specify a local patch number.
void DynamicArray< T, EngineTag >::destroy | ( | const Dom & | killlist, |
PatchID_t | frompatch, | ||
ShiftUp | method | ||
) | [inline] |
void DynamicArray< T, EngineTag >::destroy | ( | const Dom & | killlist, |
PatchID_t | frompatch | ||
) | [inline] |
void DynamicArray< T, EngineTag >::destroy | ( | Iter | begin, |
Iter | end, | ||
PatchID_t | frompatch, | ||
BackFill | method | ||
) | [inline] |
For the patch-specific destroy operations, the iterators must be convertible to "const int *" iterators as that is the type for which the underlying DynamicEventDomain objects are specialized.
void DynamicArray< T, EngineTag >::destroy | ( | Iter | begin, |
Iter | end, | ||
PatchID_t | frompatch, | ||
ShiftUp | method | ||
) | [inline] |
void DynamicArray< T, EngineTag >::destroy | ( | Iter | begin, |
Iter | end, | ||
PatchID_t | frompatch | ||
) | [inline] |
void DynamicArray< T, EngineTag >::copy | ( | const Dom & | copylist | ) | [inline] |
Copy all elements of domain n to the end of the last patch or to the end of the specified patch.
void DynamicArray< T, EngineTag >::copy | ( | const Dom & | copylist, |
PatchID_t | patch | ||
) | [inline] |
void DynamicArray< T, EngineTag >::copy | ( | const Dom & | copylist, |
PatchID_t | frompatch, | ||
PatchID_t | topatch | ||
) | [inline] |
Copy all elements from the specified local patch to the end of the local to-patch.
The domain values in this case should all be zero- based,/ so that they are relative to the first element of the specified local patch. The domain values should all be contained within the specified local patch as well. To perform cross-patch copies, use the form where you do not specify a local from-patch number.
void DynamicArray< T, EngineTag >::sync | ( | ) | [inline] |
Synchronize all the contexts to update their domain information.
This should be used after create/destroy operations have modified the domain of local context's data, and all contexts must be told of the new situation. This should be an SPMD call.
This_t& DynamicArray< T, EngineTag >::operator= | ( | const DynamicArray< T, EngineTag > & | rhs | ) | [inline] |
const This_t& DynamicArray< T, EngineTag >::operator= | ( | const DynamicArray< T, EngineTag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator= | ( | const T1 & | rhs | ) | const [inline] |
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator+= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator+= | ( | const T1 & | rhs | ) | const [inline] |
Addition.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator-= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator-= | ( | const T1 & | rhs | ) | const [inline] |
Subtraction.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator*= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator*= | ( | const T1 & | rhs | ) | const [inline] |
Multiplication.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator/= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator/= | ( | const T1 & | rhs | ) | const [inline] |
Division.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator%= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator%= | ( | const T1 & | rhs | ) | const [inline] |
Modulus.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator|= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator|= | ( | const T1 & | rhs | ) | const [inline] |
Bitwise-Or.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator&= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator&= | ( | const T1 & | rhs | ) | const [inline] |
Bitwise-And.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator^= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator^= | ( | const T1 & | rhs | ) | const [inline] |
Bitwise-Xor.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator<<= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator<<= | ( | const T1 & | rhs | ) | const [inline] |
Left shift.
Reimplemented from Array< 1, T, EngineTag >.
const This_t& DynamicArray< T, EngineTag >::operator>>= | ( | const DynamicArray< OtherT, OtherETag > & | rhs | ) | const [inline] |
const This_t& DynamicArray< T, EngineTag >::operator>>= | ( | const T1 & | rhs | ) | const [inline] |
Right shift.
Reimplemented from Array< 1, T, EngineTag >.