Commit 9bf11700 authored by Spencer Sherwin's avatar Spencer Sherwin

Updates LowEnergyPrecon and XXt to handle mass matrices as well as a Helmholtz system

parent e34c74c4
......@@ -1589,11 +1589,13 @@ namespace Nektar
RT.SetValue(i, i, 1.0);
}
if (matrixType == StdRegions::ePreconR)
if ((matrixType == StdRegions::ePreconR)||
(matrixType == StdRegions::ePreconRMass))
{
return m_transformationmatrix;
}
else if (matrixType == StdRegions::ePreconRT)
else if ((matrixType == StdRegions::ePreconRT)||
(matrixType == StdRegions::ePreconRTMass))
{
return m_transposedtransformationmatrix;
}
......
......@@ -1730,6 +1730,17 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconLinearSpaceMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekMatSharedPtr R=BuildVertexMatrix(A);
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconR:
{
NekDouble one = 1.0;
......@@ -1756,6 +1767,32 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,RT);
}
break;
case StdRegions::ePreconRMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconRTMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr RT=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,RT);
}
break;
default:
{
NekDouble one = 1.0;
......
......@@ -1473,16 +1473,24 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconLinearSpaceMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekMatSharedPtr R=BuildVertexMatrix(A);
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconR:
{
NekDouble one = 1.0;
MatrixKey helmkey(StdRegions::eHelmholtz, mkey.GetShapeType(), *this,mkey.GetConstFactors(), mkey.GetVarCoeffs());
DNekScalBlkMatSharedPtr helmStatCond = GetLocStaticCondMatrix(helmkey);
DNekScalMatSharedPtr A =helmStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Blk01 =helmStatCond->GetBlock(0,1);
DNekScalMatSharedPtr Blk10 =helmStatCond->GetBlock(1,0);
DNekScalMatSharedPtr Blk11 =helmStatCond->GetBlock(1,1);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
......@@ -1495,9 +1503,32 @@ namespace Nektar
MatrixKey helmkey(StdRegions::eHelmholtz, mkey.GetShapeType(), *this,mkey.GetConstFactors(), mkey.GetVarCoeffs());
DNekScalBlkMatSharedPtr helmStatCond = GetLocStaticCondMatrix(helmkey);
DNekScalMatSharedPtr A =helmStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Blk01 =helmStatCond->GetBlock(0,1);
DNekScalMatSharedPtr Blk10 =helmStatCond->GetBlock(1,0);
DNekScalMatSharedPtr Blk11 =helmStatCond->GetBlock(1,1);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconRMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconRTMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
......
......@@ -1232,6 +1232,17 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconLinearSpaceMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekMatSharedPtr R=BuildVertexMatrix(A);
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconR:
{
NekDouble one = 1.0;
......@@ -1258,6 +1269,32 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,RT);
}
break;
case StdRegions::ePreconRMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr StatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =StatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconRTMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr RT=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,RT);
}
break;
default:
{
//ASSERTL0(false, "Missing definition for " + (*StdRegions::MatrixTypeMap[mkey.GetMatrixType()]));
......
......@@ -205,7 +205,8 @@ namespace Nektar
// and the number of matrix entries for each block
// Dimension of matrix is just the linear vertex space
if(m_linSysKey.GetMatrixType() == StdRegions::ePreconLinearSpace)
if((m_linSysKey.GetMatrixType() == StdRegions::ePreconLinearSpace)
||(m_linSysKey.GetMatrixType() == StdRegions::ePreconLinearSpaceMass))
{
for (n = 0; n < nElmt; ++n)
{
......
......@@ -87,12 +87,24 @@ namespace Nektar
m_vertLocToGloMap = m_locToGloMap->XxtLinearSpaceMap(*expList);
// Generate XXT system.
GlobalLinSysKey preconKey(StdRegions::ePreconLinearSpace,
m_vertLocToGloMap,
(m_linsys.lock())->GetKey().GetConstFactors());
if(m_linsys.lock()->GetKey().GetMatrixType() == StdRegions::eMass)
{
GlobalLinSysKey preconKey(StdRegions::ePreconLinearSpaceMass,
m_vertLocToGloMap);
m_vertLinsys = MemoryManager<GlobalLinSysXxtFull>::
AllocateSharedPtr(preconKey,expList,m_vertLocToGloMap);
}
else
{
GlobalLinSysKey preconKey(StdRegions::ePreconLinearSpace,
m_vertLocToGloMap,
(m_linsys.lock())->GetKey().GetConstFactors());
m_vertLinsys = MemoryManager<GlobalLinSysXxtFull>::
AllocateSharedPtr(preconKey,expList,m_vertLocToGloMap);
}
m_vertLinsys = MemoryManager<GlobalLinSysXxtFull>::
AllocateSharedPtr(preconKey,expList,m_vertLocToGloMap);
}
......
......@@ -1704,58 +1704,62 @@ namespace Nektar
}
}
StdRegions::MatrixType PreconR,PreconRT;
if(m_linSysKey.GetMatrixType() == StdRegions::eMass)
{
PreconR = StdRegions::ePreconRMass;
PreconRT = StdRegions::ePreconRTMass;
}
else
{
PreconR = StdRegions::ePreconR;
PreconRT = StdRegions::ePreconRT;
}
/*
* Matrix keys - for each element type there are two matrix keys
* corresponding to the transformation matrix R and its transpose
*/
//Matrix keys for tetrahedral element transformation matrix
LocalRegions::MatrixKey TetR
(StdRegions::ePreconR,
LibUtilities::eTetrahedron,
*TetExp,
m_linSysKey.GetConstFactors(),
(PreconR, LibUtilities::eTetrahedron,
*TetExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for tetrahedral transposed transformation matrix
LocalRegions::MatrixKey TetRT
(StdRegions::ePreconRT,
LibUtilities::eTetrahedron,
*TetExp,
m_linSysKey.GetConstFactors(),
(PreconRT, LibUtilities::eTetrahedron,
*TetExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for prismatic element transformation matrix
LocalRegions::MatrixKey PrismR
(StdRegions::ePreconR,
LibUtilities::ePrism,
*PrismExp,
m_linSysKey.GetConstFactors(),
(PreconR, LibUtilities::ePrism,
*PrismExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for prismatic element transposed transformation matrix
LocalRegions::MatrixKey PrismRT
(StdRegions::ePreconRT,
LibUtilities::ePrism,
*PrismExp,
m_linSysKey.GetConstFactors(),
(PreconRT, LibUtilities::ePrism,
*PrismExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for hexahedral element transformation matrix
LocalRegions::MatrixKey HexR
(StdRegions::ePreconR,
LibUtilities::eHexahedron,
*HexExp,
m_linSysKey.GetConstFactors(),
(PreconR, LibUtilities::eHexahedron,
*HexExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for hexahedral element transposed transformation
//matrix
LocalRegions::MatrixKey HexRT
(StdRegions::ePreconRT,
LibUtilities::eHexahedron,
*HexExp,
m_linSysKey.GetConstFactors(),
(PreconRT, LibUtilities::eHexahedron,
*HexExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
/*
......
......@@ -138,7 +138,10 @@ namespace Nektar
eFwdTrans,
ePreconR,
ePreconRT,
ePreconRMass,
ePreconRTMass,
ePreconLinearSpace,
ePreconLinearSpaceMass,
eInterpGauss,
eGaussDG,
SIZE_MatrixType
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment