LORENE
coord.C
1/*
2 * Methods of class Coord
3 *
4 * (see file coord.h for documentation)
5 *
6 */
7
8/*
9 * Copyright (c) 1999-2000 Jean-Alain Marck
10 * Copyright (c) 1999-2001 Eric Gourgoulhon
11 *
12 * This file is part of LORENE.
13 *
14 * LORENE is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * LORENE is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with LORENE; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30
31
32
33/*
34 * $Id: coord.C,v 1.6 2016/12/05 16:17:50 j_novak Exp $
35 * $Log: coord.C,v $
36 * Revision 1.6 2016/12/05 16:17:50 j_novak
37 * Suppression of some global variables (file names, loch, ...) to prevent redefinitions
38 *
39 * Revision 1.5 2014/10/13 08:52:50 j_novak
40 * Lorene classes and functions now belong to the namespace Lorene.
41 *
42 * Revision 1.4 2014/10/06 15:13:04 j_novak
43 * Modified #include directives to use c++ syntax.
44 *
45 * Revision 1.3 2008/02/18 13:53:39 j_novak
46 * Removal of special indentation instructions.
47 *
48 * Revision 1.2 2002/10/16 14:36:34 j_novak
49 * Reorganization of #include instructions of standard C++, in order to
50 * use experimental version 3 of gcc.
51 *
52 * Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon
53 * LORENE
54 *
55 * Revision 2.3 1999/10/15 09:16:11 eric
56 * Depoussierage.
57 *
58 * Revision 2.2 1999/03/01 15:07:25 eric
59 * *** empty log message ***
60 *
61 * Revision 2.1 1999/02/23 14:57:03 hyc
62 * *** empty log message ***
63 *
64 * Revision 2.0 1999/02/15 10:42:45 hyc
65 * *** empty log message ***
66 *
67 * $Header: /cvsroot/Lorene/C++/Source/Coord/coord.C,v 1.6 2016/12/05 16:17:50 j_novak Exp $
68 *
69 */
70
71// Fichier includes
72#include <cstdlib>
73#include <cstdio>
74#include "coord.h"
75#include "mtbl.h"
76
77 //---------------//
78 // Constructeurs //
79 //---------------//
80
81// Constructeur par defaut
82namespace Lorene {
83Coord::Coord() : mp(0x0), met_fait(0x0), c(0x0) {}
84
85// Constructeur
86Coord::Coord(const Map* mpi, Mtbl* (*construit)(const Map* ) ) : mp(mpi),
87 met_fait(construit),
88 c(0x0)
89{}
90
91 //--------------//
92 // Destructeur //
93 //--------------//
94
96 delete c ;
97}
98
99 //------------//
100 // Impression //
101 //------------//
102
103// Operateurs <<
104ostream& operator<<(ostream& o, const Coord & ci) {
105
106 if (ci.c == 0x0) {
107 o << "La coordonnee n'est pas a jour, je la fais." << endl ;
108 ci.fait() ;
109 }
110 o << "Coordonnee: " << endl ;
111 o << *(ci.c) << endl ;
112 return o ;
113}
114
115 //----------//
116 // Methodes //
117 //----------//
118
119void Coord::fait() const {
120 delete c ;
121 c = met_fait(mp) ;
122}
123
124 //-----------------//
125 // Gestion memoire //
126 //-----------------//
127
128void Coord::del_t() const {
129 delete c ;
130 c = 0x0 ;
131}
132
133 //--------------------//
134 // Fonctions diverses //
135 //--------------------//
136
137void Coord::set(const Map* mpi, Mtbl* (*construit)(const Map*) ) {
138 mp = mpi ;
139 met_fait = construit ;
140}
141}
Coord()
Default constructor.
Definition coord.C:83
Mtbl *(* met_fait)(const Map *)
Function to compute the coordinate.
Definition coord.h:96
void fait() const
Computes, at each point of the grid, the value of the coordinate or mapping derivative represented by...
Definition coord.C:119
~Coord()
Destructor.
Definition coord.C:95
const Map * mp
Mapping on which the Coord is defined.
Definition coord.h:95
friend ostream & operator<<(ostream &, const Coord &)
Display.
Definition coord.C:104
void del_t() const
Logical destructor (deletes the Mtbl member *c ).
Definition coord.C:128
Mtbl * c
The coordinate values at each grid point.
Definition coord.h:97
void set(const Map *mp, Mtbl *(*construct)(const Map *))
Semi-constructor from a mapping and a method.
Definition coord.C:137
Multi-domain array.
Definition mtbl.h:118
Lorene prototypes.
Definition app_hor.h:67
Map(const Mg3d &)
Constructor from a multi-domain 3D grid.
Definition map.C:142