本文整理汇总了C++中tpetra::MultiVector::doExport方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiVector::doExport方法的具体用法?C++ MultiVector::doExport怎么用?C++ MultiVector::doExport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tpetra::MultiVector
的用法示例。
在下文中一共展示了MultiVector::doExport方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
OverlappingRowMatrix<MatrixType>::
exportMultiVector (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &OvX,
Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
Tpetra::CombineMode CM)
{
X.doExport (OvX, *Importer_, CM);
}
示例2: X_tmp
void IdentitySolver<MatrixType>::
apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
Teuchos::ETransp /*mode*/,
scalar_type alpha,
scalar_type beta) const
{
using Teuchos::RCP;
typedef Teuchos::ScalarTraits<scalar_type> STS;
typedef Tpetra::MultiVector<scalar_type, local_ordinal_type,
global_ordinal_type, node_type> MV;
TEUCHOS_TEST_FOR_EXCEPTION(
! isComputed (), std::runtime_error,
"Ifpack2::IdentitySolver::apply: If compute() has not yet been called, "
"or if you have changed the matrix via setMatrix(), "
"you must call compute() before you may call this method.");
// "Identity solver" does what it says: it's the identity operator.
// We have to Export if the domain and range Maps are not the same.
// Otherwise, this operator would be a permutation, not the identity.
if (export_.is_null ()) {
Y.update (alpha, X, beta);
}
else {
if (alpha == STS::one () && beta == STS::zero ()) { // the common case
Y.doExport (X, *export_, Tpetra::REPLACE);
}
else {
// We know that the domain and range Maps are compatible. First
// bring X into the range Map via Export. Then compute in place
// in Y.
MV X_tmp (Y.getMap (), Y.getNumVectors ());
X_tmp.doExport (X, *export_, Tpetra::REPLACE);
Y.update (alpha, X_tmp, beta);
}
}
++numApply_;
}
示例3: isComputed
void LocalSparseTriangularSolver<MatrixType>::
apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type,
global_ordinal_type, node_type>& X,
Tpetra::MultiVector<scalar_type, local_ordinal_type,
global_ordinal_type, node_type>& Y,
Teuchos::ETransp mode,
scalar_type alpha,
scalar_type beta) const
{
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::rcpFromRef;
typedef scalar_type ST;
typedef Teuchos::ScalarTraits<ST> STS;
const char prefix[] = "Ifpack2::LocalSparseTriangularSolver::apply: ";
if (! out_.is_null ()) {
*out_ << ">>> DEBUG " << prefix;
if (A_crs_.is_null ()) {
*out_ << "A_crs_ is null!" << std::endl;
}
else {
const std::string uplo = A_crs_->isUpperTriangular () ? "U" :
(A_crs_->isLowerTriangular () ? "L" : "N");
const std::string trans = (mode == Teuchos::CONJ_TRANS) ? "C" :
(mode == Teuchos::TRANS ? "T" : "N");
const std::string diag =
(A_crs_->getNodeNumDiags () < A_crs_->getNodeNumRows ()) ? "U" : "N";
*out_ << "uplo=\"" << uplo
<< "\", trans=\"" << trans
<< "\", diag=\"" << diag << "\"" << std::endl;
}
}
TEUCHOS_TEST_FOR_EXCEPTION
(! isComputed (), std::runtime_error, prefix << "If compute() has not yet "
"been called, or if you have changed the matrix via setMatrix(), you must "
"call compute() before you may call this method.");
// If isComputed() is true, it's impossible for the matrix to be
// null, or for it not to be a Tpetra::CrsMatrix.
TEUCHOS_TEST_FOR_EXCEPTION
(A_.is_null (), std::logic_error, prefix << "A_ is null. "
"Please report this bug to the Ifpack2 developers.");
TEUCHOS_TEST_FOR_EXCEPTION
(A_crs_.is_null (), std::logic_error, prefix << "A_crs_ is null. "
"Please report this bug to the Ifpack2 developers.");
// However, it _is_ possible that the user called resumeFill() on
// the matrix, after calling compute(). This is NOT allowed.
TEUCHOS_TEST_FOR_EXCEPTION
(! A_crs_->isFillComplete (), std::runtime_error, "If you call this "
"method, the matrix must be fill complete. It is not. This means that "
" you must have called resumeFill() on the matrix before calling apply(). "
"This is NOT allowed. Note that this class may use the matrix's data in "
"place without copying it. Thus, you cannot change the matrix and expect "
"the solver to stay the same. If you have changed the matrix, first call "
"fillComplete() on it, then call compute() on this object, before you call"
" apply(). You do NOT need to call setMatrix, as long as the matrix "
"itself (that is, its address in memory) is the same.");
auto G = A_->getGraph ();
TEUCHOS_TEST_FOR_EXCEPTION
(G.is_null (), std::logic_error, prefix << "A_ and A_crs_ are nonnull, "
"but A_'s RowGraph G is null. "
"Please report this bug to the Ifpack2 developers.");
auto importer = G->getImporter ();
auto exporter = G->getExporter ();
if (! importer.is_null ()) {
if (X_colMap_.is_null () || X_colMap_->getNumVectors () != X.getNumVectors ()) {
X_colMap_ = rcp (new MV (importer->getTargetMap (), X.getNumVectors ()));
}
else {
X_colMap_->putScalar (STS::zero ());
}
// See discussion of Github Issue #672 for why the Import needs to
// use the ZERO CombineMode. The case where the Export is
// nontrivial is likely never exercised.
X_colMap_->doImport (X, *importer, Tpetra::ZERO);
}
RCP<const MV> X_cur = importer.is_null () ? rcpFromRef (X) :
Teuchos::rcp_const_cast<const MV> (X_colMap_);
if (! exporter.is_null ()) {
if (Y_rowMap_.is_null () || Y_rowMap_->getNumVectors () != Y.getNumVectors ()) {
Y_rowMap_ = rcp (new MV (exporter->getSourceMap (), Y.getNumVectors ()));
}
else {
Y_rowMap_->putScalar (STS::zero ());
}
Y_rowMap_->doExport (Y, *importer, Tpetra::ADD);
}
RCP<MV> Y_cur = exporter.is_null () ? rcpFromRef (Y) : Y_rowMap_;
localApply (*X_cur, *Y_cur, mode, alpha, beta);
if (! exporter.is_null ()) {
Y.putScalar (STS::zero ());
Y.doExport (*Y_cur, *exporter, Tpetra::ADD);
}
++numApply_;
//.........这里部分代码省略.........