Nektar++
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Nektar::MultiRegions::GlobalMatrixKey Class Reference

Describes a matrix with ordering defined by a local to global map. More...

#include <GlobalMatrixKey.h>

Inheritance diagram for Nektar::MultiRegions::GlobalMatrixKey:
[legend]

Public Member Functions

 GlobalMatrixKey (const StdRegions::MatrixType matrixType, const AssemblyMapSharedPtr &locToGloMap=NullAssemblyMapSharedPtr, const StdRegions::ConstFactorMap &factors=StdRegions::NullConstFactorMap, const StdRegions::VarCoeffMap &varCoeffs=StdRegions::NullVarCoeffMap)
 
 GlobalMatrixKey (const GlobalMatrixKey &key, const LibUtilities::ShapeType shapeType)
 Copy constructor with change in expansion type. More...
 
 GlobalMatrixKey (const GlobalMatrixKey &key)
 Copy constructor. More...
 
virtual ~GlobalMatrixKey ()
 Destructor. More...
 
StdRegions::MatrixType GetMatrixType () const
 Return the matrix type. More...
 
LibUtilities::ShapeType GetShapeType () const
 Return the expansion type associated with key. More...
 
bool LocToGloMapIsDefined () const
 Returns true if a local to global map is defined. More...
 
int GetNConstFactors () const
 Returns the number of constants defined for this matrix. More...
 
NekDouble GetConstFactor (const StdRegions::ConstFactorType &factor) const
 Returns the requested constant. More...
 
const StdRegions::ConstFactorMapGetConstFactors () const
 Returns all the constants. More...
 
int GetNVarCoeffs () const
 
const Array< OneD, const NekDouble > & GetVarCoeff (const StdRegions::VarCoeffType &coeff) const
 
const StdRegions::VarCoeffMapGetVarCoeffs () const
 

Protected Member Functions

 GlobalMatrixKey ()
 Default constructor. More...
 

Protected Attributes

StdRegions::MatrixType m_matrixType
 Stores the matrix type based on the enum StdRegions::MatrixType. More...
 
LibUtilities::ShapeType m_shapeType
 Stores the expansion/shape type that the matrix is to be based on. More...
 
StdRegions::ConstFactorMap m_constFactors
 
StdRegions::VarCoeffMap m_varCoeffs
 
std::weak_ptr< AssemblyMapm_locToGloMap
 Pointer to the local to global mapping. More...
 

Friends

bool operator< (const GlobalMatrixKey &lhs, const GlobalMatrixKey &rhs)
 Provides ordering of GlobalMatrixKey objects. More...
 

Detailed Description

Describes a matrix with ordering defined by a local to global map.

Definition at line 47 of file GlobalMatrixKey.h.

Constructor & Destructor Documentation

◆ GlobalMatrixKey() [1/4]

Nektar::MultiRegions::GlobalMatrixKey::GlobalMatrixKey ( const StdRegions::MatrixType  matrixType,
const AssemblyMapSharedPtr locToGloMap = NullAssemblyMapSharedPtr,
const StdRegions::ConstFactorMap factors = StdRegions::NullConstFactorMap,
const StdRegions::VarCoeffMap varCoeffs = StdRegions::NullVarCoeffMap 
)

Definition at line 44 of file GlobalMatrixKey.cpp.

47  :
48  m_matrixType(matrixType),
50  m_constFactors(factors),
51  m_varCoeffs(varCoeffs),
52  m_locToGloMap(locToGloMap)
53  {
54  }
StdRegions::VarCoeffMap m_varCoeffs
StdRegions::ConstFactorMap m_constFactors
std::weak_ptr< AssemblyMap > 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.

◆ GlobalMatrixKey() [2/4]

Nektar::MultiRegions::GlobalMatrixKey::GlobalMatrixKey ( const GlobalMatrixKey key,
const LibUtilities::ShapeType  shapeType 
)

Copy constructor with change in expansion type.

Definition at line 56 of file GlobalMatrixKey.cpp.

57  :
58  m_matrixType(key.m_matrixType),
59  m_shapeType(shapeType),
60  m_constFactors(key.m_constFactors),
61  m_varCoeffs(key.m_varCoeffs),
62  m_locToGloMap(key.m_locToGloMap)
63  {
64  }
StdRegions::VarCoeffMap m_varCoeffs
StdRegions::ConstFactorMap m_constFactors
std::weak_ptr< AssemblyMap > 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.

◆ GlobalMatrixKey() [3/4]

Nektar::MultiRegions::GlobalMatrixKey::GlobalMatrixKey ( const GlobalMatrixKey key)

Copy constructor.

Definition at line 66 of file GlobalMatrixKey.cpp.

66  :
67  m_matrixType(key.m_matrixType),
68  m_shapeType(key.m_shapeType),
69  m_constFactors(key.m_constFactors),
70  m_varCoeffs(key.m_varCoeffs),
71  m_locToGloMap(key.m_locToGloMap)
72  {
73  }
StdRegions::VarCoeffMap m_varCoeffs
StdRegions::ConstFactorMap m_constFactors
std::weak_ptr< AssemblyMap > 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.

◆ ~GlobalMatrixKey()

Nektar::MultiRegions::GlobalMatrixKey::~GlobalMatrixKey ( )
virtual

Destructor.

Definition at line 75 of file GlobalMatrixKey.cpp.

76  {
77  }

◆ GlobalMatrixKey() [4/4]

Nektar::MultiRegions::GlobalMatrixKey::GlobalMatrixKey ( )
protected

Default constructor.

Member Function Documentation

◆ GetConstFactor()

NekDouble Nektar::MultiRegions::GlobalMatrixKey::GetConstFactor ( const StdRegions::ConstFactorType factor) const
inline

Returns the requested constant.

error checking

Definition at line 142 of file GlobalMatrixKey.h.

References m_constFactors.

143  {
144  auto found = m_constFactors.find(factor);
145  return (*found).second;
146  }
StdRegions::ConstFactorMap m_constFactors

◆ GetConstFactors()

const StdRegions::ConstFactorMap & Nektar::MultiRegions::GlobalMatrixKey::GetConstFactors ( ) const
inline

◆ GetMatrixType()

StdRegions::MatrixType Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType ( ) const
inline

Return the matrix type.

Definition at line 115 of file GlobalMatrixKey.h.

References m_matrixType.

Referenced by Nektar::MultiRegions::GlobalLinSysDirectFull::AssembleFullMatrix(), Nektar::MultiRegions::GlobalLinSysXxtFull::AssembleMatrixArrays(), Nektar::MultiRegions::GlobalLinSysStaticCond::ConstructNextLevelCondensedSystem(), Nektar::MultiRegions::GlobalLinSysDirectStaticCond::DetermineMatrixStorage(), Nektar::MultiRegions::ExpList::GenBlockMatrix(), Nektar::MultiRegions::ExpList::GeneralMatrixOp_IterPerExp(), Nektar::MultiRegions::ExpList::GenGlobalMatrix(), Nektar::MultiRegions::ExpList::GenGlobalMatrixFull(), Nektar::MultiRegions::GlobalLinSys::GetBlockMatrixKey(), Nektar::MultiRegions::DisContField3D::GetGlobalBndLinSys(), Nektar::MultiRegions::DisContField2D::GetGlobalBndLinSys(), Nektar::MultiRegions::DisContField1D::GetGlobalBndLinSys(), Nektar::MultiRegions::operator<<(), Nektar::MultiRegions::PreconditionerLowEnergy::SetUpReferenceElements(), Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::PreconditionerBlock::v_BuildPreconditioner(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_DoMatrixMultiply(), Nektar::MultiRegions::ContField3D::v_GeneralMatrixOp(), Nektar::MultiRegions::ContField2D::v_GeneralMatrixOp(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_InitObject(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject().

116  {
117  return m_matrixType;
118  }
StdRegions::MatrixType m_matrixType
Stores the matrix type based on the enum StdRegions::MatrixType.

◆ GetNConstFactors()

int Nektar::MultiRegions::GlobalMatrixKey::GetNConstFactors ( ) const
inline

Returns the number of constants defined for this matrix.

Definition at line 136 of file GlobalMatrixKey.h.

References m_constFactors.

Referenced by Nektar::MultiRegions::operator<<().

137  {
138  return m_constFactors.size();
139  }
StdRegions::ConstFactorMap m_constFactors

◆ GetNVarCoeffs()

int Nektar::MultiRegions::GlobalMatrixKey::GetNVarCoeffs ( ) const
inline

◆ GetShapeType()

LibUtilities::ShapeType Nektar::MultiRegions::GlobalMatrixKey::GetShapeType ( void  ) const
inline

Return the expansion type associated with key.

Definition at line 121 of file GlobalMatrixKey.h.

References m_shapeType.

Referenced by Nektar::MultiRegions::ExpList::GenBlockMatrix(), and Nektar::MultiRegions::operator<<().

122  {
123  return m_shapeType;
124  }
LibUtilities::ShapeType m_shapeType
Stores the expansion/shape type that the matrix is to be based on.

◆ GetVarCoeff()

const Array< OneD, const NekDouble > & Nektar::MultiRegions::GlobalMatrixKey::GetVarCoeff ( const StdRegions::VarCoeffType coeff) const
inline

Definition at line 159 of file GlobalMatrixKey.h.

References m_varCoeffs.

160  {
161  auto found = m_varCoeffs.find(coeff);
162  return (*found).second;
163  }
StdRegions::VarCoeffMap m_varCoeffs

◆ GetVarCoeffs()

const StdRegions::VarCoeffMap & Nektar::MultiRegions::GlobalMatrixKey::GetVarCoeffs ( ) const
inline

◆ LocToGloMapIsDefined()

bool Nektar::MultiRegions::GlobalMatrixKey::LocToGloMapIsDefined ( void  ) const
inline

Returns true if a local to global map is defined.

Definition at line 126 of file GlobalMatrixKey.h.

References m_locToGloMap.

Referenced by Nektar::MultiRegions::ContField3D::GenGlobalLinSys(), Nektar::MultiRegions::ContField1D::GenGlobalLinSys(), Nektar::MultiRegions::ContField2D::GenGlobalLinSys(), Nektar::MultiRegions::ContField3D::GetGlobalMatrix(), Nektar::MultiRegions::ContField2D::GetGlobalMatrix(), Nektar::MultiRegions::ContField3D::GetGlobalMatrixNnz(), and Nektar::MultiRegions::ContField2D::GetGlobalMatrixNnz().

127  {
128  if( m_locToGloMap.lock().get() == 0) //NullAssemblyMapSharedPtr)
129  {
130  return false;
131  }
132 
133  return true;
134  }
std::weak_ptr< AssemblyMap > m_locToGloMap
Pointer to the local to global mapping.

Friends And Related Function Documentation

◆ operator<

bool operator< ( const GlobalMatrixKey lhs,
const GlobalMatrixKey rhs 
)
friend

Provides ordering of GlobalMatrixKey objects.

Definition at line 79 of file GlobalMatrixKey.cpp.

80  {
81  if(lhs.m_matrixType < rhs.m_matrixType)
82  {
83  return true;
84  }
85 
86  if(lhs.m_matrixType > rhs.m_matrixType)
87  {
88  return false;
89  }
90 
91 
92  if(lhs.m_shapeType < rhs.m_shapeType)
93  {
94  return true;
95  }
96 
97 
98  if(lhs.m_shapeType > rhs.m_shapeType)
99  {
100  return false;
101  }
102 
103  if(lhs.m_constFactors.size() < rhs.m_constFactors.size())
104  {
105  return true;
106  }
107  else if(lhs.m_constFactors.size() > rhs.m_constFactors.size())
108  {
109  return false;
110  }
111  else
112  {
113  StdRegions::ConstFactorMap::const_iterator x, y;
114  for(x = lhs.m_constFactors.begin(), y = rhs.m_constFactors.begin();
115  x != lhs.m_constFactors.end(); ++x, ++y)
116  {
117  if (x->second < y->second)
118  {
119  return true;
120  }
121  if (x->second > y->second)
122  {
123  return false;
124  }
125  }
126  }
127 
128  if(lhs.m_varCoeffs.size() < rhs.m_varCoeffs.size())
129  {
130  return true;
131  }
132  else if(lhs.m_varCoeffs.size() > rhs.m_varCoeffs.size())
133  {
134  return false;
135  }
136 // else
137 // {
138 // StdRegions::VarCoeffMap::const_iterator x, y;
139 // for (x = lhs.m_varCoeffs.begin(), y = rhs.m_varCoeffs.begin();
140 // x != lhs.m_varCoeffs.end(); ++x, ++y)
141 // {
142 // if (x->second.get() < y->second.get())
143 // {
144 // return true;
145 // }
146 // if (x->second.get() > y->second.get())
147 // {
148 // return false;
149 // }
150 // }
151 // }
152 
153  if(!rhs.m_locToGloMap.lock().get())
154  {
155  return false;
156  }
157  else if(!lhs.m_locToGloMap.lock().get() && rhs.m_locToGloMap.lock().get() )
158  {
159  return true;
160  }
161  if(lhs.m_locToGloMap.lock()->GetHash() < rhs.m_locToGloMap.lock()->GetHash())
162  {
163  return true;
164  }
165 
166  return false;
167  }
StandardMatrixTag & lhs
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

Member Data Documentation

◆ m_constFactors

StdRegions::ConstFactorMap Nektar::MultiRegions::GlobalMatrixKey::m_constFactors
protected

◆ m_locToGloMap

std::weak_ptr<AssemblyMap> Nektar::MultiRegions::GlobalMatrixKey::m_locToGloMap
protected

Pointer to the local to global mapping.

Definition at line 102 of file GlobalMatrixKey.h.

Referenced by LocToGloMapIsDefined(), and Nektar::MultiRegions::operator<().

◆ m_matrixType

StdRegions::MatrixType Nektar::MultiRegions::GlobalMatrixKey::m_matrixType
protected

Stores the matrix type based on the enum StdRegions::MatrixType.

Definition at line 92 of file GlobalMatrixKey.h.

Referenced by GetMatrixType(), and Nektar::MultiRegions::operator<().

◆ m_shapeType

LibUtilities::ShapeType Nektar::MultiRegions::GlobalMatrixKey::m_shapeType
protected

Stores the expansion/shape type that the matrix is to be based on.

Definition at line 96 of file GlobalMatrixKey.h.

Referenced by GetShapeType(), and Nektar::MultiRegions::operator<().

◆ m_varCoeffs

StdRegions::VarCoeffMap Nektar::MultiRegions::GlobalMatrixKey::m_varCoeffs
protected