本文整理汇总了C++中Timing::check方法的典型用法代码示例。如果您正苦于以下问题:C++ Timing::check方法的具体用法?C++ Timing::check怎么用?C++ Timing::check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timing
的用法示例。
在下文中一共展示了Timing::check方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flush
void FileIO::flush(Timing timing, double dt)
{
if(timing.check(dataFileFlushTiming, dt)) H5Fflush(file, H5F_SCOPE_GLOBAL);
}
示例2: writeData
int Analysis::writeData(Timing timing, double dt)
{
if (timing.check(dataOutputMoments, dt) ) {
FA_Mom_Tp->write(getTemperatureParallel().data());
FA_Mom_HeatFlux->write(getHeatFlux().data());
FA_Mom_Density->write(getNumberDensity().data());
FA_Mom_Time->write(&timing);
writeMessage("Data I/O : Moments output");
}
if (timing.check(dataOutputStatistics, dt) ) {
// Ugly and error-prone
getPowerSpectrum();
Array2d pSpecX(Range(1, plasma->nfields), Range(0, Nx/2)); pSpecX(Range(1, plasma->nfields), Range(0, Nx/2)) = pSpec((int) DIR_X, Range(1, plasma->nfields), Range(0, Nx/2));
Array2d pSpecY(Range(1, plasma->nfields), Range(0, Nky)); pSpecY(Range(1, plasma->nfields), Range(0, Nky)) = pSpec((int) DIR_Y, Range(1, plasma->nfields), Range(0, Nky));
Array2d pPhaseX(Range(1, plasma->nfields), Range(0, Nx/2)); pPhaseX(Range(1, plasma->nfields), Range(0, Nx/2)) = pPhase((int) DIR_X, Range(1, plasma->nfields), Range(0, Nx/2));
Array2d pPhaseY(Range(1, plasma->nfields), Range(0, Nky)) ; pPhaseY(Range(1, plasma->nfields), Range(0, Nky)) = pPhase((int) DIR_Y, Range(1, plasma->nfields), Range(0, Nky));
FA_grow_x->write( pSpecX.data()); FA_grow_y->write( pSpecY.data()); FA_grow_t->write(&timing);
FA_freq_x->write(pPhaseX.data()); FA_freq_y->write(pPhaseY.data()); FA_freq_t->write(&timing);
// Heat Flux
Array3d heatKy; heatKy.reference(getHeatFluxKy());
FA_heatKy->write(heatKy.data());
Array3d particleKy; particleKy.reference(getParticleFluxKy());
FA_particleKy->write(particleKy.data());
ScalarValues scalarValues;
// calculate kineic Energy first, need for initial_e ! sum over sumdomains
scalarValues.timestep = timing.step;
scalarValues.time = timing.time;
getFieldEnergy(scalarValues.phiEnergy, scalarValues.ApEnergy, scalarValues.BpEnergy);
// Get scalar Values for every species
for(int s = NsGlD; s <= NsGuD; s++) {
scalarValues.particle_number[s-1] = getParticelNumber(s) ;
scalarValues.entropy [s-1] = getEntropy(s) ;
scalarValues.kinetic_energy [s-1] = getKineticEnergy(s) ;
scalarValues.particle_flux [s-1] = getTotalParticleFlux(s) ;
scalarValues.heat_flux [s-1] = getTotalHeatFlux(s) ;
}
SVTable->append(&scalarValues);
// write out to Terminal/File
std::stringstream messageStream;
messageStream << "Step : " << scalarValues.timestep << " Time " << scalarValues.time
<< " Field : (phi)" << scalarValues.phiEnergy << " (Ap)" << scalarValues.ApEnergy << " (Bp) " << scalarValues.BpEnergy << std::endl;
double charge = 0., kinetic_energy=0.;
for(int s = NsGlD; s <= NsGuD; s++) {
messageStream << plasma->species(s).name << " N :" << scalarValues.particle_number[s-1] << " Kinetic Energy : " << scalarValues.kinetic_energy[s-1] ;
messageStream << " Particle Flux :" << scalarValues.particle_flux[s-1] << " Heat Flux : " << scalarValues.heat_flux[s-1] << std::endl;
charge += plasma->species(s).q * scalarValues.particle_number[s-1];
kinetic_energy += scalarValues.kinetic_energy[s-1];
}
messageStream << std::endl << "------------------------------------------------------------------" <<
std::endl << "Total Energy " << kinetic_energy+scalarValues.phiEnergy + scalarValues.ApEnergy + scalarValues.BpEnergy << " Total Charge = " << ((plasma->species(0).n0 != 0.) ? 0. : charge) << std::endl;
parallel->print(messageStream);
}
return HELIOS_SUCCESS;
}