Nektar++
GlobalMatrixKey.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: GlobalMatrixKey.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: Headers for GlobalMatrixKey
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_LIBS_MULTIREGIONS_GLOBALMATRIXKEY_H
36 #define NEKTAR_LIBS_MULTIREGIONS_GLOBALMATRIXKEY_H
37 
40 
41 namespace Nektar
42 {
43 namespace MultiRegions
44 {
45 
46 /// Describes a matrix with ordering defined by a local to global map.
48 {
49 public:
51  const StdRegions::MatrixType matrixType,
53  const StdRegions::ConstFactorMap &factors =
56 
57  /// Copy constructor with change in expansion type
59  const LibUtilities::ShapeType shapeType);
60  /// Copy constructor.
62 
63  /// Destructor
65 
66  /// Provides ordering of GlobalMatrixKey objects.
67  MULTI_REGIONS_EXPORT friend bool operator<(const GlobalMatrixKey &lhs,
68  const GlobalMatrixKey &rhs);
69 
70  /// Return the matrix type.
72  /// Return the expansion type associated with key
74  /// Returns true if a local to global map is defined.
76  /// Returns the number of constants defined for this matrix.
78  /// Returns the requested constant.
80  GetConstFactor(const StdRegions::ConstFactorType &factor) const;
81  /// Returns all the constants.
83  const;
84 
86 
88  const StdRegions::VarCoeffType &coeff) const;
90 
91 protected:
92  /// Default constructor.
94 
95  /// Stores the matrix type based on the enum StdRegions::MatrixType.
97 
98  /// Stores the expansion/shape type that the matrix is to
99  /// be based on
101 
104 
105  /// Pointer to the local to global mapping.
106  std::weak_ptr<AssemblyMap> m_locToGloMap;
107 
108 private:
109 };
110 
111 /// Writes statistics about the matrix key to an output stream.
112 MULTI_REGIONS_EXPORT std::ostream &operator<<(std::ostream &os,
113  const GlobalMatrixKey &rhs);
114 
115 /// A pointer to a GlobalMatrixKey.
116 typedef std::shared_ptr<GlobalMatrixKey> GlobalMatrixKeySharedPtr;
117 
119 {
120  return m_matrixType;
121 }
122 
124 {
125  return m_shapeType;
126 }
127 
129 {
130  if (m_locToGloMap.lock().get() == 0) // NullAssemblyMapSharedPtr)
131  {
132  return false;
133  }
134 
135  return true;
136 }
137 
139 {
140  return m_constFactors.size();
141 }
142 
143 /// @Todo error checking
145  const StdRegions::ConstFactorType &factor) const
146 {
147  auto found = m_constFactors.find(factor);
148  return (*found).second;
149 }
150 
152  const
153 {
154  return m_constFactors;
155 }
156 
158 {
159  return m_varCoeffs.size();
160 }
161 
163  const StdRegions::VarCoeffType &coeff) const
164 {
165  auto found = m_varCoeffs.find(coeff);
166  return (*found).second.GetValue();
167 }
168 
170 {
171  return m_varCoeffs;
172 }
173 } // namespace MultiRegions
174 } // namespace Nektar
175 
176 #endif
#define MULTI_REGIONS_EXPORT
Describes a matrix with ordering defined by a local to global map.
const StdRegions::ConstFactorMap & GetConstFactors() const
Returns all the constants.
NekDouble GetConstFactor(const StdRegions::ConstFactorType &factor) const
Returns the requested constant.
int GetNConstFactors() const
Returns the number of constants defined for this matrix.
std::weak_ptr< AssemblyMap > m_locToGloMap
Pointer to the local to global mapping.
LibUtilities::ShapeType GetShapeType() const
Return the expansion type associated with key.
const StdRegions::VarCoeffMap & GetVarCoeffs() const
const Array< OneD, const NekDouble > & GetVarCoeff(const StdRegions::VarCoeffType &coeff) const
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
LibUtilities::ShapeType m_shapeType
Stores the expansion/shape type that the matrix is to be based on.
GlobalMatrixKey()
Default constructor.
StdRegions::ConstFactorMap m_constFactors
StdRegions::MatrixType m_matrixType
Stores the matrix type based on the enum StdRegions::MatrixType.
bool LocToGloMapIsDefined() const
Returns true if a local to global map is defined.
friend bool operator<(const GlobalMatrixKey &lhs, const GlobalMatrixKey &rhs)
Provides ordering of GlobalMatrixKey objects.
std::ostream & operator<<(std::ostream &os, const GlobalLinSysKey &rhs)
Writes information about the object to a given stream.
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
Definition: AssemblyMap.h:53
std::shared_ptr< GlobalMatrixKey > GlobalMatrixKeySharedPtr
A pointer to a GlobalMatrixKey.
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:51
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:399
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:400
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:344
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
Definition: StdRegions.hpp:343
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble