|
RTOp Package Browser (Single Doxygen Collection) Version of the Day
|
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 00031 #ifndef RTOPPACK_RTOP_NEW_T_DECL_HPP 00032 #define RTOPPACK_RTOP_NEW_T_DECL_HPP 00033 00034 00035 #include "RTOpPack_Types.hpp" 00036 #include "Teuchos_Describable.hpp" 00037 00038 00039 namespace RTOpPack { 00040 00041 00044 class ReductTarget : public Teuchos::Describable 00045 {}; 00046 00047 00155 template<class Scalar> 00156 class RTOpT : public Teuchos::Describable { 00157 public: 00158 00161 00163 typedef typename PrimitiveTypeTraits<Scalar,Scalar>::primitiveType 00164 primitive_value_type; 00165 00167 00170 00186 void get_reduct_type_num_entries( 00187 const Ptr<int> &num_values, 00188 const Ptr<int> &num_indexes, 00189 const Ptr<int> &num_chars 00190 ) const 00191 { 00192 get_reduct_type_num_entries_impl(num_values, num_indexes, num_chars); 00193 } 00194 00201 Teuchos::RCP<ReductTarget> reduct_obj_create() const 00202 { 00203 return reduct_obj_create_impl(); 00204 } 00205 00211 void reduce_reduct_objs( 00212 const ReductTarget& in_reduct_obj, const Ptr<ReductTarget>& inout_reduct_obj 00213 ) const 00214 { 00215 reduce_reduct_objs_impl( in_reduct_obj, inout_reduct_obj ); 00216 } 00217 00225 void reduct_obj_reinit( const Ptr<ReductTarget> &reduct_obj ) const 00226 { 00227 reduct_obj_reinit_impl(reduct_obj); 00228 } 00229 00239 void extract_reduct_obj_state( 00240 const ReductTarget &reduct_obj, 00241 const ArrayView<primitive_value_type> &value_data, 00242 const ArrayView<index_type> &index_data, 00243 const ArrayView<char_type> &char_data 00244 ) const 00245 { 00246 extract_reduct_obj_state_impl( reduct_obj, 00247 value_data, index_data, char_data ); 00248 } 00249 00255 void load_reduct_obj_state( 00256 const ArrayView<const primitive_value_type> &value_data, 00257 const ArrayView<const index_type> &index_data, 00258 const ArrayView<const char_type> &char_data, 00259 const Ptr<ReductTarget> &reduct_obj 00260 ) const 00261 { 00262 load_reduct_obj_state_impl( value_data, index_data, char_data, reduct_obj ); 00263 } 00264 00266 00269 00279 std::string op_name() const 00280 { 00281 return op_name_impl(); 00282 } 00283 00284 // 2007/11/14: rabartl: ToDo: Above: change to return std::string. Don't 00285 // bother deprecating the old function since you can't really do it very 00286 // well. 00287 00293 bool coord_invariant() const 00294 { 00295 return coord_invariant_impl(); 00296 } 00297 00308 Range1D range() const 00309 { 00310 return range_impl(); 00311 } 00312 00381 void apply_op( 00382 const ArrayView<const ConstSubVectorView<Scalar> > &sub_vecs, 00383 const ArrayView<const SubVectorView<Scalar> > &targ_sub_vecs, 00384 const Ptr<ReductTarget> &reduct_obj 00385 ) const 00386 { 00387 apply_op_impl(sub_vecs, targ_sub_vecs, reduct_obj); 00388 } 00389 00391 00392 protected: 00393 00396 00398 virtual void get_reduct_type_num_entries_impl( 00399 const Ptr<int> &num_values, 00400 const Ptr<int> &num_indexes, 00401 const Ptr<int> &num_chars 00402 ) const; 00403 00405 virtual Teuchos::RCP<ReductTarget> reduct_obj_create_impl() const; 00406 00408 virtual void reduce_reduct_objs_impl( 00409 const ReductTarget& in_reduct_obj, const Ptr<ReductTarget>& inout_reduct_obj 00410 ) const; 00411 00413 virtual void reduct_obj_reinit_impl( const Ptr<ReductTarget> &reduct_obj ) const; 00414 00416 virtual void extract_reduct_obj_state_impl( 00417 const ReductTarget &reduct_obj, 00418 const ArrayView<primitive_value_type> &value_data, 00419 const ArrayView<index_type> &index_data, 00420 const ArrayView<char_type> &char_data 00421 ) const; 00422 00424 virtual void load_reduct_obj_state_impl( 00425 const ArrayView<const primitive_value_type> &value_data, 00426 const ArrayView<const index_type> &index_data, 00427 const ArrayView<const char_type> &char_data, 00428 const Ptr<ReductTarget> &reduct_obj 00429 ) const; 00430 00432 virtual std::string op_name_impl() const; 00433 00435 virtual bool coord_invariant_impl() const; 00436 00438 virtual Range1D range_impl() const; 00439 00441 virtual void apply_op_impl( 00442 const ArrayView<const ConstSubVectorView<Scalar> > &sub_vecs, 00443 const ArrayView<const SubVectorView<Scalar> > &targ_sub_vecs, 00444 const Ptr<ReductTarget> &reduct_obj 00445 ) const = 0; 00446 00448 00451 00454 RTOpT( const std::string &op_name_base = "" ); 00455 00457 void setOpNameBase( const std::string &op_name_base ); 00458 00460 00461 public: 00462 00465 00467 RTOP_DEPRECATED void get_reduct_type_num_entries( 00468 int* num_values, int* num_indexes, int* num_chars 00469 ) const 00470 { 00471 using Teuchos::ptr; 00472 get_reduct_type_num_entries_impl(ptr(num_values), 00473 ptr(num_indexes), ptr(num_chars) ); 00474 } 00475 00477 RTOP_DEPRECATED void reduce_reduct_objs( 00478 const ReductTarget& in_reduct_obj, ReductTarget* inout_reduct_obj 00479 ) const 00480 { 00481 reduce_reduct_objs_impl( in_reduct_obj, Teuchos::ptr(inout_reduct_obj) ); 00482 } 00483 00485 RTOP_DEPRECATED void reduct_obj_reinit( ReductTarget* reduct_obj ) const 00486 { 00487 reduct_obj_reinit_impl(Teuchos::ptr(reduct_obj)); 00488 } 00489 00491 RTOP_DEPRECATED void extract_reduct_obj_state( 00492 const ReductTarget &reduct_obj, 00493 int num_values, primitive_value_type value_data[], 00494 int num_indexes, index_type index_data[], 00495 int num_chars, char_type char_data[] 00496 ) const 00497 { 00498 using Teuchos::arrayView; 00499 extract_reduct_obj_state_impl( reduct_obj, 00500 arrayView(value_data, num_values), arrayView(index_data, num_indexes), 00501 arrayView(char_data, num_chars) ); 00502 } 00503 00505 RTOP_DEPRECATED void load_reduct_obj_state( 00506 int num_values, const primitive_value_type value_data[], 00507 int num_indexes, const index_type index_data[], 00508 int num_chars, const char_type char_data[], 00509 ReductTarget *reduct_obj 00510 ) const 00511 { 00512 using Teuchos::arrayView; 00513 load_reduct_obj_state_impl( arrayView(value_data, num_values), 00514 arrayView(index_data, num_indexes), arrayView(char_data, num_chars), 00515 Teuchos::ptr(reduct_obj) ); 00516 } 00517 00519 RTOP_DEPRECATED void apply_op( 00520 const int num_vecs, const ConstSubVectorView<Scalar> sub_vecs[], 00521 const int num_targ_vecs, const SubVectorView<Scalar> targ_sub_vecs[], 00522 ReductTarget *reduct_obj 00523 ) const 00524 { 00525 apply_op_impl( 00526 Teuchos::arrayView(sub_vecs, num_vecs), 00527 Teuchos::arrayView(targ_sub_vecs, num_targ_vecs), 00528 Teuchos::ptr(reduct_obj) 00529 ); 00530 } 00531 00533 00534 private: 00535 00536 std::string op_name_; 00537 00538 void throwNoReductError() const; 00539 00540 }; // end class RTOpT 00541 00542 00543 // 2007/11/14: rabartl: ToDo: Break off an RTOpDefaultBase interface and put 00544 // all default implementation functions in there. 00545 00546 00547 } // end namespace RTOpPack 00548 00549 00550 #endif // RTOPPACK_RTOP_NEW_T_DECL_HPP
1.7.4