/[escript]/branches/clazy/escriptcore/src/DataLazy.cpp
ViewVC logotype

Diff of /branches/clazy/escriptcore/src/DataLazy.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 6057 by jfenwick, Thu Mar 10 06:00:58 2016 UTC revision 6066 by jfenwick, Tue Mar 15 06:42:55 2016 UTC
# Line 1061  DataLazy::resolveNodeUnary(int tid, int Line 1061  DataLazy::resolveNodeUnary(int tid, int
1061    const double* left=&((*leftres)[roffset]);    const double* left=&((*leftres)[roffset]);
1062    roffset=m_samplesize*tid;    roffset=m_samplesize*tid;
1063    double* result=&(m_samples[roffset]);    double* result=&(m_samples[roffset]);
1064      escript::ESFunction operation=SINF;
1065    switch (m_op)    switch (m_op)
1066    {    {
1067      case SIN:        case SIN:
1068          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::sin);      operation=SINF;
1069          break;      break;
1070      case COS:      case COS:
1071          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::cos);          operation=COSF;
1072          break;      break;
1073      case TAN:      case TAN:
1074          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::tan);          operation=TANF;
1075          break;      break;
1076      case ASIN:      case ASIN:
1077          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::asin);          operation=ASINF;
1078          break;      break;
1079      case ACOS:      case ACOS:
1080          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::acos);          operation=ACOSF;
1081          break;      break;
1082      case ATAN:      case ATAN:
1083          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::atan);          operation=ATANF;
1084          break;      break;
1085      case SINH:      case SINH:
1086          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::sinh);          operation=SINHF;
1087          break;      break;
1088      case COSH:      case COSH:
1089          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::cosh);          operation=COSHF;
1090          break;      break;
1091      case TANH:      case TANH:
1092          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::tanh);          operation=TANHF;
1093          break;      break;
1094      case ERF:      case ERF:
1095  #if defined (_WIN32) && !defined(__INTEL_COMPILER)          operation=ERFF;
1096          throw DataException("Error - Data:: erf function is not supported on _WIN32 platforms.");      break;
 #else  
         tensor_unary_operation(m_samplesize, left, result, ::erf);  
         break;  
 #endif  
1097     case ASINH:     case ASINH:
1098  #if defined (_WIN32) && !defined(__INTEL_COMPILER)          operation=ASINHF;
1099          tensor_unary_operation(m_samplesize, left, result, escript::asinh_substitute);      break;
 #else  
         tensor_unary_operation(m_samplesize, left, result, ::asinh);  
 #endif    
         break;  
1100     case ACOSH:     case ACOSH:
1101  #if defined (_WIN32) && !defined(__INTEL_COMPILER)          operation=ACOSHF;
1102          tensor_unary_operation(m_samplesize, left, result, escript::acosh_substitute);      break;
 #else  
         tensor_unary_operation(m_samplesize, left, result, ::acosh);  
 #endif    
         break;  
1103     case ATANH:     case ATANH:
1104  #if defined (_WIN32) && !defined(__INTEL_COMPILER)          operation=ATANHF;
1105          tensor_unary_operation(m_samplesize, left, result, escript::atanh_substitute);      break;
 #else  
         tensor_unary_operation(m_samplesize, left, result, ::atanh);  
 #endif    
         break;  
1106      case LOG10:      case LOG10:
1107          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::log10);          operation=LOG10F;
1108          break;      break;
1109      case LOG:      case LOG:
1110          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::log);          operation=LOGF;
1111          break;      break;
1112      case SIGN:      case SIGN:
1113          tensor_unary_operation(m_samplesize, left, result, escript::fsign);          operation=SIGNF;
1114          break;      break;
1115      case ABS:      case ABS:
1116          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::fabs);          operation=ABSF;
1117          break;      break;
1118      case NEG:      case NEG:
1119          tensor_unary_operation(m_samplesize, left, result, negate<double>());          operation=NEGF;
1120          break;      break;
1121      case POS:      case POS:
1122          // it doesn't mean anything for delayed.          // it doesn't mean anything for delayed.
1123          // it will just trigger a deep copy of the lazy object          // it will just trigger a deep copy of the lazy object
1124          throw DataException("Programmer error - POS not supported for lazy data.");          throw DataException("Programmer error - POS not supported for lazy data.");
1125          break;          break;
1126      case EXP:      case EXP:
1127          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::exp);          operation=EXPF;
1128          break;      break;
1129      case SQRT:      case SQRT:
1130          tensor_unary_operation<double (*)(double)>(m_samplesize, left, result, ::sqrt);          operation=SQRTF;
1131          break;      break;
1132      case RECIP:      case RECIP:
1133          tensor_unary_operation(m_samplesize, left, result, bind1st(divides<double>(),1.));          operation=INVF;
1134          break;      break;
1135      case GZ:      case GZ:
1136          tensor_unary_operation(m_samplesize, left, result, bind2nd(greater<double>(),0.0));          operation=GTZEROF;
1137          break;      break;
1138      case LZ:      case LZ:
1139          tensor_unary_operation(m_samplesize, left, result, bind2nd(less<double>(),0.0));          operation=LTZEROF;
1140          break;      break;
1141      case GEZ:      case GEZ:
1142          tensor_unary_operation(m_samplesize, left, result, bind2nd(greater_equal<double>(),0.0));          operation=GEZEROF;
1143          break;      break;
1144      case LEZ:      case LEZ:
1145          tensor_unary_operation(m_samplesize, left, result, bind2nd(less_equal<double>(),0.0));          operation=LEZEROF;
1146          break;      break;
1147  // There are actually G_UNARY_P but I don't see a compelling reason to treat them differently  // There are actually G_UNARY_P but I don't see a compelling reason to treat them differently
1148      case NEZ:      case NEZ:
1149          tensor_unary_operation(m_samplesize, left, result, bind2nd(AbsGT(),m_tol));          operation=NEQZEROF;
1150          break;      break;
1151      case EZ:      case EZ:
1152          tensor_unary_operation(m_samplesize, left, result, bind2nd(AbsLTE(),m_tol));          operation=EQZEROF;
1153          break;  cerr << "Trying to evaluate " << m_tol << endl;
1154        
1155        break;
1156      default:      default:
1157          throw DataException("Programmer error - resolveUnary can not resolve operator "+opToString(m_op)+".");          throw DataException("Programmer error - resolveUnary can not resolve operator "+opToString(m_op)+".");
1158    }    }
1159      tensor_unary_array_operation(m_samplesize,
1160                                 left,
1161                                 result,
1162                                 operation,
1163                                 m_tol);  
1164    return &(m_samples);    return &(m_samples);
1165  }  }
1166    

Legend:
Removed from v.6057  
changed lines
  Added in v.6066

  ViewVC Help
Powered by ViewVC 1.1.26