3 #ifndef __F3DUTIL_FIELDGROUP_H__ 4 #define __F3DUTIL_FIELDGROUP_H__ 9 #include <boost/foreach.hpp> 10 #include <boost/tokenizer.hpp> 11 #include <boost/thread/mutex.hpp> 12 #include <boost/mpl/vector.hpp> 13 #include <boost/mpl/for_each.hpp> 14 #include <boost/mpl/placeholders.hpp> 15 #include <boost/mpl/push_back.hpp> 16 #include <boost/mpl/transform.hpp> 17 #include <boost/fusion/mpl.hpp> 18 #include <boost/fusion/algorithm/iteration/for_each.hpp> 19 #include <boost/fusion/include/for_each.hpp> 20 #include <boost/fusion/include/as_vector.hpp> 45 namespace mpl = boost::mpl;
46 namespace ph = mpl::placeholders;
47 namespace fusion = boost::fusion;
48 namespace fusion_ro = boost::fusion::result_of;
50 typedef mpl::vector<Field3D::half, float, double>
ScalarTypes;
51 typedef mpl::vector<Field3D::V3h, Field3D::V3f, Field3D::V3d>
VectorTypes;
106 template <
int Dims_T>
112 const std::string &a_name,
113 const std::string &a_attribute,
114 Field3D::FieldRes::Vec &a_results,
115 Field3D::FieldRes::Vec &a_minResults,
116 Field3D::FieldRes::Vec &a_maxResults)
119 attribute(a_attribute),
121 minResults(a_minResults),
122 maxResults(a_maxResults)
124 Field3D::Field3DInputFile &
in;
140 template <
typename T>
144 typename Field3D::Field<T>::Vec fields =
145 m_p.in.readScalarLayers<T>(m_p.name, m_p.attribute);
147 BOOST_FOREACH (
const typename Field3D::Field<T>::Ptr &ptr, fields) {
148 m_p.results.push_back(ptr);
151 typename Field3D::Field<T>::Vec minFields =
152 m_p.in.readScalarLayers<T>(m_p.name, m_p.attribute +
k_minSuffix);
154 BOOST_FOREACH (
const typename Field3D::Field<T>::Ptr &ptr, minFields) {
155 m_p.minResults.push_back(ptr);
158 typename Field3D::Field<T>::Vec maxFields =
159 m_p.in.readScalarLayers<T>(m_p.name, m_p.attribute +
k_maxSuffix);
161 BOOST_FOREACH (
const typename Field3D::Field<T>::Ptr &ptr, maxFields) {
162 m_p.maxResults.push_back(ptr);
177 template <
typename Vec_T>
180 typedef typename Vec_T::BaseType T;
183 typename Field3D::Field<Vec_T>::Vec fields =
184 m_p.in.readVectorLayers<T>(m_p.name, m_p.attribute);
186 BOOST_FOREACH (
const typename Field3D::Field<Vec_T>::Ptr &ptr, fields) {
187 m_p.results.push_back(ptr);
190 typename Field3D::Field<Vec_T>::Vec minFields =
191 m_p.in.readVectorLayers<T>(m_p.name, m_p.attribute +
k_minSuffix);
193 BOOST_FOREACH (
const typename Field3D::Field<Vec_T>::Ptr &ptr, minFields) {
194 m_p.minResults.push_back(ptr);
197 typename Field3D::Field<Vec_T>::Vec maxFields =
198 m_p.in.readVectorLayers<T>(m_p.name, m_p.attribute +
k_maxSuffix);
200 BOOST_FOREACH (
const typename Field3D::Field<Vec_T>::Ptr &ptr, maxFields) {
201 m_p.maxResults.push_back(ptr);
210 inline std::vector<V3d>
213 std::vector<V3d> result;
214 result.push_back(
V3d(box.min.x, box.min.y, box.min.z));
215 result.push_back(
V3d(box.max.x, box.min.y, box.min.z));
216 result.push_back(
V3d(box.min.x, box.max.y, box.min.z));
217 result.push_back(
V3d(box.max.x, box.max.y, box.min.z));
218 result.push_back(
V3d(box.min.x, box.min.y, box.max.z));
219 result.push_back(
V3d(box.max.x, box.min.y, box.max.z));
220 result.push_back(
V3d(box.min.x, box.max.y, box.max.z));
221 result.push_back(
V3d(box.max.x, box.max.y, box.max.z));
227 inline std::vector<V3d>
230 std::vector<V3d> result;
231 result.push_back(
V3d(0.0, 0.0, 0.0));
232 result.push_back(
V3d(1.0, 0.0, 0.0));
233 result.push_back(
V3d(0.0, 1.0, 0.0));
234 result.push_back(
V3d(1.0, 1.0, 0.0));
235 result.push_back(
V3d(0.0, 0.0, 1.0));
236 result.push_back(
V3d(1.0, 0.0, 1.0));
237 result.push_back(
V3d(0.0, 1.0, 1.0));
238 result.push_back(
V3d(1.0, 1.0, 1.0));
249 const double epsilon = std::numeric_limits<double>::epsilon() * 10.0;
251 for (
size_t dim = 0; dim < 3; ++dim) {
253 if (std::abs(ray.dir[dim]) < epsilon) {
255 if (ray.pos[dim] < box.min[dim] || ray.pos[dim] > box.max[dim]) {
259 t0 = (box.min[dim] - ray.pos[dim]) / ray.dir[dim];
260 t1 = (box.max[dim] - ray.pos[dim]) / ray.dir[dim];
302 template <
typename BaseTypeList_T,
int Dims_T>
311 typedef typename mpl::transform<
314 typedef typename mpl::transform<
317 typedef typename mpl::transform<
320 typedef typename mpl::transform<
325 typedef typename fusion_ro::as_vector<MPLDenseTypes>::type
DenseTypes;
326 typedef typename fusion_ro::as_vector<MPLSparseTypes>::type
SparseTypes;
327 typedef typename fusion_ro::as_vector<MPLMIPDenseTypes>::type
MIPDenseTypes;
341 static const int k_missingFile = -1;
348 FieldGroup(
const Field3D::FieldRes::Vec &fields);
360 virtual void setWsBoundsOptimization(
const bool doWsBoundsOptimization);
368 virtual void setup(
const Field3D::FieldRes::Ptr field);
370 virtual void setup(
const Field3D::FieldRes::Vec &fields);
373 virtual void setup(
const Field3D::FieldRes::Vec &fields,
374 const Field3D::FieldRes::Vec &minFields,
375 const Field3D::FieldRes::Vec &maxFields);
379 int load(
const std::string &filename,
const std::string &attribute);
383 virtual size_t size()
const;
385 size_t sizeMIP()
const;
388 void sample(
const V3d &wsP,
const float wsSpotSize,
const float time,
393 void sample(
const V3d &vsP,
float *result,
bool isVs)
const;
396 void sampleMIP(
const V3d &vsP,
const float wsSpotSize,
397 float *result,
bool isVs)
const;
399 void sampleMultiple(
const size_t n,
const float *wsP,
float *result)
const;
401 void sampleMIPMultiple(
const size_t n,
const float *wsP,
const float *wsSpotSize,
402 float *result)
const;
404 Box3d wsBounds()
const;
406 bool intersects(
const V3d &wsP)
const;
410 void getMinMax(
const Box3d &wsBounds,
float *
min,
float *
max)
const;
413 {
return m_hasPrefiltMinMax; }
415 long long int memSize()
const;
418 {
return m_allFields; }
482 template <
typename BaseTypeList_T,
int Dims_T>
484 : m_hasPrefiltMinMax(false), m_doWsBoundsOptimization(false)
489 template <
typename BaseTypeList_T,
int Dims_T>
500 template <
typename BaseTypeList_T,
int Dims_T>
509 template <
typename BaseTypeList_T,
int Dims_T>
515 if (doWsBoundsOptimization) {
527 template <
typename BaseTypeList_T,
int Dims_T>
536 template <
typename BaseTypeList_T,
int Dims_T>
541 fields.push_back(field);
543 setup(fields, minFields, maxFields);
548 template <
typename BaseTypeList_T,
int Dims_T>
554 setup(fields, minFields, maxFields);
559 template <
typename BaseTypeList_T,
int Dims_T>
562 (
const Field3D::FieldRes::Vec &fields,
563 const Field3D::FieldRes::Vec &minFields,
564 const Field3D::FieldRes::Vec &maxFields)
570 for (
size_t i = 0, end = fields.size(); i < end; ++i) {
582 template <
typename BaseTypeList_T,
int Dims_T>
585 (
const Field3D::FieldRes::Vec &minFields,
586 const Field3D::FieldRes::Vec &maxFields)
593 for (
size_t i = 0, end = minFields.size(); i < end; ++i) {
599 for (
size_t i = 0, end = maxFields.size(); i < end; ++i) {
610 if (countMinOp.
count > 0 && countMaxOp.
count > 0) {
617 template <
typename BaseTypeList_T,
int Dims_T>
620 (
const std::string &filename,
const std::string &attribute)
622 using namespace Field3D;
630 const size_t sizeBeforeLoading =
size();
634 std::vector<std::string> filenames;
635 filenames.push_back(filename);
637 BOOST_FOREACH (
const std::string fn, filenames) {
645 std::vector<std::string> names;
648 BOOST_FOREACH (
const std::string &name, names) {
650 minResults, maxResults);
652 mpl::for_each<BaseTypeList_T>(op);
658 setup(results, minResults, maxResults);
661 return size() - sizeBeforeLoading;
666 template <
typename BaseTypeList_T,
int Dims_T>
669 (
const float resMult)
687 template <
typename BaseTypeList_T,
int Dims_T>
701 template <
typename BaseTypeList_T,
int Dims_T>
713 template <
typename BaseTypeList_T,
int Dims_T>
716 const float wsSpotSize,
724 Sample op(wsP, result, numHits);
729 SampleMIP mipOp(wsP, wsSpotSize, result, numHits);
738 for (
size_t i = 0; i < Dims_T; ++i) {
739 result[i] /=
static_cast<float>(numHits);
747 template <
typename BaseTypeList_T,
int Dims_T>
755 Sample op(vsP, result, numHits);
762 template <
typename BaseTypeList_T,
int Dims_T>
777 template <
typename BaseTypeList_T,
int Dims_T>
780 const float wsSpotSize,
786 SampleMIP op(vsP, wsSpotSize, result, numHits);
793 template <
typename BaseTypeList_T,
int Dims_T>
797 const float *wsSpotSize,
809 template <
typename BaseTypeList_T,
int Dims_T>
824 template <
typename BaseTypeList_T,
int Dims_T>
838 template <
typename BaseTypeList_T,
int Dims_T>
848 return intervals.size() > 0;
853 template <
typename BaseTypeList_T,
int Dims_T>
881 template <
typename BaseTypeList_T,
int Dims_T>
885 long long int result = 0;
898 template <
typename BaseTypeList_T,
int Dims_T>
905 const bool doWsBoundsOptimization)
906 : m_field(f),
m_osToWs(osToWs), m_op(op),
910 template <
typename WrapperVec_T>
914 typedef typename WrapperVec_T::value_type Wrapper_T;
915 typedef typename Wrapper_T::field_type Field_T;
916 typedef typename Field_T::Ptr FieldPtr;
919 Field3D::field_dynamic_cast<Field_T>(m_field)) {
923 Wrapper_T &entry = vec.back();
938 entry.setValueRemapOp(m_op);
955 template <
typename BaseTypeList_T,
int Dims_T>
963 template <
typename WrapperVec_T>
966 for (
size_t i = 0, end = vec.size(); i < end; ++i) {
976 template <
typename BaseTypeList_T,
int Dims_T>
984 template <
typename T>
986 { count += vec.size(); }
993 template <
typename BaseTypeList_T,
int Dims_T>
998 Field3D::FieldRes::Vec &maxFields,
1000 : m_minFields(minFields),
1001 m_maxFields(maxFields),
1006 template <
typename WrapperVec_T>
1010 typedef typename WrapperVec_T::value_type Wrapper_T;
1011 typedef typename Wrapper_T::field_type Field_T;
1012 typedef typename Field3D::MIPField<Field_T> MIPField_T;
1013 typedef typename Field_T::value_type Value_T;
1014 typedef typename Field3D::Field<Value_T>::Ptr FieldPtr;
1016 std::pair<FieldPtr, FieldPtr> result;
1017 for (
size_t i = 0, end = vec.size(); i < end; ++i) {
1018 const Field_T &f = *(vec[i].field);
1019 result = Field3D::makeMinMax<MIPField_T>(f, m_resMult, m_numThreads);
1020 m_minFields.push_back(result.first);
1021 m_maxFields.push_back(result.second);
1033 template <
typename BaseTypeList_T,
int Dims_T>
1038 Field3D::FieldRes::Vec &maxFields,
1039 const float resMult)
1040 : m_minFields(minFields),
1041 m_maxFields(maxFields),
1046 template <
typename WrapperVec_T>
1050 typedef typename WrapperVec_T::value_type Wrapper_T;
1051 typedef typename Wrapper_T::field_type MIPField_T;
1052 typedef typename MIPField_T::NestedType Field_T;
1053 typedef typename Field_T::value_type Value_T;
1054 typedef typename Field3D::Field<Value_T>::Ptr FieldPtr;
1056 std::pair<FieldPtr, FieldPtr> result;
1057 for (
size_t i = 0, end = vec.size(); i < end; ++i) {
1058 const Field_T &f = *(vec[i].field->concreteMipLevel(0));
1059 result = Field3D::makeMinMax<MIPField_T>(f, m_resMult, m_numThreads);
1060 m_minFields.push_back(result.first);
1061 m_maxFields.push_back(result.second);
1073 template <
typename BaseTypeList_T,
int Dims_T>
1078 : m_p(p), m_result(result), m_numHits(numHits)
1081 template <
typename T>
1094 template <
typename BaseTypeList_T,
int Dims_T>
1100 : m_p(p), m_wsSpotSize(wsSpotSize), m_result(result), m_numHits(numHits)
1103 template <
typename T>
1118 template <
typename BaseTypeList_T,
int Dims_T>
1124 : m_n(n), m_p(p), m_result(result), m_numHits(numHits)
1127 template <
typename T>
1141 template <
typename BaseTypeList_T,
int Dims_T>
1146 float *result,
size_t *numHits)
1147 : m_n(n), m_p(p), m_wsSpotSize(wsSpotSize), m_result(result),
1151 template <
typename T>
1155 m_result, m_numHits);
1167 template <
typename BaseTypeList_T,
int Dims_T>
1172 : m_wsBounds(wsBounds)
1175 template <
typename T>
1178 for (
size_t field = 0, end = vec.size(); field < end; ++field) {
1185 for (
size_t i = 0; i < 8; ++i) {
1187 if (vec[field].doOsToWs) {
1190 vec[field].osToWs.multVecMatrix(osP, wsP);
1194 m_wsBounds.extendBy(wsP);
1205 template <
typename BaseTypeList_T,
int Dims_T>
1210 : m_wsRay(wsRay), m_intervals(intervals)
1217 const float worldScale)
const 1221 const float time = 0.0f;
1234 const double minLen =
min(
min(wsVoxelSize.x, wsVoxelSize.y),
1236 m_intervals.push_back(
Interval(t0, t1, minLen * worldScale));
1242 const float worldScale)
const 1246 typedef std::vector<V3d> PointVec;
1248 const float time = 0.0f;
1254 PointVec wsCorners(lsCorners.size());
1255 for (PointVec::iterator lsP = lsCorners.begin(), wsP = wsCorners.begin(),
1256 end = lsCorners.end(); lsP != end; ++lsP, ++wsP) {
1262 planes[0] =
Plane3d(wsCorners[4], wsCorners[0], wsCorners[6]);
1263 planes[1] =
Plane3d(wsCorners[1], wsCorners[5], wsCorners[3]);
1264 planes[2] =
Plane3d(wsCorners[4], wsCorners[5], wsCorners[0]);
1265 planes[3] =
Plane3d(wsCorners[2], wsCorners[3], wsCorners[6]);
1266 planes[4] =
Plane3d(wsCorners[0], wsCorners[1], wsCorners[2]);
1267 planes[5] =
Plane3d(wsCorners[5], wsCorners[4], wsCorners[7]);
1272 for (
int i = 0; i < 6; ++i) {
1275 if (p.intersectT(wsRay, t)) {
1276 if (wsRay.dir.dot(p.normal) > 0.0) {
1288 const double minLen =
min(
min(wsVoxelSize.x, wsVoxelSize.y),
1290 m_intervals.push_back(
Interval(t0, t1, minLen * worldScale));
1294 template <
typename T>
1298 for (
size_t field = 0, end = vec.size(); field < end; ++field) {
1300 Ray3d wsRay = m_wsRay;
1301 if (vec[field].doOsToWs) {
1302 vec[field].wsToOs.multVecMatrix(m_wsRay.pos, wsRay.pos);
1303 vec[field].wsToOs.multDirMatrix(m_wsRay.dir, wsRay.dir);
1309 dynamic_cast<const MatrixFieldMapping*>(m)) {
1310 intersectMatrixMapping(wsRay, mtx, vec[field].worldScale);
1314 dynamic_cast<const FrustumFieldMapping*>(m)) {
1315 intersectFrustumMapping(wsRay, f, vec[field].worldScale);
1326 template <
typename BaseTypeList_T,
int Dims_T>
1331 : m_wsBounds(wsBounds), m_min(min), m_max(max)
1334 template <
typename T>
1347 template <
typename BaseTypeList_T,
int Dims_T>
1352 : m_wsBounds(wsBounds), m_min(min), m_max(max)
1355 template <
typename T>
1368 template <
typename BaseTypeList_T,
int Dims_T>
1377 : m_wsBounds(wsBounds), m_result(result), m_mode(mode)
1380 template <
typename T>
1383 if (m_mode == Min) {
1399 template <
typename BaseTypeList_T,
int Dims_T>
1404 : m_memSize(&memSize)
1407 template <
typename T>
1410 for (
size_t field = 0, end = vec.size(); field < end; ++field) {
1411 *m_memSize += vec[field].field->memSize();
1416 {
return m_memSize; }
1423 template <
typename BaseTypeList_T,
int Dims_T>
1428 : m_wsP(wsP), m_doesIntersect(false)
1431 template <
typename T>
1434 for (
size_t field = 0, end = vec.size(); field < end; ++field) {
1436 for (
size_t i = 0, end = vec.size(); i < end; ++i) {
1439 if (vec[i].doOsToWs) {
1441 vec[i].wsToOs.multVecMatrix(m_wsP, osP);
1442 vec[i].mapping->worldToVoxel(osP, vsP);
1444 vec[i].mapping->worldToVoxel(m_wsP, vsP);
1447 if (vec[i].vsBounds.intersects(vsP)) {
1448 m_doesIntersect =
true;
1455 {
return m_doesIntersect; }
1468 #endif // include guard
MIPSparseTypes m_mipSparse
#define FIELD3D_NAMESPACE_HEADER_CLOSE
void intersectMatrixMapping(const Ray3d &wsRay, const MatrixFieldMapping *mtx, const float worldScale) const
Intersect matrix mapping.
FieldWrapper< Field3D::DenseField< T > >::Vec type
void sampleMultiple(const size_t n, const float *wsP, float *result) const
Samples the fields in the group.
fusion_ro::as_vector< MPLDenseTypes >::type DenseTypes
PointIsect(const V3d &wsP)
Ctor.
static void sample(const WrapperVec_T &f, const V3d &wsP, float *value, size_t &numHits)
MemSize(long long int &memSize)
Ctor.
virtual void worldToLocal(const V3d &wsP, V3d &lsP) const
Transform from world space position into local space.
void makeMinMax(const float resMult)
Make min/max representations of the fields in the group.
Contains the Field3DFile classesOSS sanitized.
std::vector< V3d > unitCornerPoints()
boost::shared_ptr< ValueRemapOp > Ptr
FieldRes::Vec m_auxFields
Stores all the auxiliary fields owned by the FieldGroup.
Contains the DenseField class.
M44d m_osToWs
Current object to world transform.
virtual void localToWorld(const V3d &lsP, V3d &wsP) const =0
Transform from local space position into world space.
ValueRemapOp::Ptr m_op
Value remap operator.
Field3D::FieldRes::Vec & m_maxFields
static void sampleMIP(const WrapperVec_T &f, const V3d &wsP, const float wsSpotSize, float *value, size_t &numHits)
Interface for sampling a vector of fields of the same type.
FieldGroup()
Default constructor, does nothing.
int load(const std::string &filename, const std::string &attribute)
Loads all fields from a given file and optional attribute pattern.
Field3D::FieldRes::Vec & minResults
MIPDenseTypes m_mipDenseMax
LoadFieldsParams(Field3D::Field3DInputFile &a_in, const std::string &a_name, const std::string &a_attribute, Field3D::FieldRes::Vec &a_results, Field3D::FieldRes::Vec &a_minResults, Field3D::FieldRes::Vec &a_maxResults)
bool m_hasPrefiltMinMax
Whether pre-filtered min/max are present.
bool m_doWsBoundsOptimization
Enable world space bounds optimization.
bool result() const
Result.
void getMinMax(const Box3d &wsBounds, float *min, float *max) const
Returns the min/max range within a given bounding box.
fusion_ro::as_vector< MPLSparseTypes >::type SparseTypes
DoWsBoundsOptimization(const bool doWsBoundsOptimization)
Ctor.
virtual V3d wsVoxelSize(int, int, int) const
Returns world-space size of a voxel at the specified coordinate.
FIELD3D_API size_t numIOThreads()
Returns the number of I/O threads to use.
static void sampleMultiple(const WrapperVec_T &f, const size_t neval, const float *wsPs, float *value, size_t *numHits)
virtual void localToWorld(const V3d &lsP, V3d &wsP) const
Transform from local space position into world space.
GetMinMax(const Box3d &wsBounds, float *min, float *max)
Ctor.
Base class for mapping between world-, local- and voxel coordinates.
Sample(const V3d &p, float *result, size_t &numHits)
Ctor.
static void getMinMax(const WrapperVec_T &f, const Box3d &wsBounds, float *min, float *max)
void operator()(const T &vec) const
Functor.
GetWsBounds(Box3d &wsBounds)
Ctor.
long long int memSize() const
Returns the memory use in bytes for the fields in the group.
Field3D::FieldRes::Vec & m_minFields
SampleMIPMultiple(const size_t n, const float *p, const float *wsSpotSize, float *result, size_t *numHits)
Ctor.
Contains MIP-related utility functions.
FieldWrapper< Field3D::SparseField< T > >::Vec type
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 compositi...
MIPDenseTypes m_mipDenseMin
virtual size_t size() const
The number of fields in the group.
bool intersects(const V3d &wsP) const
Whether the given point intersects any of the fields in the FieldGroup.
Field3D::FieldRes::Vec & m_maxFields
This class wraps up a single field to make its interpolator and its mapping easily accessible...
bool getIntersections(const Ray3d &ray, IntervalVec &intervals) const
Gets the intersection intervals between the ray and the fields.
GrabFields(Field3D::FieldRes::Ptr f, const M44d &osToWs, ValueRemapOp::Ptr op, const bool doWsBoundsOptimization)
Ctor.
bool hasPrefiltMinMax() const
Whether the FieldGroup has a pre-filtered min/max representation.
void operator()(const T &vec) const
Functor.
SampleMultiple(const size_t n, const float *p, float *result, size_t *numHits)
Ctor.
M44d m_osToWs
Object to world transform.
static void getMinMaxMIP(const WrapperVec_T &f, const Box3d &wsBounds, float *min, float *max)
long long int result() const
Result.
GetMinMaxMIP(const Box3d &wsBounds, float *min, float *max)
Ctor.
Contains the FieldInterp base class and some standard interpolation classes.
Field3D::FieldRes::Vec & results
void operator()(const T &vec) const
Functor.
void intersectFrustumMapping(const Ray3d &wsRay, const FrustumFieldMapping *mtx, const float worldScale) const
Intersect frustum mapping.
void operator()(const T &vec) const
Functor.
const size_t m_numThreads
mpl::transform< MPLBaseTypes, detail::MakeSparse< ph::_1 > >::type MPLSparseTypes
T max(const T a, const T2 b)
Max operation on mixed types.
Represents a single integration interval. The interval is assumed to be inclusive, i.e. [t0,t1].
void operator()(WrapperVec_T &vec) const
Functor.
void operator()(const T &vec) const
Functor.
void operator()(const WrapperVec_T &vec)
Functor.
FieldRes::Vec m_allFields
Stores all the fields owned by the FieldGroup.
SampleMIP(const V3d &p, const float wsSpotSize, float *result, size_t &numHits)
Ctor.
GetMinMaxPrefilt(const Box3d &wsBounds, float *result, MinMaxMode mode)
Ctor.
size_t sizeMIP() const
The number of MIP fields in the group.
MIPFieldWrapper< Field3D::MIPField< Field3D::DenseField< T > > >::Vec type
static void getMinMaxPrefilt(const WrapperVec_T &f, const Box3d &wsBounds, float *result, const Mode mode)
LoadFields(LoadFieldsParams ¶ms)
ValueRemapOp::Ptr m_valueRemapOp
Current value remap op. Defaults to null pointer.
MIPFieldWrapper< Field3D::MIPField< Field3D::SparseField< T > > >::Vec type
const std::string & attribute
std::vector< Interval > IntervalVec
void sampleMIP(const V3d &vsP, const float wsSpotSize, float *result, bool isVs) const
Samples all the MIP fields in the group.
Box3d wsBounds() const
Returns the bounds of the group.
const FieldRes::Vec & fields() const
Returns a vector of FieldRes::Ptrs to the fields in the group.
MIPSparseTypes m_mipSparseMin
void operator()(const T &vec) const
Functor.
static const int k_missingFile
Used by load() to indicate missing file.
void operator()(const T &vec) const
Functor.
const float * m_wsSpotSize
mpl::transform< MPLBaseTypes, detail::MakeDense< ph::_1 > >::type MPLDenseTypes
void getPartitionNames(std::vector< std::string > &names) const
Gets the names of all the partitions in the file.
MIPSparseTypes m_mipSparseMax
IntervalVec & m_intervals
long long int * m_memSize
Field3D::FieldRes::Ptr m_field
The field to work on. Will be matched against the type of operator().
This class wraps up a single MIP field to make its interpolator and its mapping easily accessible...
Field3D::FieldRes::Vec & m_minFields
mpl::transform< MPLBaseTypes, detail::MakeMIPDense< ph::_1 > >::type MPLMIPDenseTypes
void operator()(const T &vec) const
Functor.
FIELD3D_NAMESPACE_OPEN typedef mpl::vector< Field3D::half, float, double > ScalarTypes
void operator()(const WrapperVec_T &vec)
Functor.
virtual V3d wsVoxelSize(int i, int j, int k) const
Returns world-space size of a voxel at the specified coordinate.
FieldGroup< VectorTypes, 3 > VectorFieldGroup
Represents the mapping of a field by a perspective transform.
Contains the initIO function.
Field3D::FieldRes::Vec & maxResults
MakeMinMax(Field3D::FieldRes::Vec &minFields, Field3D::FieldRes::Vec &maxFields, const float resMult)
Ctor.
Contains MIP-related utility functions.
mpl::vector< Field3D::V3h, Field3D::V3f, Field3D::V3d > VectorTypes
LoadFields(LoadFieldsParams ¶ms)
Contains the SparseField class.
bool intersect(const Ray3d &ray, const Box3d &box, double &outT0, double &outT1)
void sampleMIPMultiple(const size_t n, const float *wsP, const float *wsSpotSize, float *result) const
Samples all the MIP fields in the group.
Field3D::Field3DInputFile & in
void worldToLocalDir(const V3d &wsV, V3d &lsV) const
std::vector< V3d > cornerPoints(const Box3d &box)
void operator()(const T &vec) const
Functor.
void operator()(const T &vec) const
Functor.
FIELD3D_NAMESPACE_OPEN std::pair< typename MIPField_T::Ptr, typename MIPField_T::Ptr > makeMinMax(const typename MIPField_T::NestedType &base, const float resMult, const size_t numThreads)
Constructs a min/max MIP representation of the given field.
fusion_ro::as_vector< MPLMIPSparseTypes >::type MIPSparseTypes
bool m_doWsBoundsOptimization
Enable world space bounds optimization.
void operator()(WrapperVec_T &vec) const
Functor.
MakeMinMaxMIP(Field3D::FieldRes::Vec &minFields, Field3D::FieldRes::Vec &maxFields, const float resMult)
Ctor.
void setValueRemapOp(ValueRemapOp::Ptr op)
Sets the current ValueRemap operator. This will be used for subsequent setup() and load() calls...
void setOsToWs(const Imath::M44d &osToWs)
Sets the current object to world transform. This will be used for subsequent setup() and load() calls...
GetIntersections(const Ray3d &wsRay, IntervalVec &intervals)
Ctor.
T min(const T a, const T2 b)
Min operation on mixed types.
void operator()(const T &vec) const
Functor.
mpl::transform< MPLBaseTypes, detail::MakeMIPSparse< ph::_1 > >::type MPLMIPSparseTypes
const size_t m_numThreads
static const char * k_minSuffix
Represents the mapping of a field by a matrix transform.
Contains the MIPField class.
static void sampleMIPMultiple(const WrapperVec_T &f, const size_t neval, const float *wsPs, const float *wsSpotSizes, float *value, size_t *numHits)
virtual void setup(const Field3D::FieldRes::Ptr field)
Adds a single field to the group.
static const char * k_maxSuffix
fusion_ro::as_vector< MPLMIPDenseTypes >::type MIPDenseTypes
virtual void setWsBoundsOptimization(const bool doWsBoundsOptimization)
Enable world axis aligned bounding box in lookups. This will be used for subsequent setup() and load(...
bool m_doWsBoundsOptimization
Enable world space bounds optimization.
void setupMinMax(const FieldRes::Vec &minFields, const FieldRes::Vec &maxFields)
Set up the min/max MIP representations.
FieldGroup< ScalarTypes, 1 > ScalarFieldGroup
void operator()(const T &vec) const
Functor.
BaseTypeList_T MPLBaseTypes