00001 /* 00002 * Member functions of the Scalar class for the computation of integrals. 00003 */ 00004 00005 /* 00006 * Copyright (c) 2003 Eric Gourgoulhon & Jerome Novak 00007 * 00008 * Copyright (c) 1999-2001 Eric Gourgoulhon (Cmp version) 00009 * 00010 * This file is part of LORENE. 00011 * 00012 * LORENE is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * LORENE is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU General Public License 00023 * along with LORENE; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 * 00026 */ 00027 00028 00029 char scalar_integ_C[] = "$Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_integ.C,v 1.3 2004/07/26 16:02:23 j_novak Exp $" ; 00030 00031 /* 00032 * $Id: scalar_integ.C,v 1.3 2004/07/26 16:02:23 j_novak Exp $ 00033 * $Log: scalar_integ.C,v $ 00034 * Revision 1.3 2004/07/26 16:02:23 j_novak 00035 * Added a flag to specify whether the primitive should be zero either at r=0 00036 * or at r going to infinity. 00037 * 00038 * Revision 1.2 2004/06/14 15:28:17 e_gourgoulhon 00039 * Added method primr(). 00040 * 00041 * Revision 1.1 2003/09/25 09:33:36 j_novak 00042 * Added methods for integral calculation and various manipulations 00043 * 00044 * 00045 * $Header: /cvsroot/Lorene/C++/Source/Tensor/Scalar/scalar_integ.C,v 1.3 2004/07/26 16:02:23 j_novak Exp $ 00046 * 00047 */ 00048 00049 // Headers Lorene 00050 #include "tensor.h" 00051 #include "cmp.h" 00052 00053 //-----------------------------------// 00054 // Integral over all space // 00055 //-----------------------------------// 00056 00057 double Scalar::integrale() const { 00058 00059 const Tbl& integ = integrale_domains() ; 00060 00061 int nz = mp->get_mg()->get_nzone() ; 00062 00063 double resu = integ(0) ; 00064 for (int l=1; l<nz; l++) { 00065 resu += integ(l) ; 00066 } 00067 00068 return resu ; 00069 } 00070 00071 //-----------------------------------// 00072 // Integrals in each domain // 00073 //-----------------------------------// 00074 00075 const Tbl& Scalar::integrale_domains() const { 00076 00077 // Protection 00078 assert(etat != ETATNONDEF) ; 00079 00080 // If the integrals have not been previously computed, the 00081 // computation must be done by the appropriate routine of the mapping : 00082 00083 if (p_integ == 0x0) { 00084 Cmp orig(*this) ; 00085 p_integ = mp->integrale(orig) ; 00086 } 00087 00088 return *p_integ ; 00089 00090 } 00091 00092 00093 //----------------------// 00094 // Radial primitive // 00095 //----------------------// 00096 00097 Scalar Scalar::primr(bool null_infty) const { 00098 00099 Scalar resu(*mp) ; 00100 00101 mp->primr(*this, resu, null_infty) ; 00102 00103 return resu ; 00104 } 00105 00106 00107 00108
1.4.6