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
29char coord_arithm_C[] = "$Header: /cvsroot/Lorene/C++/Source/Coord/coord_arithm.C,v 1.2 2014/10/13 08:52:50 j_novak Exp $" ;
30
31/*
32 * $Id: coord_arithm.C,v 1.2 2014/10/13 08:52:50 j_novak Exp $
33 * $Log: coord_arithm.C,v $
34 * Revision 1.2 2014/10/13 08:52:50 j_novak
35 * Lorene classes and functions now belong to the namespace Lorene.
36 *
37 * Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon
38 * LORENE
39 *
40 * Revision 1.2 2000/02/25 10:24:40 eric
41 * Remplacement de la variable globale nom_C (!) par arithm_coord_C
42 *
43 * Revision 1.1 1999/10/15 13:57:58 eric
44 * Initial revision
45 *
46 *
47 * $Header: /cvsroot/Lorene/C++/Source/Coord/coord_arithm.C,v 1.2 2014/10/13 08:52:50 j_novak Exp $
48 *
49 */
50
51// Headers Lorene
52#include "coord.h"
53#include "mtbl.h"
54
55namespace Lorene {
56
57/************************************************************************/
58/* operations sur Coord -> Mtbl */
59/************************************************************************/
60
61 //********************//
62 // OPERATEURS UNAIRES //
63 //********************//
64
65Mtbl operator+(const Coord& co) {
66
67 if (co.c == 0x0) co.fait() ;
68 return *(co.c) ;
69
70}
71
72Mtbl operator-(const Coord& co) {
73
74 if (co.c == 0x0) co.fait() ;
75 return -(*(co.c)) ;
76
77}
78
79 //**********//
80 // ADDITION //
81 //**********//
82
83Mtbl operator+(const Coord& c1, const Coord& c2) {
84
85 // Sont-elles a jour ?
86 if (c1.c == 0x0) c1.fait() ;
87 if (c2.c == 0x0) c2.fait() ;
88
89 // Termine
90 return (*(c1.c)) + (*(c2.c)) ;
91}
92
93Mtbl operator+(const Coord& co, const Mtbl& mt) {
94
95 if (co.c == 0x0) co.fait() ;
96
97 return (*(co.c)) + mt ;
98}
99
100Mtbl operator+(const Mtbl& mt, const Coord& co) {
101
102 if (co.c == 0x0) co.fait() ;
103
104 return mt + (*(co.c)) ;
105}
106
107 //**************//
108 // SOUSTRACTION //
109 //**************//
110
111Mtbl operator-(const Coord& c1, const Coord& c2) {
112
113 // Sont-elles a jour ?
114 if (c1.c == 0x0) c1.fait() ;
115 if (c2.c == 0x0) c2.fait() ;
116
117 // Termine
118 return (*(c1.c)) - (*(c2.c)) ;
119}
120
121Mtbl operator-(const Coord& co, const Mtbl& mt) {
122
123 if (co.c == 0x0) co.fait() ;
124
125 return (*(co.c)) - mt ;
126}
127
128Mtbl operator-(const Mtbl& mt, const Coord& co) {
129
130 if (co.c == 0x0) co.fait() ;
131
132 return mt - (*(co.c)) ;
133}
134
135 //****************//
136 // MULTIPLICATION //
137 //****************//
138
139Mtbl operator*(const Coord& c1, const Coord& c2) {
140
141 // Sont-elles a jour ?
142 if (c1.c == 0x0) c1.fait() ;
143 if (c2.c == 0x0) c2.fait() ;
144
145 // Termine
146 return (*(c1.c)) * (*(c2.c)) ;
147}
148
149Mtbl operator*(const Mtbl& m1, const Coord& c2) {
150
151 // A jour ?
152 if (c2.c == 0x0) c2.fait() ;
153
154 // Termine
155 return (m1) * (*(c2.c)) ;
156}
157
158Mtbl operator*(const Coord& c2, const Mtbl& m1) {
159
160 // A jour ?
161 if (c2.c == 0x0) c2.fait() ;
162
163 // Termine
164 return (m1) * (*(c2.c)) ;
165}
166
167
168}
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:116
Mtbl * c
The coordinate values at each grid point.
Definition coord.h:97
Multi-domain array.
Definition mtbl.h:118
Base_val operator*(const Base_val &, const Base_val &)
This operator is used when calling multiplication or division of Valeur .
Cmp operator-(const Cmp &)
- Cmp
Definition cmp_arithm.C:108
Cmp operator+(const Cmp &)
Definition cmp_arithm.C:104
Lorene prototypes.
Definition app_hor.h:64