RTOpPack_RTOpT_def.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // RTOp: Interfaces and Support Software for Vector Reduction Transformation
00005 //       Operations
00006 //                Copyright (2006) 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 #ifndef RTOPPACK_RTOP_NEW_T_HPP
00031 #define RTOPPACK_RTOP_NEW_T_HPP
00032 
00033 #include "RTOpPack_RTOpT_decl.hpp"
00034 #include "Teuchos_Workspace.hpp"
00035 #include "Teuchos_TestForException.hpp"
00036 #include "Teuchos_ScalarTraits.hpp"
00037 
00038 
00039 namespace RTOpPack {
00040 
00041 
00042 // Protected functions to be overridden by subclasses
00043 
00044 
00045 template<class Scalar>
00046 void RTOpT<Scalar>::get_reduct_type_num_entries_impl(
00047   const Ptr<int> &num_values,
00048   const Ptr<int> &num_indexes,
00049   const Ptr<int> &num_chars
00050   ) const
00051 {
00052   *num_values  = 0;
00053   *num_indexes = 0;
00054   *num_chars   = 0;
00055 }
00056 
00057 
00058 template<class Scalar>
00059 Teuchos::RCP<ReductTarget>
00060 RTOpT<Scalar>::reduct_obj_create_impl() const
00061 {
00062   return Teuchos::null;
00063 }
00064 
00065 
00066 template<class Scalar>
00067 void RTOpT<Scalar>::reduce_reduct_objs_impl(
00068   const ReductTarget& in_reduct_obj, const Ptr<ReductTarget>& inout_reduct_obj
00069   ) const
00070 {
00071   throwNoReductError();
00072 }
00073 
00074 
00075 template<class Scalar>
00076 void RTOpT<Scalar>::reduct_obj_reinit_impl(
00077   const Ptr<ReductTarget> &reduct_obj ) const
00078 {
00079   throwNoReductError();
00080 }
00081 
00082 
00083 template<class Scalar>
00084 void RTOpT<Scalar>::extract_reduct_obj_state_impl(
00085   const ReductTarget &reduct_obj,
00086   const ArrayView<primitive_value_type> &value_data,
00087   const ArrayView<index_type> &index_data,
00088   const ArrayView<char_type> &char_data
00089   ) const
00090 {
00091   throwNoReductError();
00092 }
00093 
00094 
00095 template<class Scalar>
00096 void RTOpT<Scalar>::load_reduct_obj_state_impl(
00097   const ArrayView<const primitive_value_type> &value_data,
00098   const ArrayView<const index_type> &index_data,
00099   const ArrayView<const char_type> &char_data,
00100   const Ptr<ReductTarget> &reduct_obj
00101   ) const
00102 {
00103   throwNoReductError();
00104 }
00105 
00106 
00107 template<class Scalar>
00108 const std::string RTOpT<Scalar>::op_name_impl() const
00109 {
00110   return op_name_;
00111 }
00112 
00113 
00114 template<class Scalar>
00115 bool RTOpT<Scalar>::coord_invariant_impl() const
00116 {
00117   return true;
00118 }
00119 
00120 
00121 // Nonvirtual protected functions
00122 
00123 
00124 template<class Scalar>
00125 RTOpT<Scalar>::RTOpT( const std::string &op_name_base )
00126 {
00127   setOpNameBase(op_name_base);
00128 }
00129 
00130 
00131 template<class Scalar>
00132 void RTOpT<Scalar>::setOpNameBase( const std::string &op_name_base )
00133 {
00134   op_name_ = op_name_base+"<"+ScalarTraits<Scalar>::name()+">";
00135 }
00136 
00137 
00138 // private
00139 
00140 
00141 template<class Scalar>
00142 void RTOpT<Scalar>::throwNoReductError() const
00143 {
00144   TEST_FOR_EXCEPTION(true, std::logic_error,
00145     "Error, no reduction is defined for concrete reduction op \'"
00146     << this->description() << "\'!" );
00147 }
00148 
00149 
00150 
00151 } // end namespace RTOpPack
00152 
00153 
00154 #endif // RTOPPACK_RTOP_NEW_T_HPP

Generated on Wed May 12 21:41:16 2010 for Fundamental Vector Reduction/Transformation Operator (RTOp) Interfaces by  doxygen 1.4.7