diff options
| author | Sébastien Crozet <developer@crozet.re> | 2022-03-06 10:59:29 +0100 |
|---|---|---|
| committer | Sébastien Crozet <sebastien@crozet.re> | 2022-03-20 21:49:16 +0100 |
| commit | 815de4beff2ca31255c7fb937337602eb784ed67 (patch) | |
| tree | 82b93d1fcad98f9a9a6732e2cc0208f8a44fe67b /src/dynamics/solver/generic_velocity_ground_constraint.rs | |
| parent | 2e6f133b95b614f13445722e54f28105d9664841 (diff) | |
| download | rapier-815de4beff2ca31255c7fb937337602eb784ed67.tar.gz rapier-815de4beff2ca31255c7fb937337602eb784ed67.tar.bz2 rapier-815de4beff2ca31255c7fb937337602eb784ed67.zip | |
Complete the parallel solver fix
Diffstat (limited to 'src/dynamics/solver/generic_velocity_ground_constraint.rs')
| -rw-r--r-- | src/dynamics/solver/generic_velocity_ground_constraint.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dynamics/solver/generic_velocity_ground_constraint.rs b/src/dynamics/solver/generic_velocity_ground_constraint.rs index b2e5878..044bd48 100644 --- a/src/dynamics/solver/generic_velocity_ground_constraint.rs +++ b/src/dynamics/solver/generic_velocity_ground_constraint.rs @@ -34,7 +34,7 @@ impl GenericVelocityGroundConstraint { out_constraints: &mut Vec<AnyVelocityConstraint>, jacobians: &mut DVector<Real>, jacobian_id: &mut usize, - push: bool, + insert_at: Option<usize>, ) where Bodies: ComponentSet<RigidBodyIds> + ComponentSet<RigidBodyVelocity> @@ -87,7 +87,7 @@ impl GenericVelocityGroundConstraint { let required_jacobian_len = *jacobian_id + manifold.data.solver_contacts.len() * multibodies_ndof * 2 * DIM; - if jacobians.nrows() < required_jacobian_len { + if jacobians.nrows() < required_jacobian_len && !cfg!(feature = "parallel") { jacobians.resize_vertically_mut(required_jacobian_len, 0.0); } @@ -200,11 +200,11 @@ impl GenericVelocityGroundConstraint { ndofs2: mb2.ndofs(), }; - if push { - out_constraints.push(AnyVelocityConstraint::NongroupedGenericGround(constraint)); - } else { - out_constraints[manifold.data.constraint_index + _l] = + if let Some(at) = insert_at { + out_constraints[at + _l] = AnyVelocityConstraint::NongroupedGenericGround(constraint); + } else { + out_constraints.push(AnyVelocityConstraint::NongroupedGenericGround(constraint)); } } } |
