/[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 804 by gross, Thu Aug 10 01:12:16 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 75  class Data { Line 79  class Data {
79       Default constructor.       Default constructor.
80       Creates a DataEmpty object.       Creates a DataEmpty object.
81    */    */
82      ESCRIPT_DLL_API
83    Data();    Data();
84    
85    /**    /**
# Line 82  class Data { Line 87  class Data {
87       Copy constructor.       Copy constructor.
88       WARNING: Only performs a shallow copy.       WARNING: Only performs a shallow copy.
89    */    */
90      ESCRIPT_DLL_API
91    Data(const Data& inData);    Data(const Data& inData);
92    
93    /**    /**
# Line 90  class Data { Line 96  class Data {
96       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,
97       otherwise a shallow copy of inData is returned.       otherwise a shallow copy of inData is returned.
98    */    */
99      ESCRIPT_DLL_API
100    Data(const Data& inData,    Data(const Data& inData,
101         const FunctionSpace& what);         const FunctionSpace& what);
102    
# Line 103  class Data { Line 110  class Data {
110                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
111                         mechanism will be used.                         mechanism will be used.
112    */    */
113      ESCRIPT_DLL_API
114    Data(const DataArrayView& value,    Data(const DataArrayView& value,
115         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
116         bool expanded=false);         bool expanded=false);
# Line 118  class Data { Line 126  class Data {
126                         the given value. Otherwise a more efficient storage                         the given value. Otherwise a more efficient storage
127                         mechanism will be used.                         mechanism will be used.
128    */    */
129      ESCRIPT_DLL_API
130    Data(double value,    Data(double value,
131         const DataArrayView::ShapeType& dataPointShape=DataArrayView::ShapeType(),         const DataArrayView::ShapeType& dataPointShape=DataArrayView::ShapeType(),
132         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
# Line 130  class Data { Line 139  class Data {
139       \param inData - Input - Input Data object.       \param inData - Input - Input Data object.
140       \param region - Input - Region to copy.       \param region - Input - Region to copy.
141    */    */
142      ESCRIPT_DLL_API
143    Data(const Data& inData,    Data(const Data& inData,
144         const DataArrayView::RegionType& region);         const DataArrayView::RegionType& region);
145    
# Line 147  class Data { Line 157  class Data {
157                         the appropriate values.                         the appropriate values.
158      ==>*      ==>*
159    */    */
160      ESCRIPT_DLL_API
161    Data(const DataTagged::TagListType& tagKeys,    Data(const DataTagged::TagListType& tagKeys,
162         const DataTagged::ValueListType& values,         const DataTagged::ValueListType& values,
163         const DataArrayView& defaultValue,         const DataArrayView& defaultValue,
# Line 163  class Data { Line 174  class Data {
174                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
175                         mechanism will be used.                         mechanism will be used.
176    */    */
177      ESCRIPT_DLL_API
178    Data(const boost::python::numeric::array& value,    Data(const boost::python::numeric::array& value,
179         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
180         bool expanded=false);         bool expanded=false);
# Line 178  class Data { Line 190  class Data {
190                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
191                         mechanism will be used.                         mechanism will be used.
192    */    */
193      ESCRIPT_DLL_API
194    Data(const boost::python::object& value,    Data(const boost::python::object& value,
195         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
196         bool expanded=false);         bool expanded=false);
# Line 191  class Data { Line 204  class Data {
204       \param value - Input - Input data.       \param value - Input - Input data.
205       \param other - Input - contains all other parameters.       \param other - Input - contains all other parameters.
206    */    */
207      ESCRIPT_DLL_API
208    Data(const boost::python::object& value,    Data(const boost::python::object& value,
209         const Data& other);         const Data& other);
210    
# Line 198  class Data { Line 212  class Data {
212       \brief       \brief
213       Constructor which creates a DataConstant of "shape" with constant value.       Constructor which creates a DataConstant of "shape" with constant value.
214    */    */
215      ESCRIPT_DLL_API
216    Data(double value,    Data(double value,
217         const boost::python::tuple& shape=boost::python::make_tuple(),         const boost::python::tuple& shape=boost::python::make_tuple(),
218         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
# Line 206  class Data { Line 221  class Data {
221       \brief       \brief
222       Destructor       Destructor
223    */    */
224      ESCRIPT_DLL_API
225    ~Data();    ~Data();
226    
227    /**    /**
228       \brief       \brief
229       Perform a deep copy.       Perform a deep copy.
230    */    */
231      ESCRIPT_DLL_API
232    void    void
233    copy(const Data& other);    copy(const Data& other);
234    
# Line 221  class Data { Line 238  class Data {
238    
239    /**    /**
240       \brief       \brief
241         switches on update protection
242    
243      */
244      ESCRIPT_DLL_API
245      void
246      setProtection();
247    
248      /**
249         \brief
250         Returns trueif the data object is protected against update
251    
252      */
253      ESCRIPT_DLL_API
254      bool
255      isProtected() const;
256      /**
257         \brief
258       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.
259    */    */
260      ESCRIPT_DLL_API
261    const boost::python::numeric::array    const boost::python::numeric::array
262    convertToNumArray();    convertToNumArray();
263    
# Line 230  class Data { Line 265  class Data {
265       \brief       \brief
266       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.
267    */    */
268      ESCRIPT_DLL_API
269    const boost::python::numeric::array    const boost::python::numeric::array
270    convertToNumArrayFromSampleNo(int sampleNo);    convertToNumArrayFromSampleNo(int sampleNo);
271    
# Line 237  class Data { Line 273  class Data {
273       \brief       \brief
274       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.
275    */    */
276    #ifndef PASO_MPI  
277      ESCRIPT_DLL_API
278    const boost::python::numeric::array    const boost::python::numeric::array
279    convertToNumArrayFromDPNo(int sampleNo,    convertToNumArrayFromDPNo(int ProcNo,
280                                                            int sampleNo,
281                              int dataPointNo);                              int dataPointNo);
282    #else
283      ESCRIPT_DLL_API
284      const boost::python::numeric::array
285      convertToNumArrayFromDPNo(int procNo,
286                    int sampleNo,
287                    int dataPointNo);
288    #endif
289    
290    
291    /**    /**
292       \brief       \brief
293       Fills the expanded Data object from values of a python numarray object.       Fills the expanded Data object from values of a python numarray object.
294    */    */
295      ESCRIPT_DLL_API
296    void    void
297    fillFromNumArray(const boost::python::numeric::array);    fillFromNumArray(const boost::python::numeric::array);
298    
# Line 255  class Data { Line 303  class Data {
303       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
304       numarray returned by convertToNumArray.       numarray returned by convertToNumArray.
305    */    */
306      ESCRIPT_DLL_API
307    int    int
308    getTagNumber(int dpno);    getTagNumber(int dpno);
309    
# Line 262  class Data { Line 311  class Data {
311       \brief       \brief
312       Return the C wrapper for the Data object.       Return the C wrapper for the Data object.
313    */    */
314      ESCRIPT_DLL_API
315    escriptDataC    escriptDataC
316    getDataC();    getDataC();
317    
# Line 269  class Data { Line 319  class Data {
319       \brief       \brief
320       Return the C wrapper for the Data object - const version.       Return the C wrapper for the Data object - const version.
321    */    */
322      ESCRIPT_DLL_API
323    escriptDataC    escriptDataC
324    getDataC() const;    getDataC() const;
325    
# Line 276  class Data { Line 327  class Data {
327       \brief       \brief
328       Write the data as a string.       Write the data as a string.
329    */    */
330      ESCRIPT_DLL_API
331    inline    inline
332    std::string    std::string
333    toString() const    toString() const
# Line 289  class Data { Line 341  class Data {
341       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
342       to manipulate the point data.       to manipulate the point data.
343    */    */
344      ESCRIPT_DLL_API
345    inline    inline
346    const DataArrayView&    const DataArrayView&
347    getPointDataView() const    getPointDataView() const
# Line 300  class Data { Line 353  class Data {
353       \brief       \brief
354       Whatever the current Data type make this into a DataExpanded.       Whatever the current Data type make this into a DataExpanded.
355    */    */
356      ESCRIPT_DLL_API
357    void    void
358    expand();    expand();
359    
# Line 310  class Data { Line 364  class Data {
364       Expanded data to tagged will throw an exception.       Expanded data to tagged will throw an exception.
365      ==>*      ==>*
366    */    */
367      ESCRIPT_DLL_API
368    void    void
369    tag();    tag();
370    
# Line 317  class Data { Line 372  class Data {
372       \brief       \brief
373       Return true if this Data is expanded.       Return true if this Data is expanded.
374    */    */
375      ESCRIPT_DLL_API
376    bool    bool
377    isExpanded() const;    isExpanded() const;
378    
# Line 324  class Data { Line 380  class Data {
380       \brief       \brief
381       Return true if this Data is tagged.       Return true if this Data is tagged.
382    */    */
383      ESCRIPT_DLL_API
384    bool    bool
385    isTagged() const;    isTagged() const;
386    
# Line 331  class Data { Line 388  class Data {
388       \brief       \brief
389       Return true if this Data is constant.       Return true if this Data is constant.
390    */    */
391      ESCRIPT_DLL_API
392    bool    bool
393    isConstant() const;    isConstant() const;
394    
# Line 338  class Data { Line 396  class Data {
396       \brief       \brief
397       Return true if this Data is empty.       Return true if this Data is empty.
398    */    */
399      ESCRIPT_DLL_API
400    bool    bool
401    isEmpty() const;    isEmpty() const;
402    
# Line 345  class Data { Line 404  class Data {
404       \brief       \brief
405       Return the function space.       Return the function space.
406    */    */
407      ESCRIPT_DLL_API
408    inline    inline
409    const FunctionSpace&    const FunctionSpace&
410    getFunctionSpace() const    getFunctionSpace() const
# Line 356  class Data { Line 416  class Data {
416       \brief       \brief
417       Return a copy of the function space.       Return a copy of the function space.
418    */    */
419      ESCRIPT_DLL_API
420    const FunctionSpace    const FunctionSpace
421    getCopyOfFunctionSpace() const;    getCopyOfFunctionSpace() const;
422    
# Line 363  class Data { Line 424  class Data {
424       \brief       \brief
425       Return the domain.       Return the domain.
426    */    */
427      ESCRIPT_DLL_API
428    inline    inline
429    const AbstractDomain&    const AbstractDomain&
430    getDomain() const    getDomain() const
# Line 374  class Data { Line 436  class Data {
436       \brief       \brief
437       Return a copy of the domain.       Return a copy of the domain.
438    */    */
439      ESCRIPT_DLL_API
440    const AbstractDomain    const AbstractDomain
441    getCopyOfDomain() const;    getCopyOfDomain() const;
442    
# Line 381  class Data { Line 444  class Data {
444       \brief       \brief
445       Return the rank of the point data.       Return the rank of the point data.
446    */    */
447      ESCRIPT_DLL_API
448    inline    inline
449    int    int
450    getDataPointRank() const    getDataPointRank() const
# Line 392  class Data { Line 456  class Data {
456       \brief       \brief
457       Return the number of samples.       Return the number of samples.
458    */    */
459      ESCRIPT_DLL_API
460    inline    inline
461    int    int
462    getNumSamples() const    getNumSamples() const
# Line 403  class Data { Line 468  class Data {
468       \brief       \brief
469       Return the number of data points per sample.       Return the number of data points per sample.
470    */    */
471      ESCRIPT_DLL_API
472    inline    inline
473    int    int
474    getNumDataPointsPerSample() const    getNumDataPointsPerSample() const
# Line 416  class Data { Line 482  class Data {
482       preferred interface but is provided for use by C code.       preferred interface but is provided for use by C code.
483       \param sampleNo - Input - the given sample no.       \param sampleNo - Input - the given sample no.
484    */    */
485      ESCRIPT_DLL_API
486    inline    inline
487    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
488    getSampleData(DataAbstract::ValueType::size_type sampleNo)    getSampleData(DataAbstract::ValueType::size_type sampleNo)
# Line 429  class Data { Line 496  class Data {
496       access data that isn't tagged an exception will be thrown.       access data that isn't tagged an exception will be thrown.
497       \param tag - Input - the tag key.       \param tag - Input - the tag key.
498    */    */
499      ESCRIPT_DLL_API
500    inline    inline
501    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
502    getSampleDataByTag(int tag)    getSampleDataByTag(int tag)
# Line 452  class Data { Line 520  class Data {
520       \param value - Input - value to assign to data-points associated with       \param value - Input - value to assign to data-points associated with
521                              the given reference number.                              the given reference number.
522    */    */
523      ESCRIPT_DLL_API
524    void    void
525    setRefValue(int ref,    setRefValue(int ref,
526                const boost::python::numeric::array& value);                const boost::python::numeric::array& value);
# Line 471  class Data { Line 540  class Data {
540       \param value - Output - object to receive values from data-points       \param value - Output - object to receive values from data-points
541                               associated with the given reference number.                               associated with the given reference number.
542    */    */
543      ESCRIPT_DLL_API
544    void    void
545    getRefValue(int ref,    getRefValue(int ref,
546                boost::python::numeric::array& value);                boost::python::numeric::array& value);
# Line 483  class Data { Line 553  class Data {
553       \param sampleNo - Input -       \param sampleNo - Input -
554       \param dataPointNo - Input -       \param dataPointNo - Input -
555    */    */
556      ESCRIPT_DLL_API
557    inline    inline
558    DataArrayView    DataArrayView
559    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
560                 int dataPointNo)                 int dataPointNo)
561    {    {
562      return m_data->getDataPoint(sampleNo,dataPointNo);          return m_data->getDataPoint(sampleNo,dataPointNo);
563    }    }
564    
565    /**    /**
566       \brief       \brief
567       Return a reference to the data point shape.       Return a reference to the data point shape.
568    */    */
569      ESCRIPT_DLL_API
570    const DataArrayView::ShapeType&    const DataArrayView::ShapeType&
571    getDataPointShape() const;    getDataPointShape() const;
572    
# Line 502  class Data { Line 574  class Data {
574       \brief       \brief
575       Return the data point shape as a tuple of integers.       Return the data point shape as a tuple of integers.
576    */    */
577      ESCRIPT_DLL_API
578    const boost::python::tuple    const boost::python::tuple
579    getShapeTuple() const;    getShapeTuple() const;
580    
# Line 510  class Data { Line 583  class Data {
583       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
584       data point shape dimensions.       data point shape dimensions.
585    */    */
586      ESCRIPT_DLL_API
587    int    int
588    getDataPointSize() const;    getDataPointSize() const;
589    
# Line 517  class Data { Line 591  class Data {
591       \brief       \brief
592       Return the number of doubles stored for this Data.       Return the number of doubles stored for this Data.
593    */    */
594      ESCRIPT_DLL_API
595    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
596    getLength() const;    getLength() const;
597    
# Line 529  class Data { Line 604  class Data {
604       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
605      ==>*      ==>*
606    */    */
607      ESCRIPT_DLL_API
608    void    void
609    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
610                   const boost::python::object& value);                   const boost::python::object& value);
# Line 542  class Data { Line 618  class Data {
618       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
619      ==>*      ==>*
620    */    */
621      ESCRIPT_DLL_API
622    void    void
623    setTaggedValueFromCPP(int tagKey,    setTaggedValueFromCPP(int tagKey,
624                          const DataArrayView& value);                          const DataArrayView& value);
# Line 550  class Data { Line 627  class Data {
627      \brief      \brief
628      Copy other Data object into this Data object where mask is positive.      Copy other Data object into this Data object where mask is positive.
629    */    */
630      ESCRIPT_DLL_API
631    void    void
632    copyWithMask(const Data& other,    copyWithMask(const Data& other,
633                 const Data& mask);                 const Data& mask);
# Line 564  class Data { Line 642  class Data {
642       the result as a Data object.       the result as a Data object.
643       *       *
644    */    */
645      ESCRIPT_DLL_API
646    Data    Data
647    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
648    
# Line 573  class Data { Line 652  class Data {
652       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.
653       *       *
654    */    */
655      ESCRIPT_DLL_API
656    Data    Data
657    gradOn(const FunctionSpace& functionspace) const;    gradOn(const FunctionSpace& functionspace) const;
658    
659      ESCRIPT_DLL_API
660    Data    Data
661    grad() const;    grad() const;
662    
# Line 584  class Data { Line 665  class Data {
665       Calculate the integral over the function space domain.       Calculate the integral over the function space domain.
666       *       *
667    */    */
668      ESCRIPT_DLL_API
669    boost::python::numeric::array    boost::python::numeric::array
670    integrate() const;    integrate() const;
671    
# Line 592  class Data { Line 674  class Data {
674       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.
675       *       *
676    */    */
677      ESCRIPT_DLL_API
678    Data    Data
679    wherePositive(double tol=0.0) const;    wherePositive() const;
680    
681    /**    /**
682       \brief       \brief
683       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.
684       *       *
685    */    */
686      ESCRIPT_DLL_API
687    Data    Data
688    whereNegative(double tol=0.0) const;    whereNegative() const;
689    
690    /**    /**
691       \brief       \brief
692       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.
693       *       *
694    */    */
695      ESCRIPT_DLL_API
696    Data    Data
697    whereNonNegative(double tol=0.0) const;    whereNonNegative() 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    whereNonPositive(double tol=0.0) const;    whereNonPositive() const;
707    
708    /**    /**
709       \brief       \brief
710       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.
711       *       *
712    */    */
713      ESCRIPT_DLL_API
714    Data    Data
715    whereZero(double tol=0.0) const;    whereZero(double tol=0.0) const;
716    
# Line 632  class Data { Line 719  class Data {
719       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.
720       *       *
721    */    */
722      ESCRIPT_DLL_API
723    Data    Data
724    whereNonZero(double tol=0.0) const;    whereNonZero(double tol=0.0) const;
725    
# Line 640  class Data { Line 728  class Data {
728       Return the maximum absolute value of this Data object.       Return the maximum absolute value of this Data object.
729       *       *
730    */    */
731      ESCRIPT_DLL_API
732    double    double
733    Lsup() const;    Lsup() const;
734    
# Line 648  class Data { Line 737  class Data {
737       Return the minimum absolute value of this Data object.       Return the minimum absolute value of this Data object.
738       *       *
739    */    */
740      ESCRIPT_DLL_API
741    double    double
742    Linf() const;    Linf() const;
743    
# Line 656  class Data { Line 746  class Data {
746       Return the maximum value of this Data object.       Return the maximum value of this Data object.
747       *       *
748    */    */
749      ESCRIPT_DLL_API
750    double    double
751    sup() const;    sup() const;
752    
# Line 664  class Data { Line 755  class Data {
755       Return the minimum value of this Data object.       Return the minimum value of this Data object.
756       *       *
757    */    */
758      ESCRIPT_DLL_API
759    double    double
760    inf() const;    inf() const;
761    
# Line 672  class Data { Line 764  class Data {
764       Return the absolute value of each data point of this Data object.       Return the absolute value of each data point of this Data object.
765       *       *
766    */    */
767      ESCRIPT_DLL_API
768    Data    Data
769    abs() const;    abs() const;
770    
# Line 680  class Data { Line 773  class Data {
773       Return the maximum value of each data point of this Data object.       Return the maximum value of each data point of this Data object.
774       *       *
775    */    */
776      ESCRIPT_DLL_API
777    Data    Data
778    maxval() const;    maxval() const;
779    
# Line 688  class Data { Line 782  class Data {
782       Return the minimum value of each data point of this Data object.       Return the minimum value of each data point of this Data object.
783       *       *
784    */    */
785      ESCRIPT_DLL_API
786    Data    Data
787    minval() const;    minval() const;
788    
# Line 696  class Data { Line 791  class Data {
791       Return the (sample number, data-point number) of the data point with       Return the (sample number, data-point number) of the data point with
792       the minimum value in this Data object.       the minimum value in this Data object.
793    */    */
794      ESCRIPT_DLL_API
795    const boost::python::tuple    const boost::python::tuple
796    mindp() const;    mindp() const;
797    
798      ESCRIPT_DLL_API
799    void    void
800    calc_mindp(int& SampleNo,    calc_mindp(int& ProcNo,
801                            int& SampleNo,  
802               int& DataPointNo) const;               int& DataPointNo) const;
   
803    /**    /**
804       \brief       \brief
805       Return the sign of each data point of this Data object.       Return the sign of each data point of this Data object.
806       -1 for negative values, zero for zero values, 1 for positive values.       -1 for negative values, zero for zero values, 1 for positive values.
807       *       *
808    */    */
809      ESCRIPT_DLL_API
810    Data    Data
811    sign() const;    sign() const;
812    
813    /**    /**
814       \brief       \brief
815         Return the symmetric part of a matrix which is half the matrix plus its transpose.
816         *
817      */
818      ESCRIPT_DLL_API
819      Data
820      symmetric() const;
821    
822      /**
823         \brief
824         Return the nonsymmetric part of a matrix which is half the matrix minus its transpose.
825         *
826      */
827      ESCRIPT_DLL_API
828      Data
829      nonsymmetric() const;
830    
831      /**
832         \brief
833         Return the trace of a matrix
834         *
835      */
836      ESCRIPT_DLL_API
837      Data
838      trace(int axis_offset) const;
839    
840      /**
841         \brief
842         Transpose each data point of this Data object around the given axis.
843         *
844      */
845      ESCRIPT_DLL_API
846      Data
847      transpose(int axis_offset) const;
848    
849      /**
850         \brief
851       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.
852       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.
853       *       *
854    */    */
855      ESCRIPT_DLL_API
856    Data    Data
857    eigenvalues() const;    eigenvalues() const;
858    
# Line 730  class Data { Line 865  class Data {
865       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
866       *       *
867    */    */
868      ESCRIPT_DLL_API
869    const boost::python::tuple    const boost::python::tuple
870    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;
871    
872    /**    /**
873       \brief       \brief
874       Transpose each data point of this Data object around the given axis.       swaps the components axis0 and axis1
      --* not implemented yet *--  
      *  
   */  
   Data  
   transpose(int axis) const;  
   
   /**  
      \brief  
      Calculate the trace of each data point of this Data object.  
875       *       *
876    */    */
877      ESCRIPT_DLL_API
878    Data    Data
879    trace() const;    swapaxes(const int axis0, const int axis1) const;
880    
881    /**    /**
882       \brief       \brief
883       Return the sin of each data point of this Data object.       Return the sin of each data point of this Data object.
884       *       *
885    */    */
886      ESCRIPT_DLL_API
887    Data    Data
888    sin() const;    sin() const;
889    
# Line 763  class Data { Line 892  class Data {
892       Return the cos of each data point of this Data object.       Return the cos of each data point of this Data object.
893       *       *
894    */    */
895      ESCRIPT_DLL_API
896    Data    Data
897    cos() const;    cos() const;
898    
# Line 771  class Data { Line 901  class Data {
901       Return the tan of each data point of this Data object.       Return the tan of each data point of this Data object.
902       *       *
903    */    */
904      ESCRIPT_DLL_API
905    Data    Data
906    tan() const;    tan() const;
907    
# Line 779  class Data { Line 910  class Data {
910       Return the asin of each data point of this Data object.       Return the asin of each data point of this Data object.
911       *       *
912    */    */
913      ESCRIPT_DLL_API
914    Data    Data
915    asin() const;    asin() const;
916    
# Line 787  class Data { Line 919  class Data {
919       Return the acos of each data point of this Data object.       Return the acos of each data point of this Data object.
920       *       *
921    */    */
922      ESCRIPT_DLL_API
923    Data    Data
924    acos() const;    acos() const;
925    
# Line 795  class Data { Line 928  class Data {
928       Return the atan of each data point of this Data object.       Return the atan of each data point of this Data object.
929       *       *
930    */    */
931      ESCRIPT_DLL_API
932    Data    Data
933    atan() const;    atan() const;
934    
# Line 803  class Data { Line 937  class Data {
937       Return the sinh of each data point of this Data object.       Return the sinh of each data point of this Data object.
938       *       *
939    */    */
940      ESCRIPT_DLL_API
941    Data    Data
942    sinh() const;    sinh() const;
943    
# Line 811  class Data { Line 946  class Data {
946       Return the cosh of each data point of this Data object.       Return the cosh of each data point of this Data object.
947       *       *
948    */    */
949      ESCRIPT_DLL_API
950    Data    Data
951    cosh() const;    cosh() const;
952    
# Line 819  class Data { Line 955  class Data {
955       Return the tanh of each data point of this Data object.       Return the tanh of each data point of this Data object.
956       *       *
957    */    */
958      ESCRIPT_DLL_API
959    Data    Data
960    tanh() const;    tanh() const;
961    
# Line 827  class Data { Line 964  class Data {
964       Return the asinh of each data point of this Data object.       Return the asinh of each data point of this Data object.
965       *       *
966    */    */
967      ESCRIPT_DLL_API
968    Data    Data
969    asinh() const;    asinh() const;
970    
# Line 835  class Data { Line 973  class Data {
973       Return the acosh of each data point of this Data object.       Return the acosh of each data point of this Data object.
974       *       *
975    */    */
976      ESCRIPT_DLL_API
977    Data    Data
978    acosh() const;    acosh() const;
979    
# Line 843  class Data { Line 982  class Data {
982       Return the atanh of each data point of this Data object.       Return the atanh of each data point of this Data object.
983       *       *
984    */    */
985      ESCRIPT_DLL_API
986    Data    Data
987    atanh() const;    atanh() const;
988    
# Line 851  class Data { Line 991  class Data {
991       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.
992       *       *
993    */    */
994      ESCRIPT_DLL_API
995    Data    Data
996    log10() const;    log10() const;
997    
# Line 859  class Data { Line 1000  class Data {
1000       Return the natural log of each data point of this Data object.       Return the natural log of each data point of this Data object.
1001       *       *
1002    */    */
1003      ESCRIPT_DLL_API
1004    Data    Data
1005    log() const;    log() const;
1006    
# Line 867  class Data { Line 1009  class Data {
1009       Return the exponential function of each data point of this Data object.       Return the exponential function of each data point of this Data object.
1010       *       *
1011    */    */
1012      ESCRIPT_DLL_API
1013    Data    Data
1014    exp() const;    exp() const;
1015    
# Line 875  class Data { Line 1018  class Data {
1018       Return the square root of each data point of this Data object.       Return the square root of each data point of this Data object.
1019       *       *
1020    */    */
1021      ESCRIPT_DLL_API
1022    Data    Data
1023    sqrt() const;    sqrt() const;
1024    
# Line 883  class Data { Line 1027  class Data {
1027       Return the negation of each data point of this Data object.       Return the negation of each data point of this Data object.
1028       *       *
1029    */    */
1030      ESCRIPT_DLL_API
1031    Data    Data
1032    neg() const;    neg() const;
1033    
# Line 892  class Data { Line 1037  class Data {
1037       Simply returns this object unmodified.       Simply returns this object unmodified.
1038       *       *
1039    */    */
1040      ESCRIPT_DLL_API
1041    Data    Data
1042    pos() const;    pos() const;
1043    
# Line 902  class Data { Line 1048  class Data {
1048       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1049       *       *
1050    */    */
1051      ESCRIPT_DLL_API
1052    Data    Data
1053    powD(const Data& right) const;    powD(const Data& right) const;
1054    
# Line 912  class Data { Line 1059  class Data {
1059       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1060       *       *
1061     */     */
1062      ESCRIPT_DLL_API
1063    Data    Data
1064    powO(const boost::python::object& right) const;    powO(const boost::python::object& right) const;
1065    
1066    /**    /**
1067       \brief       \brief
1068         Return the given power of each data point of this boost python object.
1069        
1070         \param left Input - the bases
1071         *
1072       */
1073    
1074      ESCRIPT_DLL_API
1075      Data
1076      rpowO(const boost::python::object& left) const;
1077    
1078      /**
1079         \brief
1080       writes the object to a file in the DX file format       writes the object to a file in the DX file format
1081    */    */
1082      ESCRIPT_DLL_API
1083    void    void
1084    saveDX(std::string fileName) const;    saveDX(std::string fileName) const;
1085    
# Line 926  class Data { Line 1087  class Data {
1087       \brief       \brief
1088       writes the object to a file in the VTK file format       writes the object to a file in the VTK file format
1089    */    */
1090      ESCRIPT_DLL_API
1091    void    void
1092    saveVTK(std::string fileName) const;    saveVTK(std::string fileName) const;
1093    
# Line 935  class Data { Line 1097  class Data {
1097       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1098       *       *
1099    */    */
1100      ESCRIPT_DLL_API
1101    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
1102      ESCRIPT_DLL_API
1103    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
1104    
1105    /**    /**
# Line 944  class Data { Line 1108  class Data {
1108       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1109       *       *
1110    */    */
1111      ESCRIPT_DLL_API
1112    Data& operator-=(const Data& right);    Data& operator-=(const Data& right);
1113      ESCRIPT_DLL_API
1114    Data& operator-=(const boost::python::object& right);    Data& operator-=(const boost::python::object& right);
1115    
1116   /**   /**
# Line 953  class Data { Line 1119  class Data {
1119       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1120       *       *
1121    */    */
1122      ESCRIPT_DLL_API
1123    Data& operator*=(const Data& right);    Data& operator*=(const Data& right);
1124      ESCRIPT_DLL_API
1125    Data& operator*=(const boost::python::object& right);    Data& operator*=(const boost::python::object& right);
1126    
1127   /**   /**
# Line 962  class Data { Line 1130  class Data {
1130       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1131       *       *
1132    */    */
1133      ESCRIPT_DLL_API
1134    Data& operator/=(const Data& right);    Data& operator/=(const Data& right);
1135      ESCRIPT_DLL_API
1136    Data& operator/=(const boost::python::object& right);    Data& operator/=(const boost::python::object& right);
1137    
1138    /**    /**
1139       \brief       \brief
1140       Returns true if this can be interpolated to functionspace.       Returns true if this can be interpolated to functionspace.
1141    */    */
1142      ESCRIPT_DLL_API
1143    bool    bool
1144    probeInterpolation(const FunctionSpace& functionspace) const;    probeInterpolation(const FunctionSpace& functionspace) const;
1145    
# Line 987  class Data { Line 1158  class Data {
1158       \param key - Input - python slice tuple specifying       \param key - Input - python slice tuple specifying
1159       slice to return.       slice to return.
1160    */    */
1161      ESCRIPT_DLL_API
1162    Data    Data
1163    getItem(const boost::python::object& key) const;    getItem(const boost::python::object& key) const;
1164    
# Line 1001  class Data { Line 1173  class Data {
1173       slice to copy from value.       slice to copy from value.
1174       \param value - Input - Data object to copy from.       \param value - Input - Data object to copy from.
1175    */    */
1176      ESCRIPT_DLL_API
1177    void    void
1178    setItemD(const boost::python::object& key,    setItemD(const boost::python::object& key,
1179             const Data& value);             const Data& value);
1180    
1181      ESCRIPT_DLL_API
1182    void    void
1183    setItemO(const boost::python::object& key,    setItemO(const boost::python::object& key,
1184             const boost::python::object& value);             const boost::python::object& value);
# Line 1017  class Data { Line 1191  class Data {
1191       this Data object.       this Data object.
1192    */    */
1193    template <class UnaryFunction>    template <class UnaryFunction>
1194      ESCRIPT_DLL_API
1195    inline    inline
1196    void    void
1197    unaryOp(UnaryFunction operation);    unaryOp(UnaryFunction operation);
# Line 1028  class Data { Line 1203  class Data {
1203       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1204       *       *
1205    */    */
1206      ESCRIPT_DLL_API
1207    Data    Data
1208    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
1209    
# Line 1039  class Data { Line 1215  class Data {
1215       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1216       *       *
1217    */    */
1218      ESCRIPT_DLL_API
1219    void    void
1220    setSlice(const Data& value,    setSlice(const Data& value,
1221             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
# Line 1048  class Data { Line 1225  class Data {
1225       Archive the current Data object to the given file.       Archive the current Data object to the given file.
1226       \param fileName - Input - file to archive to.       \param fileName - Input - file to archive to.
1227    */    */
1228      ESCRIPT_DLL_API
1229    void    void
1230    archiveData(const std::string fileName);    archiveData(const std::string fileName);
1231    
# Line 1059  class Data { Line 1237  class Data {
1237       \param fileName - Input - file to extract from.       \param fileName - Input - file to extract from.
1238       \param fspace - Input - a suitable FunctionSpace descibing the data.       \param fspace - Input - a suitable FunctionSpace descibing the data.
1239    */    */
1240      ESCRIPT_DLL_API
1241    void    void
1242    extractData(const std::string fileName,    extractData(const std::string fileName,
1243                const FunctionSpace& fspace);                const FunctionSpace& fspace);
1244    
1245    
1246      /**
1247         \brief
1248         print the data values to stdout. Used for debugging
1249      */
1250      ESCRIPT_DLL_API
1251      void
1252        print(void);
1253    
1254      /**
1255         \brief
1256         return the MPI rank number of the local data
1257             MPI_COMM_WORLD is assumed and the result of MPI_Comm_size()
1258             is returned
1259      */
1260      ESCRIPT_DLL_API
1261        int
1262        get_MPIRank(void) const;
1263    
1264      /**
1265         \brief
1266         return the MPI rank number of the local data
1267             MPI_COMM_WORLD is assumed and the result of MPI_Comm_rank()
1268             is returned
1269      */
1270      ESCRIPT_DLL_API
1271        int
1272        get_MPISize(void) const;
1273    
1274      /**
1275         \brief
1276         return the MPI rank number of the local data
1277             MPI_COMM_WORLD is assumed and returned.
1278      */
1279      ESCRIPT_DLL_API
1280        MPI_Comm
1281        get_MPIComm(void) const;
1282        
1283   protected:   protected:
1284    
1285   private:   private:
# Line 1166  class Data { Line 1383  class Data {
1383    reshapeDataPoint(const DataArrayView::ShapeType& shape);    reshapeDataPoint(const DataArrayView::ShapeType& shape);
1384    
1385    //    //
1386      // flag to protect the data object against any update
1387      bool m_protected;
1388    
1389      //
1390    // pointer to the actual data object    // pointer to the actual data object
1391    boost::shared_ptr<DataAbstract> m_data;    boost::shared_ptr<DataAbstract> m_data;
1392    
# Line 1206  Data::initialise(const IValueType& value Line 1427  Data::initialise(const IValueType& value
1427    Operator+    Operator+
1428    Takes two Data objects.    Takes two Data objects.
1429  */  */
1430  Data operator+(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const Data& right);
1431    
1432  /**  /**
1433    \brief    \brief
1434    Operator-    Operator-
1435    Takes two Data objects.    Takes two Data objects.
1436  */  */
1437  Data operator-(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const Data& right);
1438    
1439  /**  /**
1440    \brief    \brief
1441    Operator*    Operator*
1442    Takes two Data objects.    Takes two Data objects.
1443  */  */
1444  Data operator*(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator*(const Data& left, const Data& right);
1445    
1446  /**  /**
1447    \brief    \brief
1448    Operator/    Operator/
1449    Takes two Data objects.    Takes two Data objects.
1450  */  */
1451  Data operator/(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator/(const Data& left, const Data& right);
1452    
1453  /**  /**
1454    \brief    \brief
# Line 1235  Data operator/(const Data& left, const D Line 1456  Data operator/(const Data& left, const D
1456    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1457    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1458  */  */
1459  Data operator+(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const boost::python::object& right);
1460    
1461  /**  /**
1462    \brief    \brief
# Line 1243  Data operator+(const Data& left, const b Line 1464  Data operator+(const Data& left, const b
1464    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1465    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1466  */  */
1467  Data operator-(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const boost::python::object& right);
1468    
1469  /**  /**
1470    \brief    \brief
# Line 1251  Data operator-(const Data& left, const b Line 1472  Data operator-(const Data& left, const b
1472    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1473    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1474  */  */
1475  Data operator*(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator*(const Data& left, const boost::python::object& right);
1476    
1477  /**  /**
1478    \brief    \brief
# Line 1259  Data operator*(const Data& left, const b Line 1480  Data operator*(const Data& left, const b
1480    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1481    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1482  */  */
1483  Data operator/(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator/(const Data& left, const boost::python::object& right);
1484    
1485  /**  /**
1486    \brief    \brief
# Line 1267  Data operator/(const Data& left, const b Line 1488  Data operator/(const Data& left, const b
1488    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1489    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1490  */  */
1491  Data operator+(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const boost::python::object& left, const Data& right);
1492    
1493  /**  /**
1494    \brief    \brief
# Line 1275  Data operator+(const boost::python::obje Line 1496  Data operator+(const boost::python::obje
1496    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1497    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1498  */  */
1499  Data operator-(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const boost::python::object& left, const Data& right);
1500    
1501  /**  /**
1502    \brief    \brief
# Line 1283  Data operator-(const boost::python::obje Line 1504  Data operator-(const boost::python::obje
1504    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1505    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1506  */  */
1507  Data operator*(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator*(const boost::python::object& left, const Data& right);
1508    
1509  /**  /**
1510    \brief    \brief
# Line 1291  Data operator*(const boost::python::obje Line 1512  Data operator*(const boost::python::obje
1512    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1513    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1514  */  */
1515  Data operator/(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator/(const boost::python::object& left, const Data& right);
1516    
1517  /**  /**
1518    \brief    \brief
1519    Output operator    Output operator
1520  */  */
1521  std::ostream& operator<<(std::ostream& o, const Data& data);  ESCRIPT_DLL_API std::ostream& operator<<(std::ostream& o, const Data& data);
1522    
1523  /**  /**
1524    \brief    \brief
# Line 1305  std::ostream& operator<<(std::ostream& o Line 1526  std::ostream& operator<<(std::ostream& o
1526    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
1527    be relied on. Requires further implementation.    be relied on. Requires further implementation.
1528  */  */
1529  //bool operator==(const Data& left, const Data& right);  //ESCRIPT_DLL_API bool operator==(const Data& left, const Data& right);
1530    
1531  /**  /**
1532    \brief    \brief

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

  ViewVC Help
Powered by ViewVC 1.1.26