本文整理汇总了C++中Timing::stop方法的典型用法代码示例。如果您正苦于以下问题:C++ Timing::stop方法的具体用法?C++ Timing::stop怎么用?C++ Timing::stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timing
的用法示例。
在下文中一共展示了Timing::stop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
/******************************* [ signal ] ******************************/
Type a = 0;
Type b = Ls-1;
Vector<Type> t = linspace(a,b,Ls) / Type(Fs);
Vector<Type> s = sin( Type(400*PI) * pow(t,Type(2.0)) );
/******************************** [ widow ] ******************************/
a = 0;
b = Type(Lg-1);
Type u = (Lg-1)/Type(2);
Type r = Lg/Type(8);
t = linspace(a,b,Lg);
Vector<Type> g = gauss(t,u,r);
g = g/norm(g);
/********************************* [ WFT ] *******************************/
Type runtime = 0;
Timing cnt;
cout << "Taking windowed Fourier transform." << endl;
cnt.start();
Matrix< complex<Type> > coefs = wft( s, g );
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
/******************************** [ IWFT ] *******************************/
cout << "Taking inverse windowed Fourier transform." << endl;
cnt.start();
Vector<Type> x = iwft( coefs, g );
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
cout << "The relative error is : " << "norm(s-x) / norm(s) = "
<< norm(s-x)/norm(s) << endl << endl;
return 0;
}
示例2: setOutputMatrixToAlgebraDefault
void setOutputMatrixToAlgebraDefault(float_tt* dst, size_t numVal, log4cxx::LoggerPtr logger) {
Timing timer;
valsSet(dst, ::nan(""), numVal); // ScaLAPACK algorithm should provide all entries in matrix
LOG4CXX_DEBUG(SCALAPACKPHYSICAL_HPP_logger, "setOutputMatrixToAlgebraDefault took " << timer.stop());
}
示例3: setInputMatrixToAlgebraDefault
void setInputMatrixToAlgebraDefault(float_tt* dst, size_t numVal) {
Timing timer;
memset(dst, 0, sizeof(float_tt) * numVal); // empty cells are implicit zeros for sparse matrices
enum dummy {DBG_DENSE_ALGEBRA_WITH_NAN_FILL=0}; // won't be correct if empty cells present
if(DBG_DENSE_ALGEBRA_WITH_NAN_FILL) {
valsSet(dst, ::nan(""), numVal); // any non-signalling nan will do
LOG4CXX_WARN(SCALAPACKPHYSICAL_HPP_logger, "@@@@@@@@@@@@@ WARNING: prefill matrix memory with NaN for debug");
}
LOG4CXX_DEBUG(SCALAPACKPHYSICAL_HPP_logger, "setInputMatrixToAlgebraDefault took " << timer.stop());
}
示例4: main
int main()
{
/******************************* [ signal ] ******************************/
Vector<double> t = linspace( 0.0, (Ls-1)/fs, Ls );
Vector<double> st = sin( 200*PI*pow(t,2.0) );
st = st-mean(st);
/******************************** [ CWT ] ********************************/
Matrix< complex<double> > coefs;
CWT<double> wavelet("morlet");
wavelet.setScales( fs, fs/Ls, fs/2 );
Timing cnt;
double runtime = 0.0;
cout << "Taking continuous wavelet transform(Morlet)." << endl;
cnt.start();
coefs = wavelet.cwtC(st);
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
/******************************** [ ICWT ] *******************************/
cout << "Taking inverse continuous wavelet transform." << endl;
cnt.start();
Vector<double> xt = wavelet.icwtC(coefs);
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
cout << "The relative error is : " << endl;
cout << "norm(st-xt) / norm(st) = " << norm(st-xt)/norm(st) << endl;
cout << endl << endl;
/******************************* [ signal ] ******************************/
Vector<float> tf = linspace( float(0.0), (Ls-1)/float(fs), Ls );
Vector<float> stf = sin( float(200*PI) * pow(tf,float(2.0) ) );
stf = stf-mean(stf);
/******************************** [ CWT ] ********************************/
CWT<float> waveletf("mexiHat");
waveletf.setScales( float(fs), float(fs/Ls), float(fs/2), float(0.25) );
runtime = 0.0;
cout << "Taking continuous wavelet transform(Mexican Hat)." << endl;
cnt.start();
Matrix<float> coefsf = waveletf.cwtR(stf);
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
/******************************** [ ICWT ] *******************************/
cout << "Taking inverse continuous wavelet transform." << endl;
cnt.start();
Vector<float> xtf = waveletf.icwtR(coefsf);
cnt.stop();
runtime = cnt.read();
cout << "The running time = " << runtime << " (ms)" << endl << endl;
cout << "The relative error is : " << endl;
cout << "norm(st-xt) / norm(st) = " << norm(stf-xtf)/norm(stf) << endl << endl;
return 0;
}
示例5: main
void main(void)
{
int i, k;
Timing watch;
Point3D mid, ext;
float cubeHalfSide = 100.0f;
float minSphereRadius;
float minHalfBoxExtent;
float maxSphereRadius;
float maxHalfBoxExtent;
// Note: Change the value of 'testCase' in [0, 4] to vary
// the number of overlaps in the generated test data.
int testCase = 0;
switch (testCase) {
case 0:
minSphereRadius = 1.0f;
minHalfBoxExtent = 1.0f;
maxSphereRadius = 32.5f;
maxHalfBoxExtent = 32.5f;
break;
case 1:
minSphereRadius = 1.0f;
minHalfBoxExtent = 1.0f;
maxSphereRadius = 55.0f;
maxHalfBoxExtent = 55.0f;
break;
case 2:
minSphereRadius = 1.0f;
minHalfBoxExtent = 1.0f;
maxSphereRadius = 77.5f;
maxHalfBoxExtent = 77.5f;
break;
case 3:
minSphereRadius = 13.5f;
minHalfBoxExtent = 13.5f;
maxSphereRadius = 85.0f;
maxHalfBoxExtent = 85.0f;
break;
case 4:
minSphereRadius = 28.0f;
minHalfBoxExtent = 28.0f;
maxSphereRadius = 99.0f;
maxHalfBoxExtent = 99.0f;
break;
default:
minSphereRadius = 1.0f;
minHalfBoxExtent = 1.0f;
maxSphereRadius = 10.0f;
maxHalfBoxExtent = 10.0f;
}
for (i = 0; i < NUMBER_OF_BV_PAIRS; i++) {
sphereArray[i].r = getRandomScalar(minSphereRadius, maxSphereRadius);
sphereArray[i].c.x = getRandomScalar(-cubeHalfSide + sphereArray[i].r, cubeHalfSide - sphereArray[i].r);
sphereArray[i].c.y = getRandomScalar(-cubeHalfSide + sphereArray[i].r, cubeHalfSide - sphereArray[i].r);
sphereArray[i].c.z = getRandomScalar(-cubeHalfSide + sphereArray[i].r, cubeHalfSide - sphereArray[i].r);
ext.x = getRandomScalar(minHalfBoxExtent, maxHalfBoxExtent);
ext.y = getRandomScalar(minHalfBoxExtent, maxHalfBoxExtent);
ext.z = getRandomScalar(minHalfBoxExtent, maxHalfBoxExtent);
mid.x = getRandomScalar(-cubeHalfSide + ext.x, cubeHalfSide - ext.x);
mid.y = getRandomScalar(-cubeHalfSide + ext.y, cubeHalfSide - ext.y);
mid.z = getRandomScalar(-cubeHalfSide + ext.z, cubeHalfSide - ext.z);
boxArray[i].min.x = mid.x - ext.x;
boxArray[i].min.y = mid.y - ext.y;
boxArray[i].min.z = mid.z - ext.z;
boxArray[i].max.x = mid.x + ext.x;
boxArray[i].max.y = mid.y + ext.y;
boxArray[i].max.z = mid.z + ext.z;
}
/* ==== Method 1 ==== */
noOverlaps[0] = 0;
watch.start();
for (k=0; k < REPETITIONS; k++) {
for (i = 0; i < NUMBER_OF_BV_PAIRS; i++) {
noOverlaps[0] += overlapSphereAABB_Arvo(sphereArray[i], boxArray[i]);
}
}
time[0] = watch.stop() / REPETITIONS;
noOverlaps[0] /= REPETITIONS;
printResult(algorithmName[0], noOverlaps[0], time[0]);
/* ==== Method 2 ==== */
noOverlaps[1] = 0;
watch.start();
for (k=0; k < REPETITIONS; k++) {
for (i = 0; i < NUMBER_OF_BV_PAIRS; i++) {
noOverlaps[1] += overlapSphereAABB_QRI(sphereArray[i], boxArray[i]);
}
}
time[1] = watch.stop() / REPETITIONS;
noOverlaps[1] /= REPETITIONS;
printResult(algorithmName[1], noOverlaps[1], time[1]);
//.........这里部分代码省略.........
示例6: calculateAllCollisions
//.........这里部分代码省略.........
if (mDetectorDeformManager) {
// note: once this is called, internal job collections of the
// DetectorDeformAlgorithm objects will add their jobs to the
// pipeline - but the _pipeline_ will actually start the jobs
mDetectorDeformManager->notifyPipelineStarted();
}
// add deformable self-collision jobs
if (mDetectorDeformManager) {
const std::list<Proxy*>& selfCollisionProxies = mWorld->getSelfcollisionProxies();
for (std::list<Proxy*>::const_iterator it = selfCollisionProxies.begin(); it != selfCollisionProxies.end(); ++it) {
if (!((*it)->getProxyType() & PROXYTYPE_DEFORMABLE)) {
continue;
}
if (mWorld->getUseCollisionCaching()) {
bool cacheApplied = mWorld->getCollisionCache()->applyCacheIfAvailable(*it, *it);
if (cacheApplied) {
continue;
}
}
DetectorDeformAlgorithm* algorithm = mDetectorDeformManager->pickAlgorithmFor(*it, *it);
if (algorithm) {
CollisionPair pair;
// FIXME: make CollisionPair store Proxy pointers, not
// BoundingVolume pointers.
pair.bvol1 = (*it)->getBvHierarchyNode()->getBoundingVolume();
pair.bvol2 = pair.bvol1;
algorithm->createCollisionJobFor(pair);
}
}
}
}
if (!getUsePipelining()) {
completeCurrentPhase();
time.stop();
mWorld->getCurrentDebugLogEntry()->addTiming("BroadPhase", time);
time.restart();
mCurrentPhase = PHASE_MIDDLEPHASE;
completeCurrentPhase();
time.stop();
mWorld->getCurrentDebugLogEntry()->addTiming("MiddlePhase", time);
time.restart();
mCurrentPhase = PHASE_NARROWPHASE;
completeCurrentPhase();
time.stop();
mWorld->getCurrentDebugLogEntry()->addTiming("NarrowPhase", time);
} else {
completeCurrentPhase();
time.stop();
// in a pipelined run we cannot differ between phases
// AB: note: "BroadPhase", "MiddlePhase" and "NarrowPhase" timings
// can still be retrieved from the log - since we havent added
// them, they will be nullified Timing objects.
mWorld->getCurrentDebugLogEntry()->addTiming("Pipeline", time);
}
if (mDetectorDeformManager) {
// reset the job collections of the algorithms
// note: at this point all jobs must already be completed!
mDetectorDeformManager->notifyPipelineCompleted();
}
// pipeline has been completed at this point. add results to
// worldCollisions.
worldCollisions->setRigidBoundingVolumeCollisions(&mMiddlePhaseRigidResults);
worldCollisions->addNarrowPhaseCollisions(&mCollisionInfos);
// post-pipeline algorithms
time.restart();
startCompletelyUnthreadedAlgorithms(worldCollisions);
time.stop();
mWorld->getCurrentDebugLogEntry()->addTiming("UnthreadedPhase", time);
mWorld->getCurrentDebugLogEntry()->setUIntVariable("BroadPhase job count", mWorld->getBroadPhase()->getJobCollection()->getJobsInCollectionCount());
mWorld->getCurrentDebugLogEntry()->setUIntVariable("BroadPhase min collisions per job", mMinCollisionsPerBroadPhaseJob);
mWorld->getCurrentDebugLogEntry()->setUIntVariable("BroadPhase max collisions per job", mMaxCollisionsPerBroadPhaseJob);
mWorld->getCurrentDebugLogEntry()->setUIntVariable("BroadPhase collisions", mTotalBroadPhaseCollisions);
// sanity check
mWorkerPool->waitForCompletion();
if (mWorkerPool->hasCompletedJobs()) {
std::cerr << dc_funcinfo << "ERROR: completed jobs left" << std::endl;
while (mWorkerPool->hasCompletedJobs()) {
delete mWorkerPool->retrieveCompletedJob();
}
}
mCurrentPhase = PHASE_INVALID;
if (!mBroadPhaseJobs->empty() || !mMiddlePhaseJobs->empty() || !mNarrowPhaseJobs->empty()) {
throw Exception("Pipeline: internal error: not all job lists empty at end of collision detection");
}
}