42 #ifndef THYRA_MODEL_EVALUATOR_DEFAULT_BASE_HPP
43 #define THYRA_MODEL_EVALUATOR_DEFAULT_BASE_HPP
45 #include "Thyra_VectorBase.hpp"
47 #include "Thyra_ModelEvaluator.hpp"
48 #include "Thyra_LinearOpWithSolveFactoryHelpers.hpp"
51 #ifdef HAVE_THYRA_ME_POLYNOMIAL
67 #include "Thyra_PolynomialVectorTraits.hpp"
70 #endif // HAVE_THYRA_ME_POLYNOMIAL
83 namespace ModelEvaluatorDefaultBaseTypes {
89 class DefaultDerivLinearOpSupport {
91 DefaultDerivLinearOpSupport()
92 :provideDefaultLinearOp_(false),
93 mvImplOrientation_(ModelEvaluatorBase::DERIV_MV_BY_COL)
95 DefaultDerivLinearOpSupport(
98 :provideDefaultLinearOp_(true),
99 mvImplOrientation_(mvImplOrientation_in)
101 bool provideDefaultLinearOp()
const
102 {
return provideDefaultLinearOp_; }
104 {
return mvImplOrientation_; }
106 bool provideDefaultLinearOp_;
114 class DefaultDerivMvAdjointSupport {
116 DefaultDerivMvAdjointSupport()
117 :provideDefaultAdjoint_(false),
118 mvAdjointCopyOrientation_(ModelEvaluatorBase::DERIV_MV_BY_COL)
120 DefaultDerivMvAdjointSupport(
123 :provideDefaultAdjoint_(true),
124 mvAdjointCopyOrientation_(mvAdjointCopyOrientation_in)
126 bool provideDefaultAdjoint()
const
127 {
return provideDefaultAdjoint_; }
129 {
return mvAdjointCopyOrientation_; }
131 bool provideDefaultAdjoint_;
138 template<
class Scalar>
139 struct MultiVectorAdjointPair {
140 MultiVectorAdjointPair()
142 MultiVectorAdjointPair(
143 const RCP<MultiVectorBase<Scalar> > &in_mvOuter,
144 const RCP<
const MultiVectorBase<Scalar> > &in_mvImplAdjoint
146 : mvOuter(in_mvOuter),
147 mvImplAdjoint(in_mvImplAdjoint)
149 RCP<MultiVectorBase<Scalar> > mvOuter;
150 RCP<const MultiVectorBase<Scalar> > mvImplAdjoint;
187 template<
class Scalar>
284 virtual void evalModelImpl(
301 typedef ModelEvaluatorDefaultBaseTypes::DefaultDerivLinearOpSupport
302 DefaultDerivLinearOpSupport;
304 typedef ModelEvaluatorDefaultBaseTypes::DefaultDerivMvAdjointSupport
305 DefaultDerivMvAdjointSupport;
307 typedef ModelEvaluatorDefaultBaseTypes::MultiVectorAdjointPair<Scalar>
308 MultiVectorAdjointPair;
324 bool default_W_support_;
331 void lazyInitializeDefaultBase()
const;
333 void assert_l(
const int l)
const;
335 void assert_j(
const int j)
const;
340 static DefaultDerivLinearOpSupport
341 determineDefaultDerivLinearOpSupport(
346 createDefaultLinearOp(
347 const DefaultDerivLinearOpSupport &defaultLinearOpSupport,
353 updateDefaultLinearOpSupport(
355 const DefaultDerivLinearOpSupport &defaultLinearOpSupport
359 getOutArgImplForDefaultLinearOpSupport(
361 const DefaultDerivLinearOpSupport &defaultLinearOpSupport
364 static DefaultDerivMvAdjointSupport
365 determineDefaultDerivMvAdjointSupport(
372 updateDefaultDerivMvAdjointSupport(
374 const DefaultDerivMvAdjointSupport &defaultMvAdjointSupport
388 #include "Thyra_ModelEvaluatorHelpers.hpp"
389 #include "Thyra_DefaultScaledAdjointLinearOp.hpp"
390 #include "Thyra_DetachedMultiVectorView.hpp"
391 #include "Teuchos_Assert.hpp"
400 template<
class Scalar>
403 lazyInitializeDefaultBase();
404 return prototypeOutArgs_.Np();
408 template<
class Scalar>
411 lazyInitializeDefaultBase();
412 return prototypeOutArgs_.Ng();
416 template<
class Scalar>
420 lazyInitializeDefaultBase();
421 if (default_W_support_)
422 return this->get_W_factory()->createOp();
423 return Teuchos::null;
427 template<
class Scalar>
431 lazyInitializeDefaultBase();
435 const DefaultDerivLinearOpSupport
436 defaultLinearOpSupport = DfDp_default_op_support_[l];
437 if (defaultLinearOpSupport.provideDefaultLinearOp()) {
438 return createDefaultLinearOp(
439 defaultLinearOpSupport,
444 return this->create_DfDp_op_impl(l);
448 template<
class Scalar>
452 lazyInitializeDefaultBase();
456 const DefaultDerivLinearOpSupport
457 defaultLinearOpSupport = DgDx_dot_default_op_support_[j];
458 if (defaultLinearOpSupport.provideDefaultLinearOp()) {
459 return createDefaultLinearOp(
460 defaultLinearOpSupport,
461 this->get_g_space(j),
465 return this->create_DgDx_dot_op_impl(j);
469 template<
class Scalar>
473 lazyInitializeDefaultBase();
477 const DefaultDerivLinearOpSupport
478 defaultLinearOpSupport = DgDx_default_op_support_[j];
479 if (defaultLinearOpSupport.provideDefaultLinearOp()) {
480 return createDefaultLinearOp(
481 defaultLinearOpSupport,
482 this->get_g_space(j),
486 return this->create_DgDx_op_impl(j);
490 template<
class Scalar>
494 lazyInitializeDefaultBase();
499 const DefaultDerivLinearOpSupport
500 defaultLinearOpSupport = DgDp_default_op_support_[j][l];
501 if (defaultLinearOpSupport.provideDefaultLinearOp()) {
502 return createDefaultLinearOp(
503 defaultLinearOpSupport,
504 this->get_g_space(j),
508 return this->create_DgDp_op_impl(j,l);
512 template<
class Scalar>
516 lazyInitializeDefaultBase();
517 return prototypeOutArgs_;
521 template<
class Scalar>
528 using Teuchos::outArg;
531 lazyInitializeDefaultBase();
533 const int l_Np = outArgs.
Np();
534 const int l_Ng = outArgs.
Ng();
541 assertInArgsEvalObjects(*
this,inArgs);
542 assertOutArgsEvalObjects(*
this,outArgs,&inArgs);
550 MEB::OutArgs<Scalar> outArgsImpl = this->createOutArgsImpl();
555 outArgsImpl.setArgs(outArgs,
true);
558 if (outArgsImpl.supports(MEB::OUT_ARG_f)) {
559 for (
int l = 0; l < l_Np; ++l ) {
560 const DefaultDerivLinearOpSupport defaultLinearOpSupport =
561 DfDp_default_op_support_[l];
562 if (defaultLinearOpSupport.provideDefaultLinearOp()) {
563 outArgsImpl.set_DfDp( l,
564 getOutArgImplForDefaultLinearOpSupport(
565 outArgs.
get_DfDp(l), defaultLinearOpSupport
576 for (
int j = 0; j < l_Ng; ++j ) {
577 const DefaultDerivLinearOpSupport defaultLinearOpSupport =
578 DgDx_dot_default_op_support_[j];
579 if (defaultLinearOpSupport.provideDefaultLinearOp()) {
580 outArgsImpl.set_DgDx_dot( j,
581 getOutArgImplForDefaultLinearOpSupport(
592 for (
int j = 0; j < l_Ng; ++j ) {
593 const DefaultDerivLinearOpSupport defaultLinearOpSupport =
594 DgDx_default_op_support_[j];
595 if (defaultLinearOpSupport.provideDefaultLinearOp()) {
596 outArgsImpl.set_DgDx( j,
597 getOutArgImplForDefaultLinearOpSupport(
598 outArgs.
get_DgDx(j), defaultLinearOpSupport
608 for (
int j = 0; j < l_Ng; ++j ) {
610 DgDp_default_op_support_[j];
612 DgDp_default_mv_support_[j];
613 for (
int l = 0; l < l_Np; ++l ) {
614 const DefaultDerivLinearOpSupport defaultLinearOpSupport =
615 DgDp_default_op_support_j[l];
616 const DefaultDerivMvAdjointSupport defaultMvAdjointSupport =
617 DgDp_default_mv_support_j[l];
618 MEB::Derivative<Scalar> DgDp_j_l;
619 if (!outArgs.
supports(MEB::OUT_ARG_DgDp,j,l).none())
622 defaultLinearOpSupport.provideDefaultLinearOp()
623 && !
is_null(DgDp_j_l.getLinearOp())
626 outArgsImpl.set_DgDp( j, l,
627 getOutArgImplForDefaultLinearOpSupport(
628 DgDp_j_l, defaultLinearOpSupport
633 defaultMvAdjointSupport.provideDefaultAdjoint()
634 && !
is_null(DgDp_j_l.getMultiVector())
638 DgDp_j_l.getMultiVector();
640 defaultMvAdjointSupport.mvAdjointCopyOrientation()
642 DgDp_j_l.getMultiVectorOrientation()
649 createMembers(DgDp_j_l_mv->domain(), DgDp_j_l_mv->range()->dim());
650 outArgsImpl.set_DgDp( j, l,
651 MEB::Derivative<Scalar>(
653 getOtherDerivativeMultiVectorOrientation(
654 defaultMvAdjointSupport.mvAdjointCopyOrientation()
661 MultiVectorAdjointPair(DgDp_j_l_mv, DgDp_j_l_mv_adj)
678 if ( default_W_support_ && !
is_null(W=outArgs.
get_W()) ) {
680 W_factory = this->get_W_factory();
683 uninitializeOp<Scalar>(*W_factory, W.
ptr(), outArg(W_op_const));
695 W_op = this->create_W_op();
697 outArgsImpl.set_W_op(W_op);
706 this->evalModelImpl( inArgs, outArgsImpl );
713 const int numMvAdjointCopies = DgDp_temp_adjoint_copies.
size();
714 for (
int adj_copy_i = 0; adj_copy_i < numMvAdjointCopies; ++adj_copy_i ) {
715 const MultiVectorAdjointPair adjPair =
716 DgDp_temp_adjoint_copies[adj_copy_i];
717 doExplicitMultiVectorAdjoint( *adjPair.mvImplAdjoint, &*adjPair.mvOuter );
723 if ( default_W_support_ && !
is_null(W=outArgs.
get_W()) ) {
725 W_factory = this->get_W_factory();
726 W_factory->setOStream(this->getOStream());
727 W_factory->setVerbLevel(this->getVerbLevel());
728 initializeOp<Scalar>(*W_factory, outArgsImpl.get_W_op().
getConst(), W.
ptr());
740 template<
class Scalar>
747 isInitialized_ =
false;
748 default_W_support_ =
false;
754 const MEB::InArgs<Scalar> inArgs = this->createInArgs();
755 const MEB::OutArgs<Scalar> outArgsImpl = this->createOutArgsImpl();
762 assertInArgsOutArgsSetup( this->description(), inArgs, outArgsImpl );
763 #endif // TEUCHOS_DEBUG
769 const int l_Ng = outArgsImpl.Ng();
770 const int l_Np = outArgsImpl.Np();
773 MEB::OutArgsSetup<Scalar> outArgs;
774 outArgs.setModelEvalDescription(this->description());
775 outArgs.set_Np_Ng(l_Np,l_Ng);
776 outArgs.setSupports(outArgsImpl);
779 DfDp_default_op_support_.clear();
780 if (outArgs.supports(MEB::OUT_ARG_f)) {
781 for (
int l = 0; l < l_Np; ++l ) {
782 const MEB::DerivativeSupport DfDp_l_impl_support =
783 outArgsImpl.supports(MEB::OUT_ARG_DfDp,l);
784 const DefaultDerivLinearOpSupport DfDp_l_op_support =
785 determineDefaultDerivLinearOpSupport(DfDp_l_impl_support);
786 DfDp_default_op_support_.push_back(DfDp_l_op_support);
788 MEB::OUT_ARG_DfDp, l,
789 updateDefaultLinearOpSupport(
790 DfDp_l_impl_support, DfDp_l_op_support
797 DgDx_dot_default_op_support_.clear();
798 for (
int j = 0; j < l_Ng; ++j ) {
799 const MEB::DerivativeSupport DgDx_dot_j_impl_support =
800 outArgsImpl.supports(MEB::OUT_ARG_DgDx_dot,j);
801 const DefaultDerivLinearOpSupport DgDx_dot_j_op_support =
802 determineDefaultDerivLinearOpSupport(DgDx_dot_j_impl_support);
803 DgDx_dot_default_op_support_.push_back(DgDx_dot_j_op_support);
805 MEB::OUT_ARG_DgDx_dot, j,
806 updateDefaultLinearOpSupport(
807 DgDx_dot_j_impl_support, DgDx_dot_j_op_support
813 DgDx_default_op_support_.clear();
814 for (
int j = 0; j < l_Ng; ++j ) {
815 const MEB::DerivativeSupport DgDx_j_impl_support =
816 outArgsImpl.supports(MEB::OUT_ARG_DgDx,j);
817 const DefaultDerivLinearOpSupport DgDx_j_op_support =
818 determineDefaultDerivLinearOpSupport(DgDx_j_impl_support);
819 DgDx_default_op_support_.push_back(DgDx_j_op_support);
821 MEB::OUT_ARG_DgDx, j,
822 updateDefaultLinearOpSupport(
823 DgDx_j_impl_support, DgDx_j_op_support
829 DgDp_default_op_support_.clear();
830 DgDp_default_mv_support_.clear();
831 for (
int j = 0; j < l_Ng; ++j ) {
834 for (
int l = 0; l < l_Np; ++l ) {
835 const MEB::DerivativeSupport DgDp_j_l_impl_support =
836 outArgsImpl.supports(MEB::OUT_ARG_DgDp,j,l);
838 const DefaultDerivLinearOpSupport DgDp_j_l_op_support =
839 determineDefaultDerivLinearOpSupport(DgDp_j_l_impl_support);
840 DgDp_default_op_support_[j].push_back(DgDp_j_l_op_support);
842 MEB::OUT_ARG_DgDp, j, l,
843 updateDefaultLinearOpSupport(
844 DgDp_j_l_impl_support, DgDp_j_l_op_support
848 const DefaultDerivMvAdjointSupport DgDp_j_l_mv_support =
849 determineDefaultDerivMvAdjointSupport(
850 DgDp_j_l_impl_support, *this->get_g_space(j), *this->get_p_space(l)
852 DgDp_default_mv_support_[j].push_back(DgDp_j_l_mv_support);
854 MEB::OUT_ARG_DgDp, j, l,
855 updateDefaultDerivMvAdjointSupport(
856 outArgs.supports(MEB::OUT_ARG_DgDp, j, l),
866 default_W_support_ =
false;
867 if ( outArgsImpl.supports(MEB::OUT_ARG_W_op) && !
is_null(this->get_W_factory())
868 && !outArgsImpl.supports(MEB::OUT_ARG_W) )
870 default_W_support_ =
true;
871 outArgs.setSupports(MEB::OUT_ARG_W);
872 outArgs.set_W_properties(outArgsImpl.get_W_properties());
879 prototypeOutArgs_ = outArgs;
880 isInitialized_ =
true;
884 template<
class Scalar>
887 isInitialized_ =
false;
893 template<
class Scalar>
898 MEB::OutArgs<Scalar> outArgs = this->createOutArgsImpl();
900 outArgs.supports(MEB::OUT_ARG_DfDp,l).supports(MEB::DERIV_LINEAR_OP),
902 "Error, The ModelEvaluator subclass "<<this->description()<<
" says that it"
903 " supports the LinearOpBase form of DfDp("<<l<<
") (as determined from its"
904 " OutArgs object created by createOutArgsImpl())"
905 " but this function create_DfDp_op_impl(...) has not been overridden"
906 " to create such an object!"
908 return Teuchos::null;
912 template<
class Scalar>
913 RCP<LinearOpBase<Scalar> >
914 ModelEvaluatorDefaultBase<Scalar>::create_DgDx_dot_op_impl(
int j)
const
916 typedef ModelEvaluatorBase MEB;
917 MEB::OutArgs<Scalar> outArgs = this->createOutArgsImpl();
919 outArgs.supports(MEB::OUT_ARG_DgDx_dot,j).supports(MEB::DERIV_LINEAR_OP),
921 "Error, The ModelEvaluator subclass "<<this->description()<<
" says that it"
922 " supports the LinearOpBase form of DgDx_dot("<<j<<
") (as determined from"
923 " its OutArgs object created by createOutArgsImpl())"
924 " but this function create_DgDx_dot_op_impl(...) has not been overridden"
925 " to create such an object!"
927 return Teuchos::null;
931 template<
class Scalar>
932 RCP<LinearOpBase<Scalar> >
933 ModelEvaluatorDefaultBase<Scalar>::create_DgDx_op_impl(
int j)
const
935 typedef ModelEvaluatorBase MEB;
936 MEB::OutArgs<Scalar> outArgs = this->createOutArgsImpl();
938 outArgs.supports(MEB::OUT_ARG_DgDx,j).supports(MEB::DERIV_LINEAR_OP),
940 "Error, The ModelEvaluator subclass "<<this->description()<<
" says that it"
941 " supports the LinearOpBase form of DgDx("<<j<<
") (as determined from"
942 " its OutArgs object created by createOutArgsImpl())"
943 " but this function create_DgDx_op_impl(...) has not been overridden"
944 " to create such an object!"
946 return Teuchos::null;
950 template<
class Scalar>
951 RCP<LinearOpBase<Scalar> >
952 ModelEvaluatorDefaultBase<Scalar>::create_DgDp_op_impl(
int j,
int l)
const
954 typedef ModelEvaluatorBase MEB;
955 MEB::OutArgs<Scalar> outArgs = this->createOutArgsImpl();
957 outArgs.supports(MEB::OUT_ARG_DgDp,j,l).supports(MEB::DERIV_LINEAR_OP),
959 "Error, The ModelEvaluator subclass "<<this->description()<<
" says that it"
960 " supports the LinearOpBase form of DgDp("<<j<<
","<<l<<
")"
961 " (as determined from its OutArgs object created by createOutArgsImpl())"
962 " but this function create_DgDp_op_impl(...) has not been overridden"
963 " to create such an object!"
965 return Teuchos::null;
969 template<
class Scalar>
970 RCP<const VectorSpaceBase<Scalar> >
973 return this->get_f_space();
976 template<
class Scalar>
980 return this->get_g_space(j);
983 template<
class Scalar>
987 return Teuchos::null;
990 template<
class Scalar>
994 return Teuchos::null;
997 template<
class Scalar>
1001 return Teuchos::null;
1004 template<
class Scalar>
1008 return Teuchos::null;
1011 template<
class Scalar>
1015 return Teuchos::null;
1018 template<
class Scalar>
1022 return Teuchos::null;
1028 template<
class Scalar>
1030 :isInitialized_(false), default_W_support_(false)
1037 template<
class Scalar>
1040 if (!isInitialized_)
1045 template<
class Scalar>
1046 void ModelEvaluatorDefaultBase<Scalar>::assert_l(
const int l)
const
1052 template<
class Scalar>
1053 void ModelEvaluatorDefaultBase<Scalar>::assert_j(
const int j)
const
1062 template<
class Scalar>
1063 ModelEvaluatorDefaultBaseTypes::DefaultDerivLinearOpSupport
1064 ModelEvaluatorDefaultBase<Scalar>::determineDefaultDerivLinearOpSupport(
1065 const ModelEvaluatorBase::DerivativeSupport &derivSupportImpl
1068 typedef ModelEvaluatorBase MEB;
1071 derivSupportImpl.supports(MEB::DERIV_MV_BY_COL)
1073 derivSupportImpl.supports(MEB::DERIV_TRANS_MV_BY_ROW)
1076 !derivSupportImpl.supports(MEB::DERIV_LINEAR_OP)
1079 return DefaultDerivLinearOpSupport(
1080 derivSupportImpl.supports(MEB::DERIV_MV_BY_COL)
1081 ? MEB::DERIV_MV_BY_COL
1082 : MEB::DERIV_TRANS_MV_BY_ROW
1085 return DefaultDerivLinearOpSupport();
1089 template<
class Scalar>
1090 RCP<LinearOpBase<Scalar> >
1091 ModelEvaluatorDefaultBase<Scalar>::createDefaultLinearOp(
1092 const DefaultDerivLinearOpSupport &defaultLinearOpSupport,
1093 const RCP<
const VectorSpaceBase<Scalar> > &fnc_space,
1094 const RCP<
const VectorSpaceBase<Scalar> > &var_space
1097 using Teuchos::rcp_implicit_cast;
1098 typedef LinearOpBase<Scalar> LOB;
1099 typedef ModelEvaluatorBase MEB;
1100 switch(defaultLinearOpSupport.mvImplOrientation()) {
1101 case MEB::DERIV_MV_BY_COL:
1103 return createMembers(fnc_space, var_space->dim());
1104 case MEB::DERIV_TRANS_MV_BY_ROW:
1106 return nonconstAdjoint<Scalar>(
1107 rcp_implicit_cast<LOB>(createMembers(var_space, fnc_space->dim()))
1109 #ifdef TEUCHOS_DEBUG
1114 return Teuchos::null;
1118 template<
class Scalar>
1119 ModelEvaluatorBase::DerivativeSupport
1120 ModelEvaluatorDefaultBase<Scalar>::updateDefaultLinearOpSupport(
1121 const ModelEvaluatorBase::DerivativeSupport &derivSupportImpl,
1122 const DefaultDerivLinearOpSupport &defaultLinearOpSupport
1125 typedef ModelEvaluatorBase MEB;
1126 MEB::DerivativeSupport derivSupport = derivSupportImpl;
1127 if (defaultLinearOpSupport.provideDefaultLinearOp())
1128 derivSupport.plus(MEB::DERIV_LINEAR_OP);
1129 return derivSupport;
1133 template<
class Scalar>
1134 ModelEvaluatorBase::Derivative<Scalar>
1135 ModelEvaluatorDefaultBase<Scalar>::getOutArgImplForDefaultLinearOpSupport(
1136 const ModelEvaluatorBase::Derivative<Scalar> &deriv,
1137 const DefaultDerivLinearOpSupport &defaultLinearOpSupport
1141 using Teuchos::rcp_dynamic_cast;
1142 typedef ModelEvaluatorBase MEB;
1143 typedef MultiVectorBase<Scalar> MVB;
1144 typedef ScaledAdjointLinearOpBase<Scalar> SALOB;
1149 if (
is_null(deriv.getLinearOp()))
1154 switch(defaultLinearOpSupport.mvImplOrientation()) {
1155 case MEB::DERIV_MV_BY_COL: {
1156 return MEB::Derivative<Scalar>(
1157 rcp_dynamic_cast<MVB>(deriv.getLinearOp(),
true),
1158 MEB::DERIV_MV_BY_COL
1161 case MEB::DERIV_TRANS_MV_BY_ROW: {
1162 return MEB::Derivative<Scalar>(
1163 rcp_dynamic_cast<MVB>(
1164 rcp_dynamic_cast<SALOB>(deriv.getLinearOp(),
true)->getNonconstOrigOp()
1166 MEB::DERIV_TRANS_MV_BY_ROW
1169 #ifdef TEUCHOS_DEBUG
1175 return ModelEvaluatorBase::Derivative<Scalar>();
1180 template<
class Scalar>
1181 ModelEvaluatorDefaultBaseTypes::DefaultDerivMvAdjointSupport
1182 ModelEvaluatorDefaultBase<Scalar>::determineDefaultDerivMvAdjointSupport(
1183 const ModelEvaluatorBase::DerivativeSupport &derivSupportImpl,
1184 const VectorSpaceBase<Scalar> &fnc_space,
1185 const VectorSpaceBase<Scalar> &var_space
1188 typedef ModelEvaluatorBase MEB;
1191 const bool implSupportsMv =
1192 ( derivSupportImpl.supports(MEB::DERIV_MV_BY_COL)
1193 || derivSupportImpl.supports(MEB::DERIV_TRANS_MV_BY_ROW) );
1194 const bool implLacksMvOrientSupport =
1195 ( !derivSupportImpl.supports(MEB::DERIV_MV_BY_COL)
1196 || !derivSupportImpl.supports(MEB::DERIV_TRANS_MV_BY_ROW) );
1197 const bool bothSpacesHaveInCoreViews =
1198 ( fnc_space.hasInCoreView() && var_space.hasInCoreView() );
1199 if ( implSupportsMv && implLacksMvOrientSupport && bothSpacesHaveInCoreViews ) {
1200 return DefaultDerivMvAdjointSupport(
1201 derivSupportImpl.supports(MEB::DERIV_MV_BY_COL)
1202 ? MEB::DERIV_TRANS_MV_BY_ROW
1203 : MEB::DERIV_MV_BY_COL
1207 return DefaultDerivMvAdjointSupport();
1211 template<
class Scalar>
1212 ModelEvaluatorBase::DerivativeSupport
1213 ModelEvaluatorDefaultBase<Scalar>::updateDefaultDerivMvAdjointSupport(
1214 const ModelEvaluatorBase::DerivativeSupport &derivSupportImpl,
1215 const DefaultDerivMvAdjointSupport &defaultMvAdjointSupport
1218 typedef ModelEvaluatorBase MEB;
1219 MEB::DerivativeSupport derivSupport = derivSupportImpl;
1220 if (defaultMvAdjointSupport.provideDefaultAdjoint())
1221 derivSupport.plus(defaultMvAdjointSupport.mvAdjointCopyOrientation());
1222 return derivSupport;
1229 #endif // THYRA_MODEL_EVALUATOR_DEFAULT_BASE_HPP
RCP< const T > getConst() const
int Ng() const
Return the number of axillary response functions g(j)(...) supported (Ng >= 0).
Pure abstract base interface for evaluating a stateless "model" that can be mapped into a number of d...
RCP< LinearOpWithSolveBase< Scalar > > create_W() const
virtual RCP< LinearOpBase< Scalar > > create_hess_g_xp(int j, int l) const
Default base class for concrete model evaluators.
virtual RCP< LinearOpBase< Scalar > > create_hess_f_xx() const
bool is_null(const boost::shared_ptr< T > &p)
RCP< LinearOpBase< Scalar > > create_DfDp_op(int l) const
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object...
Derivative< Scalar > get_DfDp(int l) const
Precondition: supports(OUT_ARG_DfDp,l)==true.
EDerivativeMultiVectorOrientation
void evalModel(const ModelEvaluatorBase::InArgs< Scalar > &inArgs, const ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual RCP< const VectorSpaceBase< Scalar > > get_g_multiplier_space(int j) const
Simple aggregate class that stores a derivative object as a general linear operator or as a multi-vec...
ModelEvaluatorDefaultBase()
Abstract interface for objects that represent a space for vectors.
bool supports(EOutArgsMembers arg) const
Determine if an input argument is supported or not.
Derivative< Scalar > get_DgDp(int j, int l) const
Precondition: supports(OUT_ARG_DgDp,j,l)==true.
void initializeDefaultBase()
Function called by subclasses to fully initialize this object on any important change.
#define TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(index, lower_inclusive, upper_exclusive)
int Np() const
Return the number of parameter subvectors p(l) supported (Np >= 0).
RCP< LinearOpBase< Scalar > > create_DgDx_op(int j) const
virtual RCP< const VectorSpaceBase< Scalar > > get_f_multiplier_space() const
virtual RCP< LinearOpBase< Scalar > > create_hess_f_pp(int l1, int l2) const
virtual RCP< LinearOpBase< Scalar > > create_hess_g_xx(int j) const
Base class for all linear operators.
RCP< LinearOpBase< Scalar > > create_DgDx_dot_op(int j) const
Base subclass for ModelEvaluator that defines some basic types.
void push_back(const value_type &x)
virtual RCP< LinearOpBase< Scalar > > create_hess_g_pp(int j, int l1, int l2) const
RCP< LinearOpWithSolveBase< Scalar > > get_W() const
Precondition: supports(OUT_ARG_W)==true.
void resetDefaultBase()
Sets the the DefaultBase to an uninitialized state, forcing lazy initialization when needed...
Derivative< Scalar > get_DgDx_dot(int j) const
Precondition: supports(OUT_ARG_DgDx_dot,j)==true.
Determines the forms of a general derivative that are supported.
ModelEvaluatorBase::OutArgs< Scalar > createOutArgs() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Derivative< Scalar > get_DgDx(int j) const
Precondition: supports(OUT_ARG_DgDx,j)==true.
RCP< LinearOpBase< Scalar > > create_DgDp_op(int j, int l) const
Concrete aggregate class for all input arguments computable by a ModelEvaluator subclass object...
virtual RCP< LinearOpBase< Scalar > > create_hess_f_xp(int l) const