Commit 2e456b81 authored by Dave Moxey's avatar Dave Moxey
Browse files

Cleanup whitespace

parent 22a93493
......@@ -58,25 +58,25 @@ namespace Nektar
/**
* @class Block Preconditioner
*
* This class implements Block preconditioning for the conjugate
* gradient matrix solver.
*/
* This class implements Block preconditioning for the conjugate
* gradient matrix solver.
*/
PreconditionerBlock::PreconditionerBlock(
const boost::shared_ptr<GlobalLinSys> &plinsys,
const AssemblyMapSharedPtr &pLocToGloMap)
const AssemblyMapSharedPtr &pLocToGloMap)
: Preconditioner(plinsys, pLocToGloMap),
m_linsys(plinsys),
m_preconType(pLocToGloMap->GetPreconType()),
m_locToGloMap(pLocToGloMap)
{
}
}
void PreconditionerBlock::v_InitObject()
{
GlobalSysSolnType solvertype=m_locToGloMap->GetGlobalSysSolnType();
ASSERTL0(solvertype == MultiRegions::eIterativeStaticCond,"Solver type not valid");
}
}
void PreconditionerBlock::v_BuildPreconditioner()
......@@ -89,7 +89,7 @@ namespace Nektar
return;
}
boost::shared_ptr<MultiRegions::ExpList>
boost::shared_ptr<MultiRegions::ExpList>
expList=((m_linsys.lock())->GetLocMat()).lock();
StdRegions::StdExpansionSharedPtr locExpansion;
locExpansion = expList->GetExp(0);
......@@ -110,25 +110,25 @@ namespace Nektar
}
/**
* \brief Construct a block preconditioner from
* \f$\mathbf{S}_{1}\f$
*
*\f[\mathbf{M}^{-1}=\left[\begin{array}{ccc}
* Diag[(\mathbf{S_{1}})_{vv}] & & \\ & (\mathbf{S}_{1})_{eb} & \\ & &
* (\mathbf{S}_{1})_{fb} \end{array}\right] \f]
*
* where \f$\mathbf{S}_{1}\f$ is the local schur complement matrix for
* each element.
*/
* \brief Construct a block preconditioner from
* \f$\mathbf{S}_{1}\f$
*
*\f[\mathbf{M}^{-1}=\left[\begin{array}{ccc}
* Diag[(\mathbf{S_{1}})_{vv}] & & \\ & (\mathbf{S}_{1})_{eb} & \\ & &
* (\mathbf{S}_{1})_{fb} \end{array}\right] \f]
*
* where \f$\mathbf{S}_{1}\f$ is the local schur complement matrix for
* each element.
*/
void PreconditionerBlock::BlockPreconditioner2D()
{
boost::shared_ptr<MultiRegions::ExpList>
boost::shared_ptr<MultiRegions::ExpList>
expList=((m_linsys.lock())->GetLocMat()).lock();
LocalRegions::ExpansionSharedPtr locExpansion;
GlobalLinSysKey m_linSysKey=(m_linsys.lock())->GetKey();
StdRegions::VarCoeffMap vVarCoeffMap;
int i, j, k, nel;
int nVerts, nEdges;
int nVerts, nEdges;
int eid, n, cnt, nedgemodes;
NekDouble zero = 0.0;
......@@ -150,7 +150,7 @@ namespace Nektar
int nDirBnd = m_locToGloMap->GetNumGlobalDirBndCoeffs();
int nNonDirVerts = m_locToGloMap->GetNumNonDirVertexModes();
//Vertex and edge preconditioner matrices
//Vertex and edge preconditioner matrices
VertBlk = MemoryManager<DNekMat>::
AllocateSharedPtr(nNonDirVerts,nNonDirVerts,zero,vertstorage);
......@@ -159,7 +159,7 @@ namespace Nektar
int n_exp = expList->GetNumElmts();
int nNonDirEdgeIDs=m_locToGloMap->GetNumNonDirEdges();
//set the number of blocks in the matrix
Array<OneD,unsigned int> n_blks(1+nNonDirEdgeIDs);
n_blks[0]=nNonDirVerts;
......@@ -174,9 +174,9 @@ namespace Nektar
const Array<OneD, const ExpListSharedPtr>& bndCondExp = expList->GetBndCondExpansions();
StdRegions::StdExpansion1DSharedPtr bndCondFaceExp;
LocalRegions::SegExpSharedPtr bndSegExp;
const Array<OneD, const SpatialDomains::BoundaryConditionShPtr>&
const Array<OneD, const SpatialDomains::BoundaryConditionShPtr>&
bndConditions = expList->GetBndConditions();
int meshVertId;
int meshEdgeId;
......@@ -188,7 +188,7 @@ namespace Nektar
{
bndSegExp = bndCondExp[i]->GetExp(j)
->as<LocalRegions::SegExp>();
if (bndConditions[i]->GetBoundaryConditionType() ==
if (bndConditions[i]->GetBoundaryConditionType() ==
SpatialDomains::eDirichlet)
{
meshEdgeId = (bndSegExp->GetGeom1D())->GetEid();
......@@ -209,7 +209,7 @@ namespace Nektar
for(cnt=n=0; n < n_exp; ++n)
{
nel = expList->GetOffset_Elmt_Id(n);
locExpansion = expList->GetExp(nel);
for (j = 0; j < locExpansion->GetNedges(); ++j)
......@@ -297,7 +297,7 @@ namespace Nektar
for(cnt=n=0; n < n_exp; ++n)
{
nel = expList->GetOffset_Elmt_Id(n);
locExpansion = expList->GetExp(nel);
nVerts=locExpansion->GetGeom()->GetNumVerts();
......@@ -305,7 +305,7 @@ namespace Nektar
//Get statically condensed matrix
loc_mat = (m_linsys.lock())->GetStaticCondBlock(n);
//Extract boundary block (elemental S1)
bnd_mat=loc_mat->GetBlock(0,0);
......@@ -319,17 +319,17 @@ namespace Nektar
for (v=0; v<nVerts; ++v)
{
vMap1=locExpansion->GetVertexMap(v);
//Get vertex map
globalrow = m_locToGloMap->
GetLocalToGlobalBndMap(cnt+vMap1)-nDirBnd;
if(globalrow >= 0)
{
for (m=0; m<nVerts; ++m)
{
vMap2=locExpansion->GetVertexMap(m);
//global matrix location (without offset due to
//dirichlet values)
globalcol = m_locToGloMap->
......@@ -345,7 +345,7 @@ namespace Nektar
GetLocalToGlobalBndSign(cnt + vMap1);
sign2 = m_locToGloMap->
GetLocalToGlobalBndSign(cnt + vMap2);
vertArray[globalrow]
+= sign1*sign2*S(vMap1,vMap2);
......@@ -355,18 +355,18 @@ namespace Nektar
}
}
}
//loop over edges of the element and return the edge map
for (eid=0; eid<nEdges; ++eid)
{
nedgemodes=locExpansion->GetEdgeNcoeffs(eid)-2;
DNekMatSharedPtr locMat =
DNekMatSharedPtr locMat =
MemoryManager<DNekMat>::AllocateSharedPtr
(nedgemodes,nedgemodes,zero,storage);
meshEdgeId = locExpansion->as<LocalRegions::Expansion2D>()->GetGeom2D()->GetEid(eid);
Array<OneD, unsigned int> edgemodearray =
Array<OneD, unsigned int> edgemodearray =
locExpansion->GetEdgeInverseBoundaryMap(eid);
if(edgeDirMap.count(meshEdgeId)==0)
......@@ -385,7 +385,7 @@ namespace Nektar
sign2 = m_locToGloMap->
GetLocalToGlobalBndSign(cnt + eMap2);
NekDouble globalEdgeValue =
NekDouble globalEdgeValue =
sign1*sign2*S(eMap1,eMap2);
EdgeBlockArray[edgematrixoffset+v*nedgemodes+m]=
......@@ -403,9 +403,9 @@ namespace Nektar
//Assemble edge matrices of each process
Array<OneD, NekDouble> GlobalEdgeBlock(ntotaledgeentries);
Vmath::Zero(ntotaledgeentries, GlobalEdgeBlock.get(), 1);
Vmath::Assmb(EdgeBlockArray.num_elements(),
EdgeBlockArray.get(),
localEdgeToGlobalMatrixMap.get(),
Vmath::Assmb(EdgeBlockArray.num_elements(),
EdgeBlockArray.get(),
localEdgeToGlobalMatrixMap.get(),
GlobalEdgeBlock.get());
//Exchange vertex data over different processes
......@@ -432,7 +432,7 @@ namespace Nektar
//Build the edge matrices from the vector
for(int loc=0; loc<nNonDirEdgeIDs; ++loc)
{
DNekMatSharedPtr gmat =
DNekMatSharedPtr gmat =
MemoryManager<DNekMat>::AllocateSharedPtr
(nedgemodes,nedgemodes,zero,storage);
......@@ -454,28 +454,28 @@ namespace Nektar
for (i=1; i< totblks; ++i)
{
unsigned int nmodes=m_blkMat->GetNumberOfRowsInBlockRow(i);
DNekMatSharedPtr tmp_mat =
DNekMatSharedPtr tmp_mat =
MemoryManager<DNekMat>::AllocateSharedPtr
(nmodes,nmodes,zero,storage);
tmp_mat=m_blkMat->GetBlock(i,i);
tmp_mat->Invert();
m_blkMat->SetBlock(i,i,tmp_mat);
}
}
/**
*
*/
void PreconditionerBlock::BlockPreconditioner3D()
{
boost::shared_ptr<MultiRegions::ExpList>
boost::shared_ptr<MultiRegions::ExpList>
expList=((m_linsys.lock())->GetLocMat()).lock();
LocalRegions::ExpansionSharedPtr locExpansion;
GlobalLinSysKey m_linSysKey=(m_linsys.lock())->GetKey();
StdRegions::VarCoeffMap vVarCoeffMap;
int i, j, k, nel;
int nVerts, nEdges,nFaces;
int nVerts, nEdges,nFaces;
int eid, fid, n, cnt, nedgemodes, nfacemodes;
NekDouble zero = 0.0;
......@@ -497,7 +497,7 @@ namespace Nektar
int nDirBnd = m_locToGloMap->GetNumGlobalDirBndCoeffs();
int nNonDirVerts = m_locToGloMap->GetNumNonDirVertexModes();
//Vertex, edge and face preconditioner matrices
//Vertex, edge and face preconditioner matrices
VertBlk = MemoryManager<DNekMat>::
AllocateSharedPtr(nNonDirVerts,nNonDirVerts,zero,vertstorage);
......@@ -507,7 +507,7 @@ namespace Nektar
int n_exp = expList->GetNumElmts();
int nNonDirEdgeIDs=m_locToGloMap->GetNumNonDirEdges();
int nNonDirFaceIDs=m_locToGloMap->GetNumNonDirFaces();
//set the number of blocks in the matrix
Array<OneD,unsigned int> n_blks(1+nNonDirEdgeIDs+nNonDirFaceIDs);
n_blks[0]=nNonDirVerts;
......@@ -547,7 +547,7 @@ namespace Nektar
for(j = 0; j < bndCondExp[i]->GetNumElmts(); j++)
{
bndCondFaceExp = bndCondExp[i]->GetExp(j)->as<StdRegions::StdExpansion2D>();
if (bndConditions[i]->GetBoundaryConditionType() ==
if (bndConditions[i]->GetBoundaryConditionType() ==
SpatialDomains::eDirichlet)
{
for(k = 0; k < bndCondFaceExp->GetNedges(); k++)
......@@ -578,7 +578,7 @@ namespace Nektar
for(cnt=n=0; n < n_exp; ++n)
{
nel = expList->GetOffset_Elmt_Id(n);
locExpansion = expList->GetExp(nel);
for (j = 0; j < locExpansion->GetNedges(); ++j)
......@@ -598,7 +598,7 @@ namespace Nektar
edgemodeoffset[edgematrixlocation]=dof*dof;
ntotaledgeentries+=dof*dof;
n_blks[1+edgematrixlocation++]=dof;
}
......@@ -615,7 +615,7 @@ namespace Nektar
for(cnt=n=0; n < n_exp; ++n)
{
nel = expList->GetOffset_Elmt_Id(n);
locExpansion = expList->GetExp(nel);
for (j = 0; j < locExpansion->GetNfaces(); ++j)
......@@ -632,11 +632,11 @@ namespace Nektar
uniqueFaceMap[meshFaceId]=facematrixlocation;
facemodeoffset[facematrixlocation]=dof*dof;
faceglobaloffset[facematrixlocation]+=ntotalfaceentries;
ntotalfaceentries+=dof*dof;
n_blks[1+nNonDirEdgeIDs+facematrixlocation++]=dof;
}
nlocalNonDirFaces+=dof*dof;
......@@ -708,10 +708,10 @@ namespace Nektar
for(k=0; k<nfacemodes*nfacemodes; ++k)
{
vGlobal=faceglobaloffset[uniqueFaceMap[meshFaceId]]+k;
localFaceToGlobalMatrixMap[facematrixoffset+k]
= vGlobal;
FaceBlockToUniversalMap[vGlobal]
= meshFaceId * maxFaceDof * maxFaceDof + k + 1;
}
......@@ -732,7 +732,7 @@ namespace Nektar
for(cnt=n=0; n < n_exp; ++n)
{
nel = expList->GetOffset_Elmt_Id(n);
locExpansion = expList->GetExp(nel);
nVerts=locExpansion->GetGeom()->GetNumVerts();
......@@ -741,7 +741,7 @@ namespace Nektar
//Get statically condensed matrix
loc_mat = (m_linsys.lock())->GetStaticCondBlock(n);
//Extract boundary block (elemental S1)
bnd_mat=loc_mat->GetBlock(0,0);
......@@ -755,17 +755,17 @@ namespace Nektar
for (v=0; v<nVerts; ++v)
{
vMap1=locExpansion->GetVertexMap(v);
//Get vertex map
globalrow = m_locToGloMap->
GetLocalToGlobalBndMap(cnt+vMap1)-nDirBnd;
if(globalrow >= 0)
{
for (m=0; m<nVerts; ++m)
{
vMap2=locExpansion->GetVertexMap(m);
//global matrix location (without offset due to
//dirichlet values)
globalcol = m_locToGloMap->
......@@ -781,7 +781,7 @@ namespace Nektar
GetLocalToGlobalBndSign(cnt + vMap1);
sign2 = m_locToGloMap->
GetLocalToGlobalBndSign(cnt + vMap2);
vertArray[globalrow]
+= sign1*sign2*S(vMap1,vMap2);
......@@ -791,16 +791,16 @@ namespace Nektar
}
}
}
//loop over edges of the element and return the edge map
for (eid=0; eid<nEdges; ++eid)
{
nedgemodes=locExpansion->GetEdgeNcoeffs(eid)-2;
DNekMatSharedPtr locMat =
DNekMatSharedPtr locMat =
MemoryManager<DNekMat>::AllocateSharedPtr
(nedgemodes,nedgemodes,zero,storage);
meshEdgeId = locExpansion->as<LocalRegions::Expansion3D>()->GetGeom3D()->GetEid(eid);
Array<OneD, unsigned int> edgemodearray = locExpansion->GetEdgeInverseBoundaryMap(eid);
......@@ -828,18 +828,18 @@ namespace Nektar
edgematrixoffset+=nedgemodes*nedgemodes;
}
}
//loop over faces of the element and return the face map
for (fid=0; fid<nFaces; ++fid)
{
nfacemodes = locExpansion->GetFaceIntNcoeffs(fid);
DNekMatSharedPtr locMat =
DNekMatSharedPtr locMat =
MemoryManager<DNekMat>::AllocateSharedPtr
(nfacemodes,nfacemodes,zero,storage);
meshFaceId = locExpansion->as<LocalRegions::Expansion3D>()->GetGeom3D()->GetFid(fid);
Array<OneD, unsigned int> facemodearray = locExpansion->GetFaceInverseBoundaryMap(fid);
if(faceDirMap.count(meshFaceId)==0)
......@@ -876,17 +876,17 @@ namespace Nektar
//Assemble edge matrices of each process
Array<OneD, NekDouble> GlobalEdgeBlock(ntotaledgeentries);
Vmath::Zero(ntotaledgeentries, GlobalEdgeBlock.get(), 1);
Vmath::Assmb(EdgeBlockArray.num_elements(),
EdgeBlockArray.get(),
localEdgeToGlobalMatrixMap.get(),
Vmath::Assmb(EdgeBlockArray.num_elements(),
EdgeBlockArray.get(),
localEdgeToGlobalMatrixMap.get(),
GlobalEdgeBlock.get());
//Assemble face matrices of each process
Array<OneD, NekDouble> GlobalFaceBlock(ntotalfaceentries);
Vmath::Zero(ntotalfaceentries, GlobalFaceBlock.get(), 1);
Vmath::Assmb(FaceBlockArray.num_elements(),
FaceBlockArray.get(),
localFaceToGlobalMatrixMap.get(),
Vmath::Assmb(FaceBlockArray.num_elements(),
FaceBlockArray.get(),
localFaceToGlobalMatrixMap.get(),
GlobalFaceBlock.get());
//Exchange vertex data over different processes
......@@ -917,7 +917,7 @@ namespace Nektar
//Build the edge matrices from the vector
for(int loc=0; loc<nNonDirEdgeIDs; ++loc)
{
DNekMatSharedPtr gmat =
DNekMatSharedPtr gmat =
MemoryManager<DNekMat>::AllocateSharedPtr
(nedgemodes,nedgemodes,zero,storage);
......@@ -941,7 +941,7 @@ namespace Nektar
{
nfacemodes=n_blks[1+nNonDirEdgeIDs+loc];
DNekMatSharedPtr gmat =
DNekMatSharedPtr gmat =
MemoryManager<DNekMat>::AllocateSharedPtr
(nfacemodes,nfacemodes,zero,storage);
......@@ -959,15 +959,15 @@ namespace Nektar
offset+=facemodeoffset[loc];
}
int totblks=m_blkMat->GetNumberOfBlockRows();
for (i=1; i< totblks; ++i)
{
unsigned int nmodes=m_blkMat->GetNumberOfRowsInBlockRow(i);
DNekMatSharedPtr tmp_mat =
DNekMatSharedPtr tmp_mat =
MemoryManager<DNekMat>::AllocateSharedPtr
(nmodes,nmodes,zero,storage);
tmp_mat=m_blkMat->GetBlock(i,i);
tmp_mat->Invert();
......@@ -1146,9 +1146,3 @@ namespace Nektar
}
}
}
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