/* * Methods of class Itbl * * (see file itbl.h for documentation) * */ /* * Copyright (c) 1999-2001 Philippe Grandclement * Copyright (c) 1999-2003 Eric Gourgoulhon * * This file is part of LORENE. * * LORENE is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LORENE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LORENE; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ char itbl_C[] = "$Header: /cvsroot/Lorene/C++/Source/Itbl/itbl.C,v 1.8 2014/10/13 08:53:01 j_novak Exp $" ; /* * $Id: itbl.C,v 1.8 2014/10/13 08:53:01 j_novak Exp $ * $Log: itbl.C,v $ * Revision 1.8 2014/10/13 08:53:01 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.7 2014/10/06 15:13:11 j_novak * Modified #include directives to use c++ syntax. * * Revision 1.6 2008/02/18 13:53:40 j_novak * Removal of special indentation instructions. * * Revision 1.5 2003/10/12 20:34:47 e_gourgoulhon * Suppressed the call to set_etat_zero() in the 1D constructor with * dimension 0, and replaced it by etat = ETATZERO. * * Revision 1.4 2003/10/11 16:44:17 e_gourgoulhon * * IMPORTANT CHANGE: the standard constructors set now the logical state * to ETATQCQ, and no longer to ETATNONDEF. * * Revision 1.3 2002/10/16 14:36:37 j_novak * Reorganization of #include instructions of standard C++, in order to * use experimental version 3 of gcc. * * Revision 1.2 2001/12/04 21:27:53 e_gourgoulhon * * All writing/reading to a binary file are now performed according to * the big endian convention, whatever the system is big endian or * small endian, thanks to the functions fwrite_be and fread_be * * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon * LORENE * * Revision 2.1 1999/11/23 13:17:09 eric * Le constructeur Itbl::Itbl(const Dim_tbl ) devient desormais * tbl::Itbl(const Dim_tbl& ). * La taille zero est autorisee par le constructeur 1D. * Modif affichage. * * Revision 2.0 1999/11/17 16:04:38 phil * *** empty log message *** * * * $Header: /cvsroot/Lorene/C++/Source/Itbl/itbl.C,v 1.8 2014/10/13 08:53:01 j_novak Exp $ * */ // headers C #include // headers Lorene #include "itbl.h" #include "utilitaires.h" //---------------// // Constructeurs // //---------------// // Constructeur 1D namespace Lorene { Itbl::Itbl(int n1) : etat(ETATQCQ), dim(n1) { if (n1 == 0) { t = 0x0 ; etat = ETATZERO ; } else { assert(n1 > 0) ; t = new int[n1] ; } } // Constructeur 2D Itbl::Itbl(int n1, int n0) : etat(ETATQCQ), dim(n1, n0) { t = new int[get_taille()] ; } // Constructeur 3D Itbl::Itbl(int n2, int n1, int n0) : etat(ETATQCQ), dim(n2, n1, n0) { t = new int[get_taille()] ; } // Constructeur a partir d'un Dim_tbl Itbl::Itbl(const Dim_tbl& dt) : etat(ETATQCQ), dim(dt) { if (get_taille() == 0) { set_etat_zero() ; } else { t = new int[get_taille()] ; } } // Copie Itbl::Itbl(const Itbl& tc) : etat(tc.etat), dim(tc.dim) { // La valeur eventuelle if (tc.etat == ETATQCQ) { t = new int[get_taille()] ; for (int i=0 ; i 0) { set_etat_qcq() ; for (int i=0 ; i