LORENE
coord_arithm.C
1 /*
2  * Arithmetical operations for class Coord
3  *
4  */
5 
6 /*
7  * Copyright (c) 1999-2000 Jean-Alain Marck
8  * Copyright (c) 1999-2001 Eric Gourgoulhon
9  *
10  * This file is part of LORENE.
11  *
12  * LORENE is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * LORENE is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with LORENE; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  */
27 
28 
29 
30 
31 /*
32  * $Id: coord_arithm.C,v 1.3 2016/12/05 16:17:50 j_novak Exp $
33  * $Log: coord_arithm.C,v $
34  * Revision 1.3 2016/12/05 16:17:50 j_novak
35  * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
36  *
37  * Revision 1.2 2014/10/13 08:52:50 j_novak
38  * Lorene classes and functions now belong to the namespace Lorene.
39  *
40  * Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon
41  * LORENE
42  *
43  * Revision 1.2 2000/02/25 10:24:40 eric
44  * Remplacement de la variable globale nom_C (!) par arithm_coord_C
45  *
46  * Revision 1.1 1999/10/15 13:57:58 eric
47  * Initial revision
48  *
49  *
50  * $Header: /cvsroot/Lorene/C++/Source/Coord/coord_arithm.C,v 1.3 2016/12/05 16:17:50 j_novak Exp $
51  *
52  */
53 
54 // Headers Lorene
55 #include "coord.h"
56 #include "mtbl.h"
57 
58 namespace Lorene {
59 
60 /************************************************************************/
61 /* operations sur Coord -> Mtbl */
62 /************************************************************************/
63 
64  //********************//
65  // OPERATEURS UNAIRES //
66  //********************//
67 
68 Mtbl operator+(const Coord& co) {
69 
70  if (co.c == 0x0) co.fait() ;
71  return *(co.c) ;
72 
73 }
74 
75 Mtbl operator-(const Coord& co) {
76 
77  if (co.c == 0x0) co.fait() ;
78  return -(*(co.c)) ;
79 
80 }
81 
82  //**********//
83  // ADDITION //
84  //**********//
85 
86 Mtbl operator+(const Coord& c1, const Coord& c2) {
87 
88  // Sont-elles a jour ?
89  if (c1.c == 0x0) c1.fait() ;
90  if (c2.c == 0x0) c2.fait() ;
91 
92  // Termine
93  return (*(c1.c)) + (*(c2.c)) ;
94 }
95 
96 Mtbl operator+(const Coord& co, const Mtbl& mt) {
97 
98  if (co.c == 0x0) co.fait() ;
99 
100  return (*(co.c)) + mt ;
101 }
102 
103 Mtbl operator+(const Mtbl& mt, const Coord& co) {
104 
105  if (co.c == 0x0) co.fait() ;
106 
107  return mt + (*(co.c)) ;
108 }
109 
110  //**************//
111  // SOUSTRACTION //
112  //**************//
113 
114 Mtbl operator-(const Coord& c1, const Coord& c2) {
115 
116  // Sont-elles a jour ?
117  if (c1.c == 0x0) c1.fait() ;
118  if (c2.c == 0x0) c2.fait() ;
119 
120  // Termine
121  return (*(c1.c)) - (*(c2.c)) ;
122 }
123 
124 Mtbl operator-(const Coord& co, const Mtbl& mt) {
125 
126  if (co.c == 0x0) co.fait() ;
127 
128  return (*(co.c)) - mt ;
129 }
130 
131 Mtbl operator-(const Mtbl& mt, const Coord& co) {
132 
133  if (co.c == 0x0) co.fait() ;
134 
135  return mt - (*(co.c)) ;
136 }
137 
138  //****************//
139  // MULTIPLICATION //
140  //****************//
141 
142 Mtbl operator*(const Coord& c1, const Coord& c2) {
143 
144  // Sont-elles a jour ?
145  if (c1.c == 0x0) c1.fait() ;
146  if (c2.c == 0x0) c2.fait() ;
147 
148  // Termine
149  return (*(c1.c)) * (*(c2.c)) ;
150 }
151 
152 Mtbl operator*(const Mtbl& m1, const Coord& c2) {
153 
154  // A jour ?
155  if (c2.c == 0x0) c2.fait() ;
156 
157  // Termine
158  return (m1) * (*(c2.c)) ;
159 }
160 
161 Mtbl operator*(const Coord& c2, const Mtbl& m1) {
162 
163  // A jour ?
164  if (c2.c == 0x0) c2.fait() ;
165 
166  // Termine
167  return (m1) * (*(c2.c)) ;
168 }
169 
170 
171 }
Multi-domain array.
Definition: mtbl.h:118
Lorene prototypes.
Definition: app_hor.h:67
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Mtbl * c
The coordinate values at each grid point.
Definition: coord.h:97
Cmp operator+(const Cmp &)
Definition: cmp_arithm.C:107
Active physical coordinates and mapping derivatives.
Definition: coord.h:90
void fait() const
Computes, at each point of the grid, the value of the coordinate or mapping derivative represented by...
Definition: coord.C:119
Cmp operator-(const Cmp &)
- Cmp
Definition: cmp_arithm.C:111