-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lagrangian.Correction] Add callbacks to check zero compliance (#4205)
* Create one single callback checking non-zero values for compliance * add info message in rigid case * test compliance vector only if non-rigid using boiler plate snippet * move in a dedicated file the boiler plate code * fix compil * add checks for zero compliance vector in case of rigid body * minor formatting * Add comment on rigid compliance vector * Update Sofa/Component/Constraint/Lagrangian/Correction/src/sofa/component/constraint/lagrangian/correction/UncoupledConstraintCorrection.inl --------- Co-authored-by: Paul Baksic <[email protected]>
- Loading branch information
Showing
5 changed files
with
132 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// Created by hugo on 28/11/23. | ||
// | ||
|
||
#ifndef SOFA_ISRIGIDTYPE_H | ||
#define SOFA_ISRIGIDTYPE_H | ||
|
||
namespace sofa::type | ||
{ | ||
// Boiler-plate code to test if a type implements a method | ||
// explanation https://stackoverflow.com/a/30848101 | ||
|
||
template <typename...> | ||
using void_t = void; | ||
|
||
// Primary template handles all types not supporting the operation. | ||
template <typename, template <typename> class, typename = void_t<>> | ||
struct detect : std::false_type {}; | ||
|
||
// Specialization recognizes/validates only types supporting the archetype. | ||
template <typename T, template <typename> class Op> | ||
struct detect<T, Op, void_t<Op<T>>> : std::true_type {}; | ||
|
||
// Actual test if DataType::Coord implements getOrientation() (hence is a RigidType) | ||
template <typename T> | ||
using isRigid_t = decltype(std::declval<typename T::Coord>().getOrientation()); | ||
|
||
template <typename T> | ||
using isRigidType = detect<T, isRigid_t>; | ||
} | ||
#endif //SOFA_ISRIGIDTYPE_H |