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

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

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

revision 474 by jgs, Mon Jan 30 04:23:44 2006 UTC revision 783 by gross, Tue Jul 18 01:32:50 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"
 #include "DataTagged.h"  
21  #include "DataAlgorithm.h"  #include "DataAlgorithm.h"
22  #include "FunctionSpace.h"  #include "FunctionSpace.h"
23  #include "BinaryOp.h"  #include "BinaryOp.h"
# Line 28  Line 26 
26    
27  extern "C" {  extern "C" {
28  #include "DataC.h"  #include "DataC.h"
29    #include "paso/Paso.h"
30  }  }
31    
 #include <iostream>  
32  #include <string>  #include <string>
 #include <memory>  
33  #include <algorithm>  #include <algorithm>
34    
35  #include <boost/shared_ptr.hpp>  #include <boost/shared_ptr.hpp>
36  #include <boost/python/object.hpp>  #include <boost/python/object.hpp>
 #include <boost/python/list.hpp>  
37  #include <boost/python/tuple.hpp>  #include <boost/python/tuple.hpp>
38  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
39    
# Line 45  namespace escript { Line 41  namespace escript {
41    
42  //  //
43  // Forward declaration for various implementations of Data.  // Forward declaration for various implementations of Data.
 class DataEmpty;  
44  class DataConstant;  class DataConstant;
45  class DataTagged;  class DataTagged;
46  class DataExpanded;  class DataExpanded;
# Line 80  class Data { Line 75  class Data {
75       Default constructor.       Default constructor.
76       Creates a DataEmpty object.       Creates a DataEmpty object.
77    */    */
78      ESCRIPT_DLL_API
79    Data();    Data();
80    
81    /**    /**
# Line 87  class Data { Line 83  class Data {
83       Copy constructor.       Copy constructor.
84       WARNING: Only performs a shallow copy.       WARNING: Only performs a shallow copy.
85    */    */
86      ESCRIPT_DLL_API
87    Data(const Data& inData);    Data(const Data& inData);
88    
89    /**    /**
# Line 95  class Data { Line 92  class Data {
92       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,
93       otherwise a shallow copy of inData is returned.       otherwise a shallow copy of inData is returned.
94    */    */
95      ESCRIPT_DLL_API
96    Data(const Data& inData,    Data(const Data& inData,
97         const FunctionSpace& what);         const FunctionSpace& what);
98    
# Line 108  class Data { Line 106  class Data {
106                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
107                         mechanism will be used.                         mechanism will be used.
108    */    */
109      ESCRIPT_DLL_API
110    Data(const DataArrayView& value,    Data(const DataArrayView& value,
111         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
112         bool expanded=false);         bool expanded=false);
# Line 123  class Data { Line 122  class Data {
122                         the given value. Otherwise a more efficient storage                         the given value. Otherwise a more efficient storage
123                         mechanism will be used.                         mechanism will be used.
124    */    */
125      ESCRIPT_DLL_API
126    Data(double value,    Data(double value,
127         const DataArrayView::ShapeType& dataPointShape=DataArrayView::ShapeType(),         const DataArrayView::ShapeType& dataPointShape=DataArrayView::ShapeType(),
128         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
# Line 135  class Data { Line 135  class Data {
135       \param inData - Input - Input Data object.       \param inData - Input - Input Data object.
136       \param region - Input - Region to copy.       \param region - Input - Region to copy.
137    */    */
138      ESCRIPT_DLL_API
139    Data(const Data& inData,    Data(const Data& inData,
140         const DataArrayView::RegionType& region);         const DataArrayView::RegionType& region);
141    
# Line 150  class Data { Line 151  class Data {
151       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
152       \param expanded - Input - Flag, if true fill the entire container with       \param expanded - Input - Flag, if true fill the entire container with
153                         the appropriate values.                         the appropriate values.
154        ==>*
155    */    */
156      ESCRIPT_DLL_API
157    Data(const DataTagged::TagListType& tagKeys,    Data(const DataTagged::TagListType& tagKeys,
158         const DataTagged::ValueListType& values,         const DataTagged::ValueListType& values,
159         const DataArrayView& defaultValue,         const DataArrayView& defaultValue,
# Line 167  class Data { Line 170  class Data {
170                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
171                         mechanism will be used.                         mechanism will be used.
172    */    */
173      ESCRIPT_DLL_API
174    Data(const boost::python::numeric::array& value,    Data(const boost::python::numeric::array& value,
175         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
176         bool expanded=false);         bool expanded=false);
# Line 182  class Data { Line 186  class Data {
186                         the value. Otherwise a more efficient storage                         the value. Otherwise a more efficient storage
187                         mechanism will be used.                         mechanism will be used.
188    */    */
189      ESCRIPT_DLL_API
190    Data(const boost::python::object& value,    Data(const boost::python::object& value,
191         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
192         bool expanded=false);         bool expanded=false);
# Line 195  class Data { Line 200  class Data {
200       \param value - Input - Input data.       \param value - Input - Input data.
201       \param other - Input - contains all other parameters.       \param other - Input - contains all other parameters.
202    */    */
203      ESCRIPT_DLL_API
204    Data(const boost::python::object& value,    Data(const boost::python::object& value,
205         const Data& other);         const Data& other);
206    
# Line 202  class Data { Line 208  class Data {
208       \brief       \brief
209       Constructor which creates a DataConstant of "shape" with constant value.       Constructor which creates a DataConstant of "shape" with constant value.
210    */    */
211      ESCRIPT_DLL_API
212    Data(double value,    Data(double value,
213         const boost::python::tuple& shape=boost::python::make_tuple(),         const boost::python::tuple& shape=boost::python::make_tuple(),
214         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
# Line 210  class Data { Line 217  class Data {
217       \brief       \brief
218       Destructor       Destructor
219    */    */
220      ESCRIPT_DLL_API
221    ~Data();    ~Data();
222    
223    /**    /**
224       \brief       \brief
225       Perform a deep copy.       Perform a deep copy.
226    */    */
227      ESCRIPT_DLL_API
228    void    void
229    copy(const Data& other);    copy(const Data& other);
230    
# Line 225  class Data { Line 234  class Data {
234    
235    /**    /**
236       \brief       \brief
237         switches on update protection
238    
239      */
240      ESCRIPT_DLL_API
241      void
242      setProtection();
243    
244      /**
245         \brief
246         Returns trueif the data object is protected against update
247    
248      */
249      ESCRIPT_DLL_API
250      bool
251      isProtected() const;
252      /**
253         \brief
254       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.
255    */    */
256      ESCRIPT_DLL_API
257    const boost::python::numeric::array    const boost::python::numeric::array
258    convertToNumArray();    convertToNumArray();
259    
# Line 234  class Data { Line 261  class Data {
261       \brief       \brief
262       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.
263    */    */
264      ESCRIPT_DLL_API
265    const boost::python::numeric::array    const boost::python::numeric::array
266    convertToNumArrayFromSampleNo(int sampleNo);    convertToNumArrayFromSampleNo(int sampleNo);
267    
# Line 241  class Data { Line 269  class Data {
269       \brief       \brief
270       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.
271    */    */
272      ESCRIPT_DLL_API
273    const boost::python::numeric::array    const boost::python::numeric::array
274    convertToNumArrayFromDPNo(int sampleNo,    convertToNumArrayFromDPNo(int sampleNo,
275                              int dataPointNo);                              int dataPointNo);
# Line 249  class Data { Line 278  class Data {
278       \brief       \brief
279       Fills the expanded Data object from values of a python numarray object.       Fills the expanded Data object from values of a python numarray object.
280    */    */
281      ESCRIPT_DLL_API
282    void    void
283    fillFromNumArray(const boost::python::numeric::array);    fillFromNumArray(const boost::python::numeric::array);
284    
# Line 259  class Data { Line 289  class Data {
289       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
290       numarray returned by convertToNumArray.       numarray returned by convertToNumArray.
291    */    */
292      ESCRIPT_DLL_API
293    int    int
294    getTagNumber(int dpno);    getTagNumber(int dpno);
295    
# Line 266  class Data { Line 297  class Data {
297       \brief       \brief
298       Return the C wrapper for the Data object.       Return the C wrapper for the Data object.
299    */    */
300      ESCRIPT_DLL_API
301    escriptDataC    escriptDataC
302    getDataC();    getDataC();
303    
# Line 273  class Data { Line 305  class Data {
305       \brief       \brief
306       Return the C wrapper for the Data object - const version.       Return the C wrapper for the Data object - const version.
307    */    */
308      ESCRIPT_DLL_API
309    escriptDataC    escriptDataC
310    getDataC() const;    getDataC() const;
311    
# Line 280  class Data { Line 313  class Data {
313       \brief       \brief
314       Write the data as a string.       Write the data as a string.
315    */    */
316      ESCRIPT_DLL_API
317    inline    inline
318    std::string    std::string
319    toString() const    toString() const
# Line 293  class Data { Line 327  class Data {
327       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
328       to manipulate the point data.       to manipulate the point data.
329    */    */
330      ESCRIPT_DLL_API
331    inline    inline
332    const DataArrayView&    const DataArrayView&
333    getPointDataView() const    getPointDataView() const
# Line 304  class Data { Line 339  class Data {
339       \brief       \brief
340       Whatever the current Data type make this into a DataExpanded.       Whatever the current Data type make this into a DataExpanded.
341    */    */
342      ESCRIPT_DLL_API
343    void    void
344    expand();    expand();
345    
# Line 312  class Data { Line 348  class Data {
348       If possible convert this Data to DataTagged. This will only allow       If possible convert this Data to DataTagged. This will only allow
349       Constant data to be converted to tagged. An attempt to convert       Constant data to be converted to tagged. An attempt to convert
350       Expanded data to tagged will throw an exception.       Expanded data to tagged will throw an exception.
351        ==>*
352    */    */
353      ESCRIPT_DLL_API
354    void    void
355    tag();    tag();
356    
# Line 320  class Data { Line 358  class Data {
358       \brief       \brief
359       Return true if this Data is expanded.       Return true if this Data is expanded.
360    */    */
361      ESCRIPT_DLL_API
362    bool    bool
363    isExpanded() const;    isExpanded() const;
364    
# Line 327  class Data { Line 366  class Data {
366       \brief       \brief
367       Return true if this Data is tagged.       Return true if this Data is tagged.
368    */    */
369      ESCRIPT_DLL_API
370    bool    bool
371    isTagged() const;    isTagged() const;
372    
# Line 334  class Data { Line 374  class Data {
374       \brief       \brief
375       Return true if this Data is constant.       Return true if this Data is constant.
376    */    */
377      ESCRIPT_DLL_API
378    bool    bool
379    isConstant() const;    isConstant() const;
380    
# Line 341  class Data { Line 382  class Data {
382       \brief       \brief
383       Return true if this Data is empty.       Return true if this Data is empty.
384    */    */
385      ESCRIPT_DLL_API
386    bool    bool
387    isEmpty() const;    isEmpty() const;
388    
# Line 348  class Data { Line 390  class Data {
390       \brief       \brief
391       Return the function space.       Return the function space.
392    */    */
393      ESCRIPT_DLL_API
394    inline    inline
395    const FunctionSpace&    const FunctionSpace&
396    getFunctionSpace() const    getFunctionSpace() const
# Line 359  class Data { Line 402  class Data {
402       \brief       \brief
403       Return a copy of the function space.       Return a copy of the function space.
404    */    */
405      ESCRIPT_DLL_API
406    const FunctionSpace    const FunctionSpace
407    getCopyOfFunctionSpace() const;    getCopyOfFunctionSpace() const;
408    
# Line 366  class Data { Line 410  class Data {
410       \brief       \brief
411       Return the domain.       Return the domain.
412    */    */
413      ESCRIPT_DLL_API
414    inline    inline
415    const AbstractDomain&    const AbstractDomain&
416    getDomain() const    getDomain() const
# Line 377  class Data { Line 422  class Data {
422       \brief       \brief
423       Return a copy of the domain.       Return a copy of the domain.
424    */    */
425      ESCRIPT_DLL_API
426    const AbstractDomain    const AbstractDomain
427    getCopyOfDomain() const;    getCopyOfDomain() const;
428    
# Line 384  class Data { Line 430  class Data {
430       \brief       \brief
431       Return the rank of the point data.       Return the rank of the point data.
432    */    */
433      ESCRIPT_DLL_API
434    inline    inline
435    int    int
436    getDataPointRank() const    getDataPointRank() const
# Line 395  class Data { Line 442  class Data {
442       \brief       \brief
443       Return the number of samples.       Return the number of samples.
444    */    */
445      ESCRIPT_DLL_API
446    inline    inline
447    int    int
448    getNumSamples() const    getNumSamples() const
# Line 406  class Data { Line 454  class Data {
454       \brief       \brief
455       Return the number of data points per sample.       Return the number of data points per sample.
456    */    */
457      ESCRIPT_DLL_API
458    inline    inline
459    int    int
460    getNumDataPointsPerSample() const    getNumDataPointsPerSample() const
# Line 419  class Data { Line 468  class Data {
468       preferred interface but is provided for use by C code.       preferred interface but is provided for use by C code.
469       \param sampleNo - Input - the given sample no.       \param sampleNo - Input - the given sample no.
470    */    */
471      ESCRIPT_DLL_API
472    inline    inline
473    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
474    getSampleData(DataAbstract::ValueType::size_type sampleNo)    getSampleData(DataAbstract::ValueType::size_type sampleNo)
# Line 432  class Data { Line 482  class Data {
482       access data that isn't tagged an exception will be thrown.       access data that isn't tagged an exception will be thrown.
483       \param tag - Input - the tag key.       \param tag - Input - the tag key.
484    */    */
485      ESCRIPT_DLL_API
486    inline    inline
487    DataAbstract::ValueType::value_type*    DataAbstract::ValueType::value_type*
488    getSampleDataByTag(int tag)    getSampleDataByTag(int tag)
# Line 455  class Data { Line 506  class Data {
506       \param value - Input - value to assign to data-points associated with       \param value - Input - value to assign to data-points associated with
507                              the given reference number.                              the given reference number.
508    */    */
509      ESCRIPT_DLL_API
510    void    void
511    setRefValue(int ref,    setRefValue(int ref,
512                const boost::python::numeric::array& value);                const boost::python::numeric::array& value);
# Line 474  class Data { Line 526  class Data {
526       \param value - Output - object to receive values from data-points       \param value - Output - object to receive values from data-points
527                               associated with the given reference number.                               associated with the given reference number.
528    */    */
529      ESCRIPT_DLL_API
530    void    void
531    getRefValue(int ref,    getRefValue(int ref,
532                boost::python::numeric::array& value);                boost::python::numeric::array& value);
# Line 486  class Data { Line 539  class Data {
539       \param sampleNo - Input -       \param sampleNo - Input -
540       \param dataPointNo - Input -       \param dataPointNo - Input -
541    */    */
542      ESCRIPT_DLL_API
543    inline    inline
544    DataArrayView    DataArrayView
545    getDataPoint(int sampleNo,    getDataPoint(int sampleNo,
# Line 498  class Data { Line 552  class Data {
552       \brief       \brief
553       Return a reference to the data point shape.       Return a reference to the data point shape.
554    */    */
555      ESCRIPT_DLL_API
556    const DataArrayView::ShapeType&    const DataArrayView::ShapeType&
557    getDataPointShape() const;    getDataPointShape() const;
558    
# Line 505  class Data { Line 560  class Data {
560       \brief       \brief
561       Return the data point shape as a tuple of integers.       Return the data point shape as a tuple of integers.
562    */    */
563      ESCRIPT_DLL_API
564    const boost::python::tuple    const boost::python::tuple
565    getShapeTuple() const;    getShapeTuple() const;
566    
# Line 513  class Data { Line 569  class Data {
569       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
570       data point shape dimensions.       data point shape dimensions.
571    */    */
572      ESCRIPT_DLL_API
573    int    int
574    getDataPointSize() const;    getDataPointSize() const;
575    
# Line 520  class Data { Line 577  class Data {
577       \brief       \brief
578       Return the number of doubles stored for this Data.       Return the number of doubles stored for this Data.
579    */    */
580      ESCRIPT_DLL_API
581    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
582    getLength() const;    getLength() const;
583    
# Line 530  class Data { Line 588  class Data {
588       cannot be converted to a DataTagged object.       cannot be converted to a DataTagged object.
589       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
590       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
591        ==>*
592    */    */
593      ESCRIPT_DLL_API
594    void    void
595    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
596                   const boost::python::object& value);                   const boost::python::object& value);
# Line 542  class Data { Line 602  class Data {
602       cannot be converted to a DataTagged object.       cannot be converted to a DataTagged object.
603       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
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    setTaggedValueFromCPP(int tagKey,    setTaggedValueFromCPP(int tagKey,
610                          const DataArrayView& value);                          const DataArrayView& value);
# Line 551  class Data { Line 613  class Data {
613      \brief      \brief
614      Copy other Data object into this Data object where mask is positive.      Copy other Data object into this Data object where mask is positive.
615    */    */
616      ESCRIPT_DLL_API
617    void    void
618    copyWithMask(const Data& other,    copyWithMask(const Data& other,
619                 const Data& mask);                 const Data& mask);
# Line 565  class Data { Line 628  class Data {
628       the result as a Data object.       the result as a Data object.
629       *       *
630    */    */
631      ESCRIPT_DLL_API
632    Data    Data
633    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
634    
# Line 574  class Data { Line 638  class Data {
638       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.
639       *       *
640    */    */
641      ESCRIPT_DLL_API
642    Data    Data
643    gradOn(const FunctionSpace& functionspace) const;    gradOn(const FunctionSpace& functionspace) const;
644    
645      ESCRIPT_DLL_API
646    Data    Data
647    grad() const;    grad() const;
648    
# Line 585  class Data { Line 651  class Data {
651       Calculate the integral over the function space domain.       Calculate the integral over the function space domain.
652       *       *
653    */    */
654      ESCRIPT_DLL_API
655    boost::python::numeric::array    boost::python::numeric::array
656    integrate() const;    integrate() const;
657    
# Line 593  class Data { Line 660  class Data {
660       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.
661       *       *
662    */    */
663      ESCRIPT_DLL_API
664    Data    Data
665    wherePositive() const;    wherePositive() const;
666    
# Line 601  class Data { Line 669  class Data {
669       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.
670       *       *
671    */    */
672      ESCRIPT_DLL_API
673    Data    Data
674    whereNegative() const;    whereNegative() const;
675    
# Line 609  class Data { Line 678  class Data {
678       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.
679       *       *
680    */    */
681      ESCRIPT_DLL_API
682    Data    Data
683    whereNonNegative() const;    whereNonNegative() const;
684    
# Line 617  class Data { Line 687  class Data {
687       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.
688       *       *
689    */    */
690      ESCRIPT_DLL_API
691    Data    Data
692    whereNonPositive() const;    whereNonPositive() const;
693    
# Line 625  class Data { Line 696  class Data {
696       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.
697       *       *
698    */    */
699      ESCRIPT_DLL_API
700    Data    Data
701    whereZero() const;    whereZero(double tol=0.0) const;
702    
703    /**    /**
704       \brief       \brief
705       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.
706       *       *
707    */    */
708      ESCRIPT_DLL_API
709    Data    Data
710    whereNonZero() const;    whereNonZero(double tol=0.0) const;
711    
712    /**    /**
713       \brief       \brief
714       Return the maximum absolute value of this Data object.       Return the maximum absolute value of this Data object.
715       *       *
716    */    */
717      ESCRIPT_DLL_API
718    double    double
719    Lsup() const;    Lsup() const;
720    
# Line 649  class Data { Line 723  class Data {
723       Return the minimum absolute value of this Data object.       Return the minimum absolute value of this Data object.
724       *       *
725    */    */
726      ESCRIPT_DLL_API
727    double    double
728    Linf() const;    Linf() const;
729    
# Line 657  class Data { Line 732  class Data {
732       Return the maximum value of this Data object.       Return the maximum value of this Data object.
733       *       *
734    */    */
735      ESCRIPT_DLL_API
736    double    double
737    sup() const;    sup() const;
738    
# Line 665  class Data { Line 741  class Data {
741       Return the minimum value of this Data object.       Return the minimum value of this Data object.
742       *       *
743    */    */
744      ESCRIPT_DLL_API
745    double    double
746    inf() const;    inf() const;
747    
# Line 673  class Data { Line 750  class Data {
750       Return the absolute value of each data point of this Data object.       Return the absolute value of each data point of this Data object.
751       *       *
752    */    */
753      ESCRIPT_DLL_API
754    Data    Data
755    abs() const;    abs() const;
756    
# Line 681  class Data { Line 759  class Data {
759       Return the maximum value of each data point of this Data object.       Return the maximum value of each data point of this Data object.
760       *       *
761    */    */
762      ESCRIPT_DLL_API
763    Data    Data
764    maxval() const;    maxval() const;
765    
# Line 689  class Data { Line 768  class Data {
768       Return the minimum value of each data point of this Data object.       Return the minimum value of each data point of this Data object.
769       *       *
770    */    */
771      ESCRIPT_DLL_API
772    Data    Data
773    minval() const;    minval() const;
774    
# Line 697  class Data { Line 777  class Data {
777       Return the (sample number, data-point number) of the data point with       Return the (sample number, data-point number) of the data point with
778       the minimum value in this Data object.       the minimum value in this Data object.
779    */    */
780      ESCRIPT_DLL_API
781    const boost::python::tuple    const boost::python::tuple
782    mindp() const;    mindp() const;
783    
784      ESCRIPT_DLL_API
785    void    void
786    #ifndef PASO_MPI
787    calc_mindp(int& SampleNo,    calc_mindp(int& SampleNo,
788               int& DataPointNo) const;               int& DataPointNo) const;
789    #else
790      calc_mindp(int& ProcNo,
791                            int& SampleNo,  
792                 int& DataPointNo) const;
793    #endif
794    /**    /**
795       \brief       \brief
796       Return the sign of each data point of this Data object.       Return the sign of each data point of this Data object.
797       -1 for negative values, zero for zero values, 1 for positive values.       -1 for negative values, zero for zero values, 1 for positive values.
798       *       *
799    */    */
800      ESCRIPT_DLL_API
801    Data    Data
802    sign() const;    sign() const;
803    
804    /**    /**
805       \brief       \brief
806         Return the symmetric part of a matrix which is half the matrix plus its transpose.
807         *
808      */
809      ESCRIPT_DLL_API
810      Data
811      symmetric() const;
812    
813      /**
814         \brief
815         Return the nonsymmetric part of a matrix which is half the matrix minus its transpose.
816         *
817      */
818      ESCRIPT_DLL_API
819      Data
820      nonsymmetric() const;
821    
822      /**
823         \brief
824         Return the trace of a matrix
825         *
826      */
827      ESCRIPT_DLL_API
828      Data
829      matrixtrace(int axis_offset) const;
830    
831      /**
832         \brief
833       Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
      --* not implemented yet *--  
834       *       *
835    */    */
836      ESCRIPT_DLL_API
837    Data    Data
838    transpose(int axis) const;    transpose(int axis_offset) const;
839    
840      /**
841         \brief
842         Return the eigenvalues of the symmetric part at each data point of this Data object in increasing values.
843         Currently this function is restricted to rank 2, square shape, and dimension 3.
844         *
845      */
846      ESCRIPT_DLL_API
847      Data
848      eigenvalues() const;
849    
850      /**
851         \brief
852         Return the eigenvalues and corresponding eigenvcetors of the symmetric part at each data point of this Data object.
853         the eigenvalues are ordered in increasing size where eigenvalues with relative difference less than
854         tol are treated as equal. The eigenvectors are orthogonal, normalized and the sclaed such that the
855         first non-zero entry is positive.
856         Currently this function is restricted to rank 2, square shape, and dimension 3
857         *
858      */
859      ESCRIPT_DLL_API
860      const boost::python::tuple
861      eigenvalues_and_eigenvectors(const double tol=1.e-12) const;
862    
863    /**    /**
864       \brief       \brief
865       Calculate the trace of each data point of this Data object.       Calculate the trace of each data point of this Data object.
      sum(A[i,i,i,i])  
866       *       *
867    */    */
868      ESCRIPT_DLL_API
869    Data    Data
870    trace() const;    trace() const;
871    
# Line 736  class Data { Line 874  class Data {
874       Return the sin of each data point of this Data object.       Return the sin of each data point of this Data object.
875       *       *
876    */    */
877      ESCRIPT_DLL_API
878    Data    Data
879    sin() const;    sin() const;
880    
# Line 744  class Data { Line 883  class Data {
883       Return the cos of each data point of this Data object.       Return the cos of each data point of this Data object.
884       *       *
885    */    */
886      ESCRIPT_DLL_API
887    Data    Data
888    cos() const;    cos() const;
889    
# Line 752  class Data { Line 892  class Data {
892       Return the tan of each data point of this Data object.       Return the tan of each data point of this Data object.
893       *       *
894    */    */
895      ESCRIPT_DLL_API
896    Data    Data
897    tan() const;    tan() const;
898    
# Line 760  class Data { Line 901  class Data {
901       Return the asin of each data point of this Data object.       Return the asin of each data point of this Data object.
902       *       *
903    */    */
904      ESCRIPT_DLL_API
905    Data    Data
906    asin() const;    asin() const;
907    
# Line 768  class Data { Line 910  class Data {
910       Return the acos of each data point of this Data object.       Return the acos of each data point of this Data object.
911       *       *
912    */    */
913      ESCRIPT_DLL_API
914    Data    Data
915    acos() const;    acos() const;
916    
# Line 776  class Data { Line 919  class Data {
919       Return the atan of each data point of this Data object.       Return the atan of each data point of this Data object.
920       *       *
921    */    */
922      ESCRIPT_DLL_API
923    Data    Data
924    atan() const;    atan() const;
925    
# Line 784  class Data { Line 928  class Data {
928       Return the sinh of each data point of this Data object.       Return the sinh of each data point of this Data object.
929       *       *
930    */    */
931      ESCRIPT_DLL_API
932    Data    Data
933    sinh() const;    sinh() const;
934    
# Line 792  class Data { Line 937  class Data {
937       Return the cosh of each data point of this Data object.       Return the cosh of each data point of this Data object.
938       *       *
939    */    */
940      ESCRIPT_DLL_API
941    Data    Data
942    cosh() const;    cosh() const;
943    
# Line 800  class Data { Line 946  class Data {
946       Return the tanh of each data point of this Data object.       Return the tanh of each data point of this Data object.
947       *       *
948    */    */
949      ESCRIPT_DLL_API
950    Data    Data
951    tanh() const;    tanh() const;
952    
# Line 808  class Data { Line 955  class Data {
955       Return the asinh of each data point of this Data object.       Return the asinh of each data point of this Data object.
956       *       *
957    */    */
958      ESCRIPT_DLL_API
959    Data    Data
960    asinh() const;    asinh() const;
961    
# Line 816  class Data { Line 964  class Data {
964       Return the acosh of each data point of this Data object.       Return the acosh of each data point of this Data object.
965       *       *
966    */    */
967      ESCRIPT_DLL_API
968    Data    Data
969    acosh() const;    acosh() const;
970    
# Line 824  class Data { Line 973  class Data {
973       Return the atanh of each data point of this Data object.       Return the atanh of each data point of this Data object.
974       *       *
975    */    */
976      ESCRIPT_DLL_API
977    Data    Data
978    atanh() const;    atanh() const;
979    
# Line 832  class Data { Line 982  class Data {
982       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.
983       *       *
984    */    */
985      ESCRIPT_DLL_API
986    Data    Data
987    log10() const;    log10() const;
988    
# Line 840  class Data { Line 991  class Data {
991       Return the natural log of each data point of this Data object.       Return the natural log of each data point of this Data object.
992       *       *
993    */    */
994      ESCRIPT_DLL_API
995    Data    Data
996    log() const;    log() const;
997    
# Line 848  class Data { Line 1000  class Data {
1000       Return the exponential function of each data point of this Data object.       Return the exponential function of each data point of this Data object.
1001       *       *
1002    */    */
1003      ESCRIPT_DLL_API
1004    Data    Data
1005    exp() const;    exp() const;
1006    
# Line 856  class Data { Line 1009  class Data {
1009       Return the square root of each data point of this Data object.       Return the square root of each data point of this Data object.
1010       *       *
1011    */    */
1012      ESCRIPT_DLL_API
1013    Data    Data
1014    sqrt() const;    sqrt() const;
1015    
# Line 864  class Data { Line 1018  class Data {
1018       Return the negation of each data point of this Data object.       Return the negation of each data point of this Data object.
1019       *       *
1020    */    */
1021      ESCRIPT_DLL_API
1022    Data    Data
1023    neg() const;    neg() const;
1024    
# Line 873  class Data { Line 1028  class Data {
1028       Simply returns this object unmodified.       Simply returns this object unmodified.
1029       *       *
1030    */    */
1031      ESCRIPT_DLL_API
1032    Data    Data
1033    pos() const;    pos() const;
1034    
# Line 883  class Data { Line 1039  class Data {
1039       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1040       *       *
1041    */    */
1042      ESCRIPT_DLL_API
1043    Data    Data
1044    powD(const Data& right) const;    powD(const Data& right) const;
1045    
# Line 893  class Data { Line 1050  class Data {
1050       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
1051       *       *
1052     */     */
1053      ESCRIPT_DLL_API
1054    Data    Data
1055    powO(const boost::python::object& right) const;    powO(const boost::python::object& right) const;
1056    
1057    /**    /**
1058       \brief       \brief
1059         Return the given power of each data point of this boost python object.
1060        
1061         \param left Input - the bases
1062         *
1063       */
1064    
1065      ESCRIPT_DLL_API
1066      Data
1067      rpowO(const boost::python::object& left) const;
1068    
1069      /**
1070         \brief
1071       writes the object to a file in the DX file format       writes the object to a file in the DX file format
1072    */    */
1073      ESCRIPT_DLL_API
1074    void    void
1075    saveDX(std::string fileName) const;    saveDX(std::string fileName) const;
1076    
# Line 907  class Data { Line 1078  class Data {
1078       \brief       \brief
1079       writes the object to a file in the VTK file format       writes the object to a file in the VTK file format
1080    */    */
1081      ESCRIPT_DLL_API
1082    void    void
1083    saveVTK(std::string fileName) const;    saveVTK(std::string fileName) const;
1084    
# Line 916  class Data { Line 1088  class Data {
1088       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1089       *       *
1090    */    */
1091      ESCRIPT_DLL_API
1092    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
1093      ESCRIPT_DLL_API
1094    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
1095    
1096    /**    /**
# Line 925  class Data { Line 1099  class Data {
1099       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1100       *       *
1101    */    */
1102      ESCRIPT_DLL_API
1103    Data& operator-=(const Data& right);    Data& operator-=(const Data& right);
1104      ESCRIPT_DLL_API
1105    Data& operator-=(const boost::python::object& right);    Data& operator-=(const boost::python::object& right);
1106    
1107   /**   /**
# Line 934  class Data { Line 1110  class Data {
1110       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1111       *       *
1112    */    */
1113      ESCRIPT_DLL_API
1114    Data& operator*=(const Data& right);    Data& operator*=(const Data& right);
1115      ESCRIPT_DLL_API
1116    Data& operator*=(const boost::python::object& right);    Data& operator*=(const boost::python::object& right);
1117    
1118   /**   /**
# Line 943  class Data { Line 1121  class Data {
1121       \param right - Input - The right hand side.       \param right - Input - The right hand side.
1122       *       *
1123    */    */
1124      ESCRIPT_DLL_API
1125    Data& operator/=(const Data& right);    Data& operator/=(const Data& right);
1126      ESCRIPT_DLL_API
1127    Data& operator/=(const boost::python::object& right);    Data& operator/=(const boost::python::object& right);
1128    
1129    /**    /**
1130       \brief       \brief
1131       Returns true if this can be interpolated to functionspace.       Returns true if this can be interpolated to functionspace.
1132    */    */
1133      ESCRIPT_DLL_API
1134    bool    bool
1135    probeInterpolation(const FunctionSpace& functionspace) const;    probeInterpolation(const FunctionSpace& functionspace) const;
1136    
# Line 968  class Data { Line 1149  class Data {
1149       \param key - Input - python slice tuple specifying       \param key - Input - python slice tuple specifying
1150       slice to return.       slice to return.
1151    */    */
1152      ESCRIPT_DLL_API
1153    Data    Data
1154    getItem(const boost::python::object& key) const;    getItem(const boost::python::object& key) const;
1155    
# Line 982  class Data { Line 1164  class Data {
1164       slice to copy from value.       slice to copy from value.
1165       \param value - Input - Data object to copy from.       \param value - Input - Data object to copy from.
1166    */    */
1167      ESCRIPT_DLL_API
1168    void    void
1169    setItemD(const boost::python::object& key,    setItemD(const boost::python::object& key,
1170             const Data& value);             const Data& value);
1171    
1172      ESCRIPT_DLL_API
1173    void    void
1174    setItemO(const boost::python::object& key,    setItemO(const boost::python::object& key,
1175             const boost::python::object& value);             const boost::python::object& value);
# Line 998  class Data { Line 1182  class Data {
1182       this Data object.       this Data object.
1183    */    */
1184    template <class UnaryFunction>    template <class UnaryFunction>
1185      ESCRIPT_DLL_API
1186    inline    inline
1187    void    void
1188    unaryOp(UnaryFunction operation);    unaryOp(UnaryFunction operation);
# Line 1009  class Data { Line 1194  class Data {
1194       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1195       *       *
1196    */    */
1197      ESCRIPT_DLL_API
1198    Data    Data
1199    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
1200    
# Line 1020  class Data { Line 1206  class Data {
1206       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1207       *       *
1208    */    */
1209      ESCRIPT_DLL_API
1210    void    void
1211    setSlice(const Data& value,    setSlice(const Data& value,
1212             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
# Line 1029  class Data { Line 1216  class Data {
1216       Archive the current Data object to the given file.       Archive the current Data object to the given file.
1217       \param fileName - Input - file to archive to.       \param fileName - Input - file to archive to.
1218    */    */
1219      ESCRIPT_DLL_API
1220    void    void
1221    archiveData(const std::string fileName);    archiveData(const std::string fileName);
1222    
# Line 1040  class Data { Line 1228  class Data {
1228       \param fileName - Input - file to extract from.       \param fileName - Input - file to extract from.
1229       \param fspace - Input - a suitable FunctionSpace descibing the data.       \param fspace - Input - a suitable FunctionSpace descibing the data.
1230    */    */
1231      ESCRIPT_DLL_API
1232    void    void
1233    extractData(const std::string fileName,    extractData(const std::string fileName,
1234                const FunctionSpace& fspace);                const FunctionSpace& fspace);
1235    
1236    
1237    #ifdef PASO_MPI
1238      /**
1239         \brief
1240         print the data values to stdout. Used for debugging
1241      */
1242      ESCRIPT_DLL_API
1243      void
1244        print(void);
1245    
1246      /**
1247         \brief
1248         return the MPI rank number of the local data
1249             MPI_COMM_WORLD is assumed and the result of MPI_Comm_size()
1250             is returned
1251      */
1252      ESCRIPT_DLL_API
1253        int
1254        get_MPIRank(void) const;
1255    
1256      /**
1257         \brief
1258         return the MPI rank number of the local data
1259             MPI_COMM_WORLD is assumed and the result of MPI_Comm_rank()
1260             is returned
1261      */
1262      ESCRIPT_DLL_API
1263        int
1264        get_MPISize(void) const;
1265    
1266      /**
1267         \brief
1268         return the MPI rank number of the local data
1269             MPI_COMM_WORLD is assumed and returned.
1270      */
1271      ESCRIPT_DLL_API
1272        MPI_Comm
1273        get_MPIComm(void) const;
1274    #endif
1275        
1276   protected:   protected:
1277    
1278   private:   private:
# Line 1147  class Data { Line 1376  class Data {
1376    reshapeDataPoint(const DataArrayView::ShapeType& shape);    reshapeDataPoint(const DataArrayView::ShapeType& shape);
1377    
1378    //    //
1379      // flag to protect the data object against any update
1380      bool m_protected;
1381    
1382      //
1383    // pointer to the actual data object    // pointer to the actual data object
1384    boost::shared_ptr<DataAbstract> m_data;    boost::shared_ptr<DataAbstract> m_data;
1385    
# Line 1187  Data::initialise(const IValueType& value Line 1420  Data::initialise(const IValueType& value
1420    Operator+    Operator+
1421    Takes two Data objects.    Takes two Data objects.
1422  */  */
1423  Data operator+(const Data& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const Data& right);
1424    
1425  /**  /**
1426    \brief    \brief
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
# Line 1216  Data operator/(const Data& left, const D Line 1449  Data operator/(const Data& left, const D
1449    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1450    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1451  */  */
1452  Data operator+(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator+(const Data& left, const boost::python::object& right);
1453    
1454  /**  /**
1455    \brief    \brief
# Line 1224  Data operator+(const Data& left, const b Line 1457  Data operator+(const Data& left, const b
1457    Takes LHS Data object and RHS python::object.    Takes LHS Data object and RHS python::object.
1458    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1459  */  */
1460  Data operator-(const Data& left, const boost::python::object& right);  ESCRIPT_DLL_API Data operator-(const Data& left, const boost::python::object& right);
1461    
1462  /**  /**
1463    \brief    \brief
# Line 1232  Data operator-(const Data& left, const b Line 1465  Data operator-(const Data& left, const b
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 1240  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 1248  Data operator/(const Data& left, const b Line 1481  Data operator/(const Data& left, const b
1481    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1482    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1483  */  */
1484  Data operator+(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator+(const boost::python::object& left, const Data& right);
1485    
1486  /**  /**
1487    \brief    \brief
# Line 1256  Data operator+(const boost::python::obje Line 1489  Data operator+(const boost::python::obje
1489    Takes LHS python::object and RHS Data object.    Takes LHS python::object and RHS Data object.
1490    python::object must be convertable to Data type.    python::object must be convertable to Data type.
1491  */  */
1492  Data operator-(const boost::python::object& left, const Data& right);  ESCRIPT_DLL_API Data operator-(const boost::python::object& left, const Data& right);
1493    
1494  /**  /**
1495    \brief    \brief
# Line 1264  Data operator-(const boost::python::obje Line 1497  Data operator-(const boost::python::obje
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 1272  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
1512    Output operator    Output operator
1513  */  */
1514  std::ostream& operator<<(std::ostream& o, const Data& data);  ESCRIPT_DLL_API std::ostream& operator<<(std::ostream& o, const Data& data);
1515    
1516  /**  /**
1517    \brief    \brief
# Line 1286  std::ostream& operator<<(std::ostream& o Line 1519  std::ostream& operator<<(std::ostream& o
1519    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
1520    be relied on. Requires further implementation.    be relied on. Requires further implementation.
1521  */  */
1522  //bool operator==(const Data& left, const Data& right);  //ESCRIPT_DLL_API bool operator==(const Data& left, const Data& right);
1523    
1524  /**  /**
1525    \brief    \brief
# Line 1483  inline Line 1716  inline
1716  Data  Data
1717  Data::dp_algorithm(BinaryFunction operation, double initial_value) const  Data::dp_algorithm(BinaryFunction operation, double initial_value) const
1718  {  {
   Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());  
1719    if (isExpanded()) {    if (isExpanded()) {
1720        Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1721      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());
1722      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
1723      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");
1724      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");
1725      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);
1726        return result;
1727    } else if (isTagged()) {    } else if (isTagged()) {
1728      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
1729        DataArrayView::ShapeType viewShape;
1730        DataArrayView::ValueType viewData(1);
1731        viewData[0]=0;
1732        DataArrayView defaultValue(viewData,viewShape);
1733        DataTagged::TagListType keys;
1734        DataTagged::ValueListType values;
1735        DataTagged::DataMapType::const_iterator i;
1736        for (i=dataT->getTagLookup().begin();i!=dataT->getTagLookup().end();i++) {
1737          keys.push_back(i->first);
1738          values.push_back(defaultValue);
1739        }
1740        Data result(keys,values,defaultValue,getFunctionSpace());
1741      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());
1742      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");
1743      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");
1744      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);
1745        return result;
1746    } else if (isConstant()) {    } else if (isConstant()) {
1747        Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1748      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
1749      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
1750      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");
1751      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");
1752      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);
1753        return result;
1754    }    }
1755    return result;    Data falseRetVal; // to keep compiler quiet
1756      return falseRetVal;
1757  }  }
1758    
1759  }  }

Legend:
Removed from v.474  
changed lines
  Added in v.783

  ViewVC Help
Powered by ViewVC 1.1.26