Changeset 23244


Ignore:
Timestamp:
09/10/18 21:23:01 (7 years ago)
Author:
Mathieu Morlighem
Message:

CHG: integrating changes from CoDiPack's branche

Location:
issm/trunk-jpl/src/c/shared/Numerics
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/shared/Numerics/extrema.cpp

    r15037 r23244  
    1111#include "./types.h"
    1212
     13#ifndef _HAVE_CODIPACK_// already defined in codipack headers
    1314IssmDouble min(IssmDouble a,IssmDouble b){
    1415        if (a<b)return a;
    1516        else return b;
    1617}
     18#endif
    1719int min(int a,int b){
    1820        if (a<b)return a;
    1921        else return b;
    2022}
     23#ifndef _HAVE_CODIPACK_// already defined in codipack headers
    2124IssmDouble max(IssmDouble a,IssmDouble b){
    2225        if (a>b)return a;
    2326        else return b;
    2427}
     28#endif
    2529int max(int a,int b){
    2630        if (a>b)return a;
     
    2832}
    2933
    30 #ifdef _HAVE_ADOLC_
     34#ifdef _HAVE_AD_
    3135IssmPDouble  min(IssmPDouble a,IssmPDouble b){
    3236        if (a<b)return a;
  • issm/trunk-jpl/src/c/shared/Numerics/isnan.cpp

    r20842 r23244  
    1313  return std::isnan(X.getValue());
    1414}
    15 #endif
    16 
    17 #if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)
    1815template <> int xIsInf<adouble> (const adouble& X){
    1916  return std::isinf(X.getValue());
    2017}
    2118#endif
     19
     20#if defined(_HAVE_CODIPACK_) && !defined(_WRAPPERS_)
     21template <> int xIsNan<IssmDouble> (const IssmDouble& X){
     22          return std::isnan(X.getValue());
     23}
     24template <> int xIsInf<IssmDouble> (const IssmDouble& X){
     25        return std::isinf(X.getValue());
     26}
     27#endif
  • issm/trunk-jpl/src/c/shared/Numerics/isnan.h

    r20669 r23244  
    3333#endif
    3434
     35#if defined(_HAVE_CODIPACK_) && !defined(_WRAPPERS_)
     36#include "./types.h"
     37template <> int xIsNan<IssmDouble> (const IssmDouble& X);
     38template <> int xIsInf<IssmDouble> (const IssmDouble& X);
    3539#endif
     40
     41#endif
  • issm/trunk-jpl/src/c/shared/Numerics/numerics.h

    r20021 r23244  
    2020#include "./OptPars.h"
    2121
     22#if !defined(_HAVE_CODIPACK_)
     23// already defined in codipack headers
    2224IssmDouble  min(IssmDouble a,IssmDouble b);
    2325IssmDouble  max(IssmDouble a,IssmDouble b);
     26#endif
    2427
    25 #ifdef _HAVE_ADOLC_
     28#ifdef _HAVE_AD_
    2629IssmPDouble  min(IssmPDouble a,IssmPDouble b);
    2730IssmPDouble  max(IssmPDouble a,IssmPDouble b);
  • issm/trunk-jpl/src/c/shared/Numerics/recast.h

    r18521 r23244  
    1515#endif
    1616
    17 #if !defined(_HAVE_ADOLC_) || defined(_WRAPPERS_)
     17#if !defined(_HAVE_AD_) || defined(_WRAPPERS_)
    1818
    1919template<class To, class From> To reCast(const From& from) {
     
    3434 * partial specialization
    3535 */
     36#ifdef _HAVE_ADOLC_
    3637template<class To> struct ForPartialSpecialization<To,adouble> {
    3738    static  To reCast(const adouble& from ) { return (To) (from.getValue());}
    3839};
     40#endif
     41#ifdef _HAVE_CODIPACK_
     42template<class To> struct ForPartialSpecialization<To,IssmDouble> {
     43            static  To reCast(const IssmDouble& from ) { return (To) (from.getValue());}
     44};
     45#endif
    3946
    4047#endif
  • issm/trunk-jpl/src/c/shared/Numerics/types.h

    r15838 r23244  
    2222
    2323#if defined(_HAVE_ADOLC_) &&  !defined(_WRAPPERS_)
     24/*ADOLC typedefs*/
    2425#include "adolc/adolc.h"
    25 // for active variables
    26 typedef adouble IssmDouble;
    27 // for passive variables
     26typedef adouble IssmDouble; /*for active variables*/
     27typedef double IssmPDouble; /*for passive variables*/
     28
     29#elif defined(_HAVE_CODIPACK_) && !defined(_WRAPPERS_)
     30/*CoDiPack typedefs*/
     31#include <codi.hpp>
     32typedef codi::RealReverse IssmDouble;
    2833typedef double IssmPDouble;
     34
     35/*Non-AD typedefs*/
    2936#else
    30 // see above
    3137typedef double IssmDouble;
    32 // see above
    3338typedef IssmDouble IssmPDouble;
    3439#endif
Note: See TracChangeset for help on using the changeset viewer.