LinearMACFieldInterp< Data_T > Class Template Reference

`#include <FieldInterp.h>`

Inheritance diagram for LinearMACFieldInterp< Data_T >:

## Public Types

typedef LinearMACFieldInterp | class_type
typedef boost::intrusive_ptr< LinearMACFieldInterp > | Ptr
typedef Data_T | value_type
Public Types inherited from RefBase
typedef boost::intrusive_ptr< RefBase > | Ptr
typedef boost::weak_ptr< RefBase > | WeakPtr

## Public Member Functions

double | sample (const MACField< Data_T > &data, const MACComponent &comp, const V3d &vsP) const
Data_T | sample (const MACField< Data_T > &data, const V3d &vsP) const
Public Member Functions inherited from RefBase
void | ref () const
| Used by boost::intrusive_pointer.
size_t | refcnt ()
| Used by boost::intrusive_pointer.
void | unref () const
| Used by boost::intrusive_pointer.
WeakPtr | weakPtr () const
| RefBase ()
| RefBase (const RefBase &)
| Copy constructor.
RefBase & | operator= (const RefBase &)
| Assignment operator.
virtual | ~RefBase ()
| Destructor.
virtual bool | checkRTTI (const char *typenameStr)=0
| This function is only implemented by concrete classes and triggers the actual RTTI check through matchRTTI();.
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.

## Static Public Member Functions

static const char * | staticClassName ()
static const char * | staticClassType ()
| classType for RTTI replacement
static const char * | staticClassType ()

## Public Attributes

| DEFINE_FIELD_RTTI_CONCRETE_CLASS

## Private Types

typedef RefBase | base
| Convenience typedef for referring to base class.

## Static Private Attributes

static TemplatedFieldType< LinearMACFieldInterp< Data_T > > | ms_classType

## Detailed Description

template<class Data_T>
class LinearMACFieldInterp< Data_T >

Definition at line 312 of file FieldInterp.h.

## Member Typedef Documentation

## value_type

template<class Data_T>

typedef Data_T LinearMACFieldInterp< Data_T >::value_type

Definition at line 318 of file FieldInterp.h.

## Ptr

template<class Data_T>

typedef boost::intrusive_ptr<LinearMACFieldInterp> LinearMACFieldInterp< Data_T >::Ptr

Definition at line 319 of file FieldInterp.h.

## class_type

template<class Data_T>

typedef LinearMACFieldInterp LinearMACFieldInterp< Data_T >::class_type

Definition at line 323 of file FieldInterp.h.

## base

template<class Data_T>

typedef RefBase LinearMACFieldInterp< Data_T >::base

private

Convenience typedef for referring to base class.

Definition at line 354 of file FieldInterp.h.

## Member Function Documentation

## staticClassName()

template<class Data_T>

const char * LinearMACFieldInterp< Data_T >::staticClassName | ( |  | ) |

inline static

Definition at line 326 of file FieldInterp.h.

{
return "LinearMACFieldInterp";
}

## staticClassType()

template<class Data_T>

const char * LinearMACFieldInterp< Data_T >::staticClassType | ( |  | ) |

inline static

classType for RTTI replacement

Definition at line 332 of file FieldInterp.h.

{
return ms_classType.name();
}
LinearMACFieldInterp::ms_classType
static TemplatedFieldType< LinearMACFieldInterp< Data_T > > ms_classType
Definition FieldInterp.h:349

References ms_classType.

## sample() [1/2]

template<class Data_T>

Data_T LinearMACFieldInterp< Data_T >::sample | ( | const MACField< Data_T > & | data,
|  | const V3d & | vsP ) const

Definition at line 818 of file FieldInterp.h.

{
// Pixel centers are at .5 coordinates
// NOTE: Don't use contToDisc for this, we're looking for sample
// point locations, not coordinate shifts.
const Box3i &dataWindow = data.dataWindow();
Data_T ret;
FIELD3D_VEC3_T<double> p(vsP.x , vsP.y - 0.5, vsP.z - 0.5);
// X component ---
// Lower left corner
V3i c1(static_cast<int>(floor(p.x)),
static_cast<int>(floor(p.y)),
static_cast<int>(floor(p.z)));
// Upper right corner
V3i c2(c1 + V3i(1));
// C1 fractions
FIELD3D_VEC3_T<double> f1(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
// C2 fraction
FIELD3D_VEC3_T<double> f2(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
// Clamp the coordinates
c1.x = std::min(dataWindow.max.x + 1, std::max(dataWindow.min.x, c1.x));
c1.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c1.y));
c1.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c1.z));
c2.x = std::min(dataWindow.max.x + 1, std::max(dataWindow.min.x, c2.x));
c2.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c2.y));
c2.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c2.z));
ret.x = (f1.x * (f1.y * (f1.z * data.u(c1.x, c1.y, c1.z) +
f2.z * data.u(c1.x, c1.y, c2.z)) +
f2.y * (f1.z * data.u(c1.x, c2.y, c1.z) +
f2.z * data.u(c1.x, c2.y, c2.z))) +
f2.x * (f1.y * (f1.z * data.u(c2.x, c1.y, c1.z) +
f2.z * data.u(c2.x, c1.y, c2.z)) +
f2.y * (f1.z * data.u(c2.x, c2.y, c1.z) +
f2.z * data.u(c2.x, c2.y, c2.z))));
// Y component ---
p.setValue(vsP.x - 0.5, vsP.y , vsP.z - 0.5);
// Lower left corner
c1.x = static_cast<int>(floor(p.x ));
c1.y = static_cast<int>(floor(p.y ));
c1.z = static_cast<int>(floor(p.z ));
// Upper right corner
c2.x = c1.x + 1;
c2.y = c1.y + 1;
c2.z = c1.z + 1;
// C1 fractions
f1.setValue(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
// C2 fraction
f2.setValue(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
// Clamp the coordinates
c1.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c1.x));
c1.y = std::min(dataWindow.max.y + 1, std::max(dataWindow.min.y, c1.y));
c1.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c1.z));
c2.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c2.x));
c2.y = std::min(dataWindow.max.y + 1, std::max(dataWindow.min.y, c2.y));
c2.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c2.z));
ret.y = (f1.x * (f1.y * (f1.z * data.v(c1.x, c1.y, c1.z) +
f2.z * data.v(c1.x, c1.y, c2.z)) +
f2.y * (f1.z * data.v(c1.x, c2.y, c1.z) +
f2.z * data.v(c1.x, c2.y, c2.z))) +
f2.x * (f1.y * (f1.z * data.v(c2.x, c1.y, c1.z) +
f2.z * data.v(c2.x, c1.y, c2.z)) +
f2.y * (f1.z * data.v(c2.x, c2.y, c1.z) +
f2.z * data.v(c2.x, c2.y, c2.z))));
// Z component ---
p.setValue(vsP.x - 0.5 , vsP.y - 0.5, vsP.z);
// Lower left corner
c1.x = static_cast<int>(floor(p.x ));
c1.y = static_cast<int>(floor(p.y ));
c1.z = static_cast<int>(floor(p.z ));
// Upper right corner
c2.x = c1.x + 1;
c2.y = c1.y + 1;
c2.z = c1.z + 1;
// C1 fractions
f1.setValue(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
// C2 fraction
f2.setValue(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
// Clamp the coordinates
c1.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c1.x));
c1.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c1.y));
c1.z = std::min(dataWindow.max.z + 1, std::max(dataWindow.min.z, c1.z));
c2.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c2.x));
c2.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c2.y));
c2.z = std::min(dataWindow.max.z + 1, std::max(dataWindow.min.z, c2.z));
ret.z = (f1.x * (f1.y * (f1.z * data.w(c1.x, c1.y, c1.z) +
f2.z * data.w(c1.x, c1.y, c2.z)) +
f2.y * (f1.z * data.w(c1.x, c2.y, c1.z) +
f2.z * data.w(c1.x, c2.y, c2.z))) +
f2.x * (f1.y * (f1.z * data.w(c2.x, c1.y, c1.z) +
f2.z * data.w(c2.x, c1.y, c2.z)) +
f2.y * (f1.z * data.w(c2.x, c2.y, c1.z) +
f2.z * data.w(c2.x, c2.y, c2.z))));
return ret;
}
V3i
Imath::V3i V3i
Definition SpiMathLib.h:71
LinearMACFieldInterp
Definition FieldInterp.h:313

References FieldRes::dataWindow(), FIELD3D_VEC3_T, MACField< Data_T >::u(), MACField< Data_T >::v(), and MACField< Data_T >::w().

## sample() [2/2]

template<class Data_T>

double LinearMACFieldInterp< Data_T >::sample | ( | const MACField< Data_T > & | data,
|  | const MACComponent & | comp,
|  | const V3d & | vsP ) const

Definition at line 941 of file FieldInterp.h.

{
// Pixel centers are at .5 coordinates
// NOTE: Don't use contToDisc for this, we're looking for sample
// point locations, not coordinate shifts.
const Box3i &dataWindow = data.dataWindow();
double ret = 0.0;
FIELD3D_VEC3_T<double> p;
V3i c1, c2;
FIELD3D_VEC3_T<double> f1;
FIELD3D_VEC3_T<double> f2;
switch(comp) {
// U component ---
case MACCompU:
{
p.setValue<>(vsP.x, vsP.y-0.5, vsP.z-0.5);
// Lower left corner
c1.x = static_cast<int>(floor(p.x));
c1.y = static_cast<int>(floor(p.y));
c1.z = static_cast<int>(floor(p.z));
// Upper right corner
c2.x = c1.x + 1;
c2.y = c1.y + 1;
c2.z = c1.z + 1;
// C1 fractions
f1.setValue(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
// C2 fraction
f2.setValue(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
// Clamp the coordinates
c1.x = std::min(dataWindow.max.x + 1, std::max(dataWindow.min.x, c1.x));
c1.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c1.y));
c1.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c1.z));
c2.x = std::min(dataWindow.max.x + 1, std::max(dataWindow.min.x, c2.x));
c2.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c2.y));
c2.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c2.z));
ret = (f1.x * (f1.y * (f1.z * data.u(c1.x, c1.y, c1.z) +
f2.z * data.u(c1.x, c1.y, c2.z)) +
f2.y * (f1.z * data.u(c1.x, c2.y, c1.z) +
f2.z * data.u(c1.x, c2.y, c2.z))) +
f2.x * (f1.y * (f1.z * data.u(c2.x, c1.y, c1.z) +
f2.z * data.u(c2.x, c1.y, c2.z)) +
f2.y * (f1.z * data.u(c2.x, c2.y, c1.z) +
f2.z * data.u(c2.x, c2.y, c2.z))));
break;
}
// Y component ---
case MACCompV:
{
p.setValue(vsP.x-0.5, vsP.y, vsP.z-0.5);
// Lower left corner
c1.x = static_cast<int>(floor(p.x ));
c1.y = static_cast<int>(floor(p.y ));
c1.z = static_cast<int>(floor(p.z ));
// Upper right corner
c2.x = c1.x + 1;
c2.y = c1.y + 1;
c2.z = c1.z + 1;
// C1 fractions
f1.setValue(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
// C2 fraction
f2.setValue(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
// Clamp the coordinates
c1.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c1.x));
c1.y = std::min(dataWindow.max.y + 1, std::max(dataWindow.min.y, c1.y));
c1.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c1.z));
c2.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c2.x));
c2.y = std::min(dataWindow.max.y + 1, std::max(dataWindow.min.y, c2.y));
c2.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z, c2.z));
ret = (f1.x * (f1.y * (f1.z * data.v(c1.x, c1.y, c1.z) +
f2.z * data.v(c1.x, c1.y, c2.z)) +
f2.y * (f1.z * data.v(c1.x, c2.y, c1.z) +
f2.z * data.v(c1.x, c2.y, c2.z))) +
f2.x * (f1.y * (f1.z * data.v(c2.x, c1.y, c1.z) +
f2.z * data.v(c2.x, c1.y, c2.z)) +
f2.y * (f1.z * data.v(c2.x, c2.y, c1.z) +
f2.z * data.v(c2.x, c2.y, c2.z))));
break;
}
// W component ---
case MACCompW:
{
p.setValue(vsP.x-0.5, vsP.y-0.5, vsP.z);
// Lower left corner
c1.x = static_cast<int>(floor(p.x ));
c1.y = static_cast<int>(floor(p.y ));
c1.z = static_cast<int>(floor(p.z ));
// Upper right corner
c2.x = c1.x + 1;
c2.y = c1.y + 1;
c2.z = c1.z + 1;
// C1 fractions
f1.setValue(static_cast<FIELD3D_VEC3_T<double> >(c2) - p);
// C2 fraction
f2.setValue(static_cast<FIELD3D_VEC3_T<double> >(1.0) - f1);
// Clamp the coordinates
c1.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c1.x));
c1.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c1.y));
c1.z = std::min(dataWindow.max.z + 1, std::max(dataWindow.min.z, c1.z));
c2.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x, c2.x));
c2.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y, c2.y));
c2.z = std::min(dataWindow.max.z + 1, std::max(dataWindow.min.z, c2.z));
ret = (f1.x * (f1.y * (f1.z * data.w(c1.x, c1.y, c1.z) +
f2.z * data.w(c1.x, c1.y, c2.z)) +
f2.y * (f1.z * data.w(c1.x, c2.y, c1.z) +
f2.z * data.w(c1.x, c2.y, c2.z))) +
f2.x * (f1.y * (f1.z * data.w(c2.x, c1.y, c1.z) +
f2.z * data.w(c2.x, c1.y, c2.z)) +
f2.y * (f1.z * data.w(c2.x, c2.y, c1.z) +
f2.z * data.w(c2.x, c2.y, c2.z))));
break;
}
default:
break;
}
return ret;
}

References FieldRes::dataWindow(), FIELD3D_VEC3_T, MACCompU, MACCompV, MACCompW, MACField< Data_T >::u(), MACField< Data_T >::v(), and MACField< Data_T >::w().

## Member Data Documentation

## DEFINE_FIELD_RTTI_CONCRETE_CLASS

template<class Data_T>

LinearMACFieldInterp< Data_T >::DEFINE_FIELD_RTTI_CONCRETE_CLASS

Definition at line 324 of file FieldInterp.h.

## ms_classType

template<class Data_T>

TemplatedFieldType<LinearMACFieldInterp<Data_T> > LinearMACFieldInterp< Data_T >::ms_classType

static private

Definition at line 349 of file FieldInterp.h.

Referenced by staticClassType().

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

- export/FieldInterp.h