102#include "time_slice.h"
103#include "utilitaires.h"
126 n_evol(lapse_in, depth_in),
160 :
depth(gamma_in.get_size()),
168 n_evol(lapse_in, gamma_in.get_size() ),
169 beta_evol(shift_in, gamma_in.get_size() ),
174 "Time_slice constuctor from evolution of gamma not implemented yet !\n" ;
201 bool spher = (ptriad_s != 0x0) ;
224 Vector btmp(mp, CON, triad) ;
239 bool partial_read,
int depth_in)
255 fread_be(&depth_file,
sizeof(
int), 1, fich) ;
256 if (depth_file != depth_in) {
258 "Time_slice constructor from file: the depth read in file \n"
259 <<
" is different from that given in the argument list : \n"
260 <<
" depth_file = " << depth_file
261 <<
" <-> depth_in " << depth_in <<
" !" << endl ;
271 for (
int j=jmin; j<=
jtime; j++) {
272 fread_be(&indicator,
sizeof(
int), 1, fich) ;
273 if (indicator == 1) {
275 fread_be(&xx,
sizeof(
double), 1, fich) ;
284 for (
int j=jmin; j<=
jtime; j++) {
285 fread_be(&indicator,
sizeof(
int), 1, fich) ;
286 if (indicator == 1) {
287 Scalar nn_file(mp, *(mp.get_mg()), fich) ;
293 for (
int j=jmin; j<=
jtime; j++) {
294 fread_be(&indicator,
sizeof(
int), 1, fich) ;
295 if (indicator == 1) {
296 Vector beta_file(mp, triad, fich) ;
305 "Time_slice constructor from file: the case of full reading\n"
306 <<
" is not ready yet !" << endl ;
416 flux <<
"\n------------------------------------------------------------\n"
417 <<
"Lorene class : " <<
typeid(*this).name() <<
'\n' ;
418 flux <<
"Number of stored slices : " <<
depth
421 <<
" index of time step j = " <<
jtime <<
'\n' <<
'\n' ;
423 flux <<
"ADM mass : " <<
adm_mass() << endl ;
426 flux <<
"Max. of absolute values of the various fields in each domain: \n" ;
449 if (
p_gamma != 0x0) flux <<
"Metric gamma is up to date" << endl ;
468 char* filename =
new char[ strlen(rootname)+10 ] ;
469 strcpy(filename, rootname) ;
471 sprintf(nomj,
"%06d",
jtime) ;
472 strcat(filename, nomj) ;
473 strcat(filename,
".d") ;
475 FILE* fich = fopen(filename,
"w") ;
477 cout <<
"Problem in opening file " << filename <<
" ! " << endl ;
485 const Mg3d& mgrid = *(map.get_mg()) ;
496 bool partial_save = false ;
497 sauve(fich, partial_save) ;
522 for (
int j=jmin; j<=
jtime; j++) {
523 int indicator = (
the_time.is_known(j)) ? 1 : 0 ;
524 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
525 if (indicator == 1) {
527 fwrite_be(&xx,
sizeof(
double), 1, fich) ;
536 for (
int j=jmin; j<=
jtime; j++) {
537 int indicator = (
n_evol.is_known(j)) ? 1 : 0 ;
538 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
539 if (indicator == 1)
n_evol[j].sauve(fich) ;
544 for (
int j=jmin; j<=
jtime; j++) {
545 int indicator = (
beta_evol.is_known(j)) ? 1 : 0 ;
546 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
547 if (indicator == 1)
beta_evol[j].sauve(fich) ;
554 cout <<
"Time_slice::sauve: the full writing is not ready yet !"
Cartesian vectorial bases (triads).
Spherical orthonormal vectorial bases (triads).
Vectorial bases (triads) with respect to which the tensorial components are defined.
virtual void sauve(FILE *) const
Save in a file.
Time evolution with partial storage (*** under development ***).
Metric for tensor calculation.
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
Tensor field of valence 0 (or component of a tensorial field).
void set_etat_one()
Sets the logical state to ETATUN (one).
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Class intended to describe valence-2 symmetric tensors.
int jtime
Time step index of the latest slice.
Evolution_std< Scalar > trk_evol
Values at successive time steps of the trace K of the extrinsic curvature.
Metric * p_gamma
Pointer on the induced metric at the current time step (jtime).
Evolution_std< Sym_tensor > k_dd_evol
Values at successive time steps of the covariant components of the extrinsic curvature tensor .
virtual void sauve(FILE *fich, bool partial_save) const
Total or partial saves in a binary file.
void operator=(const Time_slice &)
Assignment to another Time_slice.
Evolution_full< Tbl > adm_mass_evol
ADM mass at each time step, since the creation of the slice.
virtual const Scalar & nn() const
Lapse function N at the current time step (jtime ).
void save(const char *rootname) const
Saves in a binary file.
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Evolution_std< Sym_tensor > gam_dd_evol
Values at successive time steps of the covariant components of the induced metric .
Evolution_std< Sym_tensor > gam_uu_evol
Values at successive time steps of the contravariant components of the induced metric .
int scheme_order
Order of the finite-differences scheme for the computation of time derivatives.
virtual const Vector & beta() const
shift vector at the current time step (jtime )
virtual ~Time_slice()
Destructor.
virtual void del_deriv() const
Deletes all the derived quantities.
int depth
Number of stored time slices.
Evolution_std< Scalar > n_evol
Values at successive time steps of the lapse function N.
virtual double adm_mass() const
Returns the ADM mass (geometrical units) at the current step.
Time_slice(const Scalar &lapse_in, const Vector &shift_in, const Sym_tensor &gamma_in, const Sym_tensor &kk_in, int depth_in=3)
General constructor (Hamiltonian-like).
Evolution_std< double > the_time
Time label of each slice.
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator<<).
Evolution_std< Sym_tensor > k_uu_evol
Values at successive time steps of the contravariant components of the extrinsic curvature tensor .
friend ostream & operator<<(ostream &, const Time_slice &)
Display.
Evolution_std< Vector > beta_evol
Values at successive time steps of the shift vector .
Tensor field of valence 1.
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
const Map & get_mp() const
Returns the mapping.
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
Tbl maxabs(const Tensor &aa, const char *comment=0x0, ostream &ost=cout, bool verb=true)
Maxima in each domain of the absolute values of the tensor components.
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.