46 namespace MultiRegions
60 "IterativeStaticCond",
62 "Iterative static condensation.");
66 "IterativeMultiLevelStaticCond",
68 "Iterative multi-level static condensation.");
73 "LocalMatrixStorageStrategy",
77 "LocalMatrixStorageStrategy",
81 "LocalMatrixStorageStrategy",
85 "LocalMatrixStorageStrategy",
111 const boost::weak_ptr<ExpList> &pExpList,
112 const boost::shared_ptr<AssemblyMap> &pLocToGloMap)
119 "This constructor is only valid when using static "
122 == pLocToGloMap->GetGlobalSysSolnType(),
123 "The local to global map is not set up for the requested "
133 const boost::weak_ptr<ExpList> &pExpList,
138 const boost::shared_ptr<AssemblyMap> &pLocToGloMap,
156 std::string PreconType
165 int n, n_exp =
m_expList.lock()->GetNumElmts();
168 const Array<OneD,const unsigned int>& nbdry_size
175 for (n = 0; n < n_exp; ++n)
185 for (n = 0; n < n_exp; ++n)
192 m_expList.lock()->GetOffset_Elmt_Id(n), mat);
216 unsigned int nbdry = localMat->GetRows();
217 unsigned int nblks = 1;
218 unsigned int esize[1] = {nbdry};
222 schurComplBlock->SetBlock(0, 0, localMat);
224 return schurComplBlock;
235 int i,j,n,cnt,gid1,gid2;
238 bool doGlobalOp =
m_expList.lock()->GetGlobalOptParam()->
250 std::string PreconType
263 int nBndDofs = pLocToGloMap->GetNumGlobalBndCoeffs();
264 int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
265 unsigned int rows = nBndDofs - NumDirBCs;
266 unsigned int cols = nBndDofs - NumDirBCs;
278 for(n = cnt = 0; n <
m_schurCompl->GetNumberOfBlockRows(); ++n)
281 loc_lda = loc_mat->GetRows();
284 for(i = 0; i < loc_lda; ++i)
286 gid1 = pLocToGloMap->GetLocalToGlobalBndMap (cnt + i)
288 sign1 = pLocToGloMap->GetLocalToGlobalBndSign(cnt + i);
292 for(j = 0; j < loc_lda; ++j)
294 gid2 = pLocToGloMap->GetLocalToGlobalBndMap(cnt+j)
296 sign2 = pLocToGloMap->GetLocalToGlobalBndSign(cnt+j);
300 gmat_coo[std::make_pair(gid1,gid2)] +=
301 sign1*sign2*(*loc_mat)(i,j);
333 GetSolverInfoAsEnum<LocalMatrixStorageStrategy>(
334 "LocalMatrixStorageStrategy");
336 switch(storageStrategy)
341 size_t storageSize = 0;
344 m_scale = Array<OneD, NekDouble> (nBlk, 1.0);
345 m_rows = Array<OneD, unsigned int> (nBlk, 0U);
348 for (
int i = 0; i < nBlk; ++i)
366 for (
unsigned int n = 0; n < nBlk; ++n)
372 int loc_lda = loc_mat->GetRows();
373 int blockSize = loc_lda * loc_lda;
375 for(
int i = 0; i < loc_lda; ++i)
377 for(
int j = 0; j < loc_lda; ++j)
379 ptr[j*loc_lda+i] = (*loc_mat)(i,j);
402 std::vector<std::pair<int,int> > partitions;
403 for(
int n = 0; n <
m_schurCompl->GetNumberOfBlockRows(); ++n)
406 loc_lda = loc_mat->GetRows();
409 boost::lexical_cast<std::string>(n) +
"-th "
410 "matrix block in Schur complement has "
413 if (blockSize == loc_lda)
415 partitions[partitions.size()-1].first++;
420 partitions.push_back(make_pair(1,loc_lda));
428 sparseStorage (partitions.size());
430 for (
int part = 0, n = 0; part < partitions.size(); ++part)
434 for(
int k = 0; k < partitions[part].first; ++k, ++n)
437 loc_lda = loc_mat->GetRows();
439 ASSERTL1(loc_lda == partitions[part].second,
440 boost::lexical_cast<std::string>(n) +
"-th"
441 " matrix block in Schur complement has "
445 loc_lda*loc_lda, loc_mat->GetRawPtr());
451 sparseStorage[part] =
454 partitions[part].first, partitions[part].first,
455 partitions[part].second, partMat, matStorage );
466 LocalMatrixStorageStrategy takes values \
467 Contiguous, Non-contiguous and Sparse");
475 const Array<OneD, NekDouble>& pInput,
476 Array<OneD, NekDouble>& pOutput)
480 bool doGlobalOp =
m_expList.lock()->GetGlobalOptParam()->
486 Array<OneD, NekDouble> in = pInput + nDir;
487 Array<OneD, NekDouble> out = pOutput + nDir;
495 Array<OneD, NekDouble> tmp =
m_wsp + nLocal;
506 Array<OneD, NekDouble> tmpout =
m_wsp + nLocal;
509 const int rows =
m_rows[i];
510 Blas::Dgemv(
'N', rows, rows,
513 0.0, tmpout.get()+cnt, 1);
540 Array<OneD, NekDouble>& pInOut,
543 m_precon->DoTransformToLowEnergy(pInOut, offset);
547 Array<OneD, NekDouble>& pInOut)
549 m_precon->DoTransformFromLowEnergy(pInOut);
554 const boost::weak_ptr<ExpList> &pExpList,
559 const boost::shared_ptr<AssemblyMap> &l2gMap)
563 mkey, pExpList, pSchurCompl, pBinvD, pC, pInvD, l2gMap,
565 sys->Initialise(l2gMap);