/[escript]/branches/schroedinger/escript/src/Data.cpp
ViewVC logotype

Diff of /branches/schroedinger/escript/src/Data.cpp

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

revision 1885 by jfenwick, Tue Oct 14 03:54:42 2008 UTC revision 1886 by jfenwick, Wed Oct 15 01:34:18 2008 UTC
# Line 1085  Data::integrate() const Line 1085  Data::integrate() const
1085  Data  Data
1086  Data::sin() const  Data::sin() const
1087  {  {
1088      if (isLazy())
1089      {
1090        DataLazy* c=new DataLazy(borrowDataPtr(),SIN);
1091        return Data(c);
1092      }
1093    return C_TensorUnaryOperation<double (*)(double)>(*this, ::sin);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::sin);
1094  }  }
1095    
1096  Data  Data
1097  Data::cos() const  Data::cos() const
1098  {  {
1099      if (isLazy())
1100      {
1101        DataLazy* c=new DataLazy(borrowDataPtr(),COS);
1102        return Data(c);
1103      }
1104    return C_TensorUnaryOperation<double (*)(double)>(*this, ::cos);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::cos);
1105  }  }
1106    
1107  Data  Data
1108  Data::tan() const  Data::tan() const
1109  {  {
1110      if (isLazy())
1111      {
1112        DataLazy* c=new DataLazy(borrowDataPtr(),TAN);
1113        return Data(c);
1114      }
1115    return C_TensorUnaryOperation<double (*)(double)>(*this, ::tan);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::tan);
1116  }  }
1117    
1118  Data  Data
1119  Data::asin() const  Data::asin() const
1120  {  {
1121      if (isLazy())
1122      {
1123        DataLazy* c=new DataLazy(borrowDataPtr(),ASIN);
1124        return Data(c);
1125      }
1126    return C_TensorUnaryOperation<double (*)(double)>(*this, ::asin);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::asin);
1127  }  }
1128    
1129  Data  Data
1130  Data::acos() const  Data::acos() const
1131  {  {
1132      if (isLazy())
1133      {
1134        DataLazy* c=new DataLazy(borrowDataPtr(),ACOS);
1135        return Data(c);
1136      }
1137    return C_TensorUnaryOperation<double (*)(double)>(*this, ::acos);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::acos);
1138  }  }
1139    
# Line 1116  Data::acos() const Line 1141  Data::acos() const
1141  Data  Data
1142  Data::atan() const  Data::atan() const
1143  {  {
1144      if (isLazy())
1145      {
1146        DataLazy* c=new DataLazy(borrowDataPtr(),ATAN);
1147        return Data(c);
1148      }
1149    return C_TensorUnaryOperation<double (*)(double)>(*this, ::atan);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::atan);
1150  }  }
1151    
1152  Data  Data
1153  Data::sinh() const  Data::sinh() const
1154  {  {
1155      return C_TensorUnaryOperation<double (*)(double)>(*this, ::sinh);    if (isLazy())
1156      {
1157        DataLazy* c=new DataLazy(borrowDataPtr(),SINH);
1158        return Data(c);
1159      }
1160      return C_TensorUnaryOperation<double (*)(double)>(*this, ::sinh);
1161  }  }
1162    
1163  Data  Data
1164  Data::cosh() const  Data::cosh() const
1165  {  {
1166      return C_TensorUnaryOperation<double (*)(double)>(*this, ::cosh);    if (isLazy())
1167      {
1168        DataLazy* c=new DataLazy(borrowDataPtr(),COSH);
1169        return Data(c);
1170      }
1171      return C_TensorUnaryOperation<double (*)(double)>(*this, ::cosh);
1172  }  }
1173    
1174  Data  Data
1175  Data::tanh() const  Data::tanh() const
1176  {  {
1177      return C_TensorUnaryOperation<double (*)(double)>(*this, ::tanh);    if (isLazy())
1178      {
1179        DataLazy* c=new DataLazy(borrowDataPtr(),TANH);
1180        return Data(c);
1181      }
1182      return C_TensorUnaryOperation<double (*)(double)>(*this, ::tanh);
1183  }  }
1184    
1185    
# Line 1145  Data::erf() const Line 1189  Data::erf() const
1189  #ifdef _WIN32  #ifdef _WIN32
1190    throw DataException("Error - Data:: erf function is not supported on _WIN32 platforms.");    throw DataException("Error - Data:: erf function is not supported on _WIN32 platforms.");
1191  #else  #else
1192      if (isLazy())
1193      {
1194        DataLazy* c=new DataLazy(borrowDataPtr(),ERF);
1195        return Data(c);
1196      }
1197    return C_TensorUnaryOperation(*this, ::erf);    return C_TensorUnaryOperation(*this, ::erf);
1198  #endif  #endif
1199  }  }
# Line 1152  Data::erf() const Line 1201  Data::erf() const
1201  Data  Data
1202  Data::asinh() const  Data::asinh() const
1203  {  {
1204      if (isLazy())
1205      {
1206        DataLazy* c=new DataLazy(borrowDataPtr(),ASINH);
1207        return Data(c);
1208      }
1209  #ifdef _WIN32  #ifdef _WIN32
1210    return C_TensorUnaryOperation(*this, escript::asinh_substitute);    return C_TensorUnaryOperation(*this, escript::asinh_substitute);
1211  #else  #else
# Line 1162  Data::asinh() const Line 1216  Data::asinh() const
1216  Data  Data
1217  Data::acosh() const  Data::acosh() const
1218  {  {
1219      if (isLazy())
1220      {
1221        DataLazy* c=new DataLazy(borrowDataPtr(),ACOSH);
1222        return Data(c);
1223      }
1224  #ifdef _WIN32  #ifdef _WIN32
1225    return C_TensorUnaryOperation(*this, escript::acosh_substitute);    return C_TensorUnaryOperation(*this, escript::acosh_substitute);
1226  #else  #else
# Line 1172  Data::acosh() const Line 1231  Data::acosh() const
1231  Data  Data
1232  Data::atanh() const  Data::atanh() const
1233  {  {
1234      if (isLazy())
1235      {
1236        DataLazy* c=new DataLazy(borrowDataPtr(),ATANH);
1237        return Data(c);
1238      }
1239  #ifdef _WIN32  #ifdef _WIN32
1240    return C_TensorUnaryOperation(*this, escript::atanh_substitute);    return C_TensorUnaryOperation(*this, escript::atanh_substitute);
1241  #else  #else
# Line 1181  Data::atanh() const Line 1245  Data::atanh() const
1245    
1246  Data  Data
1247  Data::log10() const  Data::log10() const
1248  {  {  if (isLazy())
1249      {
1250        DataLazy* c=new DataLazy(borrowDataPtr(),LOG10);
1251        return Data(c);
1252      }
1253    return C_TensorUnaryOperation<double (*)(double)>(*this, ::log10);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::log10);
1254  }  }
1255    
1256  Data  Data
1257  Data::log() const  Data::log() const
1258  {  {
1259      if (isLazy())
1260      {
1261        DataLazy* c=new DataLazy(borrowDataPtr(),LOG);
1262        return Data(c);
1263      }
1264    return C_TensorUnaryOperation<double (*)(double)>(*this, ::log);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::log);
1265  }  }
1266    
1267  Data  Data
1268  Data::sign() const  Data::sign() const
1269  {  {
1270      if (isLazy())
1271      {
1272        DataLazy* c=new DataLazy(borrowDataPtr(),SIGN);
1273        return Data(c);
1274      }
1275    return C_TensorUnaryOperation(*this, escript::fsign);    return C_TensorUnaryOperation(*this, escript::fsign);
1276  }  }
1277    
1278  Data  Data
1279  Data::abs() const  Data::abs() const
1280  {  {
1281      if (isLazy())
1282      {
1283        DataLazy* c=new DataLazy(borrowDataPtr(),ABS);
1284        return Data(c);
1285      }
1286    return C_TensorUnaryOperation<double (*)(double)>(*this, ::fabs);    return C_TensorUnaryOperation<double (*)(double)>(*this, ::fabs);
1287  }  }
1288    
1289  Data  Data
1290  Data::neg() const  Data::neg() const
1291  {  {
1292      if (isLazy())
1293      {
1294        DataLazy* c=new DataLazy(borrowDataPtr(),NEG);
1295        return Data(c);
1296      }
1297    return C_TensorUnaryOperation(*this, negate<double>());    return C_TensorUnaryOperation(*this, negate<double>());
1298  }  }
1299    
1300  Data  Data
1301  Data::pos() const  Data::pos() const
1302  {  {
1303        // not doing lazy check here is deliberate.
1304        // since a deep copy of lazy data should be cheap, I'll just let it happen now
1305    Data result;    Data result;
1306    // perform a deep copy    // perform a deep copy
1307    result.copy(*this);    result.copy(*this);

Legend:
Removed from v.1885  
changed lines
  Added in v.1886

  ViewVC Help
Powered by ViewVC 1.1.26