49 #ifndef XPETRA_MATRIXFACTORY_HPP 50 #define XPETRA_MATRIXFACTORY_HPP 60 template <class Scalar = Matrix<>::scalar_type,
67 #undef XPETRA_MATRIXFACTORY_SHORT 88 return rcp(
new CrsMatrixWrap(rowMap, colMap, NumEntriesPerRowToAlloc, pftype));
91 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 116 LocalOrdinal NumMyElements = diagonal->getMap()->getNodeNumElements();
121 for (LocalOrdinal i = 0; i < NumMyElements; ++i) {
122 mtx->insertGlobalValues(MyGlobalElements[i],
123 Teuchos::tuple<GlobalOrdinal>(MyGlobalElements[i]),
124 Teuchos::tuple<Scalar>(vals[i]) );
133 if (crsOp == Teuchos::null)
138 if (newCrs->hasMatrix())
141 return Teuchos::null;
147 if (crsOp == Teuchos::null)
154 #define XPETRA_MATRIXFACTORY_SHORT 163 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
165 #undef XPETRA_MATRIXFACTORY2_SHORT 171 if (oldOp == Teuchos::null)
179 "Not Epetra or Tpetra matrix");
181 #ifdef HAVE_XPETRA_EPETRA 188 #ifdef HAVE_XPETRA_TPETRA 193 if (oldTCrsOp != Teuchos::null) {
204 return Teuchos::null;
207 #define XPETRA_MATRIXFACTORY2_SHORT 217 #undef XPETRA_MATRIXFACTORY2_SHORT 222 if (oldOp == Teuchos::null)
227 #ifdef HAVE_XPETRA_EPETRA 228 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 230 if (oldECrsOp != Teuchos::null) {
240 #ifdef HAVE_XPETRA_TPETRA 243 if (oldTCrsOp != Teuchos::null) {
250 throw Exceptions::BadCast(
"Cast from Xpetra::Matrix to Xpetra::EpetraCrsMatrix or Xpetra::TpetraCrsMatrix failed");
253 return Teuchos::null;
257 #define XPETRA_MATRIXFACTORY2_SHORT 259 #ifdef HAVE_XPETRA_INT_LONG_LONG 268 #undef XPETRA_MATRIXFACTORY2_SHORT 273 if (oldOp == Teuchos::null)
278 #ifdef HAVE_XPETRA_EPETRA 279 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 281 if (oldECrsOp != Teuchos::null) {
291 #ifdef HAVE_XPETRA_TPETRA 294 if (oldTCrsOp != Teuchos::null) {
301 throw Exceptions::BadCast(
"Cast from Xpetra::Matrix to Xpetra::EpetraCrsMatrix or Xpetra::TpetraCrsMatrix failed");
304 return Teuchos::null;
307 #endif // HAVE_XPETRA_INT_LONG_LONG 309 #define XPETRA_MATRIXFACTORY2_SHORT 313 #define XPETRA_MATRIXFACTORY_SHORT 314 #define XPETRA_MATRIXFACTORY2_SHORT
static RCP< Matrix > Build(const RCP< const Vector > &diagonal)
Constructor for creating a diagonal Xpetra::Matrix using the entries of a given vector for the diagon...
static RCP< Matrix > Build(const RCP< const Matrix > &sourceMatrix, const Import &importer, const RCP< const Map > &domainMap=Teuchos::null, const RCP< const Map > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor to create a Matrix using a fusedImport-style construction. The originalMatrix must be a X...
static RCP< Matrix > Build(const RCP< const CrsGraph > &graph, const RCP< ParameterList > ¶mList=Teuchos::null)
Constructor specifying graph.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype=Xpetra::DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying fixed number of entries for each row.
LocalOrdinal local_ordinal_type
Exception throws to report errors in the internal logical of the program.
static RCP< Matrix > Build(const RCP< const Map > &rowMap, const RCP< const Map > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, Xpetra::ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying the (possibly different) number of entries per row and providing column map...
static RCP< Matrix > Build(const RCP< const Map > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying (possibly different) number of entries in each row.
Exception indicating invalid cast attempted.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
static RCP< Matrix > Build(const RCP< const Map > &rowMap, const RCP< const Map > &colMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying the max number of non-zeros per row and providing column map.
static RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildCopy(const RCP< const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > A)
static RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildCopy(const RCP< const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > A)
TypeTo as(const TypeFrom &t)
Concrete implementation of Xpetra::Matrix.
#define XPETRA_MONITOR(funcName)
static RCP< Matrix > Build(const RCP< const Map > &rowMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype=Xpetra::DynamicProfile)
Constructor specifying the number of non-zeros for all rows.
Xpetra-specific matrix class.
MatrixFactory()
Private constructor. This is a static class.
static RCP< Matrix > Build(const RCP< const Matrix > &sourceMatrix, const Export &exporter, const RCP< const Map > &domainMap=Teuchos::null, const RCP< const Map > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor to create a Matrix using a fusedExport-style construction. The originalMatrix must be a X...
GlobalOrdinal global_ordinal_type