Field3D
ResizableField< Data_T > Class Template Reference

#include <Field.h>

Inheritance diagram for ResizableField< Data_T >:
WritableField< Data_T > WritableField< Data_T > Field< Data_T > Field< Data_T > Field< Data_T > Field< Data_T > FieldRes FieldRes FieldRes FieldRes FieldRes FieldRes FieldRes FieldRes DenseField< Data_T > DenseField< Data_T > EmptyField< Data_T > EmptyField< Data_T > MACField< Data_T > MACField< Data_T > SparseField< Data_T > SparseField< Data_T >

List of all members.

Public Types

typedef ResizableField< Data_T > class_type
typedef ResizableField< Data_T > class_type
typedef boost::intrusive_ptr
< ResizableField
Ptr
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 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 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)
 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 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.

Public Attributes

 DEFINE_FIELD_RTTI_ABSTRACT_CLASS

Protected Types

typedef WritableField< Data_T > base
 Convenience typedef for referring to base class.
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.
virtual void sizeChanged ()
 Subclasses should re-implement this if they need to perform memory allocations, etc. every time the size of the storage changes.

Detailed Description

template<class Data_T>
class ResizableField< Data_T >

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.

Definition at line 815 of file Field.h.


Member Typedef Documentation

template<class Data_T>
typedef boost::intrusive_ptr<ResizableField> ResizableField< Data_T >::Ptr
template<class 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 >, SparseField< Data_T >, DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

Definition at line 862 of file Field.h.

template<class Data_T>
typedef boost::intrusive_ptr<ResizableField> ResizableField< Data_T >::Ptr
template<class 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 >, SparseField< Data_T >, DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

Definition at line 862 of file Field.h.


Member Function Documentation

template<class Data_T >
void ResizableField< Data_T >::setSize ( const V3i size)

Resizes the object.

Warning:
Never call this from a constructor. It calls the virtual function sizeChanged().

Definition at line 877 of file Field.h.

Referenced by convertCellCenteredToMAC(), main(), 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();
}
template<class Data_T >
void ResizableField< Data_T >::setSize ( const Box3i extents)

Resizes the object.

Warning:
Never call this from a constructor. It calls the virtual function sizeChanged().

Definition at line 890 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();
}
template<class Data_T >
void ResizableField< Data_T >::setSize ( const Box3i extents,
const Box3i dataWindow 
)

Resizes the object.

Warning:
Never call this from a constructor. It calls the virtual function sizeChanged().

Definition at line 901 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();
}
template<class Data_T >
void ResizableField< Data_T >::setSize ( const V3i size,
int  padding 
)

Resizes the object with padding.

Warning:
Never call this from a constructor. It calls the virtual function sizeChanged().

Definition at line 914 of file Field.h.

{ 
  setSize(Box3i(V3i(0), size - V3i(1)),
          Box3i(V3i(-padding), 
                size + V3i(padding - 1))); 
}
template<class Data_T >
void ResizableField< Data_T >::copyFrom ( typename Field< Data_T >::Ptr  other)

Copies the data from another Field, also resizes.

Definition at line 924 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_T>::const_iterator c = other->cbegin();
  for (; i != end; ++i, ++c)
    *i = *c;
}
template<class Data_T >
template<class Data_T2 >
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 943 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;
}
template<class Data_T >
void ResizableField< Data_T >::matchDefinition ( FieldRes::Ptr  fieldToMatch)

Sets up this field so that resolution and mapping matches the other.

Definition at line 960 of file Field.h.

References FieldRes::setMapping().

Referenced by MACField< Data_T >::copyMAC().

{
  setSize(fieldToMatch->extents(), fieldToMatch->dataWindow());
  FieldRes::setMapping(fieldToMatch->mapping());
}
template<class Data_T>
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.

Note:
Make sure to call the base class version in subclasses!

Reimplemented in DenseField< Data_T >, MACField< Data_T >, SparseField< Data_T >, DenseField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

Definition at line 869 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); }
template<class Data_T>
void ResizableField< Data_T >::setSize ( const V3i size)

Resizes the object.

Warning:
Never call this from a constructor. It calls the virtual function sizeChanged().
template<class Data_T>
void ResizableField< Data_T >::setSize ( const Box3i extents)

Resizes the object.

Warning:
Never call this from a constructor. It calls the virtual function sizeChanged().
template<class Data_T>
void ResizableField< Data_T >::setSize ( const Box3i extents,
const Box3i dataWindow 
)

Resizes the object.

Warning:
Never call this from a constructor. It calls the virtual function sizeChanged().
template<class Data_T>
void ResizableField< Data_T >::setSize ( const V3i size,
int  padding 
)

Resizes the object with padding.

Warning:
Never call this from a constructor. It calls the virtual function sizeChanged().
template<class Data_T>
void ResizableField< Data_T >::copyFrom ( typename Field< Data_T >::Ptr  other)

Copies the data from another Field, also resizes.

template<class Data_T>
template<class Data_T2 >
void ResizableField< Data_T >::copyFrom ( typename Field< Data_T2 >::Ptr  other)

Copies the data from another Field of another template class, also resizes.

template<class Data_T>
void ResizableField< Data_T >::matchDefinition ( FieldRes::Ptr  fieldToMatch)

Sets up this field so that resolution and mapping matches the other.

template<class Data_T>
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.

Note:
Make sure to call the base class version in subclasses!

Reimplemented in DenseField< Data_T >, MACField< Data_T >, SparseField< Data_T >, DenseField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.

Definition at line 869 of file Field.h.

References FieldRes::m_extents, and FieldRes::m_mapping.

  { base::m_mapping->setExtents(base::m_extents); }

Member Data Documentation

template<class Data_T>
ResizableField< Data_T >::DEFINE_FIELD_RTTI_ABSTRACT_CLASS

Reimplemented from WritableField< Data_T >.

Definition at line 827 of file Field.h.


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