00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef RTOPPACK_RTOP_NEW_T_HPP
00031 #define RTOPPACK_RTOP_NEW_T_HPP
00032
00033 #include "RTOpPack_RTOpTDecl.hpp"
00034 #include "Teuchos_Workspace.hpp"
00035 #include "Teuchos_TestForException.hpp"
00036 #include "Teuchos_ScalarTraits.hpp"
00037
00038 namespace RTOpPack {
00039
00040 template<class Scalar>
00041 RTOpT<Scalar>::RTOpT( const std::string &op_name_base )
00042 :op_name_(op_name_base + std::string(Teuchos::ScalarTraits<Scalar>::name()))
00043 {}
00044
00045
00046
00047 template<class Scalar>
00048 void RTOpT<Scalar>::get_reduct_type_num_entries(
00049 int* num_values
00050 ,int* num_indexes
00051 ,int* num_chars
00052 ) const
00053 {
00054 #ifdef RTOp_DEBUG
00055 TEST_FOR_EXCEPTION( !num_values, std::logic_error, "Error!" );
00056 TEST_FOR_EXCEPTION( !num_indexes, std::logic_error, "Error!" );
00057 TEST_FOR_EXCEPTION( !num_chars, std::logic_error, "Error!" );
00058 #endif
00059 *num_values = 0;
00060 *num_indexes = 0;
00061 *num_chars = 0;
00062 }
00063
00064 template<class Scalar>
00065 Teuchos::RefCountPtr<ReductTarget>
00066 RTOpT<Scalar>::reduct_obj_create() const
00067 {
00068 return Teuchos::null;
00069 }
00070
00071 template<class Scalar>
00072 void RTOpT<Scalar>::reduce_reduct_objs(
00073 const ReductTarget& in_reduct_obj, ReductTarget* inout_reduct_obj
00074 ) const
00075 {
00076 TEST_FOR_EXCEPTION(true,std::logic_error,"Error, should not call!");
00077 }
00078
00079 template<class Scalar>
00080 void RTOpT<Scalar>::reduct_obj_reinit( ReductTarget* reduct_obj ) const
00081 {
00082 TEST_FOR_EXCEPTION(true,std::logic_error,"Error, should not call!");
00083 }
00084
00085 template<class Scalar>
00086 void RTOpT<Scalar>::extract_reduct_obj_state(
00087 const ReductTarget &reduct_obj
00088 ,int num_values
00089 ,primitive_value_type value_data[]
00090 ,int num_indexes
00091 ,index_type index_data[]
00092 ,int num_chars
00093 ,char_type char_data[]
00094 ) const
00095 {
00096 TEST_FOR_EXCEPTION(true,std::logic_error,"Error, should not call!");
00097 }
00098
00099 template<class Scalar>
00100 void RTOpT<Scalar>::load_reduct_obj_state(
00101 int num_values
00102 ,const primitive_value_type value_data[]
00103 ,int num_indexes
00104 ,const index_type index_data[]
00105 ,int num_chars
00106 ,const char_type char_data[]
00107 ,ReductTarget *reduct_obj
00108 ) const
00109 {
00110 TEST_FOR_EXCEPTION(true,std::logic_error,"Error, should not call!");
00111 }
00112
00113
00114
00115 template<class Scalar>
00116 const char* RTOpT<Scalar>::op_name() const
00117 {
00118 return op_name_.c_str();
00119 }
00120
00121 template<class Scalar>
00122 RTOpT<Scalar>& RTOpT<Scalar>::operator=(const RTOpT<Scalar>& op)
00123 {
00124 using Teuchos::Workspace;
00125 Teuchos::WorkspaceStore* wss = Teuchos::get_default_workspace_store().get();
00126 int num_values = 0, num_indexes = 0, num_chars = 0;
00127 op.get_op_type_num_entries( &num_values, &num_indexes, &num_chars );
00128 Workspace<primitive_value_type> value_data(wss,num_values,false);
00129 Workspace<index_type> index_data(wss,num_indexes,false);
00130 Workspace<char_type> char_data(wss,num_chars,false);
00131 op.extract_op_state(
00132 num_values, num_values ? &value_data[0] : NULL
00133 ,num_indexes, num_indexes ? &index_data[0] : NULL
00134 ,num_chars, num_chars ? &char_data[0] : NULL
00135 );
00136 this->load_op_state(
00137 num_values, num_values ? &value_data[0] : NULL
00138 ,num_indexes, num_indexes ? &index_data[0] : NULL
00139 ,num_chars, num_chars ? &char_data[0] : NULL
00140 );
00141 return *this;
00142 }
00143
00144 template<class Scalar>
00145 void RTOpT<Scalar>::get_op_type_num_entries(
00146 int* num_values
00147 ,int* num_indexes
00148 ,int* num_chars
00149 ) const
00150 {
00151 #ifdef RTOp_DEBUG
00152 TEST_FOR_EXCEPTION( !num_values, std::logic_error, "Error!" );
00153 TEST_FOR_EXCEPTION( !num_indexes, std::logic_error, "Error!" );
00154 TEST_FOR_EXCEPTION( !num_chars, std::logic_error, "Error!" );
00155 #endif
00156 *num_values = 0;
00157 *num_indexes = 0;
00158 *num_chars = 0;
00159 }
00160
00161 template<class Scalar>
00162 void RTOpT<Scalar>::extract_op_state(
00163 int num_values
00164 ,primitive_value_type value_data[]
00165 ,int num_indexes
00166 ,index_type index_data[]
00167 ,int num_chars
00168 ,char_type char_data[]
00169 ) const
00170 {
00171 TEST_FOR_EXCEPTION(true,std::logic_error,"Error, should not call!");
00172 }
00173
00174 template<class Scalar>
00175 void RTOpT<Scalar>::load_op_state(
00176 int num_values
00177 ,const primitive_value_type value_data[]
00178 ,int num_indexes
00179 ,const index_type index_data[]
00180 ,int num_chars
00181 ,const char_type char_data[]
00182 )
00183 {
00184 TEST_FOR_EXCEPTION(true,std::logic_error,"Error, should not call!");
00185 }
00186
00187 template<class Scalar>
00188 bool RTOpT<Scalar>::coord_invariant() const
00189 {
00190 return true;
00191 }
00192
00193 }
00194
00195 #endif // RTOPPACK_RTOP_NEW_T_HPP