74    const std::shared_ptr<AssemblyMap> &pLocToGloMap)
 
   75    : 
GlobalLinSys(pKey, pExpList, pLocToGloMap), m_locToGloMap(pLocToGloMap)
 
  105             "GlobalLinSysStaticCond: Not setup for dirForcing");
 
  107    bool atLastLevel = pLocToGloMap->AtLastLevel();
 
  108    int scLevel      = pLocToGloMap->GetStaticCondLevel();
 
  110    int nGlobDofs    = pLocToGloMap->GetNumGlobalCoeffs();
 
  111    int nLocBndDofs  = pLocToGloMap->GetNumLocalBndCoeffs();
 
  112    int nGlobBndDofs = pLocToGloMap->GetNumGlobalBndCoeffs();
 
  113    int nDirBndDofs  = pLocToGloMap->GetNumGlobalDirBndCoeffs();
 
  114    int nIntDofs     = nGlobDofs - nGlobBndDofs;
 
  116    if ((nGlobDofs - nDirBndDofs) == 0)
 
  126    unused = 
m_wsp + 1 * nLocBndDofs;
 
  127    F_bnd1 = 
m_wsp + 2 * nLocBndDofs;
 
  128    V_bnd  = 
m_wsp + 3 * nLocBndDofs;
 
  129    F_int  = 
m_wsp + 4 * nLocBndDofs;
 
  131    pLocToGloMap->LocalToLocalBnd(pLocOutput, V_bnd);
 
  142    if (nGlobBndDofs - nDirBndDofs)
 
  144        pLocToGloMap->LocalToLocalBnd(pLocInput, F_bnd);
 
  157            F_Bnd = BinvD * F_Int;
 
  159            Vmath::Vsub(nLocBndDofs, F_bnd, 1, F_bnd1, 1, F_bnd, 1);
 
  172            F_Bnd = SchurCompl * V_Bnd;
 
  174            Vmath::Vsub(nLocBndDofs, F_bnd, 1, F_bnd1, 1, F_bnd, 1);
 
  183            Vmath::Vadd(nLocBndDofs, V_bnd, 1, F_bnd1, 1, V_bnd, 1);
 
  194                pLocToGloMap->GetNextLevelLocalToGlobalMap();
 
  198            nextLevLocToGloMap->PatchAssemble(F_bnd, F_bnd);
 
  199            nextLevLocToGloMap->PatchLocalToGlobal(V_bnd, V_bnd);
 
  204            nextLevLocToGloMap->PatchGlobalToLocal(V_bnd, V_bnd);
 
  221        F_Int = F_Int - C * V_Bnd;
 
  237    const std::shared_ptr<AssemblyMap> &pLocToGloMap)
 
  239    int nLocalBnd = 
m_locToGloMap.lock()->GetNumLocalBndCoeffs();
 
  240    int nIntDofs  = 
m_locToGloMap.lock()->GetNumLocalCoeffs() - nLocalBnd;
 
  243    if (pLocToGloMap->AtLastLevel())
 
  250            pLocToGloMap->GetNextLevelLocalToGlobalMap());
 
  267    const std::shared_ptr<AssemblyMap> &pLocToGloMap)
 
  270    int n_exp = 
m_expList.lock()->GetNumElmts();
 
  273        pLocToGloMap->GetNumLocalBndCoeffsPerPatch();
 
  275        pLocToGloMap->GetNumLocalIntCoeffsPerPatch();
 
  280        nbdry_size, nbdry_size, blkmatStorage);
 
  282        nbdry_size, nint_size, blkmatStorage);
 
  284        nint_size, nbdry_size, blkmatStorage);
 
  286        nint_size, nint_size, blkmatStorage);
 
  288    for (n = 0; n < n_exp; ++n)
 
  300            m_schurCompl->SetBlock(n, n, t = loc_schur->GetBlock(0, 0));
 
  301            m_BinvD->SetBlock(n, n, t = loc_schur->GetBlock(0, 1));
 
  302            m_C->SetBlock(n, n, t = loc_schur->GetBlock(1, 0));
 
  303            m_invD->SetBlock(n, n, t = loc_schur->GetBlock(1, 1));
 
  326            pLocToGloMap->GetNumLocalBndCoeffsPerPatch();
 
  328            pLocToGloMap->GetNumLocalIntCoeffsPerPatch();
 
  346        int nPatches  = pLocToGloMap->GetNumPatches();
 
  352        for (i = 0; i < nPatches; i++)
 
  354            nEntriesA += nBndDofsPerPatch[i] * nBndDofsPerPatch[i];
 
  355            nEntriesB += nBndDofsPerPatch[i] * nIntDofsPerPatch[i];
 
  356            nEntriesC += nIntDofsPerPatch[i] * nBndDofsPerPatch[i];
 
  357            nEntriesD += nIntDofsPerPatch[i] * nIntDofsPerPatch[i];
 
  392        for (i = 0; i < nPatches; i++)
 
  395            tmparray               = storageA + cntA;
 
  397                nBndDofsPerPatch[i], nBndDofsPerPatch[i], tmparray, wType);
 
  399            tmparray               = storageB + cntB;
 
  401                nBndDofsPerPatch[i], nIntDofsPerPatch[i], tmparray, wType);
 
  403            tmparray               = storageC + cntC;
 
  405                nIntDofsPerPatch[i], nBndDofsPerPatch[i], tmparray, wType);
 
  407            tmparray               = storageD + cntD;
 
  409                nIntDofsPerPatch[i], nIntDofsPerPatch[i], tmparray, wType,
 
  412            cntA += nBndDofsPerPatch[i] * nBndDofsPerPatch[i];
 
  413            cntB += nBndDofsPerPatch[i] * nIntDofsPerPatch[i];
 
  414            cntC += nIntDofsPerPatch[i] * nBndDofsPerPatch[i];
 
  415            cntD += nIntDofsPerPatch[i] * nIntDofsPerPatch[i];
 
  422        int schurComplSubMatnRows;
 
  427        for (n = cnt = 0; n < SchurCompl->GetNumberOfBlockRows(); ++n)
 
  429            schurComplSubMat      = SchurCompl->GetBlock(n, n);
 
  430            schurComplSubMatnRows = schurComplSubMat->GetRows();
 
  433                pLocToGloMap->GetPatchMapFromPrevLevel()->GetPatchId() + cnt;
 
  434            dofId = pLocToGloMap->GetPatchMapFromPrevLevel()->GetDofId() + cnt;
 
  436                pLocToGloMap->GetPatchMapFromPrevLevel()->IsBndDof() + cnt;
 
  437            sign = pLocToGloMap->GetPatchMapFromPrevLevel()->GetSign() + cnt;
 
  440            for (i = 0; i < schurComplSubMatnRows; ++i)
 
  442                int pId = patchId[i];
 
  444                    substructuredMat[0][pId]->GetPtr();
 
  446                    substructuredMat[1][patchId[i]]->GetPtr();
 
  448                    substructuredMat[2][patchId[i]]->GetPtr();
 
  450                int subMat0rows          = substructuredMat[0][pId]->GetRows();
 
  451                int subMat1rows          = substructuredMat[1][pId]->GetRows();
 
  452                int subMat2rows          = substructuredMat[2][pId]->GetRows();
 
  456                    for (j = 0; j < schurComplSubMatnRows; ++j)
 
  459                                 "These values should be equal");
 
  463                            subMat0[dofId[i] + dofId[j] * subMat0rows] +=
 
  464                                sign[i] * 
sign[j] * (*schurComplSubMat)(i, j);
 
  468                            subMat1[dofId[i] + dofId[j] * subMat1rows] +=
 
  469                                sign[i] * 
sign[j] * (*schurComplSubMat)(i, j);
 
  475                    for (j = 0; j < schurComplSubMatnRows; ++j)
 
  478                                 "These values should be equal");
 
  482                            subMat2[dofId[i] + dofId[j] * subMat2rows] +=
 
  483                                sign[i] * 
sign[j] * (*schurComplSubMat)(i, j);
 
  489                                if (dofId[i] <= dofId[j])
 
  491                                    (*subMat3)(dofId[i], dofId[j]) +=
 
  493                                        (*schurComplSubMat)(i, j);
 
  498                                (*subMat3)(dofId[i], dofId[j]) +=
 
  500                                    (*schurComplSubMat)(i, j);
 
  506            cnt += schurComplSubMatnRows;
 
  511        for (i = 0; i < nPatches; i++)
 
  513            if (nIntDofsPerPatch[i])
 
  516                    substructuredMat[0][i]->GetPtr();
 
  518                    substructuredMat[1][i]->GetPtr();
 
  520                    substructuredMat[2][i]->GetPtr();
 
  521                int subMat0rows = substructuredMat[0][i]->GetRows();
 
  522                int subMat1rows = substructuredMat[1][i]->GetRows();
 
  523                int subMat2rows = substructuredMat[2][i]->GetRows();
 
  524                int subMat2cols = substructuredMat[2][i]->GetColumns();
 
  527                substructuredMat[3][i]->Invert();
 
  529                (*substructuredMat[1][i]) =
 
  530                    (*substructuredMat[1][i]) * (*substructuredMat[3][i]);
 
  535                if (subMat1rows && subMat2cols)
 
  537                    Blas::Dgemm(
'N', 
'N', subMat1rows, subMat2cols, subMat2rows,
 
  538                                -1.0, &subMat1[0], subMat1rows, &subMat2[0],
 
  539                                subMat2rows, 1.0, &subMat0[0], subMat0rows);
 
  548            pLocToGloMap->GetNumLocalBndCoeffsPerPatch();
 
  550            pLocToGloMap->GetNumLocalIntCoeffsPerPatch();
 
  554            nbdry_size, nbdry_size, blkmatStorage);
 
  556            nbdry_size, nint_size, blkmatStorage);
 
  558            nint_size, nbdry_size, blkmatStorage);
 
  560            nint_size, nint_size, blkmatStorage);
 
  563        for (i = 0; i < nPatches; i++)
 
  565            for (j = 0; j < 4; j++)
 
  568                    1.0, substructuredMat[j][i]);
 
  569                blkMatrices[j]->SetBlock(i, i, tmpscalmat);
 
  582                  blkMatrices[2], blkMatrices[3], pLocToGloMap);
 
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define sign(a, b)
return the sign(b)*a
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
const std::weak_ptr< ExpList > m_expList
Local Matrix System.
void SolveLinearSystem(const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir=0)
Solve the linear system for given input and output vectors.
const GlobalLinSysKey m_linSysKey
Key associated with this linear system.
virtual DNekScalMatSharedPtr v_GetBlock(unsigned int n)
Retrieves the block matrix from n-th expansion using the matrix key provided by the m_linSysKey.
virtual DNekScalBlkMatSharedPtr v_GetStaticCondBlock(unsigned int n)
Retrieves a the static condensation block matrices from n-th expansion using the matrix key provided ...
void Initialise(const std::shared_ptr< AssemblyMap > &pLocToGloMap)
Describe a linear system.
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
virtual void v_CoeffsFwdTransform(const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
std::weak_ptr< AssemblyMap > m_locToGloMap
Local to global map.
void SetupTopLevel(const std::shared_ptr< AssemblyMap > &locToGloMap)
Set up the storage for the Schur complement or the top level of the multi-level Schur complement.
~GlobalLinSysStaticCond() override
Array< OneD, NekDouble > m_wsp
Workspace array for matrix multiplication.
virtual void v_AssembleSchurComplement(std::shared_ptr< AssemblyMap > pLoctoGloMap)
GlobalLinSysStaticCond(const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.
void v_InitObject() override
virtual void v_PreSolve(int scLevel, Array< OneD, NekDouble > &F_bnd)
virtual void v_BasisFwdTransform(Array< OneD, NekDouble > &pInOut)
GlobalLinSysStaticCondSharedPtr m_recursiveSchurCompl
Schur complement for Direct Static Condensation.
virtual void v_CoeffsBwdTransform(Array< OneD, NekDouble > &pInOut)
void v_Initialise(const std::shared_ptr< AssemblyMap > &locToGloMap) override
Initialise this object.
void v_Solve(const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray) override
Solve the linear system for given input and output vectors using a specified local to global map.
DNekScalBlkMatSharedPtr m_BinvD
Block  matrix.
virtual GlobalLinSysStaticCondSharedPtr v_Recurse(const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const DNekScalBlkMatSharedPtr pSchurCompl, const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC, const DNekScalBlkMatSharedPtr pInvD, const std::shared_ptr< AssemblyMap > &locToGloMap)=0
void ConstructNextLevelCondensedSystem(const std::shared_ptr< AssemblyMap > &locToGloMap)
DNekScalBlkMatSharedPtr m_C
Block  matrix.
int v_GetNumBlocks() override
Get the number of blocks in this system.
DNekScalBlkMatSharedPtr m_invD
Block  matrix.
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
static void Dgemm(const char &transa, const char &transb, const int &m, const int &n, const int &k, const double &alpha, const double *a, const int &lda, const double *b, const int &ldb, const double &beta, double *c, const int &ldc)
BLAS level 3: Matrix-matrix multiply C = A x B where op(A)[m x k], op(B)[k x n], C[m x n] DGEMM perfo...
std::shared_ptr< AssemblyMap > AssemblyMapSharedPtr
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
void Multiply(NekMatrix< ResultDataType, StandardMatrixTag > &result, const NekMatrix< LhsDataType, LhsMatrixType > &lhs, const ResultDataType &rhs)
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
std::shared_ptr< DNekMat > DNekMatSharedPtr
PointerWrapper
Specifies if the pointer passed to a NekMatrix or NekVector is copied into an internal representation...
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.