Skip to content

Commit 6faaf7a

Browse files
committed
change ownership of d_multithreading
1 parent c68a73e commit 6faaf7a

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BuiltConstraintSolver.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@
2828

2929
namespace sofa::component::constraint::lagrangian::solver
3030
{
31+
BuiltConstraintSolver::BuiltConstraintSolver()
32+
: d_multithreading(initData(&d_multithreading, false, "multithreading", "Build compliances concurrently"))
33+
{}
34+
35+
void BuiltConstraintSolver::init()
36+
{
37+
Inherit1::init();
38+
if(d_multithreading.getValue())
39+
{
40+
simulation::MainTaskSchedulerFactory::createInRegistry()->init();
41+
}
42+
}
3143

3244
void BuiltConstraintSolver::doBuildSystem( const core::ConstraintParams *cParams, unsigned int numConstraints)
3345
{

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/BuiltConstraintSolver.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API BuiltConstraintSolver : pu
3737

3838
public:
3939
SOFA_CLASS(BuiltConstraintSolver, GenericConstraintSolver);
40+
Data<bool> d_multithreading; ///< Build compliances concurrently
4041

41-
42+
BuiltConstraintSolver();
4243
virtual void doBuildSystem( const core::ConstraintParams *cParams, unsigned int numConstraints) override;
4344

45+
virtual void init() override;
4446
private:
4547

4648
struct ComplianceWrapper

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/GenericConstraintSolver.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ GenericConstraintSolver::GenericConstraintSolver()
7070
, d_regularizationTerm(initData(&d_regularizationTerm, 0.0_sreal, "regularizationTerm", "Add regularization factor times the identity matrix to the compliance W when solving constraints"))
7171
, d_scaleTolerance(initData(&d_scaleTolerance, true, "scaleTolerance", "Scale the error tolerance with the number of constraints"))
7272
, d_allVerified(initData(&d_allVerified, false, "allVerified", "All constraints must be verified (each constraint's error < tolerance)"))
73-
, d_multithreading(initData(&d_multithreading, false, "multithreading", "Build compliances concurrently"))
7473
, d_computeGraphs(initData(&d_computeGraphs, false, "computeGraphs", "Compute graphs of errors and forces during resolution"))
7574
, d_graphErrors(initData(&d_graphErrors, "graphErrors", "Sum of the constraints' errors at each iteration"))
7675
, d_graphConstraints(initData(&d_graphConstraints, "graphConstraints", "Graph of each constraint's error at the end of the resolution"))
@@ -139,13 +138,6 @@ void GenericConstraintSolver:: init()
139138
dx.realloc(&vop,false,true, core::VecIdProperties{"constraint_dx", GetClass()->className});
140139
m_dxId = dx.id();
141140
}
142-
143-
if(d_multithreading.getValue())
144-
{
145-
simulation::MainTaskSchedulerFactory::createInRegistry()->init();
146-
}
147-
148-
149141
}
150142

151143
void GenericConstraintSolver::initializeConstraintProblems()

Sofa/Component/Constraint/Lagrangian/Solver/src/sofa/component/constraint/lagrangian/solver/GenericConstraintSolver.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class SOFA_COMPONENT_CONSTRAINT_LAGRANGIAN_SOLVER_API GenericConstraintSolver :
6666
Data< SReal > d_regularizationTerm; ///< add regularization*Id to W when solving for constraints
6767
Data<bool> d_scaleTolerance; ///< Scale the error tolerance with the number of constraints
6868
Data<bool> d_allVerified; ///< All constraints must be verified (each constraint's error < tolerance)
69-
Data<bool> d_multithreading; ///< Build compliances concurrently
7069
Data<bool> d_computeGraphs; ///< Compute graphs of errors and forces during resolution
7170
Data<std::map < std::string, sofa::type::vector<SReal> > > d_graphErrors; ///< Sum of the constraints' errors at each iteration
7271
Data<std::map < std::string, sofa::type::vector<SReal> > > d_graphConstraints; ///< Graph of each constraint's error at the end of the resolution

0 commit comments

Comments
 (0)