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

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

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

revision 495 by jgs, Wed Feb 1 05:15:12 2006 UTC revision 496 by jgs, Tue Feb 7 01:27:14 2006 UTC
# Line 15  Line 15 
15  */  */
16    
17  #include "DataTagged.h"  #include "DataTagged.h"
18    
19  #include "DataConstant.h"  #include "DataConstant.h"
20  #include "DataException.h"  #include "DataException.h"
21    
# Line 204  DataTagged::getTagNumber(int dpno) Line 205  DataTagged::getTagNumber(int dpno)
205      throw DataException("DataTagged::getTagNumber error: no data-points associated with this object.");      throw DataException("DataTagged::getTagNumber error: no data-points associated with this object.");
206    }    }
207    
208    if (dpno<0 || dpno>numDataPoints) {    if (dpno<0 || dpno>numDataPoints-1) {
209      throw DataException("DataTagged::getTagNumber error: invalid data-point number supplied.");      throw DataException("DataTagged::getTagNumber error: invalid data-point number supplied.");
210    }    }
211    
# Line 341  DataTagged::toString() const Line 342  DataTagged::toString() const
342    return temp.str();    return temp.str();
343  }  }
344    
345  DataArrayView  DataArrayView::ValueType::size_type
346  DataTagged::getDataPointByTag(int tag) const  DataTagged::getPointOffset(int sampleNo,
347                               int dataPointNo) const
348  {  {
349    DataMapType::const_iterator pos(m_offsetLookup.find(tag));    int tagKey=getFunctionSpace().getTagFromSampleNo(sampleNo);
350      DataMapType::const_iterator pos(m_offsetLookup.find(tagKey));
351    DataArrayView::ValueType::size_type offset=m_defaultValueOffset;    DataArrayView::ValueType::size_type offset=m_defaultValueOffset;
352    if (pos!=m_offsetLookup.end()) {    if (pos!=m_offsetLookup.end()) {
353      offset=pos->second;      offset=pos->second;
354    }    }
355    DataArrayView temp(getPointDataView());    return offset;
   temp.setOffset(offset);  
   return temp;  
356  }  }
357    
358  DataArrayView::ValueType::size_type  DataArrayView
359  DataTagged::getPointOffset(int sampleNo,  DataTagged::getDataPointByTag(int tag) const
                            int dataPointNo) const  
360  {  {
361    int tagKey=getFunctionSpace().getTagFromSampleNo(sampleNo);    DataMapType::const_iterator pos(m_offsetLookup.find(tag));
   DataMapType::const_iterator pos(m_offsetLookup.find(tagKey));  
362    DataArrayView::ValueType::size_type offset=m_defaultValueOffset;    DataArrayView::ValueType::size_type offset=m_defaultValueOffset;
363    if (pos!=m_offsetLookup.end()) {    if (pos!=m_offsetLookup.end()) {
364      offset=pos->second;      offset=pos->second;
365    }    }
366    return offset;    DataArrayView temp(getPointDataView());
367      temp.setOffset(offset);
368      return temp;
369  }  }
370    
371  DataArrayView  DataArrayView
# Line 376  DataTagged::getDataPoint(int sampleNo, Line 377  DataTagged::getDataPoint(int sampleNo,
377    return getDataPointByTag(tagKey);    return getDataPointByTag(tagKey);
378  }  }
379    
 const DataTagged::DataMapType&  
 DataTagged::getTagLookup() const  
 {  
   return m_offsetLookup;  
 }  
   
 DataArrayView::ValueType::size_type  
 DataTagged::getLength() const  
 {  
   return m_data.size();  
 }  
   
380  int  int
381  DataTagged::archiveData(ofstream& archiveFile,  DataTagged::archiveData(ofstream& archiveFile,
382                          const DataArrayView::ValueType::size_type noValues) const                          const DataArrayView::ValueType::size_type noValues) const

Legend:
Removed from v.495  
changed lines
  Added in v.496

  ViewVC Help
Powered by ViewVC 1.1.26