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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Headers for GlobalMatrixKey
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIBS_MULTIREGIONS_GLOBALMATRIXKEY_H
37 #define NEKTAR_LIBS_MULTIREGIONS_GLOBALMATRIXKEY_H
38 
41 
42 namespace Nektar
43 {
44  namespace MultiRegions
45  {
46 
47  /// Describes a matrix with ordering defined by a local to global map.
49  {
50  public:
52  const AssemblyMapSharedPtr &locToGloMap
56 
57  /// Copy constructor with change in expansion type
58  GlobalMatrixKey(const GlobalMatrixKey &key,
59  const LibUtilities::ShapeType shapeType);
60  /// Copy constructor.
61  MULTI_REGIONS_EXPORT GlobalMatrixKey(const GlobalMatrixKey &key);
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  /// Returns all the constants.
82 
84 
87 
88  protected:
89  /// Default constructor.
91 
92  /// Stores the matrix type based on the enum StdRegions::MatrixType.
94 
95  /// Stores the expansion/shape type that the matrix is to
96  /// be based on
98 
101 
102  /// Pointer to the local to global mapping.
104 
105  private:
106 
107  };
108 
109  /// Writes statistics about the matrix key to an output stream.
110  MULTI_REGIONS_EXPORT std::ostream& operator<<(std::ostream& os, const GlobalMatrixKey& rhs);
111 
112  /// A pointer to a GlobalMatrixKey.
113  typedef boost::shared_ptr<GlobalMatrixKey> GlobalMatrixKeySharedPtr;
114 
117  {
118  return m_matrixType;
119  }
120 
123  {
124  return m_shapeType;
125  }
126 
128  {
129  if( m_locToGloMap.get() == 0) //NullAssemblyMapSharedPtr)
130  {
131  return false;
132  }
133 
134  return true;
135  }
136 
138  {
139  return m_constFactors.size();
140  }
141 
142  /// @Todo error checking
144  {
145  StdRegions::ConstFactorMap::const_iterator found = m_constFactors.find(factor);
146  return (*found).second;
147  }
148 
149  inline const StdRegions::ConstFactorMap&
151  {
152  return m_constFactors;
153  }
154 
156  {
157  return m_varCoeffs.size();
158  }
159 
161  {
162  StdRegions::VarCoeffMap::const_iterator found = m_varCoeffs.find(coeff);
163  return (*found).second;
164  }
165 
167  {
168  return m_varCoeffs;
169  }
170  }
171 }
172 
173 #endif
const StdRegions::VarCoeffMap & GetVarCoeffs() const
boost::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
Definition: AssemblyMap.h:53
const Array< OneD, const NekDouble > & GetVarCoeff(const StdRegions::VarCoeffType &coeff) const
NekDouble GetConstFactor(const StdRegions::ConstFactorType &factor) const
Returns the requested constant.
#define MULTI_REGIONS_EXPORT
std::map< ConstFactorType, NekDouble > ConstFactorMap
Definition: StdRegions.hpp:248
friend bool operator<(const GlobalMatrixKey &lhs, const GlobalMatrixKey &rhs)
Provides ordering of GlobalMatrixKey objects.
const StdRegions::ConstFactorMap & GetConstFactors() const
Returns all the constants.
GlobalMatrixKey()
Default constructor.
StandardMatrixTag & lhs
StdRegions::ConstFactorMap m_constFactors
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:225
LibUtilities::ShapeType GetShapeType() const
Return the expansion type associated with key.
double NekDouble
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
Describes a matrix with ordering defined by a local to global map.
boost::shared_ptr< GlobalMatrixKey > GlobalMatrixKeySharedPtr
A pointer to a GlobalMatrixKey.
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
Definition: AssemblyMap.h:55
int GetNConstFactors() const
Returns the number of constants defined for this matrix.
bool LocToGloMapIsDefined() const
Returns true if a local to global map is defined.
AssemblyMapSharedPtr m_locToGloMap
Pointer to the local to global mapping.
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:226
static ConstFactorMap NullConstFactorMap
Definition: StdRegions.hpp:249