示例#1
0
文件: simple.hpp 项目: Fadis/harps
 /*!
  * 楽譜を読んでオーディオデータを生成し、指定された出力先に出力します。
  */
   void operator() () {
     tbb::parallel_for ( tbb::blocked_range< unsigned int > ( 0, track_count, 1 ),
                    TrackRunner ( readers, buffers ) );
     BufferType sum;
     Buffer< float >::SampleType *sum_raw = sum.get();
     unsigned int sample_index;
     for ( sample_index = 0; sample_index != SAMPLE_COUNT; sample_index++ )
       sum_raw[ sample_index ] = 0.0;
     unsigned int track_index;
     for ( track_index = 0; track_index != track_count; track_index++ ) {
       if ( buffers[ track_index ] ) {
         Buffer< float >::SampleType *buffer_raw = buffers[ track_index ]->get();
         for ( sample_index = 0; sample_index != SAMPLE_COUNT; sample_index++ )
           sum_raw[ sample_index ] += buffer_raw[ sample_index ];
       }
     }
     BufferType nlevel;
     Buffer< float >::SampleType *nlevel_raw = nlevel.get();
     for ( sample_index = 0; sample_index != SAMPLE_COUNT; sample_index++ ) {
       normalizer.setValue ( sum_raw[ sample_index ] );
       nlevel_raw[ sample_index ] = normalizer.getAmp();
     }
     reduceNormalizingNoize ( nlevel );
     for ( sample_index = 0; sample_index != SAMPLE_COUNT; sample_index++ )
       sum_raw[ sample_index ] /= nlevel_raw[ sample_index ];
     output ( sum/*, SAMPLE_COUNT*/ );
   }
示例#2
0
void CoulombPBCAATemp::copyFromBuffer(ParticleSet& P, BufferType& buffer)
{
  if(is_active)
  {
    buffer.get(SR2.begin(),SR2.end());
    buffer.get(Value);
  }
}
 /** calculate the averages and reset to zero
  *\param record a container class for storing scalar records (name,value)
  *\param wgtinv the inverse weight
  */
 void LocalEnergyEstimator::report(RecordListType& record, RealType wgtinv, BufferType& msg) {
   msg.get(elocal.begin(),elocal.end());
   register int ir=LocalEnergyIndex;
   b_average =  elocal[ENERGY_INDEX]*wgtinv;
   b_variance = elocal[ENERGY_SQ_INDEX]*wgtinv-b_average*b_average;
   record[ir++] = b_average;
   record[ir++] = b_variance;
   record[ir++] = elocal[POTENTIAL_INDEX]*wgtinv;
   for(int i=0, ii=LE_MAX; i<SizeOfHamiltonians; i++,ii++) {
     record[ir++] = elocal[ii]*wgtinv;
   }
   reset();
 }
示例#4
0
void CoulombPBCAB::copyFromBuffer(ParticleSet& P, BufferType& buffer)
{
  buffer.get(SRpart.begin(),SRpart.end());
  buffer.get(LRpart.begin(),LRpart.end());
  buffer.get(Value);
}
示例#5
0
 void LocalECPotential::copyFromBuffer(ParticleSet& P, BufferType& buffer) 
 {
   buffer.get(PPart.begin(),PPart.end());
   buffer.get(Value);
 }
 /** calculate the averages and reset to zero
  * @param record a container class for storing scalar records (name,value)
  * @param wgtinv the inverse weight
  *
  * Disable collection. MultipleEnergyEstimator does not need to communiate at all.
  */
 void MultipleEnergyEstimator::report(RecordNamedProperty<RealType>& record, 
     RealType wgtinv, BufferType& msg) 
 {
   msg.get(esum.begin(),esum.end());
   report(record,wgtinv);
 }