/[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

revision 106 by jgs, Thu Dec 23 07:20:12 2004 UTC revision 147 by jgs, Fri Aug 12 01:45:47 2005 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 "escript/Data/DataAbstract.h"
22  #include "escript/Data/DataTagged.h"  #include "escript/Data/DataTagged.h"
23    #include "escript/Data/DataAlgorithm.h"
24  #include "escript/Data/FunctionSpace.h"  #include "escript/Data/FunctionSpace.h"
25  #include "escript/Data/BinaryOp.h"  #include "escript/Data/BinaryOp.h"
26  #include "escript/Data/UnaryOp.h"  #include "escript/Data/UnaryOp.h"
27    #include "escript/Data/DataException.h"
28    
29  extern "C" {  extern "C" {
30  #include "escript/Data/DataC.h"  #include "escript/Data/DataC.h"
# Line 39  extern "C" { Line 41  extern "C" {
41  #include <boost/python/tuple.hpp>  #include <boost/python/tuple.hpp>
42  #include <boost/python/numeric.hpp>  #include <boost/python/numeric.hpp>
43    
44    namespace escript {
45    
46    //
47    // Forward declaration for various implimentations of Data.
48    class DataEmpty;
49    class DataConstant;
50    class DataTagged;
51    class DataExpanded;
52    
53  /**  /**
54     \brief     \brief
55     Data is essentially a factory class which creates the appropriate Data     Data creates the appropriate Data object for the given construction
56     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.  
57    
58     Description:     Description:
59     Data is essentially a factory class which creates the appropriate Data     Data is essentially a factory class which creates the appropriate Data
# Line 54  extern "C" { Line 62  extern "C" {
62     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
63     the Data object.     the Data object.
64  */  */
   
 namespace escript {  
   
 //  
 // Forward declaration for various implimentations of Data.  
 class DataEmpty;  
 class DataConstant;  
 class DataTagged;  
 class DataExpanded;  
   
65  class Data {  class Data {
66    
67    public:    public:
68    
69      // These typedefs allow function names to be cast to pointers
70      // to functions of the appropriate type when calling unaryOp etc.
71    typedef double (*UnaryDFunPtr)(double);    typedef double (*UnaryDFunPtr)(double);
72    typedef double (*BinaryDFunPtr)(double,double);    typedef double (*BinaryDFunPtr)(double,double);
73    
# Line 220  class Data { Line 220  class Data {
220    
221    /**    /**
222       \brief       \brief
223         Return the values of all data-points as a single python numarray object.
224      */
225      const boost::python::numeric::array
226      convertToNumArray();
227    
228      /**
229         \brief fills the expanded Data object from values of a  python numarray object.
230    
231      */
232      void
233      fillFromNumArray(const boost::python::numeric::array);
234      /**
235         \brief
236         Return the values of all data-points for the given sample as a single python numarray object.
237      */
238      const boost::python::numeric::array
239      convertToNumArrayFromSampleNo(int sampleNo);
240    
241      /**
242         \brief
243         Return the value of the specified data-point as a single python numarray object.
244      */
245      const boost::python::numeric::array
246      convertToNumArrayFromDPNo(int sampleNo,
247                                int dataPointNo);
248    
249      /**
250         \brief
251       Return the C wrapper for the Data object.       Return the C wrapper for the Data object.
252    */    */
253    escriptDataC    escriptDataC
# Line 397  class Data { Line 425  class Data {
425    
426    /**    /**
427       \brief       \brief
428         Assign the given value to the data-points referenced by the given
429         reference number.
430    
431         The value supplied is a python numarray object.  The data from this numarray
432         is unpacked into a DataArray, and this is used to set the corresponding
433         data-points in the underlying Data object.
434    
435         If the underlying Data object cannot be accessed via reference numbers, an
436         exception will be thrown.
437    
438         \param ref - Input - reference number.
439         \param value - Input - value to assign to data-points associated with
440                                the given reference number.
441      */
442      void
443      setRefValue(int ref,
444                  const boost::python::numeric::array& value);
445    
446      /**
447         \brief
448         Return the values associated with the data-points referenced by the given
449         reference number.
450    
451         The value supplied is a python numarray object. The data from the corresponding
452         data-points in this Data object are packed into the given numarray object.
453    
454         If the underlying Data object cannot be accessed via reference numbers, an
455         exception will be thrown.
456    
457         \param ref - Input - reference number.
458         \param value - Output - object to receive values from data-points
459                                 associated with the given reference number.
460      */
461      void
462      getRefValue(int ref,
463                  boost::python::numeric::array& value);
464    
465      /**
466         \brief
467       Return a view into the data for the data point specified.       Return a view into the data for the data point specified.
468       NOTE: Construction of the DataArrayView is a relatively expensive       NOTE: Construction of the DataArrayView is a relatively expensive
469       operation.       operation.
# Line 422  class Data { Line 489  class Data {
489       \brief       \brief
490       Return the data point shape as a tuple of integers.       Return the data point shape as a tuple of integers.
491    */    */
492    boost::python::tuple    const boost::python::tuple
493    getShapeTuple() const;    getShapeTuple() const;
494    
495    /**    /**
# Line 459  class Data { Line 526  class Data {
526       cannot be converted to a DataTagged object.       cannot be converted to a DataTagged object.
527       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
528       \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  
529    */    */
   /*  
530    void    void
531    setTaggedValue(int tagKey,    setTaggedValueFromCPP(int tagKey,
532                   const DataArrayView& value);                          const DataArrayView& value);
   */  
533    
534    /**    /**
535      \brief      \brief
# Line 483  class Data { Line 547  class Data {
547       \brief       \brief
548       Interpolates this onto the given functionspace and returns       Interpolates this onto the given functionspace and returns
549       the result as a Data object.       the result as a Data object.
550         *
551    */    */
552    Data    Data
553    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
# Line 491  class Data { Line 556  class Data {
556       \brief       \brief
557       Calculates the gradient of the data at the data points of functionspace.       Calculates the gradient of the data at the data points of functionspace.
558       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.
559         *
560    */    */
561    Data    Data
562    gradOn(const FunctionSpace& functionspace) const;    gradOn(const FunctionSpace& functionspace) const;
# Line 501  class Data { Line 567  class Data {
567    /**    /**
568       \brief       \brief
569       Calculate the integral over the function space domain.       Calculate the integral over the function space domain.
570         *
571    */    */
572    boost::python::numeric::array    boost::python::numeric::array
573    integrate() const;    integrate() const;
# Line 508  class Data { Line 575  class Data {
575    /**    /**
576       \brief       \brief
577       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.
578         *
579    */    */
580    Data    Data
581    wherePositive() const;    wherePositive() const;
# Line 515  class Data { Line 583  class Data {
583    /**    /**
584       \brief       \brief
585       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.
586         *
587    */    */
588    Data    Data
589    whereNegative() const;    whereNegative() const;
# Line 522  class Data { Line 591  class Data {
591    /**    /**
592       \brief       \brief
593       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.
594         *
595    */    */
596    Data    Data
597    whereNonNegative() const;    whereNonNegative() const;
# Line 529  class Data { Line 599  class Data {
599    /**    /**
600       \brief       \brief
601       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.
602         *
603    */    */
604    Data    Data
605    whereNonPositive() const;    whereNonPositive() const;
# Line 536  class Data { Line 607  class Data {
607    /**    /**
608       \brief       \brief
609       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.
610         *
611    */    */
612    Data    Data
613    whereZero() const;    whereZero() const;
# Line 543  class Data { Line 615  class Data {
615    /**    /**
616       \brief       \brief
617       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.
618         *
619    */    */
620    Data    Data
621    whereNonZero() const;    whereNonZero() const;
622    
623    /**    /**
624       \brief       \brief
625       Return the sin of each data point of this Data object.       Return the maximum absolute value of this Data object.
626    */       *
   Data  
   sin() const;  
   
   /**  
      \brief  
      Return the cos of each data point of this Data object.  
   */  
   Data  
   cos() const;  
   
   /**  
      \brief  
      Return the tan of each data point of this Data object.  
   */  
   Data  
   tan() const;  
   
   /**  
      \brief  
      Return the log to base 10 of each data point of this Data object.  
   */  
   Data  
   log() const;  
   
   /**  
      \brief  
      Return the natural log of each data point of this Data object.  
627    */    */
628    Data    double
629    ln() const;    Lsup() const;
630    
631    /**    /**
632       \brief       \brief
633       Return the maximum absolute value of this Data object.       Return the minimum absolute value of this Data object.
634         *
635    */    */
636    double    double
637    Lsup() const;    Linf() const;
638    
639    /**    /**
640       \brief       \brief
641       Return the maximum value of this Data object.       Return the maximum value of this Data object.
642         *
643    */    */
644    double    double
645    sup() const;    sup() const;
# Line 599  class Data { Line 647  class Data {
647    /**    /**
648       \brief       \brief
649       Return the minimum value of this Data object.       Return the minimum value of this Data object.
650         *
651    */    */
652    double    double
653    inf() const;    inf() const;
# Line 606  class Data { Line 655  class Data {
655    /**    /**
656       \brief       \brief
657       Return the absolute value of each data point of this Data object.       Return the absolute value of each data point of this Data object.
658         *
659    */    */
660    Data    Data
661    abs() const;    abs() const;
# Line 613  class Data { Line 663  class Data {
663    /**    /**
664       \brief       \brief
665       Return the maximum value of each data point of this Data object.       Return the maximum value of each data point of this Data object.
666         *
667    */    */
668    Data    Data
669    maxval() const;    maxval() const;
# Line 620  class Data { Line 671  class Data {
671    /**    /**
672       \brief       \brief
673       Return the minimum value of each data point of this Data object.       Return the minimum value of each data point of this Data object.
674         *
675    */    */
676    Data    Data
677    minval() const;    minval() const;
678    
679    /**    /**
680       \brief       \brief
681         Return the (sample number, data-point number) of the data point with
682         the minimum value in this Data object.
683      */
684      const boost::python::tuple
685      mindp() const;
686    
687      /**
688         \brief
689       Return the length of each data point of this Data object.       Return the length of each data point of this Data object.
690       sqrt(sum(A[i,j,k,l]^2))       sqrt(sum(A[i,j,k,l]^2))
691         *
692    */    */
693    Data    Data
694    length() const;    length() const;
# Line 636  class Data { Line 697  class Data {
697       \brief       \brief
698       Return the sign of each data point of this Data object.       Return the sign of each data point of this Data object.
699       -1 for negative values, zero for zero values, 1 for positive values.       -1 for negative values, zero for zero values, 1 for positive values.
700         *
701    */    */
702    Data    Data
703    sign() const;    sign() const;
704    
705    /**    /**
706      \transpose       \brief
707      Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
708      --* not implemented yet *--       --* not implemented yet *--
709         *
710    */    */
711    Data    Data
712    transpose(int axis) const;    transpose(int axis) const;
713    
714    /**    /**
715      \trace       \brief
716      Calculate the trace of each data point of this Data object.       Calculate the trace of each data point of this Data object.
717      sum(A[i,i,i,i])       sum(A[i,i,i,i])
718         *
719    */    */
720    Data    Data
721    trace() const;    trace() const;
722    
723    /**    /**
724      \exp       \brief
725      Return the exponential function of each data point of this Data object.       Return the sin of each data point of this Data object.
726         *
727    */    */
728    Data    Data
729    exp() const;    sin() const;
730    
731    /**    /**
732      \sqrt       \brief
733      Return the square root of each data point of this Data object.       Return the cos of each data point of this Data object.
734         *
735    */    */
736    Data    Data
737    sqrt() const;    cos() const;
738    
739    /**    /**
740       \brief       \brief
741       Return the given power of each data point of this Data object.       Return the tan of each data point of this Data object.
742         *
743    */    */
744    Data    Data
745    powD(const Data& right) const;    tan() const;
746    
747      /**
748         \brief
749         Return the log to base 10 of each data point of this Data object.
750         *
751      */
752    Data    Data
753    powO(const boost::python::object& right) const;    log() const;
754    
755    /**    /**
756      \brief       \brief
757      writes the object to a file in the DX file format       Return the natural log of each data point of this Data object.
758         *
759    */    */
760    void    Data
761    saveDX(std::string fileName) const;    ln() const;
762    
763    /**    /**
764      \brief       \brief
765      Return the negation of each data point of this Data object.       Return the exponential function of each data point of this Data object.
766         *
767      */
768      Data
769      exp() const;
770    
771      /**
772         \brief
773         Return the square root of each data point of this Data object.
774         *
775      */
776      Data
777      sqrt() const;
778    
779      /**
780         \brief
781         Return the negation of each data point of this Data object.
782         *
783    */    */
784    Data    Data
785    neg() const;    neg() const;
786    
787    /**    /**
788      \brief       \brief
789      Return the identity of each data point of this Data object.       Return the identity of each data point of this Data object.
790      Simply returns this object unmodified.       Simply returns this object unmodified.
791         *
792    */    */
793    Data    Data
794    pos() const;    pos() const;
795    
796    /**    /**
797       \brief       \brief
798         Return the given power of each data point of this Data object.
799    
800         \param right Input - the power to raise the object to.
801         *
802      */
803      Data
804      powD(const Data& right) const;
805    
806      /**
807         \brief
808         Return the given power of each data point of this boost python object.
809        
810         \param right Input - the power to raise the object to.
811         *
812       */
813      Data
814      powO(const boost::python::object& right) const;
815    
816      /**
817         \brief
818         writes the object to a file in the DX file format
819      */
820      void
821      saveDX(std::string fileName) const;
822    
823      /**
824         \brief
825         writes the object to a file in the VTK file format
826      */
827      void
828      saveVTK(std::string fileName) const;
829    
830      /**
831         \brief
832       Overloaded operator +=       Overloaded operator +=
833       \param right - Input - The right hand side.       \param right - Input - The right hand side.
834         *
835    */    */
836    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
837    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
# Line 714  class Data { Line 840  class Data {
840       \brief       \brief
841       Overloaded operator -=       Overloaded operator -=
842       \param right - Input - The right hand side.       \param right - Input - The right hand side.
843         *
844    */    */
845    Data& operator-=(const Data& right);    Data& operator-=(const Data& right);
846    Data& operator-=(const boost::python::object& right);    Data& operator-=(const boost::python::object& right);
# Line 722  class Data { Line 849  class Data {
849       \brief       \brief
850       Overloaded operator *=       Overloaded operator *=
851       \param right - Input - The right hand side.       \param right - Input - The right hand side.
852         *
853    */    */
854    Data& operator*=(const Data& right);    Data& operator*=(const Data& right);
855    Data& operator*=(const boost::python::object& right);    Data& operator*=(const boost::python::object& right);
# Line 730  class Data { Line 858  class Data {
858       \brief       \brief
859       Overloaded operator /=       Overloaded operator /=
860       \param right - Input - The right hand side.       \param right - Input - The right hand side.
861         *
862    */    */
863    Data& operator/=(const Data& right);    Data& operator/=(const Data& right);
864    Data& operator/=(const boost::python::object& right);    Data& operator/=(const boost::python::object& right);
# Line 763  class Data { Line 892  class Data {
892       \brief       \brief
893       Copies slice from value into this Data object.       Copies slice from value into this Data object.
894    
      \description  
895       Implements the [] set operator in python.       Implements the [] set operator in python.
896       Calls setSlice.       Calls setSlice.
897    
# Line 796  class Data { Line 924  class Data {
924       Return a Data object containing the specified slice of       Return a Data object containing the specified slice of
925       this Data object.       this Data object.
926       \param region - Input - Region to copy.       \param region - Input - Region to copy.
927         *
928    */    */
929    Data    Data
930    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
# Line 806  class Data { Line 935  class Data {
935       Data object.       Data object.
936       \param value - Input - Data to copy from.       \param value - Input - Data to copy from.
937       \param region - Input - Region to copy.       \param region - Input - Region to copy.
938         *
939    */    */
940    void    void
941    setSlice(const Data& value,    setSlice(const Data& value,
942             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
943    
944      /**
945         \brief
946         Archive the current Data object to the given file.
947         \param fileName - Input - file to archive to.
948      */
949      void
950      archiveData(const std::string fileName);
951    
952      /**
953         \brief
954         Extract the Data object archived in the given file, overwriting
955         the current Data object.
956         Note - the current object must be of type DataEmpty.
957         \param fileName - Input - file to extract from.
958         \param fspace - Input - a suitable FunctionSpace descibing the data.
959      */
960      void
961      extractData(const std::string fileName,
962                  const FunctionSpace& fspace);
963    
964   protected:   protected:
965    
966   private:   private:
# Line 831  class Data { Line 981  class Data {
981    /**    /**
982       \brief       \brief
983       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
984       this Data object and return the single double value result.       this Data object according to the given function and return the single value result.
985    */    */
986    template <class UnaryFunction>    template <class BinaryFunction>
987    inline    inline
988    double    double
989    algorithm(UnaryFunction operation) const;    algorithm(BinaryFunction operation,
990                double initial_value) const;
991    
992    template <class UnaryFunction>    /**
993         \brief
994         Reduce each data-point in this Data object using the given operation. Return a Data
995         object with the same number of data-points, but with each data-point containing only
996         one value - the result of the reduction operation on the corresponding data-point in
997         this Data object
998      */
999      template <class BinaryFunction>
1000    inline    inline
1001    Data    Data
1002    dp_algorithm(UnaryFunction operation) const;    dp_algorithm(BinaryFunction operation,
1003                   double initial_value) const;
1004    
1005    /**    /**
1006       \brief       \brief
# Line 908  class Data { Line 1067  class Data {
1067    // pointer to the actual data object    // pointer to the actual data object
1068    boost::shared_ptr<DataAbstract> m_data;    boost::shared_ptr<DataAbstract> m_data;
1069    
1070      //
1071      // pointer to the internal profiling data
1072      struct profDataEntry *profData;
1073    
1074  };  };
1075    
1076  template <class IValueType>  template <class IValueType>
# Line 1203  Data::unaryOp(UnaryFunction operation) Line 1366  Data::unaryOp(UnaryFunction operation)
1366    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.
1367    Calls escript::algorithm.    Calls escript::algorithm.
1368  */  */
1369  template <class UnaryFunction>  template <class BinaryFunction>
1370  inline  inline
1371  double  double
1372  Data::algorithm(UnaryFunction operation) const  Data::algorithm(BinaryFunction operation, double initial_value) const
1373  {  {
1374    if (isExpanded()) {    if (isExpanded()) {
1375      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());
1376      EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");      EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");
1377      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1378    } else if (isTagged()) {    } else if (isTagged()) {
1379      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());
1380      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");
1381      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1382    } else if (isConstant()) {    } else if (isConstant()) {
1383      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());
1384      EsysAssert((leftC!=0), "Programming error - casting to DataConstant.");      EsysAssert((leftC!=0), "Programming error - casting to DataConstant.");
1385      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1386    }    }
1387    return 0;    return 0;
1388  }  }
# Line 1232  Data::algorithm(UnaryFunction operation) Line 1395  Data::algorithm(UnaryFunction operation)
1395    rank 0 Data object.    rank 0 Data object.
1396    Calls escript::dp_algorithm.    Calls escript::dp_algorithm.
1397  */  */
1398  template <class UnaryFunction>  template <class BinaryFunction>
1399  inline  inline
1400  Data  Data
1401  Data::dp_algorithm(UnaryFunction operation) const  Data::dp_algorithm(BinaryFunction operation, double initial_value) const
1402  {  {
1403    Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());    Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1404    if (isExpanded()) {    if (isExpanded()) {
# Line 1243  Data::dp_algorithm(UnaryFunction operati Line 1406  Data::dp_algorithm(UnaryFunction operati
1406      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
1407      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");
1408      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");
1409      escript::dp_algorithm(*dataE,*resultE,operation);      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);
1410    } else if (isTagged()) {    } else if (isTagged()) {
1411      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
1412      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());
1413      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");
1414      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");
1415      escript::dp_algorithm(*dataT,*resultT,operation);      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);
1416    } else if (isConstant()) {    } else if (isConstant()) {
1417      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
1418      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
1419      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");
1420      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");
1421      escript::dp_algorithm(*dataC,*resultC,operation);      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);
1422    }    }
1423    return result;    return result;
1424  }  }

Legend:
Removed from v.106  
changed lines
  Added in v.147

  ViewVC Help
Powered by ViewVC 1.1.26