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

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

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

trunk/esys2/escript/src/Data/Data.h revision 121 by jgs, Fri May 6 04:26:16 2005 UTC trunk/escript/src/Data.h revision 576 by gross, Fri Mar 3 08:28:42 2006 UTC
# Line 18  Line 18 
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 {  namespace escript {
41    
42  //  //
43  // Forward declaration for various implimentations of Data.  // Forward declaration for various implementations of Data.
 class DataEmpty;  
44  class DataConstant;  class DataConstant;
45  class DataTagged;  class DataTagged;
46  class DataExpanded;  class DataExpanded;
# Line 149  class Data { Line 145  class Data {
145       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
146       \param expanded - Input - Flag, if true fill the entire container with       \param expanded - Input - Flag, if true fill the entire container with
147                         the appropriate values.                         the appropriate values.
148        ==>*
149    */    */
150    Data(const DataTagged::TagListType& tagKeys,    Data(const DataTagged::TagListType& tagKeys,
151         const DataTagged::ValueListType& values,         const DataTagged::ValueListType& values,
# Line 205  class Data { Line 202  class Data {
202         const boost::python::tuple& shape=boost::python::make_tuple(),         const boost::python::tuple& shape=boost::python::make_tuple(),
203         const FunctionSpace& what=FunctionSpace(),         const FunctionSpace& what=FunctionSpace(),
204         bool expanded=false);         bool expanded=false);
205      /**
206         \brief
207         Destructor
208      */
209      ~Data();
210    
211    /**    /**
212       \brief       \brief
# Line 241  class Data { Line 243  class Data {
243    
244    /**    /**
245       \brief       \brief
246         Fills the expanded Data object from values of a python numarray object.
247      */
248      void
249      fillFromNumArray(const boost::python::numeric::array);
250    
251      /**
252         \brief
253         Return the tag number associated with the given data-point.
254    
255         The data-point number here corresponds to the data-point number in the
256         numarray returned by convertToNumArray.
257      */
258      int
259      getTagNumber(int dpno);
260    
261      /**
262         \brief
263       Return the C wrapper for the Data object.       Return the C wrapper for the Data object.
264    */    */
265    escriptDataC    escriptDataC
# Line 289  class Data { Line 308  class Data {
308       If possible convert this Data to DataTagged. This will only allow       If possible convert this Data to DataTagged. This will only allow
309       Constant data to be converted to tagged. An attempt to convert       Constant data to be converted to tagged. An attempt to convert
310       Expanded data to tagged will throw an exception.       Expanded data to tagged will throw an exception.
311        ==>*
312    */    */
313    void    void
314    tag();    tag();
# Line 507  class Data { Line 527  class Data {
527       cannot be converted to a DataTagged object.       cannot be converted to a DataTagged object.
528       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
529       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
530        ==>*
531    */    */
532    void    void
533    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
# Line 519  class Data { Line 540  class Data {
540       cannot be converted to a DataTagged object.       cannot be converted to a DataTagged object.
541       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
542       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
543        ==>*
544    */    */
545    void    void
546    setTaggedValueFromCPP(int tagKey,    setTaggedValueFromCPP(int tagKey,
# Line 540  class Data { Line 562  class Data {
562       \brief       \brief
563       Interpolates this onto the given functionspace and returns       Interpolates this onto the given functionspace and returns
564       the result as a Data object.       the result as a Data object.
565         *
566    */    */
567    Data    Data
568    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
# Line 548  class Data { Line 571  class Data {
571       \brief       \brief
572       Calculates the gradient of the data at the data points of functionspace.       Calculates the gradient of the data at the data points of functionspace.
573       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.
574         *
575    */    */
576    Data    Data
577    gradOn(const FunctionSpace& functionspace) const;    gradOn(const FunctionSpace& functionspace) const;
# Line 558  class Data { Line 582  class Data {
582    /**    /**
583       \brief       \brief
584       Calculate the integral over the function space domain.       Calculate the integral over the function space domain.
585         *
586    */    */
587    boost::python::numeric::array    boost::python::numeric::array
588    integrate() const;    integrate() const;
# Line 565  class Data { Line 590  class Data {
590    /**    /**
591       \brief       \brief
592       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.
593         *
594    */    */
595    Data    Data
596    wherePositive() const;    wherePositive(double tol=0.0) const;
597    
598    /**    /**
599       \brief       \brief
600       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.
601         *
602    */    */
603    Data    Data
604    whereNegative() const;    whereNegative(double tol=0.0) const;
605    
606    /**    /**
607       \brief       \brief
608       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.
609         *
610    */    */
611    Data    Data
612    whereNonNegative() const;    whereNonNegative(double tol=0.0) const;
613    
614    /**    /**
615       \brief       \brief
616       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.
617         *
618    */    */
619    Data    Data
620    whereNonPositive() const;    whereNonPositive(double tol=0.0) const;
621    
622    /**    /**
623       \brief       \brief
624       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.
625         *
626    */    */
627    Data    Data
628    whereZero() const;    whereZero(double tol=0.0) const;
629    
630    /**    /**
631       \brief       \brief
632       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.
633         *
634    */    */
635    Data    Data
636    whereNonZero() const;    whereNonZero(double tol=0.0) const;
637    
638    /**    /**
639       \brief       \brief
640       Return the sin of each data point of this Data object.       Return the maximum absolute value of this Data object.
641         *
642      */
643      double
644      Lsup() const;
645    
646      /**
647         \brief
648         Return the minimum absolute value of this Data object.
649         *
650      */
651      double
652      Linf() const;
653    
654      /**
655         \brief
656         Return the maximum value of this Data object.
657         *
658      */
659      double
660      sup() const;
661    
662      /**
663         \brief
664         Return the minimum value of this Data object.
665         *
666      */
667      double
668      inf() const;
669    
670      /**
671         \brief
672         Return the absolute value of each data point of this Data object.
673         *
674    */    */
675    Data    Data
676    sin() const;    abs() const;
677    
678    /**    /**
679       \brief       \brief
680       Return the cos of each data point of this Data object.       Return the maximum value of each data point of this Data object.
681         *
682    */    */
683    Data    Data
684    cos() const;    maxval() const;
685    
686    /**    /**
687       \brief       \brief
688       Return the tan of each data point of this Data object.       Return the minimum value of each data point of this Data object.
689         *
690    */    */
691    Data    Data
692    tan() const;    minval() const;
693    
694    /**    /**
695       \brief       \brief
696       Return the log to base 10 of each data point of this Data object.       Return the (sample number, data-point number) of the data point with
697         the minimum value in this Data object.
698      */
699      const boost::python::tuple
700      mindp() const;
701    
702      void
703      calc_mindp(int& SampleNo,
704                 int& DataPointNo) const;
705    
706      /**
707         \brief
708         Return the sign of each data point of this Data object.
709         -1 for negative values, zero for zero values, 1 for positive values.
710         *
711    */    */
712    Data    Data
713    log() const;    sign() const;
714    
715    /**    /**
716       \brief       \brief
717       Return the natural log of each data point of this Data object.       Return the eigenvalues of the symmetric part at each data point of this Data object in increasing values.
718         Currently this function is restricted to rank 2, square shape, and dimension 3.
719         *
720    */    */
721    Data    Data
722    ln() const;    eigenvalues() const;
723    
724    /**    /**
725       \brief       \brief
726       Return the maximum absolute value of this Data object.       Return the eigenvalues and corresponding eigenvcetors of the symmetric part at each data point of this Data object.
727         the eigenvalues are ordered in increasing size where eigenvalues with relative difference less than
728         tol are treated as equal. The eigenvectors are orthogonal, normalized and the sclaed such that the
729         first non-zero entry is positive.
730         Currently this function is restricted to rank 2, square shape, and dimension 3
731         *
732    */    */
733    double    const boost::python::tuple
734    Lsup() const;    eigenvalues_and_eigenvectors(const double tol=1.e-12) const;
735    
736    /**    /**
737       \brief       \brief
738       Return the minimum absolute value of this Data object.       Transpose each data point of this Data object around the given axis.
739         --* not implemented yet *--
740         *
741    */    */
742    double    Data
743    Linf() const;    transpose(int axis) const;
744    
745    /**    /**
746       \brief       \brief
747       Return the maximum value of this Data object.       Calculate the trace of each data point of this Data object.
748         *
749    */    */
750    double    Data
751    sup() const;    trace() const;
752    
753    /**    /**
754       \brief       \brief
755       Return the minimum value of this Data object.       Return the sin of each data point of this Data object.
756         *
757    */    */
758    double    Data
759    inf() const;    sin() const;
760    
761    /**    /**
762       \brief       \brief
763       Return the absolute value of each data point of this Data object.       Return the cos of each data point of this Data object.
764         *
765    */    */
766    Data    Data
767    abs() const;    cos() const;
768    
769    /**    /**
770       \brief       \brief
771       Return the maximum value of each data point of this Data object.       Return the tan of each data point of this Data object.
772         *
773    */    */
774    Data    Data
775    maxval() const;    tan() const;
776    
777    /**    /**
778       \brief       \brief
779       Return the minimum value of each data point of this Data object.       Return the asin of each data point of this Data object.
780         *
781    */    */
782    Data    Data
783    minval() const;    asin() const;
784    
785    /**    /**
786       \brief       \brief
787       Return the (sample number, data-point number) of the data point with       Return the acos of each data point of this Data object.
788       the minimum value in this Data object.       *
789    */    */
790    const boost::python::tuple    Data
791    mindp() const;    acos() const;
792    
793    /**    /**
794       \brief       \brief
795       Return the length of each data point of this Data object.       Return the atan of each data point of this Data object.
796       sqrt(sum(A[i,j,k,l]^2))       *
797    */    */
798    Data    Data
799    length() const;    atan() const;
800    
801    /**    /**
802       \brief       \brief
803       Return the sign of each data point of this Data object.       Return the sinh of each data point of this Data object.
804       -1 for negative values, zero for zero values, 1 for positive values.       *
805    */    */
806    Data    Data
807    sign() const;    sinh() const;
808    
809    /**    /**
810      \brief       \brief
811      Transpose each data point of this Data object around the given axis.       Return the cosh of each data point of this Data object.
812      --* not implemented yet *--       *
813    */    */
814    Data    Data
815    transpose(int axis) const;    cosh() const;
816    
817    /**    /**
818      \brief       \brief
819      Calculate the trace of each data point of this Data object.       Return the tanh of each data point of this Data object.
820      sum(A[i,i,i,i])       *
821    */    */
822    Data    Data
823    trace() const;    tanh() const;
824    
825    /**    /**
826      \brief       \brief
827      Return the exponential function of each data point of this Data object.       Return the asinh of each data point of this Data object.
828         *
829      */
830      Data
831      asinh() const;
832    
833      /**
834         \brief
835         Return the acosh of each data point of this Data object.
836         *
837      */
838      Data
839      acosh() const;
840    
841      /**
842         \brief
843         Return the atanh of each data point of this Data object.
844         *
845      */
846      Data
847      atanh() const;
848    
849      /**
850         \brief
851         Return the log to base 10 of each data point of this Data object.
852         *
853      */
854      Data
855      log10() const;
856    
857      /**
858         \brief
859         Return the natural log of each data point of this Data object.
860         *
861      */
862      Data
863      log() const;
864    
865      /**
866         \brief
867         Return the exponential function of each data point of this Data object.
868         *
869    */    */
870    Data    Data
871    exp() const;    exp() const;
872    
873    /**    /**
874      \brief       \brief
875      Return the square root of each data point of this Data object.       Return the square root of each data point of this Data object.
876         *
877    */    */
878    Data    Data
879    sqrt() const;    sqrt() const;
880    
881    /**    /**
882      \brief       \brief
883      Return the negation of each data point of this Data object.       Return the negation of each data point of this Data object.
884         *
885    */    */
886    Data    Data
887    neg() const;    neg() const;
888    
889    /**    /**
890      \brief       \brief
891      Return the identity of each data point of this Data object.       Return the identity of each data point of this Data object.
892      Simply returns this object unmodified.       Simply returns this object unmodified.
893         *
894    */    */
895    Data    Data
896    pos() const;    pos() const;
# Line 762  class Data { Line 900  class Data {
900       Return the given power of each data point of this Data object.       Return the given power of each data point of this Data object.
901    
902       \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
903         *
904    */    */
905    Data    Data
906    powD(const Data& right) const;    powD(const Data& right) const;
907    
908    /**    /**
909     * \brief       \brief
910     * Return the given power of each data point of this boost python object.       Return the given power of each data point of this boost python object.
911     *      
912     * \param right Input - the power to raise the object to.       \param right Input - the power to raise the object to.
913         *
914     */     */
915    Data    Data
916    powO(const boost::python::object& right) const;    powO(const boost::python::object& right) const;
917    
918    /**    /**
919      \brief       \brief
920      writes the object to a file in the DX file format       writes the object to a file in the DX file format
921    */    */
922    void    void
923    saveDX(std::string fileName) const;    saveDX(std::string fileName) const;
924    
925    /**    /**
926      \brief       \brief
927      writes the object to a file in the VTK file format       writes the object to a file in the VTK file format
928    */    */
929    void    void
930    saveVTK(std::string fileName) const;    saveVTK(std::string fileName) const;
# Line 793  class Data { Line 933  class Data {
933       \brief       \brief
934       Overloaded operator +=       Overloaded operator +=
935       \param right - Input - The right hand side.       \param right - Input - The right hand side.
936         *
937    */    */
938    Data& operator+=(const Data& right);    Data& operator+=(const Data& right);
939    Data& operator+=(const boost::python::object& right);    Data& operator+=(const boost::python::object& right);
# Line 801  class Data { Line 942  class Data {
942       \brief       \brief
943       Overloaded operator -=       Overloaded operator -=
944       \param right - Input - The right hand side.       \param right - Input - The right hand side.
945         *
946    */    */
947    Data& operator-=(const Data& right);    Data& operator-=(const Data& right);
948    Data& operator-=(const boost::python::object& right);    Data& operator-=(const boost::python::object& right);
# Line 809  class Data { Line 951  class Data {
951       \brief       \brief
952       Overloaded operator *=       Overloaded operator *=
953       \param right - Input - The right hand side.       \param right - Input - The right hand side.
954         *
955    */    */
956    Data& operator*=(const Data& right);    Data& operator*=(const Data& right);
957    Data& operator*=(const boost::python::object& right);    Data& operator*=(const boost::python::object& right);
# Line 817  class Data { Line 960  class Data {
960       \brief       \brief
961       Overloaded operator /=       Overloaded operator /=
962       \param right - Input - The right hand side.       \param right - Input - The right hand side.
963         *
964    */    */
965    Data& operator/=(const Data& right);    Data& operator/=(const Data& right);
966    Data& operator/=(const boost::python::object& right);    Data& operator/=(const boost::python::object& right);
# Line 882  class Data { Line 1026  class Data {
1026       Return a Data object containing the specified slice of       Return a Data object containing the specified slice of
1027       this Data object.       this Data object.
1028       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1029         *
1030    */    */
1031    Data    Data
1032    getSlice(const DataArrayView::RegionType& region) const;    getSlice(const DataArrayView::RegionType& region) const;
# Line 892  class Data { Line 1037  class Data {
1037       Data object.       Data object.
1038       \param value - Input - Data to copy from.       \param value - Input - Data to copy from.
1039       \param region - Input - Region to copy.       \param region - Input - Region to copy.
1040         *
1041    */    */
1042    void    void
1043    setSlice(const Data& value,    setSlice(const Data& value,
# Line 939  class Data { Line 1085  class Data {
1085       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
1086       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.
1087    */    */
1088    template <class UnaryFunction>    template <class BinaryFunction>
1089    inline    inline
1090    double    double
1091    algorithm(UnaryFunction operation) const;    algorithm(BinaryFunction operation,
1092                double initial_value) const;
1093    
1094    /**    /**
1095       \brief       \brief
# Line 951  class Data { Line 1098  class Data {
1098       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
1099       this Data object       this Data object
1100    */    */
1101    template <class UnaryFunction>    template <class BinaryFunction>
1102    inline    inline
1103    Data    Data
1104    dp_algorithm(UnaryFunction operation) const;    dp_algorithm(BinaryFunction operation,
1105                   double initial_value) const;
1106    
1107    /**    /**
1108       \brief       \brief
# Line 1021  class Data { Line 1169  class Data {
1169    // pointer to the actual data object    // pointer to the actual data object
1170    boost::shared_ptr<DataAbstract> m_data;    boost::shared_ptr<DataAbstract> m_data;
1171    
1172      //
1173      // pointer to the internal profiling data
1174      struct profDataEntry *profData;
1175    
1176  };  };
1177    
1178  template <class IValueType>  template <class IValueType>
# Line 1316  Data::unaryOp(UnaryFunction operation) Line 1468  Data::unaryOp(UnaryFunction operation)
1468    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.
1469    Calls escript::algorithm.    Calls escript::algorithm.
1470  */  */
1471  template <class UnaryFunction>  template <class BinaryFunction>
1472  inline  inline
1473  double  double
1474  Data::algorithm(UnaryFunction operation) const  Data::algorithm(BinaryFunction operation, double initial_value) const
1475  {  {
1476    if (isExpanded()) {    if (isExpanded()) {
1477      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* leftC=dynamic_cast<DataExpanded*>(m_data.get());
1478      EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");      EsysAssert((leftC!=0), "Programming error - casting to DataExpanded.");
1479      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1480    } else if (isTagged()) {    } else if (isTagged()) {
1481      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* leftC=dynamic_cast<DataTagged*>(m_data.get());
1482      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");      EsysAssert((leftC!=0), "Programming error - casting to DataTagged.");
1483      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1484    } else if (isConstant()) {    } else if (isConstant()) {
1485      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* leftC=dynamic_cast<DataConstant*>(m_data.get());
1486      EsysAssert((leftC!=0), "Programming error - casting to DataConstant.");      EsysAssert((leftC!=0), "Programming error - casting to DataConstant.");
1487      return escript::algorithm(*leftC,operation);      return escript::algorithm(*leftC,operation,initial_value);
1488    }    }
1489    return 0;    return 0;
1490  }  }
# Line 1345  Data::algorithm(UnaryFunction operation) Line 1497  Data::algorithm(UnaryFunction operation)
1497    rank 0 Data object.    rank 0 Data object.
1498    Calls escript::dp_algorithm.    Calls escript::dp_algorithm.
1499  */  */
1500  template <class UnaryFunction>  template <class BinaryFunction>
1501  inline  inline
1502  Data  Data
1503  Data::dp_algorithm(UnaryFunction operation) const  Data::dp_algorithm(BinaryFunction operation, double initial_value) const
1504  {  {
   Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());  
1505    if (isExpanded()) {    if (isExpanded()) {
1506        Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1507      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());
1508      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
1509      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");
1510      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");
1511      escript::dp_algorithm(*dataE,*resultE,operation);      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);
1512        return result;
1513    } else if (isTagged()) {    } else if (isTagged()) {
1514      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
1515        DataArrayView::ShapeType viewShape;
1516        DataArrayView::ValueType viewData(1);
1517        viewData[0]=0;
1518        DataArrayView defaultValue(viewData,viewShape);
1519        DataTagged::TagListType keys;
1520        DataTagged::ValueListType values;
1521        DataTagged::DataMapType::const_iterator i;
1522        for (i=dataT->getTagLookup().begin();i!=dataT->getTagLookup().end();i++) {
1523          keys.push_back(i->first);
1524          values.push_back(defaultValue);
1525        }
1526        Data result(keys,values,defaultValue,getFunctionSpace());
1527      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());
1528      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");
1529      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");
1530      escript::dp_algorithm(*dataT,*resultT,operation);      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);
1531        return result;
1532    } else if (isConstant()) {    } else if (isConstant()) {
1533        Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1534      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
1535      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
1536      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");
1537      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");
1538      escript::dp_algorithm(*dataC,*resultC,operation);      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);
1539        return result;
1540    }    }
1541    return result;    Data falseRetVal; // to keep compiler quiet
1542      return falseRetVal;
1543  }  }
1544    
1545  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26