|
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 // 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 00044 #ifndef RTOPPACK_RTOP_NEW_T_DECL_HPP 00045 #define RTOPPACK_RTOP_NEW_T_DECL_HPP 00046 00047 00048 #include "RTOpPack_Types.hpp" 00049 #include "Teuchos_Describable.hpp" 00050 00051 00052 namespace RTOpPack { 00053 00054 00057 class ReductTarget : public Teuchos::Describable 00058 {}; 00059 00060 00168 template<class Scalar> 00169 class RTOpT : public Teuchos::Describable { 00170 public: 00171 00174 00176 typedef typename PrimitiveTypeTraits<Scalar,Scalar>::primitiveType 00177 primitive_value_type; 00178 00180 00183 00199 void get_reduct_type_num_entries( 00200 const Ptr<int> &num_values, 00201 const Ptr<int> &num_indexes, 00202 const Ptr<int> &num_chars 00203 ) const 00204 { 00205 get_reduct_type_num_entries_impl(num_values, num_indexes, num_chars); 00206 } 00207 00214 Teuchos::RCP<ReductTarget> reduct_obj_create() const 00215 { 00216 return reduct_obj_create_impl(); 00217 } 00218 00224 void reduce_reduct_objs( 00225 const ReductTarget& in_reduct_obj, const Ptr<ReductTarget>& inout_reduct_obj 00226 ) const 00227 { 00228 reduce_reduct_objs_impl( in_reduct_obj, inout_reduct_obj ); 00229 } 00230 00238 void reduct_obj_reinit( const Ptr<ReductTarget> &reduct_obj ) const 00239 { 00240 reduct_obj_reinit_impl(reduct_obj); 00241 } 00242 00252 void extract_reduct_obj_state( 00253 const ReductTarget &reduct_obj, 00254 const ArrayView<primitive_value_type> &value_data, 00255 const ArrayView<index_type> &index_data, 00256 const ArrayView<char_type> &char_data 00257 ) const 00258 { 00259 extract_reduct_obj_state_impl( reduct_obj, 00260 value_data, index_data, char_data ); 00261 } 00262 00268 void load_reduct_obj_state( 00269 const ArrayView<const primitive_value_type> &value_data, 00270 const ArrayView<const index_type> &index_data, 00271 const ArrayView<const char_type> &char_data, 00272 const Ptr<ReductTarget> &reduct_obj 00273 ) const 00274 { 00275 load_reduct_obj_state_impl( value_data, index_data, char_data, reduct_obj ); 00276 } 00277 00279 00282 00292 std::string op_name() const 00293 { 00294 return op_name_impl(); 00295 } 00296 00297 // 2007/11/14: rabartl: ToDo: Above: change to return std::string. Don't 00298 // bother deprecating the old function since you can't really do it very 00299 // well. 00300 00306 bool coord_invariant() const 00307 { 00308 return coord_invariant_impl(); 00309 } 00310 00321 Range1D range() const 00322 { 00323 return range_impl(); 00324 } 00325 00394 void apply_op( 00395 const ArrayView<const ConstSubVectorView<Scalar> > &sub_vecs, 00396 const ArrayView<const SubVectorView<Scalar> > &targ_sub_vecs, 00397 const Ptr<ReductTarget> &reduct_obj 00398 ) const 00399 { 00400 apply_op_impl(sub_vecs, targ_sub_vecs, reduct_obj); 00401 } 00402 00404 00405 protected: 00406 00409 00411 virtual void get_reduct_type_num_entries_impl( 00412 const Ptr<int> &num_values, 00413 const Ptr<int> &num_indexes, 00414 const Ptr<int> &num_chars 00415 ) const; 00416 00418 virtual Teuchos::RCP<ReductTarget> reduct_obj_create_impl() const; 00419 00421 virtual void reduce_reduct_objs_impl( 00422 const ReductTarget& in_reduct_obj, const Ptr<ReductTarget>& inout_reduct_obj 00423 ) const; 00424 00426 virtual void reduct_obj_reinit_impl( const Ptr<ReductTarget> &reduct_obj ) const; 00427 00429 virtual void extract_reduct_obj_state_impl( 00430 const ReductTarget &reduct_obj, 00431 const ArrayView<primitive_value_type> &value_data, 00432 const ArrayView<index_type> &index_data, 00433 const ArrayView<char_type> &char_data 00434 ) const; 00435 00437 virtual void load_reduct_obj_state_impl( 00438 const ArrayView<const primitive_value_type> &value_data, 00439 const ArrayView<const index_type> &index_data, 00440 const ArrayView<const char_type> &char_data, 00441 const Ptr<ReductTarget> &reduct_obj 00442 ) const; 00443 00445 virtual std::string op_name_impl() const; 00446 00448 virtual bool coord_invariant_impl() const; 00449 00451 virtual Range1D range_impl() const; 00452 00454 virtual void apply_op_impl( 00455 const ArrayView<const ConstSubVectorView<Scalar> > &sub_vecs, 00456 const ArrayView<const SubVectorView<Scalar> > &targ_sub_vecs, 00457 const Ptr<ReductTarget> &reduct_obj 00458 ) const = 0; 00459 00461 00464 00467 RTOpT( const std::string &op_name_base = "" ); 00468 00470 void setOpNameBase( const std::string &op_name_base ); 00471 00473 00474 public: 00475 00476 00477 private: 00478 00479 std::string op_name_; 00480 00481 void throwNoReductError() const; 00482 00483 }; // end class RTOpT 00484 00485 00486 // 2007/11/14: rabartl: ToDo: Break off an RTOpDefaultBase interface and put 00487 // all default implementation functions in there. 00488 00489 00490 } // end namespace RTOpPack 00491 00492 00493 #endif // RTOPPACK_RTOP_NEW_T_DECL_HPP
1.7.6.1