当前位置: 首页>>代码示例>>C++>>正文


C++ Teuchos::is_null方法代码示例

本文整理汇总了C++中Teuchos::is_null方法的典型用法代码示例。如果您正苦于以下问题:C++ Teuchos::is_null方法的具体用法?C++ Teuchos::is_null怎么用?C++ Teuchos::is_null使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Teuchos的用法示例。


在下文中一共展示了Teuchos::is_null方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: problemWithNewRHS

  Teuchos::RCP<LinearProblem<Scalar, MV, OP> >
  problemWithNewRHS (const Teuchos::RCP<const LinearProblem<Scalar, MV, OP> >& problem,
		     const Teuchos::RCP<const MV>& B)
  {
    using Teuchos::is_null;
    using Teuchos::nonnull;
    using Teuchos::null;
    using Teuchos::RCP;
    using Teuchos::rcp;
    typedef LinearProblem<Scalar, MV, OP> lp_type;
    typedef MultiVecTraits<Scalar, MV> MVT;

    RCP<const OP> A = problem->getOperator (); 
    RCP<MV> X_orig = problem->getLHS ();
    TEUCHOS_TEST_FOR_EXCEPTION(is_null (X_orig), std::invalid_argument,
		       "problemWithNewRHS(): The original LinearProblem's "
		       "initial guess / current approximate solution (getLHS())"
		       " is null.  We need an initial guess or current approxim"
		       "ate solution in order to know the domain of the (right-"
		       "preconditioned, if applicable) operator.  This is "
		       "because Belos::MultiVecTraits does not include the idea"
		       " of the domain and range of an operator, or the space "
		       "to which a vector belongs.");
    TEUCHOS_TEST_FOR_EXCEPTION(is_null (B), std::invalid_argument,
		       "problemWithNewRHS(): the given new right-hand side B "
		       "is null.");
    RCP<MV> X = MVT::CloneCopy (problem->getLHS ());

    RCP<lp_type> lp (new lp_type (A, X, B));
    lp->setLeftPrec (problem->getLeftPrec ());
    lp->setRightPrec (problem->getRightPrec ());
    // Compute initial residual(s) and prepare the problem for solution.
    lp->setProblem ();
    return lp;
  }
开发者ID:00liujj,项目名称:trilinos,代码行数:35,代码来源:BelosInnerSolver.hpp

示例2: defined

TEUCHOS_UNIT_TEST( DefaultAddedLinearOp, defaultConstruct )
{

  typedef double Scalar;

  const RCP<DefaultAddedLinearOp<Scalar> > M = defaultAddedLinearOp<Scalar>();

  TEST_ASSERT(is_null(M->range()));
  TEST_ASSERT(is_null(M->domain()));
  TEST_ASSERT(isFullyUninitialized(*M));
  TEST_ASSERT(!isPartiallyInitialized(*M));
  TEST_ASSERT(!isFullyInitialized(*M));

#  if defined(HAVE_GCC_ABI_DEMANGLE) && defined(HAVE_TEUCHOS_DEMANGLE)

  const std::string M_description = M->description();
  TEST_EQUALITY_CONST(M_description, "Thyra::DefaultAddedLinearOp<double>{numOps=0,rangeDim=0,domainDim=0}");

  {
    std::ostringstream describe_msg;
    describe_msg << "'";
    M->describe(*fancyOStream(rcpFromRef(describe_msg)), Teuchos::VERB_LOW);
    describe_msg << "'";

    std::ostringstream expected_msg;
    expected_msg
      << "' " << M_description << "\n'";

    TEST_EQUALITY_CONST( describe_msg.str(), expected_msg.str() );
  }


  {
    std::ostringstream describe_msg;
    describe_msg << "'";
    M->describe(*fancyOStream(rcpFromRef(describe_msg)), Teuchos::VERB_EXTREME);
    describe_msg << "'";

    std::ostringstream expected_msg;
    expected_msg
      << "' " << M_description << "\n"
      << "  Constituent LinearOpBase objects for M = Op[0]*...*Op[numOps-1]:\n'";

    TEST_EQUALITY_CONST( describe_msg.str(), expected_msg.str() );
  }

#  endif // defined(HAVE_GCC_ABI_DEMANGLE) && defined(HAVE_TEUCHOS_DEMANGLE)

}
开发者ID:agrippa,项目名称:Trilinos,代码行数:49,代码来源:DefaultAddedLinearOp_UnitTests.cpp

示例3:

void DefaultSerialDenseLinearOpWithSolveFactory<Scalar>::uninitializeOp(
    LinearOpWithSolveBase<Scalar> *Op,
    RCP<const LinearOpSourceBase<Scalar> > *fwdOpSrc,
    RCP<const PreconditionerBase<Scalar> > *prec,
    RCP<const LinearOpSourceBase<Scalar> > *approxFwdOpSrc,
    ESupportSolveUse *supportSolveUse
) const
{
    using Teuchos::dyn_cast;
    using Teuchos::is_null;
#ifdef TEUCHOS_DEBUG
    TEUCHOS_TEST_FOR_EXCEPT(0==Op);
#endif // TEUCHOS_DEBUG
    typedef DefaultSerialDenseLinearOpWithSolve<Scalar> DSDLOWS;
    DSDLOWS &dsdlows = dyn_cast<DSDLOWS>(*Op);
    if (fwdOpSrc) {
        // find a valid fwdOp
        const RCP<const LinearOpBase<Scalar> > fwdOp = dsdlows.getFwdOp();
        // pass out a valid fwsOpSrc
        if (!is_null(fwdOp)) {
            *fwdOpSrc = defaultLinearOpSource<Scalar>(fwdOp);
        } else {
            *fwdOpSrc = Teuchos::null;
        }
    }
    if (prec) *prec = Teuchos::null;
    if (approxFwdOpSrc) *approxFwdOpSrc = Teuchos::null;
}
开发者ID:00liujj,项目名称:trilinos,代码行数:28,代码来源:Thyra_DefaultSerialDenseLinearOpWithSolveFactory_def.hpp

示例4: sinCosModel

TEUCHOS_UNIT_TEST( Rythmos_ExplicitRKStepper, clone ) {
  RCP<SinCosModel> model = sinCosModel(false);
  RCP<RKButcherTableauBase<double> > rkbt = createRKBT<double>("Explicit 4 Stage");
  RCP<ExplicitRKStepper<double> > stepper = explicitRKStepper<double>(model,rkbt);
  TEST_ASSERT( !is_null(stepper) );
  TEST_ASSERT( stepper->supportsCloning() );
  RCP<StepperBase<double> > otherStepper = stepper->cloneStepperAlgorithm();
  TEST_ASSERT( !is_null(otherStepper) );
  TEST_ASSERT( otherStepper.ptr() != stepper.ptr() );
  {
    RCP<ExplicitRKStepper<double> > erkStepper = Teuchos::rcp_dynamic_cast<ExplicitRKStepper<double> >(otherStepper,false);
    TEST_ASSERT( !is_null(erkStepper) );
    RCP<const RKButcherTableauBase<double> > rkbt_out = erkStepper->getRKButcherTableau();
    TEST_ASSERT( rkbt.ptr() == rkbt_out.ptr() );
  }

}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例5: globalToGhostContainer

void 
TpetraLinearObjFactory<Traits,ScalarT,LocalOrdinalT,GlobalOrdinalT,NodeT>::
globalToGhostContainer(const LinearObjContainer & in,
                       LinearObjContainer & out,int mem) const
{
   using Teuchos::is_null;
   typedef LinearObjContainer LOC;

   const ContainerType & t_in = Teuchos::dyn_cast<const ContainerType>(in); 
   ContainerType & t_out = Teuchos::dyn_cast<ContainerType>(out); 
  
   // Operations occur if the GLOBAL container has the correct targets!
   // Users set the GLOBAL continer arguments
   if ( !is_null(t_in.get_x()) && !is_null(t_out.get_x()) && ((mem & LOC::X)==LOC::X))
     globalToGhostTpetraVector(*t_in.get_x(),*t_out.get_x());
  
   if ( !is_null(t_in.get_dxdt()) && !is_null(t_out.get_dxdt()) && ((mem & LOC::DxDt)==LOC::DxDt))
     globalToGhostTpetraVector(*t_in.get_dxdt(),*t_out.get_dxdt());

   if ( !is_null(t_in.get_f()) && !is_null(t_out.get_f()) && ((mem & LOC::F)==LOC::F))
      globalToGhostTpetraVector(*t_in.get_f(),*t_out.get_f());
}
开发者ID:rainiscold,项目名称:trilinos,代码行数:22,代码来源:Panzer_TpetraLinearObjFactory_impl.hpp


注:本文中的Teuchos::is_null方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。