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
42{
43
44/// Describes a matrix with ordering defined by a local to global map.
46{
47public:
49 const StdRegions::MatrixType matrixType,
54
55 /// Copy constructor with change in expansion type
57 const LibUtilities::ShapeType shapeType);
58 /// Copy constructor.
60
61 /// Destructor
63
64 /// Provides ordering of GlobalMatrixKey objects.
65 MULTI_REGIONS_EXPORT friend bool operator<(const GlobalMatrixKey &lhs,
66 const GlobalMatrixKey &rhs);
67
68 /// Return the matrix type.
70 /// Return the expansion type associated with key
72 /// Returns true if a local to global map is defined.
74 /// Returns the number of constants defined for this matrix.
76 /// Returns the requested constant.
79 /// Returns all the constants.
81 const;
82
84
86 const StdRegions::VarCoeffType &coeff) const;
88
89protected:
90 /// Default constructor.
92
93 /// Stores the matrix type based on the enum StdRegions::MatrixType.
95
96 /// Stores the expansion/shape type that the matrix is to
97 /// be based on
99
102
103 /// Pointer to the local to global mapping.
104 std::weak_ptr<AssemblyMap> m_locToGloMap;
105
106private:
107};
108
109/// Writes statistics about the matrix key to an output stream.
110MULTI_REGIONS_EXPORT std::ostream &operator<<(std::ostream &os,
111 const GlobalMatrixKey &rhs);
112
113/// A pointer to a GlobalMatrixKey.
114typedef std::shared_ptr<GlobalMatrixKey> GlobalMatrixKeySharedPtr;
115
117{
118 return m_matrixType;
119}
120
122{
123 return m_shapeType;
124}
125
127{
128 if (m_locToGloMap.lock().get() == nullptr) // NullAssemblyMapSharedPtr)
129 {
130 return false;
131 }
132
133 return true;
134}
135
137{
138 return m_constFactors.size();
139}
140
141/// @Todo error checking
143 const StdRegions::ConstFactorType &factor) const
144{
145 auto found = m_constFactors.find(factor);
146 return (*found).second;
147}
148
150 const
151{
152 return m_constFactors;
153}
154
156{
157 return m_varCoeffs.size();
158}
159
161 const StdRegions::VarCoeffType &coeff) const
162{
163 auto found = m_varCoeffs.find(coeff);
164 return (*found).second.GetValue();
165}
166
168{
169 return m_varCoeffs;
170}
171} // namespace Nektar::MultiRegions
172
173#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:51
std::shared_ptr< GlobalMatrixKey > GlobalMatrixKeySharedPtr
A pointer to a GlobalMatrixKey.
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:50
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:402
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:403
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:347
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
Definition: StdRegions.hpp:346
StdRegions::ConstFactorMap factors
double NekDouble