/[escript]/branches/schroedinger/escript/src/BinaryOp.h
ViewVC logotype

Diff of /branches/schroedinger/escript/src/BinaryOp.h

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

revision 1863 by jfenwick, Wed Oct 8 00:28:28 2008 UTC revision 1864 by jfenwick, Thu Oct 9 03:09:30 2008 UTC
# Line 65  inline void binaryOp(DataTagged& left, c Line 65  inline void binaryOp(DataTagged& left, c
65    }    }
66  }  }
67    
 // template <class BinaryFunction>  
 // inline void binaryOp(DataTagged& left, const DataArrayView& right,  
 //           BinaryFunction operation)  
 // {  
 //   //  
 //   // perform the operation on each tagged value  
 //   const DataTagged::DataMapType& lookup=left.getTagLookup();  
 //   DataTagged::DataMapType::const_iterator i;  
 //   DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();  
 //   DataArrayView& leftView=left.getPointDataView();  
 //   if (right.getRank()==0) {  
 //     for (i=lookup.begin();i!=lookupEnd;i++) {  
 //       leftView.binaryOp(i->second,right(),operation);  
 //     }  
 //   } else {  
 //     for (i=lookup.begin();i!=lookupEnd;i++) {  
 //       leftView.binaryOp(i->second,right,right.getOffset(),operation);  
 //     }  
 //   }  
 //   //  
 //   // finally perform the operation on the default value  
 //   if (right.getRank()==0) {  
 //     left.getDefaultValue().binaryOp(0,right(),operation);  
 //   } else {  
 //     left.getDefaultValue().binaryOp(right,operation);  
 //   }  
 // }  
   
68  /**  /**
69     \brief apply the binary op to each value in left and the single value right.     \brief apply the binary op to each value in left and the single value right.
70    
# Line 186  template <class BinaryFunction> Line 158  template <class BinaryFunction>
158  inline void binaryOp(DataConstant& left, const DataConstant& right,  inline void binaryOp(DataConstant& left, const DataConstant& right,
159               BinaryFunction operation)               BinaryFunction operation)
160  {  {
   //  
   // As DataConstant there is only one point data  
 //  binaryOp(left,right.getPointDataView(),operation);  
161    
162    DataMaths::binaryOp(left.getVector(), left.getShape(),0, right.getVector(),right.getShape(),0,operation);    DataMaths::binaryOp(left.getVector(), left.getShape(),0, right.getVector(),right.getShape(),0,operation);
163    
164  }  }
165    
 // template <class BinaryFunction>  
 // inline void binaryOp(DataConstant& left, const DataArrayView& right,  
 //           BinaryFunction operation)  
 // {  
 //   //  
 //   // perform an operand check, this will throw on error  
 //   if (right.getRank()==0) {  
 //     //  
 //     // special case of applying a single value to the entire array  
 //     left.getPointDataView().binaryOp(right(),operation);  
 //   } else {  
 //     left.getPointDataView().binaryOp(right,operation);  
 //   }  
 // }  
166    
167    
168  template <class BinaryFunction>  template <class BinaryFunction>
169  inline void binaryOp(DataExpanded& left, const DataAbstract& right,  inline void binaryOp(DataExpanded& left, const DataReady& right,
170               BinaryFunction operation)               BinaryFunction operation)
171  {  {
172    int i,j;    int i,j;
# Line 246  inline void binaryOp(DataExpanded& left, Line 201  inline void binaryOp(DataExpanded& left,
201    }    }
202  }  }
203    
 // template <class BinaryFunction>  
 // inline void binaryOp(DataExpanded& left, const DataArrayView& right,  
 //           BinaryFunction operation)  
 // {  
 //   int i,j;  
 //   DataTypes::ValueType::size_type numDPPSample=left.getNumDPPSample();  
 //   DataTypes::ValueType::size_type numSamples=left.getNumSamples();  
 //   if (right.getRank()==0) {  
 //     //  
 //     // This will call the double version of binaryOp  
 //     #pragma omp parallel for private(i,j) schedule(static)  
 //     for (i=0;i<numSamples;i++) {  
 //        for (j=0;j<numDPPSample;j++) {  
 //  left.getPointDataView().binaryOp(left.getPointOffset(i,j),  
 //                   right(),  
 //                                          operation);  
 //       }  
 //     }  
 //   } else {  
 //     #pragma omp parallel for private(i,j) schedule(static)  
 //     for (i=0;i<numSamples;i++) {  
 //       for (j=0;j<numDPPSample;j++) {  
 //  left.getPointDataView().binaryOp(left.getPointOffset(i,j),  
 //                   right,  
 //                                          0,  
 //                   operation);  
 //       }  
 //     }  
 //   }  
 // }  
204    
205  } // end of namespace  } // end of namespace
206    

Legend:
Removed from v.1863  
changed lines
  Added in v.1864

  ViewVC Help
Powered by ViewVC 1.1.26