Exemple #1
0
void Statistics::calculateStatistics(ParticleContainer& container, int iteration) {

	int frequency = 2000;

//	if ((iteration + 50) % frequency == 0) {
//		_saveX = true;
//		container.traverseParticles(*this);
//		LOG4CXX_DEBUG(logger, "Saved oldX at iteration "<< iteration);
//	}

	if ((iteration + 25) % frequency == 0) {
//	  _saveX = false;
//	  _diffusionFactor = 0;
//	  container.traverseParticles(*this);
//	  LOG4CXX_DEBUG(logger, "calculated diffusion of " << _diffusionFactor << " at iteration " << iteration);
	  _saveX = true;
	  // reset x
	  container.traverseParticles(*this);
	  LOG4CXX_DEBUG(logger, "Saved oldX at iteration "<< iteration);
	}

	//if ((iteration + 1) % frequency == 0) {
//		// reset counter and count particle pair distances
//		for (int i = 0; i < _numIntervalls; i++) {
//			_distanceCount[i] = 0;
//		}
		//container.traversePairs(*this);
	//}

	if (iteration == 1 || iteration % frequency == 0) {
    _saveX = false;
    container.traverseParticles(*this);
		_diffusionFactor = _diffusionFactor / container.getNumParticles();

		// reset counter and count particle pair distances
		for (int i = 0; i < _numIntervalls; i++) {
		  _distanceCount[i] = 0;
		}
		// count particlePairDistances
		container.traversePairs(*this);
		writeFile(iteration);
	}
}
Exemple #2
0
void VTKWriter::writeOutput(ParticleContainer& container, const std::string& filename, int iteration) {
	initializeOutput(container.getNumParticles());
	container.traverseParticles(*this);
	writeFile(filename, iteration);
}