Nektar++
GlobalMatrix.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: GlobalMatrix.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: GlobalMatrix header
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 #ifndef NEKTAR_LIB_MULTIREGIONS_GLOBALMATRIX_H
35 #define NEKTAR_LIB_MULTIREGIONS_GLOBALMATRIX_H
39 
40 namespace Nektar
41 {
42 namespace MultiRegions
43 {
44 
45 /// Represents a matrix of all degrees of freedom.
47 {
48 public:
50  typedef std::shared_ptr<DNekSmvBsrMat> DNekSmvBsrMatSharedPtr;
51 
52  /// Construct a new matrix.
54  const LibUtilities::SessionReaderSharedPtr &pSession, unsigned int rows,
55  unsigned int columns, const COOMatType &cooMat,
56  const MatrixStorage &matStorage = eFULL);
57 
59  {
60  }
61 
62  /// Perform a matrix-vector multiply.
65 
66  MULTI_REGIONS_EXPORT unsigned long GetMulCallsCounter() const;
67  MULTI_REGIONS_EXPORT unsigned int GetNumNonZeroEntries() const;
68 
69 private:
70  /// Pointer to a double-precision Nektar++ sparse matrix.
72 
73  unsigned int m_rows;
76 
77  unsigned long m_mulCallsCounter;
78 
79  bool m_copyOp;
80 
81  static std::string def;
82  static std::string lookupIds[];
83 };
84 
85 /// Shared pointer to a GlobalMatrix object.
86 typedef std::shared_ptr<GlobalMatrix> GlobalMatrixSharedPtr;
87 /// Mapping from global matrix keys to global matrices.
88 typedef std::map<GlobalMatrixKey, GlobalMatrixSharedPtr> GlobalMatrixMap;
89 /// Shared pointer to a global matrix map.
90 typedef std::shared_ptr<GlobalMatrixMap> GlobalMatrixMapShPtr;
91 
92 } // namespace MultiRegions
93 } // namespace Nektar
94 
95 #endif
#define MULTI_REGIONS_EXPORT
Represents a matrix of all degrees of freedom.
Definition: GlobalMatrix.h:47
static std::string lookupIds[]
Definition: GlobalMatrix.h:82
GlobalMatrix(const LibUtilities::SessionReaderSharedPtr &pSession, unsigned int rows, unsigned int columns, const COOMatType &cooMat, const MatrixStorage &matStorage=eFULL)
Construct a new matrix.
DNekSmvBsrMatSharedPtr m_smvbsrmatrix
Pointer to a double-precision Nektar++ sparse matrix.
Definition: GlobalMatrix.h:71
std::shared_ptr< DNekSmvBsrMat > DNekSmvBsrMatSharedPtr
Definition: GlobalMatrix.h:50
NekSparseMatrix< StorageSmvBsr< NekDouble > > DNekSmvBsrMat
Definition: GlobalMatrix.h:49
Array< OneD, NekDouble > m_tmpout
Definition: GlobalMatrix.h:75
unsigned long GetMulCallsCounter() const
unsigned int GetNumNonZeroEntries() const
Array< OneD, NekDouble > m_tmpin
Definition: GlobalMatrix.h:74
void Multiply(const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out)
Perform a matrix-vector multiply.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< GlobalMatrix > GlobalMatrixSharedPtr
Shared pointer to a GlobalMatrix object.
Definition: GlobalMatrix.h:86
std::map< GlobalMatrixKey, GlobalMatrixSharedPtr > GlobalMatrixMap
Mapping from global matrix keys to global matrices.
Definition: GlobalMatrix.h:88
std::shared_ptr< GlobalMatrixMap > GlobalMatrixMapShPtr
Shared pointer to a global matrix map.
Definition: GlobalMatrix.h:90
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::map< CoordType, NekDouble > COOMatType