EpetraExt Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EpetraExt_DiagonalTransientModel.hpp
Go to the documentation of this file.
1 //@HEADER
2 // ***********************************************************************
3 //
4 // EpetraExt: Epetra Extended - Linear Algebra Services Package
5 // Copyright (2011) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 
42 #ifndef EPETRA_EXT_DIAGONAL_TRANSIENT_MODEL_HPP
43 #define EPETRA_EXT_DIAGONAL_TRANSIENT_MODEL_HPP
44 
45 
49 #include "Teuchos_Array.hpp"
50 
51 
52 class Epetra_Comm;
53 class Epetra_CrsGraph;
54 
55 
56 namespace EpetraExt {
57 
58 
101  public Teuchos::VerboseObject<DiagonalTransientModel>,
103 {
104 public:
105 
108 
111  Teuchos::RCP<Epetra_Comm> const& epetra_comm
112  );
113 
116 
120  const double t, const Epetra_Vector *coeff_s_p = 0
121  ) const;
122 
126  const double t, const Epetra_Vector *coeff_s_p = 0
127  ) const;
128 
130 
133 
144 
146 
149 
169  InArgs createInArgs() const;
171  OutArgs createOutArgs() const;
173  void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const;
174 
176 
177 public:
178 
180 
181 private:
182 
183  // /////////////////////////////////////
184  // Private types
185 
191 
192 
193  // /////////////////////////////////////
194  // Private member data
195 
199  bool implicit_;
201  double gamma_min_;
202  double gamma_max_;
206  double x0_;
210  int Np_;
211  int np_;
212  int Ng_;
219 
221 
223 
224  // /////////////////////////////////////
225  // Private member functions
226 
227  void initialize();
228 
229  void set_coeff_s_p(
230  const Teuchos::RCP<const Epetra_Vector> &coeff_s_p
231  ) const;
232 
233  void unset_coeff_s_p() const;
234 
235  int coeff_s_idx(int i) const
236  {
237  return coeff_s_idx_[i];
238  }
239 
240  double coeff_s(int i) const
241  {
242  return (*coeff_s_p_)[coeff_s_idx(i)];
243  }
244 
245 };
246 
247 
253 diagonalTransientModel(
254  Teuchos::RCP<Epetra_Comm> const& epetra_comm,
256  );
257 
258 
259 } // namespace EpetraExt
260 
261 
262 // RAB: Note, I wrapped this example code in a namespace mainly to make the
263 // later definition of the nonmember functions safe (see the Thyra
264 // Coding Guildelines document).
265 
266 
267 #endif // EPETRA_EXT_DIAGONAL_TRANSIENT_MODEL_HPP
Simple transient diagonal model for an implicit or explicit ODE.
Teuchos::RCP< const Epetra_Vector > getExactSolution(const double t, const Epetra_Vector *coeff_s_p=0) const
Return the exact solution as a function of time.
Teuchos::Array< Teuchos::RCP< Teuchos::Array< std::string > > > RCP_Array_String_Array_t
Teuchos::RCP< const Epetra_Vector > get_gamma() const
Return the model vector gamma,.
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
.
Teuchos::Array< Teuchos::RCP< const Epetra_Map > > RCP_Eptra_Map_Array_t
Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
DiagonalTransientModel(Teuchos::RCP< Epetra_Comm > const &epetra_comm)
Teuchos::RCP< const Epetra_Vector > get_x_init() const
Teuchos::RCP< const Epetra_Map > get_f_map() const
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
.
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
Teuchos::RCP< const Epetra_MultiVector > getExactSensSolution(const double t, const Epetra_Vector *coeff_s_p=0) const
Return the exact sensitivity of x as a function of time.
Teuchos::RCP< const Epetra_Vector > coeff_s_p_
Teuchos::RCP< const Epetra_Map > get_x_map() const
Teuchos::RCP< Epetra_Operator > create_W() const
void setParameterList(Teuchos::RCP< Teuchos::ParameterList > const &paramList)
void set_coeff_s_p(const Teuchos::RCP< const Epetra_Vector > &coeff_s_p) const
Teuchos::RCP< const Epetra_Vector > get_x_dot_init() const
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Teuchos::Array< Teuchos::RCP< Epetra_Vector > > RCP_Eptra_Vector_Array_t
Teuchos::RCP< Teuchos::ParameterList > paramList_
Base interface for evaluating a stateless &quot;model&quot;.
void evalModel(const InArgs &inArgs, const OutArgs &outArgs) const
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Teuchos::RCP< const Epetra_Map > get_g_map(int j) const
.