Changeset 3157 in Sophya for trunk/Cosmo/SimLSS/geneutils.h


Ignore:
Timestamp:
Jan 25, 2007, 6:04:48 PM (19 years ago)
Author:
cmv
Message:

intro du facteur de croissance dans la simul cmv 25/01/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosmo/SimLSS/geneutils.h

    r3120 r3157  
    77#include "histos.h"
    88#include "tvector.h"
     9#include "cspline.h"
    910
    1011#include <vector>
     
    1213namespace SOPHYA {
    1314
     15//----------------------------------------------------
    1416class InterpFunc {
    1517public:
     
    1921  double XMin(void) {return _xmin;}
    2022  double XMax(void) {return _xmax;}
     23  inline double X(long i) {return _xmin + i*_dx;}
    2124
    2225  //! Retourne l'element le plus proche de f donnant y=f(x)
     
    2427         {
    2528         x -= _xmin;
    26          long i = long(x/_xlarg*_nm1+0.5);  // On prend le "i" le plus proche
     29         long i = long(x/_dx+0.5);  // On prend le "i" le plus proche
    2730         if(i<0) i=0; else if(i>=_nm1) i=_nm1-1;
    2831         return _y[i];
     
    4346
    4447protected:
    45   double _xmin,_xmax,_xlarg,_dx;
     48  double _xmin,_xmax,_dx;
     49  long _nm1;  // n-1
    4650  vector<double>& _y;
    47   long _nm1;  // n-1
     51};
     52
     53//----------------------------------------------------
     54class InverseFunc {
     55public:
     56  InverseFunc(vector<double>& x,vector<double>& y);
     57  virtual ~InverseFunc(void);
     58  int ComputeLinear(long n,vector<double>& xfcty);
     59  int ComputeParab(long n,vector<double>& xfcty);
     60  double YMin(void) {return _ymin;}
     61  double YMax(void) {return _ymax;}
     62protected:
     63  inline void find_in_y(double x,long& klo,long& khi)
     64    {
     65      long k;
     66      klo=0, khi=_y.size()-1;
     67      while (khi-klo > 1) {
     68        k = (khi+klo) >> 1;
     69        if (_y[k] > x) khi=k; else klo=k;
     70      }
     71    }
     72
     73  vector<double>& _x;
     74  vector<double>& _y;
     75  double _ymin,_ymax,_dy;
    4876};
    4977
    5078}
    5179
     80//----------------------------------------------------
    5281int FuncToHisto(GenericFunc& func,Histo& h,bool logaxex=false);
    5382int FuncToVec(GenericFunc& func,TVector<r_8>& h,double xmin,double xmax,bool logaxex=false);
    5483
     84//----------------------------------------------------
    5585double AngSol(double dtheta,double dphi,double theta0=M_PI/2.);
    5686double AngSol(double dtheta);
    5787
     88//----------------------------------------------------
    5889unsigned long PoissRandLimit(double mu,double mumax=10.);
    5990
Note: See TracChangeset for help on using the changeset viewer.