RTOp Package Browser (Single Doxygen Collection) Version of the Day
RTOpPack_RTOpT_def.hpp
Go to the documentation of this file.
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 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00039 // 
00040 // ***********************************************************************
00041 // @HEADER
00042 
00043 #ifndef RTOPPACK_RTOP_NEW_T_HPP
00044 #define RTOPPACK_RTOP_NEW_T_HPP
00045 
00046 #include "RTOpPack_RTOpT_decl.hpp"
00047 #include "Teuchos_Workspace.hpp"
00048 #include "Teuchos_TestForException.hpp"
00049 #include "Teuchos_ScalarTraits.hpp"
00050 
00051 
00052 namespace RTOpPack {
00053 
00054 
00055 // Protected functions to be overridden by subclasses
00056 
00057 
00058 template<class Scalar>
00059 void RTOpT<Scalar>::get_reduct_type_num_entries_impl(
00060   const Ptr<int> &num_values,
00061   const Ptr<int> &num_indexes,
00062   const Ptr<int> &num_chars
00063   ) const
00064 {
00065   *num_values  = 0;
00066   *num_indexes = 0;
00067   *num_chars   = 0;
00068 }
00069 
00070 
00071 template<class Scalar>
00072 Teuchos::RCP<ReductTarget>
00073 RTOpT<Scalar>::reduct_obj_create_impl() const
00074 {
00075   return Teuchos::null;
00076 }
00077 
00078 
00079 template<class Scalar>
00080 void RTOpT<Scalar>::reduce_reduct_objs_impl(
00081   const ReductTarget& in_reduct_obj, const Ptr<ReductTarget>& inout_reduct_obj
00082   ) const
00083 {
00084   throwNoReductError();
00085 }
00086 
00087 
00088 template<class Scalar>
00089 void RTOpT<Scalar>::reduct_obj_reinit_impl(
00090   const Ptr<ReductTarget> &reduct_obj ) const
00091 {
00092   throwNoReductError();
00093 }
00094 
00095 
00096 template<class Scalar>
00097 void RTOpT<Scalar>::extract_reduct_obj_state_impl(
00098   const ReductTarget &reduct_obj,
00099   const ArrayView<primitive_value_type> &value_data,
00100   const ArrayView<index_type> &index_data,
00101   const ArrayView<char_type> &char_data
00102   ) const
00103 {
00104   throwNoReductError();
00105 }
00106 
00107 
00108 template<class Scalar>
00109 void RTOpT<Scalar>::load_reduct_obj_state_impl(
00110   const ArrayView<const primitive_value_type> &value_data,
00111   const ArrayView<const index_type> &index_data,
00112   const ArrayView<const char_type> &char_data,
00113   const Ptr<ReductTarget> &reduct_obj
00114   ) const
00115 {
00116   throwNoReductError();
00117 }
00118 
00119 
00120 template<class Scalar>
00121 std::string RTOpT<Scalar>::op_name_impl() const
00122 {
00123   return op_name_;
00124 }
00125 
00126 
00127 template<class Scalar>
00128 bool RTOpT<Scalar>::coord_invariant_impl() const
00129 {
00130   return true;
00131 }
00132 
00133 
00134 template<class Scalar>
00135 Range1D RTOpT<Scalar>::range_impl() const
00136 {
00137   return Range1D();
00138 }
00139 
00140 
00141 // Nonvirtual protected functions
00142 
00143 
00144 template<class Scalar>
00145 RTOpT<Scalar>::RTOpT( const std::string &op_name_base )
00146 {
00147   setOpNameBase(op_name_base);
00148 }
00149 
00150 
00151 template<class Scalar>
00152 void RTOpT<Scalar>::setOpNameBase( const std::string &op_name_base )
00153 {
00154   op_name_ = op_name_base+"<"+ScalarTraits<Scalar>::name()+">";
00155 }
00156 
00157 
00158 // private
00159 
00160 
00161 template<class Scalar>
00162 void RTOpT<Scalar>::throwNoReductError() const
00163 {
00164   TEST_FOR_EXCEPTION(true, std::logic_error,
00165     "Error, no reduction is defined for concrete reduction op \'"
00166     << this->description() << "\'!" );
00167 }
00168 
00169 
00170 
00171 } // end namespace RTOpPack
00172 
00173 
00174 #endif // RTOPPACK_RTOP_NEW_T_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines