Skip to content

Commit

Permalink
Xpetra: add additional optional parameters to skip initialization of …
Browse files Browse the repository at this point in the history
…subvectors
  • Loading branch information
tawiesn committed Oct 19, 2016
1 parent 87fedbd commit 94d8da4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions packages/xpetra/sup/BlockedCrsMatrix/Xpetra_MapExtractor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,15 @@ namespace Xpetra {

//@}

RCP< Vector> getVector(size_t i, bool bThyraMode = false) const {
RCP< Vector> getVector(size_t i, bool bThyraMode = false, bool bZero = true) const {
XPETRA_TEST_FOR_EXCEPTION(bThyraMode_ == false && bThyraMode == true, Xpetra::Exceptions::RuntimeError,
"MapExtractor::getVector: getVector in Thyra-style numbering only possible if MapExtractor has been created using Thyra-style numbered submaps.");
return VectorFactory::Build(getMap(i, bThyraMode), true);
return VectorFactory::Build(getMap(i, bThyraMode), bZero);
}
RCP<MultiVector> getVector(size_t i, size_t numvec, bool bThyraMode = false) const {
RCP<MultiVector> getVector(size_t i, size_t numvec, bool bThyraMode = false, bool bZero = true) const {
XPETRA_TEST_FOR_EXCEPTION(bThyraMode_ == false && bThyraMode == true, Xpetra::Exceptions::RuntimeError,
"MapExtractor::getVector: getVector in Thyra-style numbering only possible if MapExtractor has been created using Thyra-style numbered submaps.");
return MultiVectorFactory::Build(getMap(i, bThyraMode), numvec, true);
return MultiVectorFactory::Build(getMap(i, bThyraMode), numvec, bZero);
}

/// returns true, if sub maps are stored in Thyra-style numbering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,11 @@ TEUCHOS_UNIT_TEST_TEMPLATE_6_DECL( BlockedMultiVector, InsertVector, M, MA, Scal

#ifdef HAVE_XPETRA_DEBUG
// create malicious multivector
Teuchos::RCP<MultiVector> part1 = me->getVector(0,23,false);
Teuchos::RCP<MultiVector> part1 = me->getVector(0,23,false,true);
TEST_THROW(me->InsertVector(part1,0,bvv),Xpetra::Exceptions::RuntimeError);
Teuchos::RCP<MultiVector> part2 = me->getVector(0,2,false);
Teuchos::RCP<MultiVector> part2 = me->getVector(0,2,false,true);
TEST_THROW(me->InsertVector(part2,1,bvv),Xpetra::Exceptions::RuntimeError);
TEST_THROW(Teuchos::RCP<MultiVector> part3 = me->getVector(1,2,true),Xpetra::Exceptions::RuntimeError);
TEST_THROW(Teuchos::RCP<MultiVector> part3 = me->getVector(1,2,true,true),Xpetra::Exceptions::RuntimeError);
#endif
}

Expand Down Expand Up @@ -659,14 +659,14 @@ TEUCHOS_UNIT_TEST_TEMPLATE_6_DECL( BlockedMultiVector, InsertVectorThyra, M, MA,

#ifdef HAVE_XPETRA_DEBUG
// create malicious multivector
Teuchos::RCP<MultiVector> part1 = me->getVector(0,23,true);
Teuchos::RCP<MultiVector> part1 = me->getVector(0,23,true,true);
TEST_THROW(me->InsertVector(part1,0,bvv),Xpetra::Exceptions::RuntimeError);
// unfortunately, in Thyra mode there is no error thrown since the vectors in
// block 0 and 1 have the same length (and the same GIDs)
Teuchos::RCP<MultiVector> part2 = me->getVector(0,2,true);
Teuchos::RCP<MultiVector> part2 = me->getVector(0,2,true,true);
TEST_NOTHROW(me->InsertVector(part2,1,bvv,me->getThyraMode()));
// This should throw, thought
Teuchos::RCP<MultiVector> part3 = me->getVector(0,2,true);
Teuchos::RCP<MultiVector> part3 = me->getVector(0,2,true,true);
TEST_THROW(me->InsertVector(part2,2,bvv,me->getThyraMode()),Xpetra::Exceptions::RuntimeError);
#endif
}
Expand Down

0 comments on commit 94d8da4

Please sign in to comment.