Field3D
FieldRes Class Reference

#include <Field.h>

Inheritance diagram for FieldRes:
FieldBase FieldBase RefBase RefBase RefBase RefBase Field< Data_T > Field< Data_T > ProceduralField< Data_T > ProceduralField< Data_T > WritableField< Data_T > WritableField< Data_T > ProceduralField< Data_T > ProceduralField< Data_T > WritableField< Data_T > WritableField< Data_T >

List of all members.

Public Types

typedef FieldRes class_type
typedef FieldRes class_type
typedef boost::intrusive_ptr
< FieldRes
Ptr
typedef boost::intrusive_ptr
< FieldRes
Ptr
typedef std::vector< PtrVec
typedef std::vector< PtrVec

Public Member Functions

V3i const dataResolution () const
V3i const dataResolution () const
virtual std::string dataTypeString () const =0
virtual std::string dataTypeString () const =0
const Box3idataWindow () const
 Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field subclass.
const Box3idataWindow () const
 Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field subclass.
const Box3iextents () const
 Returns the extents of the data. This signifies the relevant area that the data exists over. However, the data window (below) may be smaller than the extents, in which case it is only safe to call value() for those coordinate inside the data window.
const Box3iextents () const
 Returns the extents of the data. This signifies the relevant area that the data exists over. However, the data window (below) may be smaller than the extents, in which case it is only safe to call value() for those coordinate inside the data window.
 FieldRes ()
 This constructor ensures that we have a valid mapping at all times.
 FieldRes (const FieldRes &src)
 Base class copy constructor.
 FieldRes ()
 This constructor ensures that we have a valid mapping at all times.
 FieldRes (const FieldRes &src)
 Base class copy constructor.
bool isInBounds (int i, int j, int k)
 Returns true is the indicies are in bounds of the data window.
bool isInBounds (int i, int j, int k)
 Returns true is the indicies are in bounds of the data window.
const FieldMapping::Ptr mapping () const
 Returns a pointer to the mapping.
FieldMapping::Ptr mapping ()
 Returns a pointer to the mapping.
FieldMapping::Ptr mapping ()
 Returns a pointer to the mapping.
const FieldMapping::Ptr mapping () const
 Returns a pointer to the mapping.
virtual long long int memSize () const
 Returns the memory usage (in bytes)
virtual long long int memSize () const
 Returns the memory usage (in bytes)
void setMapping (FieldMapping::Ptr mapping)
 Sets the field's mapping.
void setMapping (FieldMapping::Ptr mapping)
 Sets the field's mapping.

Public Attributes

 DEFINE_FIELD_RTTI_ABSTRACT_CLASS

Protected Types

typedef MatrixFieldMapping default_mapping
typedef MatrixFieldMapping default_mapping

Protected Attributes

Box3i m_dataWindow
 Defines the area where data is allocated. This should be treated as a closed (i.e. inclusive) interval.
Box3i m_extents
 Defines the extents of the the storage. This may be larger or smaller than the data window, and in the case where it is larger, care must be taken not to access voxels outside the data window. This should be treated as a closed (i.e. inclusive) interval.
FieldMapping::Ptr m_mapping
 Pointer to the field's mapping.

Private Types

typedef FieldBase base
 Convenience typedef for referring to base class.
typedef FieldBase base
 Convenience typedef for referring to base class.

Detailed Description

This class serves to isolate the extents and data window from its templated subclasses. Thus, anything that needs to access the extents or data window don't need to know about what data type the subclass is templated on.

It also owns the field's mapping.

Why do we have both an extent and a data window? The extents are used to define which range of voxels define the [0..1] local coordinate system. The data window in turn defines the voxels that are legal to read/write from. Thus, for optimization we may have a large extents but a small data window, or a small extents and a larger data window which would let us apply large-kernel filters without having to deal with boundary conditions.

Definition at line 257 of file Field.h.


Member Typedef Documentation

Definition at line 325 of file Field.h.

Definition at line 325 of file Field.h.


Constructor & Destructor Documentation

FieldRes::FieldRes ( ) [inline]

This constructor ensures that we have a valid mapping at all times.

Definition at line 351 of file Field.h.

References m_dataWindow, m_extents, and m_mapping.

FieldRes::FieldRes ( const FieldRes src) [inline]

Base class copy constructor.

Todo:
OSS Go over the copy constructing - is it implemented right? 8hr

Definition at line 361 of file Field.h.

References m_mapping, and mapping().

  : FieldBase(src)
{
  // Call base class first
  // FieldBase(src);
  // Copy self
  *this = src;
  m_mapping = src.mapping()->clone();
}
FieldRes::FieldRes ( )

This constructor ensures that we have a valid mapping at all times.

FieldRes::FieldRes ( const FieldRes src)

Base class copy constructor.

Todo:
OSS Go over the copy constructing - is it implemented right? 8hr

Member Function Documentation

virtual std::string FieldRes::dataTypeString ( ) const [pure virtual]

Implemented in Field< Data_T >, and Field< Data_T >.

const Box3i& FieldRes::extents ( ) const [inline]

Returns the extents of the data. This signifies the relevant area that the data exists over. However, the data window (below) may be smaller than the extents, in which case it is only safe to call value() for those coordinate inside the data window.

Definition at line 288 of file Field.h.

References m_extents.

Referenced by convertCellCenteredToMAC(), convertMACToCellCentered(), ResizableField< Data_T >::copyFrom(), printFieldInfo(), sameDefinition(), SparseFieldIO::writeInternal(), MACFieldIO::writeInternal(), and DenseFieldIO::writeInternal().

  { return m_extents; }
void FieldRes::setMapping ( FieldMapping::Ptr  mapping) [inline]

Sets the field's mapping.

Definition at line 373 of file Field.h.

References m_extents, m_mapping, Msg::print(), and Msg::SevWarning.

Referenced by convertCellCenteredToMAC(), ResizableField< Data_T >::matchDefinition(), and Field3DInputFile::readProxyLayer().

{ 
  if (mapping) {
    m_mapping = mapping->clone(); 
    m_mapping->setExtents(m_extents); 
  } else {
    Msg::print(Msg::SevWarning, 
               "Tried to call FieldRes::setMapping with null pointer");
  }
}
FieldMapping::Ptr FieldRes::mapping ( ) [inline]
const FieldMapping::Ptr FieldRes::mapping ( ) const [inline]

Returns a pointer to the mapping.

Definition at line 306 of file Field.h.

References m_mapping.

  { return m_mapping; }
bool FieldRes::isInBounds ( int  i,
int  j,
int  k 
) [inline]

Returns true is the indicies are in bounds of the data window.

Definition at line 386 of file Field.h.

References m_dataWindow.

{
  // Check bounds
  if (i < m_dataWindow.min.x || i > m_dataWindow.max.x ||
      j < m_dataWindow.min.y || j > m_dataWindow.max.y ||
      k < m_dataWindow.min.z || k > m_dataWindow.max.z) {
    return false;
  }

  return true;
}
virtual long long int FieldRes::memSize ( ) const [inline, virtual]

Returns the memory usage (in bytes)

Note:
This needs to be re-implemented for any subclass that adds data members. Those classes should also call their superclass and add the combined memory use.

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 318 of file Field.h.

  { return sizeof(*this); }
virtual std::string FieldRes::dataTypeString ( ) const [pure virtual]

Implemented in Field< Data_T >, and Field< Data_T >.

const Box3i& FieldRes::extents ( ) const [inline]

Returns the extents of the data. This signifies the relevant area that the data exists over. However, the data window (below) may be smaller than the extents, in which case it is only safe to call value() for those coordinate inside the data window.

Definition at line 288 of file Field.h.

References m_extents.

  { return m_extents; }
const Box3i& FieldRes::dataWindow ( ) const [inline]

Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field subclass.

Definition at line 292 of file Field.h.

References m_dataWindow.

  { return m_dataWindow; }
V3i const FieldRes::dataResolution ( ) const [inline]

Definition at line 295 of file Field.h.

References m_dataWindow.

  { return m_dataWindow.max - m_dataWindow.min + V3i(1); }
void FieldRes::setMapping ( FieldMapping::Ptr  mapping)

Sets the field's mapping.

FieldMapping::Ptr FieldRes::mapping ( ) [inline]

Returns a pointer to the mapping.

Definition at line 302 of file Field.h.

References m_mapping.

  { return m_mapping; }
const FieldMapping::Ptr FieldRes::mapping ( ) const [inline]

Returns a pointer to the mapping.

Definition at line 306 of file Field.h.

References m_mapping.

  { return m_mapping; }
bool FieldRes::isInBounds ( int  i,
int  j,
int  k 
)

Returns true is the indicies are in bounds of the data window.

virtual long long int FieldRes::memSize ( ) const [inline, virtual]

Returns the memory usage (in bytes)

Note:
This needs to be re-implemented for any subclass that adds data members. Those classes should also call their superclass and add the combined memory use.

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 318 of file Field.h.

  { return sizeof(*this); }

Member Data Documentation

Defines the extents of the the storage. This may be larger or smaller than the data window, and in the case where it is larger, care must be taken not to access voxels outside the data window. This should be treated as a closed (i.e. inclusive) interval.

Definition at line 333 of file Field.h.

Referenced by extents(), FieldRes(), setMapping(), and ResizableField< Data_T >::sizeChanged().

Defines the area where data is allocated. This should be treated as a closed (i.e. inclusive) interval.

Definition at line 336 of file Field.h.

Referenced by SparseField< Data_T >::applyDataWindowOffset(), dataResolution(), dataWindow(), FieldRes(), and isInBounds().

Pointer to the field's mapping.

Definition at line 338 of file Field.h.

Referenced by FieldRes(), mapping(), setMapping(), and ResizableField< Data_T >::sizeChanged().


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