MOOCHO (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AbstractLinAlgPack_DirectSparseSolverImp.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 ALAP_DIRECT_SPARSE_SOLVER_IMP_H
43 #define ALAP_DIRECT_SPARSE_SOLVER_IMP_H
44 
47 
48 namespace AbstractLinAlgPack {
49 
50 class DirectSparseSolverImp;
51 
64 public:
65 
68 
76  public:
79  };
80 
98  class BasisMatrixImp : public BasisMatrix {
99  public:
100 
103 
106 
108 
111 
120  virtual const fact_nonzeros_ptr_t& get_fact_nonzeros() const;
121 
123 
126 
128  const VectorSpace& space_cols() const;
130  const VectorSpace& space_rows() const;
132  size_type rows() const;
134  size_type cols() const;
135 
137 
140 
142  mat_mns_mut_ptr_t clone_mns();
143 
145 
148 
150  virtual const fact_struc_ptr_t& get_fact_struc() const;
151 
153 
154  protected:
155 
158 
161  BasisMatrixImp();
162 
166  size_type dim
167  ,const fact_struc_ptr_t &fact_struc
169  );
170 
173  virtual void initialize(
174  size_type dim
175  ,const fact_struc_ptr_t &fact_struc
177  );
178 
187  void set_uninitialized();
188 
190 
193 
195  virtual Teuchos::RCP<BasisMatrixImp> create_matrix() const = 0;
196 
198 
199  private:
200 
205  friend class DirectSparseSolverImp;
206 
207 #ifdef DOXYGEN_COMPILE
208  FactorizationStructure *fact_struc;
210 #else
211  size_type dim_;
212  fact_struc_ptr_t fact_struc_;
213  fact_nonzeros_ptr_t fact_nonzeros_;
214  VectorSpaceSerial vec_space_;
215 #endif
216 
217  }; // end class BasisMatrixImp
218 
220 
223 
225  void analyze_and_factor(
227  ,DenseLinAlgPack::IVector *row_perm
228  ,DenseLinAlgPack::IVector *col_perm
229  ,size_type *rank
230  ,BasisMatrix *basis_matrix
231  ,std::ostream *out
232  );
234  void factor(
236  ,BasisMatrix *basis_matrix
238  ,std::ostream *out
239  );
243  void set_uninitialized();
244 
246 
247 protected:
248 
251 
255 
259 
265  virtual void imp_analyze_and_factor(
267  ,FactorizationStructure *fact_struc
268  ,FactorizationNonzeros *fact_nonzeros
269  ,DenseLinAlgPack::IVector *row_perm
270  ,DenseLinAlgPack::IVector *col_perm
271  ,size_type *rank
272  ,std::ostream *out = NULL
273  ) = 0;
274 
280  virtual void imp_factor(
282  ,const FactorizationStructure &fact_struc
283  ,FactorizationNonzeros *fact_nonzeros
284  ,std::ostream *out = NULL
285  ) = 0;
286 
288 
289 private:
290 
291 #ifdef DOXYGEN_COMPILE
292  FactorizationStructure *fact_struc;
293 #else
294  BasisMatrix::fact_struc_ptr_t fact_struc_;
295  size_type rank_;
296 #endif
297 
298 }; // end class DirectSparseSolverImp
299 
300 } // end namespace AbstractLinAlgPack
301 
302 #endif // ALAP_DIRECT_SPARSE_SOLVER_IMP_H
const BasisMatrix::fact_struc_ptr_t & get_fact_struc() const
Abstract class for objects that represent the factorized matrix and can be used to solve for differen...
virtual const fact_nonzeros_ptr_t & get_fact_nonzeros() const
Return a reference to a smart pointer to the object that represents the factorization nonzeros...
virtual Teuchos::RCP< BasisMatrixImp > create_matrix() const =0
Called by this->clone-mns().
virtual const Teuchos::RCP< FactorizationStructure > create_fact_struc() const =0
Create a new, uninitialized FactorizationStructure object.
virtual const Teuchos::RCP< FactorizationNonzeros > create_fact_nonzeros() const =0
Create a new, uninitialized FactorizationNonzeros object.
void factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, BasisMatrix *basis_matrix, const BasisMatrix::fact_struc_ptr_t &fact_struc, std::ostream *out)
Abstract interface for objects that represent a space for mutable coordinate vectors.
virtual void imp_analyze_and_factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, FactorizationStructure *fact_struc, FactorizationNonzeros *fact_nonzeros, DenseLinAlgPack::IVector *row_perm, DenseLinAlgPack::IVector *col_perm, size_type *rank, std::ostream *out=NULL)=0
Called to implement the analyze_and_factor() without having to worry about memory mangagment details...
Mix-in interface for extracing explicit elements from a sparse matrix in one of several Fortran compa...
virtual void initialize(size_type dim, const fact_struc_ptr_t &fact_struc, const fact_nonzeros_ptr_t &fact_nonzeros)
Initialize given initialized factorization structure and factorization nonzeros objects.
std::ostream * out
void analyze_and_factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, DenseLinAlgPack::IVector *row_perm, DenseLinAlgPack::IVector *col_perm, size_type *rank, BasisMatrix *basis_matrix, std::ostream *out)
Implementation node class for DirectSparseSolver that takes care of the memory management details...
Implementation node subclass that combines factorization structure and factorization nonzeros into a ...
virtual void imp_factor(const AbstractLinAlgPack::MatrixConvertToSparse &A, const FactorizationStructure &fact_struc, FactorizationNonzeros *fact_nonzeros, std::ostream *out=NULL)=0
Called to implement the analyze_and_factor() without having to worry about memory mangagment details...
Abstract class for objects that represent the factorization nonzeros of a particular matrix...
Subclass for serial vector space objects that create VectorMutableDense vector and MultiVectorMutable...
Abstract interface to serial direct sparse linear solvers.