Field3D
|
#include <Field.h>
Public Types | |
typedef ResizableField< Data_T > | class_type |
typedef boost::intrusive_ptr < ResizableField > | Ptr |
Public Member Functions | |
void | copyFrom (typename Field< Data_T >::Ptr other) |
Copies the data from another Field, also resizes. | |
template<class Data_T2 > | |
void | copyFrom (typename Field< Data_T2 >::Ptr other) |
Copies the data from another Field of another template class, also resizes. | |
void | matchDefinition (FieldRes::Ptr fieldToMatch) |
Sets up this field so that resolution and mapping matches the other. | |
void | setSize (const Box3i &extents) |
Resizes the object. | |
void | setSize (const V3i &size, int padding) |
Resizes the object with padding. | |
void | setSize (const Box3i &extents, const Box3i &dataWindow) |
Resizes the object. | |
void | setSize (const V3i &size) |
Resizes the object. | |
Static Public Member Functions | |
static const char * | classType () |
static const char * | staticClassName () |
Public Attributes | |
DEFINE_FIELD_RTTI_ABSTRACT_CLASS | |
Protected Types | |
typedef WritableField< Data_T > | base |
Convenience typedef for referring to base class. | |
Protected Member Functions | |
virtual void | sizeChanged () |
Subclasses should re-implement this if they need to perform memory allocations, etc. every time the size of the storage changes. | |
Static Protected Attributes | |
static TemplatedFieldType < ResizableField< Data_T > > | ms_classType |
This class adds the ability to resize the data storage object. Most Field subclasses will derive from this class. Only classes that cannot implement sizeChanged() in a reasonable manner should derive from Field or WritableField.
typedef boost::intrusive_ptr<ResizableField> ResizableField< Data_T >::Ptr |
Reimplemented from WritableField< Data_T >.
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.
typedef ResizableField<Data_T> ResizableField< Data_T >::class_type |
Reimplemented from WritableField< Data_T >.
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.
typedef WritableField<Data_T> ResizableField< Data_T >::base [protected] |
Convenience typedef for referring to base class.
Reimplemented from WritableField< Data_T >.
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.
static const char* ResizableField< Data_T >::staticClassName | ( | ) | [inline, static] |
Reimplemented from WritableField< Data_T >.
Reimplemented in DenseField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.
Definition at line 812 of file Field.h.
{ return "ResizableField"; }
static const char* ResizableField< Data_T >::classType | ( | ) | [inline, static] |
Reimplemented from WritableField< Data_T >.
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.
Definition at line 817 of file Field.h.
References FieldBase::name.
{ return ResizableField<Data_T>::ms_classType.name(); }
void ResizableField< Data_T >::setSize | ( | const V3i & | size | ) |
Resizes the object.
Definition at line 878 of file Field.h.
Referenced by convertCellCenteredToMAC(), SparseFieldIO::read(), MACFieldIO::read(), DenseFieldIO::readData(), and Field3DInputFile::readProxyLayer().
{ Field<Data_T>::m_extents.min = V3i(0); Field<Data_T>::m_extents.max = size - V3i(1); Field<Data_T>::m_dataWindow = Field<Data_T>::m_extents; // Tell subclasses that the size changed so they can update themselves. sizeChanged(); }
void ResizableField< Data_T >::setSize | ( | const Box3i & | extents | ) |
Resizes the object.
Definition at line 891 of file Field.h.
{ Field<Data_T>::m_extents = extents; Field<Data_T>::m_dataWindow = extents; // Tell subclasses that the size changed so they can update themselves. sizeChanged(); }
void ResizableField< Data_T >::setSize | ( | const Box3i & | extents, |
const Box3i & | dataWindow | ||
) |
Resizes the object.
Definition at line 902 of file Field.h.
{ Field<Data_T>::m_extents = extents; Field<Data_T>::m_dataWindow = dataWindow; // Tell subclasses that the size changed so they can update themselves. sizeChanged(); }
void ResizableField< Data_T >::setSize | ( | const V3i & | size, |
int | padding | ||
) |
void ResizableField< Data_T >::copyFrom | ( | typename Field< Data_T >::Ptr | other | ) |
Copies the data from another Field, also resizes.
Definition at line 925 of file Field.h.
References Field< Data_T >::cbegin(), FieldRes::dataWindow(), FieldRes::extents(), FieldRes::mapping(), and FieldRes::setMapping().
{ // Set mapping FieldRes::setMapping(other->mapping()); // Set size to match setSize(other->extents(), other->dataWindow()); // Copy over the data typename base::iterator i = base::begin(); typename base::iterator end = base::end(); typename Field<Data_T>::const_iterator c = other->cbegin(); for (; i != end; ++i, ++c) *i = *c; }
void ResizableField< Data_T >::copyFrom | ( | typename Field< Data_T2 >::Ptr | other | ) |
Copies the data from another Field of another template class, also resizes.
Definition at line 944 of file Field.h.
References Field< Data_T >::cbegin(), FieldRes::dataWindow(), FieldRes::extents(), and FieldRes::mapping().
{ // Set mapping setMapping(other->mapping()); // Set size to match setSize(other->extents(), other->dataWindow()); // Copy over the data typename base::iterator i = base::begin(); typename base::iterator end = base::end(); typename Field<Data_T2>::const_iterator c = other->cbegin(); for (; i != end; ++i, ++c) *i = *c; }
void ResizableField< Data_T >::matchDefinition | ( | FieldRes::Ptr | fieldToMatch | ) |
Sets up this field so that resolution and mapping matches the other.
Definition at line 961 of file Field.h.
References FieldRes::setMapping().
Referenced by MACField< Data_T >::copyMAC().
{ setSize(fieldToMatch->extents(), fieldToMatch->dataWindow()); FieldRes::setMapping(fieldToMatch->mapping()); }
virtual void ResizableField< Data_T >::sizeChanged | ( | ) | [inline, protected, virtual] |
Subclasses should re-implement this if they need to perform memory allocations, etc. every time the size of the storage changes.
Reimplemented in DenseField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.
Definition at line 866 of file Field.h.
References FieldRes::m_extents, and FieldRes::m_mapping.
Referenced by SparseField< Data_T >::sizeChanged().
{ base::m_mapping->setExtents(base::m_extents); }
ResizableField< Data_T >::DEFINE_FIELD_RTTI_ABSTRACT_CLASS |
Reimplemented from WritableField< Data_T >.
TemplatedFieldType<ResizableField<Data_T> > ResizableField< Data_T >::ms_classType [static, protected] |
Reimplemented from WritableField< Data_T >.
Reimplemented in DenseField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.