44 namespace MultiRegions
57 "PETSc Full Matrix.");
63 const boost::weak_ptr<ExpList> &pExp,
64 const boost::shared_ptr<AssemblyMap> &pLocToGloMap)
69 "This routine should only be used when using a Full PETSc"
72 const int nDofs = pLocToGloMap->GetNumGlobalCoeffs();
73 const int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
75 int i, j, n, cnt, gid1, gid2, loc_lda;
81 pLocToGloMap->GetGlobalToUniversalMapUnique(),
88 for(n = cnt = 0; n <
m_expList.lock()->GetNumElmts(); ++n)
91 loc_lda = loc_mat->GetRows();
93 for(i = 0; i < loc_lda; ++i)
95 gid1 = pLocToGloMap->GetLocalToGlobalMap(cnt+i) - nDirDofs;
96 sign1 = pLocToGloMap->GetLocalToGlobalSign(cnt + i);
100 for(j = 0; j < loc_lda; ++j)
102 gid2 = pLocToGloMap->GetLocalToGlobalMap(cnt + j)
104 sign2 = pLocToGloMap->GetLocalToGlobalSign(cnt + j);
108 value = sign1*sign2*(*loc_mat)(i,j);
110 m_matrix, gid1ro, gid2ro, value, ADD_VALUES);
119 MatAssemblyBegin(
m_matrix, MAT_FINAL_ASSEMBLY);
120 MatAssemblyEnd (
m_matrix, MAT_FINAL_ASSEMBLY);
126 SetUpSolver(pLocToGloMap->GetIterativeTolerance());
140 const Array<OneD, const NekDouble> &pInput,
141 Array<OneD, NekDouble> &pOutput,
143 const Array<OneD, const NekDouble> &pDirForcing)
145 bool dirForcCalculated = (bool) pDirForcing.num_elements();
146 int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
147 int nGlobDofs = pLocToGloMap->GetNumGlobalCoeffs();
148 Array<OneD, NekDouble> tmp(nGlobDofs), tmp2;
150 int nDirTotal = nDirDofs;
151 m_expList.lock()->GetComm()->GetRowComm()->AllReduce(
157 if(dirForcCalculated)
161 pDirForcing.get(), 1,
177 Array<OneD, NekDouble> out(nGlobDofs,0.0);
179 Vmath::Vadd(nGlobDofs-nDirDofs, &out [nDirDofs], 1,
180 &pOutput[nDirDofs], 1, &pOutput[nDirDofs], 1);