Thyra::ModelEvaluatorBase::InArgs<Scalar> TimeDiscretizedBackwardEulerModelEvaluator<Scalar>::createInArgs() const { typedef Thyra::ModelEvaluatorBase MEB; MEB::InArgsSetup<Scalar> inArgs; inArgs.setModelEvalDescription(this->description()); inArgs.setSupports(MEB::IN_ARG_x); return inArgs; }
Thyra::ModelEvaluatorBase::InArgs<Scalar> DiagonalROME<Scalar>::createInArgs() const { typedef Thyra::ModelEvaluatorBase MEB; MEB::InArgsSetup<Scalar> inArgs; inArgs.setModelEvalDescription(this->description()); inArgs.set_Np(Np_); return inArgs; }
ModelEvaluatorBase::InArgs<Scalar> DefaultStateEliminationModelEvaluator<Scalar>::createInArgs() const { typedef ModelEvaluatorBase MEB; const Teuchos::RCP<const ModelEvaluator<Scalar> > thyraModel = this->getUnderlyingModel(); const MEB::InArgs<Scalar> wrappedInArgs = thyraModel->createInArgs(); MEB::InArgsSetup<Scalar> inArgs; inArgs.setModelEvalDescription(this->description()); inArgs.set_Np(wrappedInArgs.Np()); inArgs.setSupports(wrappedInArgs); inArgs.setUnsupportsAndRelated(MEB::IN_ARG_x); // Wipe out x, x_dot ... return inArgs; }
Thyra::ModelEvaluatorBase::InArgs<Scalar> ForwardSensitivityExplicitModelEvaluator<Scalar>::createInArgs() const { TEUCHOS_ASSERT( !is_null(stateModel_) ); typedef Thyra::ModelEvaluatorBase MEB; MEB::InArgs<Scalar> stateModelInArgs = stateModel_->createInArgs(); MEB::InArgsSetup<Scalar> inArgs; inArgs.setModelEvalDescription(this->description()); inArgs.setSupports( MEB::IN_ARG_x ); inArgs.setSupports( MEB::IN_ARG_t ); inArgs.setSupports( MEB::IN_ARG_beta, stateModelInArgs.supports(MEB::IN_ARG_beta) ); return inArgs; }
Simple2DModelEvaluator<Scalar>::Simple2DModelEvaluator() : x_space_(Thyra::defaultSpmdVectorSpace<Scalar>(2)), f_space_(x_space_), W_factory_(Thyra::defaultSerialDenseLinearOpWithSolveFactory<Scalar>()), d_(0.0), p_(x_space_->dim(), Teuchos::ScalarTraits<Scalar>::zero()), showGetInvalidArg_(false) { using Teuchos::RCP; using Thyra::VectorBase; using Thyra::createMember; typedef Thyra::ModelEvaluatorBase MEB; typedef Teuchos::ScalarTraits<Scalar> ST; MEB::InArgsSetup<Scalar> inArgs; inArgs.setModelEvalDescription(this->description()); inArgs.setSupports(MEB::IN_ARG_x); prototypeInArgs_ = inArgs; MEB::OutArgsSetup<Scalar> outArgs; outArgs.setModelEvalDescription(this->description()); outArgs.setSupports(MEB::OUT_ARG_f); outArgs.setSupports(MEB::OUT_ARG_W_op); outArgs.setSupports(MEB::OUT_ARG_W_prec); prototypeOutArgs_ = outArgs; nominalValues_ = inArgs; x0_ = createMember(x_space_); V_S(x0_.ptr(), ST::zero()); nominalValues_.set_x(x0_); set_d(10.0); set_p(Teuchos::tuple<Scalar>(2.0, 0.0)()); set_x0(Teuchos::tuple<Scalar>(1.0, 1.0)()); }
void DiagonalImplicitRKModelEvaluator<Scalar>::initializeDIRKModel( const RCP<const Thyra::ModelEvaluator<Scalar> >& daeModel, const Thyra::ModelEvaluatorBase::InArgs<Scalar>& basePoint, const RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> >& dirk_W_factory, const RCP<const RKButcherTableauBase<Scalar> >& irkButcherTableau ) { typedef ScalarTraits<Scalar> ST; // ToDo: Assert input arguments! // How do I verify the basePoint is an authentic InArgs from daeModel? TEUCHOS_TEST_FOR_EXCEPTION( is_null(basePoint.get_x()), std::logic_error, "Error! The basepoint x vector is null!" ); TEUCHOS_TEST_FOR_EXCEPTION( is_null(daeModel), std::logic_error, "Error! The model evaluator pointer is null!" ); TEUCHOS_TEST_FOR_EXCEPTION( !daeModel->get_x_space()->isCompatible(*(basePoint.get_x()->space())), std::logic_error, "Error! The basepoint input arguments are incompatible with the model evaluator vector space!" ); //TEUCHOS_TEST_FOR_EXCEPT(is_null(dirk_W_factory)); daeModel_ = daeModel; basePoint_ = basePoint; dirk_W_factory_ = dirk_W_factory; dirkButcherTableau_ = irkButcherTableau; const int numStages = dirkButcherTableau_->numStages(); using Teuchos::rcp_dynamic_cast; stage_space_ = productVectorSpace(daeModel_->get_x_space(),numStages); RCP<const Thyra::VectorSpaceBase<Scalar> > vs = rcp_dynamic_cast<const Thyra::VectorSpaceBase<Scalar> >(stage_space_,true); stage_derivatives_ = rcp_dynamic_cast<Thyra::ProductVectorBase<Scalar> >(createMember(vs),true); Thyra::V_S( rcp_dynamic_cast<Thyra::VectorBase<Scalar> >(stage_derivatives_).ptr(),ST::zero()); // Set up prototypical InArgs { typedef Thyra::ModelEvaluatorBase MEB; MEB::InArgsSetup<Scalar> inArgs; inArgs.setModelEvalDescription(this->description()); inArgs.setSupports(MEB::IN_ARG_x); inArgs_ = inArgs; } // Set up prototypical OutArgs { typedef Thyra::ModelEvaluatorBase MEB; MEB::OutArgsSetup<Scalar> outArgs; outArgs.setModelEvalDescription(this->description()); outArgs.setSupports(MEB::OUT_ARG_f); outArgs.setSupports(MEB::OUT_ARG_W_op); outArgs_ = outArgs; } // Set up nominal values nominalValues_ = inArgs_; isInitialized_ = true; }
void ImplicitRKModelEvaluator<Scalar>::initializeIRKModel( const RCP<const Thyra::ModelEvaluator<Scalar> >& daeModel, const Thyra::ModelEvaluatorBase::InArgs<Scalar>& basePoint, const RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> >& irk_W_factory, const RCP<const RKButcherTableauBase<Scalar> >& irkButcherTableau ) { // ToDo: Assert input arguments! // How do I verify the basePoint is an authentic InArgs from daeModel? TEST_FOR_EXCEPTION( is_null(basePoint.get_x()), std::logic_error, "Error! The basepoint x vector is null!" ); TEST_FOR_EXCEPTION( is_null(daeModel), std::logic_error, "Error! The model evaluator pointer is null!" ); TEST_FOR_EXCEPTION( !daeModel->get_x_space()->isCompatible(*(basePoint.get_x()->space())), std::logic_error, "Error! The basepoint input arguments are incompatible with the model evaluator vector space!" ); TEST_FOR_EXCEPT(is_null(irk_W_factory)); daeModel_ = daeModel; basePoint_ = basePoint; irk_W_factory_ = irk_W_factory; irkButcherTableau_ = irkButcherTableau; const int numStages = irkButcherTableau_->numStages(); x_bar_space_ = productVectorSpace(daeModel_->get_x_space(),numStages); f_bar_space_ = productVectorSpace(daeModel_->get_f_space(),numStages); // HACK! Remove the preconditioner factory for now! if (irk_W_factory_->acceptsPreconditionerFactory()) irk_W_factory_->unsetPreconditionerFactory(); // ToDo: create the block diagonal preconditioner factory and set this on // irk_W_factory_! // Set up prototypical InArgs { typedef Thyra::ModelEvaluatorBase MEB; MEB::InArgsSetup<Scalar> inArgs; inArgs.setModelEvalDescription(this->description()); inArgs.setSupports(MEB::IN_ARG_x); inArgs_ = inArgs; } // Set up prototypical OutArgs { typedef Thyra::ModelEvaluatorBase MEB; MEB::OutArgsSetup<Scalar> outArgs; outArgs.setModelEvalDescription(this->description()); outArgs.setSupports(MEB::OUT_ARG_f); outArgs.setSupports(MEB::OUT_ARG_W_op); outArgs_ = outArgs; } // Set up nominal values nominalValues_ = inArgs_; isInitialized_ = true; }