Xpetra_MatrixFactory.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact
39 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 
47 // WARNING: This code is experimental. Backwards compatibility should not be expected.
48 
49 #ifndef XPETRA_MATRIXFACTORY_HPP
50 #define XPETRA_MATRIXFACTORY_HPP
51 
52 #include "Xpetra_ConfigDefs.hpp"
54 #include "Xpetra_Matrix.hpp"
55 #include "Xpetra_CrsMatrixWrap.hpp"
57 #include "Xpetra_Map.hpp"
58 #include "Xpetra_Vector.hpp"
59 #include "Xpetra_Exceptions.hpp"
60 
61 namespace Xpetra {
62 
63  /*template <class Scalar = Matrix<>::scalar_type,
64  class LocalOrdinal = typename Matrix<Scalar>::local_ordinal_type,
65  class GlobalOrdinal =
66  typename Matrix<Scalar, LocalOrdinal>::global_ordinal_type,
67  class Node =
68  typename Matrix<Scalar, LocalOrdinal, GlobalOrdinal>::node_type>*/
69  template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
70  class MatrixFactory2 {
71  #undef XPETRA_MATRIXFACTORY2_SHORT
72  #include "Xpetra_UseShortNames.hpp"
73 
74  public:
76  RCP<const CrsMatrixWrap> oldOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(A);
77  if (oldOp == Teuchos::null)
78  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
79 
80  RCP<const CrsMatrix> oldCrsOp = oldOp->getCrsMatrix();
81 
82  UnderlyingLib lib = A->getRowMap()->lib();
83 
85  "Not Epetra or Tpetra matrix");
86 
87  #ifdef HAVE_XPETRA_EPETRA
88  if (lib == UseEpetra) {
89  // NOTE: The proper Epetra conversion in Xpetra_MatrixFactory.cpp
90  throw Exceptions::RuntimeError("Xpetra::BuildCopy(): matrix templates are incompatible with Epetra");
91  }
92  #endif
93 
94  #ifdef HAVE_XPETRA_TPETRA
95  if (lib == UseTpetra) {
96  // Underlying matrix is Tpetra
97  RCP<const TpetraCrsMatrix> oldTCrsOp = Teuchos::rcp_dynamic_cast<const TpetraCrsMatrix>(oldCrsOp);
98 
99  if (oldTCrsOp != Teuchos::null) {
100  RCP<TpetraCrsMatrix> newTCrsOp(new TpetraCrsMatrix(*oldTCrsOp));
102 
103  return newOp;
104  } else {
105  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::TpetraCrsMatrix failed");
106  }
107  }
108  #endif
109 
110  return Teuchos::null;
111  }
112  };
113  #define XPETRA_MATRIXFACTORY2_SHORT
114 
115  //template<>
116  //class MatrixFactory2<double,int,int,typename Xpetra::Matrix<double, int, int>::node_type> {
117  template<class Node>
118  class MatrixFactory2<double,int,int,Node> {
119  typedef double Scalar;
120  typedef int LocalOrdinal;
121  typedef int GlobalOrdinal;
122  //typedef Matrix<double, int, GlobalOrdinal>::node_type Node;
123  #undef XPETRA_MATRIXFACTORY2_SHORT
124  #include "Xpetra_UseShortNames.hpp"
125  public:
127  RCP<const CrsMatrixWrap> oldOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(A);
128  if (oldOp == Teuchos::null)
129  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
130 
131  RCP<const CrsMatrix> oldCrsOp = oldOp->getCrsMatrix();
132 
133  #ifdef HAVE_XPETRA_EPETRA
134  #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
135  RCP<const EpetraCrsMatrixT<GlobalOrdinal,Node> > oldECrsOp = Teuchos::rcp_dynamic_cast<const EpetraCrsMatrixT<GlobalOrdinal,Node> >(oldCrsOp);
136  if (oldECrsOp != Teuchos::null) {
137  // Underlying matrix is Epetra
138  RCP<CrsMatrix> newECrsOp(new EpetraCrsMatrixT<GlobalOrdinal,Node>(*oldECrsOp));
139  RCP<CrsMatrixWrap> newOp (new CrsMatrixWrap (newECrsOp));
140 
141  return newOp;
142  }
143  #endif
144  #endif
145 
146  #ifdef HAVE_XPETRA_TPETRA
147  // Underlying matrix is Tpetra
148  RCP<const TpetraCrsMatrix> oldTCrsOp = Teuchos::rcp_dynamic_cast<const TpetraCrsMatrix>(oldCrsOp);
149  if (oldTCrsOp != Teuchos::null) {
150  RCP<CrsMatrix> newTCrsOp(new TpetraCrsMatrix(*oldTCrsOp));
151  RCP<CrsMatrixWrap> newOp (new CrsMatrixWrap(newTCrsOp));
152 
153  return newOp;
154  }
155  #else
156  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::EpetraCrsMatrix or Xpetra::TpetraCrsMatrix failed");
157  #endif
158 
159  TEUCHOS_UNREACHABLE_RETURN(Teuchos::null); // make compiler happy
160  }
161  };
162 
163  #define XPETRA_MATRIXFACTORY2_SHORT
164 
165  #ifdef HAVE_XPETRA_INT_LONG_LONG
166  //template<>
167  //class MatrixFactory2<double,int,long long,typename Xpetra::Matrix<double, int, long long>::node_type> {
168  template<class Node>
169  class MatrixFactory2<double, int, long long, Node> {
170  typedef double Scalar;
171  typedef int LocalOrdinal;
172  typedef long long GlobalOrdinal;
173  //typedef Matrix<double, int, GlobalOrdinal>::node_type Node;
174  #undef XPETRA_MATRIXFACTORY2_SHORT
175  #include "Xpetra_UseShortNames.hpp"
176  public:
177  static RCP<Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > BuildCopy(const RCP<const Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > A) {
178  RCP<const CrsMatrixWrap> oldOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(A);
179  if (oldOp == Teuchos::null)
180  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
181 
182  RCP<const CrsMatrix> oldCrsOp = oldOp->getCrsMatrix();
183 
184  #ifdef HAVE_XPETRA_EPETRA
185  #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
186  RCP<const EpetraCrsMatrixT<GlobalOrdinal,Node> > oldECrsOp = Teuchos::rcp_dynamic_cast<const EpetraCrsMatrixT<GlobalOrdinal,Node> >(oldCrsOp);
187  if (oldECrsOp != Teuchos::null) {
188  // Underlying matrix is Epetra
189  RCP<CrsMatrix> newECrsOp(new EpetraCrsMatrixT<GlobalOrdinal,Node>(*oldECrsOp));
190  RCP<CrsMatrixWrap> newOp (new CrsMatrixWrap (newECrsOp));
191 
192  return newOp;
193  }
194  #endif
195  #endif
196 
197  #ifdef HAVE_XPETRA_TPETRA
198  // Underlying matrix is Tpetra
199  RCP<const TpetraCrsMatrix> oldTCrsOp = Teuchos::rcp_dynamic_cast<const TpetraCrsMatrix>(oldCrsOp);
200  if (oldTCrsOp != Teuchos::null) {
201  RCP<CrsMatrix> newTCrsOp(new TpetraCrsMatrix(*oldTCrsOp));
202  RCP<CrsMatrixWrap> newOp (new CrsMatrixWrap(newTCrsOp));
203 
204  return newOp;
205  }
206  #else
207  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::EpetraCrsMatrix or Xpetra::TpetraCrsMatrix failed");
208  #endif
209 
210  return Teuchos::null; // make compiler happy
211  }
212  };
213  #endif // HAVE_XPETRA_INT_LONG_LONG
214 
215  #define XPETRA_MATRIXFACTORY2_SHORT
216 
217 
218  template <class Scalar = Matrix<>::scalar_type,
219  class LocalOrdinal = typename Matrix<Scalar>::local_ordinal_type,
220  class GlobalOrdinal =
222  class Node =
224  class MatrixFactory {
225 #undef XPETRA_MATRIXFACTORY_SHORT
226 #include "Xpetra_UseShortNames.hpp"
227 
228  private:
231 
232  public:
233 
235  static RCP<Matrix> Build(const RCP<const Map>& rowMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype = Xpetra::DynamicProfile) {
236  return rcp(new CrsMatrixWrap(rowMap, maxNumEntriesPerRow, pftype));
237  }
238 
240  static RCP<Matrix> Build(const RCP<const Map>& rowMap, const RCP<const Map>& colMap, size_t maxNumEntriesPerRow, Xpetra::ProfileType pftype = Xpetra::DynamicProfile) {
241  return rcp(new CrsMatrixWrap(rowMap, colMap, maxNumEntriesPerRow, pftype));
242  }
243 
245  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) {
246  return rcp(new CrsMatrixWrap(rowMap, colMap, NumEntriesPerRowToAlloc, pftype));
247  }
248 
249 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
250  static RCP<Matrix> Build (
252  const Teuchos::RCP<const Map>& rowMap,
253  const Teuchos::RCP<const Map>& colMap,
255  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
256  XPETRA_MONITOR("MatrixFactory::Build");
257  return rcp(new CrsMatrixWrap(rowMap, colMap, lclMatrix, params));
258  }
260  static RCP<Matrix> Build (
262  const Teuchos::RCP<const Map>& rowMap,
263  const Teuchos::RCP<const Map>& colMap,
264  const Teuchos::RCP<const Map>& domainMap = Teuchos::null,
265  const Teuchos::RCP<const Map>& rangeMap = Teuchos::null,
266  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
267  XPETRA_MONITOR("MatrixFactory::Build");
268  return rcp(new CrsMatrixWrap(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
269  }
270 #endif
271 
273  static RCP<Matrix> Build(const RCP<const Map> &rowMap, const ArrayRCP<const size_t> &NumEntriesPerRowToAlloc, ProfileType pftype = Xpetra::DynamicProfile) {
274  return rcp( new CrsMatrixWrap(rowMap, NumEntriesPerRowToAlloc, pftype) );
275  }
276 
278  static RCP<Matrix> Build(const RCP<const CrsGraph>& graph, const RCP<ParameterList>& paramList = Teuchos::null) {
279  return rcp(new CrsMatrixWrap(graph, paramList));
280  }
281 
283  static RCP<Matrix> Build(const RCP<const Vector>& diagonal) {
284  Teuchos::ArrayRCP<const Scalar> vals = diagonal->getData(0);
285  LocalOrdinal NumMyElements = diagonal->getMap()->getNodeNumElements();
286  Teuchos::ArrayView<const GlobalOrdinal> MyGlobalElements = diagonal->getMap()->getNodeElementList();
287 
289 
290  for (LocalOrdinal i = 0; i < NumMyElements; ++i) {
291  mtx->insertGlobalValues(MyGlobalElements[i],
292  Teuchos::tuple<GlobalOrdinal>(MyGlobalElements[i]),
293  Teuchos::tuple<Scalar>(vals[i]) );
294  }
295  mtx->fillComplete();
296  return mtx;
297  }
298 
300  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>& params = Teuchos::null) {
301  RCP<const CrsMatrixWrap> crsOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(sourceMatrix);
302  if (crsOp == Teuchos::null)
303  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
304 
305  RCP<CrsMatrix> originalCrs = crsOp->getCrsMatrix();
306  RCP<CrsMatrix> newCrs = CrsMatrixFactory::Build(originalCrs, importer, domainMap, rangeMap, params);
307  if (newCrs->hasMatrix())
308  return rcp(new CrsMatrixWrap(newCrs));
309  else
310  return Teuchos::null;
311  }
312 
314  static RCP<Matrix> Build(const RCP<const Matrix> & sourceMatrix, const Export &exporter, const RCP<const Map> & domainMap, const RCP<const Map> & rangeMap,const Teuchos::RCP<Teuchos::ParameterList>& params) {
315  RCP<const CrsMatrixWrap> crsOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(sourceMatrix);
316  if (crsOp == Teuchos::null)
317  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
318 
319  RCP<CrsMatrix> originalCrs = crsOp->getCrsMatrix();
320  return rcp(new CrsMatrixWrap(CrsMatrixFactory::Build(originalCrs, exporter, domainMap, rangeMap, params)));
321  }
322 
324  static RCP<Matrix> Build(const RCP<const Matrix>& sourceMatrix, const Import& RowImporter, const Import& DomainImporter, const RCP<const Map>& domainMap, const RCP<const Map>& rangeMap, const Teuchos::RCP<Teuchos::ParameterList>& params) {
325  RCP<const CrsMatrixWrap> crsOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(sourceMatrix);
326  if (crsOp == Teuchos::null)
327  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
328 
329  RCP<CrsMatrix> originalCrs = crsOp->getCrsMatrix();
330  RCP<CrsMatrix> newCrs = CrsMatrixFactory::Build(originalCrs, RowImporter, Teuchos::rcpFromRef(DomainImporter), domainMap, rangeMap, params);
331  if (newCrs->hasMatrix())
332  return rcp(new CrsMatrixWrap(newCrs));
333  else
334  return Teuchos::null;
335  }
336 
338  static RCP<Matrix> Build(const RCP<const Matrix> & sourceMatrix, const Export &RowExporter, const Export &DomainExporter, const RCP<const Map> & domainMap = Teuchos::null, const RCP<const Map> & rangeMap = Teuchos::null,const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
339  RCP<const CrsMatrixWrap> crsOp = Teuchos::rcp_dynamic_cast<const CrsMatrixWrap>(sourceMatrix);
340  if (crsOp == Teuchos::null)
341  throw Exceptions::BadCast("Cast from Xpetra::Matrix to Xpetra::CrsMatrixWrap failed");
342 
343  RCP<CrsMatrix> originalCrs = crsOp->getCrsMatrix();
344  RCP<CrsMatrix> newCrs = CrsMatrixFactory::Build(originalCrs, RowExporter, Teuchos::rcpFromRef(DomainExporter), domainMap, rangeMap, params);
345  if (newCrs->hasMatrix())
346  return rcp(new CrsMatrixWrap(newCrs));
347  else
348  return Teuchos::null;
349  }
350 
351 
355  RCP<const BlockedCrsMatrix> input = Teuchos::rcp_dynamic_cast<const BlockedCrsMatrix>(A);
356  if(input == Teuchos::null)
358 
359  // deep copy of MapExtractors (and underlying maps)
360  RCP<const MapExtractor> rgMapExt = Teuchos::rcp(new MapExtractor(*(input->getRangeMapExtractor())));
361  RCP<const MapExtractor> doMapExt = Teuchos::rcp(new MapExtractor(*(input->getDomainMapExtractor())));
362 
363  // create new BlockedCrsMatrix object
364  RCP<BlockedCrsMatrix> bop = Teuchos::rcp(new BlockedCrsMatrix(rgMapExt, doMapExt, input->getNodeMaxNumRowEntries()));
365 
366  for (size_t r = 0; r < input->Rows(); ++r) {
367  for (size_t c = 0; c < input->Cols(); ++c)
368  if(input->getMatrix(r,c) != Teuchos::null) {
369  // make a deep copy of the matrix
370  // This is a recursive call to this function
371  RCP<Matrix> mat =
373  bop->setMatrix(r,c,mat);
374  }
375  }
376 
377  if(input->isFillComplete())
378  bop->fillComplete();
379  return bop;
380  }
381  };
382 #define XPETRA_MATRIXFACTORY_SHORT
383 
384 }
385 
386 #define XPETRA_MATRIXFACTORY_SHORT
387 #define XPETRA_MATRIXFACTORY2_SHORT
388 #endif
Xpetra::MatrixFactory::Build
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.
Definition: Xpetra_MatrixFactory.hpp:235
Xpetra::MatrixFactory::Build
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...
Definition: Xpetra_MatrixFactory.hpp:283
Teuchos::as
TypeTo as(const TypeFrom &t)
Xpetra::MatrixFactory::Build
static RCP< Matrix > Build(const RCP< const CrsGraph > &graph, const RCP< ParameterList > &paramList=Teuchos::null)
Constructor specifying graph.
Definition: Xpetra_MatrixFactory.hpp:278
Xpetra::Matrix::node_type
Node node_type
Definition: Xpetra_Matrix.hpp:108
Xpetra
Xpetra namespace
Definition: Xpetra_BlockedCrsMatrix.hpp:86
Xpetra_CrsMatrixWrap.hpp
Xpetra::CrsMatrixFactory::Build
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.
Definition: Xpetra_CrsMatrixFactory.hpp:80
Xpetra::MatrixFactory::MatrixFactory
MatrixFactory()
Private constructor. This is a static class.
Definition: Xpetra_MatrixFactory.hpp:230
Xpetra::MatrixFactory2::BuildCopy
static RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildCopy(const RCP< const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > A)
Definition: Xpetra_MatrixFactory.hpp:75
Xpetra::Exceptions::BadCast
Exception indicating invalid cast attempted.
Definition: Xpetra_Exceptions.hpp:86
Xpetra_MapExtractor_fwd.hpp
Xpetra::DynamicProfile
Definition: Xpetra_ConfigDefs.hpp:187
Xpetra::MatrixFactory::Build
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.
Definition: Xpetra_MatrixFactory.hpp:273
Xpetra::Export
Definition: Xpetra_Export.hpp:62
Xpetra::MatrixFactory::Build
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 > &params=Teuchos::null)
Constructor to create a Matrix using a fusedImport-style construction. The originalMatrix must be a X...
Definition: Xpetra_MatrixFactory.hpp:300
Xpetra_BlockedCrsMatrix_fwd.hpp
Xpetra_UseShortNames.hpp
rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Xpetra::UseTpetra
Definition: Xpetra_Map.hpp:83
Xpetra::MatrixFactory::BuildCopy
static RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildCopy(const RCP< const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > A)
Definition: Xpetra_MatrixFactory.hpp:354
Xpetra::MatrixFactory::Build
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.
Definition: Xpetra_MatrixFactory.hpp:245
Teuchos::ArrayView
Xpetra::Import
Definition: Xpetra_Import.hpp:62
Teuchos::RCP
Xpetra::TpetraCrsMatrix
Definition: Xpetra_TpetraCrsMatrix.hpp:81
Xpetra::Matrix
Xpetra-specific matrix class.
Definition: Xpetra_Matrix_fwd.hpp:51
Teuchos::ArrayRCP
Xpetra::MatrixFactory2< double, int, int, Node >::Scalar
double Scalar
Definition: Xpetra_MatrixFactory.hpp:119
Xpetra::Exceptions::RuntimeError
Exception throws to report errors in the internal logical of the program.
Definition: Xpetra_Exceptions.hpp:101
Xpetra::BlockedCrsMatrix
Definition: Xpetra_BlockedCrsMatrix.hpp:94
Xpetra::MatrixFactory::Build
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.
Definition: Xpetra_MatrixFactory.hpp:240
Xpetra::MatrixFactory2< double, int, int, Node >::BuildCopy
static RCP< Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildCopy(const RCP< const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > A)
Definition: Xpetra_MatrixFactory.hpp:126
Xpetra_ConfigDefs.hpp
Xpetra::CrsMatrixWrap
Concrete implementation of Xpetra::Matrix.
Definition: Xpetra_CrsMatrixWrap_fwd.hpp:51
Xpetra::MatrixFactory2< double, int, int, Node >::GlobalOrdinal
int GlobalOrdinal
Definition: Xpetra_MatrixFactory.hpp:121
Xpetra_Vector.hpp
Xpetra::MatrixFactory::Build
static RCP< Matrix > Build(const RCP< const Matrix > &sourceMatrix, const Export &exporter, const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor to create a Matrix using a fusedExport-style construction. The originalMatrix must be a X...
Definition: Xpetra_MatrixFactory.hpp:314
Xpetra::MatrixFactory2< double, int, int, Node >::LocalOrdinal
int LocalOrdinal
Definition: Xpetra_MatrixFactory.hpp:120
Xpetra_Exceptions.hpp
Xpetra::UnderlyingLib
UnderlyingLib
Definition: Xpetra_Map.hpp:81
Xpetra::UseEpetra
Definition: Xpetra_Map.hpp:82
Xpetra::Matrix::local_ordinal_type
LocalOrdinal local_ordinal_type
Definition: Xpetra_Matrix.hpp:106
Xpetra::MapExtractor
Definition: Xpetra_MapExtractor.hpp:78
Xpetra::MatrixFactory2
Definition: Xpetra_MatrixFactory_fwd.hpp:54
Xpetra::Matrix::global_ordinal_type
GlobalOrdinal global_ordinal_type
Definition: Xpetra_Matrix.hpp:107
Xpetra::EpetraCrsMatrixT
Definition: Xpetra_EpetraCrsMatrix.hpp:78
Xpetra::MatrixFactory::Build
static RCP< Matrix > Build(const RCP< const Matrix > &sourceMatrix, const Export &RowExporter, const Export &DomainExporter, const RCP< const Map > &domainMap=Teuchos::null, const RCP< const Map > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor to create a Matrix using a fusedExport-style construction. The originalMatrix must be a X...
Definition: Xpetra_MatrixFactory.hpp:338
Xpetra::MatrixFactory::Build
static RCP< Matrix > Build(const RCP< const Matrix > &sourceMatrix, const Import &RowImporter, const Import &DomainImporter, const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor to create a Matrix using a fusedImport-style construction. The originalMatrix must be a X...
Definition: Xpetra_MatrixFactory.hpp:324
TEUCHOS_TEST_FOR_EXCEPTION
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
XPETRA_MONITOR
#define XPETRA_MONITOR(funcName)
Definition: Xpetra_ConfigDefs.hpp:128
Xpetra_Matrix.hpp
Xpetra_Map.hpp
Xpetra::CrsMatrix
Definition: Xpetra_CrsMatrix.hpp:73
Xpetra::ProfileType
ProfileType
Definition: Xpetra_ConfigDefs.hpp:185
Xpetra::StaticProfile
Definition: Xpetra_ConfigDefs.hpp:186
TEUCHOS_UNREACHABLE_RETURN
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)