/[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 104 by jgs, Fri Dec 17 07:43:12 2004 UTC revision 148 by jgs, Tue Aug 23 01:24:31 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      void
688      calc_mindp(int& SampleNo,
689                 int& DataPointNo) const;
690    
691      /**
692         \brief
693       Return the length of each data point of this Data object.       Return the length of each data point of this Data object.
694       sqrt(sum(A[i,j,k,l]^2))       sqrt(sum(A[i,j,k,l]^2))
695         *
696    */    */
697    Data    Data
698    length() const;    length() const;
# Line 636  class Data { Line 701  class Data {
701       \brief       \brief
702       Return the sign of each data point of this Data object.       Return the sign of each data point of this Data object.
703       -1 for negative values, zero for zero values, 1 for positive values.       -1 for negative values, zero for zero values, 1 for positive values.
704         *
705    */    */
706    Data    Data
707    sign() const;    sign() const;
708    
709    /**    /**
710      \transpose       \brief
711      Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
712         --* not implemented yet *--
713         *
714    */    */
715    Data    Data
716    transpose(int axis) const;    transpose(int axis) const;
717    
718    /**    /**
719      \trace       \brief
720      Calculate the trace of each data point of this Data object.       Calculate the trace of each data point of this Data object.
721      sum(A[i,i,i,i])       sum(A[i,i,i,i])
722         *
723    */    */
724    Data    Data
725    trace() const;    trace() const;
726    
727    /**    /**
728      \exp       \brief
729      Return the exponential function of each data point of this Data object.       Return the sin of each data point of this Data object.
730         *
731    */    */
732    Data    Data
733    exp() const;    sin() const;
734    
735    /**    /**
736      \sqrt       \brief
737      Return the square root of each data point of this Data object.       Return the cos of each data point of this Data object.
738         *
739    */    */
740    Data    Data
741    sqrt() const;    cos() const;
742    
743    /**    /**
744       \brief       \brief
745       Return the given power of each data point of this Data object.       Return the tan of each data point of this Data object.
746         *
747    */    */
748    Data    Data
749    powD(const Data& right) const;    tan() const;
750    
751      /**
752         \brief
753         Return the log to base 10 of each data point of this Data object.
754         *
755      */
756    Data    Data
757    powO(const boost::python::object& right) const;    log() const;
758    
759    /**    /**
760      \brief       \brief
761      writes the object to a file in the DX file format       Return the natural log of each data point of this Data object.
762         *
763    */    */
764    void    Data
765    saveDX(std::string fileName) const;    ln() const;
766    
767    /**    /**
768      \brief       \brief
769      Return the negation of each data point of this Data object.       Return the exponential function of each data point of this Data object.
770         *
771      */
772      Data
773      exp() const;
774    
775      /**
776         \brief
777         Return the square root of each data point of this Data object.
778         *
779      */
780      Data
781      sqrt() const;
782    
783      /**
784         \brief
785         Return the negation of each data point of this Data object.
786         *
787    */    */
788    Data    Data
789    neg() const;    neg() const;
790    
791    /**    /**
792      \brief       \brief
793      Return the identity of each data point of this Data object.       Return the identity of each data point of this Data object.
794      Simply returns this object unmodified.       Simply returns this object unmodified.
795         *
796    */    */
797    Data    Data
798    pos() const;    pos() const;
799    
800    /**    /**
801       \brief       \brief
802         Return the given power of each data point of this Data object.
803    
804         \param right Input - the power to raise the object to.
805         *
806      */
807      Data
808      powD(const Data& right) const;
809    
810      /**
811         \brief
812         Return the given power of each data point of this boost python object.
813        
814         \param right Input - the power to raise the object to.
815         *
816       */
817      Data
818      powO(const boost::python::object& right) const;
819    
820      /**
821         \brief
822         writes the object to a file in the DX file format
823      */
824      void
825      saveDX(std::string fileName) const;
826    
827      /**
828         \brief
829         writes the object to a file in the VTK file format
830      */
831      void
832      saveVTK(std::string fileName) const;
833    
834      /**
835         \brief
836       Overloaded operator +=       Overloaded operator +=
837       \param right - Input - The right hand side.       \param right - Input - The right hand side.
838         *
839    */    */
840    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
841    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
# Line 713  class Data { Line 844  class Data {
844       \brief       \brief
845       Overloaded operator -=       Overloaded operator -=
846       \param right - Input - The right hand side.       \param right - Input - The right hand side.
847         *
848    */    */
849    Data& operator-=(const Data& right);    Data& operator-=(const Data& right);
850    Data& operator-=(const boost::python::object& right);    Data& operator-=(const boost::python::object& right);
# Line 721  class Data { Line 853  class Data {
853       \brief       \brief
854       Overloaded operator *=       Overloaded operator *=
855       \param right - Input - The right hand side.       \param right - Input - The right hand side.
856         *
857    */    */
858    Data& operator*=(const Data& right);    Data& operator*=(const Data& right);
859    Data& operator*=(const boost::python::object& right);    Data& operator*=(const boost::python::object& right);
# Line 729  class Data { Line 862  class Data {
862       \brief       \brief
863       Overloaded operator /=       Overloaded operator /=
864       \param right - Input - The right hand side.       \param right - Input - The right hand side.
865         *
866    */    */
867    Data& operator/=(const Data& right);    Data& operator/=(const Data& right);
868    Data& operator/=(const boost::python::object& right);    Data& operator/=(const boost::python::object& right);
# Line 762  class Data { Line 896  class Data {
896       \brief       \brief
897       Copies slice from value into this Data object.       Copies slice from value into this Data object.
898    
      \description  
899       Implements the [] set operator in python.       Implements the [] set operator in python.
900       Calls setSlice.       Calls setSlice.
901    
# Line 795  class Data { Line 928  class Data {
928       Return a Data object containing the specified slice of       Return a Data object containing the specified slice of
929       this Data object.       this Data object.
930       \param region - Input - Region to copy.       \param region - Input - Region to copy.
931         *
932    */    */
933    Data    Data
934    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
# Line 805  class Data { Line 939  class Data {
939       Data object.       Data object.
940       \param value - Input - Data to copy from.       \param value - Input - Data to copy from.
941       \param region - Input - Region to copy.       \param region - Input - Region to copy.
942         *
943    */    */
944    void    void
945    setSlice(const Data& value,    setSlice(const Data& value,
946             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
947    
948      /**
949         \brief
950         Archive the current Data object to the given file.
951         \param fileName - Input - file to archive to.
952      */
953      void
954      archiveData(const std::string fileName);
955    
956      /**
957         \brief
958         Extract the Data object archived in the given file, overwriting
959         the current Data object.
960         Note - the current object must be of type DataEmpty.
961         \param fileName - Input - file to extract from.
962         \param fspace - Input - a suitable FunctionSpace descibing the data.
963      */
964      void
965      extractData(const std::string fileName,
966                  const FunctionSpace& fspace);
967    
968   protected:   protected:
969    
970   private:   private:
# Line 830  class Data { Line 985  class Data {
985    /**    /**
986       \brief       \brief
987       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
988       this Data object and return the single double value result.       this Data object according to the given function and return the single value result.
989    */    */
990    template <class UnaryFunction>    template <class BinaryFunction>
991    inline    inline
992    double    double
993    algorithm(UnaryFunction operation) const;    algorithm(BinaryFunction operation,
994                double initial_value) const;
995    
996      /**
997         \brief
998         Reduce each data-point in this Data object using the given operation. Return a Data
999         object with the same number of data-points, but with each data-point containing only
1000         one value - the result of the reduction operation on the corresponding data-point in
1001         this Data object
1002      */
1003      template <class BinaryFunction>
1004      inline
1005      Data
1006      dp_algorithm(BinaryFunction operation,
1007                   double initial_value) const;
1008    
1009    /**    /**
1010       \brief       \brief
# Line 902  class Data { Line 1071  class Data {
1071    // pointer to the actual data object    // pointer to the actual data object
1072    boost::shared_ptr<DataAbstract> m_data;    boost::shared_ptr<DataAbstract> m_data;
1073    
1074      //
1075      // pointer to the internal profiling data
1076      struct profDataEntry *profData;
1077    
1078  };  };
1079    
1080  template <class IValueType>  template <class IValueType>
# Line 1197  Data::unaryOp(UnaryFunction operation) Line 1370  Data::unaryOp(UnaryFunction operation)
1370    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.
1371    Calls escript::algorithm.    Calls escript::algorithm.
1372  */  */
1373  template <class UnaryFunction>  template <class BinaryFunction>
1374  inline  inline
1375  double  double
1376  Data::algorithm(UnaryFunction operation) const  Data::algorithm(BinaryFunction operation, double initial_value) const
1377  {  {
1378    if (isExpanded()) {    if (isExpanded()) {
1379      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());
1380      EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");      EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");
1381      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1382    } else if (isTagged()) {    } else if (isTagged()) {
1383      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());
1384      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");
1385      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1386    } else if (isConstant()) {    } else if (isConstant()) {
1387      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());
1388      EsysAssert((leftC!=0), "Programming error - casting to DataConstant.");      EsysAssert((leftC!=0), "Programming error - casting to DataConstant.");
1389      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1390    }    }
1391    return 0;    return 0;
1392  }  }
# Line 1226  Data::algorithm(UnaryFunction operation) Line 1399  Data::algorithm(UnaryFunction operation)
1399    rank 0 Data object.    rank 0 Data object.
1400    Calls escript::dp_algorithm.    Calls escript::dp_algorithm.
1401  */  */
1402  template <class UnaryFunction>  template <class BinaryFunction>
1403  inline  inline
1404  Data  Data
1405  dp_algorithm(const Data& data,  Data::dp_algorithm(BinaryFunction operation, double initial_value) const
              UnaryFunction operation)  
1406  {  {
1407    Data result(0,DataArrayView::ShapeType(),data.getFunctionSpace(),data.isExpanded());    Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1408    if (data.isExpanded()) {    if (isExpanded()) {
1409      DataExpanded* dataE=dynamic_cast<DataExpanded*>(data.m_data.get());      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());
1410      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
1411      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");
1412      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");
1413      escript::dp_algorithm(*dataE,*resultE,operation);      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);
1414    } else if (data.isTagged()) {    } else if (isTagged()) {
1415      DataTagged* dataT=dynamic_cast<DataTagged*>(data.m_data.get());      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
1416      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());
1417      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");
1418      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");
1419      escript::dp_algorithm(*dataT,*resultT,operation);      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);
1420    } else if (data.isConstant()) {    } else if (isConstant()) {
1421      DataConstant* dataC=dynamic_cast<DataConstant*>(data.m_data.get());      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
1422      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
1423      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");
1424      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");
1425      escript::dp_algorithm(*dataC,*resultC,operation);      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);
1426    }    }
1427    return result;    return result;
1428  }  }

Legend:
Removed from v.104  
changed lines
  Added in v.148

  ViewVC Help
Powered by ViewVC 1.1.26