Skip to content

Commit

Permalink
Add MatrixProjectionMethod in an example
Browse files Browse the repository at this point in the history
  • Loading branch information
alxbilger authored and fredroy committed Feb 21, 2024
1 parent a9a1dd7 commit a3f276c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ void MatrixLinearSystem<TMatrix, TVector>::projectMappedMatrices(const core::Mec
{
if (m->hasPairStates(pair))
{
msg_info() << "Found a MatrixMapping for pair " << pair[0]->getPathName() << " and " << pair[1]->getPathName() << ": " << m->getPathName();
msg_info() << "Found a matrix projection method for pair " << pair[0]->getPathName() << " and " << pair[1]->getPathName() << ": " << m->getPathName();
const auto [insert_it, success] = m_matrixMappings.insert({pair, m});
it = insert_it;
break;
Expand All @@ -1016,7 +1016,7 @@ void MatrixLinearSystem<TMatrix, TVector>::projectMappedMatrices(const core::Mec

if (it == m_matrixMappings.end()) //it has not been found in the scene graph
{
msg_info() << "Cannot find a MatrixMapping for pair " << pair[0]->getPathName() << " and " << pair[1]->getPathName() << ": create one";
msg_info() << "Cannot find a matrix projection method for pair " << pair[0]->getPathName() << " and " << pair[1]->getPathName() << ": create one";
const auto createdMatrixMapping = createMatrixMapping(pair);
const auto resolvedName = this->getContext()->getNameHelper().resolveName(createdMatrixMapping->getClassName(), sofa::core::ComponentNameHelper::Convention::xml);
createdMatrixMapping->setName(resolvedName);
Expand Down
6 changes: 5 additions & 1 deletion examples/Component/LinearSystem/MatrixLinearSystem.scn
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<EulerImplicitSolver name="odesolver" rayleighStiffness="0.1" rayleighMass="0.1" />

<Node name="matrices">
<MatrixLinearSystem template="CompressedRowSparseMatrixd" name="system" checkIndices="true"/>
<MatrixLinearSystem template="CompressedRowSparseMatrixd" name="system" checkIndices="true" printLog="true"/>
<MatrixLinearSystem template="CompressedRowSparseMatrixd" name="GS" assembleStiffness="false" assembleMass="false" assembleDamping="false" assembleGeometricStiffness="true" applyProjectiveConstraints="false"/>
<GlobalSystemMatrixImage name="imageA" linearSystem="@system"/>
<GlobalSystemMatrixImage name="imageGS" linearSystem="@GS"/>
Expand Down Expand Up @@ -80,6 +80,10 @@
<MechanicalObject template="Vec3d" name="DOFs"/>
<SubsetMapping input="@../DOFs" output="@DOFs" indices="@box.indices"/>
</Node>
<MatrixProjectionMethod areJacobiansConstant="true" mechanicalStates="@/rigidSections/green/a/DOFs @/rigidSections/green/a/DOFs"/>
<MatrixProjectionMethod areJacobiansConstant="true" mechanicalStates="@/rigidSections/green/a/DOFs @/rigidSections/green/b/DOFs"/>
<MatrixProjectionMethod areJacobiansConstant="true" mechanicalStates="@/rigidSections/green/b/DOFs @/rigidSections/green/a/DOFs"/>
<MatrixProjectionMethod areJacobiansConstant="true" mechanicalStates="@/rigidSections/green/b/DOFs @/rigidSections/green/b/DOFs"/>
<StiffSpringForceField object1="@a/DOFs" object2="@b/DOFs" spring="0 0 100 1 1" showArrowSize="0.05" drawMode="2"/>

<Node name="Visual">
Expand Down

0 comments on commit a3f276c

Please sign in to comment.