EpetraExt 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 "Epetra_ConfigDefs.h"
00048 #include "EpetraExt_ModelEvaluator.h"
00049 #include "EpetraExt_BlockCrsMatrix.h"
00050 #include "EpetraExt_BlockVector.h"
00051 #include "EpetraExt_BlockMultiVector.h"
00052 #ifdef HAVE_MPI
00053 #include "EpetraExt_MultiMpiComm.h"
00054 #else
00055 #include "EpetraExt_MultiSerialComm.h"
00056 #endif
00057 
00067 namespace EpetraExt {
00068   class MultiPointModelEvaluator
00069     : public ModelEvaluator
00070   {
00071   public:
00072 
00075 
00077   MultiPointModelEvaluator(
00078     Teuchos::RefCountPtr<EpetraExt::ModelEvaluator> underlyingME_,
00079     const Teuchos::RefCountPtr<EpetraExt::MultiComm> &globalComm_,
00080     const std::vector<Epetra_Vector*> initGuessVec,
00081     Teuchos::RefCountPtr<std::vector< Teuchos::RefCountPtr<Epetra_Vector> > >  qvec,
00082     Teuchos::RefCountPtr<std::vector< Teuchos::RefCountPtr<Epetra_Vector> > >  matching_vec = Teuchos::null
00083     );
00084 
00086 
00087   ~MultiPointModelEvaluator();
00088 
00089 
00092 
00094   Teuchos::RefCountPtr<const Epetra_Map> get_x_map() const;
00096   Teuchos::RefCountPtr<const Epetra_Map> get_f_map() const;
00098   Teuchos::RefCountPtr<const Epetra_Map> get_p_map(int l) const;
00100   Teuchos::RefCountPtr<const Epetra_Map> get_g_map(int j) const;
00102   Teuchos::RefCountPtr<const Epetra_Vector> get_x_init() const;
00104   Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(int l) const;
00106   Teuchos::RefCountPtr<Epetra_Operator> create_W() const;
00108   InArgs createInArgs() const;
00110   OutArgs createOutArgs() const;
00112   void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const;
00113 
00115 
00116   private:
00117 
00118    Teuchos::RefCountPtr<EpetraExt::ModelEvaluator> underlyingME;
00119 
00121    Teuchos::RefCountPtr<EpetraExt::MultiComm> globalComm;
00122 
00124    Teuchos::RefCountPtr<std::vector< Teuchos::RefCountPtr<Epetra_Vector> > > q_vec;
00125 
00127    Teuchos::RefCountPtr<Epetra_RowMatrix> split_W;
00128 
00130    Teuchos::RefCountPtr<Epetra_Vector> split_x;
00131 
00133    Teuchos::RefCountPtr<Epetra_Vector> split_f;
00134 
00136    Teuchos::RefCountPtr<Epetra_Vector> split_g;
00137 
00139    Teuchos::RefCountPtr<Epetra_MultiVector> split_DfDp;
00140 
00142    Teuchos::RefCountPtr<Epetra_MultiVector> split_DgDx;
00143    Teuchos::RefCountPtr<Epetra_MultiVector> split_DgDp;
00144 
00145    EpetraExt::ModelEvaluator::DerivativeMultiVector* derivMV_DfDp;
00146    EpetraExt::ModelEvaluator::Derivative* deriv_DfDp;
00147    EpetraExt::ModelEvaluator::DerivativeMultiVector* derivMV_DgDx;
00148    EpetraExt::ModelEvaluator::Derivative* deriv_DgDx;
00149    EpetraExt::ModelEvaluator::DerivativeMultiVector* derivMV_DgDp;
00150    EpetraExt::ModelEvaluator::Derivative* deriv_DgDp;
00151 
00153    Teuchos::RefCountPtr<EpetraExt::BlockCrsMatrix> block_W;
00154 
00156    EpetraExt::BlockVector* block_x;
00157 
00159    EpetraExt::BlockVector* block_f;
00160 
00162    EpetraExt::BlockMultiVector* block_DfDp;
00163 
00165    EpetraExt::BlockMultiVector* block_DgDx;
00166 
00168    Teuchos::RefCountPtr<EpetraExt::BlockVector> solution_init;
00169 
00171    int underlyingNg;
00172 
00174    int timeStepsOnTimeDomain;
00175 
00177    int numTimeDomains;
00178 
00180    int timeDomain;
00181 
00188 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00189    std::vector< std::vector<int> >* rowStencil_int;
00190 #endif
00191 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00192    std::vector< std::vector<long long> >* rowStencil_LL;
00193 #endif
00194 
00196 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
00197    std::vector<int>* rowIndex_int;
00198 #endif
00199 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
00200    std::vector<long long>* rowIndex_LL;
00201 #endif
00202    bool longlong;
00203 
00205    EDerivativeMultiVectorOrientation orientation_DgDp;
00206    int num_dg0dp0;
00207    int num_g0;
00208    int num_p0;
00209 
00211    Teuchos::RefCountPtr<std::vector< Teuchos::RefCountPtr<Epetra_Vector> > > matching_vec;
00212    bool matchingProblem;
00213 
00214   };
00215 }
00216 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines