coord_arithm.C

00001 /*
00002  *  Arithmetical operations for class Coord
00003  *
00004  */
00005 
00006 /*
00007  *   Copyright (c) 1999-2000 Jean-Alain Marck
00008  *   Copyright (c) 1999-2001 Eric Gourgoulhon
00009  *
00010  *   This file is part of LORENE.
00011  *
00012  *   LORENE is free software; you can redistribute it and/or modify
00013  *   it under the terms of the GNU General Public License as published by
00014  *   the Free Software Foundation; either version 2 of the License, or
00015  *   (at your option) any later version.
00016  *
00017  *   LORENE is distributed in the hope that it will be useful,
00018  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *   GNU General Public License for more details.
00021  *
00022  *   You should have received a copy of the GNU General Public License
00023  *   along with LORENE; if not, write to the Free Software
00024  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  *
00026  */
00027 
00028 
00029 char coord_arithm_C[] = "$Header: /cvsroot/Lorene/C++/Source/Coord/coord_arithm.C,v 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon Exp $" ;
00030 
00031 /*
00032  * $Id: coord_arithm.C,v 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon Exp $
00033  * $Log: coord_arithm.C,v $
00034  * Revision 1.1.1.1  2001/11/20 15:19:28  e_gourgoulhon
00035  * LORENE
00036  *
00037  * Revision 1.2  2000/02/25  10:24:40  eric
00038  * Remplacement de la variable globale nom_C (!) par arithm_coord_C
00039  *
00040  * Revision 1.1  1999/10/15  13:57:58  eric
00041  * Initial revision
00042  *
00043  *
00044  * $Header: /cvsroot/Lorene/C++/Source/Coord/coord_arithm.C,v 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon Exp $
00045  *
00046  */
00047 
00048 // Headers Lorene
00049 #include "coord.h"
00050 #include "mtbl.h"
00051 
00052 /************************************************************************/
00053 /*          operations sur Coord -> Mtbl            */
00054 /************************************************************************/
00055 
00056             //********************//
00057             // OPERATEURS UNAIRES //
00058             //********************//
00059             
00060 Mtbl operator+(const Coord& co) {
00061     
00062     if (co.c == 0x0) co.fait() ; 
00063     return *(co.c) ;
00064     
00065 }           
00066 
00067 Mtbl operator-(const Coord& co) {
00068     
00069     if (co.c == 0x0) co.fait() ; 
00070     return -(*(co.c)) ;
00071     
00072 }           
00073 
00074             //**********//
00075             // ADDITION //
00076             //**********//
00077 
00078 Mtbl operator+(const Coord& c1, const Coord& c2) {
00079 
00080     // Sont-elles a jour ?
00081     if (c1.c == 0x0) c1.fait() ;
00082     if (c2.c == 0x0) c2.fait() ;
00083     
00084     // Termine
00085     return (*(c1.c)) + (*(c2.c)) ;
00086 }
00087 
00088 Mtbl operator+(const Coord& co, const Mtbl& mt) {
00089 
00090     if (co.c == 0x0) co.fait() ;
00091     
00092     return (*(co.c)) + mt ;
00093 }
00094 
00095 Mtbl operator+(const Mtbl& mt, const Coord& co) {
00096 
00097     if (co.c == 0x0) co.fait() ;
00098     
00099     return mt + (*(co.c)) ;
00100 }
00101 
00102             //**************//
00103             // SOUSTRACTION //
00104             //**************//
00105 
00106 Mtbl operator-(const Coord& c1, const Coord& c2) {
00107 
00108     // Sont-elles a jour ?
00109     if (c1.c == 0x0) c1.fait() ;
00110     if (c2.c == 0x0) c2.fait() ;
00111     
00112     // Termine
00113     return (*(c1.c)) - (*(c2.c)) ;
00114 }
00115 
00116 Mtbl operator-(const Coord& co, const Mtbl& mt) {
00117 
00118     if (co.c == 0x0) co.fait() ;
00119     
00120     return (*(co.c)) - mt ;
00121 }
00122 
00123 Mtbl operator-(const Mtbl& mt, const Coord& co) {
00124 
00125     if (co.c == 0x0) co.fait() ;
00126     
00127     return mt - (*(co.c)) ;
00128 }
00129 
00130             //****************//
00131             // MULTIPLICATION //
00132             //****************//
00133 
00134 Mtbl operator*(const Coord& c1, const Coord& c2) {
00135 
00136     // Sont-elles a jour ?
00137     if (c1.c == 0x0) c1.fait() ;
00138     if (c2.c == 0x0) c2.fait() ;
00139     
00140     // Termine
00141     return (*(c1.c)) * (*(c2.c)) ;
00142 }
00143 
00144 Mtbl operator*(const Mtbl& m1, const Coord& c2) {
00145 
00146     // A jour ?
00147     if (c2.c == 0x0) c2.fait() ;
00148     
00149     // Termine
00150     return (m1) * (*(c2.c)) ;
00151 }
00152 
00153 Mtbl operator*(const Coord& c2, const Mtbl& m1) {
00154 
00155     // A jour ?
00156     if (c2.c == 0x0) c2.fait() ;
00157     
00158     // Termine
00159     return (m1) * (*(c2.c)) ;
00160 }
00161 
00162 

Generated on Tue Feb 7 01:35:15 2012 for LORENE by  doxygen 1.4.6