/[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 1723 by jfenwick, Fri Aug 22 00:39:32 2008 UTC revision 1724 by jfenwick, Mon Aug 25 05:38:57 2008 UTC
# Line 234  DataTagged::setSlice(const DataAbstract* Line 234  DataTagged::setSlice(const DataAbstract*
234      throw DataException("Error - Invalid slice region.");      throw DataException("Error - Invalid slice region.");
235    }    }
236    if (otherTemp->getPointDataView().getRank()>0 && !other->getPointDataView().checkShape(regionShape)) {    if (otherTemp->getPointDataView().getRank()>0 && !other->getPointDataView().checkShape(regionShape)) {
237      throw DataException (other->getPointDataView().createShapeErrorMessage(      throw DataException (DataTypes::createShapeErrorMessage(
238                           "Error - Couldn't copy slice due to shape mismatch.",regionShape));                           "Error - Couldn't copy slice due to shape mismatch.",regionShape,other->getShape()));
239    }    }
240    
241    // copy slice from other default value to this default value    // copy slice from other default value to this default value
# Line 300  DataTagged::setTaggedValue(int tagKey, Line 300  DataTagged::setTaggedValue(int tagKey,
300                 int dataOffset)                 int dataOffset)
301  {  {
302    if (!DataTypes::checkShape(getShape(), pointshape)) {    if (!DataTypes::checkShape(getShape(), pointshape)) {
303        throw DataException(getPointDataView().createShapeErrorMessage(        throw DataException(DataTypes::createShapeErrorMessage(
304                            "Error - Cannot setTaggedValue due to shape mismatch.", pointshape));                            "Error - Cannot setTaggedValue due to shape mismatch.", pointshape,getShape()));
305    }    }
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()) {
# Line 323  DataTagged::setTaggedValue(int tagKey, Line 323  DataTagged::setTaggedValue(int tagKey,
323                             const DataArrayView& value)                             const DataArrayView& value)
324  {  {
325    if (!getPointDataView().checkShape(value.getShape())) {    if (!getPointDataView().checkShape(value.getShape())) {
326        throw DataException(getPointDataView().createShapeErrorMessage(        throw DataException(DataTypes::createShapeErrorMessage(
327                            "Error - Cannot setTaggedValue due to shape mismatch.", value.getShape()));                            "Error - Cannot setTaggedValue due to shape mismatch.", value.getShape(),getShape()));
328    }    }
329    DataMapType::iterator pos(m_offsetLookup.find(tagKey));    DataMapType::iterator pos(m_offsetLookup.find(tagKey));
330    if (pos==m_offsetLookup.end()) {    if (pos==m_offsetLookup.end()) {
# Line 380  DataTagged::addTaggedValue(int tagKey, Line 380  DataTagged::addTaggedValue(int tagKey,
380                 int dataOffset)                 int dataOffset)
381  {  {
382    if (!DataTypes::checkShape(getShape(), pointshape)) {    if (!DataTypes::checkShape(getShape(), pointshape)) {
383      throw DataException(getPointDataView().createShapeErrorMessage(      throw DataException(DataTypes::createShapeErrorMessage(
384                          "Error - Cannot addTaggedValue due to shape mismatch.", pointshape));                          "Error - Cannot addTaggedValue due to shape mismatch.", pointshape,getShape()));
385    }    }
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()) {
# Line 414  DataTagged::addTaggedValue(int tagKey, Line 414  DataTagged::addTaggedValue(int tagKey,
414                             const DataArrayView& value)                             const DataArrayView& value)
415  {  {
416    if (!getPointDataView().checkShape(value.getShape())) {    if (!getPointDataView().checkShape(value.getShape())) {
417      throw DataException(getPointDataView().createShapeErrorMessage(      throw DataException(DataTypes::createShapeErrorMessage(
418                          "Error - Cannot addTaggedValue due to shape mismatch.", value.getShape()));                          "Error - Cannot addTaggedValue due to shape mismatch.", value.getShape(),getShape()));
419    }    }
420    DataMapType::iterator pos(m_offsetLookup.find(tagKey));    DataMapType::iterator pos(m_offsetLookup.find(tagKey));
421    if (pos!=m_offsetLookup.end()) {    if (pos!=m_offsetLookup.end()) {
# Line 525  DataTagged::getDataPointByTag(int tag) c Line 525  DataTagged::getDataPointByTag(int tag) c
525  }  }
526    
527    
528    
529    DataTypes::ValueType::size_type
530    DataTagged::getOffsetForTag(int tag) const
531    {
532      DataMapType::const_iterator pos(m_offsetLookup.find(tag));
533      DataTypes::ValueType::size_type offset=m_defaultValueOffset;
534      if (pos!=m_offsetLookup.end()) {
535        offset=pos->second;
536      }
537      return offset;
538    }
539    
540  DataTypes::ValueType::const_reference  DataTypes::ValueType::const_reference
541  DataTagged::getDataByTag(int tag, DataTypes::ValueType::size_type i) const  DataTagged::getDataByTag(int tag, DataTypes::ValueType::size_type i) const
542  {  {
# Line 816  DataTagged::dump(const std::string fileN Line 828  DataTagged::dump(const std::string fileN
828     throw DataException("Error - DataTagged:: dump is not configured with netCDF. Please contact your installation manager.");     throw DataException("Error - DataTagged:: dump is not configured with netCDF. Please contact your installation manager.");
829     #endif     #endif
830  }  }
831    
832    DataTypes::ValueType&
833    DataTagged::getVector()
834    {
835        return m_data;
836    }
837    
838    const DataTypes::ValueType&
839    DataTagged::getVector() const
840    {
841        return m_data;
842    }
843    
844  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.1723  
changed lines
  Added in v.1724

  ViewVC Help
Powered by ViewVC 1.1.26