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

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

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

revision 698 by gross, Fri Mar 31 04:52:55 2006 UTC revision 950 by gross, Tue Feb 6 07:01:11 2007 UTC
# Line 15  Line 15 
15    
16  #ifndef DATA_H  #ifndef DATA_H
17  #define DATA_H  #define DATA_H
18    #include "system_dep.h"
19    
20  #include "DataAbstract.h"  #include "DataAbstract.h"
21  #include "DataAlgorithm.h"  #include "DataAlgorithm.h"
# Line 25  Line 26 
26    
27  extern "C" {  extern "C" {
28  #include "DataC.h"  #include "DataC.h"
29    #include "paso/Paso.h"
30  }  }
31    
32    #ifndef PASO_MPI
33    #define MPI_Comm long
34    #endif
35    
36  #include <string>  #include <string>
37  #include <algorithm>  #include <algorithm>
38    
# Line 64  class Data { Line 70  class Data {
70    typedef double (*UnaryDFunPtr)(double);    typedef double (*UnaryDFunPtr)(double);
71    typedef double (*BinaryDFunPtr)(double,double);    typedef double (*BinaryDFunPtr)(double,double);
72    
73    
74    /**    /**
75       Constructors.       Constructors.
76    */    */
# Line 73  class Data { Line 80  class Data {
80       Default constructor.       Default constructor.
81       Creates a DataEmpty object.       Creates a DataEmpty object.
82    */    */
83      ESCRIPT_DLL_API
84    Data();    Data();
85    
86    /**    /**
# Line 80  class Data { Line 88  class Data {
88       Copy constructor.       Copy constructor.
89       WARNING: Only performs a shallow copy.       WARNING: Only performs a shallow copy.
90    */    */
91      ESCRIPT_DLL_API
92    Data(const Data& inData);    Data(const Data& inData);
93    
94    /**    /**
# Line 88  class Data { Line 97  class Data {
97       function space of inData the inData are tried to be interpolated to what,       function space of inData the inData are tried to be interpolated to what,
98       otherwise a shallow copy of inData is returned.       otherwise a shallow copy of inData is returned.
99    */    */
100      ESCRIPT_DLL_API
101    Data(const Data& inData,    Data(const Data& inData,
102         const FunctionSpace& what);         const FunctionSpace& what);
103    
# Line 101  class Data { Line 111  class Data {
111                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
112                         mechanism will be used.                         mechanism will be used.
113    */    */
114      ESCRIPT_DLL_API
115    Data(const DataArrayView& value,    Data(const DataArrayView& value,
116         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
117         bool expanded=false);         bool expanded=false);
# Line 116  class Data { Line 127  class Data {
127                         the given value. Otherwise a more efficient storage                         the given value. Otherwise a more efficient storage
128                         mechanism will be used.                         mechanism will be used.
129    */    */
130      ESCRIPT_DLL_API
131    Data(double value,    Data(double value,
132         const DataArrayView::ShapeType& dataPointShape=DataArrayView::ShapeType(),         const DataArrayView::ShapeType& dataPointShape=DataArrayView::ShapeType(),
133         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
# Line 128  class Data { Line 140  class Data {
140       \param inData - Input - Input Data object.       \param inData - Input - Input Data object.
141       \param region - Input - Region to copy.       \param region - Input - Region to copy.
142    */    */
143      ESCRIPT_DLL_API
144    Data(const Data& inData,    Data(const Data& inData,
145         const DataArrayView::RegionType& region);         const DataArrayView::RegionType& region);
146    
# Line 145  class Data { Line 158  class Data {
158                         the appropriate values.                         the appropriate values.
159      ==>*      ==>*
160    */    */
161      ESCRIPT_DLL_API
162    Data(const DataTagged::TagListType& tagKeys,    Data(const DataTagged::TagListType& tagKeys,
163         const DataTagged::ValueListType& values,         const DataTagged::ValueListType& values,
164         const DataArrayView& defaultValue,         const DataArrayView& defaultValue,
# Line 161  class Data { Line 175  class Data {
175                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
176                         mechanism will be used.                         mechanism will be used.
177    */    */
178      ESCRIPT_DLL_API
179    Data(const boost::python::numeric::array& value,    Data(const boost::python::numeric::array& value,
180         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
181         bool expanded=false);         bool expanded=false);
# Line 176  class Data { Line 191  class Data {
191                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
192                         mechanism will be used.                         mechanism will be used.
193    */    */
194      ESCRIPT_DLL_API
195    Data(const boost::python::object& value,    Data(const boost::python::object& value,
196         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
197         bool expanded=false);         bool expanded=false);
# Line 189  class Data { Line 205  class Data {
205       \param value - Input - Input data.       \param value - Input - Input data.
206       \param other - Input - contains all other parameters.       \param other - Input - contains all other parameters.
207    */    */
208      ESCRIPT_DLL_API
209    Data(const boost::python::object& value,    Data(const boost::python::object& value,
210         const Data& other);         const Data& other);
211    
# Line 196  class Data { Line 213  class Data {
213       \brief       \brief
214       Constructor which creates a DataConstant of "shape" with constant value.       Constructor which creates a DataConstant of "shape" with constant value.
215    */    */
216      ESCRIPT_DLL_API
217    Data(double value,    Data(double value,
218         const boost::python::tuple& shape=boost::python::make_tuple(),         const boost::python::tuple& shape=boost::python::make_tuple(),
219         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
# Line 204  class Data { Line 222  class Data {
222       \brief       \brief
223       Destructor       Destructor
224    */    */
225      ESCRIPT_DLL_API
226    ~Data();    ~Data();
227    
228    /**    /**
229       \brief       \brief
230       Perform a deep copy.       Perform a deep copy.
231    */    */
232      ESCRIPT_DLL_API
233    void    void
234    copy(const Data& other);    copy(const Data& other);
235    
# Line 219  class Data { Line 239  class Data {
239    
240    /**    /**
241       \brief       \brief
242         switches on update protection
243    
244      */
245      ESCRIPT_DLL_API
246      void
247      setProtection();
248    
249      /**
250         \brief
251         Returns trueif the data object is protected against update
252    
253      */
254      ESCRIPT_DLL_API
255      bool
256      isProtected() const;
257      /**
258         \brief
259       Return the values of all data-points as a single python numarray object.       Return the values of all data-points as a single python numarray object.
260    */    */
261      ESCRIPT_DLL_API
262    const boost::python::numeric::array    const boost::python::numeric::array
263    convertToNumArray();    convertToNumArray();
264    
265    /**    /**
266       \brief       \brief
267       Return the values of all data-points for the given sample as a single python numarray object.       Fills the expanded Data object from values of a python numarray object.
268    */    */
269    const boost::python::numeric::array    ESCRIPT_DLL_API
270    convertToNumArrayFromSampleNo(int sampleNo);    void
271      fillFromNumArray(const boost::python::numeric::array);
272    
273    /**    /**
274       \brief       \brief
275       Return the value of the specified data-point as a single python numarray object.       Return the values of a data point on this process
276    */    */
277      ESCRIPT_DLL_API
278    const boost::python::numeric::array    const boost::python::numeric::array
279    convertToNumArrayFromDPNo(int sampleNo,    getValueOfDataPoint(int dataPointNo);
                             int dataPointNo);  
280    
281    /**    /**
282       \brief       \brief
283       Fills the expanded Data object from values of a python numarray object.       sets the values of a data-point on this process
284    */    */
285      ESCRIPT_DLL_API
286    void    void
287    fillFromNumArray(const boost::python::numeric::array);    setValueOfDataPointToArray(int dataPointNo, const boost::python::numeric::array);
288    
289      /**
290         \brief
291         sets the values of a data-point on this process
292      */
293      ESCRIPT_DLL_API
294      void
295      setValueOfDataPoint(int dataPointNo, const double);
296    
297      /**
298         \brief
299         Return the value of the specified data-point across all processors
300      */
301      ESCRIPT_DLL_API
302      const boost::python::numeric::array
303      getValueOfGlobalDataPoint(int procNo, int dataPointNo);
304    
305    /**    /**
306       \brief       \brief
# Line 253  class Data { Line 309  class Data {
309       The data-point number here corresponds to the data-point number in the       The data-point number here corresponds to the data-point number in the
310       numarray returned by convertToNumArray.       numarray returned by convertToNumArray.
311    */    */
312      ESCRIPT_DLL_API
313    int    int
314    getTagNumber(int dpno);    getTagNumber(int dpno);
315    
# Line 260  class Data { Line 317  class Data {
317       \brief       \brief
318       Return the C wrapper for the Data object.       Return the C wrapper for the Data object.
319    */    */
320      ESCRIPT_DLL_API
321    escriptDataC    escriptDataC
322    getDataC();    getDataC();
323    
# Line 267  class Data { Line 325  class Data {
325       \brief       \brief
326       Return the C wrapper for the Data object - const version.       Return the C wrapper for the Data object - const version.
327    */    */
328      ESCRIPT_DLL_API
329    escriptDataC    escriptDataC
330    getDataC() const;    getDataC() const;
331    
# Line 274  class Data { Line 333  class Data {
333       \brief       \brief
334       Write the data as a string.       Write the data as a string.
335    */    */
336      ESCRIPT_DLL_API
337    inline    inline
338    std::string    std::string
339    toString() const    toString() const
# Line 287  class Data { Line 347  class Data {
347       the shape information for each data point although it also may be used       the shape information for each data point although it also may be used
348       to manipulate the point data.       to manipulate the point data.
349    */    */
350      ESCRIPT_DLL_API
351    inline    inline
352    const DataArrayView&    const DataArrayView&
353    getPointDataView() const    getPointDataView() const
# Line 298  class Data { Line 359  class Data {
359       \brief       \brief
360       Whatever the current Data type make this into a DataExpanded.       Whatever the current Data type make this into a DataExpanded.
361    */    */
362      ESCRIPT_DLL_API
363    void    void
364    expand();    expand();
365    
# Line 308  class Data { Line 370  class Data {
370       Expanded data to tagged will throw an exception.       Expanded data to tagged will throw an exception.
371      ==>*      ==>*
372    */    */
373      ESCRIPT_DLL_API
374    void    void
375    tag();    tag();
376    
# Line 315  class Data { Line 378  class Data {
378       \brief       \brief
379       Return true if this Data is expanded.       Return true if this Data is expanded.
380    */    */
381      ESCRIPT_DLL_API
382    bool    bool
383    isExpanded() const;    isExpanded() const;
384    
# Line 322  class Data { Line 386  class Data {
386       \brief       \brief
387       Return true if this Data is tagged.       Return true if this Data is tagged.
388    */    */
389      ESCRIPT_DLL_API
390    bool    bool
391    isTagged() const;    isTagged() const;
392    
# Line 329  class Data { Line 394  class Data {
394       \brief       \brief
395       Return true if this Data is constant.       Return true if this Data is constant.
396    */    */
397      ESCRIPT_DLL_API
398    bool    bool
399    isConstant() const;    isConstant() const;
400    
# Line 336  class Data { Line 402  class Data {
402       \brief       \brief
403       Return true if this Data is empty.       Return true if this Data is empty.
404    */    */
405      ESCRIPT_DLL_API
406    bool    bool
407    isEmpty() const;    isEmpty() const;
408    
# Line 343  class Data { Line 410  class Data {
410       \brief       \brief
411       Return the function space.       Return the function space.
412    */    */
413      ESCRIPT_DLL_API
414    inline    inline
415    const FunctionSpace&    const FunctionSpace&
416    getFunctionSpace() const    getFunctionSpace() const
# Line 354  class Data { Line 422  class Data {
422       \brief       \brief
423       Return a copy of the function space.       Return a copy of the function space.
424    */    */
425      ESCRIPT_DLL_API
426    const FunctionSpace    const FunctionSpace
427    getCopyOfFunctionSpace() const;    getCopyOfFunctionSpace() const;
428    
# Line 361  class Data { Line 430  class Data {
430       \brief       \brief
431       Return the domain.       Return the domain.
432    */    */
433      ESCRIPT_DLL_API
434    inline    inline
435    const AbstractDomain&    const AbstractDomain&
436    getDomain() const    getDomain() const
# Line 372  class Data { Line 442  class Data {
442       \brief       \brief
443       Return a copy of the domain.       Return a copy of the domain.
444    */    */
445      ESCRIPT_DLL_API
446    const AbstractDomain    const AbstractDomain
447    getCopyOfDomain() const;    getCopyOfDomain() const;
448    
# Line 379  class Data { Line 450  class Data {
450       \brief       \brief
451       Return the rank of the point data.       Return the rank of the point data.
452    */    */
453      ESCRIPT_DLL_API
454    inline    inline
455    int    int
456    getDataPointRank() const    getDataPointRank() const
# Line 388  class Data { Line 460  class Data {
460    
461    /**    /**
462       \brief       \brief
463         Return the number of data points
464      */
465      ESCRIPT_DLL_API
466      inline
467      int
468      getNumDataPoints() const
469      {
470        return getNumSamples() * getNumDataPointsPerSample();
471      }
472      /**
473         \brief
474       Return the number of samples.       Return the number of samples.
475    */    */
476      ESCRIPT_DLL_API
477    inline    inline
478    int    int
479    getNumSamples() const    getNumSamples() const
# Line 401  class Data { Line 485  class Data {
485       \brief       \brief
486       Return the number of data points per sample.       Return the number of data points per sample.
487    */    */
488      ESCRIPT_DLL_API
489    inline    inline
490    int    int
491    getNumDataPointsPerSample() const    getNumDataPointsPerSample() const
492    {    {
493      return m_data->getNumDPPSample();      return m_data->getNumDPPSample();
494    }    }
495      /**
496         \brief
497         dumps the object into a netCDF file
498      */
499      ESCRIPT_DLL_API
500      inline
501      void
502      dump(const std::string fileName) const
503      {
504        return m_data->dump(fileName);
505      }
506    
507    /**    /**
508       \brief       \brief
# Line 414  class Data { Line 510  class Data {
510       preferred interface but is provided for use by C code.       preferred interface but is provided for use by C code.
511       \param sampleNo - Input - the given sample no.       \param sampleNo - Input - the given sample no.
512    */    */
513      ESCRIPT_DLL_API
514    inline    inline
515    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
516    getSampleData(DataAbstract::ValueType::size_type sampleNo)    getSampleData(DataAbstract::ValueType::size_type sampleNo)
# Line 427  class Data { Line 524  class Data {
524       access data that isn't tagged an exception will be thrown.       access data that isn't tagged an exception will be thrown.
525       \param tag - Input - the tag key.       \param tag - Input - the tag key.
526    */    */
527      ESCRIPT_DLL_API
528    inline    inline
529    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
530    getSampleDataByTag(int tag)    getSampleDataByTag(int tag)
# Line 450  class Data { Line 548  class Data {
548       \param value - Input - value to assign to data-points associated with       \param value - Input - value to assign to data-points associated with
549                              the given reference number.                              the given reference number.
550    */    */
551      ESCRIPT_DLL_API
552    void    void
553    setRefValue(int ref,    setValueByReferenceNumber(int ref,
554                const boost::python::numeric::array& value);                              const boost::python::numeric::array& value);
555    
556    /**    /**
557       \brief       \brief
# Line 469  class Data { Line 568  class Data {
568       \param value - Output - object to receive values from data-points       \param value - Output - object to receive values from data-points
569                               associated with the given reference number.                               associated with the given reference number.
570    */    */
571      ESCRIPT_DLL_API
572    void    void
573    getRefValue(int ref,    getValueByReferenceNumber(int ref,
574                boost::python::numeric::array& value);                              boost::python::numeric::array& value);
575    
576    /**    /**
577       \brief       \brief
# Line 481  class Data { Line 581  class Data {
581       \param sampleNo - Input -       \param sampleNo - Input -
582       \param dataPointNo - Input -       \param dataPointNo - Input -
583    */    */
584      ESCRIPT_DLL_API
585    inline    inline
586    DataArrayView    DataArrayView
587    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
588                 int dataPointNo)                 int dataPointNo)
589    {    {
590      return m_data->getDataPoint(sampleNo,dataPointNo);          return m_data->getDataPoint(sampleNo,dataPointNo);
591    }    }
592    
593    /**    /**
594       \brief       \brief
595       Return a reference to the data point shape.       Return a reference to the data point shape.
596    */    */
597      ESCRIPT_DLL_API
598    const DataArrayView::ShapeType&    const DataArrayView::ShapeType&
599    getDataPointShape() const;    getDataPointShape() const;
600    
# Line 500  class Data { Line 602  class Data {
602       \brief       \brief
603       Return the data point shape as a tuple of integers.       Return the data point shape as a tuple of integers.
604    */    */
605      ESCRIPT_DLL_API
606    const boost::python::tuple    const boost::python::tuple
607    getShapeTuple() const;    getShapeTuple() const;
608    
# Line 508  class Data { Line 611  class Data {
611       Return the size of the data point. It is the product of the       Return the size of the data point. It is the product of the
612       data point shape dimensions.       data point shape dimensions.
613    */    */
614      ESCRIPT_DLL_API
615    int    int
616    getDataPointSize() const;    getDataPointSize() const;
617    
# Line 515  class Data { Line 619  class Data {
619       \brief       \brief
620       Return the number of doubles stored for this Data.       Return the number of doubles stored for this Data.
621    */    */
622      ESCRIPT_DLL_API
623    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
624    getLength() const;    getLength() const;
625    
# Line 527  class Data { Line 632  class Data {
632       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
633      ==>*      ==>*
634    */    */
635      ESCRIPT_DLL_API
636    void    void
637    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
638                   const boost::python::object& value);                   const boost::python::object& value);
# Line 540  class Data { Line 646  class Data {
646       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
647      ==>*      ==>*
648    */    */
649      ESCRIPT_DLL_API
650    void    void
651    setTaggedValueFromCPP(int tagKey,    setTaggedValueFromCPP(int tagKey,
652                          const DataArrayView& value);                          const DataArrayView& value);
# Line 548  class Data { Line 655  class Data {
655      \brief      \brief
656      Copy other Data object into this Data object where mask is positive.      Copy other Data object into this Data object where mask is positive.
657    */    */
658      ESCRIPT_DLL_API
659    void    void
660    copyWithMask(const Data& other,    copyWithMask(const Data& other,
661                 const Data& mask);                 const Data& mask);
# Line 562  class Data { Line 670  class Data {
670       the result as a Data object.       the result as a Data object.
671       *       *
672    */    */
673      ESCRIPT_DLL_API
674    Data    Data
675    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
676    
# Line 571  class Data { Line 680  class Data {
680       If functionspace is not present the function space of Function(getDomain()) is used.       If functionspace is not present the function space of Function(getDomain()) is used.
681       *       *
682    */    */
683      ESCRIPT_DLL_API
684    Data    Data
685    gradOn(const FunctionSpace& functionspace) const;    gradOn(const FunctionSpace& functionspace) const;
686    
687      ESCRIPT_DLL_API
688    Data    Data
689    grad() const;    grad() const;
690    
# Line 582  class Data { Line 693  class Data {
693       Calculate the integral over the function space domain.       Calculate the integral over the function space domain.
694       *       *
695    */    */
696      ESCRIPT_DLL_API
697    boost::python::numeric::array    boost::python::numeric::array
698    integrate() const;    integrate() const;
699    
700    /**    /**
701       \brief       \brief
702         Returns 1./ Data object
703         *
704      */
705      ESCRIPT_DLL_API
706      Data
707      oneOver() const;
708      /**
709         \brief
710       Return a Data with a 1 for +ive values and a 0 for 0 or -ive values.       Return a Data with a 1 for +ive values and a 0 for 0 or -ive values.
711       *       *
712    */    */
713      ESCRIPT_DLL_API
714    Data    Data
715    wherePositive() const;    wherePositive() const;
716    
# Line 598  class Data { Line 719  class Data {
719       Return a Data with a 1 for -ive values and a 0 for +ive or 0 values.       Return a Data with a 1 for -ive values and a 0 for +ive or 0 values.
720       *       *
721    */    */
722      ESCRIPT_DLL_API
723    Data    Data
724    whereNegative() const;    whereNegative() const;
725    
# Line 606  class Data { Line 728  class Data {
728       Return a Data with a 1 for +ive or 0 values and a 0 for -ive values.       Return a Data with a 1 for +ive or 0 values and a 0 for -ive values.
729       *       *
730    */    */
731      ESCRIPT_DLL_API
732    Data    Data
733    whereNonNegative() const;    whereNonNegative() const;
734    
# Line 614  class Data { Line 737  class Data {
737       Return a Data with a 1 for -ive or 0 values and a 0 for +ive values.       Return a Data with a 1 for -ive or 0 values and a 0 for +ive values.
738       *       *
739    */    */
740      ESCRIPT_DLL_API
741    Data    Data
742    whereNonPositive() const;    whereNonPositive() const;
743    
# Line 622  class Data { Line 746  class Data {
746       Return a Data with a 1 for 0 values and a 0 for +ive or -ive values.       Return a Data with a 1 for 0 values and a 0 for +ive or -ive values.
747       *       *
748    */    */
749      ESCRIPT_DLL_API
750    Data    Data
751    whereZero(double tol=0.0) const;    whereZero(double tol=0.0) const;
752    
# Line 630  class Data { Line 755  class Data {
755       Return a Data with a 0 for 0 values and a 1 for +ive or -ive values.       Return a Data with a 0 for 0 values and a 1 for +ive or -ive values.
756       *       *
757    */    */
758      ESCRIPT_DLL_API
759    Data    Data
760    whereNonZero(double tol=0.0) const;    whereNonZero(double tol=0.0) const;
761    
# Line 638  class Data { Line 764  class Data {
764       Return the maximum absolute value of this Data object.       Return the maximum absolute value of this Data object.
765       *       *
766    */    */
767      ESCRIPT_DLL_API
768    double    double
769    Lsup() const;    Lsup() const;
770    
# Line 646  class Data { Line 773  class Data {
773       Return the minimum absolute value of this Data object.       Return the minimum absolute value of this Data object.
774       *       *
775    */    */
776      ESCRIPT_DLL_API
777    double    double
778    Linf() const;    Linf() const;
779    
# Line 654  class Data { Line 782  class Data {
782       Return the maximum value of this Data object.       Return the maximum value of this Data object.
783       *       *
784    */    */
785      ESCRIPT_DLL_API
786    double    double
787    sup() const;    sup() const;
788    
# Line 662  class Data { Line 791  class Data {
791       Return the minimum value of this Data object.       Return the minimum value of this Data object.
792       *       *
793    */    */
794      ESCRIPT_DLL_API
795    double    double
796    inf() const;    inf() const;
797    
# Line 670  class Data { Line 800  class Data {
800       Return the absolute value of each data point of this Data object.       Return the absolute value of each data point of this Data object.
801       *       *
802    */    */
803      ESCRIPT_DLL_API
804    Data    Data
805    abs() const;    abs() const;
806    
# Line 678  class Data { Line 809  class Data {
809       Return the maximum value of each data point of this Data object.       Return the maximum value of each data point of this Data object.
810       *       *
811    */    */
812      ESCRIPT_DLL_API
813    Data    Data
814    maxval() const;    maxval() const;
815    
# Line 686  class Data { Line 818  class Data {
818       Return the minimum value of each data point of this Data object.       Return the minimum value of each data point of this Data object.
819       *       *
820    */    */
821      ESCRIPT_DLL_API
822    Data    Data
823    minval() const;    minval() const;
824    
# Line 694  class Data { Line 827  class Data {
827       Return the (sample number, data-point number) of the data point with       Return the (sample number, data-point number) of the data point with
828       the minimum value in this Data object.       the minimum value in this Data object.
829    */    */
830      ESCRIPT_DLL_API
831    const boost::python::tuple    const boost::python::tuple
832    mindp() const;    minGlobalDataPoint() const;
833    
834      ESCRIPT_DLL_API
835    void    void
836    calc_mindp(int& SampleNo,    calc_minGlobalDataPoint(int& ProcNo,  int& DataPointNo) const;
              int& DataPointNo) const;  
   
837    /**    /**
838       \brief       \brief
839       Return the sign of each data point of this Data object.       Return the sign of each data point of this Data object.
840       -1 for negative values, zero for zero values, 1 for positive values.       -1 for negative values, zero for zero values, 1 for positive values.
841       *       *
842    */    */
843      ESCRIPT_DLL_API
844    Data    Data
845    sign() const;    sign() const;
846    
847    /**    /**
848       \brief       \brief
849         Return the symmetric part of a matrix which is half the matrix plus its transpose.
850         *
851      */
852      ESCRIPT_DLL_API
853      Data
854      symmetric() const;
855    
856      /**
857         \brief
858         Return the nonsymmetric part of a matrix which is half the matrix minus its transpose.
859         *
860      */
861      ESCRIPT_DLL_API
862      Data
863      nonsymmetric() const;
864    
865      /**
866         \brief
867         Return the trace of a matrix
868         *
869      */
870      ESCRIPT_DLL_API
871      Data
872      trace(int axis_offset) const;
873    
874      /**
875         \brief
876         Transpose each data point of this Data object around the given axis.
877         *
878      */
879      ESCRIPT_DLL_API
880      Data
881      transpose(int axis_offset) const;
882    
883      /**
884         \brief
885       Return the eigenvalues of the symmetric part at each data point of this Data object in increasing values.       Return the eigenvalues of the symmetric part at each data point of this Data object in increasing values.
886       Currently this function is restricted to rank 2, square shape, and dimension 3.       Currently this function is restricted to rank 2, square shape, and dimension 3.
887       *       *
888    */    */
889      ESCRIPT_DLL_API
890    Data    Data
891    eigenvalues() const;    eigenvalues() const;
892    
# Line 728  class Data { Line 899  class Data {
899       Currently this function is restricted to rank 2, square shape, and dimension 3       Currently this function is restricted to rank 2, square shape, and dimension 3
900       *       *
901    */    */
902      ESCRIPT_DLL_API
903    const boost::python::tuple    const boost::python::tuple
904    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;
905    
906    /**    /**
907       \brief       \brief
908       Transpose each data point of this Data object around the given axis.       swaps the components axis0 and axis1
      --* not implemented yet *--  
909       *       *
910    */    */
911      ESCRIPT_DLL_API
912    Data    Data
913    transpose(int axis) const;    swapaxes(const int axis0, const int axis1) const;
914    
915    /**    /**
916       \brief       \brief
917       Calculate the trace of each data point of this Data object.       Return the error function erf of each data point of this Data object.
918       *       *
919    */    */
920      ESCRIPT_DLL_API
921    Data    Data
922    trace() const;    erf() const;
923    
924    /**    /**
925       \brief       \brief
926       Return the sin of each data point of this Data object.       Return the sin of each data point of this Data object.
927       *       *
928    */    */
929      ESCRIPT_DLL_API
930    Data    Data
931    sin() const;    sin() const;
932    
# Line 761  class Data { Line 935  class Data {
935       Return the cos of each data point of this Data object.       Return the cos of each data point of this Data object.
936       *       *
937    */    */
938      ESCRIPT_DLL_API
939    Data    Data
940    cos() const;    cos() const;
941    
# Line 769  class Data { Line 944  class Data {
944       Return the tan of each data point of this Data object.       Return the tan of each data point of this Data object.
945       *       *
946    */    */
947      ESCRIPT_DLL_API
948    Data    Data
949    tan() const;    tan() const;
950    
# Line 777  class Data { Line 953  class Data {
953       Return the asin of each data point of this Data object.       Return the asin of each data point of this Data object.
954       *       *
955    */    */
956      ESCRIPT_DLL_API
957    Data    Data
958    asin() const;    asin() const;
959    
# Line 785  class Data { Line 962  class Data {
962       Return the acos of each data point of this Data object.       Return the acos of each data point of this Data object.
963       *       *
964    */    */
965      ESCRIPT_DLL_API
966    Data    Data
967    acos() const;    acos() const;
968    
# Line 793  class Data { Line 971  class Data {
971       Return the atan of each data point of this Data object.       Return the atan of each data point of this Data object.
972       *       *
973    */    */
974      ESCRIPT_DLL_API
975    Data    Data
976    atan() const;    atan() const;
977    
# Line 801  class Data { Line 980  class Data {
980       Return the sinh of each data point of this Data object.       Return the sinh of each data point of this Data object.
981       *       *
982    */    */
983      ESCRIPT_DLL_API
984    Data    Data
985    sinh() const;    sinh() const;
986    
# Line 809  class Data { Line 989  class Data {
989       Return the cosh of each data point of this Data object.       Return the cosh of each data point of this Data object.
990       *       *
991    */    */
992      ESCRIPT_DLL_API
993    Data    Data
994    cosh() const;    cosh() const;
995    
# Line 817  class Data { Line 998  class Data {
998       Return the tanh of each data point of this Data object.       Return the tanh of each data point of this Data object.
999       *       *
1000    */    */
1001      ESCRIPT_DLL_API
1002    Data    Data
1003    tanh() const;    tanh() const;
1004    
# Line 825  class Data { Line 1007  class Data {
1007       Return the asinh of each data point of this Data object.       Return the asinh of each data point of this Data object.
1008       *       *
1009    */    */
1010      ESCRIPT_DLL_API
1011    Data    Data
1012    asinh() const;    asinh() const;
1013    
# Line 833  class Data { Line 1016  class Data {
1016       Return the acosh of each data point of this Data object.       Return the acosh of each data point of this Data object.
1017       *       *
1018    */    */
1019      ESCRIPT_DLL_API
1020    Data    Data
1021    acosh() const;    acosh() const;
1022    
# Line 841  class Data { Line 1025  class Data {
1025       Return the atanh of each data point of this Data object.       Return the atanh of each data point of this Data object.
1026       *       *
1027    */    */
1028      ESCRIPT_DLL_API
1029    Data    Data
1030    atanh() const;    atanh() const;
1031    
# Line 849  class Data { Line 1034  class Data {
1034       Return the log to base 10 of each data point of this Data object.       Return the log to base 10 of each data point of this Data object.
1035       *       *
1036    */    */
1037      ESCRIPT_DLL_API
1038    Data    Data
1039    log10() const;    log10() const;
1040    
# Line 857  class Data { Line 1043  class Data {
1043       Return the natural log of each data point of this Data object.       Return the natural log of each data point of this Data object.
1044       *       *
1045    */    */
1046      ESCRIPT_DLL_API
1047    Data    Data
1048    log() const;    log() const;
1049    
# Line 865  class Data { Line 1052  class Data {
1052       Return the exponential function of each data point of this Data object.       Return the exponential function of each data point of this Data object.
1053       *       *
1054    */    */
1055      ESCRIPT_DLL_API
1056    Data    Data
1057    exp() const;    exp() const;
1058    
# Line 873  class Data { Line 1061  class Data {
1061       Return the square root of each data point of this Data object.       Return the square root of each data point of this Data object.
1062       *       *
1063    */    */
1064      ESCRIPT_DLL_API
1065    Data    Data
1066    sqrt() const;    sqrt() const;
1067    
# Line 881  class Data { Line 1070  class Data {
1070       Return the negation of each data point of this Data object.       Return the negation of each data point of this Data object.
1071       *       *
1072    */    */
1073      ESCRIPT_DLL_API
1074    Data    Data
1075    neg() const;    neg() const;
1076    
# Line 890  class Data { Line 1080  class Data {
1080       Simply returns this object unmodified.       Simply returns this object unmodified.
1081       *       *
1082    */    */
1083      ESCRIPT_DLL_API
1084    Data    Data
1085    pos() const;    pos() const;
1086    
# Line 900  class Data { Line 1091  class Data {
1091       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1092       *       *
1093    */    */
1094      ESCRIPT_DLL_API
1095    Data    Data
1096    powD(const Data& right) const;    powD(const Data& right) const;
1097    
# Line 910  class Data { Line 1102  class Data {
1102       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1103       *       *
1104     */     */
1105      ESCRIPT_DLL_API
1106    Data    Data
1107    powO(const boost::python::object& right) const;    powO(const boost::python::object& right) const;
1108    
1109    /**    /**
1110       \brief       \brief
1111         Return the given power of each data point of this boost python object.
1112        
1113         \param left Input - the bases
1114         *
1115       */
1116    
1117      ESCRIPT_DLL_API
1118      Data
1119      rpowO(const boost::python::object& left) const;
1120    
1121      /**
1122         \brief
1123       writes the object to a file in the DX file format       writes the object to a file in the DX file format
1124    */    */
1125      ESCRIPT_DLL_API
1126    void    void
1127    saveDX(std::string fileName) const;    saveDX(std::string fileName) const;
1128    
# Line 924  class Data { Line 1130  class Data {
1130       \brief       \brief
1131       writes the object to a file in the VTK file format       writes the object to a file in the VTK file format
1132    */    */
1133      ESCRIPT_DLL_API
1134    void    void
1135    saveVTK(std::string fileName) const;    saveVTK(std::string fileName) const;
1136    
# Line 933  class Data { Line 1140  class Data {
1140       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1141       *       *
1142    */    */
1143      ESCRIPT_DLL_API
1144    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
1145      ESCRIPT_DLL_API
1146    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
1147    
1148    /**    /**
# Line 942  class Data { Line 1151  class Data {
1151       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1152       *       *
1153    */    */
1154      ESCRIPT_DLL_API
1155    Data& operator-=(const Data& right);    Data& operator-=(const Data& right);
1156      ESCRIPT_DLL_API
1157    Data& operator-=(const boost::python::object& right);    Data& operator-=(const boost::python::object& right);
1158    
1159   /**   /**
# Line 951  class Data { Line 1162  class Data {
1162       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1163       *       *
1164    */    */
1165      ESCRIPT_DLL_API
1166    Data& operator*=(const Data& right);    Data& operator*=(const Data& right);
1167      ESCRIPT_DLL_API
1168    Data& operator*=(const boost::python::object& right);    Data& operator*=(const boost::python::object& right);
1169    
1170   /**   /**
# Line 960  class Data { Line 1173  class Data {
1173       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1174       *       *
1175    */    */
1176      ESCRIPT_DLL_API
1177    Data& operator/=(const Data& right);    Data& operator/=(const Data& right);
1178      ESCRIPT_DLL_API
1179    Data& operator/=(const boost::python::object& right);    Data& operator/=(const boost::python::object& right);
1180    
1181    /**    /**
1182       \brief       \brief
1183       Returns true if this can be interpolated to functionspace.       Returns true if this can be interpolated to functionspace.
1184    */    */
1185      ESCRIPT_DLL_API
1186    bool    bool
1187    probeInterpolation(const FunctionSpace& functionspace) const;    probeInterpolation(const FunctionSpace& functionspace) const;
1188    
# Line 985  class Data { Line 1201  class Data {
1201       \param key - Input - python slice tuple specifying       \param key - Input - python slice tuple specifying
1202       slice to return.       slice to return.
1203    */    */
1204      ESCRIPT_DLL_API
1205    Data    Data
1206    getItem(const boost::python::object& key) const;    getItem(const boost::python::object& key) const;
1207    
# Line 999  class Data { Line 1216  class Data {
1216       slice to copy from value.       slice to copy from value.
1217       \param value - Input - Data object to copy from.       \param value - Input - Data object to copy from.
1218    */    */
1219      ESCRIPT_DLL_API
1220    void    void
1221    setItemD(const boost::python::object& key,    setItemD(const boost::python::object& key,
1222             const Data& value);             const Data& value);
1223    
1224      ESCRIPT_DLL_API
1225    void    void
1226    setItemO(const boost::python::object& key,    setItemO(const boost::python::object& key,
1227             const boost::python::object& value);             const boost::python::object& value);
# Line 1015  class Data { Line 1234  class Data {
1234       this Data object.       this Data object.
1235    */    */
1236    template <class UnaryFunction>    template <class UnaryFunction>
1237      ESCRIPT_DLL_API
1238    inline    inline
1239    void    void
1240    unaryOp(UnaryFunction operation);    unaryOp(UnaryFunction operation);
# Line 1026  class Data { Line 1246  class Data {
1246       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1247       *       *
1248    */    */
1249      ESCRIPT_DLL_API
1250    Data    Data
1251    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
1252    
# Line 1037  class Data { Line 1258  class Data {
1258       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1259       *       *
1260    */    */
1261      ESCRIPT_DLL_API
1262    void    void
1263    setSlice(const Data& value,    setSlice(const Data& value,
1264             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
# Line 1046  class Data { Line 1268  class Data {
1268       Archive the current Data object to the given file.       Archive the current Data object to the given file.
1269       \param fileName - Input - file to archive to.       \param fileName - Input - file to archive to.
1270    */    */
1271      ESCRIPT_DLL_API
1272    void    void
1273    archiveData(const std::string fileName);    archiveData(const std::string fileName);
1274    
# Line 1057  class Data { Line 1280  class Data {
1280       \param fileName - Input - file to extract from.       \param fileName - Input - file to extract from.
1281       \param fspace - Input - a suitable FunctionSpace descibing the data.       \param fspace - Input - a suitable FunctionSpace descibing the data.
1282    */    */
1283      ESCRIPT_DLL_API
1284    void    void
1285    extractData(const std::string fileName,    extractData(const std::string fileName,
1286                const FunctionSpace& fspace);                const FunctionSpace& fspace);
1287    
1288    
1289      /**
1290         \brief
1291         print the data values to stdout. Used for debugging
1292      */
1293      ESCRIPT_DLL_API
1294      void
1295        print(void);
1296    
1297      /**
1298         \brief
1299         return the MPI rank number of the local data
1300             MPI_COMM_WORLD is assumed and the result of MPI_Comm_size()
1301             is returned
1302      */
1303      ESCRIPT_DLL_API
1304        int
1305        get_MPIRank(void) const;
1306    
1307      /**
1308         \brief
1309         return the MPI rank number of the local data
1310             MPI_COMM_WORLD is assumed and the result of MPI_Comm_rank()
1311             is returned
1312      */
1313      ESCRIPT_DLL_API
1314        int
1315        get_MPISize(void) const;
1316    
1317      /**
1318         \brief
1319         return the MPI rank number of the local data
1320             MPI_COMM_WORLD is assumed and returned.
1321      */
1322      ESCRIPT_DLL_API
1323        MPI_Comm
1324        get_MPIComm(void) const;
1325    
1326      /**
1327         \brief
1328         return the object produced by the factory, which is a DataConstant or DataExpanded
1329      */
1330      ESCRIPT_DLL_API
1331        DataAbstract*
1332        borrowData(void) const;
1333    
1334   protected:   protected:
1335    
1336   private:   private:
# Line 1118  class Data { Line 1388  class Data {
1388    
1389    /**    /**
1390       \brief       \brief
      Perform the given binary operation on all of the data's elements.  
      RHS is a boost::python object.  
   */  
   template <class BinaryFunction>  
   inline  
   void  
   binaryOp(const boost::python::object& right,  
            BinaryFunction operation);  
   
   /**  
      \brief  
1391       Convert the data type of the RHS to match this.       Convert the data type of the RHS to match this.
1392       \param right - Input - data type to match.       \param right - Input - data type to match.
1393    */    */
# Line 1153  class Data { Line 1412  class Data {
1412               const FunctionSpace& what,               const FunctionSpace& what,
1413               bool expanded);               bool expanded);
1414    
1415    /**    //
1416       \brief    // flag to protect the data object against any update
1417       Reshape the data point if the data point is currently rank 0.    bool m_protected;
      Will throw an exception if the data points are not rank 0.  
      The original data point value is used for all values of the new  
      data point.  
   */  
   void  
   reshapeDataPoint(const DataArrayView::ShapeType& shape);  
1418    
1419    //    //
1420    // pointer to the actual data object    // pointer to the actual data object
# Line 1198  Data::initialise(const IValueType& value Line 1451  Data::initialise(const IValueType& value
1451  /**  /**
1452     Binary Data object operators.     Binary Data object operators.
1453  */  */
1454    inline double rpow(double x,double y)
1455    {
1456        return pow(y,x);
1457    };
1458    
1459  /**  /**
1460    \brief    \brief
1461    Operator+    Operator+
1462    Takes two Data objects.    Takes two Data objects.
1463  */  */
1464  Data operator+(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const Data& right);
1465    
1466  /**  /**
1467    \brief    \brief
1468    Operator-    Operator-
1469    Takes two Data objects.    Takes two Data objects.
1470  */  */
1471  Data operator-(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const Data& right);
1472    
1473  /**  /**
1474    \brief    \brief
1475    Operator*    Operator*
1476    Takes two Data objects.    Takes two Data objects.
1477  */  */
1478  Data operator*(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator*(const Data& left, const Data& right);
1479    
1480  /**  /**
1481    \brief    \brief
1482    Operator/    Operator/
1483    Takes two Data objects.    Takes two Data objects.
1484  */  */
1485  Data operator/(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator/(const Data& left, const Data& right);
1486    
1487  /**  /**
1488    \brief    \brief
# Line 1233  Data operator/(const Data& left, const D Line 1490  Data operator/(const Data& left, const D
1490    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1491    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1492  */  */
1493  Data operator+(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const boost::python::object& right);
1494    
1495  /**  /**
1496    \brief    \brief
# Line 1241  Data operator+(const Data& left, const b Line 1498  Data operator+(const Data& left, const b
1498    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1499    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1500  */  */
1501  Data operator-(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const boost::python::object& right);
1502    
1503  /**  /**
1504    \brief    \brief
# Line 1249  Data operator-(const Data& left, const b Line 1506  Data operator-(const Data& left, const b
1506    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1507    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1508  */  */
1509  Data operator*(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator*(const Data& left, const boost::python::object& right);
1510    
1511  /**  /**
1512    \brief    \brief
# Line 1257  Data operator*(const Data& left, const b Line 1514  Data operator*(const Data& left, const b
1514    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1515    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1516  */  */
1517  Data operator/(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator/(const Data& left, const boost::python::object& right);
1518    
1519  /**  /**
1520    \brief    \brief
# Line 1265  Data operator/(const Data& left, const b Line 1522  Data operator/(const Data& left, const b
1522    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1523    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1524  */  */
1525  Data operator+(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const boost::python::object& left, const Data& right);
1526    
1527  /**  /**
1528    \brief    \brief
# Line 1273  Data operator+(const boost::python::obje Line 1530  Data operator+(const boost::python::obje
1530    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1531    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1532  */  */
1533  Data operator-(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const boost::python::object& left, const Data& right);
1534    
1535  /**  /**
1536    \brief    \brief
# Line 1281  Data operator-(const boost::python::obje Line 1538  Data operator-(const boost::python::obje
1538    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1539    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1540  */  */
1541  Data operator*(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator*(const boost::python::object& left, const Data& right);
1542    
1543  /**  /**
1544    \brief    \brief
# Line 1289  Data operator*(const boost::python::obje Line 1546  Data operator*(const boost::python::obje
1546    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1547    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1548  */  */
1549  Data operator/(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator/(const boost::python::object& left, const Data& right);
1550    
1551  /**  /**
1552    \brief    \brief
1553    Output operator    Output operator
1554  */  */
1555  std::ostream& operator<<(std::ostream& o, const Data& data);  ESCRIPT_DLL_API std::ostream& operator<<(std::ostream& o, const Data& data);
1556    
1557    /**
1558      \brief
1559      Compute a tensor product of two Data objects
1560      \param arg0 - Input - Data object
1561      \param arg1 - Input - Data object
1562      \param axis_offset - Input - axis offset
1563      \param transpose - Input - 0: transpose neither, 1: transpose arg0, 2: transpose arg1
1564    */
1565    ESCRIPT_DLL_API
1566    Data
1567    C_GeneralTensorProduct(Data& arg0,
1568                         Data& arg1,
1569                         int axis_offset=0,
1570                         int transpose=0);
1571    
1572  /**  /**
1573    \brief    \brief
# Line 1303  std::ostream& operator<<(std::ostream& o Line 1575  std::ostream& operator<<(std::ostream& o
1575    NB: this operator does very little at this point, and isn't to    NB: this operator does very little at this point, and isn't to
1576    be relied on. Requires further implementation.    be relied on. Requires further implementation.
1577  */  */
1578  //bool operator==(const Data& left, const Data& right);  //ESCRIPT_DLL_API bool operator==(const Data& left, const Data& right);
1579    
1580  /**  /**
1581    \brief    \brief
# Line 1319  Data::binaryOp(const Data& right, Line 1591  Data::binaryOp(const Data& right,
1591     //     //
1592     // if this has a rank of zero promote it to the rank of the RHS     // if this has a rank of zero promote it to the rank of the RHS
1593     if (getPointDataView().getRank()==0 && right.getPointDataView().getRank()!=0) {     if (getPointDataView().getRank()==0 && right.getPointDataView().getRank()!=0) {
1594       reshapeDataPoint(right.getPointDataView().getShape());       throw DataException("Error - attempt to update rank zero object with object with rank bigger than zero.");
1595     }     }
1596     //     //
1597     // initially make the temporary a shallow copy     // initially make the temporary a shallow copy
# Line 1371  Data::binaryOp(const Data& right, Line 1643  Data::binaryOp(const Data& right,
1643       EsysAssert((leftC!=0 && rightC!=0), "Programming error - casting to DataConstant.");       EsysAssert((leftC!=0 && rightC!=0), "Programming error - casting to DataConstant.");
1644       escript::binaryOp(*leftC,*rightC,operation);       escript::binaryOp(*leftC,*rightC,operation);
1645     }     }
1646  }     #if defined DOPROF
1647       profData->binary++;
1648  /**     #endif
   \brief  
   Perform the given binary operation with this and right as operands.  
   Right is a boost::python object.  
 */  
 template <class BinaryFunction>  
 inline  
 void  
 Data::binaryOp(const boost::python::object& right,  
                BinaryFunction operation)  
 {  
    DataArray temp(right);  
    //  
    // if this has a rank of zero promote it to the rank of the RHS.  
    if (getPointDataView().getRank()==0 && temp.getView().getRank()!=0) {  
       reshapeDataPoint(temp.getView().getShape());  
    }  
    //  
    // Always allow scalar values for the RHS but check other shapes  
    if (temp.getView().getRank()!=0) {  
      if (!getPointDataView().checkShape(temp.getView().getShape())) {  
        throw DataException(getPointDataView().createShapeErrorMessage(  
                   "Error - RHS shape doesn't match LHS shape.",temp.getView().getShape()));  
      }  
    }  
    if (isExpanded()) {  
      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());  
      EsysAssert((leftC!=0),"Programming error - casting to DataExpanded.");  
      escript::binaryOp(*leftC,temp.getView(),operation);  
    } else if (isTagged()) {  
      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());  
      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");  
      escript::binaryOp(*leftC,temp.getView(),operation);  
    } else if (isConstant()) {  
      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());  
      EsysAssert((leftC!=0),"Programming error - casting to DataConstant.");  
      escript::binaryOp(*leftC,temp.getView(),operation);  
    }  
1649  }  }
1650    
1651  /**  /**

Legend:
Removed from v.698  
changed lines
  Added in v.950

  ViewVC Help
Powered by ViewVC 1.1.26