inline Real data_gathering(Box* box, long int total_step, int saving_period, ofstream& out_file)
{
	clock_t start_time, end_time;
	start_time = clock();

	#ifdef TRACK_PARTICLE
	if (!flag)
		flag = true;
	#endif

	if (box->thisnode->node_id == 0)
		cout << "gathering data:" << endl;
	int saving_time = 0;

	for (long int i = 0; i < total_step; i+=cell_update_period)
	{
		box->Multi_Step(cell_update_period);
		timing_information(box->thisnode,start_time,i,total_step);
		if ((i / cell_update_period) % saving_period == 0)
			out_file << box;
	}

	if (box->thisnode->node_id == 0)
		cout << "Finished" << endl;

	end_time = clock();

	Real t = (Real) (end_time - start_time) / CLOCKS_PER_SEC;
	return(t);
}
Exemple #2
0
inline Real data_gathering(Box* box, long int total_step, int trajectory_saving_period, int quantities_saving_period, ofstream& out_file, ofstream& variables_file)
{
	clock_t start_time, end_time;
	start_time = clock();
	Real box_initial_time = box->t;

	#ifdef TRACK_PARTICLE
	if (!flag)
		flag = true;
	#endif

	cout << "gathering data:" << endl;
	int saving_time = 0;

	if (box->t < dt)
	{
		box->Save_Particles_Positions();
		out_file << box;
		timing_information(box, start_time, box_initial_time);
	}

	int i = 0;
	while (box->t < sim_time)
	{
		box->Multi_Step(cell_update_period);
		i += cell_update_period;
		if ((i / cell_update_period) % trajectory_saving_period == 0)
		{
			out_file << box;
			timing_information(box, start_time, box_initial_time);
		}
		if ((i / cell_update_period) % quantities_saving_period == 0)
			box->Save_All_Variables(variables_file);
	}
	if ((total_step / cell_update_period) % trajectory_saving_period == 0)
		out_file << box;

	cout << "Finished" << endl;

	end_time = clock();

	Real t = (Real) (end_time - start_time) / CLOCKS_PER_SEC;
	return(t);
}
inline Real equilibrium(Box* box, long int equilibrium_step, int saving_period)
{
	clock_t start_time, end_time;
	start_time = clock();

	if (box->thisnode->node_id == 0)
		cout << "equilibrium:" << endl;

	for (long int i = 0; i < equilibrium_step; i+=cell_update_period)
	{
		box->Multi_Step(cell_update_period);
		timing_information(box->thisnode,start_time,i,equilibrium_step);
	}

	if (box->thisnode->node_id == 0)
		cout << "Finished" << endl;

	end_time = clock();

	Real t = (Real) (end_time - start_time) / CLOCKS_PER_SEC;
	return(t);
}