added: SAM::getUniqueEqns

this returns the unique equations for a given element.
in particular it resolves MPC couplings
This commit is contained in:
Arne Morten Kvarving 2022-10-04 12:27:50 +02:00
parent 6d42ff4e22
commit bebf8c1313
2 changed files with 28 additions and 0 deletions

View File

@ -720,6 +720,32 @@ bool SAM::getElmEqns (IntVec& meen, int iel, int nedof) const
}
bool SAM::getUniqueEqns (IntSet& meen, int iel) const
{
meen.clear();
IntVec meenTmp;
if (!this->getElmEqns(meenTmp, iel))
return false;
for (int jeq : meenTmp)
{
if (jeq < 0)
{
int jpmceq1 = mpmceq[-jeq-1];
int jpmceq2 = mpmceq[-jeq]-1;
for (int jp = jpmceq1; jp < jpmceq2; ++jp)
if (mmceq[jp] > 0)
meen.insert(meqn[mmceq[jp]-1]);
}
else if (jeq != 0)
meen.insert(jeq);
}
return true;
}
size_t SAM::getNoElmEqns (int iel) const
{
size_t result = 0;

View File

@ -196,6 +196,8 @@ public:
//! \brief Returns the number equations for an element.
//! \param[in] iel Identifier for the element to get number of equations for
size_t getNoElmEqns(int iel) const;
//! \brief Finds the matrix of unique equation numbers for an element.
bool getUniqueEqns(IntSet& meen, int iel) const;
//! \brief Finds the matrix of equation numbers for a node.
//! \param[out] mnen Matrix of node equation numbers