28 char time_slice_C[] =
"$Header: /cvsroot/Lorene/C++/Source/Time_slice/time_slice.C,v 1.16 2014/10/13 08:53:47 j_novak Exp $" ;
99 #include "time_slice.h" 100 #include "utilitaires.h" 116 scheme_order(depth_in-1),
118 the_time(0., depth_in),
119 gam_dd_evol(depth_in),
120 gam_uu_evol(depth_in),
123 n_evol(lapse_in, depth_in),
124 beta_evol(shift_in, depth_in),
157 :
depth(gamma_in.get_size()),
165 n_evol(lapse_in, gamma_in.get_size() ),
166 beta_evol(shift_in, gamma_in.get_size() ),
171 "Time_slice constuctor from evolution of gamma not implemented yet !\n" ;
198 bool spher = (ptriad_s != 0x0) ;
204 assert( dynamic_cast<const Base_vect_cart*>(&triad) != 0x0) ;
221 Vector btmp(mp, CON, triad) ;
236 bool partial_read,
int depth_in)
252 fread_be(&depth_file,
sizeof(
int), 1, fich) ;
253 if (depth_file != depth_in) {
255 "Time_slice constructor from file: the depth read in file \n" 256 <<
" is different from that given in the argument list : \n" 257 <<
" depth_file = " << depth_file
258 <<
" <-> depth_in " << depth_in <<
" !" << endl ;
268 for (
int j=jmin; j<=
jtime; j++) {
269 fread_be(&indicator,
sizeof(
int), 1, fich) ;
270 if (indicator == 1) {
272 fread_be(&xx,
sizeof(
double), 1, fich) ;
281 for (
int j=jmin; j<=
jtime; j++) {
282 fread_be(&indicator,
sizeof(
int), 1, fich) ;
283 if (indicator == 1) {
290 for (
int j=jmin; j<=
jtime; j++) {
291 fread_be(&indicator,
sizeof(
int), 1, fich) ;
292 if (indicator == 1) {
293 Vector beta_file(mp, triad, fich) ;
302 "Time_slice constructor from file: the case of full reading\n" 303 <<
" is not ready yet !" << endl ;
413 flux <<
"\n------------------------------------------------------------\n" 414 <<
"Lorene class : " <<
typeid(*this).name() <<
'\n' ;
415 flux <<
"Number of stored slices : " <<
depth 418 <<
" index of time step j = " <<
jtime <<
'\n' <<
'\n' ;
420 flux <<
"ADM mass : " <<
adm_mass() << endl ;
423 flux <<
"Max. of absolute values of the various fields in each domain: \n" ;
436 if (
n_evol.is_known(jtime)) {
446 if (
p_gamma != 0x0) flux <<
"Metric gamma is up to date" << endl ;
465 char* filename =
new char[ strlen(rootname)+10 ] ;
466 strcpy(filename, rootname) ;
468 sprintf(nomj,
"%06d",
jtime) ;
469 strcat(filename, nomj) ;
470 strcat(filename,
".d") ;
472 FILE* fich = fopen(filename,
"w") ;
474 cout <<
"Problem in opening file " << filename <<
" ! " << endl ;
493 bool partial_save = false ;
494 sauve(fich, partial_save) ;
519 for (
int j=jmin; j<=
jtime; j++) {
521 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
522 if (indicator == 1) {
524 fwrite_be(&xx,
sizeof(
double), 1, fich) ;
533 for (
int j=jmin; j<=
jtime; j++) {
534 int indicator = (
n_evol.is_known(j)) ? 1 : 0 ;
535 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
536 if (indicator == 1)
n_evol[j].sauve(fich) ;
541 for (
int j=jmin; j<=
jtime; j++) {
542 int indicator = (
beta_evol.is_known(j)) ? 1 : 0 ;
543 fwrite_be(&indicator,
sizeof(
int), 1, fich) ;
544 if (indicator == 1)
beta_evol[j].sauve(fich) ;
551 cout <<
"Time_slice::sauve: the full writing is not ready yet !" void operator=(const Time_slice &)
Assignment to another Time_slice.
virtual const Vector & beta() const
shift vector at the current time step (jtime )
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.
Metric for tensor calculation.
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).
virtual void sauve(FILE *) const
Save in a file.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Evolution_full< Tbl > adm_mass_evol
ADM mass at each time step, since the creation of the slice.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
void save(const char *rootname) const
Saves in a binary file.
int scheme_order
Order of the finite-differences scheme for the computation of time derivatives.
Tensor field of valence 0 (or component of a tensorial field).
virtual void sauve(FILE *) const
Save in a file.
Base class for coordinate mappings.
virtual void update(const TyT &new_value, int j, double time_j)
Sets a new value at a given time step.
int jtime
Time step index of the latest slice.
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field. ...
Evolution_std< Sym_tensor > gam_dd_evol
Values at successive time steps of the covariant components of the induced metric ...
Tensor field of valence 1.
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
Vectorial bases (triads) with respect to which the tensorial components are defined.
const Metric_flat & flat_met_cart() const
Returns the flat metric associated with the Cartesian coordinates and with components expressed in th...
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.
Spacelike time slice of a 3+1 spacetime.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
Evolution_std< Sym_tensor > gam_uu_evol
Values at successive time steps of the contravariant components of the induced metric ...
bool is_known(int j) const
Checks whether the value a given time step has been set.
void set_etat_one()
Sets the logical state to ETATUN (one).
Evolution_std< Sym_tensor > k_dd_evol
Values at successive time steps of the covariant components of the extrinsic curvature tensor ...
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.
Metric * p_gamma
Pointer on the induced metric at the current time step (jtime)
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator<<).
Time evolution with partial storage (*** under development ***).
virtual double adm_mass() const
Returns the ADM mass (geometrical units) at the current step.
Evolution_std< double > the_time
Time label of each slice.
Spherical orthonormal vectorial bases (triads).
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
Evolution_std< Scalar > trk_evol
Values at successive time steps of the trace K of the extrinsic curvature.
Evolution_std< Scalar > n_evol
Values at successive time steps of the lapse function N.
virtual void set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
virtual void del_deriv() const
Deletes all the derived quantities.
Evolution_std< Vector > beta_evol
Values at successive time steps of the shift vector .
const Map & get_mp() const
Returns the mapping.
int depth
Number of stored time slices.
virtual ~Time_slice()
Destructor.
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
Class intended to describe valence-2 symmetric tensors.
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
virtual void sauve(FILE *fich, bool partial_save) const
Total or partial saves in a binary file.
virtual const Scalar & nn() const
Lapse function N at the current time step (jtime )