/[escript]/branches/arrayview_from_1695_trunk/escript/src/DataTagged.cpp
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/escript/src/DataTagged.cpp

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

revision 1720 by jfenwick, Thu Aug 21 04:52:14 2008 UTC revision 1721 by jfenwick, Fri Aug 22 00:39:32 2008 UTC
# Line 296  DataTagged::setTaggedValues(const TagLis Line 296  DataTagged::setTaggedValues(const TagLis
296  void  void
297  DataTagged::setTaggedValue(int tagKey,  DataTagged::setTaggedValue(int tagKey,
298                 const DataTypes::ShapeType& pointshape,                 const DataTypes::ShapeType& pointshape,
299                             const ValueType& value)                             const ValueType& value,
300                   int dataOffset)
301  {  {
302    if (!DataTypes::checkShape(getShape(), pointshape)) {    if (!DataTypes::checkShape(getShape(), pointshape)) {
303        throw DataException(getPointDataView().createShapeErrorMessage(        throw DataException(getPointDataView().createShapeErrorMessage(
# Line 305  DataTagged::setTaggedValue(int tagKey, Line 306  DataTagged::setTaggedValue(int tagKey,
306    DataMapType::iterator pos(m_offsetLookup.find(tagKey));    DataMapType::iterator pos(m_offsetLookup.find(tagKey));
307    if (pos==m_offsetLookup.end()) {    if (pos==m_offsetLookup.end()) {
308      // tag couldn't be found so use addTaggedValue      // tag couldn't be found so use addTaggedValue
309      addTaggedValue(tagKey,pointshape, value);      addTaggedValue(tagKey,pointshape, value, dataOffset);
310    } else {    } else {
311      // copy the values into the data array at the offset determined by m_offsetLookup      // copy the values into the data array at the offset determined by m_offsetLookup
312      int offset=pos->second;      int offset=pos->second;
313      for (int i=0; i<getNoValues(); i++) {      for (int i=0; i<getNoValues(); i++) {
314        m_data[offset+i]=value[i];        m_data[offset+i]=value[i+dataOffset];
315      }      }
316    }    }
317  }  }
# Line 375  DataTagged::addTaggedValues(const TagLis Line 376  DataTagged::addTaggedValues(const TagLis
376  void  void
377  DataTagged::addTaggedValue(int tagKey,  DataTagged::addTaggedValue(int tagKey,
378                 const DataTypes::ShapeType& pointshape,                 const DataTypes::ShapeType& pointshape,
379                             const ValueType& value)                             const ValueType& value,
380                   int dataOffset)
381  {  {
382    if (!DataTypes::checkShape(getShape(), pointshape)) {    if (!DataTypes::checkShape(getShape(), pointshape)) {
383      throw DataException(getPointDataView().createShapeErrorMessage(      throw DataException(getPointDataView().createShapeErrorMessage(
# Line 384  DataTagged::addTaggedValue(int tagKey, Line 386  DataTagged::addTaggedValue(int tagKey,
386    DataMapType::iterator pos(m_offsetLookup.find(tagKey));    DataMapType::iterator pos(m_offsetLookup.find(tagKey));
387    if (pos!=m_offsetLookup.end()) {    if (pos!=m_offsetLookup.end()) {
388      // tag already exists so use setTaggedValue      // tag already exists so use setTaggedValue
389      setTaggedValue(tagKey,pointshape, value);      setTaggedValue(tagKey,pointshape, value, dataOffset);
390    } else {    } else {
391      // save the key and the location of its data in the lookup tab      // save the key and the location of its data in the lookup tab
392      m_offsetLookup.insert(DataMapType::value_type(tagKey,m_data.size()));      m_offsetLookup.insert(DataMapType::value_type(tagKey,m_data.size()));
# Line 399  DataTagged::addTaggedValue(int tagKey, Line 401  DataTagged::addTaggedValue(int tagKey,
401        m_data[i]=m_data_temp[i];        m_data[i]=m_data_temp[i];
402      }      }
403      for (int i=0;i<getNoValues();i++) {      for (int i=0;i<getNoValues();i++) {
404        m_data[oldSize+i]=value[i];        m_data[oldSize+i]=value[i+dataOffset];
405      }      }
406    }    }
407  }  }

Legend:
Removed from v.1720  
changed lines
  Added in v.1721

  ViewVC Help
Powered by ViewVC 1.1.26