Field3D
|
#include <Field.h>
Public Types | |
typedef FieldRes | class_type |
typedef boost::intrusive_ptr < FieldRes > | Ptr |
typedef std::vector< Ptr > | Vec |
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 long long int | memSize () const |
Returns the memory usage (in bytes) | |
void | setMapping (FieldMapping::Ptr mapping) |
Sets the field's mapping. | |
Static Public Member Functions | |
static const char * | classType () |
static const char * | staticClassName () |
Public Attributes | |
DEFINE_FIELD_RTTI_ABSTRACT_CLASS | |
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. |
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.
typedef boost::intrusive_ptr<FieldRes> FieldRes::Ptr |
Reimplemented from FieldBase.
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, Field< Data_T >, WritableField< Data_T >, ResizableField< Data_T >, MACField< Data_T >, ProceduralField< Data_T >, and SparseField< Data_T >.
typedef std::vector<Ptr> FieldRes::Vec |
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, Field< Data_T >, MACField< Data_T >, and SparseField< Data_T >.
typedef FieldRes FieldRes::class_type |
Reimplemented from FieldBase.
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, Field< Data_T >, WritableField< Data_T >, ResizableField< Data_T >, MACField< Data_T >, ProceduralField< Data_T >, and SparseField< Data_T >.
typedef MatrixFieldMapping FieldRes::default_mapping [protected] |
typedef FieldBase FieldRes::base [private] |
Convenience typedef for referring to base class.
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, Field< Data_T >, WritableField< Data_T >, ResizableField< Data_T >, MACField< Data_T >, ProceduralField< Data_T >, and SparseField< Data_T >.
FieldRes::FieldRes | ( | ) | [inline] |
This constructor ensures that we have a valid mapping at all times.
Definition at line 314 of file Field.h.
References m_dataWindow, m_extents, and m_mapping.
: m_mapping(new default_mapping) { m_extents = Box3i(V3i(0), V3i(-1)); m_dataWindow = m_extents; m_mapping->setExtents(m_extents); }
FieldRes::FieldRes | ( | const FieldRes & | src | ) | [inline] |
virtual std::string FieldRes::dataTypeString | ( | ) | const [inline, virtual] |
Reimplemented in Field< Data_T >.
Definition at line 223 of file Field.h.
{ return std::string("FieldRes"); }
static const char* FieldRes::staticClassName | ( | ) | [inline, static] |
Reimplemented from FieldBase.
Reimplemented in DenseField< Data_T >, Field< Data_T >, WritableField< Data_T >, ResizableField< Data_T >, MACField< Data_T >, ProceduralField< Data_T >, and SparseField< Data_T >.
Definition at line 226 of file Field.h.
{ return "FieldRes"; }
static const char* FieldRes::classType | ( | ) | [inline, static] |
Reimplemented from FieldBase.
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, Field< Data_T >, WritableField< Data_T >, ResizableField< Data_T >, MACField< Data_T >, ProceduralField< Data_T >, and SparseField< Data_T >.
Definition at line 231 of file Field.h.
{ return staticClassName(); }
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 251 of file Field.h.
Referenced by convertCellCenteredToMAC(), convertMACToCellCentered(), ResizableField< Data_T >::copyFrom(), sameDefinition(), SparseFieldIO::writeInternal(), MACFieldIO::writeInternal(), and DenseFieldIO::writeInternal().
{ 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 255 of file Field.h.
Referenced by convertCellCenteredToMAC(), convertMACToCellCentered(), ResizableField< Data_T >::copyFrom(), sameDefinition(), CubicMACFieldInterp< Data_T >::sample(), LinearMACFieldInterp< Data_T >::sample(), CubicFieldInterp< Data_T >::sample(), LinearFieldInterp< Data_T >::sample(), SparseFieldIO::writeInternal(), MACFieldIO::writeInternal(), and DenseFieldIO::writeInternal().
{ return m_dataWindow; }
V3i const FieldRes::dataResolution | ( | ) | const [inline] |
Definition at line 258 of file Field.h.
Referenced by SparseField< Data_T >::begin(), WritableField< Data_T >::begin(), DenseField< Data_T >::begin(), MACField< Data_T >::begin_comp(), SparseField< Data_T >::blockBegin(), SparseField< Data_T >::cbegin(), Field< Data_T >::cbegin(), DenseField< Data_T >::cbegin(), MACField< Data_T >::cbegin_comp(), SparseField< Data_T >::releaseBlocks(), and ProceduralFieldLookup< Data_T >::sample().
{ return m_dataWindow.max - m_dataWindow.min + V3i(1); }
void FieldRes::setMapping | ( | FieldMapping::Ptr | mapping | ) | [inline] |
Sets the field's mapping.
Definition at line 336 of file Field.h.
References m_extents, m_mapping, Msg::print(), and Msg::SevWarning.
Referenced by convertCellCenteredToMAC(), ResizableField< Data_T >::copyFrom(), 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] |
Returns a pointer to the mapping.
Definition at line 265 of file Field.h.
Referenced by convertCellCenteredToMAC(), convertMACToCellCentered(), ResizableField< Data_T >::copyFrom(), Field3DOutputFile::createNewPartition(), FieldRes(), sameDefinition(), Field3DOutputFile::writeLayer(), and wsSample().
{ return m_mapping; }
const FieldMapping::Ptr FieldRes::mapping | ( | ) | const [inline] |
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 349 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)
Reimplemented in DenseField< Data_T >, EmptyField< Data_T >, MACField< Data_T >, and SparseField< Data_T >.
Definition at line 281 of file Field.h.
{ return sizeof(*this); }
Reimplemented in Field< Data_T >, WritableField< Data_T >, and ResizableField< Data_T >.
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 296 of file Field.h.
Referenced by FieldRes(), setMapping(), and ResizableField< Data_T >::sizeChanged().
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 299 of file Field.h.
Referenced by SparseField< Data_T >::applyDataWindowOffset(), FieldRes(), and isInBounds().
FieldMapping::Ptr FieldRes::m_mapping [protected] |
Pointer to the field's mapping.
Definition at line 301 of file Field.h.
Referenced by FieldRes(), setMapping(), and ResizableField< Data_T >::sizeChanged().