////////////////////////////////////////////////////////////////////////// // generate seeds ////////////////////////////////////////////////////////////////////////// bool SeedGenerator::GetSeeds(int timestep, VaporFlow* vFlow, float *pSeeds, const bool bRandom, const unsigned int randomSeed, int stride) { Rake* pRake = 0; if (bRandom) pRake = new SolidRake(); else { if(rakeDimension == POINT) pRake = new PointRake(); else if(rakeDimension == LINE) pRake = new LineRake(); else if(rakeDimension == PLANE) pRake = new PlaneRake(); else if(rakeDimension == SOLID) pRake = new SolidRake(); } const vector<double>&usrExts = vFlow->getDataMgr()->GetExtents((size_t)timestep); if(bRandom){ //Setup for biased distribution: //First calc min/max of field in rake. float fieldMin = 0., fieldMax=0.; vector<string>varnames; varnames.push_back(varx); varnames.push_back(vary); varnames.push_back(varz); if( distribBias != 0.){ bool rc = vFlow->getFieldMagBounds(&fieldMin, &fieldMax, varnames, true, numRefinements, timeStep); if (!rc) { return false; } } //Then set up the FieldData FieldData* fData = 0; fData = vFlow->setupFieldData(varnames, true, numRefinements, timeStep, false); if (!fData) {delete pRake; return false;} bool rc = pRake->GenSeedBiased(usrExts,distribBias,fieldMin,fieldMax, fData,numSeeds, rakeLocalMin,rakeLocalMax, pSeeds, randomSeed, stride); if (!rc) { MyBase::SetErrMsg(VAPOR_ERROR_SEEDS, "Unable to generate requested number of random seed points.\nEnsure the rake overlaps valid field data\nor choose a smaller bias."); delete fData; delete pRake; return false; } if (fData) {fData->releaseData(vFlow->getDataMgr()); delete fData; } } else pRake->GenSeedRegular(usrExts,numSeeds, rakeLocalMin, rakeLocalMax, pSeeds, stride); delete pRake; return true; }
////////////////////////////////////////////////////////////////////////// // generate seeds from rake ////////////////////////////////////////////////////////////////////////// void SeedGenerator::GetSeeds(VECTOR3* pSeeds, const bool bRandom) { Rake* pRake; if(rakeDimension == LINE) pRake = new LineRake(); else if(rakeDimension == PLANE) pRake = new PlaneRake(); else if(rakeDimension == SOLID) pRake = new SolidRake(); if(bRandom) pRake->GenSeedRandom(numSeeds, rakeMin, rakeMax, pSeeds); else pRake->GenSeedRegular(numSeeds, rakeMin, rakeMax, pSeeds); delete pRake; }