utilitaires.h
/*
* Prototypes of various utilities for Lorene
*
*/
/*
* Copyright (c) 1999-2001 Eric Gourgoulhon
*
* 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
*
*/
#ifndef __UTILITAIRES_H_
#define __UTILITAIRES_H_
/*
* $Id: utilitaires.h,v 1.16 2015/01/09 15:28:52 j_novak Exp $
* $Log: utilitaires.h,v $
* Revision 1.16 2015/01/09 15:28:52 j_novak
* New integration function for general non-equally-spaced grids.
*
* Revision 1.15 2014/10/13 08:52:37 j_novak
* Lorene classes and functions now belong to the namespace Lorene.
*
* Revision 1.14 2014/10/06 15:09:40 j_novak
* Modified #include directives to use c++ syntax.
*
* Revision 1.13 2014/07/04 12:09:06 j_novak
* New argument in zerosec(): a boolean (false by default) for aborting if the number of iteration is greater than the max.
*
* Revision 1.12 2014/04/25 10:43:50 j_novak
* The member 'name' is of type string now. Correction of a few const-related issues.
*
* Revision 1.11 2008/08/19 06:41:59 j_novak
* Minor modifications to avoid warnings with gcc 4.3. Most of them concern
* cast-type operations, and constant strings that must be defined as const char*
*
* Revision 1.10 2004/09/01 09:47:55 r_prix
* fixed/improved string-reading with read_variable(): allocates returned string
*
* Revision 1.9 2004/03/22 13:12:44 j_novak
* Modification of comments to use doxygen instead of doc++
*
* Revision 1.8 2003/12/17 23:12:30 r_prix
* replaced use of C++ <string> by standard ANSI char* to be backwards compatible
* with broken compilers like MIPSpro Compiler 7.2 on SGI Origin200. ;-)
*
* Revision 1.7 2003/12/05 15:05:53 r_prix
* added read_variable() for (C++-type) strings.
*
* Revision 1.6 2003/12/04 12:33:21 r_prix
* added prototypes and documentation for variable-reading functions
* (read_variable, load_file, load_file_buffered)
*
* Revision 1.5 2002/05/02 15:16:22 j_novak
* Added functions for more general bi-fluid EOS
*
* Revision 1.4 2002/04/16 08:06:44 j_novak
* Addition of zerosec_borne
*
* Revision 1.3 2002/04/11 09:19:46 j_novak
* Back to old version of zerosec
*
* Revision 1.2 2001/12/04 21:24:33 e_gourgoulhon
*
* New functions fwrite_be and fread_be for writing/reading in a
* binary file according to the big endian convention.
*
* Revision 1.1.1.1 2001/11/20 15:19:27 e_gourgoulhon
* LORENE
*
* Revision 1.6 2001/09/14 14:23:53 eric
* Ajout de la fonction zero_list.
*
* Revision 1.5 2001/05/29 16:11:21 eric
* Modif commentaires (mise en conformite Doc++ 3.4.7).
*
* Revision 1.4 1999/12/24 12:59:54 eric
* Ajout de la routine zero_premier.
*
* Revision 1.3 1999/12/15 15:39:42 eric
* *** empty log message ***
*
* Revision 1.2 1999/12/15 15:17:03 eric
* *** empty log message ***
*
* Revision 1.1 1999/12/15 09:41:47 eric
* Initial revision
*
*
* $Header: /cvsroot/Lorene/C++/Include/utilitaires.h,v 1.16 2015/01/09 15:28:52 j_novak Exp $
*
*/
#include "stdio.h"
#include <cstring>
namespace Lorene {
class Param ;
class Tbl ;
void arrete(int a = 0) ;
bool zero_premier(double (*f)(double, const Param&), const Param& par,
double a, double b, int n, double& a0, double& b0) ;
double zerosec( double (*f)(double, const Param&), const Param& par,
double a, double b, double precis, int nitermax,
int& niter, bool abort=true) ;
double zerosec_b( double (*f)(double, const Param&),const Param& par,
double a, double b, double precis, int nitermax,
int& niter) ;
void zero_list( double (*f)(double, const Param&), const Param& par,
double xmin, double xmax, int nsub,
Tbl*& az, Tbl*& bz ) ;
Tbl integ1D(const Tbl& xx, const Tbl& ff) ;
int fwrite_be(const int* aa, int size, int nb, FILE* fich) ;
int fwrite_be(const double* aa, int size, int nb, FILE* fich) ;
int fread_be(int* aa, int size, int nb, FILE* fich) ;
int fread_be(double* aa, int size, int nb, FILE* fich) ;
char *load_file(char *fname);
char *load_file_buffered(char *fname);
int read_variable(const char *fname, const char *var_name, char *fmt, void *varp);
int read_variable(const char *fname, const char *var_name, int &var);
int read_variable(const char *fname, const char *var_name, bool &var);
int read_variable(const char *fname, const char *var_name, double &var);
int read_variable (const char *fname, const char *var_name, char **str);
void *MyMalloc (long bytes);
int FS_filelength (FILE *f);
void c_est_pas_fait(const char * ) ;
}
#endif
Lorene::Param
Parameter storage.
Definition param.h:125
Lorene::Tbl
Basic array class.
Definition tbl.h:161
Lorene::load_file_buffered
char * load_file_buffered(char *fname)
Returns pointer to data from a file using a buffer.
Lorene::zero_list
void zero_list(double(*f)(double, const Param &), const Param &par, double xmin, double xmax, int nsub, Tbl *&az, Tbl *&bz)
Locates approximatively all the zeros of a function in a given interval.
Definition zero_list.C:57
Lorene::load_file
char * load_file(char *fname)
Read file into memory and returns pointer to data.
Lorene::integ1D
Tbl integ1D(const Tbl &xx, const Tbl &ff)
Integrates a function defined on an unequally-spaced grid, approximating it by piece parabolae.
Definition integrate_1D.C:47
Lorene::FS_filelength
int FS_filelength(FILE *f)
A portable routine to determine the length of a file.
Definition read_variable.C:272
Lorene::c_est_pas_fait
void c_est_pas_fait(const char *)
Helpful function to say something is not implemented yet.
Definition c_est_pas_fait.C:73
Lorene::arrete
void arrete(int a=0)
Setting a stop point in a code.
Definition arrete.C:61
Lorene::fread_be
int fread_be(int *aa, int size, int nb, FILE *fich)
Reads integer(s) from a binary file according to the big endian convention.
Definition fread_be.C:69
Lorene::zero_premier
bool zero_premier(double(*f)(double, const Param &), const Param &par, double a, double b, int n, double &a0, double &b0)
Locates the sub-interval containing the first zero of a function in a given interval.
Definition zero_premier.C:61
Lorene::MyMalloc
void * MyMalloc(long bytes)
'Improved' malloc that sets memory to 0 and also auto-terminates on error.
Definition read_variable.C:293
Lorene::zerosec_b
double zerosec_b(double(*f)(double, const Param &), const Param &par, double a, double b, double precis, int nitermax, int &niter)
Finding the zero a function on a bounded domain.
Definition zerosec_borne.C:68
Lorene::read_variable
int read_variable(const char *fname, const char *var_name, char *fmt, void *varp)
Reads a variable from file.
Definition read_variable.C:110
Lorene::fwrite_be
int fwrite_be(const int *aa, int size, int nb, FILE *fich)
Writes integer(s) into a binary file according to the big endian convention.
Definition fwrite_be.C:70
Lorene::zerosec
double zerosec(double(*f)(double, const Param &), const Param &par, double a, double b, double precis, int nitermax, int &niter, bool abort=true)
Finding the zero a function.
Definition zerosec.C:89
Lorene
Lorene prototypes.
Definition app_hor.h:64