Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Changelog](http://keepachangelog.com/en/1.0.0/).
- Added a lot more 2D and 3D computational geometry unit tests covering more face/edge configurations
- Support for linear triangle meshes in Tribol's SINGLE_MORTAR method (exact Jacobians through Enzyme or approximate
Jacobians)
- Added API function to get the number of active contact pairs on a coupling scheme.

### Changed
- Return negative timestep vote for non-null meshes with null velocity pointers.
Expand Down
21 changes: 21 additions & 0 deletions src/tribol/interface/tribol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,27 @@ void setInterfacePairs( IndexT cs_id, IndexT numPairs, IndexT const* const pairI

} // end setInterfacePairs()

//------------------------------------------------------------------------------
int getNumberOfContactPairsOnRank( IndexT cs_id )
{
auto cs = CouplingSchemeManager::getInstance().findData( cs_id );
return cs->getNumActivePairs();
}

//------------------------------------------------------------------------------
int getTotalNumberOfContactPairs( IndexT cs_id )
{
auto cs = CouplingSchemeManager::getInstance().findData( cs_id );
if ( cs != nullptr ) {
auto comm = cs->getProblemComm();
int local_num_pairs = cs->getNumActivePairs();
int global_num_pairs = 0;
MPI_Allreduce( &local_num_pairs, &global_num_pairs, 1, MPI_INT, MPI_SUM, comm );
return global_num_pairs;
}
return 0;
}

//------------------------------------------------------------------------------
int update( int cycle, RealT t, RealT& dt )
{
Expand Down
20 changes: 20 additions & 0 deletions src/tribol/interface/tribol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,26 @@ void setInterfacePairs( IndexT cs_id, IndexT numPairs, IndexT const* mesh_id1, I
IndexT const* pairIndex1, IndexT const* mesh_id2, IndexT const* pairType2,
IndexT const* pairIndex2 );

/*!
* \brief Get the number of contact pairs on rank for the given coupling scheme
*
* \param [in] cs_id coupling scheme id
*
* \return the number of contact pairs on rank
*/
int getNumberOfContactPairsOnRank( IndexT cs_id );

/*!
* \brief Get the total number of contact pairs across all ranks for the given coupling scheme
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a warning re: ghost elements being counted multiple times.

* \param [in] cs_id coupling scheme id
*
* \return the total number of contact pairs across all rank
*
* \note this routine only works on host
*/
int getTotalNumberOfContactPairs( IndexT cs_id );

/*!
* \brief Computes the contact response at the given cycle.
*
Expand Down