Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Commit

Permalink
Remove ForceMask (#1)
Browse files Browse the repository at this point in the history
* remove forcemask

* remove header
  • Loading branch information
fredroy authored Sep 9, 2021
1 parent c87b861 commit a240289
Show file tree
Hide file tree
Showing 16 changed files with 2 additions and 265 deletions.
6 changes: 0 additions & 6 deletions Compliant_test/Assembly_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,12 +719,6 @@ struct Assembly_test : public CompliantSolver_test
DistanceMapping31::SPtr extensionMapping = addNew<DistanceMapping31>(extension);
extensionMapping->setModels(pointPairDOF.get(),extensionDOF.get());


rigidDOF->forceMask.assign( rigidDOF->getSize(), true );
particleOnRigidDOF->forceMask.assign( particleOnRigidDOF->getSize(), true );
pointPairDOF->forceMask.assign( pointPairDOF->getSize(), true );
extensionDOF->forceMask.assign( extensionDOF->getSize(), true );

UniformCompliance1::SPtr extensionCompliance = addNew<UniformCompliance1>(extension);
extensionCompliance->compliance.setValue(0);

Expand Down
6 changes: 0 additions & 6 deletions assembly/AssemblyVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,8 @@ AssemblyVisitor::chunk::map_type AssemblyVisitor::mapping(simulation::Node* node
assert( node->mechanicalMapping->getTo().size() == 1 &&
"only n -> 1 mappings are handled");

ForceMaskActivate(node->mechanicalMapping->getMechTo());
ForceMaskActivate(node->mechanicalMapping->getMechFrom());

const vector<sofa::defaulttype::BaseMatrix*>* js = node->mechanicalMapping->getJs();

ForceMaskDeactivate(node->mechanicalMapping->getMechTo());


vector<core::BaseState*> from = node->mechanicalMapping->getFrom();

for( unsigned i = 0, n = from.size(); i < n; ++i ) {
Expand Down
24 changes: 0 additions & 24 deletions contact/PenaltyCompliantContact.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,6 @@ class PenaltyCompliantContact : public BaseContact<TCollisionModel1, TCollisionM
forcefield->d_damping.setValue( this->damping_ratio.getValue() );
forcefield->d_stiffness.setValue( this->stiffness.getValue() );

for( unsigned i = 0 ; i < size ; ++i )
{
// no stiffness for non-violated penetration (alarm distance)
// TODO add a kind of projector to perform an unilateral stiffness (to add stiffness only one way).
// This would prevent sticky contacts and would allow to add small stiffness in alarm distance to slow-down object trying to go closer.

if( (*this->contacts)[i].value < 0 )
{
// only violated penetrations will propagate forces
this->mstate1->forceMask.insertEntry( this->mappedContacts[i].index1 );
if( !this->selfCollision ) this->mstate2->forceMask.insertEntry( this->mappedContacts[i].index2 );
}
}

}


Expand Down Expand Up @@ -146,16 +132,6 @@ class PenaltyCompliantContact : public BaseContact<TCollisionModel1, TCollisionM
forcefield->d_damping.setValue( this->damping_ratio.getValue() );
forcefield->d_stiffness.setValue( this->stiffness.getValue() );

// every violated contact points must propagate constraint forces
for( unsigned i = 0 ; i < size ; ++i )
{
if( (*this->contacts)[i].value < 0 )
{
// only violated penetrations will propagate forces
this->mstate1->forceMask.insertEntry( this->mappedContacts[i].index1 );
if( !this->selfCollision ) this->mstate2->forceMask.insertEntry( this->mappedContacts[i].index2 );
}
}
}


Expand Down
8 changes: 0 additions & 8 deletions forcefield/CompliantPenaltyForceField.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,6 @@ class CompliantPenaltyForceField : public core::behavior::ForceField<TDataTypes>
}
}

virtual void updateForceMask() override
{
for( unsigned int i=0 ; i<m_violated.size() ; ++i )
if(m_violated[i])
this->mstate->forceMask.insertEntry(i);
}


protected:

CompliantPenaltyForceField( core::behavior::MechanicalState<DataTypes> *mm = 0)
Expand Down
30 changes: 0 additions & 30 deletions mapping/AdditionMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,21 +155,6 @@ class SOFA_Compliant_API AdditionMapping : public ConstantAssembledMapping<TIn,
#endif /* COMPLIANT_HAVE_SOFA_GL */
}

virtual void updateForceMask() override
{
const pairs_type& p = pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom->insertEntry(indices[0]);
this->maskFrom->insertEntry(indices[1]);
}
}
}

};


Expand Down Expand Up @@ -311,21 +296,6 @@ class SOFA_Compliant_API AdditionMapping : public ConstantAssembledMapping<TIn,
}


virtual void updateForceMask() override
{
const pairs_type& p = pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo[0]->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom[0]->insertEntry(indices[0]);
this->maskFrom[1]->insertEntry(indices[1]);
}
}
}

};


Expand Down
15 changes: 0 additions & 15 deletions mapping/AssembledRigidRigidMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,6 @@ class SOFA_Compliant_API AssembledRigidRigidMapping : public AssembledMapping<TI

}


virtual void updateForceMask() override
{
const source_vectype& src = source.getValue();

for(unsigned i = 0, n = src.size(); i < n; ++i)
{
if( this->maskTo->getEntry(i) )
{
const source_type& s = src[i];
this->maskFrom->insertEntry(s.first);
}
}
}

};


Expand Down
31 changes: 0 additions & 31 deletions mapping/DifferenceMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,6 @@ class SOFA_Compliant_API DifferenceMapping : public ConstantAssembledMapping<TIn
#endif /* COMPLIANT_HAVE_SOFA_GL */
}

virtual void updateForceMask() override
{
const pairs_type& p = pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom->insertEntry(indices[0]);
this->maskFrom->insertEntry(indices[1]);
}
}
}

};


Expand Down Expand Up @@ -305,22 +290,6 @@ class SOFA_Compliant_API DifferenceMapping : public ConstantAssembledMapping<TIn
}
}


virtual void updateForceMask() override
{
const pairs_type& p = pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo[0]->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom[0]->insertEntry(indices[0]);
this->maskFrom[1]->insertEntry(indices[1]);
}
}
}

};


Expand Down
44 changes: 0 additions & 44 deletions mapping/DotProductMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,6 @@ class SOFA_Compliant_API DotProductMapping : public AssembledMapping<TIn, TOut>
}
K.compress();
}

virtual void updateForceMask() override
{
const pairs_type& p = pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom->insertEntry(indices[0]);
this->maskFrom->insertEntry(indices[1]);
}
}
}

};

Expand Down Expand Up @@ -329,22 +314,6 @@ class SOFA_Compliant_API DotProductMapping : public AssembledMapping<TIn, TOut>
}



virtual void updateForceMask() override
{
const pairs_type& p = pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo[0]->getEntry(i) )
{
const pair& pp = p[i];
this->maskFrom[pp[0][0]]->insertEntry(pp[0][1]);
this->maskFrom[pp[1][0]]->insertEntry(pp[1][1]);
}
}
}

};


Expand Down Expand Up @@ -440,19 +409,6 @@ class SOFA_Compliant_API DotProductMapping : public AssembledMapping<TIn, TOut>
}


virtual void updateForceMask() override
{
const type::vector< unsigned >& indices = d_indices.getValue();

for( size_t i = 0, iend = indices.size(); i < iend; ++i )
{
if( this->maskTo->getEntry(i) )
{
this->maskFrom->insertEntry(indices[i]);
}
}
}

};


Expand Down
16 changes: 1 addition & 15 deletions mapping/GearMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <Compliant/config.h>

#include "AssembledMultiMapping.h"
#include <sofa/helper/StateMask.h>

namespace sofa
{

Expand Down Expand Up @@ -119,20 +119,6 @@ namespace mapping
}
}

virtual void updateForceMask() override
{
const pairs_type& p = d_pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo[0]->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom[0]->insertEntry(indices[0][0]);
this->maskFrom[1]->insertEntry(indices[1][0]);
}
}
}

};

Expand Down
13 changes: 0 additions & 13 deletions mapping/ProjectionMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,6 @@ class ProjectionMapping : public AssembledMapping<TIn, TOut> {
}

}

virtual void updateForceMask() override
{
const type::vector<set_type>& s = set.getValue();

for( size_t i = 0, iend = s.size(); i < iend; ++i )
{
if( this->maskTo->getEntry(i) )
{
this->maskFrom->insertEntry(s[i].first);
}
}
}

};

Expand Down
15 changes: 0 additions & 15 deletions mapping/RigidJointMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,21 +205,6 @@ class RigidJointMapping : public AssembledMapping<TIn, TOut> {
}
}


virtual void updateForceMask() override
{
const pairs_type& p = pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom->insertEntry(indices[0]);
this->maskFrom->insertEntry(indices[1]);
}
}
}
};
}
}
Expand Down
14 changes: 0 additions & 14 deletions mapping/RigidJointMultiMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,20 +323,6 @@ class RigidJointMultiMapping : public AssembledMultiMapping<TIn, TOut> {
}
}

virtual void updateForceMask() override
{
const pairs_type& p = pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo[0]->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom[0]->insertEntry(indices[0]);
this->maskFrom[1]->insertEntry(indices[1]);
}
}
}

};

Expand Down
24 changes: 0 additions & 24 deletions mapping/SafeDistanceMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,21 +330,6 @@ class SOFA_Compliant_API SafeDistanceMapping : public AssembledMapping<TIn, TOut
#endif /* COMPLIANT_HAVE_SOFA_GL */
}

virtual void updateForceMask() override
{
const pairs_type& p = d_pairs.getValue();

for( size_t i = 0, iend = p.size(); i < iend; ++i )
{
if( this->maskTo->getEntry(i) )
{
const index_pair& indices = p[i];
this->maskFrom->insertEntry(indices[0]);
this->maskFrom->insertEntry(indices[1]);
}
}
}

};


Expand Down Expand Up @@ -665,15 +650,6 @@ class SOFA_Compliant_API SafeDistanceFromTargetMapping : public AssembledMapping
#endif /* COMPLIANT_HAVE_SOFA_GL */
}

virtual void updateForceMask() override
{
const type::vector< unsigned >& indices = d_indices.getValue();

for( size_t i = 0, iend = indices.size(); i < iend; ++i )
if( this->maskTo->getEntry(i) )
this->maskFrom->insertEntry(indices[i]);
}

};


Expand Down
5 changes: 0 additions & 5 deletions mapping/WinchMultiMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ class WinchMultiMapping : public AssembledMultiMapping<TIn, TOut>
}


virtual void updateForceMask()
{

}

};

#if !defined(SOFA_COMPONENT_MAPPING_WINCHMULTIMAPPING_CPP)
Expand Down
Loading

0 comments on commit a240289

Please sign in to comment.