| 1 |
/* |
| 2 |
* Methods of class Sym_tensor_tt |
| 3 |
* |
| 4 |
* (see file sym_tensor.h for documentation) |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
/* |
| 9 |
* Copyright (c) 2003-2004 Eric Gourgoulhon & Jerome Novak |
| 10 |
* |
| 11 |
* This file is part of LORENE. |
| 12 |
* |
| 13 |
* LORENE is free software; you can redistribute it and/or modify |
| 14 |
* it under the terms of the GNU General Public License as published by |
| 15 |
* the Free Software Foundation; either version 2 of the License, or |
| 16 |
* (at your option) any later version. |
| 17 |
* |
| 18 |
* LORENE is distributed in the hope that it will be useful, |
| 19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
* GNU General Public License for more details. |
| 22 |
* |
| 23 |
* You should have received a copy of the GNU General Public License |
| 24 |
* along with LORENE; if not, write to the Free Software |
| 25 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 26 |
* |
| 27 |
*/ |
| 28 |
|
| 29 |
|
| 30 |
char sym_tensor_tt_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/sym_tensor_tt.C,v 1.7 2014/10/13 08:53:43 j_novak Exp $" ; |
| 31 |
|
| 32 |
/* |
| 33 |
* $Id: sym_tensor_tt.C,v 1.7 2014/10/13 08:53:43 j_novak Exp $ |
| 34 |
* $Log: sym_tensor_tt.C,v $ |
| 35 |
* Revision 1.7 2014/10/13 08:53:43 j_novak |
| 36 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 37 |
* |
| 38 |
* Revision 1.6 2014/10/06 15:13:19 j_novak |
| 39 |
* Modified #include directives to use c++ syntax. |
| 40 |
* |
| 41 |
* Revision 1.5 2005/04/01 14:28:32 j_novak |
| 42 |
* Members p_eta and p_mu are now defined in class Sym_tensor. |
| 43 |
* |
| 44 |
* Revision 1.4 2004/03/30 14:01:19 j_novak |
| 45 |
* Copy constructors and operator= now copy the "derived" members. |
| 46 |
* |
| 47 |
* Revision 1.3 2004/03/03 13:16:21 j_novak |
| 48 |
* New potential khi (p_khi) and the functions manipulating it. |
| 49 |
* |
| 50 |
* Revision 1.2 2004/01/04 20:52:45 e_gourgoulhon |
| 51 |
* Added assignement (operator=) to a Tensor_sym. |
| 52 |
* |
| 53 |
* Revision 1.1 2003/10/27 10:50:54 e_gourgoulhon |
| 54 |
* First version. |
| 55 |
* |
| 56 |
* |
| 57 |
* |
| 58 |
* $Header: /cvsroot/Lorene/C++/Source/Tensor/sym_tensor_tt.C,v 1.7 2014/10/13 08:53:43 j_novak Exp $ |
| 59 |
* |
| 60 |
*/ |
| 61 |
|
| 62 |
// Headers C |
| 63 |
#include <cstdlib> |
| 64 |
|
| 65 |
// Headers Lorene |
| 66 |
#include "tensor.h" |
| 67 |
|
| 68 |
//--------------// |
| 69 |
// Constructors // |
| 70 |
//--------------// |
| 71 |
|
| 72 |
// Standard constructor |
| 73 |
// -------------------- |
| 74 |
namespace Lorene { |
| 75 |
Sym_tensor_tt::Sym_tensor_tt(const Map& map, const Base_vect& triad_i, |
| 76 |
const Metric& met) |
| 77 |
: Sym_tensor_trans(map, triad_i, met ) { |
| 78 |
|
| 79 |
set_der_0x0() ; |
| 80 |
|
| 81 |
} |
| 82 |
|
| 83 |
// Copy constructor |
| 84 |
// ---------------- |
| 85 |
Sym_tensor_tt::Sym_tensor_tt (const Sym_tensor_tt& source) |
| 86 |
: Sym_tensor_trans(source) { |
| 87 |
|
| 88 |
set_der_0x0() ; |
| 89 |
|
| 90 |
if (source.p_khi != 0x0) p_khi = new Scalar( *(source.p_khi) ) ; |
| 91 |
|
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
// Constructor from a file |
| 96 |
// ----------------------- |
| 97 |
Sym_tensor_tt::Sym_tensor_tt(const Map& mapping, const Base_vect& triad_i, |
| 98 |
const Metric& met, FILE* fd) |
| 99 |
: Sym_tensor_trans(mapping, triad_i, met, fd) { |
| 100 |
|
| 101 |
set_der_0x0() ; |
| 102 |
} |
| 103 |
|
| 104 |
//--------------// |
| 105 |
// Destructor // |
| 106 |
//--------------// |
| 107 |
|
| 108 |
Sym_tensor_tt::~Sym_tensor_tt() { |
| 109 |
|
| 110 |
Sym_tensor_tt::del_deriv() ; // in order not to follow the virtual aspect |
| 111 |
// of del_deriv() |
| 112 |
|
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
//-------------------// |
| 118 |
// Memory managment // |
| 119 |
//-------------------// |
| 120 |
|
| 121 |
void Sym_tensor_tt::del_deriv() const { |
| 122 |
|
| 123 |
if (p_khi != 0x0) delete p_khi ; |
| 124 |
|
| 125 |
set_der_0x0() ; |
| 126 |
|
| 127 |
Sym_tensor_trans::del_deriv() ; |
| 128 |
|
| 129 |
} |
| 130 |
|
| 131 |
void Sym_tensor_tt::set_der_0x0() const { |
| 132 |
|
| 133 |
p_khi = 0x0 ; |
| 134 |
} |
| 135 |
|
| 136 |
|
| 137 |
//--------------// |
| 138 |
// Assignment // |
| 139 |
//--------------// |
| 140 |
|
| 141 |
void Sym_tensor_tt::operator=(const Sym_tensor_tt& source) { |
| 142 |
|
| 143 |
// Assignment of quantities common to all derived classes of Sym_tensor_trans |
| 144 |
Sym_tensor_trans::operator=(source) ; |
| 145 |
|
| 146 |
del_deriv() ; |
| 147 |
|
| 148 |
if (source.p_khi != 0x0) p_khi = new Scalar( *(source.p_khi) ) ; |
| 149 |
|
| 150 |
} |
| 151 |
|
| 152 |
|
| 153 |
void Sym_tensor_tt::operator=(const Sym_tensor_trans& source) { |
| 154 |
|
| 155 |
// Assignment of quantities common to all derived classes of Sym_tensor_trans |
| 156 |
Sym_tensor_trans::operator=(source) ; |
| 157 |
|
| 158 |
del_deriv() ; |
| 159 |
} |
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
void Sym_tensor_tt::operator=(const Sym_tensor& source) { |
| 164 |
|
| 165 |
// Assignment of quantities common to all derived classes of Sym_tensor_trans |
| 166 |
Sym_tensor_trans::operator=(source) ; |
| 167 |
|
| 168 |
del_deriv() ; |
| 169 |
} |
| 170 |
|
| 171 |
|
| 172 |
void Sym_tensor_tt::operator=(const Tensor_sym& source) { |
| 173 |
|
| 174 |
// Assignment of quantities common to all derived classes of Sym_tensor_trans |
| 175 |
Sym_tensor_trans::operator=(source) ; |
| 176 |
|
| 177 |
del_deriv() ; |
| 178 |
} |
| 179 |
|
| 180 |
|
| 181 |
void Sym_tensor_tt::operator=(const Tensor& source) { |
| 182 |
|
| 183 |
// Assignment of quantities common to all derived classes of Sym_tensor_trans |
| 184 |
Sym_tensor_trans::operator=(source) ; |
| 185 |
|
| 186 |
del_deriv() ; |
| 187 |
} |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
} |