Commit 4e69d686 authored by David Moxey's avatar David Moxey
Browse files

Clean a few things up

parent 946e3457
......@@ -75,30 +75,20 @@ namespace Nektar
{
const int nHomDofs = pNumRows - pNumDir;
int i;
for (i = pNumDir; i < pNumRows; ++i)
{
VecSetValue(m_b, m_reorderedMap[i-pNumDir], pInput[i], INSERT_VALUES);
}
VecSetValues(m_b, nHomDofs, &m_reorderedMap[0], &pInput[pNumDir], INSERT_VALUES);
VecAssemblyBegin(m_b);
VecAssemblyEnd (m_b);
VecView(m_b, PETSC_VIEWER_STDOUT_WORLD);
PetscErrorCode ierr = KSPSolve(m_ksp, m_b, m_x);
PetscInt its;
KSPGetIterationNumber(m_ksp,&its);
cout << "iteration = " << its << endl;
//VecCreate (PETSC_COMM_WORLD, &m_x);
//VecSetSizes (m_x, nLocal, PETSC_DECIDE);
//VecSetFromOptions(m_x);
IS isGlobal, isLocal;
ISCreateGeneral(PETSC_COMM_SELF, nHomDofs, &m_reorderedMap[0], PETSC_COPY_VALUES, &isGlobal);
ISCreateStride(PETSC_COMM_SELF, nHomDofs, 0, 1, &isLocal);
//ISView(isGlobal, PETSC_VIEWER_STDOUT_SELF);
Vec locVec;
VecCreate (PETSC_COMM_SELF, &locVec);
......@@ -107,18 +97,12 @@ namespace Nektar
VecScatter ctx;
VecScatterCreate(m_x, isGlobal, locVec, isLocal, &ctx);
//VecScatterView(ctx, PETSC_VIEWER_STDOUT_WORLD);
VecScatterBegin(ctx, m_x, locVec, INSERT_VALUES, SCATTER_FORWARD);
VecScatterEnd(ctx, m_x, locVec, INSERT_VALUES, SCATTER_FORWARD);
PetscScalar *avec;
VecGetArray(locVec, &avec);
for (i = 0; i < pNumRows - pNumDir; ++i)
{
pOutput[i] = avec[i];
}
Vmath::Vcopy(nHomDofs, avec, 1, &pOutput[0], 1);
VecRestoreArray(locVec, &avec);
}
}
......
......@@ -134,14 +134,6 @@ namespace Nektar
uniIdReorder[allUniIds[n]] = cnt++;
}
map<int,int>::iterator mIt;
for (mIt = uniIdReorder.begin(); mIt != uniIdReorder.end(); ++mIt)
{
cout << "RANK " << vComm->GetRank() << ": " << mIt->first
<< " -> " << mIt->second << endl;
}
for (n = cnt = 0; n < m_expList.lock()->GetNumElmts(); ++n)
{
loc_mat = GetBlock(m_expList.lock()->GetOffset_Elmt_Id(n));
......@@ -154,7 +146,7 @@ namespace Nektar
if (gid1 >= 0)
{
int uniid = pLocToGloMap->GetGlobalToUniversalMap(gid1 + nDirDofs);
ASSERTL0(uniIdReorder.count(uniid) > 0, "wat");
ASSERTL0(uniIdReorder.count(uniid) > 0, "Error in ordering");
m_reorderedMap[gid1] = uniIdReorder[uniid];
}
}
......@@ -254,8 +246,6 @@ namespace Nektar
MatAssemblyBegin(m_matrix,MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(m_matrix,MAT_FINAL_ASSEMBLY);
MatView(m_matrix, PETSC_VIEWER_STDOUT_WORLD);
// CONSTRUCT KSP OBJECT
KSPCreate(PETSC_COMM_WORLD, &m_ksp);
KSPSetTolerances(
......@@ -285,8 +275,13 @@ namespace Nektar
int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
Array<OneD, NekDouble> tmp(nGlobDofs), tmp2;
int check = nDirDofs > 0 ? 1 : 0;
LibUtilities::CommSharedPtr vComm
= m_expList.lock()->GetSession()->GetComm();
vComm->AllReduce(check, LibUtilities::ReduceMax);
if(nDirDofs)
if(check)
{
// calculate the dirichlet forcing
if(dirForcCalculated)
......
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