当前位置: 首页>>代码示例>>C++>>正文


C++ Timing::check方法代码示例

本文整理汇总了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);

}
开发者ID:xyuan,项目名称:gkc,代码行数:5,代码来源:FileIO.cpp

示例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;
  }
开发者ID:xyuan,项目名称:gkc,代码行数:70,代码来源:Analysis.cpp


注:本文中的Timing::check方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。