Changeset 2291 in Sophya


Ignore:
Timestamp:
Dec 5, 2002, 4:43:59 PM (23 years ago)
Author:
lemeur
Message:

protections de dimensions

Location:
trunk/SophyaLib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Samba/lambdaBuilder.h

    r1756 r2291  
    1414
    1515 public :
    16 Legendre();
    1716Legendre(r_8 x, int_4 lmax);
    18  inline r_8 getPl(int_4 l)
     17
     18inline r_8 getPl(int_4 l) const
    1919{
    2020  if (l>lmax_)
     
    2525}
    2626
     27
    2728 private :
    28   void array_init(int_4 lmax);
     29
     30Legendre() {;}
     31
     32void array_init(int_4 lmax);
    2933
    3034  r_8 x_;
     
    4549
    4650 /*! return the value of the coefficient \f$  \lambda_l^m \f$ */
    47 inline double lamlm(int l, int m) const { return lambda_(l,m); }
     51inline double lamlm(int l, int m) const
     52  {
     53    lambda_.CheckRelativeIndices(l,m);
     54    return lambda_(l,m);
     55  }
    4856
    49 inline double lamlm(int index) const { return lambda_(index); }
     57inline double lamlm(int index) const {
     58 return lambda_(index);
     59}
    5060
    5161
     
    92102inline void lam_wx(int l, int m, r_8& w, r_8& x) const
    93103   {
     104  if (m > l )
     105    {
     106      throw RangeCheckError("LambdaWXBuilder::lam_wx : l < m !" );
     107    }
    94108     w=lamWlm_(l,m);
    95109     x=lamXlm_(l,m);
     
    117131inline void lam_pm(int l, int m, r_8& lambda_plus, r_8& lambda_moins) const
    118132   {
     133  if (m > l )
     134    {
     135      throw RangeCheckError("LambdaPMBuilder::lam_pm : l < m !" );
     136    }
    119137      lambda_plus = lamPlm_(l,m);
    120138     lambda_moins = lamMlm_(l,m);
  • trunk/SophyaLib/Samba/sphericaltransformserver.cc

    r1756 r2291  
    169169  // le Resize est suppose mettre a zero
    170170  map.Resize(pixelSizeIndex);
    171   char* sphere_type=map.TypeOfMap();
     171  string sphere_type=map.TypeOfMap();
    172172      int premiereTranche = 0;
    173173      int derniereTranche = map.NbThetaSlices()-1;
    174   if (strncmp(sphere_type,"RING",4) == 0)
     174  if (sphere_type.substr(0,4) == "RING")
    175175  {
    176176    nsmax=map.SizeIndex();
     
    182182    // en vue de l'application du critere Healpix : nlmax<=3*nsmax-1
    183183    // c'est approximatif ; a raffiner.
    184     if (strncmp(sphere_type,"TETAFI",6) == 0)
     184    if (sphere_type.substr(0,6) == "TETAFI")
    185185    {
    186186      nsmax=(int_4)sqrt(map.NbPixels()/12.);
     
    706706  mapq.Resize(pixelSizeIndex);
    707707  mapu.Resize(pixelSizeIndex);
    708   char* sphere_type=mapq.TypeOfMap();
    709   if (strncmp(sphere_type,mapu.TypeOfMap(),4) != 0)
     708  string sphere_type=mapq.TypeOfMap();
     709  if (sphere_type != mapu.TypeOfMap())
    710710    {
    711711      cout <<  " SphericalTransformServer: les deux spheres ne sont pas de meme type" << endl;
     
    715715     
    716716    }
    717   if (strncmp(sphere_type,"RING",4) == 0)
     717  if (sphere_type.substr(0,4) == "RING")
    718718    {
    719719      nsmax=mapq.SizeIndex();
     
    724724    // en vue de l'application du critere Healpix : nlmax<=3*nsmax-1
    725725    // c'est approximatif ; a raffiner.
    726     if (strncmp(sphere_type,"TETAFI",6) == 0)
     726    if (sphere_type.substr(0,6) == "TETAFI")
    727727      {
    728728        nsmax=(int_4)sqrt(mapq.NbPixels()/12.);
     
    739739    {
    740740      cout << "GenerateFromAlm: nlmax should be <= 3*nside-1" << endl;
    741       if (strncmp(sphere_type,"TETAFI",6) == 0)
     741      if (sphere_type.substr(0,6) == "TETAFI")
    742742        {
    743743          cout << " (for this criterium, nsmax is computed as sqrt(nbPixels/12))" << endl;
     
    877877  TVector<int_4> pixNumber;
    878878
    879   char* sphere_type=mapq.TypeOfMap();
    880   if (strncmp(sphere_type,mapu.TypeOfMap(),4) != 0)
     879  string sphere_type=mapq.TypeOfMap();
     880  if (sphere_type != mapu.TypeOfMap())
    881881    {
    882882      cout <<  " SphericalTransformServer: les deux spheres ne sont pas de meme type" << endl;
  • trunk/SophyaLib/TArray/triangmtx.h

    r1757 r2291  
    109109  inline int_4 Size() const {return elem_.Size();}
    110110
     111  inline bool CheckRelativeIndices(int_4 l, int_4 m) const
     112   {
     113     if ( l < m )
     114       {
     115         throw RangeCheckError("TriangularMatrix<T>::CheckRelativeIndices: indices out of range " );
     116       }
     117     return true;
     118   }
     119  inline bool CheckAbsoluteIndice(int_4 l, int_4 m) const
     120   {
     121     if ( indexOfElement(l,m) >= elem_.Size() )
     122       {
     123         throw RangeCheckError("TriangularMatrix<T>::CheckAbsoluteIndice: indices out of range " );
     124       }
     125   }
     126  inline bool CheckAbsoluteIndice(int_4 ind) const
     127   {
     128     if ( ind >= elem_.Size() )
     129       {
     130         throw RangeCheckError("TriangularMatrix<T>::CheckAbsoluteIndice: indices out of range " );
     131       }
     132   }
    111133
    112134void Print(int nbLignes=0)
Note: See TracChangeset for help on using the changeset viewer.