/[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 480 by jgs, Wed Feb 1 05:15:12 2006 UTC revision 751 by bcumming, Mon Jun 26 01:46:34 2006 UTC
# Line 1  Line 1 
1  // $Id$  // $Id$
2  /*  /*
3   ******************************************************************************   ************************************************************
4   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
5   *       COPYRIGHT ACcESS 2004 -  All Rights Reserved                         *   *                                                          *
6   *                                                                            *   *              http://www.access.edu.au                    *
7   * This software is the property of ACcESS.  No part of this code             *   *       Primary Business: Queensland, Australia            *
8   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
9   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
10   * by any unauthorised person is illegal unless that                          *   *                                                          *
11   * person has a software license agreement with ACcESS.                       *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
12  */  */
13    
14  /** \file Data.h */  /** \file Data.h */
# Line 27  Line 25 
25    
26  extern "C" {  extern "C" {
27  #include "DataC.h"  #include "DataC.h"
28    #include "./paso/Paso.h"
29  }  }
30    
31  #include <string>  #include <string>
# Line 145  class Data { Line 144  class Data {
144       \param what - Input - A description of what this data represents.       \param what - Input - A description of what this data represents.
145       \param expanded - Input - Flag, if true fill the entire container with       \param expanded - Input - Flag, if true fill the entire container with
146                         the appropriate values.                         the appropriate values.
147        ==>*
148    */    */
149    Data(const DataTagged::TagListType& tagKeys,    Data(const DataTagged::TagListType& tagKeys,
150         const DataTagged::ValueListType& values,         const DataTagged::ValueListType& values,
# Line 307  class Data { Line 307  class Data {
307       If possible convert this Data to DataTagged. This will only allow       If possible convert this Data to DataTagged. This will only allow
308       Constant data to be converted to tagged. An attempt to convert       Constant data to be converted to tagged. An attempt to convert
309       Expanded data to tagged will throw an exception.       Expanded data to tagged will throw an exception.
310        ==>*
311    */    */
312    void    void
313    tag();    tag();
# Line 525  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.
529        ==>*
530    */    */
531    void    void
532    setTaggedValue(int tagKey,    setTaggedValue(int tagKey,
# Line 537  class Data { Line 539  class Data {
539       cannot be converted to a DataTagged object.       cannot be converted to a DataTagged object.
540       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
541       \param value - Input - Value to associate with given key.       \param value - Input - Value to associate with given key.
542        ==>*
543    */    */
544    void    void
545    setTaggedValueFromCPP(int tagKey,    setTaggedValueFromCPP(int tagKey,
# Line 621  class Data { Line 624  class Data {
624       *       *
625    */    */
626    Data    Data
627    whereZero() const;    whereZero(double tol=0.0) const;
628    
629    /**    /**
630       \brief       \brief
# Line 629  class Data { Line 632  class Data {
632       *       *
633    */    */
634    Data    Data
635    whereNonZero() const;    whereNonZero(double tol=0.0) const;
636    
637    /**    /**
638       \brief       \brief
# Line 710  class Data { Line 713  class Data {
713    
714    /**    /**
715       \brief       \brief
716         Return the eigenvalues of the symmetric part at each data point of this Data object in increasing values.
717         Currently this function is restricted to rank 2, square shape, and dimension 3.
718         *
719      */
720      Data
721      eigenvalues() const;
722    
723      /**
724         \brief
725         Return the eigenvalues and corresponding eigenvcetors of the symmetric part at each data point of this Data object.
726         the eigenvalues are ordered in increasing size where eigenvalues with relative difference less than
727         tol are treated as equal. The eigenvectors are orthogonal, normalized and the sclaed such that the
728         first non-zero entry is positive.
729         Currently this function is restricted to rank 2, square shape, and dimension 3
730         *
731      */
732      const boost::python::tuple
733      eigenvalues_and_eigenvectors(const double tol=1.e-12) const;
734    
735      /**
736         \brief
737       Transpose each data point of this Data object around the given axis.       Transpose each data point of this Data object around the given axis.
738       --* not implemented yet *--       --* not implemented yet *--
739       *       *
# Line 720  class Data { Line 744  class Data {
744    /**    /**
745       \brief       \brief
746       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])  
747       *       *
748    */    */
749    Data    Data
# Line 893  class Data { Line 916  class Data {
916    
917    /**    /**
918       \brief       \brief
919         Return the given power of each data point of this boost python object.
920        
921         \param left Input - the bases
922         *
923       */
924    
925      Data
926      rpowO(const boost::python::object& left) const;
927    
928      /**
929         \brief
930       writes the object to a file in the DX file format       writes the object to a file in the DX file format
931    */    */
932    void    void
# Line 1039  class Data { Line 1073  class Data {
1073    extractData(const std::string fileName,    extractData(const std::string fileName,
1074                const FunctionSpace& fspace);                const FunctionSpace& fspace);
1075    
1076    
1077      /**
1078         \brief
1079         print the data values to stdout. Used for debugging
1080      */
1081      void print();
1082    
1083   protected:   protected:
1084    
1085   private:   private:
# Line 1478  inline Line 1519  inline
1519  Data  Data
1520  Data::dp_algorithm(BinaryFunction operation, double initial_value) const  Data::dp_algorithm(BinaryFunction operation, double initial_value) const
1521  {  {
   Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());  
1522    if (isExpanded()) {    if (isExpanded()) {
1523        Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1524      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());      DataExpanded* dataE=dynamic_cast<DataExpanded*>(m_data.get());
1525      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());      DataExpanded* resultE=dynamic_cast<DataExpanded*>(result.m_data.get());
1526      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");      EsysAssert((dataE!=0), "Programming error - casting data to DataExpanded.");
1527      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");      EsysAssert((resultE!=0), "Programming error - casting result to DataExpanded.");
1528      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);      escript::dp_algorithm(*dataE,*resultE,operation,initial_value);
1529        return result;
1530    } else if (isTagged()) {    } else if (isTagged()) {
1531      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());      DataTagged* dataT=dynamic_cast<DataTagged*>(m_data.get());
1532        DataArrayView::ShapeType viewShape;
1533        DataArrayView::ValueType viewData(1);
1534        viewData[0]=0;
1535        DataArrayView defaultValue(viewData,viewShape);
1536        DataTagged::TagListType keys;
1537        DataTagged::ValueListType values;
1538        DataTagged::DataMapType::const_iterator i;
1539        for (i=dataT->getTagLookup().begin();i!=dataT->getTagLookup().end();i++) {
1540          keys.push_back(i->first);
1541          values.push_back(defaultValue);
1542        }
1543        Data result(keys,values,defaultValue,getFunctionSpace());
1544      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());      DataTagged* resultT=dynamic_cast<DataTagged*>(result.m_data.get());
1545      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");      EsysAssert((dataT!=0), "Programming error - casting data to DataTagged.");
1546      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");      EsysAssert((resultT!=0), "Programming error - casting result to DataTagged.");
1547      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);      escript::dp_algorithm(*dataT,*resultT,operation,initial_value);
1548        return result;
1549    } else if (isConstant()) {    } else if (isConstant()) {
1550        Data result(0,DataArrayView::ShapeType(),getFunctionSpace(),isExpanded());
1551      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());      DataConstant* dataC=dynamic_cast<DataConstant*>(m_data.get());
1552      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());      DataConstant* resultC=dynamic_cast<DataConstant*>(result.m_data.get());
1553      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");      EsysAssert((dataC!=0), "Programming error - casting data to DataConstant.");
1554      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");      EsysAssert((resultC!=0), "Programming error - casting result to DataConstant.");
1555      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);      escript::dp_algorithm(*dataC,*resultC,operation,initial_value);
1556        return result;
1557    }    }
1558    return result;    Data falseRetVal; // to keep compiler quiet
1559      return falseRetVal;
1560  }  }
1561    
1562  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26