MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_VectorSpaceBlocked.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Moocho: Multi-functional Object-Oriented arCHitecture for Optimization
5 // Copyright (2003) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef VECTOR_SPACE_COMPOSITE_STE_H
43 #define VECTOR_SPACE_COMPOSITE_STE_H
44 
45 #include <vector>
46 
48 
49 namespace AbstractLinAlgPack {
50 
100 public:
101 
108  ,int num_vector_spaces
110  );
111 
137  void initialize(
138  const VectorSpace::space_ptr_t vec_spaces[]
139  ,int num_vector_spaces
141  );
142 
144  int num_vector_spaces() const;
145 
147  /* Returns an array (length <tt>this->num_vector_spaces()</tt>) consistent with
148  * <tt>vec_spaces</tt> passed into <tt>this->initialize()</tt>.
149  */
151 
155  const index_type* vector_spaces_offsets() const;
156 
176  void get_vector_space_position( index_type i, int* kth_vector_space, index_type* kth_global_offset ) const;
177 
180 
192  bool is_compatible(const VectorSpace& vec_space) const;
194  index_type dim() const;
202  space_ptr_t clone() const;
204  space_ptr_t sub_space(const Range1D& rng) const;
205 
207 
208 private:
209 
210  // ////////////////////////////////////////////
211  // Private types
212 
213  typedef std::vector<VectorSpace::space_ptr_t> vector_spaces_t;
214  typedef std::vector<index_type> vec_spaces_offsets_t;
215 
216  // ////////////////////////////////////////////
217  // Private data members
218 
219 #ifdef DOXYGEN_COMPILE
222 #else
223  vector_spaces_t vector_spaces_;
224  // Pointer to the list of vector spaces.
225 
226  vec_spaces_offsets_t vec_spaces_offsets_;
227  // vec_spaces_offset_[k] gives the offset for vector_spaces_[k] in the
228  // global composite vector. vec_spaces_offset_[vector_spaces_.size()] gives
229  // the total dimension of the global composite vector.
230 
231  VectorSpace::space_fcty_ptr_t small_vec_spc_fcty_;
232  // Vector space factory for small_vec_spc_fcty
233 #endif
234 
235  // Not defined and not to be called
237 
238 }; // end class VectorSpaceBlocked
239 
240 // /////////////////////////////////////////////////////////
241 // Inline members
242 
243 inline
245 {
246  return vector_spaces_.size();
247 }
248 
249 inline
252 {
253  return &vector_spaces_[0];
254 }
255 
256 inline
258 {
259  return &vec_spaces_offsets_[0];
260 }
261 
262 } // end namespace AbstractLinAlgPack
263 
264 #endif // VECTOR_SPACE_COMPOSITE_STE_H
void initialize(const VectorSpace::space_ptr_t vec_spaces[], int num_vector_spaces, const VectorSpace::space_fcty_ptr_t &small_vec_spc_fcty=Teuchos::null)
Initialize with a set of vector space objects.
multi_vec_mut_ptr_t create_members(size_type num_vecs) const
space_fcty_ptr_t small_vec_spc_fcty() const
. One-based subregion index range class.
Abstract interface for objects that represent a space for mutable coordinate vectors.
Abstract interface for objects that can create vector spaces of a specified dimension.
VectorSpace subclass for the composite of one or more VectorSpace objects.
const VectorSpace::space_ptr_t * vector_spaces() const
std::vector< VectorSpace::space_ptr_t > vector_spaces_t
const index_type * vector_spaces_offsets() const
Returns array (length this->num_vector_spaces() + 1) of offsets for each constitient vector space in ...
int num_vector_spaces() const
Return the value of num_vec_spaces passed to this->initialize().
bool is_compatible(const VectorSpace &vec_space) const
Returns true if same type and has compatible vector spaces.
void get_vector_space_position(index_type i, int *kth_vector_space, index_type *kth_global_offset) const
Get the position of the vector space object and its offset into the composite vector of the vector sp...