00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 char vector_divfree_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/vector_divfree.C,v 1.6 2005/02/14 13:01:50 j_novak Exp $" ;
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 #include <stdlib.h>
00061 #include <assert.h>
00062
00063
00064 #include "tensor.h"
00065
00066
00067
00068
00069
00070
00071
00072 Vector_divfree::Vector_divfree(const Map& map, const Base_vect& triad_i,
00073 const Metric& met)
00074 : Vector(map, CON, triad_i),
00075 met_div(&met) {
00076
00077 set_der_0x0() ;
00078
00079 }
00080
00081
00082
00083
00084 Vector_divfree::Vector_divfree (const Vector_divfree& source) :
00085 Vector(source), met_div(source.met_div) {
00086
00087 set_der_0x0() ;
00088 if (source.p_eta != 0x0) p_eta = new Scalar(*(source.p_eta)) ;
00089 if (source.p_mu != 0x0) p_mu = new Scalar(*(source.p_mu)) ;
00090
00091 }
00092
00093
00094
00095
00096 Vector_divfree::Vector_divfree(const Map& mapping, const Base_vect& triad_i,
00097 const Metric& met, FILE* fd) : Vector(mapping, triad_i, fd),
00098 met_div(&met) {
00099
00100 set_der_0x0() ;
00101
00102 }
00103
00104
00105
00106
00107
00108
00109
00110 Vector_divfree::~Vector_divfree () {
00111
00112 Vector_divfree::del_deriv() ;
00113
00114 }
00115
00116
00117
00118
00119
00120
00121 void Vector_divfree::del_deriv() const {
00122
00123 set_der_0x0() ;
00124 Vector::del_deriv() ;
00125
00126 }
00127
00128 void Vector_divfree::set_der_0x0() const {}
00129
00130
00131
00132
00133
00134 void Vector_divfree::operator=(const Vector_divfree& source) {
00135
00136
00137 Vector::operator=(source) ;
00138
00139
00140 assert(met_div == source.met_div) ;
00141
00142 del_deriv() ;
00143
00144 }
00145
00146 void Vector_divfree::operator=(const Vector& source) {
00147
00148
00149 Vector::operator=(source) ;
00150
00151
00152
00153 del_deriv() ;
00154 }
00155
00156 void Vector_divfree::operator=(const Tensor& source) {
00157
00158
00159 Vector::operator=(source) ;
00160
00161
00162
00163 del_deriv() ;
00164 }
00165
00166
00167 void Vector_divfree::set_vr_mu(const Scalar& vr_i, const Scalar& mu_i) {
00168
00169
00170 assert( dynamic_cast<const Base_vect_spher*>(triad) != 0x0 ) ;
00171
00172 del_deriv() ;
00173
00174
00175 *cmp[0] = vr_i ;
00176
00177 p_mu = new Scalar( mu_i ) ;
00178
00179 eta() ;
00180
00181 update_vtvp() ;
00182
00183 }
00184
00185
00186 const Scalar& Vector_divfree::eta() const {
00187
00188
00189 if (p_eta == 0x0) {
00190
00191
00192 #ifndef NDEBUG
00193 const Base_vect_spher* bvs = dynamic_cast<const Base_vect_spher*>(triad) ;
00194 assert(bvs != 0x0) ;
00195 #endif
00196
00197
00198 int dzp = cmp[0]->get_dzpuis() ;
00199 Scalar dvr = - cmp[0]->dsdr() ;
00200 dvr.mult_r_dzpuis(dzp) ;
00201
00202
00203 dvr -= 2. * (*cmp[0]) ;
00204
00205
00206
00207 p_eta = new Scalar( dvr.poisson_angu() ) ;
00208
00209 }
00210
00211 return *p_eta ;
00212
00213 }
00214
00215