FieldRes Class Reference
Fields

`#include <Field.h>`

Inheritance diagram for FieldRes:

## Public Types

typedef FieldRes | class_type
typedef boost::intrusive_ptr< FieldRes > | Ptr
typedef std::vector< Ptr > | Vec
Public Types inherited from FieldBase
typedef FieldBase | class_type
typedef boost::intrusive_ptr< FieldBase > | Ptr
Public Types inherited from RefBase
typedef boost::intrusive_ptr< RefBase > | Ptr
typedef boost::weak_ptr< RefBase > | WeakPtr

## Public Member Functions

V3i const | dataResolution () const
virtual std::string | dataTypeString () const
const Box3i & | dataWindow () const
| Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field subclass.
const Box3i & | extents () 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.
bool | isInBounds (int i, int j, int k) const
| Returns true is the indicies are in bounds of the data window.
FieldMapping::Ptr | mapping ()
| Returns a pointer to the mapping.
const FieldMapping::Ptr | mapping () const
| Returns a pointer to the mapping.
virtual void | mappingChanged ()
| Tells the subclass that the mapping changed.
virtual long long int | memSize () const
| Returns the memory usage (in bytes).
void | setMapping (FieldMapping::Ptr mapping)
| Sets the field's mapping.
virtual size_t | voxelCount () const
| Counts the number of voxels. For most fields, this is just the volume of the data window, but sparse data structures can override this to return a better value.
Public Member Functions inherited from FieldBase
| FieldBase ()
| Constructor.
| FieldBase (const FieldBase &)
| Copy Constructor.
virtual | ~FieldBase ()
| Destructor.
virtual std::string | className () const =0
| Returns the class name of the object. Used by the class pool and when writing the data to disk.
virtual std::string | classType () const =0
| Returns the full class type string.
virtual Ptr | clone () const =0
| Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement it.
FieldMetadata & | metadata ()
| accessor to the m_metadata class
const FieldMetadata & | metadata () const
| Read only access to the m_metadata class.
void | copyMetadata (const FieldBase &field)
| Copies the metadata from a second field.
Public Member Functions inherited from RefBase
void | ref () const
| Used by boost::intrusive_pointer.
size_t | refcnt ()
| Used by boost::intrusive_pointer.
void | unref () const
| Used by boost::intrusive_pointer.
WeakPtr | weakPtr () const
| RefBase ()
| RefBase (const RefBase &)
| Copy constructor.
RefBase & | operator= (const RefBase &)
| Assignment operator.
virtual | ~RefBase ()
| Destructor.
virtual bool | checkRTTI (const char *typenameStr)=0
| This function is only implemented by concrete classes and triggers the actual RTTI check through matchRTTI();.
bool | matchRTTI (const char *typenameStr)
| Performs a check to see if the given typename string matches this class' This needs to be implemented in -all- subclasses, even abstract ones.
Public Member Functions inherited from MetadataCallback
virtual void | metadataHasChanged (const std::string &)
| Alerts the callback holder that the metadata has changed.

## Static Public Member Functions

static const char * | staticClassName ()
static const char * | staticClassType ()
Static Public Member Functions inherited from FieldBase
static const char * | staticClassName ()
static const char * | staticClassType ()
static const char * | staticClassType ()

## Public Attributes

| DEFINE_FIELD_RTTI_ABSTRACT_CLASS
Public Attributes inherited from FieldBase
std::string | attribute
| Optional name of the attribute the field represents.
std::string | name
| Optional name of the field.

## Protected Types

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.

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

## Member Typedef Documentation

## Ptr

typedef boost::intrusive_ptr<FieldRes> FieldRes::Ptr

Definition at line 213 of file Field.h.

## Vec

typedef std::vector<Ptr> FieldRes::Vec

Definition at line 214 of file Field.h.

## class_type

typedef FieldRes FieldRes::class_type

Definition at line 218 of file Field.h.

## default_mapping

typedef MatrixFieldMapping FieldRes::default_mapping

protected

Definition at line 299 of file Field.h.

## base

typedef FieldBase FieldRes::base

private

Convenience typedef for referring to base class.

Definition at line 319 of file Field.h.

## Constructor & Destructor Documentation

## FieldRes() [1/2]

FieldRes::FieldRes | ( |  | ) |

inline

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

Definition at line 325 of file Field.h.

: m_mapping(new default_mapping)
{
m_extents = Box3i(V3i(0), V3i(-1));
m_dataWindow = m_extents;
m_mapping->setExtents(m_extents);
}
V3i
Imath::V3i V3i
Definition SpiMathLib.h:71
Box3i
Imath::Box3i Box3i
Definition SpiMathLib.h:77
FieldRes::m_extents
Box3i m_extents
Defines the extents of the the storage. This may be larger or smaller than the data window,...
Definition Field.h:307
FieldRes::m_dataWindow
Box3i m_dataWindow
Defines the area where data is allocated. This should be treated as a closed (i.e....
Definition Field.h:310
FieldRes::default_mapping
MatrixFieldMapping default_mapping
Definition Field.h:299
FieldRes::m_mapping
FieldMapping::Ptr m_mapping
Pointer to the field's mapping.
Definition Field.h:312

References m_dataWindow, m_extents, and m_mapping.

Referenced by FieldRes().

## FieldRes() [2/2]

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

: FieldBase(src)
{
// Call base class first
// FieldBase(src);
// Copy self
*this = src;
m_mapping = src.mapping()->clone();
}
FieldBase::FieldBase
FieldBase()
Constructor.
Definition Field.cpp:54
FieldRes::mapping
FieldMapping::Ptr mapping()
Returns a pointer to the mapping.
Definition Field.h:263

References FieldBase::clone(), FieldBase::FieldBase(), FieldRes(), m_mapping, and mapping().

## Member Function Documentation

## dataTypeString()

virtual std::string FieldRes::dataTypeString | ( |  | ) | const

inline virtual

Reimplemented in Field< Data_T >, and Field< Field_T::value_type >.

Definition at line 221 of file Field.h.

{ return std::string("FieldRes"); }

## staticClassName()

const char * FieldRes::staticClassName | ( |  | ) |

inline static

Definition at line 224 of file Field.h.

{
return "FieldRes";
}

Referenced by staticClassType().

## staticClassType()

const char * FieldRes::staticClassType | ( |  | ) |

inline static

Definition at line 229 of file Field.h.

{
return staticClassName();
}
FieldRes::staticClassName
static const char * staticClassName()
Definition Field.h:224

References staticClassName().

## extents()

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

{ return m_extents; }

References m_extents.

Referenced by convertCellCenteredToMAC(), convertMACToCellCentered(), ResizableField< Data_T >::copyFrom(), ResizableField< Data_T >::copyFrom(), MIPField< Field_T >::loadLevelFromDisk(), MIPField< Field_T >::mappingChanged(), sameDefinition(), ResizableField< Data_T >::setSize(), and ResizableField< Data_T >::setSize().

## dataWindow()

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

{ return m_dataWindow; }

References m_dataWindow.

Referenced by MACField< Data_T >::begin_comp(), MACField< Data_T >::begin_comp(), MACField< Data_T >::cbegin_comp(), MACField< Data_T >::cbegin_comp(), MACField< Data_T >::cend_comp(), MACField< Data_T >::cend_comp(), detail::checkInputEmpty(), convertCellCenteredToMAC(), convertMACToCellCentered(), ResizableField< Data_T >::copyFrom(), ResizableField< Data_T >::copyFrom(), MACField< Data_T >::end_comp(), MACField< Data_T >::end_comp(), MIPField< Field_T >::loadLevelFromDisk(), MIPField< Field_T >::mappingChanged(), sameDefinition(), CubicFieldInterp< Data_T >::sample(), CubicMACFieldInterp< Data_T >::sample(), LinearFieldInterp< Data_T >::sample(), LinearMACFieldInterp< Data_T >::sample(), LinearMACFieldInterp< Data_T >::sample(), LinearSparseFieldInterp< Data_T >::sample(), and ResizableField< Data_T >::setSize().

## dataResolution()

V3i const FieldRes::dataResolution | ( |  | ) | const

inline

Definition at line 256 of file Field.h.

{ return m_dataWindow.max - m_dataWindow.min + V3i(1); }

References m_dataWindow.

Referenced by DenseField< Data_T >::begin(), SparseField< Data_T >::begin(), WritableField< Data_T >::begin(), MACField< Data_T >::begin_comp(), SparseField< Data_T >::blockBegin(), DenseField< Data_T >::cbegin(), Field< Data_T >::cbegin(), SparseField< Data_T >::cbegin(), MACField< Data_T >::cbegin_comp(), SparseField< Data_T >::releaseBlocks(), and ProceduralFieldLookup< Data_T >::sample().

## setMapping()

void FieldRes::setMapping | ( | FieldMapping::Ptr | mapping | ) |

inline

Sets the field's mapping.

Definition at line 347 of file Field.h.

{
if (mapping) {
m_mapping = mapping->clone();
m_mapping->setExtents(m_extents);
} else {
Msg::print(Msg::SevWarning,
"Tried to call FieldRes::setMapping with null pointer");
}
// Tell subclasses about the mapping change
mappingChanged();
}
FieldRes::mappingChanged
virtual void mappingChanged()
Tells the subclass that the mapping changed.
Definition Field.h:283
Msg::SevWarning
@ SevWarning
Definition Log.h:68
Msg::print
FIELD3D_API void print(Severity severity, const std::string &message)
Sends the string to the assigned output, prefixing the message with the severity.
Definition Log.cpp:70

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

Referenced by convertCellCenteredToMAC(), ResizableField< Data_T >::copyFrom(), ResizableField< Data_T >::copyFrom(), ResizableField< Data_T >::matchDefinition(), Field3DInputFile::readLayer(), Field3DInputFileHDF5::readLayer(), Field3DInputFile::readProxyLayer(), Field3DInputFileHDF5::readProxyLayer(), and MIPField< Field_T >::updateMapping().

## mapping() [1/2]

FieldMapping::Ptr FieldRes::mapping | ( |  | ) |

inline

Returns a pointer to the mapping.

Definition at line 263 of file Field.h.

{ return m_mapping; }

References m_mapping.

Referenced by detail::adjustedMIPFieldMapping(), computeOffset(), convertCellCenteredToMAC(), convertMACToCellCentered(), ResizableField< Data_T >::copyFrom(), ResizableField< Data_T >::copyFrom(), Field3DOutputFileHDF5::createNewPartition(), FieldRes(), MIPField< Field_T >::loadLevelFromDisk(), MIPField< Field_T >::mappingChanged(), sameDefinition(), setMapping(), Field3DOutputFile::writeLayer(), Field3DOutputFileHDF5::writeLayer(), and wsSample().

## mapping() [2/2]

const FieldMapping::Ptr FieldRes::mapping | ( |  | ) | const

inline

Returns a pointer to the mapping.

Definition at line 267 of file Field.h.

{ return m_mapping; }

References m_mapping.

## isInBounds()

bool FieldRes::isInBounds | ( | int | i,
|  | int | j,
|  | int | k ) const

inline

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

Definition at line 362 of file Field.h.

{
// 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;
}

References m_dataWindow.

## memSize()

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 >, DenseField< double >, DenseField< float >, DenseField< half >, DenseField< V3d >, DenseField< V3f >, DenseField< V3h >, EmptyField< Data_T >, EmptyField< float >, MACField< Data_T >, MACField< V3d >, MACField< V3f >, MACField< V3h >, MIPField< Field_T >, MIPField< DenseField< Data_T > >, MIPField< SparseField< Data_T > >, Ptr< float >, real_t< Data_T >, SparseField< Data_T >, SparseField< double >, SparseField< float >, SparseField< half >, SparseField< V3d >, SparseField< V3f >, and SparseField< V3h >.

Definition at line 279 of file Field.h.

{ return sizeof(*this); }

Referenced by DenseField< Data_T >::memSize(), EmptyField< Data_T >::memSize(), and MACField< Data_T >::memSize().

## mappingChanged()

virtual void FieldRes::mappingChanged | ( |  | ) |

inline virtual

Tells the subclass that the mapping changed.

Reimplemented in MIPField< Field_T >, MIPField< DenseField< Data_T > >, and MIPField< SparseField< Data_T > >.

Definition at line 283 of file Field.h.

{ /* Empty */ }

Referenced by setMapping().

## voxelCount()

virtual size_t FieldRes::voxelCount | ( |  | ) | const

inline virtual

Counts the number of voxels. For most fields, this is just the volume of the data window, but sparse data structures can override this to return a better value.

Reimplemented in MIPField< Field_T >, MIPField< DenseField< Data_T > >, MIPField< SparseField< Data_T > >, SparseField< Data_T >, SparseField< double >, SparseField< float >, SparseField< half >, SparseField< V3d >, SparseField< V3f >, and SparseField< V3h >.

Definition at line 289 of file Field.h.

{
V3i res = m_dataWindow.size() + V3i(1);
return res.x * res.y * res.z;
}

References m_dataWindow.

## Member Data Documentation

## DEFINE_FIELD_RTTI_ABSTRACT_CLASS

FieldRes::DEFINE_FIELD_RTTI_ABSTRACT_CLASS

Definition at line 219 of file Field.h.

## m_extents

Box3i FieldRes::m_extents

protected

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

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

## m_dataWindow

Box3i FieldRes::m_dataWindow

protected

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

Definition at line 310 of file Field.h.

Referenced by SparseField< half >::applyDataWindowOffset(), DenseField< Data_T >::begin(), SparseField< Data_T >::begin(), WritableField< Data_T >::begin(), MACField< Data_T >::begin_comp(), DenseField< Data_T >::cbegin(), Field< Data_T >::cbegin(), SparseField< Data_T >::cbegin(), MACField< Data_T >::cbegin_comp(), DenseField< Data_T >::cend(), Field< Data_T >::cend(), SparseField< Data_T >::cend(), MACField< Data_T >::cend_comp(), dataResolution(), dataWindow(), DenseField< Data_T >::end(), SparseField< Data_T >::end(), WritableField< Data_T >::end(), MACField< Data_T >::end_comp(), DenseField< Data_T >::fastLValue(), SparseField< Data_T >::fastLValue(), DenseField< Data_T >::fastValue(), SparseField< Data_T >::fastValue(), FieldRes(), DenseField< Data_T >::getGrainBounds(), SparseField< Data_T >::getGrainBounds(), isInBounds(), EmptyField< Data_T >::lvalue(), DenseField< Data_T >::numGrains(), DenseField< Data_T >::ptr(), DenseField< Data_T >::ptr(), ResizableField< Data_T >::setSize(), ResizableField< Data_T >::setSize(), ResizableField< Data_T >::setSize(), SparseField< Data_T >::setupBlocks(), DenseField< Data_T >::sizeChanged(), MACField< Data_T >::sizeChanged(), MACField< Data_T >::u(), MACField< Data_T >::u(), MIPField< Field_T >::updateMapping(), MACField< Data_T >::uPtr(), MACField< Data_T >::uPtr(), MACField< Data_T >::v(), MACField< Data_T >::v(), EmptyField< Data_T >::value(), voxelCount(), MACField< Data_T >::vPtr(), MACField< Data_T >::vPtr(), MACField< Data_T >::w(), MACField< Data_T >::w(), MACField< Data_T >::wPtr(), and MACField< Data_T >::wPtr().

## m_mapping

FieldMapping::Ptr FieldRes::m_mapping

protected

Pointer to the field's mapping.

Definition at line 312 of file Field.h.

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

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

- export/Field.h