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

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

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

revision 576 by gross, Fri Mar 3 08:28:42 2006 UTC revision 876 by ksteube, Thu Oct 19 03:50:23 2006 UTC
# Line 1  Line 1 
1  // $Id$  // $Id$
2  /*  /*
3   ******************************************************************************   ************************************************************
4   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
5   *       COPYRIGHT ACcESS 2004 -  All Rights Reserved                         *   *                                                          *
6   *                                                                            *   *              http://www.access.edu.au                    *
7   * This software is the property of ACcESS.  No part of this code             *   *       Primary Business: Queensland, Australia            *
8   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
9   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
10   * by any unauthorised person is illegal unless that                          *   *                                                          *
11   * person has a software license agreement with ACcESS.                       *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
12  */  */
13    
14  /** \file Data.h */  /** \file Data.h */
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 27  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 66  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 75  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 82  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 90  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 103  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 118  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 130  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 147  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 163  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 178  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 191  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 198  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 206  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 221  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    
# Line 230  class Data { Line 266  class Data {
266       \brief       \brief
267       Return the values of all data-points for the given sample as a single python numarray object.       Return the values of all data-points for the given sample as a single python numarray object.
268    */    */
269      ESCRIPT_DLL_API
270    const boost::python::numeric::array    const boost::python::numeric::array
271    convertToNumArrayFromSampleNo(int sampleNo);    convertToNumArrayFromSampleNo(int sampleNo);
272    
# Line 237  class Data { Line 274  class Data {
274       \brief       \brief
275       Return the value of the specified data-point as a single python numarray object.       Return the value of the specified data-point as a single python numarray object.
276    */    */
277    #ifndef PASO_MPI  
278      ESCRIPT_DLL_API
279    const boost::python::numeric::array    const boost::python::numeric::array
280    convertToNumArrayFromDPNo(int sampleNo,    convertToNumArrayFromDPNo(int ProcNo,
281                                                            int sampleNo,
282                              int dataPointNo);                              int dataPointNo);
283    #else
284      ESCRIPT_DLL_API
285      const boost::python::numeric::array
286      convertToNumArrayFromDPNo(int procNo,
287                    int sampleNo,
288                    int dataPointNo);
289    #endif
290    
291    
292    /**    /**
293       \brief       \brief
294       Fills the expanded Data object from values of a python numarray object.       Fills the expanded Data object from values of a python numarray object.
295    */    */
296      ESCRIPT_DLL_API
297    void    void
298    fillFromNumArray(const boost::python::numeric::array);    fillFromNumArray(const boost::python::numeric::array);
299    
# Line 255  class Data { Line 304  class Data {
304       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
305       numarray returned by convertToNumArray.       numarray returned by convertToNumArray.
306    */    */
307      ESCRIPT_DLL_API
308    int    int
309    getTagNumber(int dpno);    getTagNumber(int dpno);
310    
# Line 262  class Data { Line 312  class Data {
312       \brief       \brief
313       Return the C wrapper for the Data object.       Return the C wrapper for the Data object.
314    */    */
315      ESCRIPT_DLL_API
316    escriptDataC    escriptDataC
317    getDataC();    getDataC();
318    
# Line 269  class Data { Line 320  class Data {
320       \brief       \brief
321       Return the C wrapper for the Data object - const version.       Return the C wrapper for the Data object - const version.
322    */    */
323      ESCRIPT_DLL_API
324    escriptDataC    escriptDataC
325    getDataC() const;    getDataC() const;
326    
# Line 276  class Data { Line 328  class Data {
328       \brief       \brief
329       Write the data as a string.       Write the data as a string.
330    */    */
331      ESCRIPT_DLL_API
332    inline    inline
333    std::string    std::string
334    toString() const    toString() const
# Line 289  class Data { Line 342  class Data {
342       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
343       to manipulate the point data.       to manipulate the point data.
344    */    */
345      ESCRIPT_DLL_API
346    inline    inline
347    const DataArrayView&    const DataArrayView&
348    getPointDataView() const    getPointDataView() const
# Line 300  class Data { Line 354  class Data {
354       \brief       \brief
355       Whatever the current Data type make this into a DataExpanded.       Whatever the current Data type make this into a DataExpanded.
356    */    */
357      ESCRIPT_DLL_API
358    void    void
359    expand();    expand();
360    
# Line 310  class Data { Line 365  class Data {
365       Expanded data to tagged will throw an exception.       Expanded data to tagged will throw an exception.
366      ==>*      ==>*
367    */    */
368      ESCRIPT_DLL_API
369    void    void
370    tag();    tag();
371    
# Line 317  class Data { Line 373  class Data {
373       \brief       \brief
374       Return true if this Data is expanded.       Return true if this Data is expanded.
375    */    */
376      ESCRIPT_DLL_API
377    bool    bool
378    isExpanded() const;    isExpanded() const;
379    
# Line 324  class Data { Line 381  class Data {
381       \brief       \brief
382       Return true if this Data is tagged.       Return true if this Data is tagged.
383    */    */
384      ESCRIPT_DLL_API
385    bool    bool
386    isTagged() const;    isTagged() const;
387    
# Line 331  class Data { Line 389  class Data {
389       \brief       \brief
390       Return true if this Data is constant.       Return true if this Data is constant.
391    */    */
392      ESCRIPT_DLL_API
393    bool    bool
394    isConstant() const;    isConstant() const;
395    
# Line 338  class Data { Line 397  class Data {
397       \brief       \brief
398       Return true if this Data is empty.       Return true if this Data is empty.
399    */    */
400      ESCRIPT_DLL_API
401    bool    bool
402    isEmpty() const;    isEmpty() const;
403    
# Line 345  class Data { Line 405  class Data {
405       \brief       \brief
406       Return the function space.       Return the function space.
407    */    */
408      ESCRIPT_DLL_API
409    inline    inline
410    const FunctionSpace&    const FunctionSpace&
411    getFunctionSpace() const    getFunctionSpace() const
# Line 356  class Data { Line 417  class Data {
417       \brief       \brief
418       Return a copy of the function space.       Return a copy of the function space.
419    */    */
420      ESCRIPT_DLL_API
421    const FunctionSpace    const FunctionSpace
422    getCopyOfFunctionSpace() const;    getCopyOfFunctionSpace() const;
423    
# Line 363  class Data { Line 425  class Data {
425       \brief       \brief
426       Return the domain.       Return the domain.
427    */    */
428      ESCRIPT_DLL_API
429    inline    inline
430    const AbstractDomain&    const AbstractDomain&
431    getDomain() const    getDomain() const
# Line 374  class Data { Line 437  class Data {
437       \brief       \brief
438       Return a copy of the domain.       Return a copy of the domain.
439    */    */
440      ESCRIPT_DLL_API
441    const AbstractDomain    const AbstractDomain
442    getCopyOfDomain() const;    getCopyOfDomain() const;
443    
# Line 381  class Data { Line 445  class Data {
445       \brief       \brief
446       Return the rank of the point data.       Return the rank of the point data.
447    */    */
448      ESCRIPT_DLL_API
449    inline    inline
450    int    int
451    getDataPointRank() const    getDataPointRank() const
# Line 392  class Data { Line 457  class Data {
457       \brief       \brief
458       Return the number of samples.       Return the number of samples.
459    */    */
460      ESCRIPT_DLL_API
461    inline    inline
462    int    int
463    getNumSamples() const    getNumSamples() const
# Line 403  class Data { Line 469  class Data {
469       \brief       \brief
470       Return the number of data points per sample.       Return the number of data points per sample.
471    */    */
472      ESCRIPT_DLL_API
473    inline    inline
474    int    int
475    getNumDataPointsPerSample() const    getNumDataPointsPerSample() const
# Line 416  class Data { Line 483  class Data {
483       preferred interface but is provided for use by C code.       preferred interface but is provided for use by C code.
484       \param sampleNo - Input - the given sample no.       \param sampleNo - Input - the given sample no.
485    */    */
486      ESCRIPT_DLL_API
487    inline    inline
488    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
489    getSampleData(DataAbstract::ValueType::size_type sampleNo)    getSampleData(DataAbstract::ValueType::size_type sampleNo)
# Line 429  class Data { Line 497  class Data {
497       access data that isn't tagged an exception will be thrown.       access data that isn't tagged an exception will be thrown.
498       \param tag - Input - the tag key.       \param tag - Input - the tag key.
499    */    */
500      ESCRIPT_DLL_API
501    inline    inline
502    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
503    getSampleDataByTag(int tag)    getSampleDataByTag(int tag)
# Line 452  class Data { Line 521  class Data {
521       \param value - Input - value to assign to data-points associated with       \param value - Input - value to assign to data-points associated with
522                              the given reference number.                              the given reference number.
523    */    */
524      ESCRIPT_DLL_API
525    void    void
526    setRefValue(int ref,    setRefValue(int ref,
527                const boost::python::numeric::array& value);                const boost::python::numeric::array& value);
# Line 471  class Data { Line 541  class Data {
541       \param value - Output - object to receive values from data-points       \param value - Output - object to receive values from data-points
542                               associated with the given reference number.                               associated with the given reference number.
543    */    */
544      ESCRIPT_DLL_API
545    void    void
546    getRefValue(int ref,    getRefValue(int ref,
547                boost::python::numeric::array& value);                boost::python::numeric::array& value);
# Line 483  class Data { Line 554  class Data {
554       \param sampleNo - Input -       \param sampleNo - Input -
555       \param dataPointNo - Input -       \param dataPointNo - Input -
556    */    */
557      ESCRIPT_DLL_API
558    inline    inline
559    DataArrayView    DataArrayView
560    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
561                 int dataPointNo)                 int dataPointNo)
562    {    {
563      return m_data->getDataPoint(sampleNo,dataPointNo);          return m_data->getDataPoint(sampleNo,dataPointNo);
564    }    }
565    
566    /**    /**
567       \brief       \brief
568       Return a reference to the data point shape.       Return a reference to the data point shape.
569    */    */
570      ESCRIPT_DLL_API
571    const DataArrayView::ShapeType&    const DataArrayView::ShapeType&
572    getDataPointShape() const;    getDataPointShape() const;
573    
# Line 502  class Data { Line 575  class Data {
575       \brief       \brief
576       Return the data point shape as a tuple of integers.       Return the data point shape as a tuple of integers.
577    */    */
578      ESCRIPT_DLL_API
579    const boost::python::tuple    const boost::python::tuple
580    getShapeTuple() const;    getShapeTuple() const;
581    
# Line 510  class Data { Line 584  class Data {
584       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
585       data point shape dimensions.       data point shape dimensions.
586    */    */
587      ESCRIPT_DLL_API
588    int    int
589    getDataPointSize() const;    getDataPointSize() const;
590    
# Line 517  class Data { Line 592  class Data {
592       \brief       \brief
593       Return the number of doubles stored for this Data.       Return the number of doubles stored for this Data.
594    */    */
595      ESCRIPT_DLL_API
596    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
597    getLength() const;    getLength() const;
598    
# Line 529  class Data { Line 605  class Data {
605       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
606      ==>*      ==>*
607    */    */
608      ESCRIPT_DLL_API
609    void    void
610    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
611                   const boost::python::object& value);                   const boost::python::object& value);
# Line 542  class Data { Line 619  class Data {
619       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
620      ==>*      ==>*
621    */    */
622      ESCRIPT_DLL_API
623    void    void
624    setTaggedValueFromCPP(int tagKey,    setTaggedValueFromCPP(int tagKey,
625                          const DataArrayView& value);                          const DataArrayView& value);
# Line 550  class Data { Line 628  class Data {
628      \brief      \brief
629      Copy other Data object into this Data object where mask is positive.      Copy other Data object into this Data object where mask is positive.
630    */    */
631      ESCRIPT_DLL_API
632    void    void
633    copyWithMask(const Data& other,    copyWithMask(const Data& other,
634                 const Data& mask);                 const Data& mask);
# Line 564  class Data { Line 643  class Data {
643       the result as a Data object.       the result as a Data object.
644       *       *
645    */    */
646      ESCRIPT_DLL_API
647    Data    Data
648    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
649    
# Line 573  class Data { Line 653  class Data {
653       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.
654       *       *
655    */    */
656      ESCRIPT_DLL_API
657    Data    Data
658    gradOn(const FunctionSpace& functionspace) const;    gradOn(const FunctionSpace& functionspace) const;
659    
660      ESCRIPT_DLL_API
661    Data    Data
662    grad() const;    grad() const;
663    
# Line 584  class Data { Line 666  class Data {
666       Calculate the integral over the function space domain.       Calculate the integral over the function space domain.
667       *       *
668    */    */
669      ESCRIPT_DLL_API
670    boost::python::numeric::array    boost::python::numeric::array
671    integrate() const;    integrate() const;
672    
673    /**    /**
674       \brief       \brief
675         Returns 1./ Data object
676         *
677      */
678      ESCRIPT_DLL_API
679      Data
680      oneOver() const;
681      /**
682         \brief
683       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.
684       *       *
685    */    */
686      ESCRIPT_DLL_API
687    Data    Data
688    wherePositive(double tol=0.0) const;    wherePositive() const;
689    
690    /**    /**
691       \brief       \brief
692       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.
693       *       *
694    */    */
695      ESCRIPT_DLL_API
696    Data    Data
697    whereNegative(double tol=0.0) const;    whereNegative() const;
698    
699    /**    /**
700       \brief       \brief
701       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.
702       *       *
703    */    */
704      ESCRIPT_DLL_API
705    Data    Data
706    whereNonNegative(double tol=0.0) const;    whereNonNegative() const;
707    
708    /**    /**
709       \brief       \brief
710       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.
711       *       *
712    */    */
713      ESCRIPT_DLL_API
714    Data    Data
715    whereNonPositive(double tol=0.0) const;    whereNonPositive() const;
716    
717    /**    /**
718       \brief       \brief
719       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.
720       *       *
721    */    */
722      ESCRIPT_DLL_API
723    Data    Data
724    whereZero(double tol=0.0) const;    whereZero(double tol=0.0) const;
725    
# Line 632  class Data { Line 728  class Data {
728       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.
729       *       *
730    */    */
731      ESCRIPT_DLL_API
732    Data    Data
733    whereNonZero(double tol=0.0) const;    whereNonZero(double tol=0.0) const;
734    
# Line 640  class Data { Line 737  class Data {
737       Return the maximum absolute value of this Data object.       Return the maximum absolute value of this Data object.
738       *       *
739    */    */
740      ESCRIPT_DLL_API
741    double    double
742    Lsup() const;    Lsup() const;
743    
# Line 648  class Data { Line 746  class Data {
746       Return the minimum absolute value of this Data object.       Return the minimum absolute value of this Data object.
747       *       *
748    */    */
749      ESCRIPT_DLL_API
750    double    double
751    Linf() const;    Linf() const;
752    
# Line 656  class Data { Line 755  class Data {
755       Return the maximum value of this Data object.       Return the maximum value of this Data object.
756       *       *
757    */    */
758      ESCRIPT_DLL_API
759    double    double
760    sup() const;    sup() const;
761    
# Line 664  class Data { Line 764  class Data {
764       Return the minimum value of this Data object.       Return the minimum value of this Data object.
765       *       *
766    */    */
767      ESCRIPT_DLL_API
768    double    double
769    inf() const;    inf() const;
770    
# Line 672  class Data { Line 773  class Data {
773       Return the absolute value of each data point of this Data object.       Return the absolute value of each data point of this Data object.
774       *       *
775    */    */
776      ESCRIPT_DLL_API
777    Data    Data
778    abs() const;    abs() const;
779    
# Line 680  class Data { Line 782  class Data {
782       Return the maximum value of each data point of this Data object.       Return the maximum value of each data point of this Data object.
783       *       *
784    */    */
785      ESCRIPT_DLL_API
786    Data    Data
787    maxval() const;    maxval() const;
788    
# Line 688  class Data { Line 791  class Data {
791       Return the minimum value of each data point of this Data object.       Return the minimum value of each data point of this Data object.
792       *       *
793    */    */
794      ESCRIPT_DLL_API
795    Data    Data
796    minval() const;    minval() const;
797    
# Line 696  class Data { Line 800  class Data {
800       Return the (sample number, data-point number) of the data point with       Return the (sample number, data-point number) of the data point with
801       the minimum value in this Data object.       the minimum value in this Data object.
802    */    */
803      ESCRIPT_DLL_API
804    const boost::python::tuple    const boost::python::tuple
805    mindp() const;    mindp() const;
806    
807      ESCRIPT_DLL_API
808    void    void
809    calc_mindp(int& SampleNo,    calc_mindp(int& ProcNo,
810                            int& SampleNo,  
811               int& DataPointNo) const;               int& DataPointNo) const;
   
812    /**    /**
813       \brief       \brief
814       Return the sign of each data point of this Data object.       Return the sign of each data point of this Data object.
815       -1 for negative values, zero for zero values, 1 for positive values.       -1 for negative values, zero for zero values, 1 for positive values.
816       *       *
817    */    */
818      ESCRIPT_DLL_API
819    Data    Data
820    sign() const;    sign() const;
821    
822    /**    /**
823       \brief       \brief
824         Return the symmetric part of a matrix which is half the matrix plus its transpose.
825         *
826      */
827      ESCRIPT_DLL_API
828      Data
829      symmetric() const;
830    
831      /**
832         \brief
833         Return the nonsymmetric part of a matrix which is half the matrix minus its transpose.
834         *
835      */
836      ESCRIPT_DLL_API
837      Data
838      nonsymmetric() const;
839    
840      /**
841         \brief
842         Return the trace of a matrix
843         *
844      */
845      ESCRIPT_DLL_API
846      Data
847      trace(int axis_offset) const;
848    
849      /**
850         \brief
851         Transpose each data point of this Data object around the given axis.
852         *
853      */
854      ESCRIPT_DLL_API
855      Data
856      transpose(int axis_offset) const;
857    
858      /**
859         \brief
860       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.
861       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.
862       *       *
863    */    */
864      ESCRIPT_DLL_API
865    Data    Data
866    eigenvalues() const;    eigenvalues() const;
867    
# Line 730  class Data { Line 874  class Data {
874       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
875       *       *
876    */    */
877      ESCRIPT_DLL_API
878    const boost::python::tuple    const boost::python::tuple
879    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;
880    
881    /**    /**
882       \brief       \brief
883       Transpose each data point of this Data object around the given axis.       swaps the components axis0 and axis1
      --* not implemented yet *--  
884       *       *
885    */    */
886      ESCRIPT_DLL_API
887    Data    Data
888    transpose(int axis) const;    swapaxes(const int axis0, const int axis1) const;
889    
890    /**    /**
891       \brief       \brief
892       Calculate the trace of each data point of this Data object.       Return the error function erf of each data point of this Data object.
893       *       *
894    */    */
895      ESCRIPT_DLL_API
896    Data    Data
897    trace() const;    erf() const;
898    
899    /**    /**
900       \brief       \brief
901       Return the sin of each data point of this Data object.       Return the sin of each data point of this Data object.
902       *       *
903    */    */
904      ESCRIPT_DLL_API
905    Data    Data
906    sin() const;    sin() const;
907    
# Line 763  class Data { Line 910  class Data {
910       Return the cos of each data point of this Data object.       Return the cos of each data point of this Data object.
911       *       *
912    */    */
913      ESCRIPT_DLL_API
914    Data    Data
915    cos() const;    cos() const;
916    
# Line 771  class Data { Line 919  class Data {
919       Return the tan of each data point of this Data object.       Return the tan of each data point of this Data object.
920       *       *
921    */    */
922      ESCRIPT_DLL_API
923    Data    Data
924    tan() const;    tan() const;
925    
# Line 779  class Data { Line 928  class Data {
928       Return the asin of each data point of this Data object.       Return the asin of each data point of this Data object.
929       *       *
930    */    */
931      ESCRIPT_DLL_API
932    Data    Data
933    asin() const;    asin() const;
934    
# Line 787  class Data { Line 937  class Data {
937       Return the acos of each data point of this Data object.       Return the acos of each data point of this Data object.
938       *       *
939    */    */
940      ESCRIPT_DLL_API
941    Data    Data
942    acos() const;    acos() const;
943    
# Line 795  class Data { Line 946  class Data {
946       Return the atan of each data point of this Data object.       Return the atan of each data point of this Data object.
947       *       *
948    */    */
949      ESCRIPT_DLL_API
950    Data    Data
951    atan() const;    atan() const;
952    
# Line 803  class Data { Line 955  class Data {
955       Return the sinh of each data point of this Data object.       Return the sinh of each data point of this Data object.
956       *       *
957    */    */
958      ESCRIPT_DLL_API
959    Data    Data
960    sinh() const;    sinh() const;
961    
# Line 811  class Data { Line 964  class Data {
964       Return the cosh of each data point of this Data object.       Return the cosh of each data point of this Data object.
965       *       *
966    */    */
967      ESCRIPT_DLL_API
968    Data    Data
969    cosh() const;    cosh() const;
970    
# Line 819  class Data { Line 973  class Data {
973       Return the tanh of each data point of this Data object.       Return the tanh of each data point of this Data object.
974       *       *
975    */    */
976      ESCRIPT_DLL_API
977    Data    Data
978    tanh() const;    tanh() const;
979    
# Line 827  class Data { Line 982  class Data {
982       Return the asinh of each data point of this Data object.       Return the asinh of each data point of this Data object.
983       *       *
984    */    */
985      ESCRIPT_DLL_API
986    Data    Data
987    asinh() const;    asinh() const;
988    
# Line 835  class Data { Line 991  class Data {
991       Return the acosh of each data point of this Data object.       Return the acosh of each data point of this Data object.
992       *       *
993    */    */
994      ESCRIPT_DLL_API
995    Data    Data
996    acosh() const;    acosh() const;
997    
# Line 843  class Data { Line 1000  class Data {
1000       Return the atanh of each data point of this Data object.       Return the atanh of each data point of this Data object.
1001       *       *
1002    */    */
1003      ESCRIPT_DLL_API
1004    Data    Data
1005    atanh() const;    atanh() const;
1006    
# Line 851  class Data { Line 1009  class Data {
1009       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.
1010       *       *
1011    */    */
1012      ESCRIPT_DLL_API
1013    Data    Data
1014    log10() const;    log10() const;
1015    
# Line 859  class Data { Line 1018  class Data {
1018       Return the natural log of each data point of this Data object.       Return the natural log of each data point of this Data object.
1019       *       *
1020    */    */
1021      ESCRIPT_DLL_API
1022    Data    Data
1023    log() const;    log() const;
1024    
# Line 867  class Data { Line 1027  class Data {
1027       Return the exponential function of each data point of this Data object.       Return the exponential function of each data point of this Data object.
1028       *       *
1029    */    */
1030      ESCRIPT_DLL_API
1031    Data    Data
1032    exp() const;    exp() const;
1033    
# Line 875  class Data { Line 1036  class Data {
1036       Return the square root of each data point of this Data object.       Return the square root of each data point of this Data object.
1037       *       *
1038    */    */
1039      ESCRIPT_DLL_API
1040    Data    Data
1041    sqrt() const;    sqrt() const;
1042    
# Line 883  class Data { Line 1045  class Data {
1045       Return the negation of each data point of this Data object.       Return the negation of each data point of this Data object.
1046       *       *
1047    */    */
1048      ESCRIPT_DLL_API
1049    Data    Data
1050    neg() const;    neg() const;
1051    
# Line 892  class Data { Line 1055  class Data {
1055       Simply returns this object unmodified.       Simply returns this object unmodified.
1056       *       *
1057    */    */
1058      ESCRIPT_DLL_API
1059    Data    Data
1060    pos() const;    pos() const;
1061    
# Line 902  class Data { Line 1066  class Data {
1066       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1067       *       *
1068    */    */
1069      ESCRIPT_DLL_API
1070    Data    Data
1071    powD(const Data& right) const;    powD(const Data& right) const;
1072    
# Line 912  class Data { Line 1077  class Data {
1077       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1078       *       *
1079     */     */
1080      ESCRIPT_DLL_API
1081    Data    Data
1082    powO(const boost::python::object& right) const;    powO(const boost::python::object& right) const;
1083    
1084    /**    /**
1085       \brief       \brief
1086         Return the given power of each data point of this boost python object.
1087        
1088         \param left Input - the bases
1089         *
1090       */
1091    
1092      ESCRIPT_DLL_API
1093      Data
1094      rpowO(const boost::python::object& left) const;
1095    
1096      /**
1097         \brief
1098       writes the object to a file in the DX file format       writes the object to a file in the DX file format
1099    */    */
1100      ESCRIPT_DLL_API
1101    void    void
1102    saveDX(std::string fileName) const;    saveDX(std::string fileName) const;
1103    
# Line 926  class Data { Line 1105  class Data {
1105       \brief       \brief
1106       writes the object to a file in the VTK file format       writes the object to a file in the VTK file format
1107    */    */
1108      ESCRIPT_DLL_API
1109    void    void
1110    saveVTK(std::string fileName) const;    saveVTK(std::string fileName) const;
1111    
# Line 935  class Data { Line 1115  class Data {
1115       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1116       *       *
1117    */    */
1118      ESCRIPT_DLL_API
1119    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
1120      ESCRIPT_DLL_API
1121    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
1122    
1123    /**    /**
# Line 944  class Data { Line 1126  class Data {
1126       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1127       *       *
1128    */    */
1129      ESCRIPT_DLL_API
1130    Data& operator-=(const Data& right);    Data& operator-=(const Data& right);
1131      ESCRIPT_DLL_API
1132    Data& operator-=(const boost::python::object& right);    Data& operator-=(const boost::python::object& right);
1133    
1134   /**   /**
# Line 953  class Data { Line 1137  class Data {
1137       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1138       *       *
1139    */    */
1140      ESCRIPT_DLL_API
1141    Data& operator*=(const Data& right);    Data& operator*=(const Data& right);
1142      ESCRIPT_DLL_API
1143    Data& operator*=(const boost::python::object& right);    Data& operator*=(const boost::python::object& right);
1144    
1145   /**   /**
# Line 962  class Data { Line 1148  class Data {
1148       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1149       *       *
1150    */    */
1151      ESCRIPT_DLL_API
1152    Data& operator/=(const Data& right);    Data& operator/=(const Data& right);
1153      ESCRIPT_DLL_API
1154    Data& operator/=(const boost::python::object& right);    Data& operator/=(const boost::python::object& right);
1155    
1156    /**    /**
1157       \brief       \brief
1158       Returns true if this can be interpolated to functionspace.       Returns true if this can be interpolated to functionspace.
1159    */    */
1160      ESCRIPT_DLL_API
1161    bool    bool
1162    probeInterpolation(const FunctionSpace& functionspace) const;    probeInterpolation(const FunctionSpace& functionspace) const;
1163    
# Line 987  class Data { Line 1176  class Data {
1176       \param key - Input - python slice tuple specifying       \param key - Input - python slice tuple specifying
1177       slice to return.       slice to return.
1178    */    */
1179      ESCRIPT_DLL_API
1180    Data    Data
1181    getItem(const boost::python::object& key) const;    getItem(const boost::python::object& key) const;
1182    
# Line 1001  class Data { Line 1191  class Data {
1191       slice to copy from value.       slice to copy from value.
1192       \param value - Input - Data object to copy from.       \param value - Input - Data object to copy from.
1193    */    */
1194      ESCRIPT_DLL_API
1195    void    void
1196    setItemD(const boost::python::object& key,    setItemD(const boost::python::object& key,
1197             const Data& value);             const Data& value);
1198    
1199      ESCRIPT_DLL_API
1200    void    void
1201    setItemO(const boost::python::object& key,    setItemO(const boost::python::object& key,
1202             const boost::python::object& value);             const boost::python::object& value);
# Line 1017  class Data { Line 1209  class Data {
1209       this Data object.       this Data object.
1210    */    */
1211    template <class UnaryFunction>    template <class UnaryFunction>
1212      ESCRIPT_DLL_API
1213    inline    inline
1214    void    void
1215    unaryOp(UnaryFunction operation);    unaryOp(UnaryFunction operation);
# Line 1028  class Data { Line 1221  class Data {
1221       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1222       *       *
1223    */    */
1224      ESCRIPT_DLL_API
1225    Data    Data
1226    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
1227    
# Line 1039  class Data { Line 1233  class Data {
1233       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1234       *       *
1235    */    */
1236      ESCRIPT_DLL_API
1237    void    void
1238    setSlice(const Data& value,    setSlice(const Data& value,
1239             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
# Line 1048  class Data { Line 1243  class Data {
1243       Archive the current Data object to the given file.       Archive the current Data object to the given file.
1244       \param fileName - Input - file to archive to.       \param fileName - Input - file to archive to.
1245    */    */
1246      ESCRIPT_DLL_API
1247    void    void
1248    archiveData(const std::string fileName);    archiveData(const std::string fileName);
1249    
# Line 1059  class Data { Line 1255  class Data {
1255       \param fileName - Input - file to extract from.       \param fileName - Input - file to extract from.
1256       \param fspace - Input - a suitable FunctionSpace descibing the data.       \param fspace - Input - a suitable FunctionSpace descibing the data.
1257    */    */
1258      ESCRIPT_DLL_API
1259    void    void
1260    extractData(const std::string fileName,    extractData(const std::string fileName,
1261                const FunctionSpace& fspace);                const FunctionSpace& fspace);
1262    
1263    
1264      /**
1265         \brief
1266         print the data values to stdout. Used for debugging
1267      */
1268      ESCRIPT_DLL_API
1269      void
1270        print(void);
1271    
1272      /**
1273         \brief
1274         return the MPI rank number of the local data
1275             MPI_COMM_WORLD is assumed and the result of MPI_Comm_size()
1276             is returned
1277      */
1278      ESCRIPT_DLL_API
1279        int
1280        get_MPIRank(void) const;
1281    
1282      /**
1283         \brief
1284         return the MPI rank number of the local data
1285             MPI_COMM_WORLD is assumed and the result of MPI_Comm_rank()
1286             is returned
1287      */
1288      ESCRIPT_DLL_API
1289        int
1290        get_MPISize(void) const;
1291    
1292      /**
1293         \brief
1294         return the MPI rank number of the local data
1295             MPI_COMM_WORLD is assumed and returned.
1296      */
1297      ESCRIPT_DLL_API
1298        MPI_Comm
1299        get_MPIComm(void) const;
1300    
1301      /**
1302         \brief
1303         return the object produced by the factory, which is a DataConstant or DataExpanded
1304      */
1305      ESCRIPT_DLL_API
1306        DataAbstract*
1307        borrowData(void) const;
1308    
1309   protected:   protected:
1310    
1311   private:   private:
# Line 1120  class Data { Line 1363  class Data {
1363    
1364    /**    /**
1365       \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  
1366       Convert the data type of the RHS to match this.       Convert the data type of the RHS to match this.
1367       \param right - Input - data type to match.       \param right - Input - data type to match.
1368    */    */
# Line 1155  class Data { Line 1387  class Data {
1387               const FunctionSpace& what,               const FunctionSpace& what,
1388               bool expanded);               bool expanded);
1389    
1390    /**    //
1391       \brief    // flag to protect the data object against any update
1392       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);  
1393    
1394    //    //
1395    // pointer to the actual data object    // pointer to the actual data object
# Line 1200  Data::initialise(const IValueType& value Line 1426  Data::initialise(const IValueType& value
1426  /**  /**
1427     Binary Data object operators.     Binary Data object operators.
1428  */  */
1429    inline double rpow(double x,double y)
1430    {
1431        return pow(y,x);
1432    };
1433    
1434  /**  /**
1435    \brief    \brief
1436    Operator+    Operator+
1437    Takes two Data objects.    Takes two Data objects.
1438  */  */
1439  Data operator+(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const Data& right);
1440    
1441  /**  /**
1442    \brief    \brief
1443    Operator-    Operator-
1444    Takes two Data objects.    Takes two Data objects.
1445  */  */
1446  Data operator-(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const Data& right);
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
# Line 1235  Data operator/(const Data& left, const D Line 1465  Data operator/(const Data& left, const D
1465    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1466    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1467  */  */
1468  Data operator+(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const boost::python::object& right);
1469    
1470  /**  /**
1471    \brief    \brief
# Line 1243  Data operator+(const Data& left, const b Line 1473  Data operator+(const Data& left, const b
1473    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1474    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1475  */  */
1476  Data operator-(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const boost::python::object& right);
1477    
1478  /**  /**
1479    \brief    \brief
# Line 1251  Data operator-(const Data& left, const b Line 1481  Data operator-(const Data& left, const b
1481    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1482    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1483  */  */
1484  Data operator*(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator*(const Data& left, const boost::python::object& right);
1485    
1486  /**  /**
1487    \brief    \brief
# Line 1259  Data operator*(const Data& left, const b Line 1489  Data operator*(const Data& left, const b
1489    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1490    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1491  */  */
1492  Data operator/(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator/(const Data& left, const boost::python::object& right);
1493    
1494  /**  /**
1495    \brief    \brief
# Line 1267  Data operator/(const Data& left, const b Line 1497  Data operator/(const Data& left, const b
1497    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1498    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1499  */  */
1500  Data operator+(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const boost::python::object& left, const Data& right);
1501    
1502  /**  /**
1503    \brief    \brief
# Line 1275  Data operator+(const boost::python::obje Line 1505  Data operator+(const boost::python::obje
1505    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1506    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1507  */  */
1508  Data operator-(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const boost::python::object& left, const Data& right);
1509    
1510  /**  /**
1511    \brief    \brief
# Line 1283  Data operator-(const boost::python::obje Line 1513  Data operator-(const boost::python::obje
1513    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1514    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1515  */  */
1516  Data operator*(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator*(const boost::python::object& left, const Data& right);
1517    
1518  /**  /**
1519    \brief    \brief
# Line 1291  Data operator*(const boost::python::obje Line 1521  Data operator*(const boost::python::obje
1521    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1522    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1523  */  */
1524  Data operator/(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator/(const boost::python::object& left, const Data& right);
1525    
1526  /**  /**
1527    \brief    \brief
1528    Output operator    Output operator
1529  */  */
1530  std::ostream& operator<<(std::ostream& o, const Data& data);  ESCRIPT_DLL_API std::ostream& operator<<(std::ostream& o, const Data& data);
1531    
1532    /**
1533      \brief
1534      Compute a tensor product of two Data objects
1535      \param arg0 - Input - Data object
1536      \param arg1 - Input - Data object
1537      \param axis_offset - Input - axis offset
1538      \param transpose - Input - 0: transpose neither, 1: transpose arg0, 2: transpose arg1
1539    */
1540    ESCRIPT_DLL_API
1541    Data
1542    C_GeneralTensorProduct(Data& arg0,
1543                         Data& arg1,
1544                         int axis_offset=0,
1545                         int transpose=0);
1546    
1547  /**  /**
1548    \brief    \brief
# Line 1305  std::ostream& operator<<(std::ostream& o Line 1550  std::ostream& operator<<(std::ostream& o
1550    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
1551    be relied on. Requires further implementation.    be relied on. Requires further implementation.
1552  */  */
1553  //bool operator==(const Data& left, const Data& right);  //ESCRIPT_DLL_API bool operator==(const Data& left, const Data& right);
1554    
1555  /**  /**
1556    \brief    \brief
# Line 1321  Data::binaryOp(const Data& right, Line 1566  Data::binaryOp(const Data& right,
1566     //     //
1567     // 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
1568     if (getPointDataView().getRank()==0 && right.getPointDataView().getRank()!=0) {     if (getPointDataView().getRank()==0 && right.getPointDataView().getRank()!=0) {
1569       reshapeDataPoint(right.getPointDataView().getShape());       throw DataException("Error - attempt to update rank zero object with object with rank bigger than zero.");
1570     }     }
1571     //     //
1572     // initially make the temporary a shallow copy     // initially make the temporary a shallow copy
# Line 1373  Data::binaryOp(const Data& right, Line 1618  Data::binaryOp(const Data& right,
1618       EsysAssert((leftC!=0 && rightC!=0), "Programming error - casting to DataConstant.");       EsysAssert((leftC!=0 && rightC!=0), "Programming error - casting to DataConstant.");
1619       escript::binaryOp(*leftC,*rightC,operation);       escript::binaryOp(*leftC,*rightC,operation);
1620     }     }
1621  }     #if defined DOPROF
1622       profData->binary++;
1623  /**     #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);  
    }  
1624  }  }
1625    
1626  /**  /**

Legend:
Removed from v.576  
changed lines
  Added in v.876

  ViewVC Help
Powered by ViewVC 1.1.26