iMSTK
Interactive Medical Simulation Toolkit
Public Types | Public Member Functions | Protected Attributes | List of all members
imstk::PbdConstraintContainer Class Reference

Container for pbd constraints. More...

#include <imstkPbdConstraintContainer.h>

Collaboration diagram for imstk::PbdConstraintContainer:
Collaboration graph
[legend]

Public Types

using iterator = std::vector< std::shared_ptr< PbdConstraint > >::iterator
 
using const_iterator = std::vector< std::shared_ptr< PbdConstraint > >::const_iterator
 

Public Member Functions

virtual void addConstraint (std::shared_ptr< PbdConstraint > constraint)
 Adds a constraint to the system, thread safe.
 
virtual void removeConstraint (std::shared_ptr< PbdConstraint > constraint)
 Linear searches for and removes a constraint from the system, thread safe.
 
virtual void removeConstraints (std::shared_ptr< std::unordered_set< size_t >> vertices, const int bodyId)
 Removes all constraints associated with vertex ids.
 
virtual iterator eraseConstraint (iterator iter)
 Removes a constraint from the system by iterator, thread safe.
 
virtual const_iterator eraseConstraint (const_iterator iter)
 
virtual void reserve (const size_t n)
 Reserve an amount of constraints in the pool, if you know ahead of time the number of constraints, or even an estimate, it can be faster to first reserve them.
 
const bool empty () const
 Returns if there are no constraints.
 
const std::vector< std::shared_ptr< PbdConstraint > > & getConstraints () const
 Get the underlying container.
 
std::vector< std::shared_ptr< PbdConstraint > > & getConstraints ()
 
const std::vector< std::vector< std::shared_ptr< PbdConstraint > > > getPartitionedConstraints () const
 Get the partitioned constraints.
 
void partitionConstraints (const int partitionThreshold)
 Partitions pbd constraints into separate vectors via graph coloring. More...
 
void clearPartitions ()
 Clear the parition vectors.
 

Protected Attributes

std::vector< std::shared_ptr< PbdConstraint > > m_constraints
 Not partitioned constraints.
 
std::vector< std::vector< std::shared_ptr< PbdConstraint > > > m_partitionedConstraints
 Partitioned pbd constraints.
 
ParallelUtils::SpinLock m_constraintLock
 Used to deal with concurrent addition/removal of constraints.
 

Detailed Description

Container for pbd constraints.

Definition at line 20 of file imstkPbdConstraintContainer.h.

Member Function Documentation

◆ partitionConstraints()

void imstk::PbdConstraintContainer::partitionConstraints ( const int  partitionThreshold)

Partitions pbd constraints into separate vectors via graph coloring.

Parameters
Minimumnumber of constraints in groups, any under will be dumped back into m_constraints

Definition at line 82 of file imstkPbdConstraintContainer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: