Example #1
0
template<> Recorder<SAVE>::~Recorder () {
	size_t n_samples = _states.size();
	if (n_samples == 0)
		return;
	HDF5File f ("simout.h5", OUT);
	NDData<double> times (n_samples);
	NDData<double> data (n_samples,3);
	for (size_t i = 0; i < n_samples; ++i) {
		times [i] = _times[i];
		data (i,0) = _states[i][0];
		data (i,1) = _states[i][1];
		data (i,2) = _states[i][2];
	}
	f.Write (times, "times");
	f.Write (data, "data");
	fclose (f);
}
Example #2
0
File: exec.cpp Project: jparal/sat
void CAMCode<B,T,D>::Exec ()
{
  _timer.Start ();

  MomInit ();
  CalcE (_B, _Ua, _dn);

  Timer thyb;
  do
  {
    if (_time.Restart ())
    {
      _time.Print ();
      CheckPointLoad ();
      _time.SetRestart (false);
    }
    else
    {
      _sensmng.SaveAll (_time);
      _sensmng.SetNextOutput (_time);
    }
    CheckPointSave ();

    DBG_INFO ("iteration time : "<<thyb);
    _timer.Update ();
    DBG_INFO ("wallclock time : "<<_timer);

    thyb.Reset ();
    thyb.Start ();
    int nit = _time.HybIters () -_time.Iter ();

    Hyb ();

    thyb.Stop ();
    thyb /= nit;

    if (Mpi::Rank () == 0)
    {
      _itertime.Push (thyb.GetWallclockTime ());

      String fname = _sensmng.GetIOManager().GetFileName ("Stat");
      HDF5File file (fname, IOFile::suff);
      file.Write (_itertime, "Iter");
    }
  }
  while (_time.Iter () < _time.ItersMax ());

  _sensmng.SaveAll (_time);
  _sensmng.SetNextOutput (_time);
}
Example #3
0
template <class T> inline static bool write (const Matrix<T> A) {
	HDF5File nf (fname, WRITE);
	nf.Write (A, mname);
    return true;
}