49 #ifdef HAVE_XPETRA_THYRA
58 #ifdef HAVE_XPETRA_EPETRA
60 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
63 Teuchos::RCP<Thyra::LinearOpBase<double> >
66 int nRows = mat->Rows();
67 int nCols = mat->Cols();
69 Teuchos::RCP<Xpetra::Matrix<double, int, int, EpetraNode> > Ablock = mat->getInnermostCrsMatrix();
71 TEUCHOS_TEST_FOR_EXCEPT(Ablock_wrap.is_null() ==
true);
75 #ifdef HAVE_XPETRA_TPETRA
77 #if ((defined(EPETRA_HAVE_OMP) && defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_INT) && defined(HAVE_TPETRA_INST_DOUBLE)) || \
78 (!defined(EPETRA_HAVE_OMP) && defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_INT) && defined(HAVE_TPETRA_INST_DOUBLE)))
80 if(tpetraMat!=Teuchos::null) bTpetra =
true;
86 #ifdef HAVE_XPETRA_EPETRA
88 if(epetraMat!=Teuchos::null) bEpetra =
true;
91 TEUCHOS_TEST_FOR_EXCEPT(bTpetra == bEpetra);
94 Teuchos::RCP<Thyra::PhysicallyBlockedLinearOpBase<Scalar> > blockMat =
95 Thyra::defaultBlockedLinearOp<Scalar>();
97 blockMat->beginBlockFill(nRows,nCols);
99 for (
int r=0; r<nRows; ++r) {
100 for (
int c=0; c<nCols; ++c) {
101 Teuchos::RCP<Matrix> xpmat = mat->getMatrix(r,c);
103 if(xpmat == Teuchos::null)
continue;
105 Teuchos::RCP<Thyra::LinearOpBase<Scalar> > thBlock = Teuchos::null;
108 Teuchos::RCP<BlockedCrsMatrix> xpblock = Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(xpmat);
109 if(xpblock != Teuchos::null) {
110 if(xpblock->Rows() == 1 && xpblock->Cols() == 1) {
112 Teuchos::RCP<CrsMatrixWrap> xpwrap = Teuchos::rcp_dynamic_cast<CrsMatrixWrap>(xpblock->getCrsMatrix());
113 TEUCHOS_TEST_FOR_EXCEPT(xpwrap.is_null() ==
true);
114 thBlock = Xpetra::ThyraUtils<Scalar,LocalOrdinal,GlobalOrdinal,Node>::toThyra(xpwrap->getCrsMatrix());
117 thBlock = Xpetra::ThyraUtils<Scalar,LocalOrdinal,GlobalOrdinal,Node>::toThyra(xpblock);
121 Teuchos::RCP<CrsMatrixWrap> xpwrap = Teuchos::rcp_dynamic_cast<CrsMatrixWrap>(xpmat);
122 TEUCHOS_TEST_FOR_EXCEPT(xpwrap.is_null() ==
true);
123 thBlock = Xpetra::ThyraUtils<Scalar,LocalOrdinal,GlobalOrdinal,Node>::toThyra(xpwrap->getCrsMatrix());
126 blockMat->setBlock(r,c,thBlock);
130 blockMat->endBlockFill();
134 # endif //#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
136 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
139 Teuchos::RCP<Thyra::LinearOpBase<double> >
142 int nRows = mat->Rows();
143 int nCols = mat->Cols();
145 Teuchos::RCP<Xpetra::Matrix<double, int, long long, EpetraNode> > Ablock = mat->getInnermostCrsMatrix();
147 TEUCHOS_TEST_FOR_EXCEPT(Ablock_wrap.is_null() ==
true);
149 bool bTpetra =
false;
150 bool bEpetra =
false;
151 #ifdef HAVE_XPETRA_TPETRA
153 #if ((defined(EPETRA_HAVE_OMP) && defined(HAVE_TPETRA_INST_OPENMP) && defined(HAVE_TPETRA_INST_INT_LONG_LONG) && defined(HAVE_TPETRA_INST_DOUBLE)) || \
154 (!defined(EPETRA_HAVE_OMP) && defined(HAVE_TPETRA_INST_SERIAL) && defined(HAVE_TPETRA_INST_INT_LONG_LONG) && defined(HAVE_TPETRA_INST_DOUBLE)))
156 if(tpetraMat!=Teuchos::null) bTpetra =
true;
162 #ifdef HAVE_XPETRA_EPETRA
164 if(epetraMat!=Teuchos::null) bEpetra =
true;
167 TEUCHOS_TEST_FOR_EXCEPT(bTpetra == bEpetra);
170 Teuchos::RCP<Thyra::PhysicallyBlockedLinearOpBase<Scalar> > blockMat =
171 Thyra::defaultBlockedLinearOp<Scalar>();
173 blockMat->beginBlockFill(nRows,nCols);
175 for (
int r=0; r<nRows; ++r) {
176 for (
int c=0; c<nCols; ++c) {
177 Teuchos::RCP<Matrix> xpmat = mat->getMatrix(r,c);
179 if(xpmat == Teuchos::null)
continue;
181 Teuchos::RCP<Thyra::LinearOpBase<Scalar> > thBlock = Teuchos::null;
184 Teuchos::RCP<BlockedCrsMatrix> xpblock = Teuchos::rcp_dynamic_cast<BlockedCrsMatrix>(xpmat);
185 if(xpblock != Teuchos::null) {
186 if(xpblock->Rows() == 1 && xpblock->Cols() == 1) {
188 Teuchos::RCP<CrsMatrixWrap> xpwrap = Teuchos::rcp_dynamic_cast<CrsMatrixWrap>(xpblock->getCrsMatrix());
189 TEUCHOS_TEST_FOR_EXCEPT(xpwrap.is_null() ==
true);
190 thBlock = Xpetra::ThyraUtils<Scalar,LocalOrdinal,GlobalOrdinal,Node>::toThyra(xpwrap->getCrsMatrix());
193 thBlock = Xpetra::ThyraUtils<Scalar,LocalOrdinal,GlobalOrdinal,Node>::toThyra(xpblock);
197 Teuchos::RCP<CrsMatrixWrap> xpwrap = Teuchos::rcp_dynamic_cast<CrsMatrixWrap>(xpmat);
198 TEUCHOS_TEST_FOR_EXCEPT(xpwrap.is_null() ==
true);
199 thBlock = Xpetra::ThyraUtils<Scalar,LocalOrdinal,GlobalOrdinal,Node>::toThyra(xpwrap->getCrsMatrix());
202 blockMat->setBlock(r,c,thBlock);
206 blockMat->endBlockFill();
210 #endif // #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
216 #endif // HAVE_XPETRA_THYRA
Concrete implementation of Xpetra::Matrix.