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

revision 480 by jgs, Wed Feb 1 05:15:12 2006 UTC revision 576 by gross, Fri Mar 3 08:28:42 2006 UTC
# Line 145  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 307  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 525  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 537  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 589  class Data { Line 593  class Data {
593       *       *
594    */    */
595    Data    Data
596    wherePositive() const;    wherePositive(double tol=0.0) const;
597    
598    /**    /**
599       \brief       \brief
# Line 597  class Data { Line 601  class Data {
601       *       *
602    */    */
603    Data    Data
604    whereNegative() const;    whereNegative(double tol=0.0) const;
605    
606    /**    /**
607       \brief       \brief
# Line 605  class Data { Line 609  class Data {
609       *       *
610    */    */
611    Data    Data
612    whereNonNegative() const;    whereNonNegative(double tol=0.0) const;
613    
614    /**    /**
615       \brief       \brief
# Line 613  class Data { Line 617  class Data {
617       *       *
618    */    */
619    Data    Data
620    whereNonPositive() const;    whereNonPositive(double tol=0.0) const;
621    
622    /**    /**
623       \brief       \brief
# Line 621  class Data { Line 625  class Data {
625       *       *
626    */    */
627    Data    Data
628    whereZero() const;    whereZero(double tol=0.0) const;
629    
630    /**    /**
631       \brief       \brief
# Line 629  class Data { Line 633  class Data {
633       *       *
634    */    */
635    Data    Data
636    whereNonZero() const;    whereNonZero(double tol=0.0) const;
637    
638    /**    /**
639       \brief       \brief
# Line 710  class Data { Line 714  class Data {
714    
715    /**    /**
716       \brief       \brief
717         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
722      eigenvalues() const;
723    
724      /**
725         \brief
726         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      const boost::python::tuple
734      eigenvalues_and_eigenvectors(const double tol=1.e-12) const;
735    
736      /**
737         \brief
738       Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
739       --* not implemented yet *--       --* not implemented yet *--
740       *       *
# Line 720  class Data { Line 745  class Data {
745    /**    /**
746       \brief       \brief
747       Calculate the trace of each data point of this Data object.       Calculate the trace of each data point of this Data object.
      sum(A[i,i,i,i])  
748       *       *
749    */    */
750    Data    Data
# Line 1478  inline Line 1502  inline
1502  Data  Data
1503  Data::dp_algorithm(BinaryFunction operation, double initial_value) 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,initial_value);      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,initial_value);      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,initial_value);      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.480  
changed lines
  Added in v.576

  ViewVC Help
Powered by ViewVC 1.1.26