AbstractLinAlgPack_VectorSpaceBlocked.hpp

Go to the documentation of this file.
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 VECTOR_SPACE_COMPOSITE_STE_H
00030 #define VECTOR_SPACE_COMPOSITE_STE_H
00031 
00032 #include <vector>
00033 
00034 #include "AbstractLinAlgPack_VectorSpace.hpp"
00035 
00036 namespace AbstractLinAlgPack {
00037 
00086 class VectorSpaceBlocked : public VectorSpace {
00087 public:
00088 
00093   VectorSpaceBlocked(
00094     const VectorSpace::space_ptr_t          vector_spaces[]
00095     ,int                                    num_vector_spaces
00096     ,const VectorSpace::space_fcty_ptr_t   &small_vec_spc_fcty = Teuchos::null
00097     );
00098   
00124   void initialize(
00125     const VectorSpace::space_ptr_t         vec_spaces[]
00126     ,int                                   num_vector_spaces
00127     ,const VectorSpace::space_fcty_ptr_t   &small_vec_spc_fcty = Teuchos::null
00128     );
00129 
00131   int num_vector_spaces() const;
00132 
00134     /* Returns an array (length <tt>this->num_vector_spaces()</tt>) consistent with
00135      * <tt>vec_spaces</tt> passed into <tt>this->initialize()</tt>.
00136      */
00137   const VectorSpace::space_ptr_t*  vector_spaces() const;
00138 
00142   const index_type* vector_spaces_offsets() const;
00143 
00163   void get_vector_space_position( index_type i, int* kth_vector_space, index_type* kth_global_offset ) const;
00164 
00167   
00179    bool is_compatible(const VectorSpace& vec_space) const;
00181   index_type dim() const;
00183   space_fcty_ptr_t small_vec_spc_fcty() const;
00185   vec_mut_ptr_t create_member() const;
00187   multi_vec_mut_ptr_t create_members(size_type num_vecs) const;
00189   space_ptr_t clone() const;
00191   space_ptr_t sub_space(const Range1D& rng) const;
00192 
00194 
00195 private:
00196 
00197   // ////////////////////////////////////////////
00198   // Private types
00199 
00200   typedef std::vector<VectorSpace::space_ptr_t>   vector_spaces_t;
00201   typedef std::vector<index_type>                 vec_spaces_offsets_t;
00202 
00203   // ////////////////////////////////////////////
00204   // Private data members
00205 
00206 #ifdef DOXYGEN_COMPILE
00207   VectorSpace           *vector_spaces;
00208   VectorSpaceFactory    *small_vec_spc_fcty;
00209 #else
00210   vector_spaces_t       vector_spaces_;
00211   // Pointer to the list of vector spaces.
00212 
00213   vec_spaces_offsets_t  vec_spaces_offsets_;
00214   // vec_spaces_offset_[k] gives the offset for vector_spaces_[k] in the 
00215   // global composite vector.  vec_spaces_offset_[vector_spaces_.size()] gives
00216   // the total dimension of the global composite vector.
00217 
00218   VectorSpace::space_fcty_ptr_t   small_vec_spc_fcty_;
00219   // Vector space factory for small_vec_spc_fcty
00220 #endif
00221 
00222   // Not defined and not to be called
00223   VectorSpaceBlocked();
00224 
00225 }; // end class VectorSpaceBlocked
00226 
00227 // /////////////////////////////////////////////////////////
00228 // Inline members
00229 
00230 inline
00231 int VectorSpaceBlocked::num_vector_spaces() const
00232 {
00233   return vector_spaces_.size();
00234 }
00235 
00236 inline
00237 const VectorSpace::space_ptr_t*
00238 VectorSpaceBlocked::vector_spaces() const
00239 {
00240   return &vector_spaces_[0];
00241 }
00242 
00243 inline
00244 const index_type* VectorSpaceBlocked::vector_spaces_offsets() const
00245 {
00246   return &vec_spaces_offsets_[0];
00247 }
00248 
00249 } // end namespace AbstractLinAlgPack
00250 
00251 #endif // VECTOR_SPACE_COMPOSITE_STE_H

Generated on Thu Sep 18 12:35:13 2008 for MOOCHO (Single Doxygen Collection) by doxygen 1.3.9.1