/[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

trunk/esys2/escript/src/Data/Data.cpp revision 121 by jgs, Fri May 6 04:26:16 2005 UTC trunk/escript/src/Data.cpp revision 480 by jgs, Wed Feb 1 05:15:12 2006 UTC
# Line 1  Line 1 
1  // $Id$  // $Id$
2    
3  /*=============================================================================  /*=============================================================================
4    
5   ******************************************************************************   ******************************************************************************
# Line 15  Line 16 
16    
17  ******************************************************************************/  ******************************************************************************/
18    
19  #include "escript/Data/Data.h"  #include "Data.h"
20    
21    #include "DataExpanded.h"
22    #include "DataConstant.h"
23    #include "DataTagged.h"
24    #include "DataEmpty.h"
25    #include "DataArray.h"
26    #include "DataArrayView.h"
27    #include "DataProf.h"
28    #include "FunctionSpaceFactory.h"
29    #include "AbstractContinuousDomain.h"
30    #include "UnaryFuncs.h"
31    
 #include <iostream>  
32  #include <fstream>  #include <fstream>
33  #include <algorithm>  #include <algorithm>
34  #include <vector>  #include <vector>
 #include <exception>  
35  #include <functional>  #include <functional>
36  #include <math.h>  #include <math.h>
37    
38  #include <boost/python/str.hpp>  #include <boost/python/dict.hpp>
39  #include <boost/python/extract.hpp>  #include <boost/python/extract.hpp>
40  #include <boost/python/long.hpp>  #include <boost/python/long.hpp>
41    
 #include "escript/Data/DataException.h"  
 #include "escript/Data/DataExpanded.h"  
 #include "escript/Data/DataConstant.h"  
 #include "escript/Data/DataTagged.h"  
 #include "escript/Data/DataEmpty.h"  
 #include "escript/Data/DataArray.h"  
 #include "escript/Data/DataAlgorithm.h"  
 #include "escript/Data/FunctionSpaceFactory.h"  
 #include "escript/Data/AbstractContinuousDomain.h"  
 #include "escript/Data/UnaryFuncs.h"  
   
42  using namespace std;  using namespace std;
43  using namespace boost::python;  using namespace boost::python;
44  using namespace boost;  using namespace boost;
45  using namespace escript;  using namespace escript;
46    
47    #if defined DOPROF
48    //
49    // global table of profiling data for all Data objects
50    DataProf dataProfTable;
51    #endif
52    
53  Data::Data()  Data::Data()
54  {  {
55    //    //
# Line 52  Data::Data() Line 57  Data::Data()
57    DataAbstract* temp=new DataEmpty();    DataAbstract* temp=new DataEmpty();
58    shared_ptr<DataAbstract> temp_data(temp);    shared_ptr<DataAbstract> temp_data(temp);
59    m_data=temp_data;    m_data=temp_data;
60    #if defined DOPROF
61      // create entry in global profiling table for this object
62      profData = dataProfTable.newData();
63    #endif
64  }  }
65    
66  Data::Data(double value,  Data::Data(double value,
# Line 65  Data::Data(double value, Line 74  Data::Data(double value,
74    }    }
75    DataArray temp(dataPointShape,value);    DataArray temp(dataPointShape,value);
76    initialise(temp.getView(),what,expanded);    initialise(temp.getView(),what,expanded);
77    #if defined DOPROF
78      // create entry in global profiling table for this object
79      profData = dataProfTable.newData();
80    #endif
81  }  }
82    
83  Data::Data(double value,  Data::Data(double value,
# Line 75  Data::Data(double value, Line 88  Data::Data(double value,
88    DataArray temp(dataPointShape,value);    DataArray temp(dataPointShape,value);
89    pair<int,int> dataShape=what.getDataShape();    pair<int,int> dataShape=what.getDataShape();
90    initialise(temp.getView(),what,expanded);    initialise(temp.getView(),what,expanded);
91    #if defined DOPROF
92      // create entry in global profiling table for this object
93      profData = dataProfTable.newData();
94    #endif
95  }  }
96    
97  Data::Data(const Data& inData)  Data::Data(const Data& inData)
98  {  {
99    m_data=inData.m_data;    m_data=inData.m_data;
100    #if defined DOPROF
101      // create entry in global profiling table for this object
102      profData = dataProfTable.newData();
103    #endif
104  }  }
105    
106  Data::Data(const Data& inData,  Data::Data(const Data& inData,
# Line 90  Data::Data(const Data& inData, Line 111  Data::Data(const Data& inData,
111    DataAbstract* tmp = inData.m_data->getSlice(region);    DataAbstract* tmp = inData.m_data->getSlice(region);
112    shared_ptr<DataAbstract> temp_data(tmp);    shared_ptr<DataAbstract> temp_data(tmp);
113    m_data=temp_data;    m_data=temp_data;
114    #if defined DOPROF
115      // create entry in global profiling table for this object
116      profData = dataProfTable.newData();
117    #endif
118  }  }
119    
120  Data::Data(const Data& inData,  Data::Data(const Data& inData,
# Line 99  Data::Data(const Data& inData, Line 124  Data::Data(const Data& inData,
124      m_data=inData.m_data;      m_data=inData.m_data;
125    } else {    } else {
126      Data tmp(0,inData.getPointDataView().getShape(),functionspace,true);      Data tmp(0,inData.getPointDataView().getShape(),functionspace,true);
127      // Note for Lutz, Must use a reference or pointer to a derived object      // Note: Must use a reference or pointer to a derived object
128      // in order to get polymorphic behaviour. Shouldn't really      // in order to get polymorphic behaviour. Shouldn't really
129      // be able to create an instance of AbstractDomain but that was done      // be able to create an instance of AbstractDomain but that was done
130      // as a boost python work around which may no longer be required.      // as a boost:python work around which may no longer be required.
131      const AbstractDomain& inDataDomain=inData.getDomain();      const AbstractDomain& inDataDomain=inData.getDomain();
132      if  (inDataDomain==functionspace.getDomain()) {      if  (inDataDomain==functionspace.getDomain()) {
133        inDataDomain.interpolateOnDomain(tmp,inData);        inDataDomain.interpolateOnDomain(tmp,inData);
# Line 111  Data::Data(const Data& inData, Line 136  Data::Data(const Data& inData,
136      }      }
137      m_data=tmp.m_data;      m_data=tmp.m_data;
138    }    }
139    #if defined DOPROF
140      // create entry in global profiling table for this object
141      profData = dataProfTable.newData();
142    #endif
143  }  }
144    
145  Data::Data(const DataTagged::TagListType& tagKeys,  Data::Data(const DataTagged::TagListType& tagKeys,
# Line 125  Data::Data(const DataTagged::TagListType Line 154  Data::Data(const DataTagged::TagListType
154    if (expanded) {    if (expanded) {
155      expand();      expand();
156    }    }
157    #if defined DOPROF
158      // create entry in global profiling table for this object
159      profData = dataProfTable.newData();
160    #endif
161  }  }
162    
163  Data::Data(const numeric::array& value,  Data::Data(const numeric::array& value,
# Line 132  Data::Data(const numeric::array& value, Line 165  Data::Data(const numeric::array& value,
165             bool expanded)             bool expanded)
166  {  {
167    initialise(value,what,expanded);    initialise(value,what,expanded);
168    #if defined DOPROF
169      // create entry in global profiling table for this object
170      profData = dataProfTable.newData();
171    #endif
172  }  }
173    
174  Data::Data(const DataArrayView& value,  Data::Data(const DataArrayView& value,
# Line 139  Data::Data(const DataArrayView& value, Line 176  Data::Data(const DataArrayView& value,
176             bool expanded)             bool expanded)
177  {  {
178    initialise(value,what,expanded);    initialise(value,what,expanded);
179    #if defined DOPROF
180      // create entry in global profiling table for this object
181      profData = dataProfTable.newData();
182    #endif
183  }  }
184    
185  Data::Data(const object& value,  Data::Data(const object& value,
# Line 147  Data::Data(const object& value, Line 188  Data::Data(const object& value,
188  {  {
189    numeric::array asNumArray(value);    numeric::array asNumArray(value);
190    initialise(asNumArray,what,expanded);    initialise(asNumArray,what,expanded);
191    #if defined DOPROF
192      // create entry in global profiling table for this object
193      profData = dataProfTable.newData();
194    #endif
195  }  }
196    
197  Data::Data(const object& value,  Data::Data(const object& value,
# Line 167  Data::Data(const object& value, Line 212  Data::Data(const object& value,
212      // Create a DataConstant with the same sample shape as other      // Create a DataConstant with the same sample shape as other
213      initialise(temp.getView(),other.getFunctionSpace(),false);      initialise(temp.getView(),other.getFunctionSpace(),false);
214    }    }
215    #if defined DOPROF
216      // create entry in global profiling table for this object
217      profData = dataProfTable.newData();
218    #endif
219    }
220    
221    Data::~Data()
222    {
223    
224  }  }
225    
226  escriptDataC  escriptDataC
# Line 353  Data::reshapeDataPoint(const DataArrayVi Line 407  Data::reshapeDataPoint(const DataArrayVi
407  Data  Data
408  Data::wherePositive() const  Data::wherePositive() const
409  {  {
410    #if defined DOPROF
411      profData->where++;
412    #endif
413    return escript::unaryOp(*this,bind2nd(greater<double>(),0.0));    return escript::unaryOp(*this,bind2nd(greater<double>(),0.0));
414  }  }
415    
416  Data  Data
417  Data::whereNegative() const  Data::whereNegative() const
418  {  {
419    #if defined DOPROF
420      profData->where++;
421    #endif
422    return escript::unaryOp(*this,bind2nd(less<double>(),0.0));    return escript::unaryOp(*this,bind2nd(less<double>(),0.0));
423  }  }
424    
425  Data  Data
426  Data::whereNonNegative() const  Data::whereNonNegative() const
427  {  {
428    #if defined DOPROF
429      profData->where++;
430    #endif
431    return escript::unaryOp(*this,bind2nd(greater_equal<double>(),0.0));    return escript::unaryOp(*this,bind2nd(greater_equal<double>(),0.0));
432  }  }
433    
434  Data  Data
435  Data::whereNonPositive() const  Data::whereNonPositive() const
436  {  {
437    #if defined DOPROF
438      profData->where++;
439    #endif
440    return escript::unaryOp(*this,bind2nd(less_equal<double>(),0.0));    return escript::unaryOp(*this,bind2nd(less_equal<double>(),0.0));
441  }  }
442    
443  Data  Data
444  Data::whereZero() const  Data::whereZero() const
445  {  {
446    #if defined DOPROF
447      profData->where++;
448    #endif
449    return escript::unaryOp(*this,bind2nd(equal_to<double>(),0.0));    return escript::unaryOp(*this,bind2nd(equal_to<double>(),0.0));
450  }  }
451    
452  Data  Data
453  Data::whereNonZero() const  Data::whereNonZero() const
454  {  {
455    #if defined DOPROF
456      profData->where++;
457    #endif
458    return escript::unaryOp(*this,bind2nd(not_equal_to<double>(),0.0));    return escript::unaryOp(*this,bind2nd(not_equal_to<double>(),0.0));
459  }  }
460    
461  Data  Data
462  Data::interpolate(const FunctionSpace& functionspace) const  Data::interpolate(const FunctionSpace& functionspace) const
463  {  {
464    #if defined DOPROF
465      profData->interpolate++;
466    #endif
467    return Data(*this,functionspace);    return Data(*this,functionspace);
468  }  }
469    
# Line 410  Data::probeInterpolation(const FunctionS Line 485  Data::probeInterpolation(const FunctionS
485  Data  Data
486  Data::gradOn(const FunctionSpace& functionspace) const  Data::gradOn(const FunctionSpace& functionspace) const
487  {  {
488    #if defined DOPROF
489      profData->grad++;
490    #endif
491    if (functionspace.getDomain()!=getDomain())    if (functionspace.getDomain()!=getDomain())
492      throw DataException("Error - gradient cannot be calculated on different domains.");      throw DataException("Error - gradient cannot be calculated on different domains.");
493    DataArrayView::ShapeType grad_shape=getPointDataView().getShape();    DataArrayView::ShapeType grad_shape=getPointDataView().getShape();
# Line 443  Data::getDataPointShape() const Line 521  Data::getDataPointShape() const
521    return getPointDataView().getShape();    return getPointDataView().getShape();
522  }  }
523    
524    void
525    Data::fillFromNumArray(const boost::python::numeric::array num_array)
526    {
527      //
528      // check rank
529      if (num_array.getrank()<getDataPointRank())
530          throw DataException("Rank of numarray does not match Data object rank");
531    
532      //
533      // check shape of num_array
534      for (int i=0; i<getDataPointRank(); i++) {
535        if (extract<int>(num_array.getshape()[i+1])!=getDataPointShape()[i])
536           throw DataException("Shape of numarray does not match Data object rank");
537      }
538    
539      //
540      // make sure data is expanded:
541      if (!isExpanded()) {
542        expand();
543      }
544    
545      //
546      // and copy over
547      m_data->copyAll(num_array);
548    }
549    
550  const  const
551  boost::python::numeric::array  boost::python::numeric::array
552  Data::convertToNumArray()  Data::convertToNumArray()
# Line 748  Data::integrate() const Line 852  Data::integrate() const
852    int rank = getDataPointRank();    int rank = getDataPointRank();
853    DataArrayView::ShapeType shape = getDataPointShape();    DataArrayView::ShapeType shape = getDataPointShape();
854    
855    #if defined DOPROF
856      profData->integrate++;
857    #endif
858    
859    //    //
860    // calculate the integral values    // calculate the integral values
861    vector<double> integrals(getDataPointSize());    vector<double> integrals(getDataPointSize());
# Line 770  Data::integrate() const Line 878  Data::integrate() const
878      }      }
879    }    }
880    if (rank==2) {    if (rank==2) {
881      bp_array.resize(shape[0],shape[1]);         bp_array.resize(shape[0],shape[1]);
882      for (int i=0; i<shape[0]; i++) {         for (int i=0; i<shape[0]; i++) {
883        for (int j=0; j<shape[1]; j++) {           for (int j=0; j<shape[1]; j++) {
884          index = i + shape[0] * j;             index = i + shape[0] * j;
885          bp_array[i,j] = integrals[index];             bp_array[make_tuple(i,j)] = integrals[index];
886        }           }
887      }         }
888    }    }
889    if (rank==3) {    if (rank==3) {
890      bp_array.resize(shape[0],shape[1],shape[2]);      bp_array.resize(shape[0],shape[1],shape[2]);
# Line 784  Data::integrate() const Line 892  Data::integrate() const
892        for (int j=0; j<shape[1]; j++) {        for (int j=0; j<shape[1]; j++) {
893          for (int k=0; k<shape[2]; k++) {          for (int k=0; k<shape[2]; k++) {
894            index = i + shape[0] * ( j + shape[1] * k );            index = i + shape[0] * ( j + shape[1] * k );
895            bp_array[i,j,k] = integrals[index];            bp_array[make_tuple(i,j,k)] = integrals[index];
896          }          }
897        }        }
898      }      }
# Line 796  Data::integrate() const Line 904  Data::integrate() const
904          for (int k=0; k<shape[2]; k++) {          for (int k=0; k<shape[2]; k++) {
905            for (int l=0; l<shape[3]; l++) {            for (int l=0; l<shape[3]; l++) {
906              index = i + shape[0] * ( j + shape[1] * ( k + shape[2] * l ) );              index = i + shape[0] * ( j + shape[1] * ( k + shape[2] * l ) );
907              bp_array[i,j,k,l] = integrals[index];              bp_array[make_tuple(i,j,k,l)] = integrals[index];
908            }            }
909          }          }
910        }        }
# Line 811  Data::integrate() const Line 919  Data::integrate() const
919  Data  Data
920  Data::sin() const  Data::sin() const
921  {  {
922    #if defined DOPROF
923      profData->unary++;
924    #endif
925    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sin);    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sin);
926  }  }
927    
928  Data  Data
929  Data::cos() const  Data::cos() const
930  {  {
931    #if defined DOPROF
932      profData->unary++;
933    #endif
934    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::cos);    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::cos);
935  }  }
936    
937  Data  Data
938  Data::tan() const  Data::tan() const
939  {  {
940    #if defined DOPROF
941      profData->unary++;
942    #endif
943    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::tan);    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::tan);
944  }  }
945    
946  Data  Data
947  Data::log() const  Data::asin() const
948    {
949    #if defined DOPROF
950      profData->unary++;
951    #endif
952      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::asin);
953    }
954    
955    Data
956    Data::acos() const
957    {
958    #if defined DOPROF
959      profData->unary++;
960    #endif
961      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::acos);
962    }
963    
964    Data
965    Data::atan() const
966    {
967    #if defined DOPROF
968      profData->unary++;
969    #endif
970      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::atan);
971    }
972    
973    Data
974    Data::sinh() const
975    {
976    #if defined DOPROF
977      profData->unary++;
978    #endif
979      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sinh);
980    }
981    
982    Data
983    Data::cosh() const
984  {  {
985    #if defined DOPROF
986      profData->unary++;
987    #endif
988      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::cosh);
989    }
990    
991    Data
992    Data::tanh() const
993    {
994    #if defined DOPROF
995      profData->unary++;
996    #endif
997      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::tanh);
998    }
999    
1000    Data
1001    Data::asinh() const
1002    {
1003    #if defined DOPROF
1004      profData->unary++;
1005    #endif
1006      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::asinh);
1007    }
1008    
1009    Data
1010    Data::acosh() const
1011    {
1012    #if defined DOPROF
1013      profData->unary++;
1014    #endif
1015      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::acosh);
1016    }
1017    
1018    Data
1019    Data::atanh() const
1020    {
1021    #if defined DOPROF
1022      profData->unary++;
1023    #endif
1024      return escript::unaryOp(*this,(Data::UnaryDFunPtr)::atanh);
1025    }
1026    
1027    Data
1028    Data::log10() const
1029    {
1030    #if defined DOPROF
1031      profData->unary++;
1032    #endif
1033    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::log10);    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::log10);
1034  }  }
1035    
1036  Data  Data
1037  Data::ln() const  Data::log() const
1038  {  {
1039    #if defined DOPROF
1040      profData->unary++;
1041    #endif
1042    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::log);    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::log);
1043  }  }
1044    
1045  Data  Data
1046  Data::sign() const  Data::sign() const
1047  {  {
1048    #if defined DOPROF
1049      profData->unary++;
1050    #endif
1051    return escript::unaryOp(*this,escript::fsign);    return escript::unaryOp(*this,escript::fsign);
1052  }  }
1053    
1054  Data  Data
1055  Data::abs() const  Data::abs() const
1056  {  {
1057    #if defined DOPROF
1058      profData->unary++;
1059    #endif
1060    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::fabs);    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::fabs);
1061  }  }
1062    
1063  Data  Data
1064  Data::neg() const  Data::neg() const
1065  {  {
1066    #if defined DOPROF
1067      profData->unary++;
1068    #endif
1069    return escript::unaryOp(*this,negate<double>());    return escript::unaryOp(*this,negate<double>());
1070  }  }
1071    
1072  Data  Data
1073  Data::pos() const  Data::pos() const
1074  {  {
1075    return (*this);  #if defined DOPROF
1076      profData->unary++;
1077    #endif
1078      Data result;
1079      // perform a deep copy
1080      result.copy(*this);
1081      return result;
1082  }  }
1083    
1084  Data  Data
1085  Data::exp() const  Data::exp() const
1086  {  {
1087    #if defined DOPROF
1088      profData->unary++;
1089    #endif
1090    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::exp);    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::exp);
1091  }  }
1092    
1093  Data  Data
1094  Data::sqrt() const  Data::sqrt() const
1095  {  {
1096    #if defined DOPROF
1097      profData->unary++;
1098    #endif
1099    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sqrt);    return escript::unaryOp(*this,(Data::UnaryDFunPtr)::sqrt);
1100  }  }
1101    
1102  double  double
1103  Data::Lsup() const  Data::Lsup() const
1104  {  {
1105    #if defined DOPROF
1106      profData->reduction1++;
1107    #endif
1108    //    //
1109    // set the initial absolute maximum value to zero    // set the initial absolute maximum value to zero
1110    return algorithm(DataAlgorithmAdapter<AbsMax>(0));    AbsMax abs_max_func;
1111      return algorithm(abs_max_func,0);
1112  }  }
1113    
1114  double  double
1115  Data::Linf() const  Data::Linf() const
1116  {  {
1117    #if defined DOPROF
1118      profData->reduction1++;
1119    #endif
1120    //    //
1121    // set the initial absolute minimum value to max double    // set the initial absolute minimum value to max double
1122    return algorithm(DataAlgorithmAdapter<AbsMin>(numeric_limits<double>::max()));    AbsMin abs_min_func;
1123      return algorithm(abs_min_func,numeric_limits<double>::max());
1124  }  }
1125    
1126  double  double
1127  Data::sup() const  Data::sup() const
1128  {  {
1129    #if defined DOPROF
1130      profData->reduction1++;
1131    #endif
1132    //    //
1133    // set the initial maximum value to min possible double    // set the initial maximum value to min possible double
1134    return algorithm(DataAlgorithmAdapter<FMax>(numeric_limits<double>::max()*-1));    FMax fmax_func;
1135      return algorithm(fmax_func,numeric_limits<double>::max()*-1);
1136  }  }
1137    
1138  double  double
1139  Data::inf() const  Data::inf() const
1140  {  {
1141    #if defined DOPROF
1142      profData->reduction1++;
1143    #endif
1144    //    //
1145    // set the initial minimum value to max possible double    // set the initial minimum value to max possible double
1146    return algorithm(DataAlgorithmAdapter<FMin>(numeric_limits<double>::max()));    FMin fmin_func;
1147      return algorithm(fmin_func,numeric_limits<double>::max());
1148  }  }
1149    
1150  Data  Data
1151  Data::maxval() const  Data::maxval() const
1152  {  {
1153    #if defined DOPROF
1154      profData->reduction2++;
1155    #endif
1156    //    //
1157    // set the initial maximum value to min possible double    // set the initial maximum value to min possible double
1158    return dp_algorithm(DataAlgorithmAdapter<FMax>(numeric_limits<double>::max()*-1));    FMax fmax_func;
1159      return dp_algorithm(fmax_func,numeric_limits<double>::max()*-1);
1160  }  }
1161    
1162  Data  Data
1163  Data::minval() const  Data::minval() const
1164  {  {
1165    #if defined DOPROF
1166      profData->reduction2++;
1167    #endif
1168    //    //
1169    // set the initial minimum value to max possible double    // set the initial minimum value to max possible double
1170    return dp_algorithm(DataAlgorithmAdapter<FMin>(numeric_limits<double>::max()));    FMin fmin_func;
1171      return dp_algorithm(fmin_func,numeric_limits<double>::max());
1172    }
1173    
1174    Data
1175    Data::trace() const
1176    {
1177    #if defined DOPROF
1178      profData->reduction2++;
1179    #endif
1180      Trace trace_func;
1181      return dp_algorithm(trace_func,0);
1182    }
1183    
1184    Data
1185    Data::transpose(int axis) const
1186    {
1187    #if defined DOPROF
1188      profData->reduction2++;
1189    #endif
1190      // not implemented
1191      throw DataException("Error - Data::transpose not implemented yet.");
1192      return Data();
1193  }  }
1194    
1195  const boost::python::tuple  const boost::python::tuple
1196  Data::mindp() const  Data::mindp() const
1197  {  {
1198      // NB: calc_mindp had to be split off from mindp as boost::make_tuple causes an
1199      // abort (for unknown reasons) if there are openmp directives with it in the
1200      // surrounding function
1201    
1202      int SampleNo;
1203      int DataPointNo;
1204    
1205      calc_mindp(SampleNo,DataPointNo);
1206    
1207      return make_tuple(SampleNo,DataPointNo);
1208    }
1209    
1210    void
1211    Data::calc_mindp(int& SampleNo,
1212                     int& DataPointNo) const
1213    {
1214      int i,j;
1215      int lowi=0,lowj=0;
1216      double min=numeric_limits<double>::max();
1217    
1218    Data temp=minval();    Data temp=minval();
1219    
1220    int numSamples=temp.getNumSamples();    int numSamples=temp.getNumSamples();
1221    int numDPPSample=temp.getNumDataPointsPerSample();    int numDPPSample=temp.getNumDataPointsPerSample();
1222    
1223    int i,j,lowi=0,lowj=0;    double next,local_min;
1224    double min=numeric_limits<double>::max();    int local_lowi,local_lowj;
1225    
1226    for (i=0; i<numSamples; i++) {    #pragma omp parallel private(next,local_min,local_lowi,local_lowj)
1227      for (j=0; j<numDPPSample; j++) {    {
1228        double next=temp.getDataPoint(i,j)();      local_min=min;
1229        if (next<min) {      #pragma omp for private(i,j) schedule(static)
1230          min=next;      for (i=0; i<numSamples; i++) {
1231          lowi=i;        for (j=0; j<numDPPSample; j++) {
1232          lowj=j;          next=temp.getDataPoint(i,j)();
1233            if (next<local_min) {
1234              local_min=next;
1235              local_lowi=i;
1236              local_lowj=j;
1237            }
1238        }        }
1239      }      }
1240        #pragma omp critical
1241        if (local_min<min) {
1242          min=local_min;
1243          lowi=local_lowi;
1244          lowj=local_lowj;
1245        }
1246    }    }
1247    
1248    return make_tuple(lowi,lowj);    SampleNo = lowi;
1249  }    DataPointNo = lowj;
   
 Data  
 Data::length() const  
 {  
   return dp_algorithm(DataAlgorithmAdapter<Length>(0));  
 }  
   
 Data  
 Data::trace() const  
 {  
   return dp_algorithm(DataAlgorithmAdapter<Trace>(0));  
 }  
   
 Data  
 Data::transpose(int axis) const  
 {  
   // not implemented  
   throw DataException("Error - Data::transpose not implemented yet.");  
   return Data();  
1250  }  }
1251    
1252  void  void
1253  Data::saveDX(std::string fileName) const  Data::saveDX(std::string fileName) const
1254  {  {
1255    getDomain().saveDX(fileName,*this);    boost::python::dict args;
1256      args["data"]=boost::python::object(this);
1257      getDomain().saveDX(fileName,args);
1258    return;    return;
1259  }  }
1260    
1261  void  void
1262  Data::saveVTK(std::string fileName) const  Data::saveVTK(std::string fileName) const
1263  {  {
1264    getDomain().saveVTK(fileName,*this);    boost::python::dict args;
1265      args["data"]=boost::python::object(this);
1266      getDomain().saveVTK(fileName,args);
1267    return;    return;
1268  }  }
1269    
1270  Data&  Data&
1271  Data::operator+=(const Data& right)  Data::operator+=(const Data& right)
1272  {  {
1273    #if defined DOPROF
1274      profData->binary++;
1275    #endif
1276    binaryOp(right,plus<double>());    binaryOp(right,plus<double>());
1277    return (*this);    return (*this);
1278  }  }
# Line 991  Data::operator+=(const Data& right) Line 1280  Data::operator+=(const Data& right)
1280  Data&  Data&
1281  Data::operator+=(const boost::python::object& right)  Data::operator+=(const boost::python::object& right)
1282  {  {
1283    #if defined DOPROF
1284      profData->binary++;
1285    #endif
1286    binaryOp(right,plus<double>());    binaryOp(right,plus<double>());
1287    return (*this);    return (*this);
1288  }  }
# Line 998  Data::operator+=(const boost::python::ob Line 1290  Data::operator+=(const boost::python::ob
1290  Data&  Data&
1291  Data::operator-=(const Data& right)  Data::operator-=(const Data& right)
1292  {  {
1293    #if defined DOPROF
1294      profData->binary++;
1295    #endif
1296    binaryOp(right,minus<double>());    binaryOp(right,minus<double>());
1297    return (*this);    return (*this);
1298  }  }
# Line 1005  Data::operator-=(const Data& right) Line 1300  Data::operator-=(const Data& right)
1300  Data&  Data&
1301  Data::operator-=(const boost::python::object& right)  Data::operator-=(const boost::python::object& right)
1302  {  {
1303    #if defined DOPROF
1304      profData->binary++;
1305    #endif
1306    binaryOp(right,minus<double>());    binaryOp(right,minus<double>());
1307    return (*this);    return (*this);
1308  }  }
# Line 1012  Data::operator-=(const boost::python::ob Line 1310  Data::operator-=(const boost::python::ob
1310  Data&  Data&
1311  Data::operator*=(const Data& right)  Data::operator*=(const Data& right)
1312  {  {
1313    #if defined DOPROF
1314      profData->binary++;
1315    #endif
1316    binaryOp(right,multiplies<double>());    binaryOp(right,multiplies<double>());
1317    return (*this);    return (*this);
1318  }  }
# Line 1019  Data::operator*=(const Data& right) Line 1320  Data::operator*=(const Data& right)
1320  Data&  Data&
1321  Data::operator*=(const boost::python::object& right)  Data::operator*=(const boost::python::object& right)
1322  {  {
1323    #if defined DOPROF
1324      profData->binary++;
1325    #endif
1326    binaryOp(right,multiplies<double>());    binaryOp(right,multiplies<double>());
1327    return (*this);    return (*this);
1328  }  }
# Line 1026  Data::operator*=(const boost::python::ob Line 1330  Data::operator*=(const boost::python::ob
1330  Data&  Data&
1331  Data::operator/=(const Data& right)  Data::operator/=(const Data& right)
1332  {  {
1333    #if defined DOPROF
1334      profData->binary++;
1335    #endif
1336    binaryOp(right,divides<double>());    binaryOp(right,divides<double>());
1337    return (*this);    return (*this);
1338  }  }
# Line 1033  Data::operator/=(const Data& right) Line 1340  Data::operator/=(const Data& right)
1340  Data&  Data&
1341  Data::operator/=(const boost::python::object& right)  Data::operator/=(const boost::python::object& right)
1342  {  {
1343    #if defined DOPROF
1344      profData->binary++;
1345    #endif
1346    binaryOp(right,divides<double>());    binaryOp(right,divides<double>());
1347    return (*this);    return (*this);
1348  }  }
# Line 1040  Data::operator/=(const boost::python::ob Line 1350  Data::operator/=(const boost::python::ob
1350  Data  Data
1351  Data::powO(const boost::python::object& right) const  Data::powO(const boost::python::object& right) const
1352  {  {
1353    #if defined DOPROF
1354      profData->binary++;
1355    #endif
1356    Data result;    Data result;
1357    result.copy(*this);    result.copy(*this);
1358    result.binaryOp(right,(Data::BinaryDFunPtr)::pow);    result.binaryOp(right,(Data::BinaryDFunPtr)::pow);
# Line 1049  Data::powO(const boost::python::object& Line 1362  Data::powO(const boost::python::object&
1362  Data  Data
1363  Data::powD(const Data& right) const  Data::powD(const Data& right) const
1364  {  {
1365    #if defined DOPROF
1366      profData->binary++;
1367    #endif
1368    Data result;    Data result;
1369    result.copy(*this);    result.copy(*this);
1370    result.binaryOp(right,(Data::BinaryDFunPtr)::pow);    result.binaryOp(right,(Data::BinaryDFunPtr)::pow);
# Line 1056  Data::powD(const Data& right) const Line 1372  Data::powD(const Data& right) const
1372  }  }
1373    
1374  //  //
1375  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1376  Data  Data
1377  escript::operator+(const Data& left, const Data& right)  escript::operator+(const Data& left, const Data& right)
1378  {  {
# Line 1069  escript::operator+(const Data& left, con Line 1385  escript::operator+(const Data& left, con
1385  }  }
1386    
1387  //  //
1388  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1389  Data  Data
1390  escript::operator-(const Data& left, const Data& right)  escript::operator-(const Data& left, const Data& right)
1391  {  {
# Line 1082  escript::operator-(const Data& left, con Line 1398  escript::operator-(const Data& left, con
1398  }  }
1399    
1400  //  //
1401  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1402  Data  Data
1403  escript::operator*(const Data& left, const Data& right)  escript::operator*(const Data& left, const Data& right)
1404  {  {
# Line 1095  escript::operator*(const Data& left, con Line 1411  escript::operator*(const Data& left, con
1411  }  }
1412    
1413  //  //
1414  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1415  Data  Data
1416  escript::operator/(const Data& left, const Data& right)  escript::operator/(const Data& left, const Data& right)
1417  {  {
# Line 1108  escript::operator/(const Data& left, con Line 1424  escript::operator/(const Data& left, con
1424  }  }
1425    
1426  //  //
1427  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1428  Data  Data
1429  escript::operator+(const Data& left, const boost::python::object& right)  escript::operator+(const Data& left, const boost::python::object& right)
1430  {  {
# Line 1124  escript::operator+(const Data& left, con Line 1440  escript::operator+(const Data& left, con
1440  }  }
1441    
1442  //  //
1443  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1444  Data  Data
1445  escript::operator-(const Data& left, const boost::python::object& right)  escript::operator-(const Data& left, const boost::python::object& right)
1446  {  {
# Line 1140  escript::operator-(const Data& left, con Line 1456  escript::operator-(const Data& left, con
1456  }  }
1457    
1458  //  //
1459  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1460  Data  Data
1461  escript::operator*(const Data& left, const boost::python::object& right)  escript::operator*(const Data& left, const boost::python::object& right)
1462  {  {
# Line 1156  escript::operator*(const Data& left, con Line 1472  escript::operator*(const Data& left, con
1472  }  }
1473    
1474  //  //
1475  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1476  Data  Data
1477  escript::operator/(const Data& left, const boost::python::object& right)  escript::operator/(const Data& left, const boost::python::object& right)
1478  {  {
# Line 1172  escript::operator/(const Data& left, con Line 1488  escript::operator/(const Data& left, con
1488  }  }
1489    
1490  //  //
1491  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1492  Data  Data
1493  escript::operator+(const boost::python::object& left, const Data& right)  escript::operator+(const boost::python::object& left, const Data& right)
1494  {  {
# Line 1185  escript::operator+(const boost::python:: Line 1501  escript::operator+(const boost::python::
1501  }  }
1502    
1503  //  //
1504  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1505  Data  Data
1506  escript::operator-(const boost::python::object& left, const Data& right)  escript::operator-(const boost::python::object& left, const Data& right)
1507  {  {
# Line 1198  escript::operator-(const boost::python:: Line 1514  escript::operator-(const boost::python::
1514  }  }
1515    
1516  //  //
1517  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1518  Data  Data
1519  escript::operator*(const boost::python::object& left, const Data& right)  escript::operator*(const boost::python::object& left, const Data& right)
1520  {  {
# Line 1211  escript::operator*(const boost::python:: Line 1527  escript::operator*(const boost::python::
1527  }  }
1528    
1529  //  //
1530  // NOTE: It is essential to specify the namepsace this operator belongs to  // NOTE: It is essential to specify the namespace this operator belongs to
1531  Data  Data
1532  escript::operator/(const boost::python::object& left, const Data& right)  escript::operator/(const boost::python::object& left, const Data& right)
1533  {  {
# Line 1224  escript::operator/(const boost::python:: Line 1540  escript::operator/(const boost::python::
1540  }  }
1541    
1542  //  //
 // NOTE: It is essential to specify the namepsace this operator belongs to  
1543  //bool escript::operator==(const Data& left, const Data& right)  //bool escript::operator==(const Data& left, const Data& right)
1544  //{  //{
1545  //  /*  //  /*
# Line 1286  Data::getItem(const boost::python::objec Line 1601  Data::getItem(const boost::python::objec
1601  Data  Data
1602  Data::getSlice(const DataArrayView::RegionType& region) const  Data::getSlice(const DataArrayView::RegionType& region) const
1603  {  {
1604    #if defined DOPROF
1605      profData->slicing++;
1606    #endif
1607    return Data(*this,region);    return Data(*this,region);
1608  }  }
1609    
# Line 1302  Data::setItemD(const boost::python::obje Line 1620  Data::setItemD(const boost::python::obje
1620                 const Data& value)                 const Data& value)
1621  {  {
1622    const DataArrayView& view=getPointDataView();    const DataArrayView& view=getPointDataView();
1623    
1624    DataArrayView::RegionType slice_region=view.getSliceRegion(key);    DataArrayView::RegionType slice_region=view.getSliceRegion(key);
1625    if (slice_region.size()!=view.getRank()) {    if (slice_region.size()!=view.getRank()) {
1626      throw DataException("Error - slice size does not match Data rank.");      throw DataException("Error - slice size does not match Data rank.");
# Line 1317  void Line 1636  void
1636  Data::setSlice(const Data& value,  Data::setSlice(const Data& value,
1637                 const DataArrayView::RegionType& region)                 const DataArrayView::RegionType& region)
1638  {  {
1639    #if defined DOPROF
1640      profData->slicing++;
1641    #endif
1642    Data tempValue(value);    Data tempValue(value);
1643    typeMatchLeft(tempValue);    typeMatchLeft(tempValue);
1644    typeMatchRight(tempValue);    typeMatchRight(tempValue);
# Line 1389  Data::setTaggedValueFromCPP(int tagKey, Line 1711  Data::setTaggedValueFromCPP(int tagKey,
1711    m_data->setTaggedValue(tagKey,value);    m_data->setTaggedValue(tagKey,value);
1712  }  }
1713    
1714    int
1715    Data::getTagNumber(int dpno)
1716    {
1717      return m_data->getTagNumber(dpno);
1718    }
1719    
1720  void  void
1721  Data::setRefValue(int ref,  Data::setRefValue(int ref,
1722                    const boost::python::numeric::array& value)                    const boost::python::numeric::array& value)
# Line 1428  Data::getRefValue(int ref, Line 1756  Data::getRefValue(int ref,
1756    DataArrayView valueView = valueDataArray.getView();    DataArrayView valueView = valueDataArray.getView();
1757    
1758    if (rank==0) {    if (rank==0) {
1759      throw DataException("Data::getRefValue error: only rank 1 data handled for now.");        boost::python::numeric::array temp_numArray(valueView());
1760          value = temp_numArray;
1761    }    }
1762    if (rank==1) {    if (rank==1) {
1763      for (int i=0; i < shape[0]; i++) {      for (int i=0; i < shape[0]; i++) {
# Line 1436  Data::getRefValue(int ref, Line 1765  Data::getRefValue(int ref,
1765      }      }
1766    }    }
1767    if (rank==2) {    if (rank==2) {
1768      throw DataException("Data::getRefValue error: only rank 1 data handled for now.");      for (int i=0; i < shape[0]; i++) {
1769          for (int j=0; j < shape[1]; j++) {
1770            value[i][j] = valueView(i,j);
1771          }
1772        }
1773    }    }
1774    if (rank==3) {    if (rank==3) {
1775      throw DataException("Data::getRefValue error: only rank 1 data handled for now.");      for (int i=0; i < shape[0]; i++) {
1776          for (int j=0; j < shape[1]; j++) {
1777            for (int k=0; k < shape[2]; k++) {
1778              value[i][j][k] = valueView(i,j,k);
1779            }
1780          }
1781        }
1782    }    }
1783    if (rank==4) {    if (rank==4) {
1784      throw DataException("Data::getRefValue error: only rank 1 data handled for now.");      for (int i=0; i < shape[0]; i++) {
1785          for (int j=0; j < shape[1]; j++) {
1786            for (int k=0; k < shape[2]; k++) {
1787              for (int l=0; l < shape[3]; l++) {
1788                value[i][j][k][l] = valueView(i,j,k,l);
1789              }
1790            }
1791          }
1792        }
1793    }    }
1794    
1795  }  }
# Line 1472  Data::archiveData(const std::string file Line 1819  Data::archiveData(const std::string file
1819      dataType = 3;      dataType = 3;
1820      cout << "\tdataType: DataExpanded" << endl;      cout << "\tdataType: DataExpanded" << endl;
1821    }    }
1822    
1823    if (dataType == -1) {    if (dataType == -1) {
1824      throw DataException("archiveData Error: undefined dataType");      throw DataException("archiveData Error: undefined dataType");
1825    }    }
# Line 1511  Data::archiveData(const std::string file Line 1859  Data::archiveData(const std::string file
1859    cout << ">" << endl;    cout << ">" << endl;
1860    
1861    //    //
1862    // Write common data items to archive file    // Open archive file
1863    ofstream archiveFile;    ofstream archiveFile;
1864    archiveFile.open(fileName.data(), ios::out);    archiveFile.open(fileName.data(), ios::out);
1865    
# Line 1519  Data::archiveData(const std::string file Line 1867  Data::archiveData(const std::string file
1867      throw DataException("archiveData Error: problem opening archive file");      throw DataException("archiveData Error: problem opening archive file");
1868    }    }
1869    
1870      //
1871      // Write common data items to archive file
1872    archiveFile.write(reinterpret_cast<char *>(&dataType),sizeof(int));    archiveFile.write(reinterpret_cast<char *>(&dataType),sizeof(int));
1873    archiveFile.write(reinterpret_cast<char *>(&noSamples),sizeof(int));    archiveFile.write(reinterpret_cast<char *>(&noSamples),sizeof(int));
1874    archiveFile.write(reinterpret_cast<char *>(&noDPPSample),sizeof(int));    archiveFile.write(reinterpret_cast<char *>(&noDPPSample),sizeof(int));
# Line 1542  Data::archiveData(const std::string file Line 1892  Data::archiveData(const std::string file
1892      throw DataException("archiveData Error: problem writing to archive file");      throw DataException("archiveData Error: problem writing to archive file");
1893    }    }
1894    
   archiveFile.close();  
   
   if (!archiveFile.good()) {  
     throw DataException("archiveData Error: problem closing archive file");  
   }  
   
1895    //    //
1896    // Collect and archive underlying data values for each Data type    // Archive underlying data values for each Data type
1897      int noValues;
1898    switch (dataType) {    switch (dataType) {
1899      case 0:      case 0:
1900        // DataEmpty        // DataEmpty
1901          noValues = 0;
1902          archiveFile.write(reinterpret_cast<char *>(&noValues),sizeof(int));
1903          cout << "\tnoValues: " << noValues << endl;
1904        break;        break;
1905      case 1:      case 1:
1906        // DataConstant        // DataConstant
1907          noValues = m_data->getLength();
1908          archiveFile.write(reinterpret_cast<char *>(&noValues),sizeof(int));
1909          cout << "\tnoValues: " << noValues << endl;
1910          if (m_data->archiveData(archiveFile,noValues)) {
1911            throw DataException("archiveData Error: problem writing data to archive file");
1912          }
1913        break;        break;
1914      case 2:      case 2:
1915        // DataTagged        // DataTagged
1916          noValues = m_data->getLength();
1917          archiveFile.write(reinterpret_cast<char *>(&noValues),sizeof(int));
1918          cout << "\tnoValues: " << noValues << endl;
1919          if (m_data->archiveData(archiveFile,noValues)) {
1920            throw DataException("archiveData Error: problem writing data to archive file");
1921          }
1922        break;        break;
1923      case 3:      case 3:
1924        // DataExpanded        // DataExpanded
1925          noValues = m_data->getLength();
1926          archiveFile.write(reinterpret_cast<char *>(&noValues),sizeof(int));
1927          cout << "\tnoValues: " << noValues << endl;
1928          if (m_data->archiveData(archiveFile,noValues)) {
1929            throw DataException("archiveData Error: problem writing data to archive file");
1930          }
1931        break;        break;
1932    }    }
1933    
1934      if (!archiveFile.good()) {
1935        throw DataException("archiveData Error: problem writing data to archive file");
1936      }
1937    
1938      //
1939      // Close archive file
1940      archiveFile.close();
1941    
1942      if (!archiveFile.good()) {
1943        throw DataException("archiveData Error: problem closing archive file");
1944      }
1945    
1946  }  }
1947    
1948  void  void
# Line 1590  Data::extractData(const std::string file Line 1968  Data::extractData(const std::string file
1968    int flatShape[4];    int flatShape[4];
1969    
1970    //    //
1971    // Open the archive file and read common data items    // Open the archive file
1972    ifstream archiveFile;    ifstream archiveFile;
1973    archiveFile.open(fileName.data(), ios::in);    archiveFile.open(fileName.data(), ios::in);
1974    
# Line 1598  Data::extractData(const std::string file Line 1976  Data::extractData(const std::string file
1976      throw DataException("extractData Error: problem opening archive file");      throw DataException("extractData Error: problem opening archive file");
1977    }    }
1978    
1979      //
1980      // Read common data items from archive file
1981    archiveFile.read(reinterpret_cast<char *>(&dataType),sizeof(int));    archiveFile.read(reinterpret_cast<char *>(&dataType),sizeof(int));
1982    archiveFile.read(reinterpret_cast<char *>(&noSamples),sizeof(int));    archiveFile.read(reinterpret_cast<char *>(&noSamples),sizeof(int));
1983    archiveFile.read(reinterpret_cast<char *>(&noDPPSample),sizeof(int));    archiveFile.read(reinterpret_cast<char *>(&noDPPSample),sizeof(int));
# Line 1626  Data::extractData(const std::string file Line 2006  Data::extractData(const std::string file
2006      throw DataException("extractData Error: problem reading from archive file");      throw DataException("extractData Error: problem reading from archive file");
2007    }    }
2008    
2009    archiveFile.close();    //
2010      // Verify the values just read from the archive file
   if (!archiveFile.good()) {  
     throw DataException("extractData Error: problem closing archive file");  
   }  
   
2011    switch (dataType) {    switch (dataType) {
2012      case 0:      case 0:
2013        cout << "\tdataType: DataEmpty" << endl;        cout << "\tdataType: DataEmpty" << endl;
# Line 1686  Data::extractData(const std::string file Line 2062  Data::extractData(const std::string file
2062    
2063    //    //
2064    // Load this DataVector with the appropriate values    // Load this DataVector with the appropriate values
2065      int noValues;
2066      archiveFile.read(reinterpret_cast<char *>(&noValues),sizeof(int));
2067      cout << "\tnoValues: " << noValues << endl;
2068    switch (dataType) {    switch (dataType) {
2069      case 0:      case 0:
2070        // DataEmpty        // DataEmpty
2071          if (noValues != 0) {
2072            throw DataException("extractData Error: problem reading data from archive file");
2073          }
2074        break;        break;
2075      case 1:      case 1:
2076        // DataConstant        // DataConstant
2077          if (dataVec.extractData(archiveFile,noValues)) {
2078            throw DataException("extractData Error: problem reading data from archive file");
2079          }
2080        break;        break;
2081      case 2:      case 2:
2082        // DataTagged        // DataTagged
2083          if (dataVec.extractData(archiveFile,noValues)) {
2084            throw DataException("extractData Error: problem reading data from archive file");
2085          }
2086        break;        break;
2087      case 3:      case 3:
2088        // DataExpanded        // DataExpanded
2089          if (dataVec.extractData(archiveFile,noValues)) {
2090            throw DataException("extractData Error: problem reading data from archive file");
2091          }
2092        break;        break;
2093    }    }
2094    
2095      if (!archiveFile.good()) {
2096        throw DataException("extractData Error: problem reading from archive file");
2097      }
2098    
2099      //
2100      // Close archive file
2101      archiveFile.close();
2102    
2103      if (!archiveFile.good()) {
2104        throw DataException("extractData Error: problem closing archive file");
2105      }
2106    
2107    //    //
2108    // Construct an appropriate Data object    // Construct an appropriate Data object
2109    DataAbstract* tempData;    DataAbstract* tempData;
# Line 1724  Data::extractData(const std::string file Line 2127  Data::extractData(const std::string file
2127    }    }
2128    shared_ptr<DataAbstract> temp_data(tempData);    shared_ptr<DataAbstract> temp_data(tempData);
2129    m_data=temp_data;    m_data=temp_data;
   
2130  }  }
2131    
2132  ostream& escript::operator<<(ostream& o, const Data& data)  ostream& escript::operator<<(ostream& o, const Data& data)

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

  ViewVC Help
Powered by ViewVC 1.1.26