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

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

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

revision 2105 by jfenwick, Fri Nov 28 01:52:12 2008 UTC revision 2271 by jfenwick, Mon Feb 16 05:08:29 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__; *((int*)0)=17;throw DataException(ss.str());}
39    
40  namespace escript {  namespace escript {
41    
42  DataExpanded::DataExpanded(const boost::python::numeric::array& value,  DataExpanded::DataExpanded(const WrappedArray& value,
43                             const FunctionSpace& what)                             const FunctionSpace& what)
44    : parent(what,DataTypes::shapeFromNumArray(value))    : parent(what,value.getShape())
45  {  {
46    //    //
47    // initialise the data array for this object    // initialise the data array for this object
# Line 79  DataExpanded::DataExpanded(const DataTag Line 84  DataExpanded::DataExpanded(const DataTag
84    for (i=0;i<numRows;i++) {    for (i=0;i<numRows;i++) {
85      for (j=0;j<numCols;j++) {      for (j=0;j<numCols;j++) {
86        try {        try {
87             DataTypes::copyPoint(getVector(), getPointOffset(i,j), getNoValues(),             DataTypes::copyPoint(getVectorRW(), getPointOffset(i,j), getNoValues(),
88                                  other.getVector(),                                  other.getVectorRO(),
89                                  other.getPointOffset(i,j));                                  other.getPointOffset(i,j));
90        }        }
91        catch (std::exception& e) {        catch (std::exception& e) {
# Line 110  DataExpanded::DataExpanded(const DataExp Line 115  DataExpanded::DataExpanded(const DataExp
115    for (i=0;i<numRows;i++) {    for (i=0;i<numRows;i++) {
116      for (j=0;j<numCols;j++) {      for (j=0;j<numCols;j++) {
117        try {        try {
118  //         getPointDataView().copySlice(getPointOffset(i,j),          DataTypes::copySlice(getVectorRW(),getShape(),getPointOffset(i,j),
119  //                                      other.getPointDataView(),                                       other.getVectorRO(),
 //                                      other.getPointOffset(i,j),  
 //                                      region_loop_range);  
         DataTypes::copySlice(getVector(),getShape(),getPointOffset(i,j),  
                                      other.getVector(),  
120                       other.getShape(),                       other.getShape(),
121                                       other.getPointOffset(i,j),                                       other.getPointOffset(i,j),
122                                       region_loop_range);                                       region_loop_range);
# Line 127  DataExpanded::DataExpanded(const DataExp Line 128  DataExpanded::DataExpanded(const DataExp
128    }    }
129  }  }
130    
 // DataExpanded::DataExpanded(const DataArrayView& value,  
 //                            const FunctionSpace& what)  
 //   : DataAbstract(what)  
 // {  
 //   //  
 //   // get the shape of the given data value  
 //   DataTypes::ShapeType tempShape=value.getShape();  
 //   //  
 //   // initialise this Data object to the shape of the given data value  
 //   initialise(tempShape,what.getNumSamples(),what.getNumDPPSample());  
 //   //  
 //   // copy the given value to every data point  
 //   copy(value);  
 // }  
   
131  DataExpanded::DataExpanded(const FunctionSpace& what,  DataExpanded::DataExpanded(const FunctionSpace& what,
132                             const DataTypes::ShapeType &shape,                             const DataTypes::ShapeType &shape,
133                             const DataTypes::ValueType &data)                             const DataTypes::ValueType &data)
# Line 200  DataExpanded::setSlice(const DataAbstrac Line 186  DataExpanded::setSlice(const DataAbstrac
186    if (tempDataExp==0) {    if (tempDataExp==0) {
187      throw DataException("Programming error - casting to DataExpanded.");      throw DataException("Programming error - casting to DataExpanded.");
188    }    }
189      CHECK_FOR_EX_WRITE
190    //    //
191    // get shape of slice    // get shape of slice
192    DataTypes::ShapeType shape(DataTypes::getResultSliceShape(region));    DataTypes::ShapeType shape(DataTypes::getResultSliceShape(region));
# Line 218  DataExpanded::setSlice(const DataAbstrac Line 205  DataExpanded::setSlice(const DataAbstrac
205    DataTypes::ValueType::size_type numRows=m_data.getNumRows();    DataTypes::ValueType::size_type numRows=m_data.getNumRows();
206    DataTypes::ValueType::size_type numCols=m_data.getNumCols();    DataTypes::ValueType::size_type numCols=m_data.getNumCols();
207    int i, j;    int i, j;
208    ValueType& vec=getVector();    ValueType& vec=getVectorRW();
209    const ShapeType& mshape=getShape();    const ShapeType& mshape=getShape();
210    const ValueType& tVec=tempDataExp->getVector();    const ValueType& tVec=tempDataExp->getVectorRO();
211    const ShapeType& tShape=tempDataExp->getShape();    const ShapeType& tShape=tempDataExp->getShape();
212    #pragma omp parallel for private(i,j) schedule(static)    #pragma omp parallel for private(i,j) schedule(static)
213    for (i=0;i<numRows;i++) {    for (i=0;i<numRows;i++) {
214      for (j=0;j<numCols;j++) {      for (j=0;j<numCols;j++) {
 /*      getPointDataView().copySliceFrom(getPointOffset(i,j),  
                                        tempDataExp->getPointDataView(),  
                                        tempDataExp->getPointOffset(i,j),  
                                        region_loop_range);*/  
215          DataTypes::copySliceFrom(vec,mshape,getPointOffset(i,j),          DataTypes::copySliceFrom(vec,mshape,getPointOffset(i,j),
216                                         tVec,                                         tVec,
217                         tShape,                         tShape,
# Line 253  DataExpanded::copy(const DataConstant& v Line 236  DataExpanded::copy(const DataConstant& v
236    #pragma omp parallel for private(i,j) schedule(static)    #pragma omp parallel for private(i,j) schedule(static)
237    for (i=0;i<nRows;i++) {    for (i=0;i<nRows;i++) {
238      for (j=0;j<nCols;j++) {      for (j=0;j<nCols;j++) {
239        // NOTE: An exception may be thown from this call if        DataTypes::copyPoint(getVectorRW(), getPointOffset(i,j), getNoValues(), value.getVectorRO(), 0);
       // DOASSERT is on which of course will play  
       // havoc with the omp threads. Run single threaded  
       // if using DOASSERT.  
       //getPointDataView().copy(getPointOffset(i,j),value);  
       DataTypes::copyPoint(getVector(), getPointOffset(i,j), getNoValues(), value.getVector(), 0);  
240      }      }
241    }    }
242  }  }
243    
244    void
245  // void  DataExpanded::copy(const WrappedArray& value)
246  // DataExpanded::copy(const DataArrayView& value)  {
 // {  
 //   //  
 //   // copy a single value to every data point in this object  
 //   int nRows=m_data.getNumRows();  
 //   int nCols=m_data.getNumCols();  
 //   int i,j;  
 //   #pragma omp parallel for private(i,j) schedule(static)  
 //   for (i=0;i<nRows;i++) {  
 //     for (j=0;j<nCols;j++) {  
 //       // NOTE: An exception may be thown from this call if  
 //       // DOASSERT is on which of course will play  
 //       // havoc with the omp threads. Run single threaded  
 //       // if using DOASSERT.  
 //       getPointDataView().copy(getPointOffset(i,j),value);  
 //     }  
 //   }  
 // }  
   
 void  
 DataExpanded::copy(const boost::python::numeric::array& value)  
 {  
   
   // extract the shape of the numarray  
   DataTypes::ShapeType tempShape;  
   for (int i=0; i < value.getrank(); i++) {  
     tempShape.push_back(extract<int>(value.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(value);  
   
   //  
247    // check the input shape matches this shape    // check the input shape matches this shape
248    if (!DataTypes::checkShape(getShape(),tempShape)) {    if (!DataTypes::checkShape(getShape(),value.getShape())) {
249      throw DataException(DataTypes::createShapeErrorMessage(      throw DataException(DataTypes::createShapeErrorMessage(
250                          "Error - (DataExpanded) Cannot copy due to shape mismatch.",                          "Error - (DataExpanded) Cannot copy due to shape mismatch.",
251                          tempShape,getShape()));                          value.getShape(),getShape()));
252    }    }
253    //    getVectorRW().copyFromArray(value, getNumDPPSample()*getNumSamples());
   // now copy over the data  
   //copy(temp_dataView);  
   getVector().copyFromNumArray(value,getNumDPPSample()*getNumSamples());  
254  }  }
255    
256    
# Line 339  DataExpanded::toString() const Line 279  DataExpanded::toString() const
279        offset=getPointOffset(i,j);        offset=getPointOffset(i,j);
280        stringstream suffix;        stringstream suffix;
281        suffix << "( id: " << i << ", ref: " << fs.getReferenceIDOfSample(i) << ", pnt: " << j << ")";        suffix << "( id: " << i << ", ref: " << fs.getReferenceIDOfSample(i) << ", pnt: " << j << ")";
282        temp << DataTypes::pointToString(getVector(),getShape(),offset,suffix.str());        temp << DataTypes::pointToString(getVectorRO(),getShape(),offset,suffix.str());
283        if (!(i==(m_data.getNumRows()-1) && j==(m_data.getNumCols()-1))) {        if (!(i==(m_data.getNumRows()-1) && j==(m_data.getNumCols()-1))) {
284          temp << endl;          temp << endl;
285        }        }
# Line 377  DataExpanded::getLength() const Line 317  DataExpanded::getLength() const
317    
318  void  void
319  DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value) {  DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const double value) {
320      CHECK_FOR_EX_WRITE
321    //    //
322    // Get the number of samples and data-points per sample.    // Get the number of samples and data-points per sample.
323    int numSamples = getNumSamples();    int numSamples = getNumSamples();
# Line 392  DataExpanded::copyToDataPoint(const int Line 333  DataExpanded::copyToDataPoint(const int
333             throw DataException("Error - DataExpanded::copyDataPoint invalid dataPointNoInSample.");             throw DataException("Error - DataExpanded::copyDataPoint invalid dataPointNoInSample.");
334       }       }
335       ValueType::size_type offset = getPointOffset(sampleNo, dataPointNo);       ValueType::size_type offset = getPointOffset(sampleNo, dataPointNo);
336       ValueType& vec=getVector();       ValueType& vec=getVectorRW();
337       if (dataPointRank==0) {       if (dataPointRank==0) {
338           vec[offset]=value;           vec[offset]=value;
339       } else if (dataPointRank==1) {       } else if (dataPointRank==1) {
# Line 426  DataExpanded::copyToDataPoint(const int Line 367  DataExpanded::copyToDataPoint(const int
367       }       }
368    }    }
369  }  }
370    
371  void  void
372  DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const boost::python::numeric::array& value) {  DataExpanded::copyToDataPoint(const int sampleNo, const int dataPointNo, const WrappedArray& value) {
373      CHECK_FOR_EX_WRITE
374    //    //
375    // Get the number of samples and data-points per sample.    // Get the number of samples and data-points per sample.
376    int numSamples = getNumSamples();    int numSamples = getNumSamples();
377    int numDataPointsPerSample = getNumDPPSample();    int numDataPointsPerSample = getNumDPPSample();
   int dataPointRank = getRank();  
   const ShapeType& shape = getShape();  
378    //    //
379    // check rank:    // check rank:
380    if (value.getrank()!=dataPointRank)    if (value.getRank()!=getRank())
381         throw DataException("Rank of numarray does not match Data object rank");         throw DataException("Rank of numarray does not match Data object rank");
382    if (numSamples*numDataPointsPerSample > 0) {    if (numSamples*numDataPointsPerSample > 0) {
383       //TODO: global error handling       //TODO: global error handling
# Line 447  DataExpanded::copyToDataPoint(const int Line 388  DataExpanded::copyToDataPoint(const int
388             throw DataException("Error - DataExpanded::copyDataPoint invalid dataPointNoInSample.");             throw DataException("Error - DataExpanded::copyDataPoint invalid dataPointNoInSample.");
389       }       }
390       ValueType::size_type offset = getPointOffset(sampleNo, dataPointNo);       ValueType::size_type offset = getPointOffset(sampleNo, dataPointNo);
391       ValueType& vec=getVector();       ValueType& vec=getVectorRW();
392       if (dataPointRank==0) {       vec.copyFromArrayToOffset(value,offset,1);
          vec[offset]=extract<double>(value[0]);  
      } else if (dataPointRank==1) {  
         for (int i=0; i<shape[0]; i++) {  
             vec[offset+i]=extract<double>(value[i]);  
         }  
      } else if (dataPointRank==2) {  
         for (int i=0; i<shape[0]; i++) {  
            for (int j=0; j<shape[1]; j++) {  
               vec[offset+getRelIndex(shape,i,j)]=extract<double>(value[i][j]);  
            }  
         }  
      } else if (dataPointRank==3) {  
         for (int i=0; i<shape[0]; i++) {  
            for (int j=0; j<shape[1]; j++) {  
               for (int k=0; k<shape[2]; k++) {  
                  vec[offset+getRelIndex(shape,i,j,k)]=extract<double>(value[i][j][k]);  
               }  
            }  
         }  
      } else if (dataPointRank==4) {  
          for (int i=0; i<shape[0]; i++) {  
            for (int j=0; j<shape[1]; j++) {  
              for (int k=0; k<shape[2]; k++) {  
                for (int l=0; l<shape[3]; l++) {  
                   vec[offset+getRelIndex(shape,i,j,k,l)]=extract<double>(value[i][j][k][l]);  
                }  
              }  
            }  
          }  
      }  
   }  
 }  
 void  
 DataExpanded::copyAll(const boost::python::numeric::array& value) {  
   //  
   // Get the number of samples and data-points per sample.  
   int numSamples = getNumSamples();  
   int numDataPointsPerSample = getNumDPPSample();  
   int dataPointRank = getRank();  
   const ShapeType& dataPointShape = getShape();  
   //  
   // check rank:  
   if (value.getrank()!=dataPointRank+1)  
        throw DataException("Rank of numarray does not match Data object rank");  
   if (value.getshape()[0]!=numSamples*numDataPointsPerSample)  
        throw DataException("leading dimension of numarray is too small");  
   //  
   ValueType& vec=getVector();  
   int dataPoint = 0;  
   for (int sampleNo = 0; sampleNo < numSamples; sampleNo++) {  
     for (int dataPointNo = 0; dataPointNo < numDataPointsPerSample; dataPointNo++) {  
       ValueType::size_type offset=getPointOffset(sampleNo, dataPointNo);  
       if (dataPointRank==0) {  
          vec[offset]=extract<double>(value[dataPoint]);  
       } else if (dataPointRank==1) {  
          for (int i=0; i<dataPointShape[0]; i++) {  
             vec[offset+i]=extract<double>(value[dataPoint][i]);  
          }  
       } else if (dataPointRank==2) {  
          for (int i=0; i<dataPointShape[0]; i++) {  
            for (int j=0; j<dataPointShape[1]; j++) {  
          vec[offset+getRelIndex(dataPointShape,i,j)]=extract<double>(value[dataPoint][i][j]);  
            }  
          }  
        } else if (dataPointRank==3) {  
          for (int i=0; i<dataPointShape[0]; i++) {  
            for (int j=0; j<dataPointShape[1]; j++) {  
              for (int k=0; k<dataPointShape[2]; k++) {  
          vec[offset+getRelIndex(dataPointShape,i,j,k)]=extract<double>(value[dataPoint][i][j][k]);  
              }  
            }  
          }  
        } else if (dataPointRank==4) {  
          for (int i=0; i<dataPointShape[0]; i++) {  
            for (int j=0; j<dataPointShape[1]; j++) {  
              for (int k=0; k<dataPointShape[2]; k++) {  
                for (int l=0; l<dataPointShape[3]; l++) {  
                  vec[offset+getRelIndex(dataPointShape,i,j,k,l)]=extract<double>(value[dataPoint][i][j][k][l]);  
                }  
              }  
            }  
          }  
       }  
       dataPoint++;  
     }  
393    }    }
394  }  }
395    
396  void  void
397  DataExpanded::symmetric(DataAbstract* ev)  DataExpanded::symmetric(DataAbstract* ev)
398  {  {
# Line 546  DataExpanded::symmetric(DataAbstract* ev Line 403  DataExpanded::symmetric(DataAbstract* ev
403    if (temp_ev==0) {    if (temp_ev==0) {
404      throw DataException("Error - DataExpanded::symmetric: casting to DataExpanded failed (propably a programming error).");      throw DataException("Error - DataExpanded::symmetric: casting to DataExpanded failed (propably a programming error).");
405    }    }
406    ValueType& vec=getVector();    const ValueType& vec=getVectorRO();
407    const ShapeType& shape=getShape();    const ShapeType& shape=getShape();
408    ValueType& evVec=temp_ev->getVector();    ValueType& evVec=temp_ev->getVectorRW();
409    const ShapeType& evShape=temp_ev->getShape();    const ShapeType& evShape=temp_ev->getShape();
410    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
411    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
# Line 568  DataExpanded::nonsymmetric(DataAbstract* Line 425  DataExpanded::nonsymmetric(DataAbstract*
425    if (temp_ev==0) {    if (temp_ev==0) {
426      throw DataException("Error - DataExpanded::nonsymmetric: casting to DataExpanded failed (propably a programming error).");      throw DataException("Error - DataExpanded::nonsymmetric: casting to DataExpanded failed (propably a programming error).");
427    }    }
428    ValueType& vec=getVector();    const ValueType& vec=getVectorRO();
429    const ShapeType& shape=getShape();    const ShapeType& shape=getShape();
430    ValueType& evVec=temp_ev->getVector();    ValueType& evVec=temp_ev->getVectorRW();
431    const ShapeType& evShape=temp_ev->getShape();    const ShapeType& evShape=temp_ev->getShape();
432    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
433    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
# Line 590  DataExpanded::trace(DataAbstract* ev, in Line 447  DataExpanded::trace(DataAbstract* ev, in
447    if (temp_ev==0) {    if (temp_ev==0) {
448      throw DataException("Error - DataExpanded::trace: casting to DataExpanded failed (propably a programming error).");      throw DataException("Error - DataExpanded::trace: casting to DataExpanded failed (propably a programming error).");
449    }    }
450    ValueType& vec=getVector();    const ValueType& vec=getVectorRO();
451    const ShapeType& shape=getShape();    const ShapeType& shape=getShape();
452    ValueType& evVec=temp_ev->getVector();    ValueType& evVec=temp_ev->getVectorRW();
453    const ShapeType& evShape=temp_ev->getShape();    const ShapeType& evShape=temp_ev->getShape();
454    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
455    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
# Line 613  DataExpanded::transpose(DataAbstract* ev Line 470  DataExpanded::transpose(DataAbstract* ev
470    if (temp_ev==0) {    if (temp_ev==0) {
471      throw DataException("Error - DataExpanded::transpose: casting to DataExpanded failed (propably a programming error).");      throw DataException("Error - DataExpanded::transpose: casting to DataExpanded failed (propably a programming error).");
472    }    }
473    ValueType& vec=getVector();    const ValueType& vec=getVectorRO();
474    const ShapeType& shape=getShape();    const ShapeType& shape=getShape();
475    ValueType& evVec=temp_ev->getVector();    ValueType& evVec=temp_ev->getVectorRW();
476    const ShapeType& evShape=temp_ev->getShape();    const ShapeType& evShape=temp_ev->getShape();
477    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
478    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
# Line 636  DataExpanded::swapaxes(DataAbstract* ev, Line 493  DataExpanded::swapaxes(DataAbstract* ev,
493    if (temp_ev==0) {    if (temp_ev==0) {
494      throw DataException("Error - DataExpanded::swapaxes: casting to DataExpanded failed (propably a programming error).");      throw DataException("Error - DataExpanded::swapaxes: casting to DataExpanded failed (propably a programming error).");
495    }    }
496    ValueType& vec=getVector();    const ValueType& vec=getVectorRO();
497    const ShapeType& shape=getShape();    const ShapeType& shape=getShape();
498    ValueType& evVec=temp_ev->getVector();    ValueType& evVec=temp_ev->getVectorRW();
499    const ShapeType& evShape=temp_ev->getShape();    const ShapeType& evShape=temp_ev->getShape();
500    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
501    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
# Line 658  DataExpanded::eigenvalues(DataAbstract* Line 515  DataExpanded::eigenvalues(DataAbstract*
515    if (temp_ev==0) {    if (temp_ev==0) {
516      throw DataException("Error - DataExpanded::eigenvalues: casting to DataExpanded failed (propably a programming error).");      throw DataException("Error - DataExpanded::eigenvalues: casting to DataExpanded failed (propably a programming error).");
517    }    }
518    ValueType& vec=getVector();    const ValueType& vec=getVectorRO();
519    const ShapeType& shape=getShape();    const ShapeType& shape=getShape();
520    ValueType& evVec=temp_ev->getVector();    ValueType& evVec=temp_ev->getVectorRW();
521    const ShapeType& evShape=temp_ev->getShape();    const ShapeType& evShape=temp_ev->getShape();
522    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
523    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
# Line 684  DataExpanded::eigenvalues_and_eigenvecto Line 541  DataExpanded::eigenvalues_and_eigenvecto
541    if (temp_V==0) {    if (temp_V==0) {
542      throw DataException("Error - DataExpanded::eigenvalues_and_eigenvectors: casting to DataExpanded failed (propably a programming error).");      throw DataException("Error - DataExpanded::eigenvalues_and_eigenvectors: casting to DataExpanded failed (propably a programming error).");
543    }    }
544    ValueType& vec=getVector();    const ValueType& vec=getVectorRO();
545    const ShapeType& shape=getShape();    const ShapeType& shape=getShape();
546    ValueType& evVec=temp_ev->getVector();    ValueType& evVec=temp_ev->getVectorRW();
547    const ShapeType& evShape=temp_ev->getShape();    const ShapeType& evShape=temp_ev->getShape();
548    ValueType& VVec=temp_V->getVector();    ValueType& VVec=temp_V->getVectorRW();
549    const ShapeType& VShape=temp_V->getShape();    const ShapeType& VShape=temp_V->getShape();
550    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)    #pragma omp parallel for private(sampleNo,dataPointNo) schedule(static)
551    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {    for (sampleNo = 0; sampleNo < numSamples; sampleNo++) {
# Line 704  void Line 561  void
561  DataExpanded::setToZero(){  DataExpanded::setToZero(){
562  // TODO: Surely there is a more efficient way to do this????  // TODO: Surely there is a more efficient way to do this????
563  // Why is there no memset here? Parallel issues?  // Why is there no memset here? Parallel issues?
564      CHECK_FOR_EX_WRITE
565    int numSamples = getNumSamples();    int numSamples = getNumSamples();
566    int numDataPointsPerSample = getNumDPPSample();    int numDataPointsPerSample = getNumDPPSample();
567    DataTypes::ValueType::size_type n = getNoValues();    DataTypes::ValueType::size_type n = getNoValues();
# Line 820  DataExpanded::setTaggedValue(int tagKey, Line 678  DataExpanded::setTaggedValue(int tagKey,
678                 const DataTypes::ValueType& value,                 const DataTypes::ValueType& value,
679             int dataOffset)             int dataOffset)
680  {  {
681      CHECK_FOR_EX_WRITE
682    int numSamples = getNumSamples();    int numSamples = getNumSamples();
683    int numDataPointsPerSample = getNumDPPSample();    int numDataPointsPerSample = getNumDPPSample();
684    int sampleNo,dataPointNo, i;    int sampleNo,dataPointNo, i;
# Line 846  DataExpanded::setTaggedValue(int tagKey, Line 705  DataExpanded::setTaggedValue(int tagKey,
705  void  void
706  DataExpanded::reorderByReferenceIDs(int *reference_ids)  DataExpanded::reorderByReferenceIDs(int *reference_ids)
707  {  {
708      CHECK_FOR_EX_WRITE
709    int numSamples = getNumSamples();    int numSamples = getNumSamples();
710    DataTypes::ValueType::size_type n = getNoValues() * getNumDPPSample();    DataTypes::ValueType::size_type n = getNoValues() * getNumDPPSample();
711    int sampleNo, sampleNo2,i;    int sampleNo, sampleNo2,i;
# Line 881  DataExpanded::reorderByReferenceIDs(int Line 741  DataExpanded::reorderByReferenceIDs(int
741  }  }
742    
743  DataTypes::ValueType&  DataTypes::ValueType&
744  DataExpanded::getVector()  DataExpanded::getVectorRW()
745  {  {
746        CHECK_FOR_EX_WRITE
747      return m_data.getData();      return m_data.getData();
748  }  }
749    
750  const DataTypes::ValueType&  const DataTypes::ValueType&
751  DataExpanded::getVector() const  DataExpanded::getVectorRO() const
752  {  {
753      return m_data.getData();      return m_data.getData();
754  }  }
755    
756    
757  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.2105  
changed lines
  Added in v.2271

  ViewVC Help
Powered by ViewVC 1.1.26