/[escript]/trunk/escript/src/DataArrayView.h
ViewVC logotype

Diff of /trunk/escript/src/DataArrayView.h

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

revision 108 by jgs, Thu Jan 27 06:21:59 2005 UTC revision 113 by jgs, Mon Feb 28 07:06:33 2005 UTC
# Line 733  class DataArrayView { Line 733  class DataArrayView {
733       the data point using the given operation, returning the result as a       the data point using the given operation, returning the result as a
734       scalar. Operation must be a pointer to a function.       scalar. Operation must be a pointer to a function.
735    
      Called by escript::dp_algorithm.  
   
      \param operation - Input -  
                   Operation to apply. Must be a pointer to a function.  
   */  
   template <class UnaryFunction>  
   double  
   dp_reductionOp(UnaryFunction operation) const;  
   
   /**  
      \brief  
      Perform the given data point reduction operation on the data point  
      specified by the given offset into the view. Reduces all elements of  
      the data point using the given operation, returning the result as a  
      scalar. Operation must be a pointer to a function.  
   
      Called by escript::dp_algorithm.  
   
      \param offset - Input -  
                   Apply the operation to data starting at this offset in this view.  
      \param operation - Input -  
                   Operation to apply. Must be a pointer to a function.  
   */  
   template <class UnaryFunction>  
   double  
   dp_reductionOp(ValueType::size_type offset,  
                  UnaryFunction operation) const;  
   
   /**  
      \brief  
      Perform the given reduction operation on the data point  
      specified by the default offset into the view. Reduces all elements of  
      the data point using the given operation, returning the result as a  
      scalar. Operation must be a pointer to a function.  
   
736       Called by escript::algorithm.       Called by escript::algorithm.
737    
738       \param operation - Input -       \param operation - Input -
# Line 779  class DataArrayView { Line 744  class DataArrayView {
744    
745    /**    /**
746       \brief       \brief
747       Perform the given reduction operation on the data point       Perform the given data point reduction operation on the data point
748       specified by the given offset into the view. Reduces all elements of       specified by the given offset into the view. Reduces all elements of
749       the data point using the given operation, returning the result as a       the data point using the given operation, returning the result as a
750       scalar. Operation must be a pointer to a function.       scalar. Operation must be a pointer to a function.
# Line 798  class DataArrayView { Line 763  class DataArrayView {
763    
764    /**    /**
765       \brief       \brief
766       Perform matrix multiply.       Perform a matrix multiply of the given views.
767         This is purely a utility method and has no bearing on this view.
      Description:  
      Perform matrix multiply.  
768    
769       \param left - Input - The left hand side.       \param left - Input - The left hand side.
770       \param right - Input - The right hand side.       \param right - Input - The right hand side.
# Line 958  DataArrayView::binaryOp(ValueType::size_ Line 921  DataArrayView::binaryOp(ValueType::size_
921                          BinaryFunction operation)                          BinaryFunction operation)
922  {  {
923    EsysAssert((!isEmpty()&&checkOffset(offset)),    EsysAssert((!isEmpty()&&checkOffset(offset)),
924               "Error - Couldn't perform binaryOp due to insufficient storage.");               "Error - Couldn't perform binaryOp due to insufficient storage in left object.");
925    for (ValueType::size_type i=0;i<noValues();i++) {    for (ValueType::size_type i=0;i<noValues();i++) {
926      (*m_data)[offset+i]=operation((*m_data)[offset+i],right);      (*m_data)[offset+i]=operation((*m_data)[offset+i],right);
927    }    }
# Line 967  DataArrayView::binaryOp(ValueType::size_ Line 930  DataArrayView::binaryOp(ValueType::size_
930  template <class UnaryFunction>  template <class UnaryFunction>
931  inline  inline
932  double  double
 DataArrayView::dp_reductionOp(UnaryFunction operation) const  
 {  
   return dp_reductionOp(m_offset,operation);  
 }  
   
 template <class UnaryFunction>  
 inline  
 double  
 DataArrayView::dp_reductionOp(ValueType::size_type offset,  
                               UnaryFunction operation) const  
 {  
   EsysAssert((!isEmpty()&&checkOffset(offset)),  
                "Error - Couldn't perform dp_reductionOp due to insufficient storage.");  
   operation.resetResult();  
   for (ValueType::size_type i=0;i<noValues();i++) {  
     operation((*m_data)[offset+i]);  
   }  
   return operation.getResult();  
 }  
   
 template <class UnaryFunction>  
 inline  
 double  
933  DataArrayView::reductionOp(UnaryFunction operation) const  DataArrayView::reductionOp(UnaryFunction operation) const
934  {  {
935    return reductionOp(m_offset,operation);    return reductionOp(m_offset,operation);
# Line 1003  DataArrayView::reductionOp(ValueType::si Line 943  DataArrayView::reductionOp(ValueType::si
943  {  {
944    EsysAssert((!isEmpty()&&checkOffset(offset)),    EsysAssert((!isEmpty()&&checkOffset(offset)),
945                 "Error - Couldn't perform reductionOp due to insufficient storage.");                 "Error - Couldn't perform reductionOp due to insufficient storage.");
946      operation.resetResult();
947    for (ValueType::size_type i=0;i<noValues();i++) {    for (ValueType::size_type i=0;i<noValues();i++) {
948      operation((*m_data)[offset+i]);      operation((*m_data)[offset+i]);
949    }    }

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

  ViewVC Help
Powered by ViewVC 1.1.26