46 #ifndef XPETRA_REORDEREDBLOCKEDCRSMATRIX_HPP
47 #define XPETRA_REORDEREDBLOCKEDCRSMATRIX_HPP
69 template <
class Scalar,
82 #undef XPETRA_REORDEREDBLOCKEDCRSMATRIX_SHORT
132 map = fullRangeMapExtractor->getMap(Teuchos::as<size_t>(leaf->
GetIndex()),
false);
135 std::vector<Teuchos::RCP<const Map> > subMaps (numBlocks, Teuchos::null);
137 for(
size_t i = 0; i < numBlocks; i++) {
178 bool bCopyResultX =
false;
179 bool bCopyResultY =
false;
240 if (bCopyResultX ==
true) {
245 if (bCopyResultY ==
true) {
268 std::string
description()
const {
return "ReorderedBlockedCrsMatrix"; }
277 out <<
"ReorderedBlockMatrix is fillComplete" << std::endl;
279 out <<
"fullRowMap" << std::endl;
286 out <<
"Xpetra::ReorderedBlockedCrsMatrix is NOT fillComplete" << std::endl;
291 out <<
"Block(" << r <<
"," << c <<
")" << std::endl;
305 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
321 map = fullRangeMapExtractor->getMap(Teuchos::as<size_t>(leaf->
GetIndex()), bThyraMode);
324 std::vector<Teuchos::RCP<const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > > subMaps (numBlocks, Teuchos::null);
326 for(
size_t i = 0; i < numBlocks; i++) {
351 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
367 if(rowSz == 0 && colSz == 0) {
375 if (mat == Teuchos::null)
return Teuchos::null;
379 if(matwrap != Teuchos::null) {
384 std::vector<Teuchos::RCP<const Map> > rowSubMaps (1, submap);
389 std::vector<Teuchos::RCP<const Map> > colSubMaps (1, submap2);
396 rbmat = Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(mat);
405 std::vector<Teuchos::RCP<const Map> > rowSubMaps (rowSz, Teuchos::null);
406 for(
size_t i = 0; i < rowSz; i++) {
419 std::vector<Teuchos::RCP<const Map> > rowSubMaps (1, submap);
425 std::vector<Teuchos::RCP<const Map> > colSubMaps (colSz, Teuchos::null);
426 for(
size_t j = 0; j < colSz; j++) {
439 std::vector<Teuchos::RCP<const Map> > colSubMaps (1, submap);
447 if (rowSz == 0 && colSz > 0) {
448 for(
size_t j = 0; j < colSz; j++) {
451 rbmat->
setMatrix(0,j,Teuchos::rcp_const_cast<Matrix>(submat));
454 }
else if (rowSz > 0 && colSz == 0) {
455 for(
size_t i = 0; i < rowSz; i++) {
458 rbmat->
setMatrix(i,0,Teuchos::rcp_const_cast<Matrix>(submat));
462 for(
size_t i = 0; i < rowSz; i++) {
464 for(
size_t j = 0; j < colSz; j++) {
467 rbmat->
setMatrix(i,j,Teuchos::rcp_const_cast<Matrix>(submat));
480 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
489 TEUCHOS_ASSERT(bmat->getRangeMapExtractor()->getThyraMode() ==
true);
490 TEUCHOS_ASSERT(bmat->getDomainMapExtractor()->getThyraMode() ==
true);
498 if(rowSz == 0 && colSz == 0) {
506 if(mat == Teuchos::null)
return Teuchos::null;
510 if(matwrap != Teuchos::null) {
517 std::vector<Teuchos::RCP<const Map> > rowXpSubMaps (1, xpsubmap);
518 std::vector<Teuchos::RCP<const Map> > rowTySubMaps (1, thysubmap);
526 std::vector<Teuchos::RCP<const Map> > colXpSubMaps (1, xpsubmap2);
527 std::vector<Teuchos::RCP<const Map> > colTySubMaps (1, tysubmap2);
537 rbmat = Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(mat);
546 std::vector<Teuchos::RCP<const Map> > rowXpSubMaps (rowSz, Teuchos::null);
547 std::vector<Teuchos::RCP<const Map> > rowTySubMaps (rowSz, Teuchos::null);
548 for(
size_t i = 0; i < rowSz; i++) {
564 std::vector<Teuchos::RCP<const Map> > rowXpSubMaps (1, xpsubmap);
565 std::vector<Teuchos::RCP<const Map> > rowTySubMaps (1, thysubmap);
572 std::vector<Teuchos::RCP<const Map> > colXpSubMaps (colSz, Teuchos::null);
573 std::vector<Teuchos::RCP<const Map> > colTySubMaps (colSz, Teuchos::null);
574 for(
size_t j = 0; j < colSz; j++) {
590 std::vector<Teuchos::RCP<const Map> > colXpSubMaps (1, xpsubmap);
591 std::vector<Teuchos::RCP<const Map> > colTySubMaps (1, tysubmap);
601 if (rowSz == 0 && colSz > 0) {
602 for(
size_t j = 0; j < colSz; j++) {
605 rbmat->
setMatrix(0,j,Teuchos::rcp_const_cast<Matrix>(submat));
608 }
else if (rowSz > 0 && colSz == 0) {
609 for(
size_t i = 0; i < rowSz; i++) {
612 rbmat->
setMatrix(i,0,Teuchos::rcp_const_cast<Matrix>(submat));
616 for(
size_t i = 0; i < rowSz; i++) {
618 for(
size_t j = 0; j < colSz; j++) {
621 rbmat->
setMatrix(i,j,Teuchos::rcp_const_cast<Matrix>(submat));
633 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
635 TEUCHOS_ASSERT(bmat->getRangeMapExtractor()->getThyraMode() == bmat->getDomainMapExtractor()->getThyraMode());
637 if(bmat->getRangeMapExtractor()->getThyraMode() ==
false) {
649 #define XPETRA_REORDEREDBLOCKEDCRSMATRIX_SHORT