for(int i = 0; i < 20; i++)
{
setStartTime(blockTime);
openvdb::FloatGrid::Ptr cachedLevelSet = (openvdb::createLevelSet<openvdb::FloatGrid>(voxelSize, halfWidth));
openvdb::tools::ParticlesToLevelSet<openvdb::FloatGrid, openvdb::Index32> raster(*cachedLevelSet);
raster.setRmin(1e-6);
raster.setGrainSize(1);
raster.rasterizeSpheres(myParticles);
raster.finalize();
dump("ParticlesToLevelSet index = %d took %.2lf sec\n", i, getEndTime(blockTime));
}
for(int i = 0; i < 20; i++)
{
setStartTime(blockTime);
openvdb::FloatGrid::Ptr cachedLevelSet = (openvdb::createLevelSet<openvdb::FloatGrid>(voxelSize, halfWidth));
openvdb::tools::ParticlesToLevelSet<openvdb::FloatGrid, openvdb::Index32> raster(*cachedLevelSet);
raster.setRmin(1e-6);
raster.setGrainSize(1);
raster.rasterizeSpheres(myParticles);
raster.finalize();
dump("ParticlesToLevelSet index = %d took %.2lf sec\n", i, getEndTime(blockTime));
cachedLevelSet->clear(); // << clear added here
if(cachedLevelSet->empty()) // added to confirm grid is empty when checking cachedLevelSet->empty()
dump("EMPTIED\n");}
UpdateParticles took 1.87 secParticle Count = 4242109ParticlesToLevelSet index = 0 took 5.51 secEMPTIEDParticlesToLevelSet index = 1 took 5.62 secEMPTIEDParticlesToLevelSet index = 2 took 5.68 secEMPTIEDParticlesToLevelSet index = 3 took 5.70 secEMPTIEDParticlesToLevelSet index = 4 took 5.80 secEMPTIEDParticlesToLevelSet index = 5 took 6.27 secEMPTIEDParticlesToLevelSet index = 6 took 6.21 secEMPTIEDParticlesToLevelSet index = 7 took 6.15 secEMPTIEDParticlesToLevelSet index = 8 took 6.32 secEMPTIEDParticlesToLevelSet index = 9 took 6.27 secEMPTIEDParticlesToLevelSet index = 10 took 6.44 secEMPTIEDParticlesToLevelSet index = 11 took 6.35 secEMPTIEDParticlesToLevelSet index = 12 took 6.51 secEMPTIEDParticlesToLevelSet index = 13 took 6.50 secEMPTIEDParticlesToLevelSet index = 14 took 6.42 secEMPTIEDParticlesToLevelSet index = 15 took 6.44 secEMPTIEDParticlesToLevelSet index = 16 took 6.45 secEMPTIEDParticlesToLevelSet index = 17 took 6.76 secEMPTIEDParticlesToLevelSet index = 18 took 6.93 secEMPTIEDParticlesToLevelSet index = 19 took 6.67 secEMPTIEDPress any key to continue . . .I don't know what timer you're using can you try to replace setStartTime(blockTime);
with
openvdb::util::CpuTimer timer("ParticlesToLevelSet");// remember to include <openvdb/util/CpuTimer.h>
anddump("ParticlesToLevelSet index = %d took %.2lf sec\n", i, getEndTime(blockTime));
with
timer.stop();
Also, what is your voxelSize, the size of the input particles in units of the voxelSize, the OS, the core count of your CPU and the compiler version? Finally when you build are you linking against jemalloc or tbbmalloc - or neither? All of these factors could affect your performance. The best would of course be if you could email the actual code (preferably simplified as much as possible) so I try to reproduce your observations. In short I'm baffled :)
Cheers,
-K
Since I don't have access to a Windows machine I can't help you beyond saying this is not a known issue under Linux. Maybe someone else on this forum can try to reproduce your observation on Windows ...