FieldWrapper< Field_T > Struct Template Reference

This class wraps up a single field to make its interpolator and its mapping easily accessible. The 'Vec' typedef gives access to a std::vector. More...

`#include <FieldWrapper.h>`

## Public Types

typedef Field_T | field_type
typedef std::vector< FieldWrapper > | Vec

## Public Member Functions

| FieldWrapper (const typename Field_T::Ptr f)
void | setOsToWs (const M44d &i_osToWs)
void | setValueRemapOp (ValueRemapOp::Ptr op)
void | setWsBoundsOptimization (const bool doWsBoundsOptimization_)

## Public Attributes

bool | doOsToWs
bool | doWsBoundsOptimization
const Field_T * | field
Field_T::Ptr | fieldPtr
Field_T::LinearInterp | interp
const Field3D::FieldMapping * | mapping
M44d | osToWs
| Optionally, enable doOsToWs to apply a world to object transform before lookups.
const ValueRemapOp * | valueRemapOp
ValueRemapOp::Ptr | valueRemapOpPtr
| Optionally, set a ValueRemapOp to remap values.
Box3d | vsBounds
double | worldScale
Imath::Box3f | wsBounds
M44d | wsToOs
M44d | wsToVs
| Optionally, enable wsBounds optimization to use a world axis aligned bounding box in lookups.

## Detailed Description

template<typename Field_T>
struct FieldWrapper< Field_T >

This class wraps up a single field to make its interpolator and its mapping easily accessible. The 'Vec' typedef gives access to a std::vector.

Definition at line 63 of file FieldWrapper.h.

## Member Typedef Documentation

## field_type

template<typename Field_T>

typedef Field_T FieldWrapper< Field_T >::field_type

Definition at line 65 of file FieldWrapper.h.

## Vec

template<typename Field_T>

typedef std::vector<FieldWrapper> FieldWrapper< Field_T >::Vec

Definition at line 66 of file FieldWrapper.h.

## Constructor & Destructor Documentation

## FieldWrapper()

template<typename Field_T>

FieldWrapper< Field_T >::FieldWrapper | ( | const typename Field_T::Ptr | f | ) |

inline

Definition at line 68 of file FieldWrapper.h.

: field(f.get()),
fieldPtr(f),
mapping(f->mapping().get()),
vsBounds(continuousBounds(f->dataWindow())),
worldScale(1.0),
doOsToWs(false),
doWsBoundsOptimization(false),
valueRemapOp(NULL)
{ }
continuousBounds
Box3d continuousBounds(const Box3i &bbox)
Definition Field.h:1111
FieldWrapper
This class wraps up a single field to make its interpolator and its mapping easily accessible....
Definition FieldWrapper.h:64
FieldWrapper::doWsBoundsOptimization
bool doWsBoundsOptimization
Definition FieldWrapper.h:144
FieldWrapper::valueRemapOp
const ValueRemapOp * valueRemapOp
Definition FieldWrapper.h:147
FieldWrapper::worldScale
double worldScale
Definition FieldWrapper.h:138
FieldWrapper::fieldPtr
Field_T::Ptr fieldPtr
Definition FieldWrapper.h:132
FieldWrapper::vsBounds
Box3d vsBounds
Definition FieldWrapper.h:134
FieldWrapper::field
const Field_T * field
Definition FieldWrapper.h:131
FieldWrapper::mapping
const Field3D::FieldMapping * mapping
Definition FieldWrapper.h:133
FieldWrapper::doOsToWs
bool doOsToWs
Definition FieldWrapper.h:139

## Member Function Documentation

## setOsToWs()

template<typename Field_T>

void FieldWrapper< Field_T >::setOsToWs | ( | const M44d & | i_osToWs | ) |

inline

Definition at line 79 of file FieldWrapper.h.

{
osToWs = i_osToWs;
wsToOs = osToWs.inverse();
// Compute world scale
V3d ws(1.0);
if (!Imath::extractScaling(osToWs, ws, false)) {
Msg::print("WARNING: FieldGroup/FieldWrapper: "
"Couldn't extract world scale from object-to-world "
"transform. Defaulting to 1.0.");
}
worldScale = std::max(std::max(ws.x, ws.y), ws.z);
// Set boolean
doOsToWs = true;
// Update wsBounds
if (doWsBoundsOptimization) {
setWsBoundsOptimization(doWsBoundsOptimization);
}
}
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
FieldWrapper::osToWs
M44d osToWs
Optionally, enable doOsToWs to apply a world to object transform before lookups.
Definition FieldWrapper.h:137
FieldWrapper::setWsBoundsOptimization
void setWsBoundsOptimization(const bool doWsBoundsOptimization_)
Definition FieldWrapper.h:100
FieldWrapper::wsToOs
M44d wsToOs
Definition FieldWrapper.h:137

## setWsBoundsOptimization()

template<typename Field_T>

void FieldWrapper< Field_T >::setWsBoundsOptimization | ( | const bool | doWsBoundsOptimization_ | ) |

inline

Definition at line 100 of file FieldWrapper.h.

{
if (!doWsBoundsOptimization_)
return;
// wsBounds can be set only if mapping is a matrix
const MatrixFieldMapping *mtx_mapping =
dynamic_cast<const MatrixFieldMapping*>(mapping);
if (mtx_mapping) {
const float time = 0;
M44d vsToWs;
if (doOsToWs) {
wsToVs = wsToOs * mtx_mapping->worldToVoxel(time);
vsToWs = wsToVs.inverse();
} else {
wsToVs = mtx_mapping->worldToVoxel(time);
vsToWs = wsToVs.inverse();
}
const Imath::Box3d wsBounds_d = Imath::transform(vsBounds,
vsToWs);
wsBounds = Imath::Box3f(wsBounds_d.min, wsBounds_d.max);
doWsBoundsOptimization = true;
}
}
FieldWrapper::wsToVs
M44d wsToVs
Optionally, enable wsBounds optimization to use a world axis aligned bounding box in lookups.
Definition FieldWrapper.h:142
FieldWrapper::wsBounds
Imath::Box3f wsBounds
Definition FieldWrapper.h:143

Referenced by Vec<>::setOsToWs().

## setValueRemapOp()

template<typename Field_T>

void FieldWrapper< Field_T >::setValueRemapOp | ( | ValueRemapOp::Ptr | op | ) |

inline

Definition at line 124 of file FieldWrapper.h.

{
valueRemapOpPtr = op;
valueRemapOp = valueRemapOpPtr.get();
}
FieldWrapper::valueRemapOpPtr
ValueRemapOp::Ptr valueRemapOpPtr
Optionally, set a ValueRemapOp to remap values.
Definition FieldWrapper.h:146

## Member Data Documentation

## interp

template<typename Field_T>

Field_T::LinearInterp FieldWrapper< Field_T >::interp

Definition at line 130 of file FieldWrapper.h.

## field

template<typename Field_T>

const Field_T* FieldWrapper< Field_T >::field

Definition at line 131 of file FieldWrapper.h.

## fieldPtr

template<typename Field_T>

Field_T::Ptr FieldWrapper< Field_T >::fieldPtr

Definition at line 132 of file FieldWrapper.h.

## mapping

template<typename Field_T>

const Field3D::FieldMapping* FieldWrapper< Field_T >::mapping

Definition at line 133 of file FieldWrapper.h.

## vsBounds

template<typename Field_T>

Box3d FieldWrapper< Field_T >::vsBounds

Definition at line 134 of file FieldWrapper.h.

## osToWs

template<typename Field_T>

M44d FieldWrapper< Field_T >::osToWs

Optionally, enable doOsToWs to apply a world to object transform before lookups.

Definition at line 137 of file FieldWrapper.h.

## wsToOs

template<typename Field_T>

M44d FieldWrapper< Field_T >::wsToOs

Definition at line 137 of file FieldWrapper.h.

## worldScale

template<typename Field_T>

double FieldWrapper< Field_T >::worldScale

Definition at line 138 of file FieldWrapper.h.

## doOsToWs

template<typename Field_T>

bool FieldWrapper< Field_T >::doOsToWs

Definition at line 139 of file FieldWrapper.h.

## wsToVs

template<typename Field_T>

M44d FieldWrapper< Field_T >::wsToVs

Optionally, enable wsBounds optimization to use a world axis aligned bounding box in lookups.

Definition at line 142 of file FieldWrapper.h.

## wsBounds

template<typename Field_T>

Imath::Box3f FieldWrapper< Field_T >::wsBounds

Definition at line 143 of file FieldWrapper.h.

## doWsBoundsOptimization

template<typename Field_T>

bool FieldWrapper< Field_T >::doWsBoundsOptimization

Definition at line 144 of file FieldWrapper.h.

## valueRemapOpPtr

template<typename Field_T>

ValueRemapOp::Ptr FieldWrapper< Field_T >::valueRemapOpPtr

Optionally, set a ValueRemapOp to remap values.

Definition at line 146 of file FieldWrapper.h.

## valueRemapOp

template<typename Field_T>

const ValueRemapOp* FieldWrapper< Field_T >::valueRemapOp

Definition at line 147 of file FieldWrapper.h.

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

- export/FieldWrapper.h