/[escript]/trunk-mpi-branch/escript/src/BinaryOp.h
ViewVC logotype

Diff of /trunk-mpi-branch/escript/src/BinaryOp.h

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

revision 121 by jgs, Fri May 6 04:26:16 2005 UTC revision 122 by jgs, Thu Jun 9 05:38:05 2005 UTC
# Line 53  inline void binaryOp(DataTagged& left, c Line 53  inline void binaryOp(DataTagged& left, c
53    DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();    DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();
54    DataArrayView& leftView=left.getPointDataView();    DataArrayView& leftView=left.getPointDataView();
55    if (right.getRank()==0) {    if (right.getRank()==0) {
56      for (i=lookup.begin();i!=lookupEnd;++i) {      for (i=lookup.begin();i!=lookupEnd;i++) {
57        leftView.binaryOp(i->second,right(),operation);        leftView.binaryOp(i->second,right(),operation);
58      }      }
59    } else {    } else {
60      for (i=lookup.begin();i!=lookupEnd;++i) {      for (i=lookup.begin();i!=lookupEnd;i++) {
61        leftView.binaryOp(i->second,right,right.getOffset(),operation);        leftView.binaryOp(i->second,right,right.getOffset(),operation);
62      }      }
63    }    }
# Line 75  inline void binaryOp(DataTagged& left, c Line 75  inline void binaryOp(DataTagged& left, c
75    const DataTagged::DataMapType& rightLookup=right.getTagLookup();    const DataTagged::DataMapType& rightLookup=right.getTagLookup();
76    DataTagged::DataMapType::const_iterator i;    DataTagged::DataMapType::const_iterator i;
77    DataTagged::DataMapType::const_iterator rightLookupEnd=rightLookup.end();    DataTagged::DataMapType::const_iterator rightLookupEnd=rightLookup.end();
78    for (i=rightLookup.begin();i!=rightLookupEnd;++i) {    for (i=rightLookup.begin();i!=rightLookupEnd;i++) {
79      //      //
80      // Add the right hand tag to the left hand tag list and assign      // Add the right hand tag to the left hand tag list and assign
81      // the rights default value. If the tag already exists the      // the rights default value. If the tag already exists the
# Line 87  inline void binaryOp(DataTagged& left, c Line 87  inline void binaryOp(DataTagged& left, c
87    // the right hand side will use the right's default value as the right operand    // the right hand side will use the right's default value as the right operand
88    const DataTagged::DataMapType& leftLookup=left.getTagLookup();    const DataTagged::DataMapType& leftLookup=left.getTagLookup();
89    DataTagged::DataMapType::const_iterator leftLookupEnd=leftLookup.end();    DataTagged::DataMapType::const_iterator leftLookupEnd=leftLookup.end();
90    for (i=leftLookup.begin();i!=leftLookupEnd;++i) {    for (i=leftLookup.begin();i!=leftLookupEnd;i++) {
91      left.getDataPointByTag(i->first).binaryOp(right.getDataPointByTag(i->first),      left.getDataPointByTag(i->first).binaryOp(right.getDataPointByTag(i->first),operation);
                           operation);  
92    }    }
93    //    //
94    // finally perform the operation on the default value    // finally perform the operation on the default value
# Line 114  inline void binaryOp(DataConstant& left, Line 113  inline void binaryOp(DataConstant& left,
113    if (right.getRank()==0) {    if (right.getRank()==0) {
114      //      //
115      // special case of applying a single value to the entire array      // special case of applying a single value to the entire array
116      left.getPointDataView().binaryOp(right(), operation);      left.getPointDataView().binaryOp(right(),operation);
117    } else {    } else {
118      left.getPointDataView().binaryOp(right, operation);      left.getPointDataView().binaryOp(right,operation);
119    }    }
120  }  }
121    
# Line 130  inline void binaryOp(DataExpanded& left, Line 129  inline void binaryOp(DataExpanded& left,
129    if (right.getPointDataView().getRank()==0) {    if (right.getPointDataView().getRank()==0) {
130      //      //
131      // This will call the double version of binaryOp      // This will call the double version of binaryOp
132  #pragma omp parallel for private(i,j) schedule(static)      #pragma omp parallel for private(i,j) schedule(static)
133      for (i=0;i<numSamples;++i) {      for (i=0;i<numSamples;i++) {
134        for (j=0;j<numDPPSample;++j) {        for (j=0;j<numDPPSample;j++) {
135      left.getPointDataView().binaryOp(left.getPointOffset(i,j),      left.getPointDataView().binaryOp(left.getPointOffset(i,j),
136                       right.getPointDataView().getData(right.getPointOffset(i,j)),operation);                       right.getPointDataView().getData(right.getPointOffset(i,j)),
137                                             operation);
138        }        }
139      }      }
140    } else {    } else {
141  #pragma omp parallel for private(i,j) schedule(static)      #pragma omp parallel for private(i,j) schedule(static)
142      for (i=0;i<numSamples;++i) {      for (i=0;i<numSamples;i++) {
143        for (j=0;j<numDPPSample;++j) {        for (j=0;j<numDPPSample;j++) {
144      left.getPointDataView().binaryOp(left.getPointOffset(i,j),      left.getPointDataView().binaryOp(left.getPointOffset(i,j),
145                       right.getPointDataView(),                       right.getPointDataView(),
146                       right.getPointOffset(i,j),                       right.getPointOffset(i,j),
# Line 160  inline void binaryOp(DataExpanded& left, Line 160  inline void binaryOp(DataExpanded& left,
160    if (right.getRank()==0) {    if (right.getRank()==0) {
161      //      //
162      // This will call the double version of binaryOp      // This will call the double version of binaryOp
163  #pragma omp parallel for private(i,j) schedule(static)      #pragma omp parallel for private(i,j) schedule(static)
164       for (i=0;i<numSamples;++i) {      for (i=0;i<numSamples;i++) {
165         for (j=0;j<numDPPSample;++j) {         for (j=0;j<numDPPSample;j++) {
166      left.getPointDataView().binaryOp(left.getPointOffset(i,j),      left.getPointDataView().binaryOp(left.getPointOffset(i,j),
167                       right(),operation);                       right(),
168                                             operation);
169        }        }
170      }      }
171    } else {    } else {
172  #pragma omp parallel for private(i,j) schedule(static)      #pragma omp parallel for private(i,j) schedule(static)
173      for (i=0;i<numSamples;++i) {      for (i=0;i<numSamples;i++) {
174        for (j=0;j<numDPPSample;++j) {        for (j=0;j<numDPPSample;j++) {
175      left.getPointDataView().binaryOp(left.getPointOffset(i,j),      left.getPointDataView().binaryOp(left.getPointOffset(i,j),
176                       right,0,                       right,
177                                             0,
178                       operation);                       operation);
179        }        }
180      }      }
# Line 180  inline void binaryOp(DataExpanded& left, Line 182  inline void binaryOp(DataExpanded& left,
182  }  }
183    
184  } // end of namespace  } // end of namespace
185    
186  #endif  #endif

Legend:
Removed from v.121  
changed lines
  Added in v.122

  ViewVC Help
Powered by ViewVC 1.1.26