47 const ParameterList& pL = GetParameterList();
48 const size_t row = Teuchos::as<size_t>(pL.get<
int>(
"block row"));
49 const size_t col = Teuchos::as<size_t>(pL.get<
int>(
"block col"));
52 RCP<Matrix> Ain = currentLevel.
Get<RCP<Matrix>>(
"A", this->GetFactory(
"A").get());
53 RCP<BlockedCrsMatrix> A = rcp_dynamic_cast<BlockedCrsMatrix>(Ain);
56 TEUCHOS_TEST_FOR_EXCEPTION(A.is_null(),
Exceptions::BadCast,
"Input matrix A is not a BlockedCrsMatrix.");
57 TEUCHOS_TEST_FOR_EXCEPTION(row > A->Rows(),
Exceptions::RuntimeError,
"row [" << row <<
"] > A.Rows() [" << A->Rows() <<
"].");
58 TEUCHOS_TEST_FOR_EXCEPTION(col > A->Cols(),
Exceptions::RuntimeError,
"col [" << col <<
"] > A.Cols() [" << A->Cols() <<
"].");
61 RCP<const StridedMap> stridedRangeMap = Teuchos::null;
62 RCP<const StridedMap> stridedDomainMap = Teuchos::null;
65 RCP<const MapExtractor> rangeMapExtractor = A->getRangeMapExtractor();
66 RCP<const MapExtractor> domainMapExtractor = A->getDomainMapExtractor();
71 if (stridedRangeMap.is_null()) {
73 "Range map extractor contains non-strided maps in block row " << row <<
". This should not be.");
74 stridedRangeMap = rcp_dynamic_cast<const StridedMap>(rangeMapExtractor->getMap(row));
77 if (stridedDomainMap.is_null()) {
79 "Domain map extractor contains non-strided maps in block row " << row <<
". This should not be.");
80 stridedDomainMap = rcp_dynamic_cast<const StridedMap>(domainMapExtractor->getMap(col));
83 TEUCHOS_TEST_FOR_EXCEPTION(stridedRangeMap.is_null(),
Exceptions::BadCast,
"rangeMap " << row <<
" is not a strided map.");
84 TEUCHOS_TEST_FOR_EXCEPTION(stridedDomainMap.is_null(),
Exceptions::BadCast,
"domainMap " << col <<
" is not a strided map.");
86 RCP<Matrix> Op = MatrixFactory::Build(stridedRangeMap, stridedDomainMap,
static_cast<size_t>(0));
87 TEUCHOS_ASSERT(!Op.is_null());
89 Op->fillComplete(stridedDomainMap, stridedRangeMap);
90 TEUCHOS_ASSERT(Op->isFillComplete());
92 GetOStream(
Statistics1) <<
"A(" << row <<
"," << col <<
") is a single block and has strided maps:"
93 <<
"\n range map fixed block size = " << stridedRangeMap->getFixedBlockSize() <<
", strided block id = " << stridedRangeMap->getStridedBlockId()
94 <<
"\n domain map fixed block size = " << stridedDomainMap->getFixedBlockSize() <<
", strided block id = " << stridedDomainMap->getStridedBlockId() << std::endl;
95 GetOStream(
Statistics2) <<
"A(" << row <<
"," << col <<
") has " << Op->getGlobalNumRows() <<
"x" << Op->getGlobalNumCols() <<
" rows and columns." << std::endl;
97 if (Op->IsView(
"stridedMaps") ==
true)
98 Op->RemoveView(
"stridedMaps");
99 Op->CreateView(
"stridedMaps", stridedRangeMap, stridedDomainMap);
101 currentLevel.
Set(
"A", Op,
this);
T & Get(const std::string &ename, const FactoryBase *factory=NoFactory::get())
Get data without decrementing associated storage counter (i.e., read-only access)....