@@ -576,7 +576,8 @@ template<class DataTypes>
576576inline void TetrahedronFEMForceField<DataTypes>::accumulateForceSmall(Vector& f, const Vector & p,
577577 type::vector<VoigtTensor>& elasticStrains,
578578 type::vector<VoigtTensor>& plasticStrains,
579- typename VecElement::const_iterator elementIt, Index elementIndex , Real plasticYieldThreshold, Real plasticMaxThreshold, Real plasticCreep)
579+ typename VecElement::const_iterator elementIt, Index elementIndex ,
580+ Real plasticYieldThreshold, Real plasticMaxThreshold, Real plasticCreep)
580581{
581582 const VecCoord &initialPoints=d_initialPoints.getValue ();
582583 Element index = *elementIt;
@@ -607,7 +608,7 @@ inline void TetrahedronFEMForceField<DataTypes>::accumulateForceSmall(Vector& f,
607608 strainDisplacements[elementIndex],
608609 plasticYieldThreshold, plasticMaxThreshold, plasticCreep );
609610 }
610- else if (d_plasticMaxThreshold. getValue () <= 0 )
611+ else if (plasticMaxThreshold <= 0 )
611612 {
612613 Transformation Rot;
613614 Rot[0 ][0 ]=Rot[1 ][1 ]=Rot[2 ][2 ]=1 ;
@@ -1611,9 +1612,6 @@ inline void TetrahedronFEMForceField<DataTypes>::reinit()
16111612template <class DataTypes >
16121613inline void TetrahedronFEMForceField<DataTypes>::addForce (const core::MechanicalParams* /* mparams*/ , DataVecDeriv& d_f, const DataVecCoord& d_x, const DataVecDeriv& /* d_v */ )
16131614{
1614- VecDeriv& f = *d_f.beginEdit ();
1615- const VecCoord& p = d_x.getValue ();
1616-
16171615 Real plasticYieldThreshold = d_plasticYieldThreshold.getValue ();
16181616 Real plasticMaxThreshold = d_plasticYieldThreshold.getValue ();
16191617 Real plasticCreep = d_plasticCreep.getValue ();
@@ -1624,6 +1622,8 @@ inline void TetrahedronFEMForceField<DataTypes>::addForce (const core::Mechanica
16241622 auto plasticStrains = helper::getWriteOnlyAccessor (d_plasticStrains);
16251623 plasticStrains.resize (_indexedElements->size ());
16261624
1625+ auto p = helper::getReadAccessor (d_x);
1626+ auto f = helper::getWriteOnlyAccessor (d_f);
16271627 f.resize (p.size ());
16281628
16291629 if (needUpdateTopology)
@@ -1640,7 +1640,7 @@ inline void TetrahedronFEMForceField<DataTypes>::addForce (const core::Mechanica
16401640 {
16411641 for (it=_indexedElements->begin (), i = 0 ; it!=_indexedElements->end (); ++it,++i)
16421642 {
1643- accumulateForceSmall ( f, p, elasticStrains.wref (), plasticStrains.wref (), it, i,
1643+ accumulateForceSmall ( f. wref () , p. ref () , elasticStrains.wref (), plasticStrains.wref (), it, i,
16441644 plasticYieldThreshold, plasticMaxThreshold, plasticCreep );
16451645 }
16461646 break ;
@@ -1649,7 +1649,7 @@ inline void TetrahedronFEMForceField<DataTypes>::addForce (const core::Mechanica
16491649 {
16501650 for (it=_indexedElements->begin (), i = 0 ; it!=_indexedElements->end (); ++it,++i)
16511651 {
1652- accumulateForceLarge ( f, p, elasticStrains.wref (), plasticStrains.wref (), it, i,
1652+ accumulateForceLarge ( f. wref () , p. ref () , elasticStrains.wref (), plasticStrains.wref (), it, i,
16531653 plasticYieldThreshold, plasticMaxThreshold, plasticCreep );
16541654 }
16551655 break ;
@@ -1658,7 +1658,7 @@ inline void TetrahedronFEMForceField<DataTypes>::addForce (const core::Mechanica
16581658 {
16591659 for (it=_indexedElements->begin (), i = 0 ; it!=_indexedElements->end (); ++it,++i)
16601660 {
1661- accumulateForcePolar ( f, p, elasticStrains.wref (), plasticStrains.wref (), it, i,
1661+ accumulateForcePolar ( f. wref () , p. ref () , elasticStrains.wref (), plasticStrains.wref (), it, i,
16621662 plasticYieldThreshold, plasticMaxThreshold, plasticCreep );
16631663 }
16641664 break ;
@@ -1667,14 +1667,12 @@ inline void TetrahedronFEMForceField<DataTypes>::addForce (const core::Mechanica
16671667 {
16681668 for (it=_indexedElements->begin (), i = 0 ; it!=_indexedElements->end (); ++it,++i)
16691669 {
1670- accumulateForceSVD ( f, p, elasticStrains.wref (), plasticStrains.wref (), it, i,
1670+ accumulateForceSVD ( f. wref () , p. ref () , elasticStrains.wref (), plasticStrains.wref (), it, i,
16711671 plasticYieldThreshold, plasticMaxThreshold, plasticCreep );
16721672 }
16731673 break ;
16741674 }
16751675 }
1676- d_f.endEdit ();
1677-
16781676 updateVonMisesStress = true ;
16791677}
16801678
0 commit comments