Nektar++
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
library
MultiRegions
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
39
#include <
MultiRegions/AssemblyMap/AssemblyMap.h
>
40
#include <
StdRegions/StdRegions.hpp
>
41
42
namespace
Nektar
43
{
44
namespace
MultiRegions
45
{
46
47
/// Describes a matrix with ordering defined by a local to global map.
48
class
GlobalMatrixKey
49
{
50
public
:
51
MULTI_REGIONS_EXPORT
GlobalMatrixKey
(
const
StdRegions::MatrixType
matrixType,
52
const
AssemblyMapSharedPtr
&locToGloMap
53
=
NullAssemblyMapSharedPtr
,
54
const
StdRegions::ConstFactorMap
&factors =
StdRegions::NullConstFactorMap
,
55
const
StdRegions::VarCoeffMap
&varCoeffs =
StdRegions::NullVarCoeffMap
);
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
64
MULTI_REGIONS_EXPORT
virtual
~GlobalMatrixKey
();
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.
71
MULTI_REGIONS_EXPORT
StdRegions::MatrixType
GetMatrixType
()
const
;
72
/// Return the expansion type associated with key
73
MULTI_REGIONS_EXPORT
LibUtilities::ShapeType
GetShapeType
()
const
;
74
/// Returns true if a local to global map is defined.
75
MULTI_REGIONS_EXPORT
bool
LocToGloMapIsDefined
()
const
;
76
/// Returns the number of constants defined for this matrix.
77
MULTI_REGIONS_EXPORT
int
GetNConstFactors
()
const
;
78
/// Returns the requested constant.
79
MULTI_REGIONS_EXPORT
NekDouble
GetConstFactor
(
const
StdRegions::ConstFactorType
& factor)
const
;
80
/// Returns all the constants.
81
MULTI_REGIONS_EXPORT
const
StdRegions::ConstFactorMap
&
GetConstFactors
()
const
;
82
83
MULTI_REGIONS_EXPORT
int
GetNVarCoeffs
()
const
;
84
85
MULTI_REGIONS_EXPORT
const
Array<OneD, const NekDouble> &
GetVarCoeff
(
const
StdRegions::VarCoeffType
& coeff)
const
;
86
MULTI_REGIONS_EXPORT
const
StdRegions::VarCoeffMap
&
GetVarCoeffs
()
const
;
87
88
protected
:
89
/// Default constructor.
90
GlobalMatrixKey
();
91
92
/// Stores the matrix type based on the enum StdRegions::MatrixType.
93
StdRegions::MatrixType
m_matrixType
;
94
95
/// Stores the expansion/shape type that the matrix is to
96
/// be based on
97
LibUtilities::ShapeType
m_shapeType
;
98
99
StdRegions::ConstFactorMap
m_constFactors
;
100
StdRegions::VarCoeffMap
m_varCoeffs
;
101
102
/// Pointer to the local to global mapping.
103
AssemblyMapSharedPtr
m_locToGloMap
;
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
115
inline
StdRegions::MatrixType
116
GlobalMatrixKey::GetMatrixType
()
const
117
{
118
return
m_matrixType
;
119
}
120
121
inline
LibUtilities::ShapeType
122
GlobalMatrixKey::GetShapeType
()
const
123
{
124
return
m_shapeType
;
125
}
126
127
inline
bool
GlobalMatrixKey::LocToGloMapIsDefined
(
void
)
const
128
{
129
if
(
m_locToGloMap
.get() == 0)
//NullAssemblyMapSharedPtr)
130
{
131
return
false
;
132
}
133
134
return
true
;
135
}
136
137
inline
int
GlobalMatrixKey::GetNConstFactors
()
const
138
{
139
return
m_constFactors
.size();
140
}
141
142
/// @Todo error checking
143
inline
NekDouble
GlobalMatrixKey::GetConstFactor
(
const
StdRegions::ConstFactorType
&factor)
const
144
{
145
StdRegions::ConstFactorMap::const_iterator found =
m_constFactors
.find(factor);
146
return
(*found).second;
147
}
148
149
inline
const
StdRegions::ConstFactorMap
&
150
GlobalMatrixKey::GetConstFactors
()
const
151
{
152
return
m_constFactors
;
153
}
154
155
inline
int
GlobalMatrixKey::GetNVarCoeffs
()
const
156
{
157
return
m_varCoeffs
.size();
158
}
159
160
inline
const
Array<OneD, const NekDouble> &
GlobalMatrixKey::GetVarCoeff
(
const
StdRegions::VarCoeffType
&coeff)
const
161
{
162
StdRegions::VarCoeffMap::const_iterator found =
m_varCoeffs
.find(coeff);
163
return
(*found).second;
164
}
165
166
inline
const
StdRegions::VarCoeffMap
&
GlobalMatrixKey::GetVarCoeffs
()
const
167
{
168
return
m_varCoeffs
;
169
}
170
}
171
}
172
173
#endif
Generated on Sun Mar 15 2015 00:11:32 for Nektar++ by
1.8.1.2