#include "mat.h"

int main()
{
   char matname[80]; cin >> matname;
   cout << "material " << matname << endl;
   mat_type *a_mat;
   cin >> a_mat;
   cout << "mat*:\n" << a_mat << endl << "mat:\n" << *a_mat << endl;
   mat_type::state *st = a_mat->new_state(); cin >> *st;
   cout << "state = " << *st << endl;
   cout << "p = " << a_mat->p(st) << '\n';
   cout << "c^2 = " << a_mat->csqv(st) << '\n';
   cout << "T = " << a_mat->t(st) << '\n';
   cout << "cv = " << a_mat->cv(st) << '\n';
   cout << "e = " << a_mat->e(st) << '\n';

   double dq; cin >> dq; cout << "heat: " << dq << endl;
   int nsteps; cin >> nsteps; cout << nsteps << " steps\n";

   double dq1 = dq / nsteps;
   cout << endl << "step	state	p	c^2	T	cv	e\n";
   for (int i=0;i<nsteps;i++) {
      a_mat->add_thermal_energy(st,dq1);
      cout << i+1 << '\t' << *st << '\t' << a_mat->p(st) << '\t'
           << a_mat->csqv(st) << '\t' << a_mat->t(st) << '\t'
           << a_mat->cv(st) << '\t' << a_mat->e(st) << endl;
   }
}
