/[escript]/trunk-mpi-branch/escript/src/BinaryOp.h
ViewVC logotype

Diff of /trunk-mpi-branch/escript/src/BinaryOp.h

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

trunk/escript/src/BinaryOp.h revision 555 by jgs, Wed Feb 22 04:44:10 2006 UTC trunk-mpi-branch/escript/src/BinaryOp.h revision 1306 by ksteube, Tue Sep 18 05:51:09 2007 UTC
# Line 1  Line 1 
1  /*  
2   ******************************************************************************  /* $Id$ */
3   *                                                                            *  
4   *       COPYRIGHT  ACcESS 2004 -  All Rights Reserved                        *  /*******************************************************
5   *                                                                            *   *
6   * This software is the property of ACcESS. No part of this code              *   *           Copyright 2003-2007 by ACceSS MNRF
7   * may be copied in any form or by any means without the expressed written    *   *       Copyright 2007 by University of Queensland
8   * consent of ACcESS.  Copying, use or modification of this software          *   *
9   * by any unauthorised person is illegal unless that person has a software    *   *                http://esscc.uq.edu.au
10   * license agreement with ACcESS.                                             *   *        Primary Business: Queensland, Australia
11   *                                                                            *   *  Licensed under the Open Software License version 3.0
12   ******************************************************************************   *     http://www.opensource.org/licenses/osl-3.0.php
13  */   *
14                                                                               *******************************************************/
15    
16  #if !defined  escript_BinaryOp_20040315_H  #if !defined  escript_BinaryOp_20040315_H
17  #define escript_BinaryOp_20040315_H  #define escript_BinaryOp_20040315_H
18    #include "system_dep.h"
19    
20  #include "DataArrayView.h"  #include "DataArrayView.h"
21  #include "DataConstant.h"  #include "DataConstant.h"
# Line 67  template <class BinaryFunction> Line 69  template <class BinaryFunction>
69  inline void binaryOp(DataTagged& left, const DataTagged& right,  inline void binaryOp(DataTagged& left, const DataTagged& right,
70               BinaryFunction operation)               BinaryFunction operation)
71  {  {
72      int right_rank=right.getPointDataView().getRank();
73    //    //
74    // Add the right hand tag keys which can't currently be found on the left    // Add the right hand tag keys which can't currently be found on the left
75    const DataTagged::DataMapType& rightLookup=right.getTagLookup();    const DataTagged::DataMapType& rightLookup=right.getTagLookup();
# Line 86  inline void binaryOp(DataTagged& left, c Line 89  inline void binaryOp(DataTagged& left, c
89    const DataTagged::DataMapType& leftLookup=left.getTagLookup();    const DataTagged::DataMapType& leftLookup=left.getTagLookup();
90    DataTagged::DataMapType::const_iterator leftLookupEnd=leftLookup.end();    DataTagged::DataMapType::const_iterator leftLookupEnd=leftLookup.end();
91    for (i=leftLookup.begin();i!=leftLookupEnd;i++) {    for (i=leftLookup.begin();i!=leftLookupEnd;i++) {
92      left.getDataPointByTag(i->first).binaryOp(right.getDataPointByTag(i->first),operation);      if (right_rank==0) {
93           left.getDataPointByTag(i->first).binaryOp(i->second,right.getDataPointByTag(i->first)(),operation);
94        } else {
95           left.getDataPointByTag(i->first).binaryOp(right.getDataPointByTag(i->first),operation);
96        }
97    }    }
98    //    //
99    // finally perform the operation on the default value    // finally perform the operation on the default value
100    left.getDefaultValue().binaryOp(right.getDefaultValue(),operation);    if (right_rank==0) {
101         left.getDefaultValue().binaryOp(0,right.getDefaultValue()(),operation);
102      } else {
103         left.getDefaultValue().binaryOp(right.getDefaultValue(),operation);
104      }
105  }  }
106    
107  template <class BinaryFunction>  template <class BinaryFunction>

Legend:
Removed from v.555  
changed lines
  Added in v.1306

  ViewVC Help
Powered by ViewVC 1.1.26