/* * Arithmetical operations for class Mtbl * */ /* * Copyright (c) 1999-2000 Jean-Alain Marck * Copyright (c) 1999-2001 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 mtbl_arithm_C[] = "$Header: /cvsroot/Lorene/C++/Source/Mtbl/mtbl_arithm.C,v 1.2 2014/10/13 08:53:08 j_novak Exp $" ; /* * $Id: mtbl_arithm.C,v 1.2 2014/10/13 08:53:08 j_novak Exp $ * $Log: mtbl_arithm.C,v $ * Revision 1.2 2014/10/13 08:53:08 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon * LORENE * * Revision 2.8 2000/09/27 14:21:12 eric * Multiplication par un double : on met le resultat a ETATZERO si * x == 0 * * Revision 2.7 2000/08/16 10:30:14 eric * Suppression du membre dzpuis. * * Revision 2.6 1999/10/26 08:08:25 eric * Ajout de protection dzpuis dans +=, -= * * Revision 2.5 1999/10/18 15:07:22 eric * La fonction membre annule() est rebaptisee annule_hard(). * * Revision 2.4 1999/10/15 13:58:04 eric * L'arithmetique liee aux Coord's se trouve desormais dans le fichier * arithm_coord.C. * * Revision 2.3 1999/10/01 10:09:01 eric * Changement prototypes. * Correction erreurs lorsque etat=ETATZERO * * Revision 2.2 1999/04/26 17:12:26 phil * ajout de Coord * Mtbl * * Revision 2.1 1999/02/22 15:50:22 hyc * *** empty log message *** * * Revision 2.0 1999/02/15 10:42:45 hyc * *** empty log message *** * * Revision 2.1 1999/02/15 09:59:50 hyc * *** empty log message *** * * Revision 2.0 1999/01/15 09:10:39 hyc * *** empty log message *** * * * $Header: /cvsroot/Lorene/C++/Source/Mtbl/mtbl_arithm.C,v 1.2 2014/10/13 08:53:08 j_novak Exp $ * */ // Headers Lorene #include "mtbl.h" #include "coord.h" //********************// // OPERATEURS UNAIRES // //********************// // + Mtbl // ------ namespace Lorene { Mtbl operator+(const Mtbl& t1) // + Mtbl { // Protection assert(t1.get_etat() != ETATNONDEF) ; return t1 ; } // - Mtbl // ------ Mtbl operator-(const Mtbl& t1) // - Mtbl { // Protection assert(t1.get_etat() != ETATNONDEF) ; // Cas particulier if (t1.get_etat() == ETATZERO) { return t1 ; } // Cas general assert(t1.get_etat() == ETATQCQ) ; // sinon... Mtbl r(t1) ; // Mtbl resultat for (int i=0 ; iset_etat_zero() ; *(r.t)[i] += x ; } } else{ assert(r.get_etat() == ETATQCQ) ; for (int i=0 ; iset_etat_zero() ; *(r.t)[i] -= x ; } } else{ assert(r.get_etat() == ETATQCQ) ; for (int i=0 ; i