ConstrainedOptPack_DecompositionSystemVarReductImp.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 DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H
00030 #define DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H
00031 
00032 #include "ConstrainedOptPack_DecompositionSystemVarReduct.hpp"
00033 #include "AbstractLinAlgPack_BasisSystemTester.hpp"
00034 #include "AbstractLinAlgPack_VectorSpace.hpp"
00035 #include "Teuchos_StandardCompositionMacros.hpp"
00036 #include "Teuchos_StandardMemberCompositionMacros.hpp"
00037 
00038 namespace ConstrainedOptPack {
00039 
00079 class DecompositionSystemVarReductImp : public DecompositionSystemVarReduct {
00080 public:
00081 
00084 
00086   typedef DecompositionSystem                                inherited;
00088   typedef Teuchos::RCP<const BasisSystem>       basis_sys_ptr_t;
00089 
00091 
00094 
00096   STANDARD_COMPOSITION_MEMBERS( BasisSystemTester, basis_sys_tester );
00097 
00110   DecompositionSystemVarReductImp(
00111     const VectorSpace::space_ptr_t     &space_x
00112     ,const VectorSpace::space_ptr_t    &space_c
00113     ,const basis_sys_ptr_t             &basis_sys
00114     ,const basis_sys_tester_ptr_t      &basis_sys_tester
00115     ,EExplicitImplicit                 D_imp
00116     ,EExplicitImplicit                 Uz_imp
00117     );
00118 
00120 
00144   void initialize(
00145     const VectorSpace::space_ptr_t     &space_x
00146     ,const VectorSpace::space_ptr_t    &space_c
00147     ,const basis_sys_ptr_t             &basis_sys
00148     );
00149 
00152   
00154   const VectorSpace::space_ptr_t& space_x() const;
00156   const VectorSpace::space_ptr_t& space_c() const;
00158   const basis_sys_ptr_t& basis_sys() const;
00159 
00161 
00164 
00201   void get_basis_matrices(
00202     std::ostream                                      *out
00203     ,EOutputLevel                                     olevel
00204     ,ERunTests                                        test_what
00205     ,MatrixOp                                         *Z
00206     ,MatrixOp                                         *Y
00207     ,MatrixOpNonsing                                  *R
00208     ,MatrixOp                                         *Uz
00209     ,MatrixOp                                         *Uy
00210     ,Teuchos::RCP<MatrixOpNonsing>       *C_ptr
00211     ,Teuchos::RCP<MatrixOp>              *D_ptr
00212     );
00213 
00242   void set_basis_matrices(
00243     std::ostream                                       *out
00244     ,EOutputLevel                                      olevel
00245     ,ERunTests                                         test_what
00246     ,const Teuchos::RCP<MatrixOpNonsing>  &C_ptr
00247     ,const Teuchos::RCP<MatrixOp>         &D_ptr
00248     ,MatrixOp                                          *Uz
00249     ,const basis_sys_ptr_t                             &basis_sys   = Teuchos::null
00250     );
00251 
00253   EExplicitImplicit D_imp_used() const; 
00254 
00256 
00259 
00261   size_type n() const;
00263   size_type m() const;
00265   size_type r() const;
00267   const VectorSpace::space_ptr_t space_range() const;
00269   const VectorSpace::space_ptr_t space_null() const;
00271   const mat_fcty_ptr_t factory_Z() const;
00273   const mat_fcty_ptr_t factory_Uz() const;
00282   void update_decomp(
00283     std::ostream          *out
00284     ,EOutputLevel         olevel
00285     ,ERunTests            test_what
00286     ,const MatrixOp       &Gc
00287     ,MatrixOp             *Z
00288     ,MatrixOp             *Y
00289     ,MatrixOpNonsing      *R
00290     ,MatrixOp             *Uz
00291     ,MatrixOp             *Uy
00292     ,EMatRelations        mat_rel
00293     ) const;
00295   void print_update_decomp(
00296     std::ostream& out, const std::string& leading_str ) const;
00297 
00299 
00302 
00304   Range1D var_indep() const;
00306   Range1D var_dep() const;
00307 
00309 
00310 protected:
00311 
00313   virtual void update_D_imp_used(EExplicitImplicit *D_imp_used) const;
00314 
00323   virtual mat_nonsing_fcty_ptr_t::element_type::obj_ptr_t uninitialize_matrices(
00324     std::ostream                     *out
00325     ,EOutputLevel                    olevel
00326     ,MatrixOp                        *Y
00327     ,MatrixOpNonsing                 *R
00328     ,MatrixOp                        *Uy
00329     ) const = 0;
00330 
00339   virtual void initialize_matrices(
00340     std::ostream                                           *out
00341     ,EOutputLevel                                          olevel
00342     ,const mat_nonsing_fcty_ptr_t::element_type::obj_ptr_t &C_ptr
00343     ,const mat_fcty_ptr_t::element_type::obj_ptr_t         &D_ptr
00344     ,MatrixOp                                              *Y
00345     ,MatrixOpNonsing                                       *R
00346     ,MatrixOp                                              *Uy
00347     ,EMatRelations                                         mat_rel
00348     ) const = 0;
00349 
00354   virtual void print_update_matrices(
00355     std::ostream& out, const std::string& leading_str ) const = 0;
00356 
00357 private:
00358 
00359   // //////////////////////////////////
00360   // Private data members
00361   
00362 #ifdef DOXYGEN_COMPILE
00363   AbstractLinAlgPack::BasisSystem       *basis_sys;
00364   VectorSpace                           *space_x;
00365   VectorSpace                           *space_c;
00366   VectorSpace                           *space_range;
00367   VectorSpace                           *space_null;
00368 #else
00369   basis_sys_ptr_t                       basis_sys_;
00370   VectorSpace::space_ptr_t              space_x_;
00371   VectorSpace::space_ptr_t              space_c_;
00372   VectorSpace::space_ptr_t              space_range_;
00373   VectorSpace::space_ptr_t              space_null_;
00374   mutable Teuchos::RCP<MatrixOpNonsing>  C_ptr_;
00375   mutable Teuchos::RCP<MatrixOp>             D_ptr_;
00376   mutable EExplicitImplicit                                   D_imp_used_;
00377 #endif
00378   // //////////////////////////////////
00379   // Private member functions
00380 
00382   void alloc_new_D_matrix( 
00383     std::ostream                             *out
00384     ,EOutputLevel                            olevel
00385     ,Teuchos::RCP<MatrixOp> *D_ptr
00386     ) const;
00387   
00388   // not defined and not to be called!
00389   DecompositionSystemVarReductImp(const DecompositionSystemVarReductImp&);
00390   DecompositionSystemVarReductImp& operator=(const DecompositionSystemVarReductImp&);
00391   
00392 };  // end class DecompositionSystemVarReductImp
00393 
00394 // //////////////////////////////////////////
00395 // Inline members
00396 
00397 inline
00398 const VectorSpace::space_ptr_t&
00399 DecompositionSystemVarReductImp::space_x() const
00400 {
00401   return space_x_;
00402 }
00403 
00404 inline
00405 const VectorSpace::space_ptr_t&
00406 DecompositionSystemVarReductImp::space_c() const
00407 {
00408   return space_c_;
00409 }
00410 
00411 inline
00412 const DecompositionSystemVarReductImp::basis_sys_ptr_t&
00413 DecompositionSystemVarReductImp::basis_sys() const
00414 {
00415   return basis_sys_;
00416 }
00417 
00418 inline
00419 DecompositionSystemVarReductImp::EExplicitImplicit
00420 DecompositionSystemVarReductImp::D_imp_used() const
00421 {
00422   update_D_imp_used(&D_imp_used_);
00423   return D_imp_used_;
00424 }
00425 
00426 } // end namespace ConstrainedOptPack
00427 
00428 #endif  // DECOMPOSITION_SYSTEM_VAR_REDUCT_IMP_H

Generated on Tue Jul 13 09:30:51 2010 for MOOCHO (Single Doxygen Collection) by  doxygen 1.4.7