/[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 854 by gross, Thu Sep 21 05:29:42 2006 UTC revision 1118 by gross, Tue Apr 24 08:55:04 2007 UTC
# Line 254  class Data { Line 254  class Data {
254    ESCRIPT_DLL_API    ESCRIPT_DLL_API
255    bool    bool
256    isProtected() const;    isProtected() const;
257    
258    /**    /**
259       \brief       \brief
260       Return the values of all data-points as a single python numarray object.       Return the values of a data point on this process
261    */    */
262    ESCRIPT_DLL_API    ESCRIPT_DLL_API
263    const boost::python::numeric::array    const boost::python::numeric::array
264    convertToNumArray();    getValueOfDataPoint(int dataPointNo);
265    
266    /**    /**
267       \brief       \brief
268       Return the values of all data-points for the given sample as a single python numarray object.       sets the values of a data-point from a python object on this process
269    */    */
270    ESCRIPT_DLL_API    ESCRIPT_DLL_API
271    const boost::python::numeric::array    void
272    convertToNumArrayFromSampleNo(int sampleNo);    setValueOfDataPointToPyObject(int dataPointNo, const boost::python::object& py_object);
273    
274    /**    /**
275       \brief       \brief
276       Return the value of the specified data-point as a single python numarray object.       sets the values of a data-point from a numarray object on this process
277    */    */
 #ifndef PASO_MPI    
   ESCRIPT_DLL_API  
   const boost::python::numeric::array  
   convertToNumArrayFromDPNo(int ProcNo,  
                                                         int sampleNo,  
                             int dataPointNo);  
 #else  
278    ESCRIPT_DLL_API    ESCRIPT_DLL_API
279    const boost::python::numeric::array    void
280    convertToNumArrayFromDPNo(int procNo,    setValueOfDataPointToArray(int dataPointNo, const boost::python::numeric::array&);
                 int sampleNo,  
                 int dataPointNo);  
 #endif  
   
281    
282    /**    /**
283       \brief       \brief
284       Fills the expanded Data object from values of a python numarray object.       sets the values of a data-point on this process
285    */    */
286    ESCRIPT_DLL_API    ESCRIPT_DLL_API
287    void    void
288    fillFromNumArray(const boost::python::numeric::array);    setValueOfDataPoint(int dataPointNo, const double);
289    
290      /**
291         \brief
292         Return the value of the specified data-point across all processors
293      */
294      ESCRIPT_DLL_API
295      const boost::python::numeric::array
296      getValueOfGlobalDataPoint(int procNo, int dataPointNo);
297    
298    /**    /**
299       \brief       \brief
# Line 455  class Data { Line 453  class Data {
453    
454    /**    /**
455       \brief       \brief
456         Return the number of data points
457      */
458      ESCRIPT_DLL_API
459      inline
460      int
461      getNumDataPoints() const
462      {
463        return getNumSamples() * getNumDataPointsPerSample();
464      }
465      /**
466         \brief
467       Return the number of samples.       Return the number of samples.
468    */    */
469    ESCRIPT_DLL_API    ESCRIPT_DLL_API
# Line 476  class Data { Line 485  class Data {
485    {    {
486      return m_data->getNumDPPSample();      return m_data->getNumDPPSample();
487    }    }
488      /**
489         \brief
490         dumps the object into a netCDF file
491      */
492      ESCRIPT_DLL_API
493      inline
494      void
495      dump(const std::string fileName) const
496      {
497        return m_data->dump(fileName);
498      }
499    
500    /**    /**
501       \brief       \brief
# Line 507  class Data { Line 527  class Data {
527    
528    /**    /**
529       \brief       \brief
      Assign the given value to the data-points referenced by the given  
      reference number.  
   
      The value supplied is a python numarray object.  The data from this numarray  
      is unpacked into a DataArray, and this is used to set the corresponding  
      data-points in the underlying Data object.  
   
      If the underlying Data object cannot be accessed via reference numbers, an  
      exception will be thrown.  
   
      \param ref - Input - reference number.  
      \param value - Input - value to assign to data-points associated with  
                             the given reference number.  
   */  
   ESCRIPT_DLL_API  
   void  
   setRefValue(int ref,  
               const boost::python::numeric::array& value);  
   
   /**  
      \brief  
      Return the values associated with the data-points referenced by the given  
      reference number.  
   
      The value supplied is a python numarray object. The data from the corresponding  
      data-points in this Data object are packed into the given numarray object.  
   
      If the underlying Data object cannot be accessed via reference numbers, an  
      exception will be thrown.  
   
      \param ref - Input - reference number.  
      \param value - Output - object to receive values from data-points  
                              associated with the given reference number.  
   */  
   ESCRIPT_DLL_API  
   void  
   getRefValue(int ref,  
               boost::python::numeric::array& value);  
   
   /**  
      \brief  
530       Return a view into the data for the data point specified.       Return a view into the data for the data point specified.
531       NOTE: Construction of the DataArrayView is a relatively expensive       NOTE: Construction of the DataArrayView is a relatively expensive
532       operation.       operation.
# Line 596  class Data { Line 575  class Data {
575    DataArrayView::ValueType::size_type    DataArrayView::ValueType::size_type
576    getLength() const;    getLength() const;
577    
578    
579    
580      /**
581         \brief
582         Assign the given value to the tag assocciated with name. Implicitly converts this
583         object to type DataTagged. Throws an exception if this object
584         cannot be converted to a DataTagged object or name cannot be mapped onto a tag key.
585         \param tagKey - Input - Integer key.
586         \param value - Input - Value to associate with given key.
587        ==>*
588      */
589      ESCRIPT_DLL_API
590      void
591      setTaggedValueByName(std::string name,
592                           const boost::python::object& value);
593    
594    /**    /**
595       \brief       \brief
596       Assign the given value to the tag. Implicitly converts this       Assign the given value to the tag. Implicitly converts this
# Line 639  class Data { Line 634  class Data {
634    
635    /**    /**
636       \brief       \brief
637         set all values to zero
638         *
639      */
640      ESCRIPT_DLL_API
641      void
642      setToZero();
643    
644      /**
645         \brief
646       Interpolates this onto the given functionspace and returns       Interpolates this onto the given functionspace and returns
647       the result as a Data object.       the result as a Data object.
648       *       *
# Line 646  class Data { Line 650  class Data {
650    ESCRIPT_DLL_API    ESCRIPT_DLL_API
651    Data    Data
652    interpolate(const FunctionSpace& functionspace) const;    interpolate(const FunctionSpace& functionspace) const;
   
653    /**    /**
654       \brief       \brief
655       Calculates the gradient of the data at the data points of functionspace.       Calculates the gradient of the data at the data points of functionspace.
# Line 802  class Data { Line 805  class Data {
805    */    */
806    ESCRIPT_DLL_API    ESCRIPT_DLL_API
807    const boost::python::tuple    const boost::python::tuple
808    mindp() const;    minGlobalDataPoint() const;
809    
810    ESCRIPT_DLL_API    ESCRIPT_DLL_API
811    void    void
812    calc_mindp(int& ProcNo,    calc_minGlobalDataPoint(int& ProcNo,  int& DataPointNo) const;
                         int& SampleNo,    
              int& DataPointNo) const;  
813    /**    /**
814       \brief       \brief
815       Return the sign of each data point of this Data object.       Return the sign of each data point of this Data object.
# Line 889  class Data { Line 890  class Data {
890    
891    /**    /**
892       \brief       \brief
893         Return the error function erf of each data point of this Data object.
894         *
895      */
896      ESCRIPT_DLL_API
897      Data
898      erf() const;
899    
900      /**
901         \brief
902       Return the sin of each data point of this Data object.       Return the sin of each data point of this Data object.
903       *       *
904    */    */
# Line 1386  class Data { Line 1396  class Data {
1396    // pointer to the actual data object    // pointer to the actual data object
1397    boost::shared_ptr<DataAbstract> m_data;    boost::shared_ptr<DataAbstract> m_data;
1398    
   //  
   // pointer to the internal profiling data  
   struct profDataEntry *profData;  
   
1399  };  };
1400    
1401  template <class IValueType>  template <class IValueType>
# Line 1420  Data::initialise(const IValueType& value Line 1426  Data::initialise(const IValueType& value
1426  inline double rpow(double x,double y)  inline double rpow(double x,double y)
1427  {  {
1428      return pow(y,x);      return pow(y,x);
1429  };  }
1430    
1431  /**  /**
1432    \brief    \brief
# Line 1609  Data::binaryOp(const Data& right, Line 1615  Data::binaryOp(const Data& right,
1615       EsysAssert((leftC!=0 && rightC!=0), "Programming error - casting to DataConstant.");       EsysAssert((leftC!=0 && rightC!=0), "Programming error - casting to DataConstant.");
1616       escript::binaryOp(*leftC,*rightC,operation);       escript::binaryOp(*leftC,*rightC,operation);
1617     }     }
    #if defined DOPROF  
    profData->binary++;  
    #endif  
1618  }  }
1619    
1620  /**  /**

Legend:
Removed from v.854  
changed lines
  Added in v.1118

  ViewVC Help
Powered by ViewVC 1.1.26