Thyra Version of the Day
Thyra_ModelEvaluatorBase_def.hpp
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // Redistribution and use in source and binary forms, with or without
00011 // modification, are permitted provided that the following conditions are
00012 // met:
00013 //
00014 // 1. Redistributions of source code must retain the above copyright
00015 // notice, this list of conditions and the following disclaimer.
00016 //
00017 // 2. Redistributions in binary form must reproduce the above copyright
00018 // notice, this list of conditions and the following disclaimer in the
00019 // documentation and/or other materials provided with the distribution.
00020 //
00021 // 3. Neither the name of the Corporation nor the names of the
00022 // contributors may be used to endorse or promote products derived from
00023 // this software without specific prior written permission.
00024 //
00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00036 //
00037 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
00043 #define THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
00044 
00045 
00046 #include "Thyra_ModelEvaluatorBase_decl.hpp"
00047 #include "Thyra_MultiVectorBase.hpp"
00048 #include "Thyra_VectorBase.hpp"
00049 #include "Thyra_MultiVectorStdOps.hpp"
00050 #include "Thyra_VectorStdOps.hpp"
00051 
00052 
00053 namespace Thyra {
00054 
00055 
00056 namespace ModelEvaluatorHelperPack {
00057 
00058 
00059 template<class Scalar>
00060 inline
00061 RCP<const Thyra::VectorBase<Scalar> >
00062 condCloneVec(
00063   const RCP<const Thyra::VectorBase<Scalar> > &vec,
00064   bool cloneObject
00065   )
00066 {
00067   if(cloneObject)
00068     return vec->clone_v();
00069   return vec;
00070 }
00071 
00072 
00073 } // namespace ModelEvaluatorHelperPack
00074 
00075 
00076 //
00077 // ModelEvaluatorBase::InArgs
00078 //
00079 
00080 
00081 template<class Scalar>
00082 ModelEvaluatorBase::InArgs<Scalar>::InArgs()
00083   :modelEvalDescription_("WARNING!  THIS INARGS OBJECT IS UNINITALIZED!")
00084 {
00085   typedef Teuchos::ScalarTraits<Scalar> ST;
00086   typedef Teuchos::ScalarTraits<typename ST::magnitudeType> SMT;
00087   std::fill_n(&supports_[0],NUM_E_IN_ARGS_MEMBERS,false);
00088   t_     = SMT::zero();
00089   alpha_ = ST::zero();
00090   beta_  = ST::zero();
00091 }
00092 
00093 
00094 template<class Scalar>
00095 int ModelEvaluatorBase::InArgs<Scalar>::Np() const
00096 { return p_.size(); }
00097 
00098 template<class Scalar>
00099 bool ModelEvaluatorBase::InArgs<Scalar>::supports(EInArgsMembers arg) const
00100 {
00101   TEUCHOS_TEST_FOR_EXCEPTION(
00102     int(arg)>=NUM_E_IN_ARGS_MEMBERS || int(arg) < 0,std::logic_error
00103     ,"model = \'"<<modelEvalDescription_
00104     <<"\': Error, arg="<<toString(arg)<<" is invalid!"
00105     );
00106   return supports_[arg];
00107 }
00108 
00109 
00110 template<class Scalar>
00111 void ModelEvaluatorBase::InArgs<Scalar>::set_x_dot(
00112   const RCP<const VectorBase<Scalar> > &x_dot
00113   )
00114 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; }
00115 
00116 
00117 template<class Scalar>
00118 RCP<const VectorBase<Scalar> >
00119 ModelEvaluatorBase::InArgs<Scalar>::get_x_dot() const
00120 { assert_supports(IN_ARG_x_dot); return x_dot_; }
00121 
00122 
00123 template<class Scalar>
00124 void ModelEvaluatorBase::InArgs<Scalar>::set_x(
00125   const RCP<const VectorBase<Scalar> > &x
00126   )
00127 { assert_supports(IN_ARG_x); x_ = x; }
00128 
00129 
00130 template<class Scalar>
00131 RCP<const VectorBase<Scalar> >
00132 ModelEvaluatorBase::InArgs<Scalar>::get_x() const
00133 { assert_supports(IN_ARG_x); return x_; }
00134 
00135 
00136 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00137 
00138 template<class Scalar>
00139 void ModelEvaluatorBase::InArgs<Scalar>::set_x_dot_poly(
00140   const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_dot_poly
00141   )
00142 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; }
00143 
00144 
00145 template<class Scalar>
00146 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > >
00147 ModelEvaluatorBase::InArgs<Scalar>::get_x_dot_poly() const
00148 { assert_supports(IN_ARG_x_dot_poly); return x_dot_poly_; }
00149 
00150 
00151 template<class Scalar>
00152 void ModelEvaluatorBase::InArgs<Scalar>::set_x_poly(
00153   const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_poly
00154   )
00155 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; }
00156 
00157 
00158 template<class Scalar>
00159 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > >
00160 ModelEvaluatorBase::InArgs<Scalar>::get_x_poly() const
00161 { assert_supports(IN_ARG_x_poly); return x_poly_; }
00162 
00163 
00164 #endif // HAVE_THYRA_ME_POLYNOMIAL
00165 
00166 template<class Scalar>
00167 void ModelEvaluatorBase::InArgs<Scalar>::set_p(
00168   int l, const RCP<const VectorBase<Scalar> > &p_l
00169   )
00170 { assert_l(l); p_[l] = p_l; }
00171 
00172 
00173 template<class Scalar>
00174 RCP<const VectorBase<Scalar> >
00175 ModelEvaluatorBase::InArgs<Scalar>::get_p(int l) const
00176 { assert_l(l); return p_[l]; }
00177 
00178 
00179 template<class Scalar>
00180 void ModelEvaluatorBase::InArgs<Scalar>::set_t( ScalarMag t )
00181 { assert_supports(IN_ARG_t); t_ = t; }
00182 
00183 
00184 template<class Scalar>
00185 typename ModelEvaluatorBase::InArgs<Scalar>::ScalarMag
00186 ModelEvaluatorBase::InArgs<Scalar>::get_t() const
00187 { assert_supports(IN_ARG_t); return t_; }
00188 
00189 
00190 template<class Scalar>
00191 void ModelEvaluatorBase::InArgs<Scalar>::set_alpha( Scalar alpha )
00192 { assert_supports(IN_ARG_alpha); alpha_ = alpha; }
00193 
00194 
00195 template<class Scalar>
00196 Scalar ModelEvaluatorBase::InArgs<Scalar>::get_alpha() const
00197 { assert_supports(IN_ARG_alpha); return alpha_; }
00198 
00199 
00200 template<class Scalar>
00201 void ModelEvaluatorBase::InArgs<Scalar>::set_beta( Scalar beta )
00202 { assert_supports(IN_ARG_beta); beta_ = beta; }
00203 
00204 
00205 template<class Scalar>
00206 Scalar ModelEvaluatorBase::InArgs<Scalar>::get_beta() const
00207 { assert_supports(IN_ARG_beta); return beta_; }
00208 
00209 
00210 template<class Scalar>
00211 void ModelEvaluatorBase::InArgs<Scalar>::setArgs(
00212   const InArgs<Scalar>& inArgs, bool ignoreUnsupported, bool cloneObjects
00213   )
00214 {
00215   using ModelEvaluatorHelperPack::condCloneVec;
00216   if( inArgs.supports(IN_ARG_x_dot) && nonnull(inArgs.get_x_dot()) ) {
00217     if(supports(IN_ARG_x_dot) || !ignoreUnsupported)
00218       set_x_dot(condCloneVec(inArgs.get_x_dot(),cloneObjects));
00219   }
00220   if( inArgs.supports(IN_ARG_x) && nonnull(inArgs.get_x()) ) {
00221     if(supports(IN_ARG_x) || !ignoreUnsupported)
00222       set_x(condCloneVec(inArgs.get_x(),cloneObjects));
00223   }
00224 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00225   if( inArgs.supports(IN_ARG_x_dot_poly) && nonnull(inArgs.get_x_dot_poly()) ) {
00226     if(supports(IN_ARG_x_dot_poly) || !ignoreUnsupported) {
00227       TEUCHOS_TEST_FOR_EXCEPT(
00228         cloneObjects && "Have not implemented cloning for x_dot_poly yet!" );
00229       set_x_dot_poly(inArgs.get_x_dot_poly());
00230     }
00231   }
00232   if( inArgs.supports(IN_ARG_x_poly) && nonnull(inArgs.get_x_poly()) ) {
00233     if(supports(IN_ARG_x_poly) || !ignoreUnsupported) {
00234       TEUCHOS_TEST_FOR_EXCEPT(
00235         cloneObjects && "Have not implemented cloning for x_poly yet!" );
00236       set_x_poly(inArgs.get_x_poly());
00237     }
00238   }
00239 #endif // HAVE_THYRA_ME_POLYNOMIAL
00240   const int min_Np = TEUCHOS_MIN(this->Np(),inArgs.Np());
00241   for (int l = 0; l < min_Np; ++l) {
00242     if (nonnull(inArgs.get_p(l)))
00243       set_p(l,condCloneVec(inArgs.get_p(l),cloneObjects));
00244   }
00245   if (inArgs.supports(IN_ARG_t)) {
00246     if(supports(IN_ARG_t) || !ignoreUnsupported)
00247       set_t(inArgs.get_t());
00248   }
00249   if (inArgs.supports(IN_ARG_alpha)) {
00250     if(supports(IN_ARG_alpha) || !ignoreUnsupported)
00251       set_alpha(inArgs.get_alpha());
00252   }
00253   if (inArgs.supports(IN_ARG_beta)) {
00254     if(supports(IN_ARG_beta) || !ignoreUnsupported)
00255       set_beta(inArgs.get_beta());
00256   }
00257 }
00258 
00259 
00260 template<class Scalar>
00261 void ModelEvaluatorBase::InArgs<Scalar>::assertSameSupport(
00262   const InArgs<Scalar> &inArgs
00263   ) const
00264 {
00265   for ( int inArg_i = 0; inArg_i < NUM_E_IN_ARGS_MEMBERS; ++inArg_i ) {
00266     const EInArgsMembers inArg_arg = static_cast<EInArgsMembers>(inArg_i);
00267     const std::string inArg_name = toString(inArg_arg);
00268     TEUCHOS_TEST_FOR_EXCEPTION(
00269       supports(inArg_arg) != inArgs.supports(inArg_arg), std::logic_error,
00270       "Error, the input argument "<<inArg_name<<" with support "<<inArgs.supports(inArg_arg)<<"\n"
00271       "in the InArgs object for the model:\n\n"
00272       "  "<<inArgs.modelEvalDescription()<<"\n\n"
00273       "is not the same the argument "<<inArg_name<<" with support "<<supports(inArg_arg)<<"\n"
00274       "in the InArgs object for the model:\n\n"
00275       "  "<<modelEvalDescription()<<"\n\n"
00276       "and these two InArgs objects are not compatible!"
00277       );
00278   }
00279   TEUCHOS_ASSERT_EQUALITY( this->Np(), inArgs.Np() );
00280 }
00281 
00282 
00283 template<class Scalar>
00284 std::string ModelEvaluatorBase::InArgs<Scalar>::modelEvalDescription() const
00285 {
00286   return modelEvalDescription_;
00287 }
00288 
00289 
00290 template<class Scalar>
00291 std::string ModelEvaluatorBase::InArgs<Scalar>::description() const
00292 {
00293   typedef Teuchos::ScalarTraits<Scalar> ST;
00294   std::ostringstream oss;
00295   oss
00296     << "Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<">"
00297     << "{"
00298     << "model="<<modelEvalDescription_
00299     << ",Np="<<Np()
00300     << "}";
00301   return oss.str();
00302 }
00303 
00304 
00305 template<class Scalar>
00306 void ModelEvaluatorBase::InArgs<Scalar>::describe(
00307   Teuchos::FancyOStream &out_arg, const Teuchos::EVerbosityLevel verbLevel
00308   ) const
00309 {
00310   using std::endl;
00311   typedef Teuchos::ScalarTraits<Scalar> ST;
00312   using Teuchos::OSTab;
00313   using Teuchos::describe;
00314   using Teuchos::includesVerbLevel;
00315   typedef RCP<const VectorBase<Scalar> > CV_ptr;
00316 
00317   if(verbLevel == Teuchos::VERB_NONE)
00318     return;
00319 
00320   RCP<Teuchos::FancyOStream>
00321     out = Teuchos::rcp(&out_arg,false);
00322   const bool dump_x = includesVerbLevel(verbLevel,Teuchos::VERB_HIGH);
00323   const Teuchos::EVerbosityLevel x_verbLevel =
00324     dump_x?Teuchos::VERB_EXTREME:verbLevel;
00325   const bool print_x_nrm = includesVerbLevel(verbLevel,Teuchos::VERB_LOW);
00326   const bool dump_p = includesVerbLevel(verbLevel,Teuchos::VERB_MEDIUM);
00327   const Teuchos::EVerbosityLevel p_verbLevel =
00328     dump_p?Teuchos::VERB_EXTREME:verbLevel;
00329   const bool print_p_nrm = includesVerbLevel(verbLevel,Teuchos::VERB_LOW);
00330   OSTab tab(out);
00331 
00332   *out <<"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<">:\n";
00333   tab.incrTab();
00334 
00335   *out <<"model = " << modelEvalDescription_ << "\n";
00336   *out <<"Np = " << Np() << "\n";
00337 
00338   CV_ptr x_dot;
00339   if ( this->supports(IN_ARG_x_dot) && !is_null(x_dot=get_x_dot()) ) {
00340     *out << "x_dot = " << Teuchos::describe(*x_dot,x_verbLevel);
00341     if (print_x_nrm)
00342       *out << "||x_dot|| = " << norm(*x_dot) << endl;
00343   }
00344 
00345   CV_ptr x;
00346   if ( this->supports(IN_ARG_x) && !is_null(x=get_x()) ) {
00347     *out << "x = " << Teuchos::describe(*x,x_verbLevel);
00348     if (print_x_nrm)
00349       *out << "||x|| = " << norm(*x) << endl;
00350   }
00351   
00352   if (print_x_nrm) {
00353     for( int l = 0; l < Np(); ++l ) {
00354       CV_ptr p_l;
00355       if ( !is_null(p_l = this->get_p(l)) ) {
00356         *out << "p("<<l<<") = " << Teuchos::describe(*p_l,p_verbLevel);
00357         if (print_p_nrm)
00358           *out << "||p("<<l<<")|| = " << norm(*p_l) << endl;
00359       }
00360     }
00361   }
00362   
00363   if (includesVerbLevel(verbLevel,Teuchos::VERB_MEDIUM)) {
00364     if (this->supports(IN_ARG_t)) {
00365       *out << "t = " << t_ << endl;
00366     }
00367     if (this->supports(IN_ARG_alpha)) {
00368       *out << "alpha = " << alpha_ << endl;
00369     }
00370     if (this->supports(IN_ARG_beta)) {
00371       *out << "beta = " << beta_ << endl;
00372     }
00373   }
00374   
00375 }
00376 
00377 
00378 template<class Scalar>
00379 void ModelEvaluatorBase::InArgs<Scalar>::_setModelEvalDescription(
00380   const std::string &modelEvalDescription_in
00381   )
00382 {
00383   modelEvalDescription_ = modelEvalDescription_in;
00384 }
00385 
00386 
00387 template<class Scalar>
00388 void ModelEvaluatorBase::InArgs<Scalar>::_set_Np(int Np_in)
00389 {
00390   p_.resize(Np_in);
00391 }
00392 
00393 
00394 template<class Scalar>
00395 void ModelEvaluatorBase::InArgs<Scalar>::_setSupports(
00396   EInArgsMembers arg, bool supports_in
00397   )
00398 {
00399   TEUCHOS_TEST_FOR_EXCEPTION(
00400     int(arg)>=NUM_E_IN_ARGS_MEMBERS || int(arg) < 0,std::logic_error
00401     ,"model = \'"<<modelEvalDescription_
00402     <<"\': Error, arg="<<toString(arg)<<" is invalid!");
00403   supports_[arg] = supports_in;
00404 }
00405 
00406 
00407 template<class Scalar>
00408 void ModelEvaluatorBase::InArgs<Scalar>::_setSupports(
00409   const InArgs<Scalar>& inArgs, const int Np_in
00410   )
00411 {
00412   std::copy(
00413     &inArgs.supports_[0],
00414     &inArgs.supports_[0] + NUM_E_IN_ARGS_MEMBERS, &supports_[0] );
00415   this->_set_Np( Np_in >= 0 ? Np_in : inArgs.Np() );
00416 }
00417 
00418 
00419 template<class Scalar>
00420 void ModelEvaluatorBase::InArgs<Scalar>::_setUnsupportsAndRelated(
00421   EInArgsMembers arg
00422   )
00423 {
00424   switch(arg) {
00425     case IN_ARG_x: {
00426       this->_setSupports(IN_ARG_x_dot,false);
00427       this->_setSupports(IN_ARG_x_dot_poly,false);
00428       this->_setSupports(IN_ARG_alpha,false);
00429       this->_setSupports(IN_ARG_beta,false);
00430       break;
00431     }
00432     default:
00433       TEUCHOS_TEST_FOR_EXCEPTION(
00434         true ,std::logic_error,
00435         "Error, can not handle args other than IN_ARG_x yet!"
00436         );
00437       break;
00438   }
00439   this->_setSupports(arg,false);
00440 }
00441 
00442 
00443 template<class Scalar>
00444 void ModelEvaluatorBase::InArgs<Scalar>::assert_supports(
00445   EInArgsMembers arg
00446   ) const
00447 {
00448   TEUCHOS_TEST_FOR_EXCEPTION(
00449     !supports_[arg], std::logic_error
00450     ,"Thyra::ModelEvaluatorBase::InArgs<"
00451     << Teuchos::ScalarTraits<Scalar>::name() <<">::assert_supports(arg): "
00452     "model = \'"<<modelEvalDescription_<<"\': Error, "
00453     "The argument arg = " << toString(arg) << " is not supported!"
00454     );
00455 }
00456 
00457 
00458 template<class Scalar>
00459 void ModelEvaluatorBase::InArgs<Scalar>::assert_l(int l) const
00460 {
00461   TEUCHOS_TEST_FOR_EXCEPTION(
00462     !( 0 <= l && l < Np() ), std::logic_error
00463     ,"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_l(l):\n\n"
00464     " model = \'"<<modelEvalDescription_<<"\':\n\n"
00465     "Error, The parameter l = " << l << " is not in the range [0,"<<Np()<<")!"
00466     );
00467 }
00468 
00469 
00470 //
00471 // ModelEvaluatorBase::DerivativeMultiVector
00472 //
00473 
00474 
00475 template<class Scalar>
00476 std::string ModelEvaluatorBase::DerivativeMultiVector<Scalar>::description() const
00477 {
00478   using std::endl;
00479   std::ostringstream oss;
00480   oss << "DerivativeMultiVector{";
00481   if (is_null(getMultiVector())) {
00482     oss << "NULL";
00483   }
00484   else {
00485     oss
00486       << "multiVec=" << getMultiVector()->description()
00487       << ",orientation=" << toString(getOrientation());
00488   }
00489   oss << "}";
00490   return oss.str();
00491 }
00492 
00493 
00494 template<class Scalar>
00495 void ModelEvaluatorBase::DerivativeMultiVector<Scalar>::describe(
00496   Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00497   ) const
00498 {
00499   using std::endl;
00500   using Teuchos::describe;
00501   Teuchos::OSTab tab1(out);
00502   out << "DerivativeMultiVector\n";
00503   Teuchos::OSTab tab2(out);
00504   out
00505     << "multiVec = "
00506     << describe(*getMultiVector(),verbLevel)
00507     << "orientation = "
00508     << toString(getOrientation()) << endl;
00509 }
00510 
00511 
00512 // 2007/06/12: rabartl: The above description() and describe(...) functions
00513 // have to be defined here and not in the class DerivativeMultiVector since it
00514 // relies on the non-member function
00515 // toString(ModelEvaluatorBase::EDerivativeMultiVectorOrientation) which is
00516 // defined after the class definition for ModelEvaluatorBase.  This was caught
00517 // by the intel compiler.  I am not sure why this worked with gcc.
00518 
00519 
00520 //
00521 // ModelEvaluatorBase::Derivative
00522 //
00523 
00524 
00525 template<class Scalar>
00526 std::string
00527 ModelEvaluatorBase::Derivative<Scalar>::description() const
00528 {
00529   using std::endl;
00530   std::ostringstream oss;
00531   oss << "Derivative{";
00532   if (isEmpty()) {
00533     oss << "NULL";
00534   }
00535   else if (!is_null(getLinearOp())) {
00536     oss << "linearOp=" << getLinearOp()->description();
00537   }
00538   else {
00539     oss << "derivMultiVec=" << getDerivativeMultiVector().description();
00540   }
00541   oss << "}";
00542   return oss.str();
00543 }
00544 
00545 
00546 template<class Scalar>
00547 void ModelEvaluatorBase::Derivative<Scalar>::describe( 
00548   Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00549   ) const
00550 {
00551   using std::endl;
00552   using Teuchos::describe;
00553   Teuchos::OSTab tab1(out);
00554   out << "Derivative:";
00555   if (isEmpty()) {
00556     out << " NULL\n";
00557   }
00558   else if (!is_null(getLinearOp())) {
00559     out
00560       << endl
00561       << "linearOp = " << describe(*getLinearOp(),verbLevel);
00562   }
00563   else {
00564     out
00565       << endl
00566       << "derivMultiVec = ";
00567     getDerivativeMultiVector().describe(out,verbLevel);
00568   }
00569 }
00570 
00571 
00572 //
00573 // ModelEvaluatorBase::OutArgs
00574 //
00575 
00576 
00577 template<class Scalar>
00578 ModelEvaluatorBase::OutArgs<Scalar>::OutArgs()
00579   :modelEvalDescription_("WARNING!  THIS OUTARGS OBJECT IS UNINITALIZED!"),
00580    isFailed_(false)
00581 { std::fill_n(&supports_[0],NUM_E_OUT_ARGS_MEMBERS,false); }
00582 
00583 
00584 template<class Scalar>
00585 int ModelEvaluatorBase::OutArgs<Scalar>::Np() const
00586 { return DfDp_.size(); }
00587 
00588 
00589 template<class Scalar>
00590 int ModelEvaluatorBase::OutArgs<Scalar>::Ng() const
00591 { return g_.size(); }
00592 
00593 
00594 template<class Scalar>
00595 bool ModelEvaluatorBase::OutArgs<Scalar>::supports(
00596   EOutArgsMembers arg
00597   ) const
00598 {
00599   TEUCHOS_TEST_FOR_EXCEPTION(
00600     int(arg)>=NUM_E_OUT_ARGS_MEMBERS || int(arg) < 0,std::logic_error
00601     ,"model = \'"<<modelEvalDescription_
00602     <<"\': Error, arg="<<toString(arg)<<" is invalid!"
00603     );
00604   return supports_[arg];
00605 }
00606 
00607 
00608 template<class Scalar>
00609 const ModelEvaluatorBase::DerivativeSupport&
00610 ModelEvaluatorBase::OutArgs<Scalar>::supports(
00611   EOutArgsDfDp arg, int l
00612   ) const
00613 {
00614   assert_l(l);
00615   return supports_DfDp_[l];
00616 }
00617 
00618 
00619 template<class Scalar>
00620 const ModelEvaluatorBase::DerivativeSupport&
00621 ModelEvaluatorBase::OutArgs<Scalar>::supports(
00622   EOutArgsDgDx_dot arg, int j
00623   ) const
00624 {
00625   assert_j(j);
00626   return supports_DgDx_dot_[j];
00627 }
00628 
00629 
00630 template<class Scalar>
00631 const ModelEvaluatorBase::DerivativeSupport&
00632 ModelEvaluatorBase::OutArgs<Scalar>::supports(
00633   EOutArgsDgDx arg, int j
00634   ) const
00635 {
00636   assert_j(j);
00637   return supports_DgDx_[j];
00638 }
00639 
00640 
00641 template<class Scalar>
00642 const ModelEvaluatorBase::DerivativeSupport&
00643 ModelEvaluatorBase::OutArgs<Scalar>::supports(
00644   EOutArgsDgDp arg, int j, int l
00645   ) const
00646 {
00647   assert_j(j);
00648   assert_l(l);
00649   return supports_DgDp_[ j*Np() + l ];
00650 }
00651 
00652 
00653 template<class Scalar>
00654 void ModelEvaluatorBase::OutArgs<Scalar>::set_f( 
00655   const RCP<VectorBase<Scalar> > &f
00656   )
00657 {
00658   assert_supports(OUT_ARG_f);
00659   f_ = f;
00660 }
00661 
00662 
00663 template<class Scalar>
00664 RCP<VectorBase<Scalar> >
00665 ModelEvaluatorBase::OutArgs<Scalar>::get_f() const
00666 {
00667   assert_supports(OUT_ARG_f);
00668   return f_;
00669 }
00670 
00671 
00672 template<class Scalar>
00673 void ModelEvaluatorBase::OutArgs<Scalar>::set_g(
00674   int j, const RCP<VectorBase<Scalar> > &g_j
00675   )
00676 {
00677   assert_j(j);
00678   g_[j] = g_j;
00679 }
00680 
00681 
00682 template<class Scalar>
00683 RCP<VectorBase<Scalar> >
00684 ModelEvaluatorBase::OutArgs<Scalar>::get_g(int j) const
00685 { 
00686   assert_j(j);
00687   return g_[j];
00688 }
00689 
00690 
00691 template<class Scalar>
00692 void ModelEvaluatorBase::OutArgs<Scalar>::set_W(
00693   const RCP<LinearOpWithSolveBase<Scalar> > &W
00694   )
00695 {
00696   assert_supports(OUT_ARG_W);
00697   W_ = W;
00698 }
00699 
00700 
00701 template<class Scalar>
00702 RCP<LinearOpWithSolveBase<Scalar> >
00703 ModelEvaluatorBase::OutArgs<Scalar>::get_W() const
00704 {
00705   assert_supports(OUT_ARG_W);
00706   return W_;
00707 }
00708 
00709 
00710 template<class Scalar>
00711 void ModelEvaluatorBase::OutArgs<Scalar>::set_W_op(
00712   const RCP<LinearOpBase<Scalar> > &W_op
00713   )
00714 {
00715   assert_supports(OUT_ARG_W_op);
00716   W_op_ = W_op;
00717 }
00718 
00719 
00720 template<class Scalar>
00721 RCP<LinearOpBase<Scalar> >
00722 ModelEvaluatorBase::OutArgs<Scalar>::get_W_op() const
00723 {
00724   assert_supports(OUT_ARG_W_op);
00725   return W_op_;
00726 }
00727 
00728 
00729 template<class Scalar>
00730 void ModelEvaluatorBase::OutArgs<Scalar>::set_W_prec(
00731   const RCP<PreconditionerBase<Scalar> > &W_prec
00732   )
00733 {
00734   assert_supports(OUT_ARG_W_prec);
00735   W_prec_ = W_prec;
00736 }
00737 
00738 
00739 template<class Scalar>
00740 RCP<PreconditionerBase<Scalar> >
00741 ModelEvaluatorBase::OutArgs<Scalar>::get_W_prec() const
00742 {
00743   assert_supports(OUT_ARG_W_prec);
00744   return W_prec_;
00745 }
00746 
00747 
00748 template<class Scalar>
00749 ModelEvaluatorBase::DerivativeProperties
00750 ModelEvaluatorBase::OutArgs<Scalar>::get_W_properties() const
00751 {
00752   assert_supports(OUT_ARG_f);
00753   return W_properties_;
00754 }
00755 
00756 
00757 template<class Scalar>
00758 void ModelEvaluatorBase::OutArgs<Scalar>::set_DfDp(
00759   int l, const Derivative<Scalar> &DfDp_l
00760   )
00761 {
00762   assert_supports(OUT_ARG_DfDp,l,DfDp_l);
00763   DfDp_[l] = DfDp_l;
00764 }
00765 
00766 
00767 template<class Scalar>
00768 ModelEvaluatorBase::Derivative<Scalar>
00769 ModelEvaluatorBase::OutArgs<Scalar>::get_DfDp(int l) const
00770 {
00771   assert_supports(OUT_ARG_DfDp,l);
00772   return DfDp_[l];
00773 }
00774 
00775 
00776 template<class Scalar>
00777 ModelEvaluatorBase::DerivativeProperties
00778 ModelEvaluatorBase::OutArgs<Scalar>::get_DfDp_properties(int l) const
00779 {
00780   assert_supports(OUT_ARG_DfDp,l);
00781   return DfDp_properties_[l];
00782 }
00783 
00784 
00785 template<class Scalar>
00786 void ModelEvaluatorBase::OutArgs<Scalar>::set_DgDx_dot(
00787   int j, const Derivative<Scalar> &DgDx_dot_j
00788   )
00789 {
00790   assert_supports(OUT_ARG_DgDx_dot,j,DgDx_dot_j);
00791   DgDx_dot_[j] = DgDx_dot_j;
00792 }
00793 
00794 
00795 template<class Scalar>
00796 ModelEvaluatorBase::Derivative<Scalar>
00797 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_dot(int j) const
00798 {
00799   assert_supports(OUT_ARG_DgDx_dot,j);
00800   return DgDx_dot_[j];
00801 }
00802 
00803 
00804 template<class Scalar>
00805 ModelEvaluatorBase::DerivativeProperties
00806 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_dot_properties(int j) const
00807 {
00808   assert_supports(OUT_ARG_DgDx_dot,j);
00809   return DgDx_dot_properties_[j];
00810 }
00811 
00812 
00813 template<class Scalar>
00814 void ModelEvaluatorBase::OutArgs<Scalar>::set_DgDx(
00815   int j, const Derivative<Scalar> &DgDx_j
00816   )
00817 {
00818   assert_supports(OUT_ARG_DgDx,j,DgDx_j);
00819   DgDx_[j] = DgDx_j;
00820 }
00821 
00822 
00823 template<class Scalar>
00824 ModelEvaluatorBase::Derivative<Scalar>
00825 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx(int j) const
00826 {
00827   assert_supports(OUT_ARG_DgDx,j);
00828   return DgDx_[j];
00829 }
00830 
00831 
00832 template<class Scalar>
00833 ModelEvaluatorBase::DerivativeProperties
00834 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_properties(int j) const
00835 {
00836   assert_supports(OUT_ARG_DgDx,j);
00837   return DgDx_properties_[j];
00838 }
00839 
00840 
00841 template<class Scalar>
00842 void ModelEvaluatorBase::OutArgs<Scalar>::set_DgDp(
00843   int j, int l, const Derivative<Scalar> &DgDp_j_l
00844   )
00845 {
00846   assert_supports(OUT_ARG_DgDp,j,l,DgDp_j_l);
00847   DgDp_[ j*Np() + l ] = DgDp_j_l;
00848 }
00849 
00850 
00851 template<class Scalar>
00852 ModelEvaluatorBase::Derivative<Scalar>
00853 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDp(int j, int l) const
00854 {
00855   assert_supports(OUT_ARG_DgDp,j,l);
00856   return DgDp_[ j*Np() + l ];
00857 }
00858 
00859 
00860 template<class Scalar>
00861 ModelEvaluatorBase::DerivativeProperties
00862 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDp_properties(int j, int l) const
00863 {
00864   assert_supports(OUT_ARG_DgDp,j,l);
00865   return DgDp_properties_[ j*Np() + l ];
00866 }
00867 
00868 
00869 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00870 
00871 
00872 template<class Scalar>
00873 void ModelEvaluatorBase::OutArgs<Scalar>::set_f_poly(
00874   const RCP<Teuchos::Polynomial< VectorBase<Scalar> > > &f_poly
00875   )
00876 {
00877   f_poly_ = f_poly;
00878 }
00879 
00880 
00881 template<class Scalar>
00882 RCP<Teuchos::Polynomial< VectorBase<Scalar> > >
00883 ModelEvaluatorBase::OutArgs<Scalar>::get_f_poly() const
00884 {
00885   return f_poly_;
00886 }
00887 
00888 
00889 #endif // HAVE_THYRA_ME_POLYNOMIAL
00890 
00891 
00892 template<class Scalar>
00893 void ModelEvaluatorBase::OutArgs<Scalar>::setArgs(
00894   const OutArgs<Scalar>& inputOutArgs, bool ignoreUnsupported
00895   )
00896 {
00897   typedef ModelEvaluatorBase MEB;
00898   const int min_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.Np());
00899   const int min_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.Ng());
00900   // f
00901   if ( inputOutArgs.supports(OUT_ARG_f) && nonnull(inputOutArgs.get_f()) ) {
00902     if ( supports(OUT_ARG_f) || !ignoreUnsupported )
00903       set_f(inputOutArgs.get_f());
00904   }
00905 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00906   // f_poly
00907   if ( inputOutArgs.supports(OUT_ARG_f_poly) && nonnull(inputOutArgs.get_f_poly()) ) {
00908     if ( supports(OUT_ARG_f_poly) || !ignoreUnsupported )
00909       set_f_poly(inputOutArgs.get_f_poly());
00910   }
00911 #endif // HAVE_THYRA_ME_POLYNOMIAL
00912   // g(j)
00913   for ( int j = 0; j < min_Ng; ++j ) {
00914     if ( nonnull(inputOutArgs.get_g(j)) )
00915       set_g(j,inputOutArgs.get_g(j));
00916   }
00917   // W
00918   if( inputOutArgs.supports(OUT_ARG_W) && nonnull(inputOutArgs.get_W()) ) {
00919     if ( supports(OUT_ARG_W) || !ignoreUnsupported )
00920       set_W(inputOutArgs.get_W());
00921   }
00922   // W_op
00923   if( inputOutArgs.supports(OUT_ARG_W_op) && nonnull(inputOutArgs.get_W_op()) ) {
00924     if ( supports(OUT_ARG_W_op) || !ignoreUnsupported )
00925       set_W_op(inputOutArgs.get_W_op());
00926   }
00927   // W_prec
00928   if( inputOutArgs.supports(OUT_ARG_W_prec) && nonnull(inputOutArgs.get_W_prec()) ) {
00929     if ( supports(OUT_ARG_W_prec) || !ignoreUnsupported )
00930       set_W_prec(inputOutArgs.get_W_prec());
00931   }
00932   // DfDp(l)
00933   for ( int l = 0; l < min_Np; ++l ) {
00934     MEB::Derivative<Scalar> DfDp_l;
00935     if ( !inputOutArgs.supports(OUT_ARG_DfDp,l).none()
00936       && !(DfDp_l=inputOutArgs.get_DfDp(l)).isEmpty() )
00937     {
00938       if ( DfDp_l.isSupportedBy(supports(OUT_ARG_DfDp,l)) || !ignoreUnsupported )
00939         set_DfDp(l,DfDp_l);
00940     }
00941   }
00942   // DgDx_dot(j) and DgDx(j)
00943   for ( int j = 0; j < min_Ng; ++j ) {
00944     // DgDx_dot(j)
00945     MEB::Derivative<Scalar> DgDx_dot_j;
00946     if ( !inputOutArgs.supports(OUT_ARG_DgDx_dot,j).none()
00947       && !(DgDx_dot_j=inputOutArgs.get_DgDx_dot(j)).isEmpty() )
00948     {
00949       if( DgDx_dot_j.isSupportedBy(supports(OUT_ARG_DgDx_dot,j)) || !ignoreUnsupported )
00950         set_DgDx_dot(j,DgDx_dot_j);
00951     }
00952     // DgDx(j)
00953     MEB::Derivative<Scalar> DgDx_j;
00954     if ( !inputOutArgs.supports(OUT_ARG_DgDx,j).none()
00955       && !(DgDx_j=inputOutArgs.get_DgDx(j)).isEmpty() ) {
00956       if ( DgDx_j.isSupportedBy(supports(OUT_ARG_DgDx,j)) || !ignoreUnsupported )
00957         set_DgDx(j,DgDx_j);
00958     }
00959   }
00960   // DgDp(j,l)
00961   for ( int l = 0; l < min_Np; ++l ) {
00962     for ( int j = 0; j < min_Ng; ++j ) {
00963       MEB::Derivative<Scalar> DgDp_j_l;
00964       if ( !inputOutArgs.supports(OUT_ARG_DgDp,j,l).none() 
00965         && !(DgDp_j_l=inputOutArgs.get_DgDp(j,l)).isEmpty() )
00966       {
00967         if ( DgDp_j_l.isSupportedBy(supports(OUT_ARG_DgDp,j,l)) || !ignoreUnsupported )
00968           set_DgDp(j,l,DgDp_j_l);
00969       }
00970     }
00971   }
00972   // ToDo: Add more args as needed!
00973 }
00974 
00975 
00976 template<class Scalar>
00977 void ModelEvaluatorBase::OutArgs<Scalar>::setFailed() const
00978 {
00979   typedef Teuchos::ScalarTraits<Scalar> ST;
00980   isFailed_ = true;
00981   if( this->supports(OUT_ARG_f) && nonnull(this->get_f()) ) {
00982     assign(this->get_f().ptr(),ST::nan());
00983   }
00984   for( int j = 0; j < this->Ng(); ++j ) {
00985     if (nonnull(this->get_g(j)))
00986       assign(this->get_g(j).ptr(),ST::nan());
00987   }
00988   // ToDo: Set other objects to NaN as well!
00989 }
00990 
00991 
00992 template<class Scalar>
00993 bool ModelEvaluatorBase::OutArgs<Scalar>::isFailed() const
00994 {
00995   return isFailed_;
00996 }
00997 
00998 
00999 template<class Scalar>
01000 bool ModelEvaluatorBase::OutArgs<Scalar>::isEmpty() const
01001 {
01002   if (!is_null(f_))
01003     return false;
01004   if (!is_null(W_))
01005     return false;
01006   if (!is_null(W_op_))
01007     return false;
01008   for ( int l = 0; l < Np(); ++l ) {
01009     if (!DfDp_[l].isEmpty())
01010       return false;
01011   }
01012 #ifdef HAVE_THYRA_ME_POLYNOMIAL
01013   if (!is_null(f_poly_))
01014     return false;
01015 #endif // HAVE_THYRA_ME_POLYNOMIAL
01016   for ( int j = 0; j < Ng(); ++j ) {
01017     if (!is_null(g_[j]))
01018       return false;
01019     if (!DgDx_dot_[j].isEmpty())
01020       return false;
01021     if (!DgDx_[j].isEmpty())
01022       return false;
01023     for ( int l = 0; l < Np(); ++l ) {
01024       if (!DgDp_[j*Np()+l].isEmpty())
01025         return false;
01026     }
01027   }
01028   return true;
01029 }
01030 
01031 
01032 template<class Scalar>
01033 void ModelEvaluatorBase::OutArgs<Scalar>::assertSameSupport(
01034   const OutArgs<Scalar> &outArgs
01035   ) const
01036 {
01037 
01038   for ( int outArg_i = 0; outArg_i < NUM_E_OUT_ARGS_MEMBERS; ++outArg_i ) {
01039     const EOutArgsMembers outArg_arg = static_cast<EOutArgsMembers>(outArg_i);
01040     const std::string outArg_name = toString(outArg_arg);
01041     TEUCHOS_TEST_FOR_EXCEPTION(
01042       supports(outArg_arg) != outArgs.supports(outArg_arg), std::logic_error,
01043       "Error, the output argument "<<outArg_name<<" with support "<<outArgs.supports(outArg_arg)<<"\n"
01044       "in the OutArgs object for the model:\n\n"
01045       "  "<<outArgs.modelEvalDescription()<<"\n\n"
01046       "is not the same the argument "<<outArg_name<<" with support "<<supports(outArg_arg)<<"\n"
01047       "in the OutArgs object for the model:\n\n"
01048       "  "<<modelEvalDescription()<<"\n\n"
01049       "and these two OutArgs objects are not compatible!"
01050       );
01051   }
01052 
01053   const int l_Np = this->Np();
01054   const int l_Ng = this->Ng();
01055   TEUCHOS_ASSERT_EQUALITY( l_Np, outArgs.Np() );
01056   TEUCHOS_ASSERT_EQUALITY( l_Ng, outArgs.Ng() );
01057 
01058   if (supports(OUT_ARG_f)) {
01059     for ( int l = 0; l < l_Np; ++l ) {
01060       TEUCHOS_TEST_FOR_EXCEPTION(
01061         !supports(OUT_ARG_DfDp,l).isSameSupport(outArgs.supports(OUT_ARG_DfDp,l)),
01062         std::logic_error,
01063         "Error, the support for DfDp("<<l<<") is not the same for the models\n\n"
01064         "  "<<outArgs.modelEvalDescription()<<"\n\n"
01065         "and:\n\n"
01066         "  "<<modelEvalDescription()<<"\n\n"
01067         "and these two OutArgs objects are not compatible!"
01068         );
01069     }
01070   }
01071 
01072   for ( int j = 0; j < l_Ng; ++j ) {
01073     TEUCHOS_TEST_FOR_EXCEPTION(
01074       !supports(OUT_ARG_DgDx_dot,j).isSameSupport(outArgs.supports(OUT_ARG_DgDx_dot,j)),
01075       std::logic_error,
01076       "Error, the support for DgDx_dot("<<j<<") is not the same for the models\n\n"
01077       "  "<<outArgs.modelEvalDescription()<<"\n\n"
01078       "and:\n\n"
01079       "  "<<modelEvalDescription()<<"\n\n"
01080       "and these two OutArgs objects are not compatible!"
01081       );
01082     TEUCHOS_TEST_FOR_EXCEPTION(
01083       !supports(OUT_ARG_DgDx,j).isSameSupport(outArgs.supports(OUT_ARG_DgDx,j)),
01084       std::logic_error,
01085       "Error, the support for DgDx("<<j<<") is not the same for the models\n\n"
01086       "  "<<outArgs.modelEvalDescription()<<"\n\n"
01087       "and:\n\n"
01088       "  "<<modelEvalDescription()<<"\n\n"
01089       "and these two OutArgs objects are not compatible!"
01090       );
01091     for ( int l = 0; l < l_Np; ++l ) {
01092       TEUCHOS_TEST_FOR_EXCEPTION(
01093         !supports(OUT_ARG_DgDp,j,l).isSameSupport(outArgs.supports(OUT_ARG_DgDp,j,l)),
01094         std::logic_error,
01095         "Error, the support for DgDp("<<j<<","<<l<<") is not the same for the models\n\n"
01096         "  "<<outArgs.modelEvalDescription()<<"\n\n"
01097         "and:\n\n"
01098         "  "<<modelEvalDescription()<<"\n\n"
01099         "and these two OutArgs objects are not compatible!"
01100         );
01101     }
01102   }
01103 }
01104 
01105 
01106 template<class Scalar>
01107 std::string ModelEvaluatorBase::OutArgs<Scalar>::modelEvalDescription() const
01108 {
01109   return modelEvalDescription_;
01110 }
01111 
01112 
01113 template<class Scalar>
01114 std::string ModelEvaluatorBase::OutArgs<Scalar>::description() const
01115 {
01116   typedef Teuchos::ScalarTraits<Scalar> ST;
01117   std::ostringstream oss;
01118   oss
01119     << "Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<">"
01120     << "{"
01121     << "model="<<modelEvalDescription_
01122     << ",Np="<<Np()
01123     << ",Ng="<<Ng()
01124     << "}";
01125   return oss.str();
01126 }
01127 
01128 
01129 template<class Scalar>
01130 void ModelEvaluatorBase::OutArgs<Scalar>::describe(
01131   Teuchos::FancyOStream &out_arg, const Teuchos::EVerbosityLevel verbLevel
01132   ) const
01133 {
01134 
01135   using Teuchos::OSTab;
01136   using Teuchos::describe;
01137   typedef Teuchos::ScalarTraits<Scalar> ST;
01138   typedef RCP<const VectorBase<Scalar> > CV_ptr;
01139   typedef RCP<const LinearOpBase<Scalar> > CLO_ptr;
01140   typedef RCP<const LinearOpWithSolveBase<Scalar> > CLOWS_ptr;
01141   typedef ModelEvaluatorBase MEB;
01142   typedef MEB::Derivative<Scalar> Deriv;
01143 
01144   if( verbLevel == Teuchos::VERB_NONE && verbLevel == Teuchos::VERB_DEFAULT )
01145     return;
01146 
01147   RCP<Teuchos::FancyOStream>
01148     out = Teuchos::rcp(&out_arg,false);
01149   OSTab tab(out);
01150 
01151   *out <<"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<">:\n";
01152   tab.incrTab();
01153 
01154   *out <<"model = " << modelEvalDescription_ << "\n";
01155   *out <<"Np = " << Np() << "\n";
01156   *out <<"Ng = " << Ng() << "\n";
01157 
01158   CV_ptr f;
01159   if (this->supports(OUT_ARG_f) && !is_null(f=get_f()) ) {
01160     *out << "f = " << Teuchos::describe(*f,verbLevel);
01161   }
01162   
01163   for( int j = 0; j < Ng(); ++j ) {
01164     CV_ptr g_j;
01165     if (!is_null(g_j=this->get_g(j)))
01166       *out << "g("<<j<<") = " << Teuchos::describe(*g_j,verbLevel);
01167   }
01168   
01169   CLOWS_ptr W;
01170   if ( this->supports(OUT_ARG_W) && !is_null(W=get_W()) ) {
01171     *out << "W = " << Teuchos::describe(*W,verbLevel);
01172   }
01173   
01174   CLO_ptr W_op;
01175   if ( this->supports(OUT_ARG_W_op) && !is_null(W_op=get_W_op()) ) {
01176     *out << "W_op = " << Teuchos::describe(*W_op,verbLevel);
01177   }
01178   
01179   for( int l = 0; l < Np(); ++l ) {
01180     Deriv DfDp_l;
01181     if (
01182       !this->supports(OUT_ARG_DfDp,l).none()
01183       && !(DfDp_l=get_DfDp(l)).isEmpty()
01184       )
01185     {
01186       *out << "DfDp("<<l<<") = ";
01187       DfDp_l.describe(*out,verbLevel);
01188     }
01189   }
01190   
01191   for( int j = 0; j < Ng(); ++j ) {
01192     
01193     Deriv DgDx_dot_j;
01194     if (
01195       !this->supports(OUT_ARG_DgDx_dot,j).none()
01196       && !(DgDx_dot_j=get_DgDx_dot(j)).isEmpty()
01197       )
01198     {
01199       *out << "DgDx_dot("<<j<<") = ";
01200       DgDx_dot_j.describe(*out,verbLevel);
01201     }
01202     
01203     Deriv DgDx_j;
01204     if (
01205       !this->supports(OUT_ARG_DgDx,j).none()
01206       && !(DgDx_j=get_DgDx(j)).isEmpty()
01207       )
01208     {
01209       *out << "DgDx("<<j<<") = ";
01210       DgDx_j.describe(*out,verbLevel);
01211     }
01212     
01213     for( int l = 0; l < Np(); ++l ) {
01214       
01215       Deriv DgDp_j_l;
01216       if (
01217         !this->supports(OUT_ARG_DgDp,j,l).none()
01218         && !(DgDp_j_l=get_DgDp(j,l)).isEmpty()
01219         )
01220       {
01221         *out << "DgDp("<<j<<","<<l<<") = ";
01222         DgDp_j_l.describe(*out,verbLevel);
01223       }
01224     }
01225     
01226   }
01227   
01228   // ToDo: Add output for more objects?
01229 
01230 }
01231 
01232 
01233 // protected
01234 
01235 
01236 template<class Scalar>
01237 void ModelEvaluatorBase::OutArgs<Scalar>::_setModelEvalDescription(
01238   const std::string &modelEvalDescription_in
01239   )
01240 {
01241   modelEvalDescription_ = modelEvalDescription_in;
01242 }
01243 
01244 template<class Scalar>
01245 void ModelEvaluatorBase::OutArgs<Scalar>::_set_Np_Ng(int Np_in, int Ng_in)
01246 {
01247   if(Np_in) {
01248     supports_DfDp_.resize(Np_in);
01249     DfDp_.resize(Np_in); std::fill_n(DfDp_.begin(),Np_in,Derivative<Scalar>());
01250     DfDp_properties_.resize(Np_in); std::fill_n(DfDp_properties_.begin(),Np_in,DerivativeProperties());
01251   }
01252   if(Ng_in) {
01253     g_.resize(Ng_in); std::fill_n(g_.begin(),Ng_in,Teuchos::null);
01254     supports_DgDx_dot_.resize(Ng_in);
01255     DgDx_dot_.resize(Ng_in); std::fill_n(DgDx_dot_.begin(),Ng_in,Derivative<Scalar>());
01256     DgDx_dot_properties_.resize(Ng_in); std::fill_n(DgDx_dot_properties_.begin(),Ng_in,DerivativeProperties());
01257     supports_DgDx_.resize(Ng_in);
01258     DgDx_.resize(Ng_in); std::fill_n(DgDx_.begin(),Ng_in,Derivative<Scalar>());
01259     DgDx_properties_.resize(Ng_in); std::fill_n(DgDx_properties_.begin(),Ng_in,DerivativeProperties());
01260   }
01261   if(Np_in && Ng_in) {
01262     const int NpNg = Np_in*Ng_in;
01263     supports_DgDp_.resize(NpNg);
01264     DgDp_.resize(NpNg); std::fill_n(DgDp_.begin(),NpNg,Derivative<Scalar>());
01265     DgDp_properties_.resize(NpNg); std::fill_n(DgDp_properties_.begin(),NpNg,DerivativeProperties());
01266   }
01267 }
01268 
01269 
01270 template<class Scalar>
01271 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
01272   EOutArgsMembers arg, bool supports_in )
01273 {
01274   TEUCHOS_TEST_FOR_EXCEPTION(
01275     int(arg)>=NUM_E_OUT_ARGS_MEMBERS || int(arg) < 0,std::logic_error
01276     ,"model = \'"<<modelEvalDescription_
01277     <<"\': Error, arg="<<toString(arg)<<" is invalid!"
01278     );
01279   supports_[arg] = supports_in;
01280 }
01281 
01282 
01283 template<class Scalar>
01284 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
01285   EOutArgsDfDp arg, int l, const DerivativeSupport& supports_in
01286   )
01287 {
01288   assert_supports(OUT_ARG_f);
01289   assert_l(l);
01290   supports_DfDp_[l] = supports_in;
01291 }
01292 
01293 
01294 template<class Scalar>
01295 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
01296   EOutArgsDgDx_dot arg, int j, const DerivativeSupport& supports_in
01297   )
01298 {
01299   assert_j(j);
01300   supports_DgDx_dot_[j] = supports_in;
01301 }
01302 
01303 
01304 template<class Scalar>
01305 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
01306   EOutArgsDgDx arg, int j, const DerivativeSupport& supports_in
01307   )
01308 {
01309   assert_j(j);
01310   supports_DgDx_[j] = supports_in;
01311 }
01312 
01313 
01314 template<class Scalar>
01315 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
01316   EOutArgsDgDp arg, int j, int l, const DerivativeSupport& supports_in
01317   )
01318 {
01319   assert_j(j);
01320   assert_l(l);
01321   supports_DgDp_[ j*Np()+ l ] = supports_in;
01322 }
01323 
01324 
01325 template<class Scalar>
01326 void ModelEvaluatorBase::OutArgs<Scalar>::_set_W_properties( 
01327   const DerivativeProperties &properties
01328   )
01329 {
01330   W_properties_ = properties;
01331 }
01332 
01333 
01334 template<class Scalar>
01335 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DfDp_properties(
01336   int l, const DerivativeProperties &properties
01337   )
01338 {
01339   assert_supports(OUT_ARG_DfDp,l);
01340   DfDp_properties_[l] = properties;
01341 }
01342 
01343 
01344 template<class Scalar>
01345 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDx_dot_properties(
01346   int j, const DerivativeProperties &properties
01347   )
01348 {
01349   assert_supports(OUT_ARG_DgDx_dot,j);
01350   DgDx_dot_properties_[j] = properties;
01351 }
01352 
01353 
01354 template<class Scalar>
01355 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDx_properties(
01356   int j, const DerivativeProperties &properties
01357   )
01358 {
01359   assert_supports(OUT_ARG_DgDx,j);
01360   DgDx_properties_[j] = properties;
01361 }
01362 
01363 
01364 template<class Scalar>
01365 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDp_properties(
01366   int j, int l, const DerivativeProperties &properties
01367   )
01368 {
01369   assert_supports(OUT_ARG_DgDp,j,l);
01370   DgDp_properties_[ j*Np()+ l ] = properties;
01371 }
01372 
01373 
01374 template<class Scalar>
01375 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
01376   const OutArgs<Scalar>& inputOutArgs
01377   )
01378 {
01379   typedef ModelEvaluatorBase MEB;
01380   const int l_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.Np()); 
01381   const int l_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.Ng()); 
01382   std::copy(
01383     &inputOutArgs.supports_[0],
01384     &inputOutArgs.supports_[0] + NUM_E_OUT_ARGS_MEMBERS, &supports_[0] );
01385   for( int l = 0; l < l_Np; ++l ) {
01386     DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DfDp,l);
01387     if (!ds.none()) {
01388       this->_setSupports(MEB::OUT_ARG_DfDp,l,ds);
01389       this->_set_DfDp_properties(l,inputOutArgs.get_DfDp_properties(l));
01390     }
01391   }
01392   for( int j = 0; j < l_Ng; ++j ) {
01393     DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx_dot,j);
01394     this->_setSupports(MEB::OUT_ARG_DgDx_dot,j,ds);
01395     if(!ds.none()) this->_set_DgDx_dot_properties(j,inputOutArgs.get_DgDx_dot_properties(j));
01396   }
01397   for( int j = 0; j < l_Ng; ++j ) {
01398     DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx,j);
01399     this->_setSupports(MEB::OUT_ARG_DgDx,j,ds);
01400     if(!ds.none()) this->_set_DgDx_properties(j,inputOutArgs.get_DgDx_properties(j));
01401   }
01402   for( int j = 0; j < l_Ng; ++j ) for( int l = 0; l < l_Np; ++l ) {
01403     DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDp,j,l);
01404     this->_setSupports(MEB::OUT_ARG_DgDp,j,l,ds);
01405     if(!ds.none()) this->_set_DgDp_properties(j,l,inputOutArgs.get_DgDp_properties(j,l));
01406   }
01407   if(this->supports(OUT_ARG_W) || this->supports(OUT_ARG_W_op))
01408     this->_set_W_properties(inputOutArgs.get_W_properties());
01409 }
01410 
01411 
01412 template<class Scalar>
01413 void ModelEvaluatorBase::OutArgs<Scalar>::_setUnsupportsAndRelated(
01414   EInArgsMembers arg
01415   )
01416 {
01417   switch(arg) {
01418     case IN_ARG_x: {
01419       const int l_Ng = this->Ng();
01420       for( int j = 0; j < l_Ng; ++j ) {
01421         this->_setSupports(OUT_ARG_DgDx_dot,j,DerivativeSupport());
01422         this->_setSupports(OUT_ARG_DgDx,j,DerivativeSupport());
01423       }
01424       break;
01425     }
01426     default:
01427       TEUCHOS_TEST_FOR_EXCEPTION(
01428         true ,std::logic_error,
01429         "Error, can not handle args other than IN_ARG_x yet!"
01430         );
01431       break;
01432   }
01433 }
01434 
01435 
01436 template<class Scalar>
01437 void ModelEvaluatorBase::OutArgs<Scalar>::_setUnsupportsAndRelated(
01438   EOutArgsMembers arg
01439   )
01440 {
01441   switch(arg) {
01442     case OUT_ARG_f: {
01443       this->_setSupports(OUT_ARG_W,false);
01444       this->_setSupports(OUT_ARG_W_op,false);
01445       this->_setSupports(OUT_ARG_f_poly,false);
01446       const int l_Np = this->Np();
01447       for( int l = 0; l < l_Np; ++l )
01448         this->_setSupports(OUT_ARG_DfDp,l,DerivativeSupport());
01449       break;
01450     }
01451     default:
01452       TEUCHOS_TEST_FOR_EXCEPTION(
01453         true ,std::logic_error,
01454         "Error, can not handle args other than OUT_ARG_f yet!"
01455         );
01456       break;
01457   }
01458   this->_setSupports(arg,false);
01459 }
01460 
01461 
01462 // private
01463 
01464 
01465 template<class Scalar>
01466 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(EOutArgsMembers arg) const
01467 {
01468   TEUCHOS_TEST_FOR_EXCEPTION(
01469     !this->supports(arg), std::logic_error
01470     ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(arg):\n\n"
01471     "model = \'"<<modelEvalDescription_<<"\':\n\n"
01472     "Error, The argument arg = " << toString(arg) << " is not supported!"
01473     );
01474 }
01475 
01476 
01477 template<class Scalar>
01478 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
01479   EOutArgsDfDp arg, int l, const Derivative<Scalar> &deriv
01480   ) const
01481 {
01482   const DerivativeSupport derivSupport = this->supports(arg,l);
01483   TEUCHOS_TEST_FOR_EXCEPTION(
01484     !deriv.isSupportedBy(derivSupport), std::logic_error,
01485     "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp,l):\n\n"
01486     "model = \'"<<modelEvalDescription_<<"\':\n\n"
01487     "Error, The argument DfDp("<<l<<") = " << deriv.description() << "\n"
01488     "is not supported!\n\n"
01489     "The supported types include " << derivSupport.description() << "!"
01490     );
01491 }
01492 
01493 
01494 template<class Scalar>
01495 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
01496   EOutArgsDgDx_dot arg, int j, const Derivative<Scalar> &deriv
01497   ) const
01498 {
01499   const DerivativeSupport derivSupport = this->supports(arg,j);
01500   TEUCHOS_TEST_FOR_EXCEPTION(
01501     !deriv.isSupportedBy(derivSupport), std::logic_error,
01502     "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot,j):\n\n"
01503     "model = \'"<<modelEvalDescription_<<"\':\n\n"
01504     "Error, The argument DgDx_dot("<<j<<") = " << deriv.description() << "\n"
01505     "is not supported!\n\n"
01506     "The supported types include " << derivSupport.description() << "!"
01507     );
01508 }
01509 
01510 
01511 template<class Scalar>
01512 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
01513   EOutArgsDgDx arg, int j, const Derivative<Scalar> &deriv
01514   ) const
01515 {
01516   const DerivativeSupport derivSupport = this->supports(arg,j);
01517   TEUCHOS_TEST_FOR_EXCEPTION(
01518     !deriv.isSupportedBy(derivSupport), std::logic_error,
01519     "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx,j):\n\n"
01520     "model = \'"<<modelEvalDescription_<<"\':\n\n"
01521     "Error, The argument DgDx("<<j<<") = " << deriv.description() << "\n"
01522     "is not supported!\n\n"
01523     "The supported types include " << derivSupport.description() << "!"
01524     );
01525 }
01526 
01527 
01528 template<class Scalar>
01529 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
01530   EOutArgsDgDp arg, int j, int l, const Derivative<Scalar> &deriv
01531   ) const
01532 {
01533   const DerivativeSupport derivSupport = this->supports(arg,j,l);
01534   TEUCHOS_TEST_FOR_EXCEPTION(
01535     !deriv.isSupportedBy(derivSupport), std::logic_error,
01536     "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp,j,l):\n\n"
01537     "model = \'"<<modelEvalDescription_<<"\':\n\n"
01538     "Error, The argument DgDp("<<j<<","<<l<<") = " << deriv.description() << "\n"
01539     "is not supported!\n\n"
01540     "The supported types include " << derivSupport.description() << "!"
01541     );
01542 }
01543 
01544 
01545 template<class Scalar>
01546 void ModelEvaluatorBase::OutArgs<Scalar>::assert_l(int l) const
01547 {
01548   TEUCHOS_TEST_FOR_EXCEPTION(
01549     !( 0 <= l && l < Np() ), std::logic_error
01550     ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_l(l):\n\n"
01551     "model = \'"<<modelEvalDescription_<<"\':\n\n"
01552     "Error,  The parameter subvector p("<<l<<")"
01553     " is not in the range [0,"<<Np()<<")!"
01554     );
01555 }
01556 
01557 
01558 template<class Scalar>
01559 void ModelEvaluatorBase::OutArgs<Scalar>::assert_j(int j) const
01560 {
01561   TEUCHOS_TEST_FOR_EXCEPTION(
01562     !( 0 <= j && j < Ng() ), std::logic_error
01563     ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_j(j):\n\n"
01564     "model = \'"<<modelEvalDescription_<<"\':\n\n"
01565     "Error, The auxiliary function g("<<j<<")"
01566     " is not in the range [0,"<<Ng()<<")!"
01567     );
01568 }
01569 
01570 
01571 //
01572 // ModelEvaluatorBase::InArgsSetup
01573 //
01574 
01575 
01576 template<class Scalar>
01577 ModelEvaluatorBase::InArgsSetup<Scalar>::InArgsSetup()
01578 {}
01579 
01580 
01581 template<class Scalar>
01582 ModelEvaluatorBase::InArgsSetup<Scalar>::InArgsSetup( const InArgs<Scalar>& inArgs )
01583   :InArgs<Scalar>(inArgs)
01584 {}
01585 
01586 
01587 template<class Scalar>
01588 void ModelEvaluatorBase::InArgsSetup<Scalar>::setModelEvalDescription(
01589   const std::string &modelEvalDescription_in )
01590 {
01591   this->_setModelEvalDescription(modelEvalDescription_in);
01592 }
01593 
01594 
01595 template<class Scalar>
01596 void ModelEvaluatorBase::InArgsSetup<Scalar>::set_Np(int Np_in)
01597 { this->_set_Np(Np_in); }
01598 
01599 
01600 template<class Scalar>
01601 void ModelEvaluatorBase::InArgsSetup<Scalar>::setSupports( EInArgsMembers arg, bool supports_in )
01602 { this->_setSupports(arg,supports_in); }
01603 
01604 
01605 template<class Scalar>
01606 void ModelEvaluatorBase::InArgsSetup<Scalar>::setSupports(
01607   const InArgs<Scalar>& inArgs, const int Np_in
01608   )
01609 {
01610   this->_setSupports(inArgs, Np_in);
01611 }
01612 
01613 
01614 template<class Scalar>
01615 void ModelEvaluatorBase::InArgsSetup<Scalar>::setUnsupportsAndRelated(
01616   EInArgsMembers arg
01617   )
01618 {
01619   this->_setUnsupportsAndRelated(arg);
01620 }
01621 
01622 
01623 //
01624 // ModelEvaluatorBase::OutArgsSetup
01625 //
01626 
01627 
01628 template<class Scalar>
01629 ModelEvaluatorBase::OutArgsSetup<Scalar>::OutArgsSetup()
01630 {}
01631 
01632 
01633 template<class Scalar>
01634 ModelEvaluatorBase::OutArgsSetup<Scalar>::OutArgsSetup(
01635   const OutArgs<Scalar>& inputOutArgs
01636   )
01637   :OutArgs<Scalar>(inputOutArgs)
01638 {}
01639 
01640 
01641 template<class Scalar>
01642 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setModelEvalDescription(
01643   const std::string &modelEvalDescription_in
01644   )
01645 { this->_setModelEvalDescription(modelEvalDescription_in); }
01646 
01647 
01648 template<class Scalar>
01649 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_Np_Ng(int Np_in, int Ng_in)
01650 { this->_set_Np_Ng(Np_in, Ng_in); }
01651 
01652 
01653 template<class Scalar>
01654 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setSupports(
01655   EOutArgsMembers arg, bool supports_in
01656   )
01657 { this->_setSupports(arg,supports_in); }
01658 
01659 
01660 template<class Scalar>
01661 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setSupports(
01662   EOutArgsDfDp arg, int l, const DerivativeSupport& supports_in
01663   )
01664 { this->_setSupports(arg,l,supports_in); }
01665 
01666 
01667 template<class Scalar>
01668 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setSupports( 
01669   EOutArgsDgDx_dot arg, int j, const DerivativeSupport& supports_in
01670   )
01671 { this->_setSupports(arg,j,supports_in); }
01672 
01673 
01674 template<class Scalar>
01675 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setSupports(
01676   EOutArgsDgDx arg, int j, const DerivativeSupport& supports_in
01677   )
01678 { this->_setSupports(arg,j,supports_in); }
01679 
01680 
01681 template<class Scalar>
01682 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setSupports(
01683   EOutArgsDgDp arg, int j, int l, const DerivativeSupport& supports_in
01684   )
01685 { this->_setSupports(arg,j,l,supports_in); }
01686 
01687 
01688 template<class Scalar>
01689 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_W_properties(
01690   const DerivativeProperties &properties
01691   )
01692 { this->_set_W_properties(properties); }
01693 
01694 
01695 template<class Scalar>
01696 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DfDp_properties(
01697   int l, const DerivativeProperties &properties
01698   )
01699 { this->_set_DfDp_properties(l,properties); }
01700 
01701 
01702 template<class Scalar>
01703 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDx_dot_properties(
01704   int j, const DerivativeProperties &properties
01705   )
01706 { this->_set_DgDx_dot_properties(j,properties); }
01707 
01708 
01709 template<class Scalar>
01710 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDx_properties(
01711   int j, const DerivativeProperties &properties
01712   )
01713 { this->_set_DgDx_properties(j,properties); }
01714 
01715 
01716 template<class Scalar>
01717 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDp_properties(
01718   int j, int l, const DerivativeProperties &properties
01719   )
01720 { this->_set_DgDp_properties(j,l,properties); }
01721 
01722 
01723 template<class Scalar>
01724 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setSupports(
01725   const OutArgs<Scalar>& inputOutArgs
01726   )
01727 { this->_setSupports(inputOutArgs); }
01728 
01729 
01730 template<class Scalar>
01731 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setUnsupportsAndRelated(
01732   EInArgsMembers arg
01733   )
01734 { this->_setUnsupportsAndRelated(arg); }
01735 
01736 
01737 template<class Scalar>
01738 void ModelEvaluatorBase::OutArgsSetup<Scalar>::setUnsupportsAndRelated(
01739   EOutArgsMembers arg
01740   )
01741 { this->_setUnsupportsAndRelated(arg); }
01742 
01743 
01744 } // namespace Thyra
01745 
01746 
01747 
01748 //
01749 // Explicit instantiation macro
01750 //
01751 // Must be expanded from within the Thyra namespace!
01752 //
01753 
01754 
01755 #define THYRA_MODEL_EVALUATOR_BASE_INSTANT(SCALAR) \
01756   \
01757   template class ModelEvaluatorBase::InArgs<SCALAR >; \
01758   \
01759   template std::string \
01760   ModelEvaluatorBase::Derivative<SCALAR >::description() const; \
01761   \
01762   template \
01763   void ModelEvaluatorBase::Derivative<SCALAR >::describe( \
01764     Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel \
01765     ) const; \
01766   \
01767   template class ModelEvaluatorBase::OutArgs<SCALAR >; \
01768   \
01769   template class ModelEvaluatorBase::InArgsSetup<SCALAR >; \
01770   \
01771   template class ModelEvaluatorBase::OutArgsSetup<SCALAR >;
01772 
01773 
01774 #endif // THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines