/* * Methods for making calculations with Godunov-type arrays. * * See the file tbl_val.h for documentation * */ /* * Copyright (c) 2001 Jerome Novak * * This file is part of LORENE. * * LORENE is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LORENE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LORENE; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ char TBL_VAL_MATH_C[] = "$Header: /cvsroot/Lorene/C++/Source/Valencia/tbl_val_math.C,v 1.4 2014/10/13 08:53:48 j_novak Exp $" ; /* * $Id: tbl_val_math.C,v 1.4 2014/10/13 08:53:48 j_novak Exp $ * $Log: tbl_val_math.C,v $ * Revision 1.4 2014/10/13 08:53:48 j_novak * Lorene classes and functions now belong to the namespace Lorene. * * Revision 1.3 2014/10/06 15:13:22 j_novak * Modified #include directives to use c++ syntax. * * Revision 1.2 2002/11/12 10:03:54 j_novak * The method "Tbl_val::get_gval" has been changed to "get_grid". * * Revision 1.1 2001/11/22 13:41:54 j_novak * Added all source files for manipulating Valencia type objects and making * interpolations to and from Meudon grids. * * * $Header: /cvsroot/Lorene/C++/Source/Valencia/tbl_val_math.C,v 1.4 2014/10/13 08:53:48 j_novak Exp $ * */ // Headers C // --------- #include #include // Headers Lorene // -------------- #include "tbl_val.h" //-------// // Sinus // //-------// namespace Lorene { Tbl_val sin(const Tbl_val& ti) { // Protection assert(ti.get_etat() != ETATNONDEF) ; // Cas ETATZERO if (ti.get_etat() == ETATZERO) { return ti ; } // Cas general assert(ti.get_etat() == ETATQCQ) ; // sinon... Tbl_val to(ti.get_grille()) ; // Tbl_val resultat to.set_etat_qcq() ; int taille = ti.get_taille() ; for (int i=0 ; i 0) { return ti ; } else { cout << "Tbl_val pow: ETATZERO^n avec n<=0 ! "<< endl ; abort () ; } } // Cas general assert(ti.get_etat() == ETATQCQ) ; // sinon... Tbl_val to(ti.get_grille()) ; // Tbl_val resultat to.set_etat_qcq() ; double x = n ; int taille = ti.get_taille() ; for (int i=0 ; i 0) { return ti ; } else { cout << "Tbl_val pow: ETATZERO^x avec x<=0 !" << endl ; abort () ; } } // Cas general assert(ti.get_etat() == ETATQCQ) ; // sinon... Tbl_val to(ti.get_grille()) ; // Tbl_val resultat to.set_etat_qcq() ; int taille = ti.get_taille() ; for (int i=0 ; i resu ) resu = x[i] ; } return resu ; } //-------------------------------// // min // //-------------------------------// double min(const Tbl_val& ti) { // Protection assert(ti.get_etat() != ETATNONDEF) ; // Cas particulier if (ti.get_etat() == ETATZERO) { return double(0) ; } // Cas general assert(ti.get_etat() == ETATQCQ) ; // sinon.... const double* x = ti.t ; double resu = x[0] ; for (int i=1; i