Field3D
FieldGroup< BaseTypeList_T, Dims_T >::GetMinMax Struct Reference

#include <FieldGroup.h>

Public Types

enum  CompositeOp
 
typedef fusion_ro::as_vector< MPLDenseTypes >::type DenseTypes
 
typedef fusion_ro::as_vector< MPLMIPDenseTypes >::type MIPDenseTypes
 
typedef fusion_ro::as_vector< MPLMIPSparseTypes >::type MIPSparseTypes
 
typedef BaseTypeList_T MPLBaseTypes
 
typedef mpl::transform< MPLBaseTypes, detail::MakeDense< ph::_1 > >::type MPLDenseTypes
 
typedef mpl::transform< MPLBaseTypes, detail::MakeMIPDense< ph::_1 > >::type MPLMIPDenseTypes
 
typedef mpl::transform< MPLBaseTypes, detail::MakeMIPSparse< ph::_1 > >::type MPLMIPSparseTypes
 
typedef mpl::transform< MPLBaseTypes, detail::MakeSparse< ph::_1 > >::type MPLSparseTypes
 
typedef fusion_ro::as_vector< MPLSparseTypes >::type SparseTypes
 

Public Member Functions

 FieldGroup ()
 Default constructor, does nothing.
 
 FieldGroup (const Field3D::FieldRes::Vec &fields)
 Construct from a set of fields.
 
const FieldRes::Vecfields () const
 Returns a vector of FieldRes::Ptrs to the fields in the group.
 
bool getIntersections (const Ray3d &ray, IntervalVec &intervals) const
 Gets the intersection intervals between the ray and the fields.
 
 GetMinMax (const Box3d &wsBounds, float *min, float *max)
 Ctor.
 
void getMinMax (const Box3d &wsBounds, float *min, float *max) const
 Returns the min/max range within a given bounding box.
 
bool hasPrefiltMinMax () const
 Whether the FieldGroup has a pre-filtered min/max representation.
 
bool intersects (const V3d &wsP) const
 Whether the given point intersects any of the fields in the FieldGroup.
 
int load (const std::string &filename, const std::string &attribute)
 Loads all fields from a given file and optional attribute pattern.
 
void makeMinMax (const float resMult)
 Make min/max representations of the fields in the group.
 
long long int memSize () const
 Returns the memory use in bytes for the fields in the group.
 
template<typename T>
void operator() (const T &vec) const
 Functor.
 
void sample (const V3d &vsP, float *result, bool isVs) const
 Samples the group of fields at the given point. This call will not include MIP fields, which require a spot size.
 
void sample (const V3d &wsP, const float wsSpotSize, const float time, float *result, const CompositeOp compOp=Add)
 Unified sampling of the group's fields. Will handle both MIP and non-MIP data with optional compositing functor.
 
void sampleMIP (const V3d &vsP, const float wsSpotSize, float *result, bool isVs) const
 Samples all the MIP fields in the group.
 
void sampleMIPMultiple (const size_t n, const float *wsP, const float *wsSpotSize, float *result) const
 Samples all the MIP fields in the group.
 
void sampleMultiple (const size_t n, const float *wsP, float *result) const
 Samples the fields in the group.
 
void setOsToWs (const Imath::M44d &osToWs)
 Sets the current object to world transform. This will be used for subsequent setup() and load() calls. Primarily used when the FieldGroup is employed for instancing of multiple fields.
 
virtual void setup (const Field3D::FieldRes::Ptr field)
 Adds a single field to the group.
 
virtual void setup (const Field3D::FieldRes::Vec &fields)
 Initializes the FieldGroup from a set of fields.
 
virtual void setup (const Field3D::FieldRes::Vec &fields, const Field3D::FieldRes::Vec &minFields, const Field3D::FieldRes::Vec &maxFields)
 Initializes the FieldGroup from a set of fields with pre-computed min/max representations.
 
void setValueRemapOp (ValueRemapOp::Ptr op)
 Sets the current ValueRemap operator. This will be used for subsequent setup() and load() calls. Primarily used when the FieldGroup is employed for instancing of multiple fields. By default, no value remapping takes place.
 
virtual void setWsBoundsOptimization (const bool doWsBoundsOptimization)
 Enable world axis aligned bounding box in lookups. This will be used for subsequent setup() and load() calls. Primarily used when the FieldGroup is employed for instancing of multiple fields.
 
virtual size_t size () const
 The number of fields in the group.
 
size_t sizeMIP () const
 The number of MIP fields in the group.
 
Box3d wsBounds () const
 Returns the bounds of the group.
 

Public Attributes

float * m_max
 
float * m_min
 
const Box3dm_wsBounds
 

Static Public Attributes

static const int k_missingFile
 Used by load() to indicate missing file.
 

Protected Member Functions

void setupMinMax (const FieldRes::Vec &minFields, const FieldRes::Vec &maxFields)
 Set up the min/max MIP representations.
 

Protected Attributes

FieldRes::Vec m_allFields
 Stores all the fields owned by the FieldGroup.
 
FieldRes::Vec m_auxFields
 Stores all the auxiliary fields owned by the FieldGroup.
 
DenseTypes m_dense
 
bool m_doWsBoundsOptimization
 Enable world space bounds optimization.
 
bool m_hasPrefiltMinMax
 Whether pre-filtered min/max are present.
 
MIPDenseTypes m_mipDense
 
MIPDenseTypes m_mipDenseMax
 
MIPDenseTypes m_mipDenseMin
 
MIPSparseTypes m_mipSparse
 
MIPSparseTypes m_mipSparseMax
 
MIPSparseTypes m_mipSparseMin
 
M44d m_osToWs
 Current object to world transform.
 
SparseTypes m_sparse
 
ValueRemapOp::Ptr m_valueRemapOp
 Current value remap op. Defaults to null pointer.
 

Detailed Description

template<typename BaseTypeList_T, int Dims_T>
struct FieldGroup< BaseTypeList_T, Dims_T >::GetMinMax

Definition at line 1327 of file FieldGroup.h.

Member Typedef Documentation

◆ MPLBaseTypes

typedef BaseTypeList_T FieldGroup< BaseTypeList_T, Dims_T >::MPLBaseTypes

Definition at line 308 of file FieldGroup.h.

◆ MPLDenseTypes

typedef mpl::transform<MPLBaseTypes,detail::MakeDense<ph::_1>>::type FieldGroup< BaseTypeList_T, Dims_T >::MPLDenseTypes

Definition at line 313 of file FieldGroup.h.

◆ MPLSparseTypes

typedef mpl::transform<MPLBaseTypes,detail::MakeSparse<ph::_1>>::type FieldGroup< BaseTypeList_T, Dims_T >::MPLSparseTypes

Definition at line 316 of file FieldGroup.h.

◆ MPLMIPDenseTypes

typedef mpl::transform<MPLBaseTypes,detail::MakeMIPDense<ph::_1>>::type FieldGroup< BaseTypeList_T, Dims_T >::MPLMIPDenseTypes

Definition at line 319 of file FieldGroup.h.

◆ MPLMIPSparseTypes

typedef mpl::transform<MPLBaseTypes,detail::MakeMIPSparse<ph::_1>>::type FieldGroup< BaseTypeList_T, Dims_T >::MPLMIPSparseTypes

Definition at line 322 of file FieldGroup.h.

◆ DenseTypes

typedef fusion_ro::as_vector<MPLDenseTypes>::type FieldGroup< BaseTypeList_T, Dims_T >::DenseTypes

Definition at line 325 of file FieldGroup.h.

◆ SparseTypes

typedef fusion_ro::as_vector<MPLSparseTypes>::type FieldGroup< BaseTypeList_T, Dims_T >::SparseTypes

Definition at line 326 of file FieldGroup.h.

◆ MIPDenseTypes

typedef fusion_ro::as_vector<MPLMIPDenseTypes>::type FieldGroup< BaseTypeList_T, Dims_T >::MIPDenseTypes

Definition at line 327 of file FieldGroup.h.

◆ MIPSparseTypes

typedef fusion_ro::as_vector<MPLMIPSparseTypes>::type FieldGroup< BaseTypeList_T, Dims_T >::MIPSparseTypes

Definition at line 328 of file FieldGroup.h.

Member Enumeration Documentation

◆ CompositeOp

Definition at line 332 of file FieldGroup.h.

333 {
334 Add = 0,
335 Avg
336 };

Constructor & Destructor Documentation

◆ GetMinMax()

template<typename BaseTypeList_T, int Dims_T>
FieldGroup< BaseTypeList_T, Dims_T >::GetMinMax::GetMinMax ( const Box3d & wsBounds,
float * min,
float * max )
inline

Ctor.

Definition at line 1330 of file FieldGroup.h.

References m_max, m_min, m_wsBounds, and wsBounds().

Member Function Documentation

◆ operator()()

template<typename BaseTypeList_T, int Dims_T>
template<typename T>
void FieldGroup< BaseTypeList_T, Dims_T >::GetMinMax::operator() ( const T & vec) const
inline

Functor.

Definition at line 1335 of file FieldGroup.h.

1336 {
1338 }
static void getMinMax(const WrapperVec_T &f, const Box3d &wsBounds, float *min, float *max)

References FieldSampler< WrapperVec_T, Dims_T >::getMinMax(), m_max, m_min, and m_wsBounds.

◆ FieldGroup() [1/2]

FieldGroup< BaseTypeList_T, Dims_T >::FieldGroup ( )

Default constructor, does nothing.

Definition at line 346 of file FieldGroup.h.

◆ FieldGroup() [2/2]

FieldGroup< BaseTypeList_T, Dims_T >::FieldGroup ( const Field3D::FieldRes::Vec & fields)

Construct from a set of fields.

Definition at line 348 of file FieldGroup.h.

493{
494 // Perform setup
495 setup(fields);
496}
const FieldRes::Vec & fields() const
Definition FieldGroup.h:417
virtual void setup(const Field3D::FieldRes::Ptr field)
Definition FieldGroup.h:538

◆ setOsToWs()

void FieldGroup< BaseTypeList_T, Dims_T >::setOsToWs ( const Imath::M44d & osToWs)

Sets the current object to world transform. This will be used for subsequent setup() and load() calls. Primarily used when the FieldGroup is employed for instancing of multiple fields.

Definition at line 355 of file FieldGroup.h.

503{
505}

◆ setWsBoundsOptimization()

void FieldGroup< BaseTypeList_T, Dims_T >::setWsBoundsOptimization ( const bool doWsBoundsOptimization)
virtual

Enable world axis aligned bounding box in lookups. This will be used for subsequent setup() and load() calls. Primarily used when the FieldGroup is employed for instancing of multiple fields.

Definition at line 360 of file FieldGroup.h.

◆ setValueRemapOp()

void FieldGroup< BaseTypeList_T, Dims_T >::setValueRemapOp ( ValueRemapOp::Ptr op)

Sets the current ValueRemap operator. This will be used for subsequent setup() and load() calls. Primarily used when the FieldGroup is employed for instancing of multiple fields. By default, no value remapping takes place.

Note
It is ok to pass in a null pointer to disable value remapping.

Definition at line 366 of file FieldGroup.h.

530{
532}
ValueRemapOp::Ptr m_valueRemapOp
Definition FieldGroup.h:445

◆ setup() [1/3]

void FieldGroup< BaseTypeList_T, Dims_T >::setup ( const Field3D::FieldRes::Ptr field)
virtual

Adds a single field to the group.

Definition at line 368 of file FieldGroup.h.

539{
541 fields.push_back(field);
542 // Perform setup
544}

◆ setup() [2/3]

void FieldGroup< BaseTypeList_T, Dims_T >::setup ( const Field3D::FieldRes::Vec & fields)
virtual

Initializes the FieldGroup from a set of fields.

Definition at line 370 of file FieldGroup.h.

551{
553 // Perform setup
555}

◆ setup() [3/3]

void FieldGroup< BaseTypeList_T, Dims_T >::setup ( const Field3D::FieldRes::Vec & fields,
const Field3D::FieldRes::Vec & minFields,
const Field3D::FieldRes::Vec & maxFields )
virtual

Initializes the FieldGroup from a set of fields with pre-computed min/max representations.

Definition at line 373 of file FieldGroup.h.

565{
566 // Record fields in m_allFields
568
569 // Pick out primary fields
570 for (size_t i = 0, end = fields.size(); i < end; ++i) {
576 }
577
578 // Pick out min/max fields
580}
void setupMinMax(const FieldRes::Vec &minFields, const FieldRes::Vec &maxFields)
Definition FieldGroup.h:585
FieldRes::Vec m_allFields
Definition FieldGroup.h:448

◆ load()

int FieldGroup< BaseTypeList_T, Dims_T >::load ( const std::string & filename,
const std::string & attribute )

Loads all fields from a given file and optional attribute pattern.

Returns
Number of fields loaded, or a negative number if the file failed to open.

Definition at line 379 of file FieldGroup.h.

621{
622 using namespace Field3D;
623
624 // Storage for the primary fields
626 // Storage for the auxiliary fields
628
629 // Track number of fields in group before loading.
630 const size_t sizeBeforeLoading = size();
631
632 // Open each file ---
633
635 filenames.push_back(filename);
636
638
640 if (!in.open(fn)) {
641 return k_missingFile;
642 }
643
644 // Use partition names to determine if fields should be loaded
646 in.getPartitionNames(names);
647
653 }
654
655 }
656
657 // Set up from fields
659
660 // Done. Return the number of fields that were loaded.
661 return size() - sizeBeforeLoading;
662}
virtual size_t size() const
Definition FieldGroup.h:689
static const int k_missingFile
Definition FieldGroup.h:341

◆ makeMinMax()

void FieldGroup< BaseTypeList_T, Dims_T >::makeMinMax ( const float resMult)

Make min/max representations of the fields in the group.

Definition at line 381 of file FieldGroup.h.

◆ size()

size_t FieldGroup< BaseTypeList_T, Dims_T >::size ( ) const
virtual

The number of fields in the group.

Definition at line 383 of file FieldGroup.h.

◆ sizeMIP()

size_t FieldGroup< BaseTypeList_T, Dims_T >::sizeMIP ( ) const

The number of MIP fields in the group.

Definition at line 385 of file FieldGroup.h.

704{
708 return op.count;
709}

◆ sample() [1/2]

void FieldGroup< BaseTypeList_T, Dims_T >::sample ( const V3d & wsP,
const float wsSpotSize,
const float time,
float * result,
const CompositeOp compOp = Add )

Unified sampling of the group's fields. Will handle both MIP and non-MIP data with optional compositing functor.

Definition at line 388 of file FieldGroup.h.

720{
721 size_t numHits = 0;
722
723 // Handle ordinary fields
727
728 // Handle MIP fields
732
733 // Check composite op
734 if (compOp == Add) {
735 // Nothing
736 } else {
737 if (numHits > 1) {
738 for (size_t i = 0; i < Dims_T; ++i) {
739 result[i] /= static_cast<float>(numHits);
740 }
741 }
742 }
743}

◆ sample() [2/2]

void FieldGroup< BaseTypeList_T, Dims_T >::sample ( const V3d & vsP,
float * result,
bool isVs ) const

Samples the group of fields at the given point. This call will not include MIP fields, which require a spot size.

Warning
To be deprecated in favor of sample(wsP, wsSpotSize, time, ...)

Definition at line 393 of file FieldGroup.h.

752{
753 size_t numHits = 0;
754
758}

◆ sampleMIP()

void FieldGroup< BaseTypeList_T, Dims_T >::sampleMIP ( const V3d & vsP,
const float wsSpotSize,
float * result,
bool isVs ) const

Samples all the MIP fields in the group.

Warning
To be deprecated in favor of sample(wsP, wsSpotSize, time, ...)

Definition at line 396 of file FieldGroup.h.

◆ sampleMultiple()

void FieldGroup< BaseTypeList_T, Dims_T >::sampleMultiple ( const size_t n,
const float * wsP,
float * result ) const

Samples the fields in the group.

Definition at line 399 of file FieldGroup.h.

767{
768 size_t numHits = 0;
769
773}

◆ sampleMIPMultiple()

void FieldGroup< BaseTypeList_T, Dims_T >::sampleMIPMultiple ( const size_t n,
const float * wsP,
const float * wsSpotSize,
float * result ) const

Samples all the MIP fields in the group.

Definition at line 401 of file FieldGroup.h.

◆ wsBounds()

Box3d FieldGroup< BaseTypeList_T, Dims_T >::wsBounds ( ) const

Returns the bounds of the group.

Definition at line 404 of file FieldGroup.h.

Referenced by GetMinMax().

◆ intersects()

bool FieldGroup< BaseTypeList_T, Dims_T >::intersects ( const V3d & wsP) const

Whether the given point intersects any of the fields in the FieldGroup.

Definition at line 406 of file FieldGroup.h.

◆ getIntersections()

bool FieldGroup< BaseTypeList_T, Dims_T >::getIntersections ( const Ray3d & ray,
IntervalVec & intervals ) const

Gets the intersection intervals between the ray and the fields.

Definition at line 408 of file FieldGroup.h.

◆ getMinMax()

void FieldGroup< BaseTypeList_T, Dims_T >::getMinMax ( const Box3d & wsBounds,
float * min,
float * max ) const

Returns the min/max range within a given bounding box.

Definition at line 410 of file FieldGroup.h.

858{
859 if (m_hasPrefiltMinMax) {
860 // Pre-filtered types
867 } else {
868 // Non-prefiltered types
872 // Non-prefiltered MIP types
876 }
877}
GetMinMax(const Box3d &wsBounds, float *min, float *max)
Ctor.
MIPDenseTypes m_mipDenseMin
Definition FieldGroup.h:432
MIPSparseTypes m_mipSparseMax
Definition FieldGroup.h:433
MIPSparseTypes m_mipSparseMin
Definition FieldGroup.h:433
MIPDenseTypes m_mipDenseMax
Definition FieldGroup.h:432

◆ hasPrefiltMinMax()

bool FieldGroup< BaseTypeList_T, Dims_T >::hasPrefiltMinMax ( ) const
inline

Whether the FieldGroup has a pre-filtered min/max representation.

Definition at line 412 of file FieldGroup.h.

413 { return m_hasPrefiltMinMax; }

◆ memSize()

long long int FieldGroup< BaseTypeList_T, Dims_T >::memSize ( ) const

Returns the memory use in bytes for the fields in the group.

Definition at line 415 of file FieldGroup.h.

884{
885 long long int result = 0;
891 return result;
892}

◆ fields()

const FieldRes::Vec & FieldGroup< BaseTypeList_T, Dims_T >::fields ( ) const
inline

Returns a vector of FieldRes::Ptrs to the fields in the group.

Definition at line 417 of file FieldGroup.h.

418 { return m_allFields; }

◆ setupMinMax()

void FieldGroup< BaseTypeList_T, Dims_T >::setupMinMax ( const FieldRes::Vec & minFields,
const FieldRes::Vec & maxFields )
protected

Set up the min/max MIP representations.

Definition at line 425 of file FieldGroup.h.

587{
588 // Record minFields and maxFields as auxiliary fields
589 m_auxFields.insert(m_auxFields.end(), minFields.begin(), minFields.end());
590 m_auxFields.insert(m_auxFields.end(), maxFields.begin(), maxFields.end());
591
592 // Pick out min fields
593 for (size_t i = 0, end = minFields.size(); i < end; ++i) {
597 }
598 // Pick out max fields
599 for (size_t i = 0, end = maxFields.size(); i < end; ++i) {
603 }
604 // Check if we have pre-filtered fields
610 if (countMinOp.count > 0 && countMaxOp.count > 0) {
611 m_hasPrefiltMinMax = true;
612 }
613}
FieldRes::Vec m_auxFields
Definition FieldGroup.h:450

Member Data Documentation

◆ m_wsBounds

template<typename BaseTypeList_T, int Dims_T>
const Box3d& FieldGroup< BaseTypeList_T, Dims_T >::GetMinMax::m_wsBounds

Definition at line 1340 of file FieldGroup.h.

Referenced by GetMinMax(), and operator()().

◆ m_min

template<typename BaseTypeList_T, int Dims_T>
float* FieldGroup< BaseTypeList_T, Dims_T >::GetMinMax::m_min

Definition at line 1341 of file FieldGroup.h.

Referenced by GetMinMax(), and operator()().

◆ m_max

template<typename BaseTypeList_T, int Dims_T>
float* FieldGroup< BaseTypeList_T, Dims_T >::GetMinMax::m_max

Definition at line 1342 of file FieldGroup.h.

Referenced by GetMinMax(), and operator()().

◆ k_missingFile

const int FieldGroup< BaseTypeList_T, Dims_T >::k_missingFile
static

Used by load() to indicate missing file.

Definition at line 341 of file FieldGroup.h.

◆ m_dense

DenseTypes FieldGroup< BaseTypeList_T, Dims_T >::m_dense
protected

Definition at line 430 of file FieldGroup.h.

◆ m_sparse

SparseTypes FieldGroup< BaseTypeList_T, Dims_T >::m_sparse
protected

Definition at line 431 of file FieldGroup.h.

◆ m_mipDense

MIPDenseTypes FieldGroup< BaseTypeList_T, Dims_T >::m_mipDense
protected

Definition at line 432 of file FieldGroup.h.

◆ m_mipDenseMin

MIPDenseTypes FieldGroup< BaseTypeList_T, Dims_T >::m_mipDenseMin
protected

Definition at line 432 of file FieldGroup.h.

◆ m_mipDenseMax

MIPDenseTypes FieldGroup< BaseTypeList_T, Dims_T >::m_mipDenseMax
protected

Definition at line 432 of file FieldGroup.h.

◆ m_mipSparse

MIPSparseTypes FieldGroup< BaseTypeList_T, Dims_T >::m_mipSparse
protected

Definition at line 433 of file FieldGroup.h.

◆ m_mipSparseMin

MIPSparseTypes FieldGroup< BaseTypeList_T, Dims_T >::m_mipSparseMin
protected

Definition at line 433 of file FieldGroup.h.

◆ m_mipSparseMax

MIPSparseTypes FieldGroup< BaseTypeList_T, Dims_T >::m_mipSparseMax
protected

Definition at line 433 of file FieldGroup.h.

◆ m_hasPrefiltMinMax

bool FieldGroup< BaseTypeList_T, Dims_T >::m_hasPrefiltMinMax
protected

Whether pre-filtered min/max are present.

Definition at line 436 of file FieldGroup.h.

◆ m_osToWs

M44d FieldGroup< BaseTypeList_T, Dims_T >::m_osToWs
protected

Current object to world transform.

Definition at line 439 of file FieldGroup.h.

◆ m_doWsBoundsOptimization

bool FieldGroup< BaseTypeList_T, Dims_T >::m_doWsBoundsOptimization
protected

Enable world space bounds optimization.

Definition at line 442 of file FieldGroup.h.

◆ m_valueRemapOp

ValueRemapOp::Ptr FieldGroup< BaseTypeList_T, Dims_T >::m_valueRemapOp
protected

Current value remap op. Defaults to null pointer.

Definition at line 445 of file FieldGroup.h.

◆ m_allFields

FieldRes::Vec FieldGroup< BaseTypeList_T, Dims_T >::m_allFields
protected

Stores all the fields owned by the FieldGroup.

Definition at line 448 of file FieldGroup.h.

◆ m_auxFields

FieldRes::Vec FieldGroup< BaseTypeList_T, Dims_T >::m_auxFields
protected

Stores all the auxiliary fields owned by the FieldGroup.

Definition at line 450 of file FieldGroup.h.


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