本文整理汇总了C++中Teuchos::typeName方法的典型用法代码示例。如果您正苦于以下问题:C++ Teuchos::typeName方法的具体用法?C++ Teuchos::typeName怎么用?C++ Teuchos::typeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Teuchos
的用法示例。
在下文中一共展示了Teuchos::typeName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: describe
void AmesosLinearOpWithSolve::describe(
Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel
) const
{
using Teuchos::OSTab;
using Teuchos::typeName;
using Teuchos::describe;
switch(verbLevel) {
case Teuchos::VERB_DEFAULT:
case Teuchos::VERB_LOW:
out << this->description() << std::endl;
break;
case Teuchos::VERB_MEDIUM:
case Teuchos::VERB_HIGH:
case Teuchos::VERB_EXTREME:
{
out
<< Teuchos::Describable::description() << "{"
<< "rangeDim=" << this->range()->dim()
<< ",domainDim="<< this->domain()->dim() << "}\n";
OSTab tab(out);
if(!is_null(fwdOp_)) {
out << "fwdOp = " << describe(*fwdOp_,verbLevel);
}
if(!is_null(amesosSolver_)) {
out << "amesosSolver=" << typeName(*amesosSolver_) << "\n";
}
break;
}
default:
TEST_FOR_EXCEPT(true); // Should never get here!
}
}
示例2: description
std::string AmesosLinearOpWithSolve::description() const
{
std::ostringstream oss;
oss << Teuchos::Describable::description();
if(!is_null(amesosSolver_)) {
oss
<< "{fwdOp="<<fwdOp_->description()
<< ",amesosSolver="<<typeName(*amesosSolver_)<<"}";
}
return oss.str();
}
示例3: describe
void AztecOOLinearOpWithSolve::describe(
Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel
) const
{
using Teuchos::OSTab;
using Teuchos::typeName;
using Teuchos::describe;
switch(verbLevel) {
case Teuchos::VERB_DEFAULT:
case Teuchos::VERB_LOW:
out << this->description() << std::endl;
break;
case Teuchos::VERB_MEDIUM:
case Teuchos::VERB_HIGH:
case Teuchos::VERB_EXTREME:
{
out
<< Teuchos::Describable::description() << "{"
<< "rangeDim=" << this->range()->dim()
<< ",domainDim="<< this->domain()->dim() << "}\n";
OSTab tab(out);
if (!is_null(fwdOp_)) {
out << "fwdOp = " << describe(*fwdOp_,verbLevel);
}
if (!is_null(prec_)) {
out << "prec = " << describe(*prec_,verbLevel);
}
if (!is_null(aztecFwdSolver_)) {
if (aztecFwdSolver_->GetUserOperator())
out
<< "Aztec Fwd Op = "
<< typeName(*aztecFwdSolver_->GetUserOperator()) << "\n";
if (aztecFwdSolver_->GetUserMatrix())
out
<< "Aztec Fwd Mat = "
<< typeName(*aztecFwdSolver_->GetUserMatrix()) << "\n";
if (aztecFwdSolver_->GetPrecOperator())
out
<< "Aztec Fwd Prec Op = "
<< typeName(*aztecFwdSolver_->GetPrecOperator()) << "\n";
if (aztecFwdSolver_->GetPrecMatrix())
out
<< "Aztec Fwd Prec Mat = "
<< typeName(*aztecFwdSolver_->GetPrecMatrix()) << "\n";
}
if (!is_null(aztecAdjSolver_)) {
if (aztecAdjSolver_->GetUserOperator())
out
<< "Aztec Adj Op = "
<< typeName(*aztecAdjSolver_->GetUserOperator()) << "\n";
if (aztecAdjSolver_->GetUserMatrix())
out
<< "Aztec Adj Mat = "
<< typeName(*aztecAdjSolver_->GetUserMatrix()) << "\n";
if (aztecAdjSolver_->GetPrecOperator())
out
<< "Aztec Adj Prec Op = "
<< typeName(*aztecAdjSolver_->GetPrecOperator()) << "\n";
if (aztecAdjSolver_->GetPrecMatrix())
out
<< "Aztec Adj Prec Mat = "
<< typeName(*aztecAdjSolver_->GetPrecMatrix()) << "\n";
}
break;
}
default:
TEUCHOS_TEST_FOR_EXCEPT(true); // Should never get here!
}
}
示例4: totalTimer
SolveStatus<double>
AmesosLinearOpWithSolve::solveImpl(
const EOpTransp M_trans,
const MultiVectorBase<double> &B,
const Ptr<MultiVectorBase<double> > &X,
const Ptr<const SolveCriteria<double> > solveCriteria
) const
{
using Teuchos::rcpFromPtr;
using Teuchos::rcpFromRef;
using Teuchos::OSTab;
Teuchos::Time totalTimer("");
totalTimer.start(true);
TEUCHOS_FUNC_TIME_MONITOR("AmesosLOWS");
Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
Teuchos::EVerbosityLevel verbLevel = this->getVerbLevel();
OSTab tab = this->getOSTab();
if(out.get() && static_cast<int>(verbLevel) > static_cast<int>(Teuchos::VERB_NONE))
*out << "\nSolving block system using Amesos solver "
<< typeName(*amesosSolver_) << " ...\n\n";
//
// Get the op(...) range and domain maps
//
const EOpTransp amesosOpTransp = real_trans(trans_trans(amesosSolverTransp_,M_trans));
const Epetra_Operator *amesosOp = epetraLP_->GetOperator();
const Epetra_Map
&opRangeMap = ( amesosOpTransp == NOTRANS
? amesosOp->OperatorRangeMap() : amesosOp->OperatorDomainMap() ),
&opDomainMap = ( amesosOpTransp == NOTRANS
? amesosOp->OperatorDomainMap() : amesosOp->OperatorRangeMap() );
//
// Get Epetra_MultiVector views of B and X
//
Teuchos::RCP<const Epetra_MultiVector>
epetra_B = get_Epetra_MultiVector(opRangeMap, rcpFromRef(B));
Teuchos::RCP<Epetra_MultiVector>
epetra_X = get_Epetra_MultiVector(opDomainMap, rcpFromPtr(X));
//
// Set B and X in the linear problem
//
epetraLP_->SetLHS(&*epetra_X);
epetraLP_->SetRHS(const_cast<Epetra_MultiVector*>(&*epetra_B));
// Above should be okay but cross your fingers!
//
// Solve the linear system
//
const bool oldUseTranspose = amesosSolver_->UseTranspose();
amesosSolver_->SetUseTranspose(amesosOpTransp==TRANS);
const int err = amesosSolver_->Solve();
TEST_FOR_EXCEPTION( 0!=err, CatastrophicSolveFailure,
"Error, the function Solve() on the amesos solver of type\n"
"\'"<<typeName(*amesosSolver_)<<"\' failed with error code "<<err<<"!"
);
amesosSolver_->SetUseTranspose(oldUseTranspose);
//
// Unset B and X
//
epetraLP_->SetLHS(NULL);
epetraLP_->SetRHS(NULL);
epetra_X = Teuchos::null;
epetra_B = Teuchos::null;
//
// Scale X if needed
//
if(amesosSolverScalar_!=1.0)
Thyra::scale(1.0/amesosSolverScalar_, X);
//
// Set the solve status if requested
//
SolveStatus<double> solveStatus;
solveStatus.solveStatus = SOLVE_STATUS_CONVERGED;
solveStatus.achievedTol = SolveStatus<double>::unknownTolerance();
solveStatus.message =
std::string("Solver ")+typeName(*amesosSolver_)+std::string(" converged!");
//
// Report the overall time
//
if(out.get() && static_cast<int>(verbLevel) >= static_cast<int>(Teuchos::VERB_LOW))
*out
<< "\nTotal solve time = "<<totalTimer.totalElapsedTime()<<" sec\n";
return solveStatus;
}