EpetraExt Package Browser (Single Doxygen Collection) Development
EpetraExt_MultiPointModelEvaluator.h
Go to the documentation of this file.
00001 /*
00002 //@HEADER
00003 // ***********************************************************************
00004 //
00005 //     EpetraExt: Epetra Extended - Linear Algebra Services Package
00006 //                 Copyright (2011) Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
00039 //
00040 // ***********************************************************************
00041 //@HEADER
00042 */
00043 
00044 #ifndef EPETRAEXT_MULTIPOINTMODELEVALUATOR_H
00045 #define EPETRAEXT_MULTIPOINTMODELEVALUATOR_H
00046 
00047 #include "EpetraExt_ModelEvaluator.h"
00048 #include "EpetraExt_BlockCrsMatrix.h"
00049 #include "EpetraExt_BlockVector.h"
00050 #include "EpetraExt_BlockMultiVector.h"
00051 #ifdef HAVE_MPI
00052 #include "EpetraExt_MultiMpiComm.h"
00053 #else
00054 #include "EpetraExt_MultiSerialComm.h"
00055 #endif
00056 
00066 namespace EpetraExt {
00067   class MultiPointModelEvaluator
00068     : public ModelEvaluator
00069   {
00070   public:
00071 
00074 
00076   MultiPointModelEvaluator(
00077     Teuchos::RefCountPtr<EpetraExt::ModelEvaluator> underlyingME_,
00078     const Teuchos::RefCountPtr<EpetraExt::MultiComm> &globalComm_,
00079     const std::vector<Epetra_Vector*> initGuessVec,
00080     Teuchos::RefCountPtr<std::vector< Teuchos::RefCountPtr<Epetra_Vector> > >  q_vec,
00081     Teuchos::RefCountPtr<std::vector< Teuchos::RefCountPtr<Epetra_Vector> > >  matching_vec = Teuchos::null
00082     );
00083 
00085 
00086   ~MultiPointModelEvaluator();
00087 
00088 
00091 
00093   Teuchos::RefCountPtr<const Epetra_Map> get_x_map() const;
00095   Teuchos::RefCountPtr<const Epetra_Map> get_f_map() const;
00097   Teuchos::RefCountPtr<const Epetra_Map> get_p_map(int l) const;
00099   Teuchos::RefCountPtr<const Epetra_Map> get_g_map(int j) const;
00101   Teuchos::RefCountPtr<const Epetra_Vector> get_x_init() const;
00103   Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(int l) const;
00105   Teuchos::RefCountPtr<Epetra_Operator> create_W() const;
00107   InArgs createInArgs() const;
00109   OutArgs createOutArgs() const;
00111   void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const;
00112 
00114 
00115   private:
00116 
00117    Teuchos::RefCountPtr<EpetraExt::ModelEvaluator> underlyingME;
00118 
00120    Teuchos::RefCountPtr<EpetraExt::MultiComm> globalComm;
00121 
00123    Teuchos::RefCountPtr<std::vector< Teuchos::RefCountPtr<Epetra_Vector> > > q_vec;
00124 
00126    Teuchos::RefCountPtr<Epetra_RowMatrix> split_W;
00127 
00129    Teuchos::RefCountPtr<Epetra_Vector> split_x;
00130 
00132    Teuchos::RefCountPtr<Epetra_Vector> split_f;
00133 
00135    Teuchos::RefCountPtr<Epetra_Vector> split_g;
00136 
00138    Teuchos::RefCountPtr<Epetra_MultiVector> split_DfDp;
00139 
00141    Teuchos::RefCountPtr<Epetra_MultiVector> split_DgDx;
00142    Teuchos::RefCountPtr<Epetra_MultiVector> split_DgDp;
00143 
00144    EpetraExt::ModelEvaluator::DerivativeMultiVector* derivMV_DfDp;
00145    EpetraExt::ModelEvaluator::Derivative* deriv_DfDp;
00146    EpetraExt::ModelEvaluator::DerivativeMultiVector* derivMV_DgDx;
00147    EpetraExt::ModelEvaluator::Derivative* deriv_DgDx;
00148    EpetraExt::ModelEvaluator::DerivativeMultiVector* derivMV_DgDp;
00149    EpetraExt::ModelEvaluator::Derivative* deriv_DgDp;
00150 
00152    Teuchos::RefCountPtr<EpetraExt::BlockCrsMatrix> block_W;
00153 
00155    EpetraExt::BlockVector* block_x;
00156 
00158    EpetraExt::BlockVector* block_f;
00159 
00161    EpetraExt::BlockMultiVector* block_DfDp;
00162 
00164    EpetraExt::BlockMultiVector* block_DgDx;
00165 
00167    Teuchos::RefCountPtr<EpetraExt::BlockVector> solution_init;
00168 
00170    int underlyingNg;
00171 
00173    int timeStepsOnTimeDomain;
00174 
00176    int numTimeDomains;
00177 
00179    int timeDomain;
00180 
00187    std::vector< std::vector<int> >* rowStencil;
00188 
00190    std::vector<int>* rowIndex;
00191 
00193    EDerivativeMultiVectorOrientation orientation_DgDp;
00194    int num_dg0dp0;
00195    int num_g0;
00196    int num_p0;
00197 
00199    Teuchos::RefCountPtr<std::vector< Teuchos::RefCountPtr<Epetra_Vector> > > matching_vec;
00200    bool matchingProblem;
00201 
00202   };
00203 }
00204 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines