本文整理汇总了C++中InArgs::get_x_dotdot方法的典型用法代码示例。如果您正苦于以下问题:C++ InArgs::get_x_dotdot方法的具体用法?C++ InArgs::get_x_dotdot怎么用?C++ InArgs::get_x_dotdot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InArgs
的用法示例。
在下文中一共展示了InArgs::get_x_dotdot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Timer
void
Albany::ModelEvaluator::evalModel(const InArgs& inArgs,
const OutArgs& outArgs) const
{
Teuchos::TimeMonitor Timer(*timer); //start timer
//
// Get the input arguments
//
Teuchos::RCP<const Epetra_Vector> x = inArgs.get_x();
Teuchos::RCP<const Epetra_Vector> x_dot;
Teuchos::RCP<const Epetra_Vector> x_dotdot;
double alpha = 0.0;
double omega = 0.0;
double beta = 1.0;
double curr_time = 0.0;
x_dot = inArgs.get_x_dot();
x_dotdot = inArgs.get_x_dotdot();
if (x_dot != Teuchos::null || x_dotdot != Teuchos::null) {
alpha = inArgs.get_alpha();
omega = inArgs.get_omega();
beta = inArgs.get_beta();
curr_time = inArgs.get_t();
}
for (int i=0; i<num_param_vecs; i++) {
Teuchos::RCP<const Epetra_Vector> p = inArgs.get_p(i);
if (p != Teuchos::null) {
for (unsigned int j=0; j<sacado_param_vec[i].size(); j++)
sacado_param_vec[i][j].baseValue = (*p)[j];
}
}
for (int i=0; i<num_dist_param_vecs; i++) {
Teuchos::RCP<const Epetra_Vector> p = inArgs.get_p(i+num_param_vecs);
if (p != Teuchos::null) {
*(distParamLib->get(dist_param_names[i])->vector()) = *p;
}
}
//
// Get the output arguments
//
EpetraExt::ModelEvaluator::Evaluation<Epetra_Vector> f_out = outArgs.get_f();
Teuchos::RCP<Epetra_Operator> W_out = outArgs.get_W();
// Cast W to a CrsMatrix, throw an exception if this fails
Teuchos::RCP<Epetra_CrsMatrix> W_out_crs;
if (W_out != Teuchos::null)
W_out_crs = Teuchos::rcp_dynamic_cast<Epetra_CrsMatrix>(W_out, true);
int test_var = 0;
if(test_var != 0){
std::cout << "The current solution length is: " << x->MyLength() << std::endl;
x->Print(std::cout);
}
// Get preconditioner operator, if requested
Teuchos::RCP<Epetra_Operator> WPrec_out;
if (outArgs.supports(OUT_ARG_WPrec)) WPrec_out = outArgs.get_WPrec();
//
// Compute the functions
//
bool f_already_computed = false;
// W matrix
if (W_out != Teuchos::null) {
app->computeGlobalJacobian(alpha, beta, omega, curr_time, x_dot.get(), x_dotdot.get(),*x,
sacado_param_vec, f_out.get(), *W_out_crs);
f_already_computed=true;
if(test_var != 0){
//std::cout << "The current rhs length is: " << f_out->MyLength() << std::endl;
//f_out->Print(std::cout);
std::cout << "The current Jacobian length is: " << W_out_crs->NumGlobalRows() << std::endl;
W_out_crs->Print(std::cout);
}
}
if (WPrec_out != Teuchos::null) {
app->computeGlobalJacobian(alpha, beta, omega, curr_time, x_dot.get(), x_dotdot.get(), *x,
sacado_param_vec, f_out.get(), *Extra_W_crs);
f_already_computed=true;
if(test_var != 0){
//std::cout << "The current rhs length is: " << f_out->MyLength() << std::endl;
//f_out->Print(std::cout);
std::cout << "The current preconditioner length is: " << Extra_W_crs->NumGlobalRows() << std::endl;
Extra_W_crs->Print(std::cout);
}
app->computeGlobalPreconditioner(Extra_W_crs, WPrec_out);
}
// scalar df/dp
for (int i=0; i<num_param_vecs; i++) {
Teuchos::RCP<Epetra_MultiVector> dfdp_out =
outArgs.get_DfDp(i).getMultiVector();
if (dfdp_out != Teuchos::null) {
Teuchos::Array<int> p_indexes =
outArgs.get_DfDp(i).getDerivativeMultiVector().getParamIndexes();
Teuchos::RCP<ParamVec> p_vec;
//.........这里部分代码省略.........
示例2: Timer
void
Albany::ModelEvaluator::evalModel(const InArgs& inArgs,
const OutArgs& outArgs) const
{
Teuchos::TimeMonitor Timer(*timer); //start timer
//
// Get the input arguments
//
Teuchos::RCP<const Epetra_Vector> x = inArgs.get_x();
Teuchos::RCP<const Epetra_Vector> x_dot;
Teuchos::RCP<const Epetra_Vector> x_dotdot;
//create comm and node objects for Epetra -> Tpetra conversions
Teuchos::RCP<const Teuchos::Comm<int> > commT = app->getComm();
Teuchos::RCP<Epetra_Comm> comm = Albany::createEpetraCommFromTeuchosComm(commT);
//Create Tpetra copy of x, call it xT
Teuchos::RCP<const Tpetra_Vector> xT;
if (x != Teuchos::null)
xT = Petra::EpetraVector_To_TpetraVectorConst(*x, commT);
double alpha = 0.0;
double omega = 0.0;
double beta = 1.0;
double curr_time = 0.0;
if(num_time_deriv > 0)
x_dot = inArgs.get_x_dot();
if(num_time_deriv > 1)
x_dotdot = inArgs.get_x_dotdot();
//Declare and create Tpetra copy of x_dot, call it x_dotT
Teuchos::RCP<const Tpetra_Vector> x_dotT;
if (Teuchos::nonnull(x_dot))
x_dotT = Petra::EpetraVector_To_TpetraVectorConst(*x_dot, commT);
//Declare and create Tpetra copy of x_dotdot, call it x_dotdotT
Teuchos::RCP<const Tpetra_Vector> x_dotdotT;
if (Teuchos::nonnull(x_dotdot))
x_dotdotT = Petra::EpetraVector_To_TpetraVectorConst(*x_dotdot, commT);
if (Teuchos::nonnull(x_dot)){
alpha = inArgs.get_alpha();
beta = inArgs.get_beta();
curr_time = inArgs.get_t();
}
if (Teuchos::nonnull(x_dotdot)) {
omega = inArgs.get_omega();
}
for (int i=0; i<num_param_vecs; i++) {
Teuchos::RCP<const Epetra_Vector> p = inArgs.get_p(i);
if (p != Teuchos::null) {
for (unsigned int j=0; j<sacado_param_vec[i].size(); j++) {
sacado_param_vec[i][j].baseValue = (*p)[j];
}
}
}
for (int i=0; i<num_dist_param_vecs; i++) {
Teuchos::RCP<const Epetra_Vector> p = inArgs.get_p(i+num_param_vecs);
//create Tpetra copy of p
Teuchos::RCP<const Tpetra_Vector> pT;
if (p != Teuchos::null) {
pT = Petra::EpetraVector_To_TpetraVectorConst(*p, commT);
//*(distParamLib->get(dist_param_names[i])->vector()) = *p;
*(distParamLib->get(dist_param_names[i])->vector()) = *pT;
}
}
//
// Get the output arguments
//
EpetraExt::ModelEvaluator::Evaluation<Epetra_Vector> f_out = outArgs.get_f();
Teuchos::RCP<Epetra_Operator> W_out = outArgs.get_W();
// Cast W to a CrsMatrix, throw an exception if this fails
Teuchos::RCP<Epetra_CrsMatrix> W_out_crs;
#ifdef WRITE_MASS_MATRIX_TO_MM_FILE
//IK, 7/15/14: adding object to hold mass matrix to be written to matrix market file
Teuchos::RCP<Epetra_CrsMatrix> Mass;
//IK, 7/15/14: needed for writing mass matrix out to matrix market file
EpetraExt::ModelEvaluator::Evaluation<Epetra_Vector> ftmp = outArgs.get_f();
#endif
if (W_out != Teuchos::null) {
W_out_crs = Teuchos::rcp_dynamic_cast<Epetra_CrsMatrix>(W_out, true);
#ifdef WRITE_MASS_MATRIX_TO_MM_FILE
//IK, 7/15/14: adding object to hold mass matrix to be written to matrix market file
Mass = Teuchos::rcp_dynamic_cast<Epetra_CrsMatrix>(W_out, true);
#endif
}
int test_var = 0;
if(test_var != 0){
std::cout << "The current solution length is: " << x->MyLength() << std::endl;
x->Print(std::cout);
}
// Get preconditioner operator, if requested
//.........这里部分代码省略.........