/[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 113 by jgs, Mon Feb 28 07:06:33 2005 UTC revision 122 by jgs, Thu Jun 9 05:38:05 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"
# Line 40  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 55  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:
# Line 223  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
230         Return the values of all data-points for the given sample as a single python numarray object.
231      */
232      const boost::python::numeric::array
233      convertToNumArrayFromSampleNo(int sampleNo);
234    
235      /**
236         \brief
237         Return the value of the specified data-point as a single python numarray object.
238      */
239      const boost::python::numeric::array
240      convertToNumArrayFromDPNo(int sampleNo,
241                                int dataPointNo);
242    
243      /**
244         \brief
245       Return the C wrapper for the Data object.       Return the C wrapper for the Data object.
246    */    */
247    escriptDataC    escriptDataC
# Line 464  class Data { Line 483  class Data {
483       \brief       \brief
484       Return the data point shape as a tuple of integers.       Return the data point shape as a tuple of integers.
485    */    */
486    boost::python::tuple    const boost::python::tuple
487    getShapeTuple() const;    getShapeTuple() const;
488    
489    /**    /**
# Line 501  class Data { Line 520  class Data {
520       cannot be converted to a DataTagged object.       cannot be converted to a DataTagged object.
521       \param tagKey - Input - Integer key.       \param tagKey - Input - Integer key.
522       \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  
523    */    */
   /*  
524    void    void
525    setTaggedValue(int tagKey,    setTaggedValueFromCPP(int tagKey,
526                   const DataArrayView& value);                          const DataArrayView& value);
   */  
527    
528    /**    /**
529      \brief      \brief
# Line 633  class Data { Line 649  class Data {
649    
650    /**    /**
651       \brief       \brief
652         Return the minimum absolute value of this Data object.
653      */
654      double
655      Linf() const;
656    
657      /**
658         \brief
659       Return the maximum value of this Data object.       Return the maximum value of this Data object.
660    */    */
661    double    double
# Line 668  class Data { Line 691  class Data {
691    
692    /**    /**
693       \brief       \brief
694         Return the (sample number, data-point number) of the data point with
695         the minimum value in this Data object.
696      */
697      const boost::python::tuple
698      mindp() const;
699    
700      /**
701         \brief
702       Return the length of each data point of this Data object.       Return the length of each data point of this Data object.
703       sqrt(sum(A[i,j,k,l]^2))       sqrt(sum(A[i,j,k,l]^2))
704    */    */
# Line 683  class Data { Line 714  class Data {
714    sign() const;    sign() const;
715    
716    /**    /**
717      \transpose      \brief
718      Transpose each data point of this Data object around the given axis.      Transpose each data point of this Data object around the given axis.
719      --* not implemented yet *--      --* not implemented yet *--
720    */    */
# Line 691  class Data { Line 722  class Data {
722    transpose(int axis) const;    transpose(int axis) const;
723    
724    /**    /**
725      \trace      \brief
726      Calculate the trace of each data point of this Data object.      Calculate the trace of each data point of this Data object.
727      sum(A[i,i,i,i])      sum(A[i,i,i,i])
728    */    */
# Line 699  class Data { Line 730  class Data {
730    trace() const;    trace() const;
731    
732    /**    /**
733      \exp      \brief
734      Return the exponential function of each data point of this Data object.      Return the exponential function of each data point of this Data object.
735    */    */
736    Data    Data
737    exp() const;    exp() const;
738    
739    /**    /**
740      \sqrt      \brief
741      Return the square root of each data point of this Data object.      Return the square root of each data point of this Data object.
742    */    */
743    Data    Data
744    sqrt() const;    sqrt() const;
745    
746    /**    /**
747        \brief
748        Return the negation of each data point of this Data object.
749      */
750      Data
751      neg() const;
752    
753      /**
754        \brief
755        Return the identity of each data point of this Data object.
756        Simply returns this object unmodified.
757      */
758      Data
759      pos() const;
760    
761      /**
762       \brief       \brief
763       Return the given power of each data point of this Data object.       Return the given power of each data point of this Data object.
764    
765         \param right Input - the power to raise the object to.
766    */    */
767    Data    Data
768    powD(const Data& right) const;    powD(const Data& right) const;
769    
770      /**
771       * \brief
772       * Return the given power of each data point of this boost python object.
773       *
774       * \param right Input - the power to raise the object to.
775       */
776    Data    Data
777    powO(const boost::python::object& right) const;    powO(const boost::python::object& right) const;
778    
# Line 737  class Data { Line 791  class Data {
791    saveVTK(std::string fileName) const;    saveVTK(std::string fileName) const;
792    
793    /**    /**
     \brief  
     Return the negation of each data point of this Data object.  
   */  
   Data  
   neg() const;  
   
   /**  
     \brief  
     Return the identity of each data point of this Data object.  
     Simply returns this object unmodified.  
   */  
   Data  
   pos() const;  
   
   /**  
794       \brief       \brief
795       Overloaded operator +=       Overloaded operator +=
796       \param right - Input - The right hand side.       \param right - Input - The right hand side.
# Line 812  class Data { Line 851  class Data {
851       \brief       \brief
852       Copies slice from value into this Data object.       Copies slice from value into this Data object.
853    
      \description  
854       Implements the [] set operator in python.       Implements the [] set operator in python.
855       Calls setSlice.       Calls setSlice.
856    
# Line 860  class Data { Line 898  class Data {
898    setSlice(const Data& value,    setSlice(const Data& value,
899             const DataArrayView::RegionType& region);             const DataArrayView::RegionType& region);
900    
901      /**
902         \brief
903         Archive the current Data object to the given file.
904         \param fileName - Input - file to archive to.
905      */
906      void
907      archiveData(const std::string fileName);
908    
909      /**
910         \brief
911         Extract the Data object archived in the given file, overwriting
912         the current Data object.
913         Note - the current object must be of type DataEmpty.
914         \param fileName - Input - file to extract from.
915         \param fspace - Input - a suitable FunctionSpace descibing the data.
916      */
917      void
918      extractData(const std::string fileName,
919                  const FunctionSpace& fspace);
920    
921   protected:   protected:
922    
923   private:   private:

Legend:
Removed from v.113  
changed lines
  Added in v.122

  ViewVC Help
Powered by ViewVC 1.1.26