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()),
158 scheme_order(gamma_in.get_size()-1),
160 the_time(0., gamma_in.get_size()),
161 gam_dd_evol( gamma_in.get_size() ),
162 gam_uu_evol( gamma_in.get_size() ),
163 k_dd_evol( gamma_in.get_size() ),
164 k_uu_evol( gamma_in.get_size() ),
165 n_evol(lapse_in, gamma_in.get_size() ),
166 beta_evol(shift_in, gamma_in.get_size() ),
167 trk_evol(gamma_in.get_size() ),
171 "Time_slice constuctor from evolution of gamma not implemented yet !\n" ;
182 scheme_order(depth_in-1),
184 the_time(0., depth_in),
185 gam_dd_evol(depth_in),
186 gam_uu_evol(depth_in),
198 bool spher = (ptriad_s != 0x0) ;
221 Vector btmp(mp, CON, triad) ;
236 bool partial_read,
int depth_in)
239 gam_dd_evol(depth_in),
240 gam_uu_evol(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 ;
316 scheme_order(tin.scheme_order),
318 the_time(tin.the_time),
319 gam_dd_evol(tin.gam_dd_evol),
320 gam_uu_evol(tin.gam_uu_evol),
321 k_dd_evol(tin.k_dd_evol),
322 k_uu_evol(tin.k_uu_evol),
324 beta_evol(tin.beta_evol),
325 trk_evol(tin.trk_evol),
326 adm_mass_evol(tin.adm_mass_evol) {
335 scheme_order(depth_in-1),
337 the_time(0., depth_in),
338 gam_dd_evol(depth_in),
339 gam_uu_evol(depth_in),
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" ;
446 if (
p_gamma != 0x0) flux <<
"Metric gamma is up to date" << endl ;
453 ostream& operator<<(ostream& flux,
const Time_slice& sigma) {
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 !"
virtual void update(const TyT &new_value, int j, double time_j)
Sets a new value at a given time step.
virtual const Sym_tensor & cov() const
Read-only access to the covariant representation.
bool is_known(int j) const
Checks whether the value a given time step has been set.
Time evolution with partial storage (*** under development ***).
int depth
Number of stored time slices.
Class intended to describe valence-2 symmetric tensors.
virtual double adm_mass() const
Returns the ADM mass (geometrical units) at the current step.
Metric for tensor calculation.
void set_etat_one()
Sets the logical state to ETATUN (one).
virtual ~Time_slice()
Destructor.
Evolution_std< Vector > beta_evol
Values at successive time steps of the shift vector .
virtual const Scalar & nn() const
Lapse function N at the current time step (jtime )
int scheme_order
Order of the finite-differences scheme for the computation of time derivatives.
Cartesian vectorial bases (triads).
virtual void sauve(FILE *) const
Save in a file.
Evolution_std< Scalar > n_evol
Values at successive time steps of the lapse function N.
Evolution_full< Tbl > adm_mass_evol
ADM mass at each time step, since the creation of the slice.
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 set_etat_zero()
Sets the logical state of all components to ETATZERO (zero state).
void set_der_0x0() const
Sets to 0x0 all the pointers on derived quantities.
const Mg3d * get_mg() const
Gives the Mg3d on which the mapping is defined.
const Metric_flat & flat_met_spher() const
Returns the flat metric associated with the spherical coordinates and with components expressed in th...
Tensor field of valence 0 (or component of a tensorial field).
const Map & get_mp() const
Returns the mapping.
void save(const char *rootname) const
Saves in a binary file.
Evolution_std< Sym_tensor > gam_dd_evol
Values at successive time steps of the covariant components of the induced metric .
Evolution_std< Sym_tensor > k_dd_evol
Values at successive time steps of the covariant components of the extrinsic curvature tensor .
virtual void del_deriv() const
Deletes all the derived quantities.
Spherical orthonormal vectorial bases (triads).
virtual void sauve(FILE *) const
Save in a file.
void sauve(FILE *fd, bool save_base=false) const
Saves into a file.
const Metric_flat & flat_met_cart() const
Returns the flat metric associated with the Cartesian coordinates and with components expressed in th...
int get_index_type(int i) const
Gives the type (covariant or contravariant) of the index number i .
virtual ostream & operator>>(ostream &) const
Operator >> (virtual function called by the operator<<).
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Evolution_std< double > the_time
Time label of each slice.
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.
virtual void set_etat_zero()
Sets the logical state to ETATZERO (zero).
Tensor field of valence 1.
Spacelike time slice of a 3+1 spacetime.
Tensor trace(int ind1, int ind2) const
Trace on two different type indices.
const Base_vect * get_triad() const
Returns the vectorial basis (triad) on which the components are defined.
Evolution_std< Scalar > trk_evol
Values at successive time steps of the trace K of the extrinsic curvature.
Evolution_std< Sym_tensor > gam_uu_evol
Values at successive time steps of the contravariant components of the induced metric .
virtual void std_spectral_base()
Sets the spectral bases of the Valeur va to the standard ones for a scalar field.
int jtime
Time step index of the latest slice.
void operator=(const Time_slice &)
Assignment to another Time_slice.
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.
virtual const Vector & beta() const
shift vector at the current time step (jtime )
Metric * p_gamma
Pointer on the induced metric at the current time step (jtime)
Base class for coordinate mappings.
Vectorial bases (triads) with respect to which the tensorial components are defined.
virtual void sauve(FILE *fich, bool partial_save) const
Total or partial saves in a binary file.
Evolution_std< Sym_tensor > k_uu_evol
Values at successive time steps of the contravariant components of the extrinsic curvature tensor .