Skip to content

Commit

Permalink
Fixed issue with the normal displacement constraint when node IDs don…
Browse files Browse the repository at this point in the history
…'t start at 1.
  • Loading branch information
SteveMaas1978 committed Dec 3, 2024
1 parent 2846ba4 commit 47cf879
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions FEBioMech/FEFixedNormalDisplacement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,29 @@ void FEFixedNormalDisplacement::Activate()
// nx*ux + ny*uy + nz*uz = 0
if (m_bshellb == false) {
for (int i = 0; i < m_surf.Nodes(); ++i) {
FENode node = m_surf.Node(i);
FENode& node = m_surf.Node(i);
if ((node.HasFlags(FENode::EXCLUDE) == false) && (node.m_rid == -1)) {
int nid = m_surf.NodeIndex(i) + 1; // NOTE: the linear constraint set still assumes 1-based indexing!
vec3d nn = m_surf.NodeNormal(i);
FEAugLagLinearConstraint* pLC = fecore_alloc(FEAugLagLinearConstraint, &fem);
pLC->AddDOF(node.GetID(), dofs.GetDOF("x"), nn.x);
pLC->AddDOF(node.GetID(), dofs.GetDOF("y"), nn.y);
pLC->AddDOF(node.GetID(), dofs.GetDOF("z"), nn.z);
pLC->AddDOF(nid, dofs.GetDOF("x"), nn.x);
pLC->AddDOF(nid, dofs.GetDOF("y"), nn.y);
pLC->AddDOF(nid, dofs.GetDOF("z"), nn.z);
// add the linear constraint to the system
m_lc.add(pLC);
}
}
}
else {
for (int i = 0; i < m_surf.Nodes(); ++i) {
FENode node = m_surf.Node(i);
FENode& node = m_surf.Node(i);
if ((node.HasFlags(FENode::EXCLUDE) == false) && (node.m_rid == -1)) {
vec3d nn = m_surf.NodeNormal(i);
FEAugLagLinearConstraint* pLC = fecore_alloc(FEAugLagLinearConstraint, &fem);
pLC->AddDOF(node.GetID(), dofs.GetDOF("sx"), nn.x);
pLC->AddDOF(node.GetID(), dofs.GetDOF("sy"), nn.y);
pLC->AddDOF(node.GetID(), dofs.GetDOF("sz"), nn.z);
int nid = m_surf.NodeIndex(i) + 1; // NOTE: the linear constraint set still assumes 1-based indexing!
FEAugLagLinearConstraint* pLC = fecore_alloc(FEAugLagLinearConstraint, &fem);
pLC->AddDOF(nid, dofs.GetDOF("sx"), nn.x);
pLC->AddDOF(nid, dofs.GetDOF("sy"), nn.y);
pLC->AddDOF(nid, dofs.GetDOF("sz"), nn.z);
// add the linear constraint to the system
m_lc.add(pLC);
}
Expand Down

0 comments on commit 47cf879

Please sign in to comment.