/[escript]/trunk/escript/src/Data.cpp
ViewVC logotype

Diff of /trunk/escript/src/Data.cpp

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

revision 1319 by matt, Thu Sep 27 00:27:51 2007 UTC revision 1327 by matt, Fri Oct 12 07:10:40 2007 UTC
# Line 1530  Data::powD(const Data& right) const Line 1530  Data::powD(const Data& right) const
1530  Data  Data
1531  escript::operator+(const Data& left, const Data& right)  escript::operator+(const Data& left, const Data& right)
1532  {  {
1533    Data result;    return C_TensorBinaryOperation(left, right, plus<double>());
   //  
   // perform a deep copy  
   if (left.getDataPointRank()<right.getDataPointRank()) {  
      result.copy(right);  
      result+=left;  
   } else {  
      result.copy(left);  
      result+=right;  
   }  
   return result;  
1534  }  }
1535    
1536  //  //
# Line 1548  escript::operator+(const Data& left, con Line 1538  escript::operator+(const Data& left, con
1538  Data  Data
1539  escript::operator-(const Data& left, const Data& right)  escript::operator-(const Data& left, const Data& right)
1540  {  {
1541    Data result;    return C_TensorBinaryOperation(left, right, minus<double>());
   //  
   // perform a deep copy  
   if (left.getDataPointRank()<right.getDataPointRank()) {  
      result=right.neg();  
      result+=left;  
   } else {  
      result.copy(left);  
      result-=right;  
   }  
   return result;  
1542  }  }
1543    
1544  //  //
# Line 1566  escript::operator-(const Data& left, con Line 1546  escript::operator-(const Data& left, con
1546  Data  Data
1547  escript::operator*(const Data& left, const Data& right)  escript::operator*(const Data& left, const Data& right)
1548  {  {
1549    Data result;    return C_TensorBinaryOperation(left, right, multiplies<double>());
   //  
   // perform a deep copy  
   if (left.getDataPointRank()<right.getDataPointRank()) {  
      result.copy(right);  
      result*=left;  
   } else {  
      result.copy(left);  
      result*=right;  
   }  
   return result;  
1550  }  }
1551    
1552  //  //
# Line 1584  escript::operator*(const Data& left, con Line 1554  escript::operator*(const Data& left, con
1554  Data  Data
1555  escript::operator/(const Data& left, const Data& right)  escript::operator/(const Data& left, const Data& right)
1556  {  {
1557    Data result;    return C_TensorBinaryOperation(left, right, divides<double>());
   //  
   // perform a deep copy  
   if (left.getDataPointRank()<right.getDataPointRank()) {  
      result=right.oneOver();  
      result*=left;  
   } else {  
      result.copy(left);  
      result/=right;  
   }  
   return result;  
1558  }  }
1559    
1560  //  //

Legend:
Removed from v.1319  
changed lines
  Added in v.1327

  ViewVC Help
Powered by ViewVC 1.1.26