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

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

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

revision 2085 by jfenwick, Mon Nov 24 00:45:48 2008 UTC revision 2086 by jfenwick, Mon Nov 24 02:38:50 2008 UTC
# Line 33  extern "C" { Line 33  extern "C" {
33  #include <algorithm>  #include <algorithm>
34  #include <vector>  #include <vector>
35  #include <functional>  #include <functional>
36    #include <sstream>  // so we can throw messages about ranks
37    
38  #include <boost/python/dict.hpp>  #include <boost/python/dict.hpp>
39  #include <boost/python/extract.hpp>  #include <boost/python/extract.hpp>
# Line 176  Data::Data(const numeric::array& value, Line 177  Data::Data(const numeric::array& value,
177    initialise(value,what,expanded);    initialise(value,what,expanded);
178    m_protected=false;    m_protected=false;
179  }  }
 /*  
 Data::Data(const DataArrayView& value,  
        const FunctionSpace& what,  
            bool expanded)  
 {  
   initialise(value,what,expanded);  
   m_protected=false;  
 }*/  
180    
181  Data::Data(const DataTypes::ValueType& value,  Data::Data(const DataTypes::ValueType& value,
182           const DataTypes::ShapeType& shape,           const DataTypes::ShapeType& shape,
# Line 212  Data::Data(const object& value, Line 205  Data::Data(const object& value,
205    
206    // extract the shape of the numarray    // extract the shape of the numarray
207    DataTypes::ShapeType tempShape=DataTypes::shapeFromNumArray(asNumArray);    DataTypes::ShapeType tempShape=DataTypes::shapeFromNumArray(asNumArray);
208  // /*  for (int i=0; i < asNumArray.getrank(); i++) {    if (DataTypes::getRank(tempShape)==0) {
 //     tempShape.push_back(extract<int>(asNumArray.getshape()[i]));  
 //   }*/  
 //   // get the space for the data vector  
 //   int len = DataTypes::noValues(tempShape);  
 //   DataVector temp_data(len, 0.0, len);  
 // /*  DataArrayView temp_dataView(temp_data, tempShape);  
 //   temp_dataView.copy(asNumArray);*/  
 //   temp_data.copyFromNumArray(asNumArray);  
   
   //  
   // Create DataConstant using the given value and all other parameters  
   // copied from other. If value is a rank 0 object this Data  
   // will assume the point data shape of other.  
   
   if (DataTypes::getRank(tempShape)/*temp_dataView.getRank()*/==0) {  
209    
210    
211      // get the space for the data vector      // get the space for the data vector
# Line 238  Data::Data(const object& value, Line 216  Data::Data(const object& value,
216      int len = DataTypes::noValues(other.getDataPointShape());      int len = DataTypes::noValues(other.getDataPointShape());
217    
218      DataVector temp2_data(len, temp_data[0]/*temp_dataView()*/, len);      DataVector temp2_data(len, temp_data[0]/*temp_dataView()*/, len);
     //DataArrayView temp2_dataView(temp2_data, other.getPointDataView().getShape());  
 //     initialise(temp2_dataView, other.getFunctionSpace(), false);  
   
219      DataConstant* t=new DataConstant(other.getFunctionSpace(),other.getDataPointShape(),temp2_data);      DataConstant* t=new DataConstant(other.getFunctionSpace(),other.getDataPointShape(),temp2_data);
 //     boost::shared_ptr<DataAbstract> sp(t);  
 //     m_data=sp;  
220      m_data=DataAbstract_ptr(t);      m_data=DataAbstract_ptr(t);
221    
222    } else {    } else {
223      //      //
224      // Create a DataConstant with the same sample shape as other      // Create a DataConstant with the same sample shape as other
 //     initialise(temp_dataView, other.getFunctionSpace(), false);  
225      DataConstant* t=new DataConstant(asNumArray,other.getFunctionSpace());      DataConstant* t=new DataConstant(asNumArray,other.getFunctionSpace());
226  //     boost::shared_ptr<DataAbstract> sp(t);  //     boost::shared_ptr<DataAbstract> sp(t);
227  //     m_data=sp;  //     m_data=sp;
# Line 2594  escript::C_GeneralTensorProduct(Data& ar Line 2566  escript::C_GeneralTensorProduct(Data& ar
2566       for (int i=axis_offset; i<rank1; i++, ++out_index)   { shape2[out_index]=tmpShape1[i]; } // Last part of arg_1_Z       for (int i=axis_offset; i<rank1; i++, ++out_index)   { shape2[out_index]=tmpShape1[i]; } // Last part of arg_1_Z
2567    }    }
2568    
2569      if (shape2.size()>ESCRIPT_MAX_DATA_RANK)
2570      {
2571         ostringstream os;
2572         os << "C_GeneralTensorProduct: Error - Attempt to create a rank " << shape2.size() << " object. The maximum rank is " << ESCRIPT_MAX_DATA_RANK << ".";
2573         throw DataException(os.str());
2574      }
2575    
2576    // Declare output Data object    // Declare output Data object
2577    Data res;    Data res;
2578    

Legend:
Removed from v.2085  
changed lines
  Added in v.2086

  ViewVC Help
Powered by ViewVC 1.1.26