102 #include "time_slice.h" 103 #include "utilitaires.h" 119 scheme_order(depth_in-1),
121 the_time(0., depth_in),
122 gam_dd_evol(depth_in),
123 gam_uu_evol(depth_in),
126 n_evol(lapse_in, depth_in),
127 beta_evol(shift_in, depth_in),
160 : depth(gamma_in.get_size()),
161 scheme_order(gamma_in.get_size()-1),
163 the_time(0., gamma_in.get_size()),
164 gam_dd_evol( gamma_in.get_size() ),
165 gam_uu_evol( gamma_in.get_size() ),
166 k_dd_evol( gamma_in.get_size() ),
167 k_uu_evol( gamma_in.get_size() ),
168 n_evol(lapse_in, gamma_in.get_size() ),
169 beta_evol(shift_in, gamma_in.get_size() ),
170 trk_evol(gamma_in.get_size() ),
174 "Time_slice constuctor from evolution of gamma not implemented yet !\n" ;
185 scheme_order(depth_in-1),
187 the_time(0., depth_in),
188 gam_dd_evol(depth_in),
189 gam_uu_evol(depth_in),
201 bool spher = (ptriad_s != 0x0) ;
207 assert( dynamic_cast<const Base_vect_cart*>(&triad) != 0x0) ;
224 Vector btmp(mp, CON, triad) ;
239 bool partial_read,
int depth_in)
242 gam_dd_evol(depth_in),
243 gam_uu_evol(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) {
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 ;
319 scheme_order(tin.scheme_order),
321 the_time(tin.the_time),
322 gam_dd_evol(tin.gam_dd_evol),
323 gam_uu_evol(tin.gam_uu_evol),
324 k_dd_evol(tin.k_dd_evol),
325 k_uu_evol(tin.k_uu_evol),
327 beta_evol(tin.beta_evol),
328 trk_evol(tin.trk_evol),
329 adm_mass_evol(tin.adm_mass_evol) {
338 scheme_order(depth_in-1),
340 the_time(0., depth_in),
341 gam_dd_evol(depth_in),
342 gam_uu_evol(depth_in),
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 ;
456 ostream& operator<<(ostream& flux,
const Time_slice& sigma) {
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 ;
496 bool partial_save = false ;
497 sauve(fich, partial_save) ;
522 for (
int j=jmin; j<=
jtime; j++) {
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 !" 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 ...
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 )