/[escript]/branches/arrayview_from_1695_trunk/escript/src/UnaryOp.h
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/escript/src/UnaryOp.h

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

revision 1697 by jfenwick, Mon Aug 11 06:29:54 2008 UTC revision 1726 by jfenwick, Tue Aug 26 03:33:34 2008 UTC
# Line 17  Line 17 
17  #define escript_UnaryOp_20040315_H  #define escript_UnaryOp_20040315_H
18  #include "system_dep.h"  #include "system_dep.h"
19    
 #include "DataArrayView.h"  
20  #include "DataConstant.h"  #include "DataConstant.h"
21  #include "DataTagged.h"  #include "DataTagged.h"
22  #include "DataExpanded.h"  #include "DataExpanded.h"
# Line 44  unaryOp(DataExpanded& data, Line 43  unaryOp(DataExpanded& data,
43    int i,j;    int i,j;
44    DataTypes::ValueType::size_type numDPPSample=data.getNumDPPSample();    DataTypes::ValueType::size_type numDPPSample=data.getNumDPPSample();
45    DataTypes::ValueType::size_type numSamples=data.getNumSamples();    DataTypes::ValueType::size_type numSamples=data.getNumSamples();
46      DataTypes::ValueType& left=data.getVector();
47      const DataTypes::ShapeType& shape=data.getShape();
48    #pragma omp parallel for private(i,j) schedule(static)    #pragma omp parallel for private(i,j) schedule(static)
49    for (i=0;i<numSamples;i++) {    for (i=0;i<numSamples;i++) {
50      for (j=0;j<numDPPSample;j++) {      for (j=0;j<numDPPSample;j++) {
51        data.getPointDataView().unaryOp(data.getPointOffset(i,j),operation);        //data.getPointDataView().unaryOp(data.getPointOffset(i,j),operation);
52          DataMaths::unaryOp(left,shape,data.getPointOffset(i,j),operation);
53      }      }
54    }    }
55  }  }
# Line 62  unaryOp(DataTagged& data, Line 64  unaryOp(DataTagged& data,
64    const DataTagged::DataMapType& lookup=data.getTagLookup();    const DataTagged::DataMapType& lookup=data.getTagLookup();
65    DataTagged::DataMapType::const_iterator i;    DataTagged::DataMapType::const_iterator i;
66    DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();    DataTagged::DataMapType::const_iterator lookupEnd=lookup.end();
67    DataArrayView& dataView=data.getPointDataView();    //DataArrayView& dataView=data.getPointDataView();
68      DataTypes::ValueType& left=data.getVector();
69      const DataTypes::ShapeType& shape=data.getShape();
70    for (i=lookup.begin();i!=lookupEnd;i++) {    for (i=lookup.begin();i!=lookupEnd;i++) {
71      dataView.unaryOp(i->second,operation);  //    dataView.unaryOp(i->second,operation);
72        DataMaths::unaryOp(left,shape,i->second,operation);
73    }    }
74    // perform the operation on the default value    // perform the operation on the default value
75    data.getDefaultValue().unaryOp(operation);    //data.getDefaultValue().unaryOp(operation);
76      DataMaths::unaryOp(left,shape,data.getDefaultOffset(),operation);
77  }  }
78    
79  template <class UnaryFunction>  template <class UnaryFunction>
# Line 76  void Line 82  void
82  unaryOp(DataConstant& data,  unaryOp(DataConstant& data,
83          UnaryFunction operation)          UnaryFunction operation)
84  {  {
85    data.getPointDataView().unaryOp(operation);    //data.getPointDataView().unaryOp(operation);
86      DataMaths::unaryOp(data.getVector(),data.getShape(),0,operation);
87  }  }
88    
89  } // end of namespace  } // end of namespace

Legend:
Removed from v.1697  
changed lines
  Added in v.1726

  ViewVC Help
Powered by ViewVC 1.1.26