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

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

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

revision 1772 by jfenwick, Wed Sep 3 04:56:50 2008 UTC revision 1773 by jfenwick, Tue Sep 9 02:52:26 2008 UTC
# Line 161  DataExpanded::DataExpanded(const Functio Line 161  DataExpanded::DataExpanded(const Functio
161                             const DataTypes::ValueType &data)                             const DataTypes::ValueType &data)
162    : DataAbstract(what,shape)    : DataAbstract(what,shape)
163  {  {
164    //    EsysAssert(data.size()%getNoValues()==0,
165    // create the view of the data                   "DataExpanded Constructor - size of supplied data is not a multiple of shape size.");
166    initialise(what.getNumSamples(),what.getNumDPPSample());  
167    //    if (data.size()==getNoValues())
168    // copy the data in the correct format    {
169    m_data.getData()=data;       ValueType& vec=m_data.getData();
170         //
171         // create the view of the data
172         initialise(what.getNumSamples(),what.getNumDPPSample());
173         // now we copy this value to all elements
174         for (int i=0;i<getLength();)
175         {
176        for (int j=0;j<getNoValues();++j,++i)
177        {
178            vec[i]=data[j];
179        }
180         }
181      }
182      else
183      {
184         //
185         // copy the data in the correct format
186         m_data.getData()=data;
187      }
188    
189    
190  }  }
191    
192  DataExpanded::~DataExpanded()  DataExpanded::~DataExpanded()
# Line 300  DataExpanded::copy(const boost::python:: Line 320  DataExpanded::copy(const boost::python::
320    getVector().copyFromNumArray(value);    getVector().copyFromNumArray(value);
321  }  }
322    
323    
324  void  void
325  DataExpanded::initialise(int noSamples,  DataExpanded::initialise(int noSamples,
326                           int noDataPointsPerSample)                           int noDataPointsPerSample)
# Line 307  DataExpanded::initialise(int noSamples, Line 328  DataExpanded::initialise(int noSamples,
328    //    //
329    // resize data array to the required size    // resize data array to the required size
330    m_data.resize(noSamples,noDataPointsPerSample,getNoValues());    m_data.resize(noSamples,noDataPointsPerSample,getNoValues());
331    
332    //    //
333  //   // create the data view of the data array  //   // create the data view of the data array
334  //   DataArrayView temp(m_data.getData(),shape);  //   DataArrayView temp(m_data.getData(),shape);
# Line 324  DataExpanded::toString() const Line 346  DataExpanded::toString() const
346    //    //
347    // create a temporary view as the offset will be changed    // create a temporary view as the offset will be changed
348  //  DataArrayView tempView(getPointDataView().getData(),getPointDataView().getShape(),getPointDataView().getOffset());  //  DataArrayView tempView(getPointDataView().getData(),getPointDataView().getShape(),getPointDataView().getOffset());
349    
350    int offset=0;    int offset=0;
351    for (int i=0;i<m_data.getNumRows();i++) {    for (int i=0;i<m_data.getNumRows();i++) {
352      for (int j=0;j<m_data.getNumCols();j++) {      for (int j=0;j<m_data.getNumCols();j++) {

Legend:
Removed from v.1772  
changed lines
  Added in v.1773

  ViewVC Help
Powered by ViewVC 1.1.26