Field3D
MIPFieldWrapper< Field_T > Struct Template Reference

This class wraps up a single MIP 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 Field_T::LinearInterp LinearInterp
 
typedef std::vector< MIPFieldWrapperVec
 

Public Member Functions

 MIPFieldWrapper (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
 
LinearInterpinterp
 
boost::shared_ptr< LinearInterpinterpPtr
 
const Field3D::FieldMapping * mapping
 
M44d osToWs
 Optionally, enable doOsToWs to apply a world to object transform before lookups.
 
const ValueRemapOpvalueRemapOp
 
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 MIPFieldWrapper< Field_T >

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

Definition at line 157 of file FieldWrapper.h.

Member Typedef Documentation

◆ field_type

template<typename Field_T>
typedef Field_T MIPFieldWrapper< Field_T >::field_type

Definition at line 159 of file FieldWrapper.h.

◆ Vec

template<typename Field_T>
typedef std::vector<MIPFieldWrapper> MIPFieldWrapper< Field_T >::Vec

Definition at line 160 of file FieldWrapper.h.

◆ LinearInterp

template<typename Field_T>
typedef Field_T::LinearInterp MIPFieldWrapper< Field_T >::LinearInterp

Definition at line 161 of file FieldWrapper.h.

Constructor & Destructor Documentation

◆ MIPFieldWrapper()

template<typename Field_T>
MIPFieldWrapper< Field_T >::MIPFieldWrapper ( const typename Field_T::Ptr f)
inline

Definition at line 163 of file FieldWrapper.h.

164 : interpPtr(new LinearInterp(*f)),
165 field(f.get()),
166 fieldPtr(f),
167 mapping(f->mapping().get()),
168 vsBounds(continuousBounds(f->dataWindow())),
169 worldScale(1.0),
170 doOsToWs(false),
172 {
173 interp = interpPtr.get();
174 }
Box3d continuousBounds(const Box3i &bbox)
Definition Field.h:1111
This class wraps up a single MIP field to make its interpolator and its mapping easily accessible....
boost::shared_ptr< LinearInterp > interpPtr
LinearInterp * interp
Field_T::Ptr fieldPtr
Field_T::LinearInterp LinearInterp
const Field_T * field
const Field3D::FieldMapping * mapping
const ValueRemapOp * valueRemapOp

Member Function Documentation

◆ setOsToWs()

template<typename Field_T>
void MIPFieldWrapper< Field_T >::setOsToWs ( const M44d & i_osToWs)
inline

Definition at line 176 of file FieldWrapper.h.

177 {
179 wsToOs = osToWs.inverse();
180 // Compute world scale
181 V3d ws(1.0);
182 if (!Imath::extractScaling(osToWs, ws, false)) {
183 Msg::print("WARNING: FieldGroup/FieldWrapper: "
184 "Couldn't extract world scale from object-to-world "
185 "transform. Defaulting to 1.0.");
186 }
187 worldScale = std::max(std::max(ws.x, ws.y), ws.z);
188 // Set boolean
189 doOsToWs = true;
190
191 // Update wsBounds
194 }
195 }
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
void setWsBoundsOptimization(const bool doWsBoundsOptimization_)
M44d osToWs
Optionally, enable doOsToWs to apply a world to object transform before lookups.
bool doWsBoundsOptimization

◆ setWsBoundsOptimization()

template<typename Field_T>
void MIPFieldWrapper< Field_T >::setWsBoundsOptimization ( const bool doWsBoundsOptimization_)
inline

Definition at line 197 of file FieldWrapper.h.

198 {
200 return;
201 // wsBounds can be set only if mapping is a matrix
203 dynamic_cast<const MatrixFieldMapping*>(mapping);
204 if (mtx_mapping) {
205 const float time = 0;
206 M44d vsToWs;
207 if (doOsToWs) {
208 wsToVs = wsToOs * mtx_mapping->worldToVoxel(time);
209 vsToWs = wsToVs.inverse();
210 } else {
211 wsToVs = mtx_mapping->worldToVoxel(time);
212 vsToWs = wsToVs.inverse();
213 }
215 vsToWs);
218 }
219 }
Imath::Box3f wsBounds
M44d wsToVs
Optionally, enable wsBounds optimization to use a world axis aligned bounding box in lookups.

Referenced by Vec<>::setOsToWs().

◆ setValueRemapOp()

template<typename Field_T>
void MIPFieldWrapper< Field_T >::setValueRemapOp ( ValueRemapOp::Ptr op)
inline

Definition at line 221 of file FieldWrapper.h.

222 {
225 }
ValueRemapOp::Ptr valueRemapOpPtr
Optionally, set a ValueRemapOp to remap values.

Member Data Documentation

◆ interpPtr

template<typename Field_T>
boost::shared_ptr<LinearInterp> MIPFieldWrapper< Field_T >::interpPtr

Definition at line 227 of file FieldWrapper.h.

◆ interp

template<typename Field_T>
LinearInterp* MIPFieldWrapper< Field_T >::interp

Definition at line 228 of file FieldWrapper.h.

◆ field

template<typename Field_T>
const Field_T* MIPFieldWrapper< Field_T >::field

Definition at line 229 of file FieldWrapper.h.

◆ fieldPtr

template<typename Field_T>
Field_T::Ptr MIPFieldWrapper< Field_T >::fieldPtr

Definition at line 230 of file FieldWrapper.h.

◆ mapping

template<typename Field_T>
const Field3D::FieldMapping* MIPFieldWrapper< Field_T >::mapping

Definition at line 231 of file FieldWrapper.h.

◆ vsBounds

template<typename Field_T>
Box3d MIPFieldWrapper< Field_T >::vsBounds

Definition at line 232 of file FieldWrapper.h.

◆ osToWs

template<typename Field_T>
M44d MIPFieldWrapper< Field_T >::osToWs

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

Definition at line 235 of file FieldWrapper.h.

◆ wsToOs

template<typename Field_T>
M44d MIPFieldWrapper< Field_T >::wsToOs

Definition at line 235 of file FieldWrapper.h.

◆ worldScale

template<typename Field_T>
double MIPFieldWrapper< Field_T >::worldScale

Definition at line 236 of file FieldWrapper.h.

◆ doOsToWs

template<typename Field_T>
bool MIPFieldWrapper< Field_T >::doOsToWs

Definition at line 237 of file FieldWrapper.h.

◆ wsToVs

template<typename Field_T>
M44d MIPFieldWrapper< Field_T >::wsToVs

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

Definition at line 240 of file FieldWrapper.h.

◆ wsBounds

template<typename Field_T>
Imath::Box3f MIPFieldWrapper< Field_T >::wsBounds

Definition at line 241 of file FieldWrapper.h.

◆ doWsBoundsOptimization

template<typename Field_T>
bool MIPFieldWrapper< Field_T >::doWsBoundsOptimization

Definition at line 242 of file FieldWrapper.h.

◆ valueRemapOpPtr

template<typename Field_T>
ValueRemapOp::Ptr MIPFieldWrapper< Field_T >::valueRemapOpPtr

Optionally, set a ValueRemapOp to remap values.

Definition at line 244 of file FieldWrapper.h.

◆ valueRemapOp

template<typename Field_T>
const ValueRemapOp* MIPFieldWrapper< Field_T >::valueRemapOp

Definition at line 245 of file FieldWrapper.h.


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