/[escript]/trunk/escript/src/DataArray.cpp
ViewVC logotype

Diff of /trunk/escript/src/DataArray.cpp

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

revision 121 by jgs, Fri May 6 04:26:16 2005 UTC revision 151 by jgs, Thu Sep 22 01:55:00 2005 UTC
# Line 24  namespace escript { Line 24  namespace escript {
24    
25  DataArray::DataArray(double value)  DataArray::DataArray(double value)
26  {  {
27      m_data.resize(1,value);      m_data.resize(1,value,1);
28      // create a view with an empty shape, a scalar.      // create a view with an empty shape, a scalar.
29      m_dataView.reset(new DataArrayView(m_data,DataArrayView::ShapeType()));      m_dataView.reset(new DataArrayView(m_data,DataArrayView::ShapeType()));
30  }  }
# Line 32  DataArray::DataArray(double value) Line 32  DataArray::DataArray(double value)
32  DataArray::DataArray(const DataArrayView::ShapeType& shape,  DataArray::DataArray(const DataArrayView::ShapeType& shape,
33                       double value)                       double value)
34  {  {
35      m_data.resize(DataArrayView::noValues(shape),value);      int len = DataArrayView::noValues(shape);
36        m_data.resize(len,value,len);
37      m_dataView.reset(new DataArrayView(m_data,shape));      m_dataView.reset(new DataArrayView(m_data,shape));
38  }  }
39    
# Line 69  DataArray::initialise(const boost::pytho Line 70  DataArray::initialise(const boost::pytho
70        tempShape.push_back(extract<int>(value.getshape()[i]));        tempShape.push_back(extract<int>(value.getshape()[i]));
71      }      }
72      // allocate the space for the data vector      // allocate the space for the data vector
73      m_data.resize(DataArrayView::noValues(tempShape));      int len = DataArrayView::noValues(tempShape);
74        m_data.resize(len,0.,len);
75      // create a view with the same shape      // create a view with the same shape
76      m_dataView.reset(new DataArrayView(m_data,tempShape));      m_dataView.reset(new DataArrayView(m_data,tempShape));
77      // fill the data vector with the values from the numarray      // fill the data vector with the values from the numarray

Legend:
Removed from v.121  
changed lines
  Added in v.151

  ViewVC Help
Powered by ViewVC 1.1.26