/[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 1942 by jfenwick, Mon Oct 27 06:06:39 2008 UTC revision 1943 by jfenwick, Wed Oct 29 04:05:14 2008 UTC
# Line 120  Data::Data(const Data& inData, Line 120  Data::Data(const Data& inData,
120    {    {
121      throw DataException("Error - will not interpolate for instances of DataEmpty.");      throw DataException("Error - will not interpolate for instances of DataEmpty.");
122    }    }
   if (inData.isLazy())  
   {  
     FORCERESOLVE;  
 //     throw DataException("Error - will not interpolate for instances of DataLazy - yet.");  
   }  
123    if (inData.getFunctionSpace()==functionspace) {    if (inData.getFunctionSpace()==functionspace) {
124      m_data=inData.m_data;      m_data=inData.m_data;
125    }    }
126    else    else
127    {             // this cast is safe for ref count because the class holds a reference    {
128      const DataReady* dr=dynamic_cast<const DataReady*>(inData.m_data.get());  
129      if (inData.isConstant()) {  // for a constant function, we just need to use the new function space      if (inData.isConstant()) {  // for a constant function, we just need to use the new function space
130        if (!inData.probeInterpolation(functionspace))        if (!inData.probeInterpolation(functionspace))
131        {           // Even though this is constant, we still need to check whether interpolation is allowed        {           // Even though this is constant, we still need to check whether interpolation is allowed
132      throw FunctionSpaceException("Call to probeInterpolation returned false for DataConstant.");      throw FunctionSpaceException("Call to probeInterpolation returned false for DataConstant.");
133        }        }
134          // if the data is not lazy, this will just be a cast to DataReady
135          DataReady_ptr dr=inData.m_data->resolve();
136        DataConstant* dc=new DataConstant(functionspace,inData.m_data->getShape(),dr->getVector());          DataConstant* dc=new DataConstant(functionspace,inData.m_data->getShape(),dr->getVector());  
137        m_data=DataAbstract_ptr(dc);        m_data=DataAbstract_ptr(dc);
138      } else {      } else {
# Line 701  Data::interpolate(const FunctionSpace& f Line 698  Data::interpolate(const FunctionSpace& f
698  bool  bool
699  Data::probeInterpolation(const FunctionSpace& functionspace) const  Data::probeInterpolation(const FunctionSpace& functionspace) const
700  {  {
701    if (getFunctionSpace()==functionspace) {    return getFunctionSpace().probeInterpolation(functionspace);
702      return true;  //   if (getFunctionSpace()==functionspace) {
703    } else {  //     return true;
704      const_Domain_ptr domain=getDomain();  //   } else {
705      if  (*domain==*functionspace.getDomain()) {  //     const_Domain_ptr domain=getDomain();
706        return domain->probeInterpolationOnDomain(getFunctionSpace().getTypeCode(),functionspace.getTypeCode());  //     if  (*domain==*functionspace.getDomain()) {
707      } else {  //       return domain->probeInterpolationOnDomain(getFunctionSpace().getTypeCode(),functionspace.getTypeCode());
708        return domain->probeInterpolationACross(getFunctionSpace().getTypeCode(),*(functionspace.getDomain()),functionspace.getTypeCode());  //     } else {
709      }  //       return domain->probeInterpolationACross(getFunctionSpace().getTypeCode(),*(functionspace.getDomain()),functionspace.getTypeCode());
710    }  //     }
711    //   }
712  }  }
713    
714  Data  Data

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

  ViewVC Help
Powered by ViewVC 1.1.26