EpetraExt Package Browser (Single Doxygen Collection) Development
GLpApp_AdvDiffReactOptModel.hpp
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 GLP_APP_ADV_DIFF_REACT_OPT_MODEL_HPP
00045 #define GLP_APP_ADV_DIFF_REACT_OPT_MODEL_HPP
00046 
00047 #include "EpetraExt_ModelEvaluator.h"
00048 #include "GLpApp_GLpYUEpetraDataPool.hpp"
00049 #include "Epetra_Map.h"
00050 #include "Epetra_Vector.h"
00051 #include "Epetra_Comm.h"
00052 #include "Epetra_CrsGraph.h"
00053 #include "Teuchos_VerboseObject.hpp"
00054 #include "Teuchos_Array.hpp"
00055 
00056 namespace GLpApp {
00057 
00162 class AdvDiffReactOptModel
00163   : public EpetraExt::ModelEvaluator
00164   , public Teuchos::VerboseObject<AdvDiffReactOptModel>
00165 {
00166 public:
00167 
00169   AdvDiffReactOptModel(
00170     const Teuchos::RefCountPtr<const Epetra_Comm>  &comm
00171     ,const double                                  beta
00172     ,const double                                  len_x     // Ignored if meshFile is *not* empty
00173     ,const double                                  len_y     // Ignored if meshFile is *not* empty
00174     ,const int                                     local_nx  // Ignored if meshFile is *not* empty
00175     ,const int                                     local_ny  // Ignored if meshFile is *not* empty
00176     ,const char                                    meshFile[]
00177     ,const int                                     np
00178     ,const double                                  x0
00179     ,const double                                  p0
00180     ,const double                                  reactionRate
00181     ,const bool                                    normalizeBasis
00182     ,const bool                                    supportDerivatives
00183     );
00184 
00186   void set_q( Teuchos::RefCountPtr<const Epetra_Vector> const& q );
00187 
00189   Teuchos::RefCountPtr<GLpApp::GLpYUEpetraDataPool> getDataPool();
00190 
00192   Teuchos::RefCountPtr<const Epetra_MultiVector> get_B_bar() const;
00193 
00196 
00198   Teuchos::RefCountPtr<const Epetra_Map> get_x_map() const;
00200   Teuchos::RefCountPtr<const Epetra_Map> get_f_map() const;
00202   Teuchos::RefCountPtr<const Epetra_Map> get_p_map(int l) const;
00204   Teuchos::RefCountPtr<const Epetra_Map> get_g_map(int j) const;
00206   Teuchos::RefCountPtr<const Epetra_Vector> get_x_init() const;
00208   Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(int l) const;
00210   Teuchos::RefCountPtr<const Epetra_Vector> get_x_lower_bounds() const;
00212   Teuchos::RefCountPtr<const Epetra_Vector> get_x_upper_bounds() const;
00214   Teuchos::RefCountPtr<const Epetra_Vector> get_p_lower_bounds(int l) const;
00216   Teuchos::RefCountPtr<const Epetra_Vector> get_p_upper_bounds(int l) const;
00218   Teuchos::RefCountPtr<Epetra_Operator> create_W() const;
00220   Teuchos::RefCountPtr<Epetra_Operator> create_DfDp_op(int l) const;
00222   InArgs createInArgs() const;
00224   OutArgs createOutArgs() const;
00226   void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const;
00227 
00229 
00230 private:
00231 
00232   // /////////////////////////////////////
00233   // Private types
00234 
00235   typedef Teuchos::Array<Teuchos::RefCountPtr<const Epetra_Map> >  RCP_Eptra_Map_Array_t;
00236   typedef Teuchos::Array<Teuchos::RefCountPtr<Epetra_Vector> >     RCP_Eptra_Vector_Array_t;
00237 
00238   // /////////////////////////////////////
00239   // Private member data
00240 
00241   static const int Np_         = 2; // Number of axiliary parameters
00242   static const int p_bndy_idx  = 0; // index for boundary flux parameters
00243   static const int p_rx_idx    = 1; // index for reaction rate parameter
00244 
00245   bool      supportDerivatives_;
00246 
00247   bool      isInitialized_;
00248 
00249   Teuchos::RefCountPtr<GLpApp::GLpYUEpetraDataPool>   dat_;
00250   int                                                 np_;
00251   Teuchos::RefCountPtr<const Epetra_Vector>           q_;
00252 
00253   Teuchos::RefCountPtr<const Epetra_Map>              map_p_bar_;
00254   Teuchos::RefCountPtr<Epetra_MultiVector>            B_bar_;
00255 
00256   Teuchos::RefCountPtr<const Epetra_Comm>  epetra_comm_;
00257   Teuchos::RefCountPtr<const Epetra_Map>   map_x_;
00258   RCP_Eptra_Map_Array_t                    map_p_;
00259   Teuchos::RefCountPtr<const Epetra_Map>   map_f_;
00260   Teuchos::RefCountPtr<const Epetra_Map>   map_g_;
00261 
00262   Teuchos::RefCountPtr<Epetra_Vector> x0_;
00263   Teuchos::RefCountPtr<Epetra_Vector> xL_;
00264   Teuchos::RefCountPtr<Epetra_Vector> xU_;
00265   RCP_Eptra_Vector_Array_t            p0_;
00266   RCP_Eptra_Vector_Array_t            pL_;
00267   RCP_Eptra_Vector_Array_t            pU_;
00268   Teuchos::RefCountPtr<Epetra_Vector> gL_;
00269   Teuchos::RefCountPtr<Epetra_Vector> gU_;
00270 
00271   Teuchos::RefCountPtr<Epetra_CrsGraph>  W_graph_;
00272 
00273 };
00274 
00275 } // namespace GLpApp
00276 
00277 #endif // GLP_APP_ADV_DIFF_REACT_OPT_MODEL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines