Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

messaget.h

00001 //
00002 // messaget.h
00003 //
00004 // Copyright (C) 1996 Limit Point Systems, Inc.
00005 //
00006 // Author: Curtis Janssen <cljanss@limitpt.com>
00007 // Maintainer: LPS
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
00026 //
00027 
00028 #ifndef _util_group_messaget_h
00029 #define _util_group_messaget_h
00030 
00031 #ifdef __GNUC__
00032 #pragma implementation
00033 #endif
00034 
00035 #include <util/group/message.h>
00036 
00037 template <class T>
00038 void
00039 GrpSumReduce<T>::reduce(T*target, T*data, int nelement)
00040 {
00041   for (int i=0; i<nelement; i++) {
00042       target[i] += data[i];
00043     }
00044 }
00045 
00046 template <class T>
00047 void
00048 GrpMinReduce<T>::reduce(T*target, T*data, int nelement)
00049 {
00050   for (int i=0; i<nelement; i++) {
00051       if (target[i] > data[i]) target[i] = data[i];
00052     }
00053 }
00054 
00055 template <class T>
00056 void
00057 GrpMaxReduce<T>::reduce(T*target, T*data, int nelement)
00058 {
00059   for (int i=0; i<nelement; i++) {
00060       if (target[i] < data[i]) target[i] = data[i];
00061     }
00062 }
00063 
00064 template <class T>
00065 void
00066 GrpArithmeticAndReduce<T>::reduce(T*target, T*data, int nelement)
00067 {
00068   for (int i=0; i<nelement; i++) {
00069       target[i] = target[i] & data[i];
00070     }
00071 }
00072 
00073 template <class T>
00074 void
00075 GrpArithmeticOrReduce<T>::reduce(T*target, T*data, int nelement)
00076 {
00077   for (int i=0; i<nelement; i++) {
00078       target[i] = target[i] | data[i];
00079     }
00080 }
00081 
00082 template <class T>
00083 void
00084 GrpArithmeticXOrReduce<T>::reduce(T*target, T*data, int nelement)
00085 {
00086   for (int i=0; i<nelement; i++) {
00087       target[i] = target[i] ^ data[i];
00088     }
00089 }
00090 
00091 template <class T>
00092 void
00093 GrpProductReduce<T>::reduce(T*target, T*data, int nelement)
00094 {
00095   for (int i=0; i<nelement; i++) {
00096       target[i] *= data[i];
00097     }
00098 }
00099 
00100 template <class T>
00101 void
00102 GrpFunctionReduce<T>::reduce(T*target, T*data, int nelement)
00103 {
00104   (*func_)(target,data,nelement);
00105 }
00106 
00107 #endif
00108 
00110 
00111 // Local Variables:
00112 // mode: c++
00113 // c-file-style: "CLJ"
00114 // End:

Generated at Thu Oct 4 18:08:46 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.