00001 //*****************************************************************// 00002 // Albany 2.0: Copyright 2012 Sandia Corporation // 00003 // This Software is released under the BSD license detailed // 00004 // in the file "license.txt" in the top-level Albany directory // 00005 //*****************************************************************// 00006 #ifndef MOR_GAUSSNEWTONOPERATORFACTOR_HPP 00007 #define MOR_GAUSSNEWTONOPERATORFACTOR_HPP 00008 00009 #include "MOR_ReducedOperatorFactory.hpp" 00010 00011 class Epetra_MultiVector; 00012 class Epetra_CrsMatrix; 00013 class Epetra_Operator; 00014 00015 #include "MOR_ReducedJacobianFactory.hpp" 00016 00017 #include "Teuchos_RCP.hpp" 00018 00019 namespace MOR { 00020 00021 template <typename Derived> 00022 class GaussNewtonOperatorFactoryBase : public ReducedOperatorFactory { 00023 public: 00024 explicit GaussNewtonOperatorFactoryBase(const Teuchos::RCP<const Epetra_MultiVector> &reducedBasis); 00025 00026 virtual bool fullJacobianRequired(bool residualRequested, bool jacobianRequested) const; 00027 00028 virtual const Epetra_MultiVector &leftProjection(const Epetra_MultiVector &fullVec, Epetra_MultiVector &result) const; 00029 00030 virtual Teuchos::RCP<Epetra_CrsMatrix> reducedJacobianNew(); 00031 virtual const Epetra_CrsMatrix &reducedJacobian(Epetra_CrsMatrix &result) const; 00032 00033 virtual void fullJacobianIs(const Epetra_Operator &op); 00034 00035 protected: 00036 Teuchos::RCP<const Epetra_MultiVector> getPremultipliedReducedBasis() const; 00037 00038 private: 00039 Teuchos::RCP<const Epetra_MultiVector> reducedBasis_; 00040 00041 ReducedJacobianFactory jacobianFactory_; 00042 00043 Teuchos::RCP<const Epetra_MultiVector> getLeftBasis() const; 00044 }; 00045 00046 class GaussNewtonOperatorFactory : public GaussNewtonOperatorFactoryBase<GaussNewtonOperatorFactory> { 00047 public: 00048 explicit GaussNewtonOperatorFactory(const Teuchos::RCP<const Epetra_MultiVector> &reducedBasis); 00049 00050 Teuchos::RCP<const Epetra_MultiVector> leftProjectorBasis() const; 00051 }; 00052 00053 class GaussNewtonMetricOperatorFactory : public GaussNewtonOperatorFactoryBase<GaussNewtonMetricOperatorFactory> { 00054 public: 00055 GaussNewtonMetricOperatorFactory(const Teuchos::RCP<const Epetra_MultiVector> &reducedBasis, 00056 const Teuchos::RCP<const Epetra_Operator> &metric); 00057 00058 // Overridden 00059 virtual void fullJacobianIs(const Epetra_Operator &op); 00060 00061 Teuchos::RCP<const Epetra_MultiVector> leftProjectorBasis() const; 00062 00063 private: 00064 Teuchos::RCP<const Epetra_Operator> metric_; 00065 00066 Teuchos::RCP<Epetra_MultiVector> premultipliedLeftProjector_; 00067 00068 void updatePremultipliedLeftProjector(); 00069 }; 00070 00071 } // namespace MOR 00072 00073 #endif /* MOR_GAUSSNEWTONOPERATORFACTOR_HPP */