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

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

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

revision 1942 by jfenwick, Mon Oct 27 06:06:39 2008 UTC revision 1943 by jfenwick, Wed Oct 29 04:05:14 2008 UTC
# Line 124  resultFS(DataAbstract_ptr left, DataAbst Line 124  resultFS(DataAbstract_ptr left, DataAbst
124      // that way, if interpolate is required in any other op we can just throw a      // that way, if interpolate is required in any other op we can just throw a
125      // programming error exception.      // programming error exception.
126    
127      FunctionSpace l=left->getFunctionSpace();
128      if (left->getFunctionSpace()!=right->getFunctionSpace())    FunctionSpace r=right->getFunctionSpace();
129      {    if (l!=r)
130          throw DataException("FunctionSpaces not equal - interpolation not supported on lazy data.");    {
131      }      if (r.probeInterpolation(l))
132      return left->getFunctionSpace();      {
133        return l;
134        }
135        if (l.probeInterpolation(r))
136        {
137        return r;
138        }
139        throw DataException("Cannot interpolate between the FunctionSpaces given for operation "+opToString(op)+".");
140      }
141      return l;
142  }  }
143    
144  // return the shape of the result of "left op right"  // return the shape of the result of "left op right"
# Line 252  DataLazy::DataLazy(DataAbstract_ptr left Line 261  DataLazy::DataLazy(DataAbstract_ptr left
261  }  }
262    
263    
264    // In this constructor we need to consider interpolation
265  DataLazy::DataLazy(DataAbstract_ptr left, DataAbstract_ptr right, ES_optype op)  DataLazy::DataLazy(DataAbstract_ptr left, DataAbstract_ptr right, ES_optype op)
266      : parent(resultFS(left,right,op), resultShape(left,right,op)),      : parent(resultFS(left,right,op), resultShape(left,right,op)),
267      m_op(op)      m_op(op)
# Line 260  DataLazy::DataLazy(DataAbstract_ptr left Line 270  DataLazy::DataLazy(DataAbstract_ptr left
270     {     {
271      throw DataException("Programmer error - constructor DataLazy(left, right, op) will only process BINARY operations.");      throw DataException("Programmer error - constructor DataLazy(left, right, op) will only process BINARY operations.");
272     }     }
273    
274       if (getFunctionSpace()!=left->getFunctionSpace())    // left needs to be interpolated
275       {
276        FunctionSpace fs=getFunctionSpace();
277        Data ltemp(left);
278        Data tmp(ltemp,fs);
279        left=tmp.borrowDataPtr();
280       }
281       if (getFunctionSpace()!=right->getFunctionSpace())   // left needs to be interpolated
282       {
283        Data tmp(Data(right),getFunctionSpace());
284        right=tmp.borrowDataPtr();
285       }
286       left->operandCheck(*right);
287    
288     if (left->isLazy())          // the children need to be DataLazy. Wrap them in IDENTITY if required     if (left->isLazy())          // the children need to be DataLazy. Wrap them in IDENTITY if required
289     {     {
290      m_left=dynamic_pointer_cast<DataLazy>(left);      m_left=dynamic_pointer_cast<DataLazy>(left);

Legend:
Removed from v.1942  
changed lines
  Added in v.1943

  ViewVC Help
Powered by ViewVC 1.1.26