|
AbstractLinAlgPack: C++ Interfaces For Vectors, Matrices And Related Linear Algebra Objects
Version of the Day
|
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 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 // @HEADER 00041 00042 #ifndef VECTOR_SPACE_COMPOSITE_STE_H 00043 #define VECTOR_SPACE_COMPOSITE_STE_H 00044 00045 #include <vector> 00046 00047 #include "AbstractLinAlgPack_VectorSpace.hpp" 00048 00049 namespace AbstractLinAlgPack { 00050 00099 class VectorSpaceBlocked : public VectorSpace { 00100 public: 00101 00106 VectorSpaceBlocked( 00107 const VectorSpace::space_ptr_t vector_spaces[] 00108 ,int num_vector_spaces 00109 ,const VectorSpace::space_fcty_ptr_t &small_vec_spc_fcty = Teuchos::null 00110 ); 00111 00137 void initialize( 00138 const VectorSpace::space_ptr_t vec_spaces[] 00139 ,int num_vector_spaces 00140 ,const VectorSpace::space_fcty_ptr_t &small_vec_spc_fcty = Teuchos::null 00141 ); 00142 00144 int num_vector_spaces() const; 00145 00147 /* Returns an array (length <tt>this->num_vector_spaces()</tt>) consistent with 00148 * <tt>vec_spaces</tt> passed into <tt>this->initialize()</tt>. 00149 */ 00150 const VectorSpace::space_ptr_t* vector_spaces() const; 00151 00155 const index_type* vector_spaces_offsets() const; 00156 00176 void get_vector_space_position( index_type i, int* kth_vector_space, index_type* kth_global_offset ) const; 00177 00180 00192 bool is_compatible(const VectorSpace& vec_space) const; 00194 index_type dim() const; 00196 space_fcty_ptr_t small_vec_spc_fcty() const; 00198 vec_mut_ptr_t create_member() const; 00200 multi_vec_mut_ptr_t create_members(size_type num_vecs) const; 00202 space_ptr_t clone() const; 00204 space_ptr_t sub_space(const Range1D& rng) const; 00205 00207 00208 private: 00209 00210 // //////////////////////////////////////////// 00211 // Private types 00212 00213 typedef std::vector<VectorSpace::space_ptr_t> vector_spaces_t; 00214 typedef std::vector<index_type> vec_spaces_offsets_t; 00215 00216 // //////////////////////////////////////////// 00217 // Private data members 00218 00219 #ifdef DOXYGEN_COMPILE 00220 VectorSpace *vector_spaces; 00221 VectorSpaceFactory *small_vec_spc_fcty; 00222 #else 00223 vector_spaces_t vector_spaces_; 00224 // Pointer to the list of vector spaces. 00225 00226 vec_spaces_offsets_t vec_spaces_offsets_; 00227 // vec_spaces_offset_[k] gives the offset for vector_spaces_[k] in the 00228 // global composite vector. vec_spaces_offset_[vector_spaces_.size()] gives 00229 // the total dimension of the global composite vector. 00230 00231 VectorSpace::space_fcty_ptr_t small_vec_spc_fcty_; 00232 // Vector space factory for small_vec_spc_fcty 00233 #endif 00234 00235 // Not defined and not to be called 00236 VectorSpaceBlocked(); 00237 00238 }; // end class VectorSpaceBlocked 00239 00240 // ///////////////////////////////////////////////////////// 00241 // Inline members 00242 00243 inline 00244 int VectorSpaceBlocked::num_vector_spaces() const 00245 { 00246 return vector_spaces_.size(); 00247 } 00248 00249 inline 00250 const VectorSpace::space_ptr_t* 00251 VectorSpaceBlocked::vector_spaces() const 00252 { 00253 return &vector_spaces_[0]; 00254 } 00255 00256 inline 00257 const index_type* VectorSpaceBlocked::vector_spaces_offsets() const 00258 { 00259 return &vec_spaces_offsets_[0]; 00260 } 00261 00262 } // end namespace AbstractLinAlgPack 00263 00264 #endif // VECTOR_SPACE_COMPOSITE_STE_H
1.7.6.1