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 AssemblyMapSharedPtr &locToGloMap
55 
56  /// Copy constructor with change in expansion type
57  GlobalMatrixKey(const GlobalMatrixKey &key,
58  const LibUtilities::ShapeType shapeType);
59  /// Copy constructor.
60  MULTI_REGIONS_EXPORT GlobalMatrixKey(const GlobalMatrixKey &key);
61 
62  /// Destructor
64 
65  /// Provides ordering of GlobalMatrixKey objects.
66  MULTI_REGIONS_EXPORT friend bool operator<(const GlobalMatrixKey &lhs,
67  const GlobalMatrixKey &rhs);
68 
69  /// Return the matrix type.
71  /// Return the expansion type associated with key
73  /// Returns true if a local to global map is defined.
75  /// Returns the number of constants defined for this matrix.
77  /// Returns the requested constant.
79  /// Returns all the constants.
81 
83 
86 
87  protected:
88  /// Default constructor.
90 
91  /// Stores the matrix type based on the enum StdRegions::MatrixType.
93 
94  /// Stores the expansion/shape type that the matrix is to
95  /// be based on
97 
100 
101  /// Pointer to the local to global mapping.
102  std::weak_ptr<AssemblyMap> m_locToGloMap;
103 
104  private:
105 
106  };
107 
108  /// Writes statistics about the matrix key to an output stream.
109  MULTI_REGIONS_EXPORT std::ostream& operator<<(std::ostream& os, const GlobalMatrixKey& rhs);
110 
111  /// A pointer to a GlobalMatrixKey.
112  typedef std::shared_ptr<GlobalMatrixKey> GlobalMatrixKeySharedPtr;
113 
116  {
117  return m_matrixType;
118  }
119 
122  {
123  return m_shapeType;
124  }
125 
127  {
128  if( m_locToGloMap.lock().get() == 0) //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  {
144  auto found = m_constFactors.find(factor);
145  return (*found).second;
146  }
147 
148  inline const StdRegions::ConstFactorMap&
150  {
151  return m_constFactors;
152  }
153 
155  {
156  return m_varCoeffs.size();
157  }
158 
160  {
161  auto found = m_varCoeffs.find(coeff);
162  return (*found).second;
163  }
164 
166  {
167  return m_varCoeffs;
168  }
169  }
170 }
171 
172 #endif
const StdRegions::ConstFactorMap & GetConstFactors() const
Returns all the constants.
#define MULTI_REGIONS_EXPORT
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:294
friend bool operator<(const GlobalMatrixKey &lhs, const GlobalMatrixKey &rhs)
Provides ordering of GlobalMatrixKey objects.
GlobalMatrixKey()
Default constructor.
StandardMatrixTag & lhs
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:52
StdRegions::VarCoeffMap m_varCoeffs
StdRegions::ConstFactorMap m_constFactors
std::shared_ptr< GlobalMatrixKey > GlobalMatrixKeySharedPtr
A pointer to a GlobalMatrixKey.
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
std::ostream & operator<<(std::ostream &os, const GlobalLinSysKey &rhs)
Writes information about the object to a given stream.
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:264
const Array< OneD, const NekDouble > & GetVarCoeff(const StdRegions::VarCoeffType &coeff) const
bool LocToGloMapIsDefined() const
Returns true if a local to global map is defined.
LibUtilities::ShapeType GetShapeType() const
Return the expansion type associated with key.
std::weak_ptr< AssemblyMap > m_locToGloMap
Pointer to the local to global mapping.
double NekDouble
Describes a matrix with ordering defined by a local to global map.
const StdRegions::VarCoeffMap & GetVarCoeffs() const
NekDouble GetConstFactor(const StdRegions::ConstFactorType &factor) const
Returns the requested constant.
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
Definition: AssemblyMap.h:54
int GetNConstFactors() const
Returns the number of constants defined for this matrix.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs
LibUtilities::ShapeType m_shapeType
Stores the expansion/shape type that the matrix is to be based on.
StdRegions::MatrixType m_matrixType
Stores the matrix type based on the enum StdRegions::MatrixType.
static VarCoeffMap NullVarCoeffMap
Definition: StdRegions.hpp:265
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:295