/[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 751 by bcumming, Mon Jun 26 01:46:34 2006 UTC revision 922 by gross, Fri Jan 5 04:23:05 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"  #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 65  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 74  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 81  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 89  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 102  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 117  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 129  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 146  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 162  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 177  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 190  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 197  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 205  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 220  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 254  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 261  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 268  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 275  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 288  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 299  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 309  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 316  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 323  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 330  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 337  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 344  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 355  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 362  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 373  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 380  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 389  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 402  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
# Line 415  class Data { Line 499  class Data {
499       preferred interface but is provided for use by C code.       preferred interface but is provided for use by C code.
500       \param sampleNo - Input - the given sample no.       \param sampleNo - Input - the given sample no.
501    */    */
502      ESCRIPT_DLL_API
503    inline    inline
504    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
505    getSampleData(DataAbstract::ValueType::size_type sampleNo)    getSampleData(DataAbstract::ValueType::size_type sampleNo)
# Line 428  class Data { Line 513  class Data {
513       access data that isn't tagged an exception will be thrown.       access data that isn't tagged an exception will be thrown.
514       \param tag - Input - the tag key.       \param tag - Input - the tag key.
515    */    */
516      ESCRIPT_DLL_API
517    inline    inline
518    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
519    getSampleDataByTag(int tag)    getSampleDataByTag(int tag)
# Line 451  class Data { Line 537  class Data {
537       \param value - Input - value to assign to data-points associated with       \param value - Input - value to assign to data-points associated with
538                              the given reference number.                              the given reference number.
539    */    */
540      ESCRIPT_DLL_API
541    void    void
542    setRefValue(int ref,    setRefValue(int ref,
543                const boost::python::numeric::array& value);                const boost::python::numeric::array& value);
# Line 470  class Data { Line 557  class Data {
557       \param value - Output - object to receive values from data-points       \param value - Output - object to receive values from data-points
558                               associated with the given reference number.                               associated with the given reference number.
559    */    */
560      ESCRIPT_DLL_API
561    void    void
562    getRefValue(int ref,    getRefValue(int ref,
563                boost::python::numeric::array& value);                boost::python::numeric::array& value);
# Line 482  class Data { Line 570  class Data {
570       \param sampleNo - Input -       \param sampleNo - Input -
571       \param dataPointNo - Input -       \param dataPointNo - Input -
572    */    */
573      ESCRIPT_DLL_API
574    inline    inline
575    DataArrayView    DataArrayView
576    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
577                 int dataPointNo)                 int dataPointNo)
578    {    {
579      return m_data->getDataPoint(sampleNo,dataPointNo);          return m_data->getDataPoint(sampleNo,dataPointNo);
580    }    }
581    
582    /**    /**
583       \brief       \brief
584       Return a reference to the data point shape.       Return a reference to the data point shape.
585    */    */
586      ESCRIPT_DLL_API
587    const DataArrayView::ShapeType&    const DataArrayView::ShapeType&
588    getDataPointShape() const;    getDataPointShape() const;
589    
# Line 501  class Data { Line 591  class Data {
591       \brief       \brief
592       Return the data point shape as a tuple of integers.       Return the data point shape as a tuple of integers.
593    */    */
594      ESCRIPT_DLL_API
595    const boost::python::tuple    const boost::python::tuple
596    getShapeTuple() const;    getShapeTuple() const;
597    
# Line 509  class Data { Line 600  class Data {
600       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
601       data point shape dimensions.       data point shape dimensions.
602    */    */
603      ESCRIPT_DLL_API
604    int    int
605    getDataPointSize() const;    getDataPointSize() const;
606    
# Line 516  class Data { Line 608  class Data {
608       \brief       \brief
609       Return the number of doubles stored for this Data.       Return the number of doubles stored for this Data.
610    */    */
611      ESCRIPT_DLL_API
612    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
613    getLength() const;    getLength() const;
614    
# Line 528  class Data { Line 621  class Data {
621       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
622      ==>*      ==>*
623    */    */
624      ESCRIPT_DLL_API
625    void    void
626    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
627                   const boost::python::object& value);                   const boost::python::object& value);
# Line 541  class Data { Line 635  class Data {
635       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
636      ==>*      ==>*
637    */    */
638      ESCRIPT_DLL_API
639    void    void
640    setTaggedValueFromCPP(int tagKey,    setTaggedValueFromCPP(int tagKey,
641                          const DataArrayView& value);                          const DataArrayView& value);
# Line 549  class Data { Line 644  class Data {
644      \brief      \brief
645      Copy other Data object into this Data object where mask is positive.      Copy other Data object into this Data object where mask is positive.
646    */    */
647      ESCRIPT_DLL_API
648    void    void
649    copyWithMask(const Data& other,    copyWithMask(const Data& other,
650                 const Data& mask);                 const Data& mask);
# Line 563  class Data { Line 659  class Data {
659       the result as a Data object.       the result as a Data object.
660       *       *
661    */    */
662      ESCRIPT_DLL_API
663    Data    Data
664    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
665    
# Line 572  class Data { Line 669  class Data {
669       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.
670       *       *
671    */    */
672      ESCRIPT_DLL_API
673    Data    Data
674    gradOn(const FunctionSpace& functionspace) const;    gradOn(const FunctionSpace& functionspace) const;
675    
676      ESCRIPT_DLL_API
677    Data    Data
678    grad() const;    grad() const;
679    
# Line 583  class Data { Line 682  class Data {
682       Calculate the integral over the function space domain.       Calculate the integral over the function space domain.
683       *       *
684    */    */
685      ESCRIPT_DLL_API
686    boost::python::numeric::array    boost::python::numeric::array
687    integrate() const;    integrate() const;
688    
689    /**    /**
690       \brief       \brief
691         Returns 1./ Data object
692         *
693      */
694      ESCRIPT_DLL_API
695      Data
696      oneOver() const;
697      /**
698         \brief
699       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.
700       *       *
701    */    */
702      ESCRIPT_DLL_API
703    Data    Data
704    wherePositive() const;    wherePositive() const;
705    
# Line 599  class Data { Line 708  class Data {
708       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.
709       *       *
710    */    */
711      ESCRIPT_DLL_API
712    Data    Data
713    whereNegative() const;    whereNegative() const;
714    
# Line 607  class Data { Line 717  class Data {
717       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.
718       *       *
719    */    */
720      ESCRIPT_DLL_API
721    Data    Data
722    whereNonNegative() const;    whereNonNegative() const;
723    
# Line 615  class Data { Line 726  class Data {
726       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.
727       *       *
728    */    */
729      ESCRIPT_DLL_API
730    Data    Data
731    whereNonPositive() const;    whereNonPositive() const;
732    
# Line 623  class Data { Line 735  class Data {
735       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.
736       *       *
737    */    */
738      ESCRIPT_DLL_API
739    Data    Data
740    whereZero(double tol=0.0) const;    whereZero(double tol=0.0) const;
741    
# Line 631  class Data { Line 744  class Data {
744       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.
745       *       *
746    */    */
747      ESCRIPT_DLL_API
748    Data    Data
749    whereNonZero(double tol=0.0) const;    whereNonZero(double tol=0.0) const;
750    
# Line 639  class Data { Line 753  class Data {
753       Return the maximum absolute value of this Data object.       Return the maximum absolute value of this Data object.
754       *       *
755    */    */
756      ESCRIPT_DLL_API
757    double    double
758    Lsup() const;    Lsup() const;
759    
# Line 647  class Data { Line 762  class Data {
762       Return the minimum absolute value of this Data object.       Return the minimum absolute value of this Data object.
763       *       *
764    */    */
765      ESCRIPT_DLL_API
766    double    double
767    Linf() const;    Linf() const;
768    
# Line 655  class Data { Line 771  class Data {
771       Return the maximum value of this Data object.       Return the maximum value of this Data object.
772       *       *
773    */    */
774      ESCRIPT_DLL_API
775    double    double
776    sup() const;    sup() const;
777    
# Line 663  class Data { Line 780  class Data {
780       Return the minimum value of this Data object.       Return the minimum value of this Data object.
781       *       *
782    */    */
783      ESCRIPT_DLL_API
784    double    double
785    inf() const;    inf() const;
786    
# Line 671  class Data { Line 789  class Data {
789       Return the absolute value of each data point of this Data object.       Return the absolute value of each data point of this Data object.
790       *       *
791    */    */
792      ESCRIPT_DLL_API
793    Data    Data
794    abs() const;    abs() const;
795    
# Line 679  class Data { Line 798  class Data {
798       Return the maximum value of each data point of this Data object.       Return the maximum value of each data point of this Data object.
799       *       *
800    */    */
801      ESCRIPT_DLL_API
802    Data    Data
803    maxval() const;    maxval() const;
804    
# Line 687  class Data { Line 807  class Data {
807       Return the minimum value of each data point of this Data object.       Return the minimum value of each data point of this Data object.
808       *       *
809    */    */
810      ESCRIPT_DLL_API
811    Data    Data
812    minval() const;    minval() const;
813    
# Line 695  class Data { Line 816  class Data {
816       Return the (sample number, data-point number) of the data point with       Return the (sample number, data-point number) of the data point with
817       the minimum value in this Data object.       the minimum value in this Data object.
818    */    */
819      ESCRIPT_DLL_API
820    const boost::python::tuple    const boost::python::tuple
821    mindp() const;    minGlobalDataPoint() const;
822    
823      ESCRIPT_DLL_API
824    void    void
825    calc_mindp(int& SampleNo,    calc_minGlobalDataPoint(int& ProcNo,  int& DataPointNo) const;
              int& DataPointNo) const;  
   
826    /**    /**
827       \brief       \brief
828       Return the sign of each data point of this Data object.       Return the sign of each data point of this Data object.
829       -1 for negative values, zero for zero values, 1 for positive values.       -1 for negative values, zero for zero values, 1 for positive values.
830       *       *
831    */    */
832      ESCRIPT_DLL_API
833    Data    Data
834    sign() const;    sign() const;
835    
836    /**    /**
837       \brief       \brief
838         Return the symmetric part of a matrix which is half the matrix plus its transpose.
839         *
840      */
841      ESCRIPT_DLL_API
842      Data
843      symmetric() const;
844    
845      /**
846         \brief
847         Return the nonsymmetric part of a matrix which is half the matrix minus its transpose.
848         *
849      */
850      ESCRIPT_DLL_API
851      Data
852      nonsymmetric() const;
853    
854      /**
855         \brief
856         Return the trace of a matrix
857         *
858      */
859      ESCRIPT_DLL_API
860      Data
861      trace(int axis_offset) const;
862    
863      /**
864         \brief
865         Transpose each data point of this Data object around the given axis.
866         *
867      */
868      ESCRIPT_DLL_API
869      Data
870      transpose(int axis_offset) const;
871    
872      /**
873         \brief
874       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.
875       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.
876       *       *
877    */    */
878      ESCRIPT_DLL_API
879    Data    Data
880    eigenvalues() const;    eigenvalues() const;
881    
# Line 729  class Data { Line 888  class Data {
888       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
889       *       *
890    */    */
891      ESCRIPT_DLL_API
892    const boost::python::tuple    const boost::python::tuple
893    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;
894    
895    /**    /**
896       \brief       \brief
897       Transpose each data point of this Data object around the given axis.       swaps the components axis0 and axis1
      --* not implemented yet *--  
898       *       *
899    */    */
900      ESCRIPT_DLL_API
901    Data    Data
902    transpose(int axis) const;    swapaxes(const int axis0, const int axis1) const;
903    
904    /**    /**
905       \brief       \brief
906       Calculate the trace of each data point of this Data object.       Return the error function erf of each data point of this Data object.
907       *       *
908    */    */
909      ESCRIPT_DLL_API
910    Data    Data
911    trace() const;    erf() const;
912    
913    /**    /**
914       \brief       \brief
915       Return the sin of each data point of this Data object.       Return the sin of each data point of this Data object.
916       *       *
917    */    */
918      ESCRIPT_DLL_API
919    Data    Data
920    sin() const;    sin() const;
921    
# Line 762  class Data { Line 924  class Data {
924       Return the cos of each data point of this Data object.       Return the cos of each data point of this Data object.
925       *       *
926    */    */
927      ESCRIPT_DLL_API
928    Data    Data
929    cos() const;    cos() const;
930    
# Line 770  class Data { Line 933  class Data {
933       Return the tan of each data point of this Data object.       Return the tan of each data point of this Data object.
934       *       *
935    */    */
936      ESCRIPT_DLL_API
937    Data    Data
938    tan() const;    tan() const;
939    
# Line 778  class Data { Line 942  class Data {
942       Return the asin of each data point of this Data object.       Return the asin of each data point of this Data object.
943       *       *
944    */    */
945      ESCRIPT_DLL_API
946    Data    Data
947    asin() const;    asin() const;
948    
# Line 786  class Data { Line 951  class Data {
951       Return the acos of each data point of this Data object.       Return the acos of each data point of this Data object.
952       *       *
953    */    */
954      ESCRIPT_DLL_API
955    Data    Data
956    acos() const;    acos() const;
957    
# Line 794  class Data { Line 960  class Data {
960       Return the atan of each data point of this Data object.       Return the atan of each data point of this Data object.
961       *       *
962    */    */
963      ESCRIPT_DLL_API
964    Data    Data
965    atan() const;    atan() const;
966    
# Line 802  class Data { Line 969  class Data {
969       Return the sinh of each data point of this Data object.       Return the sinh of each data point of this Data object.
970       *       *
971    */    */
972      ESCRIPT_DLL_API
973    Data    Data
974    sinh() const;    sinh() const;
975    
# Line 810  class Data { Line 978  class Data {
978       Return the cosh of each data point of this Data object.       Return the cosh of each data point of this Data object.
979       *       *
980    */    */
981      ESCRIPT_DLL_API
982    Data    Data
983    cosh() const;    cosh() const;
984    
# Line 818  class Data { Line 987  class Data {
987       Return the tanh of each data point of this Data object.       Return the tanh of each data point of this Data object.
988       *       *
989    */    */
990      ESCRIPT_DLL_API
991    Data    Data
992    tanh() const;    tanh() const;
993    
# Line 826  class Data { Line 996  class Data {
996       Return the asinh of each data point of this Data object.       Return the asinh of each data point of this Data object.
997       *       *
998    */    */
999      ESCRIPT_DLL_API
1000    Data    Data
1001    asinh() const;    asinh() const;
1002    
# Line 834  class Data { Line 1005  class Data {
1005       Return the acosh of each data point of this Data object.       Return the acosh of each data point of this Data object.
1006       *       *
1007    */    */
1008      ESCRIPT_DLL_API
1009    Data    Data
1010    acosh() const;    acosh() const;
1011    
# Line 842  class Data { Line 1014  class Data {
1014       Return the atanh of each data point of this Data object.       Return the atanh of each data point of this Data object.
1015       *       *
1016    */    */
1017      ESCRIPT_DLL_API
1018    Data    Data
1019    atanh() const;    atanh() const;
1020    
# Line 850  class Data { Line 1023  class Data {
1023       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.
1024       *       *
1025    */    */
1026      ESCRIPT_DLL_API
1027    Data    Data
1028    log10() const;    log10() const;
1029    
# Line 858  class Data { Line 1032  class Data {
1032       Return the natural log of each data point of this Data object.       Return the natural log of each data point of this Data object.
1033       *       *
1034    */    */
1035      ESCRIPT_DLL_API
1036    Data    Data
1037    log() const;    log() const;
1038    
# Line 866  class Data { Line 1041  class Data {
1041       Return the exponential function of each data point of this Data object.       Return the exponential function of each data point of this Data object.
1042       *       *
1043    */    */
1044      ESCRIPT_DLL_API
1045    Data    Data
1046    exp() const;    exp() const;
1047    
# Line 874  class Data { Line 1050  class Data {
1050       Return the square root of each data point of this Data object.       Return the square root of each data point of this Data object.
1051       *       *
1052    */    */
1053      ESCRIPT_DLL_API
1054    Data    Data
1055    sqrt() const;    sqrt() const;
1056    
# Line 882  class Data { Line 1059  class Data {
1059       Return the negation of each data point of this Data object.       Return the negation of each data point of this Data object.
1060       *       *
1061    */    */
1062      ESCRIPT_DLL_API
1063    Data    Data
1064    neg() const;    neg() const;
1065    
# Line 891  class Data { Line 1069  class Data {
1069       Simply returns this object unmodified.       Simply returns this object unmodified.
1070       *       *
1071    */    */
1072      ESCRIPT_DLL_API
1073    Data    Data
1074    pos() const;    pos() const;
1075    
# Line 901  class Data { Line 1080  class Data {
1080       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1081       *       *
1082    */    */
1083      ESCRIPT_DLL_API
1084    Data    Data
1085    powD(const Data& right) const;    powD(const Data& right) const;
1086    
# Line 911  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    powO(const boost::python::object& right) const;    powO(const boost::python::object& right) const;
1097    
# Line 922  class Data { Line 1103  class Data {
1103       *       *
1104     */     */
1105    
1106      ESCRIPT_DLL_API
1107    Data    Data
1108    rpowO(const boost::python::object& left) const;    rpowO(const boost::python::object& left) const;
1109    
# Line 929  class Data { Line 1111  class Data {
1111       \brief       \brief
1112       writes the object to a file in the DX file format       writes the object to a file in the DX file format
1113    */    */
1114      ESCRIPT_DLL_API
1115    void    void
1116    saveDX(std::string fileName) const;    saveDX(std::string fileName) const;
1117    
# Line 936  class Data { Line 1119  class Data {
1119       \brief       \brief
1120       writes the object to a file in the VTK file format       writes the object to a file in the VTK file format
1121    */    */
1122      ESCRIPT_DLL_API
1123    void    void
1124    saveVTK(std::string fileName) const;    saveVTK(std::string fileName) const;
1125    
# Line 945  class Data { Line 1129  class Data {
1129       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1130       *       *
1131    */    */
1132      ESCRIPT_DLL_API
1133    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
1134      ESCRIPT_DLL_API
1135    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
1136    
1137    /**    /**
# Line 954  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 963  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 972  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    /**    /**
1171       \brief       \brief
1172       Returns true if this can be interpolated to functionspace.       Returns true if this can be interpolated to functionspace.
1173    */    */
1174      ESCRIPT_DLL_API
1175    bool    bool
1176    probeInterpolation(const FunctionSpace& functionspace) const;    probeInterpolation(const FunctionSpace& functionspace) const;
1177    
# Line 997  class Data { Line 1190  class Data {
1190       \param key - Input - python slice tuple specifying       \param key - Input - python slice tuple specifying
1191       slice to return.       slice to return.
1192    */    */
1193      ESCRIPT_DLL_API
1194    Data    Data
1195    getItem(const boost::python::object& key) const;    getItem(const boost::python::object& key) const;
1196    
# Line 1011  class Data { Line 1205  class Data {
1205       slice to copy from value.       slice to copy from value.
1206       \param value - Input - Data object to copy from.       \param value - Input - Data object to copy from.
1207    */    */
1208      ESCRIPT_DLL_API
1209    void    void
1210    setItemD(const boost::python::object& key,    setItemD(const boost::python::object& key,
1211             const Data& value);             const Data& value);
1212    
1213      ESCRIPT_DLL_API
1214    void    void
1215    setItemO(const boost::python::object& key,    setItemO(const boost::python::object& key,
1216             const boost::python::object& value);             const boost::python::object& value);
# Line 1027  class Data { Line 1223  class Data {
1223       this Data object.       this Data object.
1224    */    */
1225    template <class UnaryFunction>    template <class UnaryFunction>
1226      ESCRIPT_DLL_API
1227    inline    inline
1228    void    void
1229    unaryOp(UnaryFunction operation);    unaryOp(UnaryFunction operation);
# Line 1038  class Data { Line 1235  class Data {
1235       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1236       *       *
1237    */    */
1238      ESCRIPT_DLL_API
1239    Data    Data
1240    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
1241    
# Line 1049  class Data { Line 1247  class Data {
1247       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1248       *       *
1249    */    */
1250      ESCRIPT_DLL_API
1251    void    void
1252    setSlice(const Data& value,    setSlice(const Data& value,
1253             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
# Line 1058  class Data { Line 1257  class Data {
1257       Archive the current Data object to the given file.       Archive the current Data object to the given file.
1258       \param fileName - Input - file to archive to.       \param fileName - Input - file to archive to.
1259    */    */
1260      ESCRIPT_DLL_API
1261    void    void
1262    archiveData(const std::string fileName);    archiveData(const std::string fileName);
1263    
# Line 1069  class Data { Line 1269  class Data {
1269       \param fileName - Input - file to extract from.       \param fileName - Input - file to extract from.
1270       \param fspace - Input - a suitable FunctionSpace descibing the data.       \param fspace - Input - a suitable FunctionSpace descibing the data.
1271    */    */
1272      ESCRIPT_DLL_API
1273    void    void
1274    extractData(const std::string fileName,    extractData(const std::string fileName,
1275                const FunctionSpace& fspace);                const FunctionSpace& fspace);
# Line 1078  class Data { Line 1279  class Data {
1279       \brief       \brief
1280       print the data values to stdout. Used for debugging       print the data values to stdout. Used for debugging
1281    */    */
1282    void print();    ESCRIPT_DLL_API
1283      void
1284        print(void);
1285    
1286      /**
1287         \brief
1288         return the MPI rank number of the local data
1289             MPI_COMM_WORLD is assumed and the result of MPI_Comm_size()
1290             is returned
1291      */
1292      ESCRIPT_DLL_API
1293        int
1294        get_MPIRank(void) const;
1295    
1296      /**
1297         \brief
1298         return the MPI rank number of the local data
1299             MPI_COMM_WORLD is assumed and the result of MPI_Comm_rank()
1300             is returned
1301      */
1302      ESCRIPT_DLL_API
1303        int
1304        get_MPISize(void) const;
1305    
1306      /**
1307         \brief
1308         return the MPI rank number of the local data
1309             MPI_COMM_WORLD is assumed and returned.
1310      */
1311      ESCRIPT_DLL_API
1312        MPI_Comm
1313        get_MPIComm(void) const;
1314    
1315      /**
1316         \brief
1317         return the object produced by the factory, which is a DataConstant or DataExpanded
1318      */
1319      ESCRIPT_DLL_API
1320        DataAbstract*
1321        borrowData(void) const;
1322    
1323   protected:   protected:
1324    
# Line 1137  class Data { Line 1377  class Data {
1377    
1378    /**    /**
1379       \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  
1380       Convert the data type of the RHS to match this.       Convert the data type of the RHS to match this.
1381       \param right - Input - data type to match.       \param right - Input - data type to match.
1382    */    */
# Line 1172  class Data { Line 1401  class Data {
1401               const FunctionSpace& what,               const FunctionSpace& what,
1402               bool expanded);               bool expanded);
1403    
1404    /**    //
1405       \brief    // flag to protect the data object against any update
1406       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);  
1407    
1408    //    //
1409    // pointer to the actual data object    // pointer to the actual data object
# Line 1217  Data::initialise(const IValueType& value Line 1440  Data::initialise(const IValueType& value
1440  /**  /**
1441     Binary Data object operators.     Binary Data object operators.
1442  */  */
1443    inline double rpow(double x,double y)
1444    {
1445        return pow(y,x);
1446    };
1447    
1448  /**  /**
1449    \brief    \brief
1450    Operator+    Operator+
1451    Takes two Data objects.    Takes two Data objects.
1452  */  */
1453  Data operator+(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const Data& right);
1454    
1455  /**  /**
1456    \brief    \brief
1457    Operator-    Operator-
1458    Takes two Data objects.    Takes two Data objects.
1459  */  */
1460  Data operator-(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const Data& right);
1461    
1462  /**  /**
1463    \brief    \brief
1464    Operator*    Operator*
1465    Takes two Data objects.    Takes two Data objects.
1466  */  */
1467  Data operator*(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator*(const Data& left, const Data& right);
1468    
1469  /**  /**
1470    \brief    \brief
1471    Operator/    Operator/
1472    Takes two Data objects.    Takes two Data objects.
1473  */  */
1474  Data operator/(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator/(const Data& left, const Data& right);
1475    
1476  /**  /**
1477    \brief    \brief
# Line 1252  Data operator/(const Data& left, const D Line 1479  Data operator/(const Data& left, const D
1479    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1480    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1481  */  */
1482  Data operator+(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const boost::python::object& right);
1483    
1484  /**  /**
1485    \brief    \brief
# Line 1260  Data operator+(const Data& left, const b Line 1487  Data operator+(const Data& left, const b
1487    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1488    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1489  */  */
1490  Data operator-(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const boost::python::object& right);
1491    
1492  /**  /**
1493    \brief    \brief
# Line 1268  Data operator-(const Data& left, const b Line 1495  Data operator-(const Data& left, const b
1495    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1496    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1497  */  */
1498  Data operator*(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator*(const Data& left, const boost::python::object& right);
1499    
1500  /**  /**
1501    \brief    \brief
# Line 1276  Data operator*(const Data& left, const b Line 1503  Data operator*(const Data& left, const b
1503    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1504    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1505  */  */
1506  Data operator/(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator/(const Data& left, const boost::python::object& right);
1507    
1508  /**  /**
1509    \brief    \brief
# Line 1284  Data operator/(const Data& left, const b Line 1511  Data operator/(const Data& left, const b
1511    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1512    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1513  */  */
1514  Data operator+(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const boost::python::object& left, const Data& right);
1515    
1516  /**  /**
1517    \brief    \brief
# Line 1292  Data operator+(const boost::python::obje Line 1519  Data operator+(const boost::python::obje
1519    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1520    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1521  */  */
1522  Data operator-(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const boost::python::object& left, const Data& right);
1523    
1524  /**  /**
1525    \brief    \brief
# Line 1300  Data operator-(const boost::python::obje Line 1527  Data operator-(const boost::python::obje
1527    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1528    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1529  */  */
1530  Data operator*(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator*(const boost::python::object& left, const Data& right);
1531    
1532  /**  /**
1533    \brief    \brief
# Line 1308  Data operator*(const boost::python::obje Line 1535  Data operator*(const boost::python::obje
1535    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1536    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1537  */  */
1538  Data operator/(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator/(const boost::python::object& left, const Data& right);
1539    
1540  /**  /**
1541    \brief    \brief
1542    Output operator    Output operator
1543  */  */
1544  std::ostream& operator<<(std::ostream& o, const Data& data);  ESCRIPT_DLL_API std::ostream& operator<<(std::ostream& o, const Data& data);
1545    
1546    /**
1547      \brief
1548      Compute a tensor product of two Data objects
1549      \param arg0 - Input - Data object
1550      \param arg1 - Input - Data object
1551      \param axis_offset - Input - axis offset
1552      \param transpose - Input - 0: transpose neither, 1: transpose arg0, 2: transpose arg1
1553    */
1554    ESCRIPT_DLL_API
1555    Data
1556    C_GeneralTensorProduct(Data& arg0,
1557                         Data& arg1,
1558                         int axis_offset=0,
1559                         int transpose=0);
1560    
1561  /**  /**
1562    \brief    \brief
# Line 1322  std::ostream& operator<<(std::ostream& o Line 1564  std::ostream& operator<<(std::ostream& o
1564    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
1565    be relied on. Requires further implementation.    be relied on. Requires further implementation.
1566  */  */
1567  //bool operator==(const Data& left, const Data& right);  //ESCRIPT_DLL_API bool operator==(const Data& left, const Data& right);
1568    
1569  /**  /**
1570    \brief    \brief
# Line 1338  Data::binaryOp(const Data& right, Line 1580  Data::binaryOp(const Data& right,
1580     //     //
1581     // 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
1582     if (getPointDataView().getRank()==0 && right.getPointDataView().getRank()!=0) {     if (getPointDataView().getRank()==0 && right.getPointDataView().getRank()!=0) {
1583       reshapeDataPoint(right.getPointDataView().getShape());       throw DataException("Error - attempt to update rank zero object with object with rank bigger than zero.");
1584     }     }
1585     //     //
1586     // initially make the temporary a shallow copy     // initially make the temporary a shallow copy
# Line 1390  Data::binaryOp(const Data& right, Line 1632  Data::binaryOp(const Data& right,
1632       EsysAssert((leftC!=0 && rightC!=0), "Programming error - casting to DataConstant.");       EsysAssert((leftC!=0 && rightC!=0), "Programming error - casting to DataConstant.");
1633       escript::binaryOp(*leftC,*rightC,operation);       escript::binaryOp(*leftC,*rightC,operation);
1634     }     }
1635  }     #if defined DOPROF
1636       profData->binary++;
1637  /**     #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);  
    }  
1638  }  }
1639    
1640  /**  /**

Legend:
Removed from v.751  
changed lines
  Added in v.922

  ViewVC Help
Powered by ViewVC 1.1.26