AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects Version of the Day
AbstractLinAlgPack_VectorSubView.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
00005 //                  Copyright (2003) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef ALAP_VECTOR_SUB_VIEW_H
00030 #define ALAP_VECTOR_SUB_VIEW_H
00031 
00032 #include "AbstractLinAlgPack_Vector.hpp"
00033 #include "AbstractLinAlgPack_VectorApplyOpSerialBase.hpp"
00034 #include "AbstractLinAlgPack_VectorSpaceSubSpace.hpp"
00035 
00036 namespace AbstractLinAlgPack {
00037 
00053 class VectorSubView
00054   : virtual public Vector
00055   , virtual protected VectorApplyOpSerialBase
00056 {
00057 public:
00058 
00063   VectorSubView();
00066   VectorSubView( const vec_ptr_t& full_vec, const Range1D& rng );
00084   void initialize( const vec_ptr_t& full_vec, const Range1D& rng );
00092   void set_uninitialized();
00094   const vec_ptr_t& full_vec() const;
00096   const VectorSpaceSubSpace& space_impl() const;
00097 
00100 
00102   const VectorSpace& space() const;
00104   index_type dim() const;
00120   void apply_op(
00121     const RTOpPack::RTOp& op
00122     ,const size_t num_vecs, const Vector* vecs[]
00123     ,const size_t num_targ_vecs, VectorMutable* targ_vecs[]
00124     ,RTOpPack::ReductTarget *reduct_obj
00125     ,const index_type first_ele, const index_type sub_dim, const index_type global_offset
00126     ) const;
00128   value_type get_ele(index_type i) const;
00130   vec_ptr_t sub_view( const Range1D& rng ) const;
00132   void get_sub_vector( const Range1D& rng, RTOpPack::SubVector* sub_vec ) const;
00134   void free_sub_vector( RTOpPack::SubVector* sub_vec ) const;
00135 
00137 
00138 private:
00139 
00140   vec_ptr_t                  full_vec_;   
00141   VectorSpaceSubSpace        space_;      
00142 
00143   // Not defined and not to be called
00144   VectorSubView& operator=(const VectorSubView&);
00145   
00146 }; // end class VectorSubView
00147 
00148 // /////////////////////////////////////////////
00149 // Inline members
00150 
00151 inline
00152 VectorSubView::VectorSubView()
00153 {}
00154 
00155 inline
00156 const VectorSubView::vec_ptr_t&
00157 VectorSubView::full_vec() const
00158 {
00159   return full_vec_;
00160 }
00161 
00162 inline
00163 const VectorSpaceSubSpace& VectorSubView::space_impl() const
00164 {
00165   return space_;
00166 }
00167 
00168 } // end namespace AbstractLinAlgPack
00169 
00170 #endif // ALAP_VECTOR_SUB_VIEW_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends