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

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

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

revision 2211 by jfenwick, Fri Jan 9 01:28:32 2009 UTC revision 2212 by jfenwick, Wed Jan 14 00:15:00 2009 UTC
# Line 32  using namespace boost::python; Line 32  using namespace boost::python;
32  using namespace boost;  using namespace boost;
33  using namespace escript::DataTypes;  using namespace escript::DataTypes;
34    
35    
36    #define CHECK_FOR_EX_WRITE if (!checkNoSharing()) {throw DataException("Attempt to modify shared object");}
37    
38    // #define CHECK_FOR_EX_WRITE if (!checkNoSharing()) {std::ostringstream ss; ss << " Attempt to modify shared object. line " << __LINE__ << " of " << __FILE__; throw DataException(ss.str());}
39    
40  namespace escript {  namespace escript {
41    
42  DataExpanded::DataExpanded(const WrappedArray& value,  DataExpanded::DataExpanded(const WrappedArray& value,
# Line 200  DataExpanded::setSlice(const DataAbstrac Line 205  DataExpanded::setSlice(const DataAbstrac
205    if (tempDataExp==0) {    if (tempDataExp==0) {
206      throw DataException("Programming error - casting to DataExpanded.");      throw DataException("Programming error - casting to DataExpanded.");
207    }    }
208      CHECK_FOR_EX_WRITE
209    //    //
210    // get shape of slice    // get shape of slice
211    DataTypes::ShapeType shape(DataTypes::getResultSliceShape(region));    DataTypes::ShapeType shape(DataTypes::getResultSliceShape(region));
# Line 339  DataExpanded::getLength() const Line 345  DataExpanded::getLength() const
345    
346  void  void
347  DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value) {  DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value) {
348      CHECK_FOR_EX_WRITE
349    //    //
350    // Get the number of samples and data-points per sample.    // Get the number of samples and data-points per sample.
351    int numSamples = getNumSamples();    int numSamples = getNumSamples();
# Line 391  DataExpanded::copyToDataPoint(const int Line 398  DataExpanded::copyToDataPoint(const int
398    
399  void  void
400  DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const WrappedArray& value) {  DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const WrappedArray& value) {
401      CHECK_FOR_EX_WRITE
402    //    //
403    // Get the number of samples and data-points per sample.    // Get the number of samples and data-points per sample.
404    int numSamples = getNumSamples();    int numSamples = getNumSamples();
# Line 581  void Line 589  void
589  DataExpanded::setToZero(){  DataExpanded::setToZero(){
590  // TODO: Surely there is a more efficient way to do this????  // TODO: Surely there is a more efficient way to do this????
591  // Why is there no memset here? Parallel issues?  // Why is there no memset here? Parallel issues?
592      CHECK_FOR_EX_WRITE
593    int numSamples = getNumSamples();    int numSamples = getNumSamples();
594    int numDataPointsPerSample = getNumDPPSample();    int numDataPointsPerSample = getNumDPPSample();
595    DataTypes::ValueType::size_type n = getNoValues();    DataTypes::ValueType::size_type n = getNoValues();
# Line 697  DataExpanded::setTaggedValue(int tagKey, Line 706  DataExpanded::setTaggedValue(int tagKey,
706                 const DataTypes::ValueType& value,                 const DataTypes::ValueType& value,
707             int dataOffset)             int dataOffset)
708  {  {
709      CHECK_FOR_EX_WRITE
710    int numSamples = getNumSamples();    int numSamples = getNumSamples();
711    int numDataPointsPerSample = getNumDPPSample();    int numDataPointsPerSample = getNumDPPSample();
712    int sampleNo,dataPointNo, i;    int sampleNo,dataPointNo, i;
# Line 723  DataExpanded::setTaggedValue(int tagKey, Line 733  DataExpanded::setTaggedValue(int tagKey,
733  void  void
734  DataExpanded::reorderByReferenceIDs(int *reference_ids)  DataExpanded::reorderByReferenceIDs(int *reference_ids)
735  {  {
736      CHECK_FOR_EX_WRITE
737    int numSamples = getNumSamples();    int numSamples = getNumSamples();
738    DataTypes::ValueType::size_type n = getNoValues() * getNumDPPSample();    DataTypes::ValueType::size_type n = getNoValues() * getNumDPPSample();
739    int sampleNo, sampleNo2,i;    int sampleNo, sampleNo2,i;
# Line 760  DataExpanded::reorderByReferenceIDs(int Line 771  DataExpanded::reorderByReferenceIDs(int
771  DataTypes::ValueType&  DataTypes::ValueType&
772  DataExpanded::getVector()  DataExpanded::getVector()
773  {  {
774        CHECK_FOR_EX_WRITE
775      return m_data.getData();      return m_data.getData();
776  }  }
777    
# Line 769  DataExpanded::getVector() const Line 781  DataExpanded::getVector() const
781      return m_data.getData();      return m_data.getData();
782  }  }
783    
784    const DataTypes::ValueType&
785    DataExpanded::getVectorRO() const
786    {
787        return m_data.getData();
788    }
789    
790    
791  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.2211  
changed lines
  Added in v.2212

  ViewVC Help
Powered by ViewVC 1.1.26