コード例 #1
0
ファイル: webservicettsprovider.cpp プロジェクト: KDE/simon
WebserviceTTSProvider::WebserviceTTSProvider() : QObject(),
  downloadMutex(QMutex::Recursive),
  downloadOffset(0),
  currentConnection(0),
  net(0),
  player(0)
{
  initializeOutput();
  connect(SoundServer::getInstance(), SIGNAL(devicesChanged()), this, SLOT(initializeOutput()));
}
コード例 #2
0
ファイル: PixelProvider.cpp プロジェクト: Myasuka/scidb
inline void setOutputPosition(  boost::shared_ptr<ArrayIterator>& stateArrayIterator,
                                boost::shared_ptr<ChunkIterator>& stateChunkIterator,
                                Coordinates const& outPos)
{
  if (!stateChunkIterator || !stateChunkIterator->setPosition(outPos))
  {
     //cout << "ok I couldn't set the pos" << endl; flush(cout);
     if (stateChunkIterator) {
         stateChunkIterator->flush();
         stateChunkIterator.reset();
     }
     //cout << "flushed the CiT" << endl; flush(cout);

     if (!stateArrayIterator->setPosition(outPos))
     {
       //cout << "Even the AiT couldn't set .. do it" << endl; flush(cout);
       initializeOutput(stateArrayIterator, stateChunkIterator, outPos);
       //cout << "Done" << endl; flush(cout); 
     }
     else
     {
       //cout << "The AiT was able .. Updating chunk .. or I dunno" << endl; flush(cout);
       boost::shared_ptr<Query> query(stateArrayIterator->getQuery());
       Chunk& stateChunk = stateArrayIterator->updateChunk();
       stateChunkIterator = stateChunk.getIterator(query, ChunkIterator::APPEND_CHUNK);
       //cout << "Done" << endl; flush(cout);
     }
     if (!stateChunkIterator->setPosition(outPos))
         throw SYSTEM_EXCEPTION(SCIDB_SE_EXECUTION, SCIDB_LE_OPERATION_FAILED) << "setPosition";
  }
}
コード例 #3
0
ファイル: VTKWriter.cpp プロジェクト: p-hoffmann/madpac
void VTKWriter::writeOutput(int xsize, int ysize, OffsetArray<double> *_p, OffsetArray<utils::Vector<double,2> > *_v, const std::string& filename, int iteration) {
	initializeOutput(xsize*ysize);
	for(int i=0;i<xsize;i++)
		for(int j=0;j<ysize;j++)
			plotCell(_p,_v,i,j,1,0,0,1);
	writeFile(filename, iteration);
}
コード例 #4
0
bool MediaConverter::initialize(const LPRImage *pRawImage, const char *outputMediaName)
{
	return initializeInput(pRawImage) && initializeOutput(outputMediaName);
}
コード例 #5
0
ファイル: ljx_main.c プロジェクト: frankwillmore/ftw-codebase
int main(int argc, char *argv[])
{
  parseCommandLineOptions(argc, argv);
  initializeRandomNumberGeneratorTo(rng_seed);
  initializeOutput();
  setInitialConditions();
  if (graphicsModeEnabled()) initializeDisplay();
  
  perturbation_length=fixed_perturbation_length;

  for(monte_carlo_steps=start_mcs; monte_carlo_steps<=end_mcs; monte_carlo_steps++)
  {
    updatePairList();
    generateOutput();
    attempted_moves = 0;
    accepted_moves = 0;

    for (monte_carlo_step_counter=0; monte_carlo_step_counter<number_of_molecules; monte_carlo_step_counter++) 
    {
      double boltzmann_factor;
      double the_exponential;
  
      delta_energy = 0;
      attemptMove();
      attempted_moves++;

      if (delta_energy < 0) 
      {
        change_flag = 1;
        accepted_moves++;
        continue; /* move accepted */
      }

      // the following uses reduced temperature
      the_exponential = 0.0 - delta_energy/temperature;
     /* evaluate exponential, unless it's arbitrarily small */
      if (the_exponential > -25)
      {
        boltzmann_factor = exp(the_exponential);
        if (boltzmann_factor > rnd())
        {
          change_flag = 1;
          accepted_moves++;
          continue; /* move accepted */
        }
      }

      // revert move
      x[particle_number] -= dx;
      y[particle_number] -= dy;
      z[particle_number] -= dz;
    }

    if (monte_carlo_steps < relaxation_allowance) 
    {
      acceptance_ratio = (0.0 + accepted_moves)/(0.0 + attempted_moves);
      if (acceptance_ratio < target_acceptance_ratio) perturbation_length *= .9;
      else if (perturbation_length*perturbation_length*perturbation_length*16 < box_x*box_y*box_z) perturbation_length *=1.1;
    }
    else perturbation_length = fixed_perturbation_length;
    if (graphicsModeEnabled() && changeFlagIsSet()) drawGraphicalRepresentation();
  } 

  finalizeOutput();
  return 0;
} /* end main */
コード例 #6
0
ファイル: VTKWriter.cpp プロジェクト: p-hoffmann/madpac
void VTKWriter::writeOutput(ParticleContainer& container, const std::string& filename, int iteration) {
	initializeOutput(container.getNumParticles());
	container.traverseParticles(*this);
	writeFile(filename, iteration);
}