I was wondering if there is a convinient way (or more of a standard way) to iterate over a subset of blocks?
Finding the global min/max was fairly easy given all the sample code in the newsgroup and inside the houdini plugin.
Finding the min/max for a subset of blocks, seems a bit more complicated (as stated by Magnus). I tried the following approch:
// creating a Box3i of a subset I want to calc min/max of
Field3D::Box3i bi_box(vsP_min, vsP_max);
// getting the block indexes of the min and the max (they probably differ, span over multiple blocks)
// lower bounds
int bx, by, bz;
field->getBlockCoord(vsP_min.x, vsP_min.y, vsP_min.z, bx, by, bz);
// upper bounds
int bex, bey, bez;
field->getBlockCoord(vsP_max.x, vsP_max.y, vsP_max.z, bex, bey, bez);
// create subdomain I want to iterate over (spans over multiple blocks)
Field3D::Box3i boundBox(V3i(bx,by,bz), V3i(bex,bey,bez));
// iterate over this subset
Field3D::SparseFieldf::iterator it = field->begin(boundBox);
Field3D::SparseFieldf::iterator it_end = field->end(boundBox);
for ( ; it != it_end; ++it) {
// do something
}
Cheers
Maik