Field3D
|
This subclass of Field implements a standard MAC field. Refer to your favorite fluid simulations book for an explanation. More...
#include <MACField.h>
Classes | |
class | const_mac_comp_iterator |
class | mac_comp_iterator |
Public Types | |
typedef MACField< Data_T > | class_type |
typedef MACField< Data_T > | class_type |
typedef CubicMACFieldInterp < Data_T > | CubicInterp |
typedef CubicMACFieldInterp < Data_T > | CubicInterp |
typedef LinearMACFieldInterp < Data_T > | LinearInterp |
typedef LinearMACFieldInterp < Data_T > | LinearInterp |
typedef boost::intrusive_ptr < MACField > | Ptr |
typedef boost::intrusive_ptr < MACField > | Ptr |
typedef Data_T::BaseType | real_t |
This typedef is used to refer to the scalar component type of the vectors. | |
typedef Data_T::BaseType | real_t |
This typedef is used to refer to the scalar component type of the vectors. | |
typedef std::vector< Ptr > | Vec |
This is a convenience typedef for the list that Field3DInputFile::readScalarLayers() and Field3DInputFile::readVectorLayers() will return its data in. | |
typedef std::vector< Ptr > | Vec |
This is a convenience typedef for the list that Field3DInputFile::readScalarLayers() and Field3DInputFile::readVectorLayers() will return its data in. | |
Public Member Functions | |
virtual void | clear (const Data_T &value) |
Clears all the voxels in the storage. | |
virtual void | clear (const Data_T &value) |
Clears all the voxels in the storage. | |
void | copyMAC (MACField::Ptr other) |
TEMP: Copies the MAC field data from another MAC field. This should be re-implemented using proper iterators over the field. | |
void | copyMAC (MACField::Ptr other) |
TEMP: Copies the MAC field data from another MAC field. This should be re-implemented using proper iterators over the field. | |
V3i | getComponentSize () const |
Returns the size of U,V,W components. | |
V3i | getComponentSize () const |
Returns the size of U,V,W components. | |
real_t | uCenter (int i, int j, int k) const |
Returns the u-component interpolated to the cell center. | |
real_t | uCenter (int i, int j, int k) const |
Returns the u-component interpolated to the cell center. | |
real_t | vCenter (int i, int j, int k) const |
Returns the v-component interpolated to the cell center. | |
real_t | vCenter (int i, int j, int k) const |
Returns the v-component interpolated to the cell center. | |
real_t | wCenter (int i, int j, int k) const |
Returns the w-component interpolated to the cell center. | |
real_t | wCenter (int i, int j, int k) const |
Returns the w-component interpolated to the cell center. | |
Constructors & destructor | |
MACField () | |
Constructs an empty buffer. | |
MACField () | |
Constructs an empty buffer. | |
From Field | |
virtual Data_T | value (int i, int j, int k) const |
virtual long long int | memSize () const |
Returns the memory usage (in bytes) | |
virtual Data_T | value (int i, int j, int k) const |
virtual long long int | memSize () const |
Returns the memory usage (in bytes) | |
From WritableField | |
virtual Data_T & | lvalue (int i, int j, int k) |
This will return the appropriate interpolated value but setting that to something else does not change the MAC field. | |
virtual Data_T & | lvalue (int i, int j, int k) |
This will return the appropriate interpolated value but setting that to something else does not change the MAC field. | |
MAC-component access | |
const real_t & | u (int i, int j, int k) const |
Read access to value on u-facing wall. | |
real_t & | u (int i, int j, int k) |
Write access to value on u-facing wall. | |
const real_t & | v (int i, int j, int k) const |
Read access to value on v-facing wall. | |
real_t & | v (int i, int j, int k) |
Write access to value on v-facing wall. | |
const real_t & | w (int i, int j, int k) const |
Read access to value on w-facing wall. | |
real_t & | w (int i, int j, int k) |
Write access to value on w-facing wall. | |
const real_t & | u (int i, int j, int k) const |
Read access to value on u-facing wall. | |
real_t & | u (int i, int j, int k) |
Write access to value on u-facing wall. | |
const real_t & | v (int i, int j, int k) const |
Read access to value on v-facing wall. | |
real_t & | v (int i, int j, int k) |
Write access to value on v-facing wall. | |
const real_t & | w (int i, int j, int k) const |
Read access to value on w-facing wall. | |
real_t & | w (int i, int j, int k) |
Write access to value on w-facing wall. | |
MAC-component iterators | |
A note about MAC iterators The subset that we choose to iterate over is defined by voxels, not MAC face coordinates. Thus, iterator from (0, 0, 0) to (0, 0, 0) will actually visit (0, 0, 0) and (1, 0, 0) for the u component, and (0, 0, 0) to (0, 1, 0) for the v component... | |
const_mac_comp_iterator | cbegin_comp (MACComponent comp) const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard. | |
const_mac_comp_iterator | cbegin_comp (MACComponent comp, const Box3i &subset) const |
Const iterator to first element of specific subset. | |
const_mac_comp_iterator | cend_comp (MACComponent comp) const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard. | |
const_mac_comp_iterator | cend_comp (MACComponent comp, const Box3i &subset) const |
Const iterator to first element of specific subset. | |
mac_comp_iterator | begin_comp (MACComponent comp) |
Iterator to first element. | |
mac_comp_iterator | begin_comp (MACComponent comp, const Box3i &subset) |
Iterator to first element of specific subset. | |
mac_comp_iterator | end_comp (MACComponent comp) |
Iterator to first element. | |
mac_comp_iterator | end_comp (MACComponent comp, const Box3i &subset) |
Iterator to first element of specific subset. | |
const_mac_comp_iterator | cbegin_comp (MACComponent comp) const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard. | |
const_mac_comp_iterator | cbegin_comp (MACComponent comp, const Box3i &subset) const |
Const iterator to first element of specific subset. | |
const_mac_comp_iterator | cend_comp (MACComponent comp) const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard. | |
const_mac_comp_iterator | cend_comp (MACComponent comp, const Box3i &subset) const |
Const iterator to first element of specific subset. | |
mac_comp_iterator | begin_comp (MACComponent comp) |
Iterator to first element. | |
mac_comp_iterator | begin_comp (MACComponent comp, const Box3i &subset) |
Iterator to first element of specific subset. | |
mac_comp_iterator | end_comp (MACComponent comp) |
Iterator to first element. | |
mac_comp_iterator | end_comp (MACComponent comp, const Box3i &subset) |
Iterator to first element of specific subset. | |
From FieldBase | |
virtual std::string | className () const |
Returns the class name of the object. Used by the class pool and when writing the data to disk. | |
virtual FieldBase::Ptr | clone () const |
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement it. | |
virtual std::string | className () const |
Returns the class name of the object. Used by the class pool and when writing the data to disk. | |
virtual FieldBase::Ptr | clone () const |
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement it. | |
Public Attributes | |
DEFINE_FIELD_RTTI_CONCRETE_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. | |
const real_t * | uPtr (int i, int j, int k) const |
Direct access to value on u-facing wall. | |
const real_t * | uPtr (int i, int j, int k) const |
Direct access to value on u-facing wall. | |
real_t * | uPtr (int i, int j, int k) |
Direct access to value on u-facing wall. | |
real_t * | uPtr (int i, int j, int k) |
Direct access to value on u-facing wall. | |
const real_t * | vPtr (int i, int j, int k) const |
Direct access to value on v-facing wall. | |
const real_t * | vPtr (int i, int j, int k) const |
Direct access to value on v-facing wall. | |
real_t * | vPtr (int i, int j, int k) |
Direct access to value on v-facing wall. | |
real_t * | vPtr (int i, int j, int k) |
Direct access to value on v-facing wall. | |
const real_t * | wPtr (int i, int j, int k) const |
Direct access to value on w-facing wall. | |
real_t * | wPtr (int i, int j, int k) |
Direct access to value on w-facing wall. | |
const real_t * | wPtr (int i, int j, int k) const |
Direct access to value on w-facing wall. | |
real_t * | wPtr (int i, int j, int k) |
Direct access to value on w-facing wall. | |
Protected Attributes | |
Data_T | m_dummy |
Dummy storage of a temp value that lvalue() can write to. | |
std::vector< real_t > | m_u |
U component storage. | |
V3i | m_uSize |
Size of U grid along each axis. | |
int | m_uSizeXY |
Size of xy slice for u component. | |
std::vector< real_t > | m_v |
V component storage. | |
V3i | m_vSize |
Size of V grid along each axis. | |
int | m_vSizeXY |
Size of xy slice for v component. | |
std::vector< real_t > | m_w |
W component storage. | |
V3i | m_wSize |
Size of W grid along each axis. | |
int | m_wSizeXY |
Size of xy slice for w component. | |
Private Types | |
typedef ResizableField< Data_T > | base |
Convenience typedef for referring to base class. | |
typedef ResizableField< Data_T > | base |
Convenience typedef for referring to base class. |
This subclass of Field implements a standard MAC field. Refer to your favorite fluid simulations book for an explanation.
The definition for u,v,w indexing used can be found on page 25 in Bridson - Fluid Simulation for Computer Graphics
Definition at line 95 of file MACField.h.
Reimplemented from ResizableField< Data_T >.
Definition at line 101 of file MACField.h.
This is a convenience typedef for the list that Field3DInputFile::readScalarLayers() and Field3DInputFile::readVectorLayers() will return its data in.
Reimplemented from Field< Data_T >.
Definition at line 102 of file MACField.h.
This typedef is used to refer to the scalar component type of the vectors.
Definition at line 105 of file MACField.h.
typedef LinearMACFieldInterp<Data_T> MACField< Data_T >::LinearInterp |
Definition at line 107 of file MACField.h.
typedef CubicMACFieldInterp<Data_T> MACField< Data_T >::CubicInterp |
Definition at line 108 of file MACField.h.
typedef MACField<Data_T> MACField< Data_T >::class_type |
Reimplemented from ResizableField< Data_T >.
Definition at line 138 of file MACField.h.
typedef ResizableField<Data_T> MACField< Data_T >::base [private] |
Convenience typedef for referring to base class.
Reimplemented from ResizableField< Data_T >.
Definition at line 322 of file MACField.h.
Reimplemented from ResizableField< Data_T >.
Definition at line 101 of file MACField.h.
This is a convenience typedef for the list that Field3DInputFile::readScalarLayers() and Field3DInputFile::readVectorLayers() will return its data in.
Reimplemented from Field< Data_T >.
Definition at line 102 of file MACField.h.
This typedef is used to refer to the scalar component type of the vectors.
Definition at line 105 of file MACField.h.
typedef LinearMACFieldInterp<Data_T> MACField< Data_T >::LinearInterp |
Definition at line 107 of file MACField.h.
typedef CubicMACFieldInterp<Data_T> MACField< Data_T >::CubicInterp |
Definition at line 108 of file MACField.h.
typedef MACField<Data_T> MACField< Data_T >::class_type |
Reimplemented from ResizableField< Data_T >.
Definition at line 138 of file MACField.h.
typedef ResizableField<Data_T> MACField< Data_T >::base [private] |
Convenience typedef for referring to base class.
Reimplemented from ResizableField< Data_T >.
Definition at line 322 of file MACField.h.
Constructs an empty buffer.
Definition at line 579 of file MACField.h.
Referenced by MACField< Data_T >::clone().
: base() { }
void MACField< Data_T >::clear | ( | const Data_T & | value | ) | [virtual] |
Data_T MACField< Data_T >::value | ( | int | i, |
int | j, | ||
int | k | ||
) | const [virtual] |
Implements Field< Data_T >.
Definition at line 598 of file MACField.h.
Referenced by convertMACToCellCentered().
long long int MACField< Data_T >::memSize | ( | ) | const [virtual] |
Returns the memory usage (in bytes)
Reimplemented from FieldRes.
Definition at line 606 of file MACField.h.
{ long long int superClassMemSize = base::memSize(); long long int vectorMemSize = (m_u.capacity() + m_v.capacity() + m_w.capacity()) * sizeof(real_t); return sizeof(*this) + vectorMemSize + superClassMemSize; }
Data_T & MACField< Data_T >::lvalue | ( | int | i, |
int | j, | ||
int | k | ||
) | [virtual] |
This will return the appropriate interpolated value but setting that to something else does not change the MAC field.
Implements WritableField< Data_T >.
Definition at line 617 of file MACField.h.
const MACField< Data_T >::real_t & MACField< Data_T >::u | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
Read access to value on u-facing wall.
Definition at line 666 of file MACField.h.
Referenced by convertCellCenteredToMAC(), CubicMACFieldInterp< Data_T >::sample(), LinearMACFieldInterp< Data_T >::sample(), and MACField< Data_T >::uCenter().
{ assert (i >= base::m_dataWindow.min.x); assert (i <= base::m_dataWindow.max.x + 1); assert (j >= base::m_dataWindow.min.y); assert (j <= base::m_dataWindow.max.y); assert (k >= base::m_dataWindow.min.z); assert (k <= base::m_dataWindow.max.z); // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return m_u[i + j * m_uSize.x + k * m_uSizeXY]; }
Write access to value on u-facing wall.
Definition at line 685 of file MACField.h.
{ assert (i >= base::m_dataWindow.min.x); assert (i <= base::m_dataWindow.max.x + 1); assert (j >= base::m_dataWindow.min.y); assert (j <= base::m_dataWindow.max.y); assert (k >= base::m_dataWindow.min.z); assert (k <= base::m_dataWindow.max.z); // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return m_u[i + j * m_uSize.x + k * m_uSizeXY]; }
const MACField< Data_T >::real_t & MACField< Data_T >::v | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
Read access to value on v-facing wall.
Definition at line 704 of file MACField.h.
Referenced by convertCellCenteredToMAC(), CubicMACFieldInterp< Data_T >::sample(), LinearMACFieldInterp< Data_T >::sample(), and MACField< Data_T >::vCenter().
{ assert (i >= base::m_dataWindow.min.x); assert (i <= base::m_dataWindow.max.x); assert (j >= base::m_dataWindow.min.y); assert (j <= base::m_dataWindow.max.y + 1); assert (k >= base::m_dataWindow.min.z); assert (k <= base::m_dataWindow.max.z); // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return m_v[i + j * m_vSize.x + k * m_vSizeXY]; }
Write access to value on v-facing wall.
Definition at line 723 of file MACField.h.
{ assert (i >= base::m_dataWindow.min.x); assert (i <= base::m_dataWindow.max.x); assert (j >= base::m_dataWindow.min.y); assert (j <= base::m_dataWindow.max.y + 1); assert (k >= base::m_dataWindow.min.z); assert (k <= base::m_dataWindow.max.z); // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return m_v[i + j * m_vSize.x + k * m_vSizeXY]; }
const MACField< Data_T >::real_t & MACField< Data_T >::w | ( | int | i, |
int | j, | ||
int | k | ||
) | const |
Read access to value on w-facing wall.
Definition at line 742 of file MACField.h.
Referenced by convertCellCenteredToMAC(), CubicMACFieldInterp< Data_T >::sample(), LinearMACFieldInterp< Data_T >::sample(), and MACField< Data_T >::wCenter().
{ assert (i >= base::m_dataWindow.min.x); assert (i <= base::m_dataWindow.max.x); assert (j >= base::m_dataWindow.min.y); assert (j <= base::m_dataWindow.max.y); assert (k >= base::m_dataWindow.min.z); assert (k <= base::m_dataWindow.max.z + 1); // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return m_w[i + j * m_wSize.x + k * m_wSizeXY]; }
Write access to value on w-facing wall.
Definition at line 761 of file MACField.h.
{ assert (i >= base::m_dataWindow.min.x); assert (i <= base::m_dataWindow.max.x); assert (j >= base::m_dataWindow.min.y); assert (j <= base::m_dataWindow.max.y); assert (k >= base::m_dataWindow.min.z); assert (k <= base::m_dataWindow.max.z + 1); // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return m_w[i + j * m_wSize.x + k * m_wSizeXY]; }
MACField< Data_T >::const_mac_comp_iterator MACField< Data_T >::cbegin_comp | ( | MACComponent | comp | ) | const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard.
Definition at line 780 of file MACField.h.
References FieldRes::dataResolution(), and MACFieldUtil::makeDataWindowForComponent().
Referenced by MACFieldIO::writeData().
{ using namespace MACFieldUtil; if (FieldRes::dataResolution() == V3i(0)) return cend_comp(comp); Box3i dataWindow = makeDataWindowForComponent(base::m_dataWindow, comp); return const_mac_comp_iterator(comp, *this, dataWindow, dataWindow.min); }
MACField< Data_T >::const_mac_comp_iterator MACField< Data_T >::cbegin_comp | ( | MACComponent | comp, |
const Box3i & | subset | ||
) | const |
Const iterator to first element of specific subset.
Definition at line 794 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
{ using namespace MACFieldUtil; if (subset.isEmpty()) return cend_comp(comp, subset); Box3i dataWindow = makeDataWindowForComponent(subset, comp); return const_mac_comp_iterator(comp, *this, dataWindow, subset.min); }
MACField< Data_T >::const_mac_comp_iterator MACField< Data_T >::cend_comp | ( | MACComponent | comp | ) | const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard.
Definition at line 807 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
{ using namespace MACFieldUtil; Box3i dataWindow = makeDataWindowForComponent(base::m_dataWindow, comp); return const_mac_comp_iterator(comp, *this, dataWindow, V3i(dataWindow.min.x, dataWindow.min.y, dataWindow.max.z + 1)); }
MACField< Data_T >::const_mac_comp_iterator MACField< Data_T >::cend_comp | ( | MACComponent | comp, |
const Box3i & | subset | ||
) | const |
Const iterator to first element of specific subset.
Definition at line 822 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
{ using namespace MACFieldUtil; Box3i dataWindow = makeDataWindowForComponent(subset, comp); return const_mac_comp_iterator(comp, *this, dataWindow, V3i(dataWindow.min.x, dataWindow.min.y, dataWindow.max.z + 1)); }
MACField< Data_T >::mac_comp_iterator MACField< Data_T >::begin_comp | ( | MACComponent | comp | ) |
Iterator to first element.
Definition at line 836 of file MACField.h.
References FieldRes::dataResolution(), and MACFieldUtil::makeDataWindowForComponent().
Referenced by MACFieldIO::readData().
{ using namespace MACFieldUtil; if (FieldRes::dataResolution() == V3i(0)) return end_comp(comp); Box3i dataWindow = makeDataWindowForComponent(base::m_dataWindow, comp); return mac_comp_iterator(comp, *this, dataWindow, dataWindow.min); }
MACField< Data_T >::mac_comp_iterator MACField< Data_T >::begin_comp | ( | MACComponent | comp, |
const Box3i & | subset | ||
) |
Iterator to first element of specific subset.
Definition at line 849 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
{ using namespace MACFieldUtil; if (subset.isEmpty()) return end_comp(comp, subset); Box3i dataWindow = makeDataWindowForComponent(subset, comp); return mac_comp_iterator(comp, *this, dataWindow, subset.min); }
MACField< Data_T >::mac_comp_iterator MACField< Data_T >::end_comp | ( | MACComponent | comp | ) |
Iterator to first element.
Definition at line 862 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
{ using namespace MACFieldUtil; Box3i dataWindow = makeDataWindowForComponent(base::m_dataWindow, comp); return mac_comp_iterator(comp, *this, dataWindow, V3i(dataWindow.min.x, dataWindow.min.y, dataWindow.max.z + 1)); }
MACField< Data_T >::mac_comp_iterator MACField< Data_T >::end_comp | ( | MACComponent | comp, |
const Box3i & | subset | ||
) |
Iterator to first element of specific subset.
Definition at line 875 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
{ using namespace MACFieldUtil; Box3i dataWindow = makeDataWindowForComponent(subset, comp); return mac_comp_iterator(comp, *this, dataWindow, V3i(dataWindow.min.x, dataWindow.min.y, dataWindow.max.z + 1)); }
Returns the u-component interpolated to the cell center.
Definition at line 223 of file MACField.h.
References MACField< Data_T >::u().
Returns the v-component interpolated to the cell center.
Definition at line 228 of file MACField.h.
References MACField< Data_T >::v().
Returns the w-component interpolated to the cell center.
Definition at line 233 of file MACField.h.
References MACField< Data_T >::w().
TEMP: Copies the MAC field data from another MAC field. This should be re-implemented using proper iterators over the field.
Definition at line 240 of file MACField.h.
References MACField< Data_T >::m_u, MACField< Data_T >::m_v, MACField< Data_T >::m_w, and ResizableField< Data_T >::matchDefinition().
{ matchDefinition(other); std::copy(other->m_u.begin(), other->m_u.end(), m_u.begin()); std::copy(other->m_v.begin(), other->m_v.end(), m_v.begin()); std::copy(other->m_w.begin(), other->m_w.end(), m_w.begin()); }
Returns the size of U,V,W components.
Definition at line 251 of file MACField.h.
References MACField< Data_T >::m_u, MACField< Data_T >::m_v, and MACField< Data_T >::m_w.
Referenced by MACFieldIO::writeData(), and MACFieldIO::writeInternal().
virtual std::string MACField< Data_T >::className | ( | ) | const [inline, virtual] |
Returns the class name of the object. Used by the class pool and when writing the data to disk.
Implements FieldBase.
Definition at line 258 of file MACField.h.
{ return std::string("MACField"); }
virtual FieldBase::Ptr MACField< Data_T >::clone | ( | ) | const [inline, virtual] |
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement it.
Implements FieldBase.
Definition at line 261 of file MACField.h.
References MACField< Data_T >::MACField().
void MACField< Data_T >::sizeChanged | ( | ) | [protected, virtual] |
Subclasses should re-implement this if they need to perform memory allocations, etc. every time the size of the storage changes.
Reimplemented from ResizableField< Data_T >.
Definition at line 626 of file MACField.h.
{ // Call base class base::sizeChanged(); V3i baseSize = base::m_dataWindow.max - base::m_dataWindow.min + V3i(1); if (std::min(std::min(baseSize.x, baseSize.y), baseSize.z) < 0) throw Exc::ResizeException("Attempt to resize ResizableField object " "using negative size. Data window was: " + boost::lexical_cast<std::string>(baseSize)); // Calculate the size for each component of the MAC field m_uSize = baseSize + V3i(1, 0, 0); m_vSize = baseSize + V3i(0, 1, 0); m_wSize = baseSize + V3i(0, 0, 1); // Calculate the size of each z slice m_uSizeXY = m_uSize.x * m_uSize.y; m_vSizeXY = m_vSize.x * m_vSize.y; m_wSizeXY = m_wSize.x * m_wSize.y; // Allocate memory try { m_u.resize(m_uSize.x * m_uSize.y * m_uSize.z); m_v.resize(m_vSize.x * m_vSize.y * m_vSize.z); m_w.resize(m_wSize.x * m_wSize.y * m_wSize.z); } catch (std::bad_alloc &e) { throw Exc::MemoryException("Couldn't allocate MACField of size " + boost::lexical_cast<std::string>(baseSize)); } }
const MACField< Data_T >::real_t * MACField< Data_T >::uPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | const [protected] |
Direct access to value on u-facing wall.
Definition at line 888 of file MACField.h.
{ // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return &m_u[i + j * m_uSize.x + k * m_uSizeXY]; }
MACField< Data_T >::real_t * MACField< Data_T >::uPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | [protected] |
Direct access to value on u-facing wall.
Definition at line 901 of file MACField.h.
{ // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return &m_u[i + j * m_uSize.x + k * m_uSizeXY]; }
const MACField< Data_T >::real_t * MACField< Data_T >::vPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | const [protected] |
Direct access to value on v-facing wall.
Definition at line 914 of file MACField.h.
{ // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return &m_v[i + j * m_vSize.x + k * m_vSizeXY]; }
MACField< Data_T >::real_t * MACField< Data_T >::vPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | [protected] |
Direct access to value on v-facing wall.
Definition at line 927 of file MACField.h.
{ // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return &m_v[i + j * m_vSize.x + k * m_vSizeXY]; }
const MACField< Data_T >::real_t * MACField< Data_T >::wPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | const [protected] |
Direct access to value on w-facing wall.
Definition at line 940 of file MACField.h.
{ // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return &m_w[i + j * m_wSize.x + k * m_wSizeXY]; }
MACField< Data_T >::real_t * MACField< Data_T >::wPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | [protected] |
Direct access to value on w-facing wall.
Definition at line 953 of file MACField.h.
{ // Add crop window offset i -= base::m_dataWindow.min.x; j -= base::m_dataWindow.min.y; k -= base::m_dataWindow.min.z; return &m_w[i + j * m_wSize.x + k * m_wSizeXY]; }
virtual void MACField< Data_T >::clear | ( | const Data_T & | value | ) | [virtual] |
Clears all the voxels in the storage.
Reimplemented from WritableField< Data_T >.
virtual Data_T MACField< Data_T >::value | ( | int | i, |
int | j, | ||
int | k | ||
) | const [virtual] |
Implements Field< Data_T >.
virtual long long int MACField< Data_T >::memSize | ( | ) | const [virtual] |
Returns the memory usage (in bytes)
Reimplemented from FieldRes.
virtual Data_T& MACField< Data_T >::lvalue | ( | int | i, |
int | j, | ||
int | k | ||
) | [virtual] |
This will return the appropriate interpolated value but setting that to something else does not change the MAC field.
Implements WritableField< Data_T >.
Read access to value on u-facing wall.
Write access to value on u-facing wall.
Read access to value on v-facing wall.
Write access to value on v-facing wall.
Read access to value on w-facing wall.
Write access to value on w-facing wall.
const_mac_comp_iterator MACField< Data_T >::cbegin_comp | ( | MACComponent | comp | ) | const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard.
const_mac_comp_iterator MACField< Data_T >::cbegin_comp | ( | MACComponent | comp, |
const Box3i & | subset | ||
) | const |
Const iterator to first element of specific subset.
const_mac_comp_iterator MACField< Data_T >::cend_comp | ( | MACComponent | comp | ) | const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard.
const_mac_comp_iterator MACField< Data_T >::cend_comp | ( | MACComponent | comp, |
const Box3i & | subset | ||
) | const |
Const iterator to first element of specific subset.
mac_comp_iterator MACField< Data_T >::begin_comp | ( | MACComponent | comp | ) |
Iterator to first element.
mac_comp_iterator MACField< Data_T >::begin_comp | ( | MACComponent | comp, |
const Box3i & | subset | ||
) |
Iterator to first element of specific subset.
mac_comp_iterator MACField< Data_T >::end_comp | ( | MACComponent | comp | ) |
Iterator to first element.
mac_comp_iterator MACField< Data_T >::end_comp | ( | MACComponent | comp, |
const Box3i & | subset | ||
) |
Iterator to first element of specific subset.
Returns the u-component interpolated to the cell center.
Definition at line 223 of file MACField.h.
References MACField< Data_T >::u().
Returns the v-component interpolated to the cell center.
Definition at line 228 of file MACField.h.
References MACField< Data_T >::v().
Returns the w-component interpolated to the cell center.
Definition at line 233 of file MACField.h.
References MACField< Data_T >::w().
TEMP: Copies the MAC field data from another MAC field. This should be re-implemented using proper iterators over the field.
Definition at line 240 of file MACField.h.
References MACField< Data_T >::m_u, MACField< Data_T >::m_v, MACField< Data_T >::m_w, and ResizableField< Data_T >::matchDefinition().
{ matchDefinition(other); std::copy(other->m_u.begin(), other->m_u.end(), m_u.begin()); std::copy(other->m_v.begin(), other->m_v.end(), m_v.begin()); std::copy(other->m_w.begin(), other->m_w.end(), m_w.begin()); }
Returns the size of U,V,W components.
Definition at line 251 of file MACField.h.
References MACField< Data_T >::m_u, MACField< Data_T >::m_v, and MACField< Data_T >::m_w.
virtual std::string MACField< Data_T >::className | ( | ) | const [inline, virtual] |
Returns the class name of the object. Used by the class pool and when writing the data to disk.
Implements FieldBase.
Definition at line 258 of file MACField.h.
{ return std::string("MACField"); }
virtual FieldBase::Ptr MACField< Data_T >::clone | ( | ) | const [inline, virtual] |
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement it.
Implements FieldBase.
Definition at line 261 of file MACField.h.
References MACField< Data_T >::MACField().
virtual void MACField< Data_T >::sizeChanged | ( | ) | [protected, virtual] |
Subclasses should re-implement this if they need to perform memory allocations, etc. every time the size of the storage changes.
Reimplemented from ResizableField< Data_T >.
const real_t* MACField< Data_T >::uPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | const [protected] |
Direct access to value on u-facing wall.
Direct access to value on u-facing wall.
const real_t* MACField< Data_T >::vPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | const [protected] |
Direct access to value on v-facing wall.
Direct access to value on v-facing wall.
const real_t* MACField< Data_T >::wPtr | ( | int | i, |
int | j, | ||
int | k | ||
) | const [protected] |
Direct access to value on w-facing wall.
Direct access to value on w-facing wall.
MACField< Data_T >::DEFINE_FIELD_RTTI_CONCRETE_CLASS |
Definition at line 139 of file MACField.h.
U component storage.
Definition at line 296 of file MACField.h.
Referenced by MACField< Data_T >::copyMAC(), and MACField< Data_T >::getComponentSize().
V component storage.
Definition at line 298 of file MACField.h.
Referenced by MACField< Data_T >::copyMAC(), and MACField< Data_T >::getComponentSize().
W component storage.
Definition at line 300 of file MACField.h.
Referenced by MACField< Data_T >::copyMAC(), and MACField< Data_T >::getComponentSize().
Size of U grid along each axis.
Definition at line 303 of file MACField.h.
Size of xy slice for u component.
Definition at line 305 of file MACField.h.
Size of V grid along each axis.
Definition at line 307 of file MACField.h.
Size of xy slice for v component.
Definition at line 309 of file MACField.h.
Size of W grid along each axis.
Definition at line 311 of file MACField.h.
Size of xy slice for w component.
Definition at line 313 of file MACField.h.
Dummy storage of a temp value that lvalue() can write to.
Definition at line 316 of file MACField.h.