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 CubicMACFieldInterp< Data_T > | CubicInterp |
typedef LinearMACFieldInterp< Data_T > | LinearInterp |
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. More... | |
typedef std::vector< Ptr > | Vec |
![]() | |
typedef ResizableField< Data_T > | class_type |
typedef boost::intrusive_ptr< ResizableField > | Ptr |
![]() | |
typedef WritableField< Data_T > | class_type |
typedef boost::intrusive_ptr< WritableField > | Ptr |
![]() | |
typedef Field< Data_T > | class_type |
typedef boost::intrusive_ptr< Field > | Ptr |
typedef Data_T | value_type |
Allows us to reference the template class. More... | |
typedef std::vector< Ptr > | Vec |
This is a convenience typedef for the list that Field3DInputFile::readScalarLayers() and Field3DInputFile::readVectorLayers() will return its data in. More... | |
![]() | |
typedef FieldRes | class_type |
typedef boost::intrusive_ptr< FieldRes > | Ptr |
typedef std::vector< Ptr > | Vec |
![]() | |
typedef FieldBase | class_type |
typedef boost::intrusive_ptr< FieldBase > | Ptr |
![]() | |
typedef boost::intrusive_ptr< RefBase > | Ptr |
typedef boost::weak_ptr< RefBase > | WeakPtr |
Public Member Functions | |
void | copyMAC (typename MACField::Ptr other) |
TEMP: Copies the MAC field data from another MAC field. This should be re-implemented using proper iterators over the field. More... | |
V3i | getComponentSize () const |
Returns the size of U,V,W components. More... | |
real_t | uCenter (int i, int j, int k) const |
Returns the u-component interpolated to the cell center. More... | |
real_t | vCenter (int i, int j, int k) const |
Returns the v-component interpolated to the cell center. More... | |
real_t | wCenter (int i, int j, int k) const |
Returns the w-component interpolated to the cell center. More... | |
Constructors & destructor | |
MACField () | |
Constructs an empty buffer. More... | |
virtual void | clear (const Data_T &value) |
Clears all the voxels in the storage. More... | |
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) More... | |
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. More... | |
MAC-component access | |
const real_t & | u (int i, int j, int k) const |
Read access to value on u-facing wall. More... | |
real_t & | u (int i, int j, int k) |
Write access to value on u-facing wall. More... | |
const real_t & | v (int i, int j, int k) const |
Read access to value on v-facing wall. More... | |
real_t & | v (int i, int j, int k) |
Write access to value on v-facing wall. More... | |
const real_t & | w (int i, int j, int k) const |
Read access to value on w-facing wall. More... | |
real_t & | w (int i, int j, int k) |
Write access to value on w-facing wall. More... | |
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. More... | |
const_mac_comp_iterator | cbegin_comp (MACComponent comp, const Box3i &subset) const |
Const iterator to first element of specific subset. More... | |
const_mac_comp_iterator | cend_comp (MACComponent comp) const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard. More... | |
const_mac_comp_iterator | cend_comp (MACComponent comp, const Box3i &subset) const |
Const iterator to first element of specific subset. More... | |
mac_comp_iterator | begin_comp (MACComponent comp) |
Iterator to first element. More... | |
mac_comp_iterator | begin_comp (MACComponent comp, const Box3i &subset) |
Iterator to first element of specific subset. More... | |
mac_comp_iterator | end_comp (MACComponent comp) |
Iterator to first element. More... | |
mac_comp_iterator | end_comp (MACComponent comp, const Box3i &subset) |
Iterator to first element of specific subset. More... | |
![]() | |
void | copyFrom (typename Field< Data_T >::Ptr other) |
Copies the data from another Field, also resizes. More... | |
template<class Data_T2 > | |
void | copyFrom (typename Field< Data_T2 >::Ptr other) |
Copies the data from another Field of another template class, also resizes. More... | |
void | matchDefinition (FieldRes::Ptr fieldToMatch) |
Sets up this field so that resolution and mapping matches the other. More... | |
void | setSize (const Box3i &extents) |
Resizes the object. More... | |
void | setSize (const Box3i &extents, const Box3i &dataWindow) |
Resizes the object. More... | |
void | setSize (const V3i &size) |
Resizes the object. More... | |
void | setSize (const V3i &size, int padding) |
Resizes the object with padding. More... | |
![]() | |
iterator | begin () |
Iterator to first element. More... | |
iterator | begin (const Box3i &subset) |
Iterator to first element of specific subset. More... | |
iterator | end () |
Iterator pointing one element past the last valid one. More... | |
iterator | end (const Box3i &subset) |
Iterator pointing one element past the last valid one (for a subset) More... | |
![]() | |
const_iterator | cbegin () const |
Const iterator to first element. "cbegin" matches the tr1 c++ standard. More... | |
const_iterator | cbegin (const Box3i &subset) const |
Const iterator to first element of specific subset. More... | |
const_iterator | cend () const |
Const iterator pointing one element past the last valid one. More... | |
const_iterator | cend (const Box3i &subset) const |
Const iterator pointing one element past the last valid one (for a subset) More... | |
virtual std::string | dataTypeString () const |
virtual | ~Field () |
Dtor. More... | |
![]() | |
V3i const | dataResolution () const |
const Box3i & | dataWindow () const |
Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field subclass. More... | |
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. More... | |
FieldRes () | |
This constructor ensures that we have a valid mapping at all times. More... | |
FieldRes (const FieldRes &src) | |
Base class copy constructor. More... | |
bool | isInBounds (int i, int j, int k) const |
Returns true is the indicies are in bounds of the data window. More... | |
FieldMapping::Ptr | mapping () |
Returns a pointer to the mapping. More... | |
const FieldMapping::Ptr | mapping () const |
Returns a pointer to the mapping. More... | |
virtual void | mappingChanged () |
Tells the subclass that the mapping changed. More... | |
void | setMapping (FieldMapping::Ptr mapping) |
Sets the field's mapping. More... | |
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. More... | |
![]() | |
FieldBase () | |
Constructor. More... | |
FieldBase (const FieldBase &) | |
Copy Constructor. More... | |
virtual | ~FieldBase () |
Destructor. More... | |
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. More... | |
virtual std::string | classType () const =0 |
Returns the full class type string. More... | |
FieldMetadata & | metadata () |
accessor to the m_metadata class More... | |
const FieldMetadata & | metadata () const |
Read only access to the m_metadata class. More... | |
void | copyMetadata (const FieldBase &field) |
Copies the metadata from a second field. More... | |
![]() | |
void | ref () const |
Used by boost::intrusive_pointer. More... | |
size_t | refcnt () |
Used by boost::intrusive_pointer. More... | |
void | unref () const |
Used by boost::intrusive_pointer. More... | |
WeakPtr | weakPtr () const |
RefBase () | |
RefBase (const RefBase &) | |
Copy constructor. More... | |
RefBase & | operator= (const RefBase &) |
Assignment operator. More... | |
virtual | ~RefBase () |
Destructor. More... | |
virtual bool | checkRTTI (const char *typenameStr)=0 |
This function is only implemented by concrete classes and triggers the actual RTTI check through matchRTTI();. More... | |
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. More... | |
![]() | |
virtual void | metadataHasChanged (const std::string &) |
Alerts the callback holder that the metadata has changed. More... | |
Static Public Member Functions | |
static const char * | staticClassName () |
static const char * | staticClassType () |
![]() | |
static const char * | staticClassName () |
static const char * | staticClassType () |
![]() | |
static const char * | staticClassName () |
static const char * | staticClassType () |
![]() | |
static const char * | staticClassName () |
static const char * | staticClassType () |
![]() | |
static const char * | staticClassName () |
static const char * | staticClassType () |
![]() | |
static const char * | staticClassName () |
static const char * | staticClassType () |
![]() | |
static const char * | staticClassType () |
Public Attributes | |
DEFINE_FIELD_RTTI_CONCRETE_CLASS | |
![]() | |
DEFINE_FIELD_RTTI_ABSTRACT_CLASS | |
![]() | |
DEFINE_FIELD_RTTI_ABSTRACT_CLASS | |
![]() | |
DEFINE_FIELD_RTTI_ABSTRACT_CLASS | |
![]() | |
DEFINE_FIELD_RTTI_ABSTRACT_CLASS | |
![]() | |
std::string | attribute |
Optional name of the attribute the field represents. More... | |
std::string | name |
Optional name of the field. More... | |
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. More... | |
real_t * | uPtr (int i, int j, int k) |
Direct access to value on u-facing wall. More... | |
const real_t * | uPtr (int i, int j, int k) const |
Direct access to value on u-facing wall. More... | |
real_t * | vPtr (int i, int j, int k) |
Direct access to value on v-facing wall. More... | |
const real_t * | vPtr (int i, int j, int k) const |
Direct access to value on v-facing wall. More... | |
real_t * | wPtr (int i, int j, int k) |
Direct access to value on w-facing wall. More... | |
const real_t * | wPtr (int i, int j, int k) const |
Direct access to value on w-facing wall. More... | |
Protected Attributes | |
Data_T | m_dummy |
Dummy storage of a temp value that lvalue() can write to. More... | |
std::vector< real_t > | m_u |
U component storage. More... | |
V3i | m_uSize |
Size of U grid along each axis. More... | |
int | m_uSizeXY |
Size of xy slice for u component. More... | |
std::vector< real_t > | m_v |
V component storage. More... | |
V3i | m_vSize |
Size of V grid along each axis. More... | |
int | m_vSizeXY |
Size of xy slice for v component. More... | |
std::vector< real_t > | m_w |
W component storage. More... | |
V3i | m_wSize |
Size of W grid along each axis. More... | |
int | m_wSizeXY |
Size of xy slice for w component. More... | |
![]() | |
Box3i | m_dataWindow |
Defines the area where data is allocated. This should be treated as a closed (i.e. inclusive) interval. More... | |
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. More... | |
FieldMapping::Ptr | m_mapping |
Pointer to the field's mapping. More... | |
Private Types | |
typedef ResizableField< Data_T > | base |
Static Private Attributes | |
static TemplatedFieldType< MACField< Data_T > > | ms_classType |
From FieldBase | |
FIELD3D_CLASSNAME_CLASSTYPE_IMPLEMENTATION | |
virtual FieldBase::Ptr | clone () const |
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement it. More... | |
Additional Inherited Members | |
![]() | |
typedef WritableField< Data_T > | base |
![]() | |
typedef MatrixFieldMapping | default_mapping |
![]() | |
static TemplatedFieldType< ResizableField< Data_T > > | ms_classType |
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.
Definition at line 101 of file MACField.h.
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 |
Definition at line 112 of file MACField.h.
|
private |
Definition at line 336 of file MACField.h.
Constructs an empty buffer.
Definition at line 611 of file MACField.h.
Referenced by MACField< Data_T >::clone().
|
inlinestatic |
Definition at line 115 of file MACField.h.
|
inlinestatic |
Definition at line 120 of file MACField.h.
References FieldBase::name.
|
inlinevirtual |
|
virtual |
Implements Field< Data_T >.
Definition at line 630 of file MACField.h.
Referenced by convertMACToCellCentered().
|
virtual |
Returns the memory usage (in bytes)
Reimplemented from FieldRes.
Definition at line 638 of file MACField.h.
|
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 649 of file MACField.h.
|
inline |
Read access to value on u-facing wall.
Definition at line 698 of file MACField.h.
References detail::max(), and detail::min().
Referenced by convertCellCenteredToMAC(), LinearMACFieldInterp< Data_T >::sample(), CubicMACFieldInterp< Data_T >::sample(), and MACField< Data_T >::uCenter().
|
inline |
Write access to value on u-facing wall.
Definition at line 717 of file MACField.h.
References detail::max(), and detail::min().
|
inline |
Read access to value on v-facing wall.
Definition at line 736 of file MACField.h.
References detail::max(), and detail::min().
Referenced by convertCellCenteredToMAC(), LinearMACFieldInterp< Data_T >::sample(), CubicMACFieldInterp< Data_T >::sample(), and MACField< Data_T >::vCenter().
|
inline |
Write access to value on v-facing wall.
Definition at line 755 of file MACField.h.
References detail::max(), and detail::min().
|
inline |
Read access to value on w-facing wall.
Definition at line 774 of file MACField.h.
References detail::max(), and detail::min().
Referenced by convertCellCenteredToMAC(), LinearMACFieldInterp< Data_T >::sample(), CubicMACFieldInterp< Data_T >::sample(), and MACField< Data_T >::wCenter().
|
inline |
Write access to value on w-facing wall.
Definition at line 793 of file MACField.h.
References detail::max(), and detail::min().
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 812 of file MACField.h.
References FieldRes::dataResolution(), and MACFieldUtil::makeDataWindowForComponent().
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 826 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
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 839 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
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 854 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
MACField< Data_T >::mac_comp_iterator MACField< Data_T >::begin_comp | ( | MACComponent | comp | ) |
Iterator to first element.
Definition at line 868 of file MACField.h.
References FieldRes::dataResolution(), and MACFieldUtil::makeDataWindowForComponent().
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 881 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
MACField< Data_T >::mac_comp_iterator MACField< Data_T >::end_comp | ( | MACComponent | comp | ) |
Iterator to first element.
Definition at line 894 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
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 907 of file MACField.h.
References MACFieldUtil::makeDataWindowForComponent().
Returns the u-component interpolated to the cell center.
Definition at line 233 of file MACField.h.
References MACField< Data_T >::u().
Returns the v-component interpolated to the cell center.
Definition at line 238 of file MACField.h.
References MACField< Data_T >::v().
Returns the w-component interpolated to the cell center.
Definition at line 243 of file MACField.h.
References MACField< Data_T >::w().
|
inline |
TEMP: Copies the MAC field data from another MAC field. This should be re-implemented using proper iterators over the field.
Definition at line 250 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().
Returns the size of U,V,W components.
Definition at line 261 of file MACField.h.
References MACField< Data_T >::m_u, MACField< Data_T >::m_v, and MACField< Data_T >::m_w.
|
inlinevirtual |
Returns a pointer to a copy of the field, pure virtual so ensure derived classes properly implement it.
Implements FieldBase.
Definition at line 271 of file MACField.h.
References MACField< Data_T >::MACField().
|
protectedvirtual |
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 658 of file MACField.h.
References detail::min().
|
inlineprotected |
Direct access to value on u-facing wall.
Definition at line 920 of file MACField.h.
|
inlineprotected |
Direct access to value on u-facing wall.
Definition at line 933 of file MACField.h.
|
inlineprotected |
Direct access to value on v-facing wall.
Definition at line 946 of file MACField.h.
|
inlineprotected |
Direct access to value on v-facing wall.
Definition at line 959 of file MACField.h.
|
inlineprotected |
Direct access to value on w-facing wall.
Definition at line 972 of file MACField.h.
|
inlineprotected |
Direct access to value on w-facing wall.
Definition at line 985 of file MACField.h.
MACField< Data_T >::DEFINE_FIELD_RTTI_CONCRETE_CLASS |
Definition at line 113 of file MACField.h.
MACField< Data_T >::FIELD3D_CLASSNAME_CLASSTYPE_IMPLEMENTATION |
Definition at line 269 of file MACField.h.
U component storage.
Definition at line 306 of file MACField.h.
Referenced by MACField< Data_T >::copyMAC(), and MACField< Data_T >::getComponentSize().
V component storage.
Definition at line 308 of file MACField.h.
Referenced by MACField< Data_T >::copyMAC(), and MACField< Data_T >::getComponentSize().
W component storage.
Definition at line 310 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 313 of file MACField.h.
|
protected |
Size of xy slice for u component.
Definition at line 315 of file MACField.h.
Size of V grid along each axis.
Definition at line 317 of file MACField.h.
|
protected |
Size of xy slice for v component.
Definition at line 319 of file MACField.h.
Size of W grid along each axis.
Definition at line 321 of file MACField.h.
|
protected |
Size of xy slice for w component.
Definition at line 323 of file MACField.h.
|
mutableprotected |
Dummy storage of a temp value that lvalue() can write to.
Definition at line 326 of file MACField.h.
|
staticprivate |
Definition at line 332 of file MACField.h.