/[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 1802 by jfenwick, Wed Sep 17 06:33:18 2008 UTC revision 1803 by jfenwick, Wed Sep 24 06:20:29 2008 UTC
# Line 109  Data::Data(const Data& inData, Line 109  Data::Data(const Data& inData,
109  Data::Data(const Data& inData,  Data::Data(const Data& inData,
110             const FunctionSpace& functionspace)             const FunctionSpace& functionspace)
111  {  {
112      if (inData.isEmpty())
113      {
114        throw DataException("Error - will not interpolate for instances of DataEmpty.");
115      }
116    if (inData.getFunctionSpace()==functionspace) {    if (inData.getFunctionSpace()==functionspace) {
117      m_data=inData.m_data;      m_data=inData.m_data;
118    } else if (inData.isConstant()) { // for a constant function, we just need to use the new function space    } else if (inData.isConstant()) { // for a constant function, we just need to use the new function space
# Line 438  Data::copy(const Data& other) Line 442  Data::copy(const Data& other)
442  void  void
443  Data::setToZero()  Data::setToZero()
444  {  {
445      if (isEmpty())
446      {
447         throw DataException("Error - Operations not permitted on instances of DataEmpty.");
448      }
449    {    {
450      DataExpanded* temp=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* temp=dynamic_cast<DataExpanded*>(m_data.get());
451      if (temp!=0) {      if (temp!=0) {
# Line 466  void Line 474  void
474  Data::copyWithMask(const Data& other,  Data::copyWithMask(const Data& other,
475                     const Data& mask)                     const Data& mask)
476  {  {
477      if (other.isEmpty() || mask.isEmpty())
478      {
479        throw DataException("Error - copyWithMask not permitted using instances of DataEmpty.");
480      }
481    Data mask1;    Data mask1;
482    Data mask2;    Data mask2;
483    
# Line 631  Data::probeInterpolation(const FunctionS Line 643  Data::probeInterpolation(const FunctionS
643  Data  Data
644  Data::gradOn(const FunctionSpace& functionspace) const  Data::gradOn(const FunctionSpace& functionspace) const
645  {  {
646      if (isEmpty())
647      {
648        throw DataException("Error - operation not permitted on instances of DataEmpty.");
649      }
650    double blocktimer_start = blocktimer_time();    double blocktimer_start = blocktimer_time();
651    if (functionspace.getDomain()!=getDomain())    if (functionspace.getDomain()!=getDomain())
652      throw DataException("Error - gradient cannot be calculated on different domains.");      throw DataException("Error - gradient cannot be calculated on different domains.");
# Line 645  Data::gradOn(const FunctionSpace& functi Line 661  Data::gradOn(const FunctionSpace& functi
661  Data  Data
662  Data::grad() const  Data::grad() const
663  {  {
664      if (isEmpty())
665      {
666        throw DataException("Error - operation not permitted on instances of DataEmpty.");
667      }
668    return gradOn(escript::function(getDomain()));    return gradOn(escript::function(getDomain()));
669  }  }
670    
# Line 660  Data::getLength() const Line 680  Data::getLength() const
680    return m_data->getLength();    return m_data->getLength();
681  }  }
682    
 // const DataTypes::ShapeType&  
 // Data::getDataPointShape() const  
 // {  
 //   return getPointDataView().getShape();  
 // }  
   
   
   
   
683  const  const
684  boost::python::numeric::array  boost::python::numeric::array
685  Data:: getValueOfDataPoint(int dataPointNo)  Data:: getValueOfDataPoint(int dataPointNo)
# Line 1551  Data::calc_minGlobalDataPoint(int& ProcN Line 1562  Data::calc_minGlobalDataPoint(int& ProcN
1562  void  void
1563  Data::saveDX(std::string fileName) const  Data::saveDX(std::string fileName) const
1564  {  {
1565      if (isEmpty())
1566      {
1567        throw DataException("Error - Operations not permitted on instances of DataEmpty.");
1568      }
1569    boost::python::dict args;    boost::python::dict args;
1570    args["data"]=boost::python::object(this);    args["data"]=boost::python::object(this);
1571    getDomain().saveDX(fileName,args);    getDomain().saveDX(fileName,args);
# Line 1560  Data::saveDX(std::string fileName) const Line 1575  Data::saveDX(std::string fileName) const
1575  void  void
1576  Data::saveVTK(std::string fileName) const  Data::saveVTK(std::string fileName) const
1577  {  {
1578      if (isEmpty())
1579      {
1580        throw DataException("Error - Operations not permitted on instances of DataEmpty.");
1581      }
1582    boost::python::dict args;    boost::python::dict args;
1583    args["data"]=boost::python::object(this);    args["data"]=boost::python::object(this);
1584    getDomain().saveVTK(fileName,args);    getDomain().saveVTK(fileName,args);
# Line 1979  Data::setTaggedValueFromCPP(int tagKey, Line 1998  Data::setTaggedValueFromCPP(int tagKey,
1998  int  int
1999  Data::getTagNumber(int dpno)  Data::getTagNumber(int dpno)
2000  {  {
2001      if (isEmpty())
2002      {
2003        throw DataException("Error - operation not permitted on instances of DataEmpty.");
2004      }
2005    return getFunctionSpace().getTagFromDataPointNo(dpno);    return getFunctionSpace().getTagFromDataPointNo(dpno);
2006  }  }
2007    

Legend:
Removed from v.1802  
changed lines
  Added in v.1803

  ViewVC Help
Powered by ViewVC 1.1.26