You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugin could benefit from the use of smart pointers. There are many instances were naked pointers to the DistanceGrid object are being used by various components in the plugin. Their use is self-contained and seems well-managed. However, smart pointers could
Reduce some bulk code in destructors and similar methods
Relieve classes from managing memory directly
Replacements should be made in the following classes:
DistanceGrid
DistanceGridCollisionModel
RigidDistanceGridIntersection and FFDDistanceGridIntersection
DistanceGridForceField
Note
The DistanceGrid uses a static std::map to hold references to DistanceGrid instances and centrally manage memory. This is so that all components that make use of the same grid do not duplicate the allocation and use the existing (allocated) grid instead. The DistanceGrid class holds a reference count and increments/decrements the counter whenever it gives/takes access to the allocated grid to other components. It deletes itself from the static map once all instances have been destroyed. A combination of shared and weak pointers can do this. Behaviour should be replicated not altered.