Пример #1
0
int RunStorage::get_run(int run_id, Parameters &pars, Observations &obs, string &info_txt, double &info_value, bool clear_old)
{
	vector<double> par_data;
	vector<double> obs_data;

	int status = get_run(run_id, par_data, obs_data, info_txt, info_value);
	if (clear_old)
	{
	  pars.update(par_names, par_data);
	  obs.update(obs_names, obs_data);
	}
	else
	{
	  pars.update_without_clear(par_names, par_data);
	  obs.update_without_clear(obs_names, obs_data);
	}
	return status;
}
Пример #2
0
int  RunStorage::get_observations(int run_id, Observations &obs)
{
	std::int8_t r_status;
	vector<char> info_txt_buf;
	info_txt_buf.resize(info_txt_length, '\0');
	double info_value;

	check_rec_id(run_id);

	size_t n_par = par_names.size();
	size_t n_obs = obs_names.size();
	vector<double> obs_data;
	obs_data.resize(n_obs);
	buf_stream.seekg(get_stream_pos(run_id), ios_base::beg);
	buf_stream.read(reinterpret_cast<char*>(&r_status), sizeof(r_status));
	buf_stream.read(reinterpret_cast<char*>(&info_txt_buf[0]), sizeof(char)*info_txt_length);
	buf_stream.read(reinterpret_cast<char*>(&info_value), sizeof(double));
	buf_stream.seekg(n_par*sizeof(double), ios_base::cur);
	buf_stream.read(reinterpret_cast<char*>(obs_data.data()), n_obs*sizeof(double));
	int status = r_status;
	obs.update(obs_names, obs_data);
	return status;
}