/[escript]/branches/more_shared_ptrs_from_1812/escript/src/Data.h
ViewVC logotype

Diff of /branches/more_shared_ptrs_from_1812/escript/src/Data.h

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

revision 558 by jgs, Tue Feb 21 01:23:23 2006 UTC revision 559 by jgs, Thu Feb 23 01:43:44 2006 UTC
# Line 1482  inline Line 1482  inline
1482  Data  Data
1483  Data::dp_algorithm(BinaryFunction operation, double initial_value) const  Data::dp_algorithm(BinaryFunction operation, double initial_value) const
1484  {  {
   Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());  
1485    if (isExpanded()) {    if (isExpanded()) {
1486        Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1487      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());
1488      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
1489      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");
1490      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");
1491      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);
1492        return result;
1493    } else if (isTagged()) {    } else if (isTagged()) {
1494      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
1495        DataTagged::TagListType keys;
1496        DataTagged::DataMapType::const_iterator i;
1497        for (i=dataT->getTagLookup().begin();i!=dataT->getTagLookup().end();i++) {
1498          keys.push_back(i->first);
1499        }
1500        DataArrayView::ShapeType viewShape;
1501        DataArrayView::ValueType viewData(1);
1502        viewData[0]=0;
1503        DataArrayView defaultValue(viewData,viewShape);
1504        DataTagged::ValueListType values;
1505        values.push_back(defaultValue);
1506        Data result(keys,values,defaultValue,getFunctionSpace());
1507      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());
1508      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");
1509      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");
1510      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);
1511        return result;
1512    } else if (isConstant()) {    } else if (isConstant()) {
1513        Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1514      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
1515      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
1516      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");
1517      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");
1518      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);
1519        return result;
1520    }    }
1521    return result;    Data falseRetVal; // to keep compiler quiet
1522      return falseRetVal;
1523  }  }
1524    
1525  }  }

Legend:
Removed from v.558  
changed lines
  Added in v.559

  ViewVC Help
Powered by ViewVC 1.1.26