Skip to content

Commit 09dabce

Browse files
committed
Fixed logic in contact potential when exclude_neighbors is off.
1 parent 8c49f58 commit 09dabce

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

FEBioMech/FEContactPotential.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,18 @@ static bool is_neighbor(FESurfaceElement& e1, FESurfaceElement& e2)
217217
return false;
218218
}
219219

220+
static bool is_same(FESurfaceElement& e1, FESurfaceElement& e2)
221+
{
222+
int n1 = e1.Nodes();
223+
int n2 = e2.Nodes();
224+
for (int i = 0; i < n1; ++i)
225+
{
226+
if (e1.m_node[i] != e2.m_node[i]) return false;
227+
}
228+
return true;
229+
}
230+
231+
220232
struct BOX
221233
{
222234
public:
@@ -525,7 +537,15 @@ void FEContactPotential::BuildNeighborTable()
525537
{
526538
set<FESurfaceElement*>& nbrList = m_elemNeighbors[i];
527539
nbrList.clear();
528-
nbrList.insert(&el1);
540+
541+
for (int j = 0; j < m_surf2.Elements(); ++j)
542+
{
543+
FESurfaceElement& el2 = m_surf2.Element(j);
544+
if (el2.isActive() && ::is_same(el1, el2))
545+
{
546+
nbrList.insert(&el2);
547+
}
548+
}
529549
}
530550
}
531551
}

0 commit comments

Comments
 (0)