MOOCHO (Single Doxygen Collection) Version of the Day
AbstractLinAlgPack_DirectSparseSolverImp.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 ALAP_DIRECT_SPARSE_SOLVER_IMP_H
00030 #define ALAP_DIRECT_SPARSE_SOLVER_IMP_H
00031 
00032 #include "AbstractLinAlgPack_DirectSparseSolver.hpp"
00033 #include "AbstractLinAlgPack_VectorSpaceSerial.hpp"
00034 
00035 namespace AbstractLinAlgPack {
00036 
00037 class DirectSparseSolverImp;
00038 
00050 class DirectSparseSolverImp : public DirectSparseSolver {
00051 public:
00052 
00055 
00062   class FactorizationNonzeros {
00063   public:
00065     virtual ~FactorizationNonzeros() {}
00066   };
00067 
00085   class BasisMatrixImp : public BasisMatrix {
00086   public:
00087 
00090 
00092     typedef Teuchos::RCP<FactorizationNonzeros> fact_nonzeros_ptr_t;
00093 
00095 
00098 
00107     virtual const fact_nonzeros_ptr_t&  get_fact_nonzeros() const;
00108 
00110 
00113 
00115     const VectorSpace& space_cols() const;
00117     const VectorSpace& space_rows() const;
00119     size_type rows() const;
00121     size_type cols() const;
00122 
00124 
00127 
00129     mat_mns_mut_ptr_t clone_mns();
00130 
00132 
00135 
00137     virtual const fact_struc_ptr_t&  get_fact_struc() const;
00138 
00140 
00141   protected:
00142 
00145 
00148     BasisMatrixImp();
00149 
00152     BasisMatrixImp(
00153       size_type                      dim
00154       ,const fact_struc_ptr_t        &fact_struc
00155       ,const fact_nonzeros_ptr_t     &fact_nonzeros
00156       );
00157 
00160     virtual void initialize(
00161       size_type                      dim
00162       ,const fact_struc_ptr_t        &fact_struc
00163       ,const fact_nonzeros_ptr_t     &fact_nonzeros
00164       );
00165 
00174     void set_uninitialized();
00175 
00177 
00180 
00182     virtual Teuchos::RCP<BasisMatrixImp> create_matrix() const = 0;
00183 
00185 
00186   private:
00187 
00192     friend class DirectSparseSolverImp;
00193 
00194 #ifdef DOXYGEN_COMPILE
00195     FactorizationStructure    *fact_struc;
00196     FactorizationNonzeros     *fact_nonzeros;
00197 #else
00198     size_type                 dim_;
00199     fact_struc_ptr_t          fact_struc_;
00200     fact_nonzeros_ptr_t       fact_nonzeros_;
00201     VectorSpaceSerial         vec_space_;
00202 #endif
00203 
00204   }; // end class BasisMatrixImp
00205 
00207 
00210 
00212   void analyze_and_factor(
00213     const AbstractLinAlgPack::MatrixConvertToSparse   &A
00214     ,DenseLinAlgPack::IVector                            *row_perm
00215     ,DenseLinAlgPack::IVector                            *col_perm
00216     ,size_type                                      *rank
00217     ,BasisMatrix                                    *basis_matrix
00218     ,std::ostream                                   *out
00219     );
00221   void factor(
00222     const AbstractLinAlgPack::MatrixConvertToSparse   &A
00223     ,BasisMatrix                                    *basis_matrix
00224     ,const BasisMatrix::fact_struc_ptr_t            &fact_struc
00225     ,std::ostream                                   *out
00226     );
00228   const BasisMatrix::fact_struc_ptr_t& get_fact_struc() const;
00230   void set_uninitialized();
00231 
00233 
00234 protected:
00235 
00238 
00241   virtual const Teuchos::RCP<FactorizationStructure> create_fact_struc() const = 0;
00242 
00245   virtual const Teuchos::RCP<FactorizationNonzeros> create_fact_nonzeros() const = 0;
00246 
00252   virtual void imp_analyze_and_factor(
00253     const AbstractLinAlgPack::MatrixConvertToSparse   &A
00254     ,FactorizationStructure                         *fact_struc
00255     ,FactorizationNonzeros                          *fact_nonzeros
00256     ,DenseLinAlgPack::IVector                            *row_perm
00257     ,DenseLinAlgPack::IVector                            *col_perm
00258     ,size_type                                      *rank
00259     ,std::ostream                                   *out            = NULL
00260     ) = 0;
00261 
00267   virtual void imp_factor(
00268     const AbstractLinAlgPack::MatrixConvertToSparse   &A
00269     ,const FactorizationStructure                   &fact_struc
00270     ,FactorizationNonzeros                          *fact_nonzeros
00271     ,std::ostream                                   *out            = NULL
00272     ) = 0;
00273 
00275 
00276 private:
00277 
00278 #ifdef DOXYGEN_COMPILE
00279     FactorizationStructure           *fact_struc;
00280 #else
00281     BasisMatrix::fact_struc_ptr_t    fact_struc_;
00282     size_type                        rank_;
00283 #endif
00284 
00285 };  // end class DirectSparseSolverImp 
00286 
00287 } // end namespace AbstractLinAlgPack 
00288 
00289 #endif  // ALAP_DIRECT_SPARSE_SOLVER_IMP_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines