FEApp_SGMatrixFreeOp.hpp

Go to the documentation of this file.
00001 // $Id: FEApp_SGMatrixFreeOp.hpp,v 1.1 2008/08/01 22:57:12 etphipp Exp $ 
00002 // $Source: /space/CVS/Trilinos/packages/sacado/example/FEApp/FEApp_SGMatrixFreeOp.hpp,v $ 
00003 // @HEADER
00004 // ***********************************************************************
00005 // 
00006 //                           Sacado Package
00007 //                 Copyright (2006) Sandia Corporation
00008 // 
00009 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00010 // the U.S. Government retains certain rights in this software.
00011 // 
00012 // This library is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU Lesser General Public License as
00014 // published by the Free Software Foundation; either version 2.1 of the
00015 // License, or (at your option) any later version.
00016 //  
00017 // This library is distributed in the hope that it will be useful, but
00018 // WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 // Lesser General Public License for more details.
00021 //  
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License along with this library; if not, write to the Free Software
00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 // USA
00026 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
00027 // (etphipp@sandia.gov).
00028 // 
00029 // ***********************************************************************
00030 // @HEADER
00031 
00032 #ifndef FEAPP_SGMATRIXFREEOP_HPP
00033 #define FEAPP_SGMATRIXFREEOP_HPP
00034 
00035 #include "FEApp_TemplateTypes.hpp"
00036 
00037 #if SGFAD_ACTIVE
00038 
00039 #include "Teuchos_RCP.hpp"
00040 
00041 #include "Epetra_Operator.h"
00042 #include "Epetra_Map.h"
00043 #include "Epetra_Comm.h"
00044 #include "Epetra_CrsMatrix.h"
00045 #include "Epetra_MultiVector.h"
00046 #include "EpetraExt_BlockMultiVector.h"
00047 
00048 namespace FEApp {
00049     
00053   class SGMatrixFreeOp : public Epetra_Operator {
00054       
00055   public:
00056 
00057     typedef SGType::expansion_type::tp_type tp_type;
00058 
00060     SGMatrixFreeOp(const Teuchos::RCP<const Epetra_Map>& base_map,
00061        const Teuchos::RCP<const Epetra_Map>& sg_map,
00062        const Teuchos::RCP<const tp_type >& Cijk,
00063        const Teuchos::RCP<std::vector< Teuchos::RCP<Epetra_CrsMatrix> > >& jacs);
00064     
00066     virtual ~SGMatrixFreeOp();
00067 
00069     virtual std::vector< Teuchos::RCP<Epetra_CrsMatrix> >&
00070     getJacobianBlocks();
00071     
00073     virtual int SetUseTranspose(bool UseTranspose);
00074     
00079     virtual int Apply(const Epetra_MultiVector& Input, 
00080           Epetra_MultiVector& Result) const;
00081 
00086     virtual int ApplyInverse(const Epetra_MultiVector& X, 
00087            Epetra_MultiVector& Y) const;
00088     
00090     virtual double NormInf() const;
00091     
00093     virtual const char* Label () const;
00094   
00096     virtual bool UseTranspose() const;
00097     
00102     virtual bool HasNormInf() const;
00103 
00108     virtual const Epetra_Comm & Comm() const;
00109 
00114     virtual const Epetra_Map& OperatorDomainMap () const;
00115 
00120     virtual const Epetra_Map& OperatorRangeMap () const;
00121 
00122   private:
00123     
00125     SGMatrixFreeOp(const SGMatrixFreeOp&);
00126     
00128     SGMatrixFreeOp& operator=(const SGMatrixFreeOp&);
00129     
00130   protected:
00131     
00133     string label;
00134     
00136     Teuchos::RCP<const Epetra_Map> base_map;
00137 
00139     Teuchos::RCP<const Epetra_Map> sg_map;
00140 
00142     Teuchos::RCP<const tp_type > Cijk;
00143 
00145     Teuchos::RCP<std::vector< Teuchos::RCP<Epetra_CrsMatrix> > > jacs;
00146 
00148     bool useTranspose;
00149 
00151     unsigned int num_blocks;
00152 
00154     mutable Teuchos::RCP<EpetraExt::BlockMultiVector> sg_input;
00155 
00157     mutable Teuchos::RCP<EpetraExt::BlockMultiVector> sg_result;
00158 
00160     mutable std::vector< Teuchos::RCP<Epetra_MultiVector> > input_block;
00161 
00163     mutable std::vector< Teuchos::RCP<Epetra_MultiVector> > result_block;
00164 
00166     mutable Teuchos::RCP<Epetra_MultiVector> tmp;
00167 
00168   }; // class SGMatrixFreeOp
00169   
00170 } // namespace FEApp
00171 
00172 #endif // SGFAD_ACTIVE
00173 
00174 #endif // FEAPP_SGMATRIXFREEOP_HPP

Generated on Wed May 12 21:59:04 2010 for Sacado Package Browser (Single Doxygen Collection) by  doxygen 1.4.7