|
RTOpPack: Extra C/C++ Code for Vector Reduction/Transformation Operators Version of the Day
|
00001 /* 00002 // @HEADER 00003 // *********************************************************************** 00004 // 00005 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization 00006 // Copyright (2003) Sandia Corporation 00007 // 00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00009 // license for use of this work by or on behalf of the U.S. Government. 00010 // 00011 // This library is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as 00013 // published by the Free Software Foundation; either version 2.1 of the 00014 // License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, but 00017 // WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 // Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public 00022 // License along with this library; if not, write to the Free Software 00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00024 // USA 00025 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00026 // 00027 // *********************************************************************** 00028 // @HEADER 00029 */ 00030 00031 #include "RTOp_reduct_sum_value.h" 00032 00033 int RTOp_reduct_sum_value( 00034 const struct RTOp_RTOp_vtbl_t* vtbl, const void* obj_data 00035 , RTOp_ReductTarget in_targ_obj, RTOp_ReductTarget inout_targ_obj ) 00036 { 00037 /* inout_dot_prod += in_dot_prod */ 00038 *((RTOp_value_type*)inout_targ_obj) += *((RTOp_value_type*)in_targ_obj); 00039 return 0; 00040 } 00041 00042 static void CALL_API external_reduct_op( void* in_targ_array, void* inout_targ_array 00043 , int* len, RTOp_Datatype* datatype ) 00044 { 00045 /* inout_dot_prod += in_dot_prod */ 00046 RTOp_value_type /* index past the size members */ 00047 *in_targs = (RTOp_value_type*)in_targ_array + 3, 00048 *inout_targs = (RTOp_value_type*)inout_targ_array + 3; 00049 int i; 00050 for( i = 0; i < *len; ++i, inout_targs += 4, in_targs += 4 ) 00051 *inout_targs += *in_targs; 00052 } 00053 00054 int RTOp_get_reduct_sum_value_op( 00055 const struct RTOp_RTOp_vtbl_t* vtbl, const void* obj_data 00056 , RTOp_reduct_op_func_ptr_t* reduct_op_func_ptr ) 00057 { 00058 *reduct_op_func_ptr = external_reduct_op; 00059 return 0; 00060 }
1.7.4