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 |
|
|
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 |
|
|
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 |
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 |