|
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 ALAP_DIRECT_SPARSE_SOLVER_IMP_H 00043 #define ALAP_DIRECT_SPARSE_SOLVER_IMP_H 00044 00045 #include "AbstractLinAlgPack_DirectSparseSolver.hpp" 00046 #include "AbstractLinAlgPack_VectorSpaceSerial.hpp" 00047 00048 namespace AbstractLinAlgPack { 00049 00050 class DirectSparseSolverImp; 00051 00063 class DirectSparseSolverImp : public DirectSparseSolver { 00064 public: 00065 00068 00075 class FactorizationNonzeros { 00076 public: 00078 virtual ~FactorizationNonzeros() {} 00079 }; 00080 00098 class BasisMatrixImp : public BasisMatrix { 00099 public: 00100 00103 00105 typedef Teuchos::RCP<FactorizationNonzeros> fact_nonzeros_ptr_t; 00106 00108 00111 00120 virtual const fact_nonzeros_ptr_t& get_fact_nonzeros() const; 00121 00123 00126 00128 const VectorSpace& space_cols() const; 00130 const VectorSpace& space_rows() const; 00132 size_type rows() const; 00134 size_type cols() const; 00135 00137 00140 00142 mat_mns_mut_ptr_t clone_mns(); 00143 00145 00148 00150 virtual const fact_struc_ptr_t& get_fact_struc() const; 00151 00153 00154 protected: 00155 00158 00161 BasisMatrixImp(); 00162 00165 BasisMatrixImp( 00166 size_type dim 00167 ,const fact_struc_ptr_t &fact_struc 00168 ,const fact_nonzeros_ptr_t &fact_nonzeros 00169 ); 00170 00173 virtual void initialize( 00174 size_type dim 00175 ,const fact_struc_ptr_t &fact_struc 00176 ,const fact_nonzeros_ptr_t &fact_nonzeros 00177 ); 00178 00187 void set_uninitialized(); 00188 00190 00193 00195 virtual Teuchos::RCP<BasisMatrixImp> create_matrix() const = 0; 00196 00198 00199 private: 00200 00205 friend class DirectSparseSolverImp; 00206 00207 #ifdef DOXYGEN_COMPILE 00208 FactorizationStructure *fact_struc; 00209 FactorizationNonzeros *fact_nonzeros; 00210 #else 00211 size_type dim_; 00212 fact_struc_ptr_t fact_struc_; 00213 fact_nonzeros_ptr_t fact_nonzeros_; 00214 VectorSpaceSerial vec_space_; 00215 #endif 00216 00217 }; // end class BasisMatrixImp 00218 00220 00223 00225 void analyze_and_factor( 00226 const AbstractLinAlgPack::MatrixConvertToSparse &A 00227 ,DenseLinAlgPack::IVector *row_perm 00228 ,DenseLinAlgPack::IVector *col_perm 00229 ,size_type *rank 00230 ,BasisMatrix *basis_matrix 00231 ,std::ostream *out 00232 ); 00234 void factor( 00235 const AbstractLinAlgPack::MatrixConvertToSparse &A 00236 ,BasisMatrix *basis_matrix 00237 ,const BasisMatrix::fact_struc_ptr_t &fact_struc 00238 ,std::ostream *out 00239 ); 00241 const BasisMatrix::fact_struc_ptr_t& get_fact_struc() const; 00243 void set_uninitialized(); 00244 00246 00247 protected: 00248 00251 00254 virtual const Teuchos::RCP<FactorizationStructure> create_fact_struc() const = 0; 00255 00258 virtual const Teuchos::RCP<FactorizationNonzeros> create_fact_nonzeros() const = 0; 00259 00265 virtual void imp_analyze_and_factor( 00266 const AbstractLinAlgPack::MatrixConvertToSparse &A 00267 ,FactorizationStructure *fact_struc 00268 ,FactorizationNonzeros *fact_nonzeros 00269 ,DenseLinAlgPack::IVector *row_perm 00270 ,DenseLinAlgPack::IVector *col_perm 00271 ,size_type *rank 00272 ,std::ostream *out = NULL 00273 ) = 0; 00274 00280 virtual void imp_factor( 00281 const AbstractLinAlgPack::MatrixConvertToSparse &A 00282 ,const FactorizationStructure &fact_struc 00283 ,FactorizationNonzeros *fact_nonzeros 00284 ,std::ostream *out = NULL 00285 ) = 0; 00286 00288 00289 private: 00290 00291 #ifdef DOXYGEN_COMPILE 00292 FactorizationStructure *fact_struc; 00293 #else 00294 BasisMatrix::fact_struc_ptr_t fact_struc_; 00295 size_type rank_; 00296 #endif 00297 00298 }; // end class DirectSparseSolverImp 00299 00300 } // end namespace AbstractLinAlgPack 00301 00302 #endif // ALAP_DIRECT_SPARSE_SOLVER_IMP_H
1.7.6.1