47 #ifndef XPETRA_MATRIXFACTORY_CPP 
   48 #define XPETRA_MATRIXFACTORY_CPP 
   54    Teuchos::RCP<Matrix > MatrixFactory2<double,int,int,Xpetra::Matrix<double, int, int>::node_type>::BuildCopy(
const Teuchos::RCP<const Matrix > A) {
 
   55     RCP<const CrsMatrixWrap> oldOp = Teuchos::rcp_dynamic_cast<
const CrsMatrixWrap>(A);
 
   56     if (oldOp == Teuchos::null)
 
   57       throw Exceptions::BadCast(
"Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
 
   59     RCP<const CrsMatrix> oldCrsOp = oldOp->getCrsMatrix();
 
   61 #ifdef HAVE_XPETRA_EPETRA 
   62 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 
   63         RCP<const EpetraCrsMatrixT<GlobalOrdinal,Node> > oldECrsOp = Teuchos::rcp_dynamic_cast<
const EpetraCrsMatrixT<GlobalOrdinal,Node> >(oldCrsOp);
 
   64     if (oldECrsOp != Teuchos::null) {
 
   66       RCP<CrsMatrix>     newECrsOp(
new EpetraCrsMatrixT<GlobalOrdinal,Node>(*oldECrsOp));
 
   67       RCP<CrsMatrixWrap> newOp    (
new CrsMatrixWrap  (newECrsOp));
 
   74 #ifdef HAVE_XPETRA_TPETRA 
   76     RCP<const TpetraCrsMatrix> oldTCrsOp = Teuchos::rcp_dynamic_cast<
const TpetraCrsMatrix>(oldCrsOp);
 
   77     if (oldTCrsOp != Teuchos::null) {
 
   78       RCP<CrsMatrix>     newTCrsOp(
new TpetraCrsMatrix(*oldTCrsOp));
 
   79       RCP<CrsMatrixWrap> newOp    (
new CrsMatrixWrap(newTCrsOp));
 
   84     throw Exceptions::BadCast(
"Cast from Xpetra::Matrix to Xpetra::EpetraCrsMatrix or Xpetra::TpetraCrsMatrix failed");
 
   90 #ifdef HAVE_XPETRA_INT_LONG_LONG 
   92   Teuchos::RCP<Xpetra::Matrix<double,int,long long,typename Xpetra::Matrix<double, int, long long>::node_type> > MatrixFactory2<double,int,long long,typename Xpetra::Matrix<double, int, long long>::node_type>::BuildCopy(
const Teuchos::RCP<
const Xpetra::Matrix<
double,
int,
long long,
typename Matrix<double, int, long long>::node_type> > A) {
 
   93     RCP<const CrsMatrixWrap> oldOp = Teuchos::rcp_dynamic_cast<
const CrsMatrixWrap>(A);
 
   94     if (oldOp == Teuchos::null)
 
   95       throw Exceptions::BadCast(
"Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
 
   97     RCP<const CrsMatrix> oldCrsOp = oldOp->getCrsMatrix();
 
   99 #ifdef HAVE_XPETRA_EPETRA 
  100 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 
  101         RCP<const EpetraCrsMatrixT<GlobalOrdinal,Node> > oldECrsOp = Teuchos::rcp_dynamic_cast<
const EpetraCrsMatrixT<GlobalOrdinal,Node> >(oldCrsOp);
 
  102     if (oldECrsOp != Teuchos::null) {
 
  104       RCP<CrsMatrix>     newECrsOp(
new EpetraCrsMatrixT<GlobalOrdinal,Node>(*oldECrsOp));
 
  105       RCP<CrsMatrixWrap> newOp    (
new CrsMatrixWrap  (newECrsOp));
 
  112 #ifdef HAVE_XPETRA_TPETRA 
  114     RCP<const TpetraCrsMatrix> oldTCrsOp = Teuchos::rcp_dynamic_cast<
const TpetraCrsMatrix>(oldCrsOp);
 
  115     if (oldTCrsOp != Teuchos::null) {
 
  116       RCP<CrsMatrix>     newTCrsOp(
new TpetraCrsMatrix(*oldTCrsOp));
 
  117       RCP<CrsMatrixWrap> newOp    (
new CrsMatrixWrap(newTCrsOp));
 
  122     throw Exceptions::BadCast(
"Cast from Xpetra::Matrix to Xpetra::EpetraCrsMatrix or Xpetra::TpetraCrsMatrix failed");
 
  125     return Teuchos::null;  
 
  128 #endif // HAVE_XPETRA_INT_LONG_LONG 
Xpetra-specific matrix class.