/[escript]/branches/schroedinger/escript/src/Data.h
ViewVC logotype

Diff of /branches/schroedinger/escript/src/Data.h

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

trunk/esys2/escript/src/Data/Data.h revision 117 by jgs, Fri Apr 1 05:48:57 2005 UTC trunk/escript/src/Data.h revision 480 by jgs, Wed Feb 1 05:15:12 2006 UTC
# Line 1  Line 1 
1  // $Id$  // $Id$
2  /*=============================================================================  /*
   
3   ******************************************************************************   ******************************************************************************
4   *                                                                            *   *                                                                            *
5   *       COPYRIGHT ACcESS 2004 -  All Rights Reserved                         *   *       COPYRIGHT ACcESS 2004 -  All Rights Reserved                         *
# Line 12  Line 11 
11   * person has a software license agreement with ACcESS.                       *   * person has a software license agreement with ACcESS.                       *
12   *                                                                            *   *                                                                            *
13   ******************************************************************************   ******************************************************************************
14    */
15    
16  ******************************************************************************/  /** \file Data.h */
17    
18  #ifndef DATA_H  #ifndef DATA_H
19  #define DATA_H  #define DATA_H
20    
21  #include "escript/Data/DataAbstract.h"  #include "DataAbstract.h"
22  #include "escript/Data/DataTagged.h"  #include "DataAlgorithm.h"
23  #include "escript/Data/FunctionSpace.h"  #include "FunctionSpace.h"
24  #include "escript/Data/BinaryOp.h"  #include "BinaryOp.h"
25  #include "escript/Data/UnaryOp.h"  #include "UnaryOp.h"
26  #include "escript/Data/DataException.h"  #include "DataException.h"
27    
28  extern "C" {  extern "C" {
29  #include "escript/Data/DataC.h"  #include "DataC.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    
40    namespace escript {
41    
42    //
43    // Forward declaration for various implementations of Data.
44    class DataConstant;
45    class DataTagged;
46    class DataExpanded;
47    
48  /**  /**
49     \brief     \brief
50     Data is essentially a factory class which creates the appropriate Data     Data creates the appropriate Data object for the given construction
51     object for the given construction arguments. It retains control over     arguments.
    the object created for the lifetime of the object.  
    The type of Data object referred to may change during the lifetime of  
    the Data object.  
52    
53     Description:     Description:
54     Data is essentially a factory class which creates the appropriate Data     Data is essentially a factory class which creates the appropriate Data
# Line 55  extern "C" { Line 57  extern "C" {
57     The type of Data object referred to may change during the lifetime of     The type of Data object referred to may change during the lifetime of
58     the Data object.     the Data object.
59  */  */
   
 namespace escript {  
   
 //  
 // Forward declaration for various implimentations of Data.  
 class DataEmpty;  
 class DataConstant;  
 class DataTagged;  
 class DataExpanded;  
   
60  class Data {  class Data {
61    
62    public:    public:
# Line 209  class Data { Line 201  class Data {
201         const boost::python::tuple& shape=boost::python::make_tuple(),         const boost::python::tuple& shape=boost::python::make_tuple(),
202         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
203         bool expanded=false);         bool expanded=false);
204      /**
205         \brief
206         Destructor
207      */
208      ~Data();
209    
210    /**    /**
211       \brief       \brief
# Line 223  class Data { Line 220  class Data {
220    
221    /**    /**
222       \brief       \brief
223       Return the values of all data-points in a single python numarray object.       Return the values of all data-points as a single python numarray object.
224    */    */
225    boost::python::numeric::array    const boost::python::numeric::array
226    convertToNumArray();    convertToNumArray();
227    
228    /**    /**
229       \brief       \brief
230         Return the values of all data-points for the given sample as a single python numarray object.
231      */
232      const boost::python::numeric::array
233      convertToNumArrayFromSampleNo(int sampleNo);
234    
235      /**
236         \brief
237         Return the value of the specified data-point as a single python numarray object.
238      */
239      const boost::python::numeric::array
240      convertToNumArrayFromDPNo(int sampleNo,
241                                int dataPointNo);
242    
243      /**
244         \brief
245         Fills the expanded Data object from values of a python numarray object.
246      */
247      void
248      fillFromNumArray(const boost::python::numeric::array);
249    
250      /**
251         \brief
252         Return the tag number associated with the given data-point.
253    
254         The data-point number here corresponds to the data-point number in the
255         numarray returned by convertToNumArray.
256      */
257      int
258      getTagNumber(int dpno);
259    
260      /**
261         \brief
262       Return the C wrapper for the Data object.       Return the C wrapper for the Data object.
263    */    */
264    escriptDataC    escriptDataC
# Line 471  class Data { Line 500  class Data {
500       \brief       \brief
501       Return the data point shape as a tuple of integers.       Return the data point shape as a tuple of integers.
502    */    */
503    boost::python::tuple    const boost::python::tuple
504    getShapeTuple() const;    getShapeTuple() const;
505    
506    /**    /**
# Line 508  class Data { Line 537  class Data {
537       cannot be converted to a DataTagged object.       cannot be converted to a DataTagged object.
538       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
539       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
      Note: removed for now - this version not needed, and breaks escript.cpp  
540    */    */
   /*  
541    void    void
542    setTaggedValue(int tagKey,    setTaggedValueFromCPP(int tagKey,
543                   const DataArrayView& value);                          const DataArrayView& value);
   */  
544    
545    /**    /**
546      \brief      \brief
# Line 532  class Data { Line 558  class Data {
558       \brief       \brief
559       Interpolates this onto the given functionspace and returns       Interpolates this onto the given functionspace and returns
560       the result as a Data object.       the result as a Data object.
561         *
562    */    */
563    Data    Data
564    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
# Line 540  class Data { Line 567  class Data {
567       \brief       \brief
568       Calculates the gradient of the data at the data points of functionspace.       Calculates the gradient of the data at the data points of functionspace.
569       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.
570         *
571    */    */
572    Data    Data
573    gradOn(const FunctionSpace& functionspace) const;    gradOn(const FunctionSpace& functionspace) const;
# Line 550  class Data { Line 578  class Data {
578    /**    /**
579       \brief       \brief
580       Calculate the integral over the function space domain.       Calculate the integral over the function space domain.
581         *
582    */    */
583    boost::python::numeric::array    boost::python::numeric::array
584    integrate() const;    integrate() const;
# Line 557  class Data { Line 586  class Data {
586    /**    /**
587       \brief       \brief
588       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.
589         *
590    */    */
591    Data    Data
592    wherePositive() const;    wherePositive() const;
# Line 564  class Data { Line 594  class Data {
594    /**    /**
595       \brief       \brief
596       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.
597         *
598    */    */
599    Data    Data
600    whereNegative() const;    whereNegative() const;
# Line 571  class Data { Line 602  class Data {
602    /**    /**
603       \brief       \brief
604       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.
605         *
606    */    */
607    Data    Data
608    whereNonNegative() const;    whereNonNegative() const;
# Line 578  class Data { Line 610  class Data {
610    /**    /**
611       \brief       \brief
612       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.
613         *
614    */    */
615    Data    Data
616    whereNonPositive() const;    whereNonPositive() const;
# Line 585  class Data { Line 618  class Data {
618    /**    /**
619       \brief       \brief
620       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.
621         *
622    */    */
623    Data    Data
624    whereZero() const;    whereZero() const;
# Line 592  class Data { Line 626  class Data {
626    /**    /**
627       \brief       \brief
628       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.
629         *
630    */    */
631    Data    Data
632    whereNonZero() const;    whereNonZero() const;
633    
634    /**    /**
635       \brief       \brief
636         Return the maximum absolute value of this Data object.
637         *
638      */
639      double
640      Lsup() const;
641    
642      /**
643         \brief
644         Return the minimum absolute value of this Data object.
645         *
646      */
647      double
648      Linf() const;
649    
650      /**
651         \brief
652         Return the maximum value of this Data object.
653         *
654      */
655      double
656      sup() const;
657    
658      /**
659         \brief
660         Return the minimum value of this Data object.
661         *
662      */
663      double
664      inf() const;
665    
666      /**
667         \brief
668         Return the absolute value of each data point of this Data object.
669         *
670      */
671      Data
672      abs() const;
673    
674      /**
675         \brief
676         Return the maximum value of each data point of this Data object.
677         *
678      */
679      Data
680      maxval() const;
681    
682      /**
683         \brief
684         Return the minimum value of each data point of this Data object.
685         *
686      */
687      Data
688      minval() const;
689    
690      /**
691         \brief
692         Return the (sample number, data-point number) of the data point with
693         the minimum value in this Data object.
694      */
695      const boost::python::tuple
696      mindp() const;
697    
698      void
699      calc_mindp(int& SampleNo,
700                 int& DataPointNo) const;
701    
702      /**
703         \brief
704         Return the sign of each data point of this Data object.
705         -1 for negative values, zero for zero values, 1 for positive values.
706         *
707      */
708      Data
709      sign() const;
710    
711      /**
712         \brief
713         Transpose each data point of this Data object around the given axis.
714         --* not implemented yet *--
715         *
716      */
717      Data
718      transpose(int axis) const;
719    
720      /**
721         \brief
722         Calculate the trace of each data point of this Data object.
723         sum(A[i,i,i,i])
724         *
725      */
726      Data
727      trace() const;
728    
729      /**
730         \brief
731       Return the sin of each data point of this Data object.       Return the sin of each data point of this Data object.
732         *
733    */    */
734    Data    Data
735    sin() const;    sin() const;
# Line 606  class Data { Line 737  class Data {
737    /**    /**
738       \brief       \brief
739       Return the cos of each data point of this Data object.       Return the cos of each data point of this Data object.
740         *
741    */    */
742    Data    Data
743    cos() const;    cos() const;
# Line 613  class Data { Line 745  class Data {
745    /**    /**
746       \brief       \brief
747       Return the tan of each data point of this Data object.       Return the tan of each data point of this Data object.
748         *
749    */    */
750    Data    Data
751    tan() const;    tan() const;
752    
753    /**    /**
754       \brief       \brief
755       Return the log to base 10 of each data point of this Data object.       Return the asin of each data point of this Data object.
756         *
757    */    */
758    Data    Data
759    log() const;    asin() const;
760    
761    /**    /**
762       \brief       \brief
763       Return the natural log of each data point of this Data object.       Return the acos of each data point of this Data object.
764         *
765    */    */
766    Data    Data
767    ln() const;    acos() const;
768    
769    /**    /**
770       \brief       \brief
771       Return the maximum absolute value of this Data object.       Return the atan of each data point of this Data object.
772         *
773    */    */
774    double    Data
775    Lsup() const;    atan() const;
776    
777    /**    /**
778       \brief       \brief
779       Return the minimum absolute value of this Data object.       Return the sinh of each data point of this Data object.
780         *
781    */    */
782    double    Data
783    Linf() const;    sinh() const;
784    
785    /**    /**
786       \brief       \brief
787       Return the maximum value of this Data object.       Return the cosh of each data point of this Data object.
788         *
789    */    */
790    double    Data
791    sup() const;    cosh() const;
792    
793    /**    /**
794       \brief       \brief
795       Return the minimum value of this Data object.       Return the tanh of each data point of this Data object.
796         *
797    */    */
798    double    Data
799    inf() const;    tanh() const;
800    
801    /**    /**
802       \brief       \brief
803       Return the absolute value of each data point of this Data object.       Return the asinh of each data point of this Data object.
804         *
805    */    */
806    Data    Data
807    abs() const;    asinh() const;
808    
809    /**    /**
810       \brief       \brief
811       Return the maximum value of each data point of this Data object.       Return the acosh of each data point of this Data object.
812         *
813    */    */
814    Data    Data
815    maxval() const;    acosh() const;
816    
817    /**    /**
818       \brief       \brief
819       Return the minimum value of each data point of this Data object.       Return the atanh of each data point of this Data object.
820         *
821    */    */
822    Data    Data
823    minval() const;    atanh() const;
824    
825    /**    /**
826       \brief       \brief
827       Return the length of each data point of this Data object.       Return the log to base 10 of each data point of this Data object.
828       sqrt(sum(A[i,j,k,l]^2))       *
829    */    */
830    Data    Data
831    length() const;    log10() const;
832    
833    /**    /**
834       \brief       \brief
835       Return the sign of each data point of this Data object.       Return the natural log of each data point of this Data object.
836       -1 for negative values, zero for zero values, 1 for positive values.       *
837    */    */
838    Data    Data
839    sign() const;    log() const;
840    
841    /**    /**
842      \transpose       \brief
843      Transpose each data point of this Data object around the given axis.       Return the exponential function of each data point of this Data object.
844      --* not implemented yet *--       *
845    */    */
846    Data    Data
847    transpose(int axis) const;    exp() const;
848    
849    /**    /**
850      \trace       \brief
851      Calculate the trace of each data point of this Data object.       Return the square root of each data point of this Data object.
852      sum(A[i,i,i,i])       *
853    */    */
854    Data    Data
855    trace() const;    sqrt() const;
856    
857    /**    /**
858      \exp       \brief
859      Return the exponential function of each data point of this Data object.       Return the negation of each data point of this Data object.
860         *
861    */    */
862    Data    Data
863    exp() const;    neg() const;
864    
865    /**    /**
866      \sqrt       \brief
867      Return the square root of each data point of this Data object.       Return the identity of each data point of this Data object.
868         Simply returns this object unmodified.
869         *
870    */    */
871    Data    Data
872    sqrt() const;    pos() const;
873    
874    /**    /**
875       \brief       \brief
876       Return the given power of each data point of this Data object.       Return the given power of each data point of this Data object.
877    
878         \param right Input - the power to raise the object to.
879         *
880    */    */
881    Data    Data
882    powD(const Data& right) const;    powD(const Data& right) const;
883    
884      /**
885         \brief
886         Return the given power of each data point of this boost python object.
887        
888         \param right Input - the power to raise the object to.
889         *
890       */
891    Data    Data
892    powO(const boost::python::object& right) const;    powO(const boost::python::object& right) const;
893    
894    /**    /**
895      \brief       \brief
896      writes the object to a file in the DX file format       writes the object to a file in the DX file format
897    */    */
898    void    void
899    saveDX(std::string fileName) const;    saveDX(std::string fileName) const;
900    
901    /**    /**
902      \brief       \brief
903      writes the object to a file in the VTK file format       writes the object to a file in the VTK file format
904    */    */
905    void    void
906    saveVTK(std::string fileName) const;    saveVTK(std::string fileName) const;
907    
908    /**    /**
     \brief  
     Return the negation of each data point of this Data object.  
   */  
   Data  
   neg() const;  
   
   /**  
     \brief  
     Return the identity of each data point of this Data object.  
     Simply returns this object unmodified.  
   */  
   Data  
   pos() const;  
   
   /**  
909       \brief       \brief
910       Overloaded operator +=       Overloaded operator +=
911       \param right - Input - The right hand side.       \param right - Input - The right hand side.
912         *
913    */    */
914    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
915    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
# Line 777  class Data { Line 918  class Data {
918       \brief       \brief
919       Overloaded operator -=       Overloaded operator -=
920       \param right - Input - The right hand side.       \param right - Input - The right hand side.
921         *
922    */    */
923    Data& operator-=(const Data& right);    Data& operator-=(const Data& right);
924    Data& operator-=(const boost::python::object& right);    Data& operator-=(const boost::python::object& right);
# Line 785  class Data { Line 927  class Data {
927       \brief       \brief
928       Overloaded operator *=       Overloaded operator *=
929       \param right - Input - The right hand side.       \param right - Input - The right hand side.
930         *
931    */    */
932    Data& operator*=(const Data& right);    Data& operator*=(const Data& right);
933    Data& operator*=(const boost::python::object& right);    Data& operator*=(const boost::python::object& right);
# Line 793  class Data { Line 936  class Data {
936       \brief       \brief
937       Overloaded operator /=       Overloaded operator /=
938       \param right - Input - The right hand side.       \param right - Input - The right hand side.
939         *
940    */    */
941    Data& operator/=(const Data& right);    Data& operator/=(const Data& right);
942    Data& operator/=(const boost::python::object& right);    Data& operator/=(const boost::python::object& right);
# Line 826  class Data { Line 970  class Data {
970       \brief       \brief
971       Copies slice from value into this Data object.       Copies slice from value into this Data object.
972    
      \description  
973       Implements the [] set operator in python.       Implements the [] set operator in python.
974       Calls setSlice.       Calls setSlice.
975    
# Line 859  class Data { Line 1002  class Data {
1002       Return a Data object containing the specified slice of       Return a Data object containing the specified slice of
1003       this Data object.       this Data object.
1004       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1005         *
1006    */    */
1007    Data    Data
1008    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
# Line 869  class Data { Line 1013  class Data {
1013       Data object.       Data object.
1014       \param value - Input - Data to copy from.       \param value - Input - Data to copy from.
1015       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1016         *
1017    */    */
1018    void    void
1019    setSlice(const Data& value,    setSlice(const Data& value,
1020             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
1021    
1022      /**
1023         \brief
1024         Archive the current Data object to the given file.
1025         \param fileName - Input - file to archive to.
1026      */
1027      void
1028      archiveData(const std::string fileName);
1029    
1030      /**
1031         \brief
1032         Extract the Data object archived in the given file, overwriting
1033         the current Data object.
1034         Note - the current object must be of type DataEmpty.
1035         \param fileName - Input - file to extract from.
1036         \param fspace - Input - a suitable FunctionSpace descibing the data.
1037      */
1038      void
1039      extractData(const std::string fileName,
1040                  const FunctionSpace& fspace);
1041    
1042   protected:   protected:
1043    
1044   private:   private:
# Line 896  class Data { Line 1061  class Data {
1061       Perform the specified reduction algorithm on every element of every data point in       Perform the specified reduction algorithm on every element of every data point in
1062       this Data object according to the given function and return the single value result.       this Data object according to the given function and return the single value result.
1063    */    */
1064    template <class UnaryFunction>    template <class BinaryFunction>
1065    inline    inline
1066    double    double
1067    algorithm(UnaryFunction operation) const;    algorithm(BinaryFunction operation,
1068                double initial_value) const;
1069    
1070    /**    /**
1071       \brief       \brief
# Line 908  class Data { Line 1074  class Data {
1074       one value - the result of the reduction operation on the corresponding data-point in       one value - the result of the reduction operation on the corresponding data-point in
1075       this Data object       this Data object
1076    */    */
1077    template <class UnaryFunction>    template <class BinaryFunction>
1078    inline    inline
1079    Data    Data
1080    dp_algorithm(UnaryFunction operation) const;    dp_algorithm(BinaryFunction operation,
1081                   double initial_value) const;
1082    
1083    /**    /**
1084       \brief       \brief
# Line 978  class Data { Line 1145  class Data {
1145    // pointer to the actual data object    // pointer to the actual data object
1146    boost::shared_ptr<DataAbstract> m_data;    boost::shared_ptr<DataAbstract> m_data;
1147    
1148      //
1149      // pointer to the internal profiling data
1150      struct profDataEntry *profData;
1151    
1152  };  };
1153    
1154  template <class IValueType>  template <class IValueType>
# Line 1273  Data::unaryOp(UnaryFunction operation) Line 1444  Data::unaryOp(UnaryFunction operation)
1444    object (*this) is a rank n Data object, and returned object is a scalar.    object (*this) is a rank n Data object, and returned object is a scalar.
1445    Calls escript::algorithm.    Calls escript::algorithm.
1446  */  */
1447  template <class UnaryFunction>  template <class BinaryFunction>
1448  inline  inline
1449  double  double
1450  Data::algorithm(UnaryFunction operation) const  Data::algorithm(BinaryFunction operation, double initial_value) const
1451  {  {
1452    if (isExpanded()) {    if (isExpanded()) {
1453      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());
1454      EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");      EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");
1455      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1456    } else if (isTagged()) {    } else if (isTagged()) {
1457      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());
1458      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");
1459      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1460    } else if (isConstant()) {    } else if (isConstant()) {
1461      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());
1462      EsysAssert((leftC!=0), "Programming error - casting to DataConstant.");      EsysAssert((leftC!=0), "Programming error - casting to DataConstant.");
1463      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1464    }    }
1465    return 0;    return 0;
1466  }  }
# Line 1302  Data::algorithm(UnaryFunction operation) Line 1473  Data::algorithm(UnaryFunction operation)
1473    rank 0 Data object.    rank 0 Data object.
1474    Calls escript::dp_algorithm.    Calls escript::dp_algorithm.
1475  */  */
1476  template <class UnaryFunction>  template <class BinaryFunction>
1477  inline  inline
1478  Data  Data
1479  Data::dp_algorithm(UnaryFunction operation) const  Data::dp_algorithm(BinaryFunction operation, double initial_value) const
1480  {  {
1481    Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());    Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1482    if (isExpanded()) {    if (isExpanded()) {
# Line 1313  Data::dp_algorithm(UnaryFunction operati Line 1484  Data::dp_algorithm(UnaryFunction operati
1484      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
1485      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");
1486      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");
1487      escript::dp_algorithm(*dataE,*resultE,operation);      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);
1488    } else if (isTagged()) {    } else if (isTagged()) {
1489      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
1490      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());
1491      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");
1492      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");
1493      escript::dp_algorithm(*dataT,*resultT,operation);      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);
1494    } else if (isConstant()) {    } else if (isConstant()) {
1495      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
1496      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
1497      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");
1498      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");
1499      escript::dp_algorithm(*dataC,*resultC,operation);      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);
1500    }    }
1501    return result;    return result;
1502  }  }

Legend:
Removed from v.117  
changed lines
  Added in v.480

  ViewVC Help
Powered by ViewVC 1.1.26