-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge Pull Request #13333 from trilinos/Trilinos/xpetra-fix-missing-s…
…ymbols Automatically Merged using Trilinos Pull Request AutoTester PR Title: b'Xpetra: fix missing symbols' PR Author: jhux2
- Loading branch information
Showing
14 changed files
with
243 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
packages/xpetra/src/Matrix/Xpetra_MatrixFactory2_decl.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
// @HEADER | ||
// ***************************************************************************** | ||
// Xpetra: A linear algebra interface package | ||
// | ||
// Copyright 2012 NTESS and the Xpetra contributors. | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// ***************************************************************************** | ||
// @HEADER | ||
|
||
// WARNING: This code is experimental. Backwards compatibility should not be expected. | ||
|
||
#ifndef XPETRA_MATRIXFACTORY2_DECL_HPP | ||
#define XPETRA_MATRIXFACTORY2_DECL_HPP | ||
|
||
#include "Xpetra_ConfigDefs.hpp" | ||
#include "Xpetra_MapExtractor_fwd.hpp" | ||
#include "Xpetra_Matrix.hpp" | ||
#include "Xpetra_CrsMatrixWrap.hpp" | ||
#include "Xpetra_BlockedCrsMatrix_fwd.hpp" | ||
#include "Xpetra_Map.hpp" | ||
#include "Xpetra_BlockedMap.hpp" | ||
#include "Xpetra_Vector.hpp" | ||
#include "Xpetra_BlockedVector.hpp" | ||
#include "Xpetra_Exceptions.hpp" | ||
|
||
namespace Xpetra { | ||
|
||
template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType> | ||
class MatrixFactory2 { | ||
#undef XPETRA_MATRIXFACTORY2_SHORT | ||
#include "Xpetra_UseShortNames.hpp" | ||
|
||
public: | ||
static RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > BuildCopy(const RCP<const Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > A, bool setFixedBlockSize = true); | ||
}; | ||
#define XPETRA_MATRIXFACTORY2_SHORT | ||
|
||
// template<> | ||
// class MatrixFactory2<double,int,int,typename Xpetra::Matrix<double, int, int>::node_type> { | ||
template <class Node> | ||
class MatrixFactory2<double, int, int, Node> { | ||
typedef double Scalar; | ||
typedef int LocalOrdinal; | ||
typedef int GlobalOrdinal; | ||
// typedef Matrix<double, int, GlobalOrdinal>::node_type Node; | ||
#undef XPETRA_MATRIXFACTORY2_SHORT | ||
#include "Xpetra_UseShortNames.hpp" | ||
public: | ||
static RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > BuildCopy(const RCP<const Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > A, bool setFixedBlockSize = true) { | ||
RCP<const CrsMatrixWrap> oldOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(A); | ||
if (oldOp == Teuchos::null) | ||
throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed"); | ||
|
||
RCP<const CrsMatrix> oldCrsOp = oldOp->getCrsMatrix(); | ||
|
||
#ifdef HAVE_XPETRA_EPETRA | ||
#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES | ||
RCP<const EpetraCrsMatrixT<GlobalOrdinal, Node> > oldECrsOp = Teuchos::rcp_dynamic_cast<const EpetraCrsMatrixT<GlobalOrdinal, Node> >(oldCrsOp); | ||
if (oldECrsOp != Teuchos::null) { | ||
// Underlying matrix is Epetra | ||
RCP<CrsMatrix> newECrsOp(new EpetraCrsMatrixT<GlobalOrdinal, Node>(*oldECrsOp)); | ||
RCP<CrsMatrixWrap> newOp(new CrsMatrixWrap(newECrsOp)); | ||
if (setFixedBlockSize) | ||
newOp->SetFixedBlockSize(A->GetFixedBlockSize()); | ||
return newOp; | ||
} | ||
#endif | ||
#endif | ||
|
||
#ifdef HAVE_XPETRA_TPETRA | ||
// Underlying matrix is Tpetra | ||
RCP<const TpetraCrsMatrix> oldTCrsOp = Teuchos::rcp_dynamic_cast<const TpetraCrsMatrix>(oldCrsOp); | ||
if (oldTCrsOp != Teuchos::null) { | ||
RCP<CrsMatrix> newTCrsOp(new TpetraCrsMatrix(*oldTCrsOp)); | ||
RCP<CrsMatrixWrap> newOp(new CrsMatrixWrap(newTCrsOp)); | ||
if (setFixedBlockSize) | ||
newOp->SetFixedBlockSize(A->GetFixedBlockSize()); | ||
return newOp; | ||
} | ||
return Teuchos::null; | ||
#else | ||
throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::EpetraCrsMatrix or Xpetra::TpetraCrsMatrix failed"); | ||
TEUCHOS_UNREACHABLE_RETURN(Teuchos::null); // make compiler happy | ||
#endif | ||
|
||
} // BuildCopy | ||
}; | ||
|
||
#define XPETRA_MATRIXFACTORY2_SHORT | ||
|
||
#ifdef HAVE_XPETRA_INT_LONG_LONG | ||
template <class Node> | ||
class MatrixFactory2<double, int, long long, Node> { | ||
typedef double Scalar; | ||
typedef int LocalOrdinal; | ||
typedef long long GlobalOrdinal; | ||
// typedef Matrix<double, int, GlobalOrdinal>::node_type Node; | ||
#undef XPETRA_MATRIXFACTORY2_SHORT | ||
#include "Xpetra_UseShortNames.hpp" | ||
public: | ||
static RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > BuildCopy(const RCP<const Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > A, bool setFixedBlockSize = true) { | ||
RCP<const CrsMatrixWrap> oldOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(A); | ||
if (oldOp == Teuchos::null) | ||
throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed"); | ||
|
||
RCP<const CrsMatrix> oldCrsOp = oldOp->getCrsMatrix(); | ||
|
||
#ifdef HAVE_XPETRA_EPETRA | ||
#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES | ||
RCP<const EpetraCrsMatrixT<GlobalOrdinal, Node> > oldECrsOp = Teuchos::rcp_dynamic_cast<const EpetraCrsMatrixT<GlobalOrdinal, Node> >(oldCrsOp); | ||
if (oldECrsOp != Teuchos::null) { | ||
// Underlying matrix is Epetra | ||
RCP<CrsMatrix> newECrsOp(new EpetraCrsMatrixT<GlobalOrdinal, Node>(*oldECrsOp)); | ||
RCP<CrsMatrixWrap> newOp(new CrsMatrixWrap(newECrsOp)); | ||
if (setFixedBlockSize) | ||
newOp->SetFixedBlockSize(A->GetFixedBlockSize()); | ||
return newOp; | ||
} | ||
#endif | ||
#endif | ||
|
||
#ifdef HAVE_XPETRA_TPETRA | ||
// Underlying matrix is Tpetra | ||
RCP<const TpetraCrsMatrix> oldTCrsOp = Teuchos::rcp_dynamic_cast<const TpetraCrsMatrix>(oldCrsOp); | ||
if (oldTCrsOp != Teuchos::null) { | ||
RCP<CrsMatrix> newTCrsOp(new TpetraCrsMatrix(*oldTCrsOp)); | ||
RCP<CrsMatrixWrap> newOp(new CrsMatrixWrap(newTCrsOp)); | ||
if (setFixedBlockSize) | ||
newOp->SetFixedBlockSize(A->GetFixedBlockSize()); | ||
return newOp; | ||
} | ||
#else | ||
throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::EpetraCrsMatrix or Xpetra::TpetraCrsMatrix failed"); | ||
#endif | ||
|
||
return Teuchos::null; // make compiler happy | ||
} | ||
}; | ||
#endif // HAVE_XPETRA_INT_LONG_LONG | ||
|
||
#define XPETRA_MATRIXFACTORY2_SHORT | ||
|
||
} // namespace Xpetra | ||
|
||
#define XPETRA_MATRIXFACTORY2_SHORT | ||
|
||
#endif // ifndef XPETRA_MATRIXFACTORY2_DECL_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// @HEADER | ||
// ***************************************************************************** | ||
// Xpetra: A linear algebra interface package | ||
// | ||
// Copyright 2012 NTESS and the Xpetra contributors. | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// ***************************************************************************** | ||
// @HEADER | ||
|
||
// WARNING: This code is experimental. Backwards compatibility should not be expected. | ||
|
||
#ifndef XPETRA_MATRIXFACTORY2_DEF_HPP | ||
#define XPETRA_MATRIXFACTORY2_DEF_HPP | ||
|
||
#include "Xpetra_MatrixFactory2_decl.hpp" | ||
#include "Xpetra_BlockedCrsMatrix.hpp" | ||
|
||
namespace Xpetra { | ||
|
||
template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node> | ||
RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> MatrixFactory2<Scalar, LocalOrdinal, GlobalOrdinal, Node>::BuildCopy(const RCP<const Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> A, bool setFixedBlockSize) { | ||
RCP<const CrsMatrixWrap> oldOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(A); | ||
if (oldOp == Teuchos::null) | ||
throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed"); | ||
|
||
RCP<const CrsMatrix> oldCrsOp = oldOp->getCrsMatrix(); | ||
|
||
UnderlyingLib lib = A->getRowMap()->lib(); | ||
|
||
TEUCHOS_TEST_FOR_EXCEPTION(lib != UseEpetra && lib != UseTpetra, Exceptions::RuntimeError, | ||
"Not Epetra or Tpetra matrix"); | ||
|
||
#ifdef HAVE_XPETRA_EPETRA | ||
if (lib == UseEpetra) { | ||
// NOTE: The proper Epetra conversion in Xpetra_MatrixFactory.cpp | ||
throw Exceptions::RuntimeError("Xpetra::BuildCopy(): matrix templates are incompatible with Epetra"); | ||
} | ||
#endif | ||
|
||
#ifdef HAVE_XPETRA_TPETRA | ||
if (lib == UseTpetra) { | ||
// Underlying matrix is Tpetra | ||
RCP<const TpetraCrsMatrix> oldTCrsOp = Teuchos::rcp_dynamic_cast<const TpetraCrsMatrix>(oldCrsOp); | ||
|
||
if (oldTCrsOp != Teuchos::null) { | ||
RCP<TpetraCrsMatrix> newTCrsOp(new TpetraCrsMatrix(*oldTCrsOp)); | ||
RCP<CrsMatrixWrap> newOp(new CrsMatrixWrap(Teuchos::as<RCP<CrsMatrix>>(newTCrsOp))); | ||
if (setFixedBlockSize) | ||
newOp->SetFixedBlockSize(A->GetFixedBlockSize()); | ||
|
||
return newOp; | ||
} else { | ||
throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::TpetraCrsMatrix failed"); | ||
} | ||
} | ||
#endif | ||
|
||
return Teuchos::null; | ||
} | ||
|
||
} // namespace Xpetra | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.