Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup changes from dev_2023 branch #2

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
77d5337
[doc] Add some comments
epernod Oct 4, 2022
f7aed15
Add WireSectionMaterial component to store the material property of a…
epernod Sep 23, 2022
bd991f7
Update WireREstShape to use the new WireMaterialSection links
epernod Sep 23, 2022
2ca0d78
Add check on BeamMAterial section
epernod Sep 26, 2022
91bd6bf
[WireRestShape] Remove use of Edge2QuatTopologyMapping, no need to pr…
epernod Sep 30, 2022
483e4e7
[src] Move numEdges and numEdgesCollision into WireSectionMaterial
epernod Oct 1, 2022
5be2cfd
[WireRestShape] Remove use of Edge2QuatTopologyMapping, no need to pr…
epernod Oct 3, 2022
7448b43
Fix numEdges creation fron materials
epernod Oct 3, 2022
e14d0aa
[src] Update WireRestShape to use a vector of Links instead of hardco…
epernod Oct 4, 2022
c442d02
backup changes in scenes
epernod Oct 4, 2022
52e0213
Add float/double methods.
epernod Oct 4, 2022
96a1a2f
Merge branch 'master' into BeamMaterial
fredroy Oct 12, 2022
75c0343
Update src/BeamAdapter/component/model/WireSectionMaterial.cpp
epernod Oct 13, 2022
7bf0249
[WireRestShape] Fix Collision edges sampling
epernod Oct 5, 2022
17ef028
[WRShape] Add epsilon on get youngModulus and interpolation
epernod Oct 11, 2022
7c4ec9f
Turn severals methods into const
epernod Oct 11, 2022
5d3e23b
Merge branch 'master' into BeamMaterial
epernod Jun 27, 2023
7a55ef4
[WireSection] Update WireSectionMaterial to be templated
epernod Jun 27, 2023
c9617f9
Temporarly comment code related to loading mesh not anymore working t…
epernod Jun 27, 2023
9d81cf3
Remove use of Edge2QuadTopologicalMapping
epernod Jun 27, 2023
dcc9816
Fix compilation
epernod Jun 27, 2023
d982a78
backup work on moving loader to material
epernod Jun 28, 2023
44463a5
backup work on new RodSection classes architecture
epernod Jun 29, 2023
3d1cc2c
Add RodSpire and RodStraight sections implementation
epernod Jun 29, 2023
5f48f9e
[WireRestShape] Remove optiond releaseWire or brokenIn2
epernod Jun 29, 2023
024f3c6
Add RodMeshSection implementation
epernod Jun 29, 2023
eefc535
Update WireRestShape to only use RodSectionMaterials
epernod Jun 29, 2023
e267534
Clean and doc Rod section classes and WireRestShape
epernod Jun 30, 2023
5a16d1f
Remove BaseRodSectionMaterial.cpp
epernod Jun 30, 2023
93fd33f
Forgot to update cudaInstantiations
epernod Jun 30, 2023
5c1be5e
Update all scenes with new rod section components
epernod Jun 30, 2023
00f9ec4
Merge branch 'master' into BeamMaterial
epernod Jun 30, 2023
c6c7d21
Restore exact same density of edges
epernod Jun 30, 2023
2ba8a9d
[doc] Update documentation
epernod Oct 13, 2022
22390f2
Backup work on scenes
epernod Oct 5, 2022
a423836
[IRCtrl] skip onKey event and comment partially onAnimationBeginEvent…
epernod Oct 19, 2022
26c9399
[IRCtrl] some small cleaning
epernod Nov 13, 2022
20673f9
add option to force adaptivemapping to not compute applyj/jt (useful …
fredroy Sep 28, 2022
255d72c
[src] Fix AdaptiveBeamController potential segfault on MouseEvent if …
epernod May 24, 2023
a424fa8
Merge branch 'BeamMaterial' into dev_LnRobotics
epernod Jun 30, 2023
69b2d59
[BeamInterpolation] Update getNodeIndices method signature
epernod Jun 26, 2023
d9982b4
[BeamInterpolation] Rename method conputeTransform2 into computeTrans…
epernod Jun 27, 2023
14e0510
[BeamInterpolation] Rename method conputeTransform2 into computeTrans…
epernod Jun 27, 2023
b045c91
[interpolation] Move ProjectionSearch into Slidingconstraint as it is…
epernod Jul 1, 2023
f717e24
Remove canCreate and Create method form interpolation component
epernod Jul 1, 2023
c5f36ef
Remove code linked to brokenIn2
epernod Jul 1, 2023
3781efa
Turn method into const
epernod Jul 1, 2023
b6326c9
revert [IRCtrl] skip onKey event and comment partially onAnimationBeg…
epernod Jul 3, 2023
f95f070
[BeamInterpolation] Add method computeTransform with node indices as …
epernod Jul 3, 2023
3983008
[scenes] Fix scenes regression
epernod Jul 24, 2023
a34459b
Add action to export the actions, otherwise it was done when the next…
epernod Jul 25, 2023
be65e4b
backup logs for debug
epernod Jul 25, 2023
c0341ff
Remove code related to drop action, not anymore supported
epernod Jul 25, 2023
57b2426
[IRC] Clean unused method
epernod Jul 27, 2023
e52bfe0
[IRCtrl] rename method IRComputeSampling into ComputeInstrumentsCurvA…
epernod Jul 27, 2023
2163599
[IRCtrl] Update code comments
epernod Jul 27, 2023
725e500
[IRCtrl] Rewrite totalLengthIsChanging
epernod Jul 27, 2023
623d8e4
[IRCtrl] Rewrite totalLengthIsChanging. Not sure sorting is a good thing
epernod Jul 27, 2023
6ca98dd
[IRCtrl] VArious small cleanup
epernod Jul 27, 2023
048c620
[IRCtrl] Small fix: avoid adding 0 curvAbs per device deployed
epernod Jul 27, 2023
7ae05b0
[IRCtrl] Small fix: update warning message if number of edges is not …
epernod Jul 27, 2023
38f0b2c
[IRCtrl] Update turn the check of wrong abscisse curv from error to w…
epernod Jul 27, 2023
50c76b9
[IRCtrl] Some constifying and cleanup
epernod Jul 27, 2023
d4ef9bb
[IRCtrl] Update doc and rename method
epernod Jul 28, 2023
3c89804
Merge commit 'a243f9c426a133f8a0f250a7ce5bf5e933e58468' into dev_2023
epernod Jul 16, 2024
b18f1b1
Merge commit 'fa008a9e81846f42589b390bfdbe8aeabdc18fa0' into dev_2023
epernod Jul 16, 2024
b7fdcb7
Merge branch 'v24.06' into dev_2023
epernod Jul 16, 2024
7eaf0c4
Merge branch 'master' into dev_2023
epernod Jul 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added doc/AdaptiveBeamMapping_00000001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 2 additions & 19 deletions src/BeamAdapter/component/BeamInterpolation.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,29 +101,10 @@ class BeamInterpolation : public BaseBeamInterpolation<DataTypes>
BeamInterpolation() ;
virtual ~BeamInterpolation() override = default;

//////////////////////////////////// Exposing this object in the factory ///////////////////////
/// Pre-construction check method called by ObjectFactory.
/// Check that DataTypes matches the MechanicalState.
template<class T>
static bool canCreate(T* obj, sofa::core::objectmodel::BaseContext* context, sofa::core::objectmodel::BaseObjectDescription* arg)
{
if (dynamic_cast<MechanicalState<DataTypes>*>(context->getMechanicalState()) == nullptr)
{
arg->logError(std::string("No mechanical state with the datatype '") + DataTypes::Name() +
"' found in the context node.");
return false;
}
return sofa::core::objectmodel::BaseObject::canCreate(obj, context, arg);
}

////////////////////////////////////////////////////////////////////////////////////////////////


//////////////////////////////////// Inherited from Base ///////////////////////////////////////
void init() override ;
void bwdInit() override ;
void reinit() override ;
void reset() override ;

//TODO(dmarchal@cduriez) Ca me semble détourner l'API pour faire des choses par surprise. A mon avis la bonne solution
//est d'implémenter un vrai binding Python pour BeamInterpolation. Avec une fonction updateInterpolation
Expand All @@ -140,6 +121,8 @@ class BeamInterpolation : public BaseBeamInterpolation<DataTypes>
bool verifyTopology();
void computeCrossSectionInertiaMatrix();

/// Given @param beamId will return the 2 PointID forming the given edge from the list @sa d_edgeList. Return true if found otherwise false.
bool getNodeIndices(const ElementID beamID, PointID &node0Idx, PointID &node1Idx) const;
void getInterpolationParam(unsigned int edgeInList, Real &_L, Real &_A, Real &_Iy , Real &_Iz,
Real &_Asy, Real &_Asz, Real &J) override;

Expand Down
34 changes: 26 additions & 8 deletions src/BeamAdapter/component/BeamInterpolation.inl
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,6 @@ void BeamInterpolation<DataTypes>::storeResetState()
updateInterpolation();
}

template<class DataTypes>
void BeamInterpolation<DataTypes>::reset()
{
if(d_componentState.getValue()==ComponentState::Invalid)
return ;

bwdInit();
}

template<class DataTypes>
bool BeamInterpolation<DataTypes>::interpolationIsAlreadyInitialized()
Expand Down Expand Up @@ -485,6 +477,32 @@ void BeamInterpolation<DataTypes>::getSplineRestTransform(unsigned int edgeInLis
}


template<class DataTypes>
bool BeamInterpolation<DataTypes>::getNodeIndices(const ElementID beamID, PointID& node0Idx, PointID& node1Idx) const
{
if (m_topologyEdges == nullptr)
{
msg_error() <<"This object does not have edge topology defined (computation halted). " ;
return false;
}

const VecElementID& edges = d_edgeList.getValue();
if (beamID >= edges.size())
{
msg_error() << "Given beamID: " << beamID << " in getNodeIndices is out of bounds: " << edges.size();
return false;
}

/// 1. Get the indices of element and nodes
const ElementID& e = edges[beamID] ;
const BaseMeshTopology::Edge& edge= (*m_topologyEdges)[e];
node0Idx = edge[0];
node1Idx = edge[1];

return true;
}


template<class DataTypes>
void BeamInterpolation<DataTypes>::getInterpolationParam(unsigned int edgeInList, Real &_L, Real &_A, Real &_Iy ,
Real &_Iz, Real &_Asy, Real &_Asz, Real &_J)
Expand Down
10 changes: 0 additions & 10 deletions src/BeamAdapter/component/WireBeamInterpolation.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,6 @@ class WireBeamInterpolation : public BaseBeamInterpolation<DataTypes>
using BaseBeamInterpolation<DataTypes>::d_componentState ;
////////////////////////////////////////////////////////////////////////////

public:

template<class T>
static bool canCreate(T* obj, sofa::core::objectmodel::BaseContext* context, sofa::core::objectmodel::BaseObjectDescription* arg)
{
return Inherited::canCreate(obj,context,arg);
}

template<class T>
static typename T::SPtr create(T* tObj, core::objectmodel::BaseContext* context, core::objectmodel::BaseObjectDescription* arg) ;

/////////////////////////// Deprecated Methods //////////////////////////////////////////
/// For coils: a part of the coil instrument can be brokenIn2 (by default the point of release is the end of the straight length)
Expand Down
39 changes: 0 additions & 39 deletions src/BeamAdapter/component/WireBeamInterpolation.inl
Original file line number Diff line number Diff line change
Expand Up @@ -253,45 +253,6 @@ bool WireBeamInterpolation<DataTypes>::getApproximateCurvAbs(const Vec3& x_input



template<class DataTypes>
template<class T>
typename T::SPtr WireBeamInterpolation<DataTypes>::create(T* tObj, core::objectmodel::BaseContext* context, core::objectmodel::BaseObjectDescription* arg)
{
WireRestShape<DataTypes>* _restShape = nullptr;
std::string _restShapePath;
bool pathOK = false;

if(arg)
{
if (arg->getAttribute("WireRestShape",nullptr) != nullptr)
{
_restShapePath = arg->getAttribute("WireRestShape");
context->findLinkDest(_restShape, _restShapePath, nullptr);

if(_restShape == nullptr)
msg_warning(context) << " ("<< WireBeamInterpolation<DataTypes>::GetClass()->className <<") : WireRestShape attribute not set correctly, WireBeamInterpolation will be constructed with a default WireRestShape" ;
else
pathOK = true;
}
else
msg_error(context) << " (" << WireBeamInterpolation<DataTypes>::GetClass()->className <<") : WireRestShape attribute not used, WireBeamInterpolation will be constructed with a default WireRestShape" ;


if (!pathOK)
{
_restShapePath=" ";
_restShape = new WireRestShape<DataTypes>();
}
}

typename T::SPtr obj = sofa::core::objectmodel::New<T>(_restShape);
obj->setPathToRestShape(_restShapePath);
if (context) context->addObject(obj);
if (arg) obj->parse(arg);
return obj;
}


} // namespace sofa::component::fem::_wirebeaminterpolation_


Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void BeamAdapterActionController<DataTypes>::onKeyPressedEvent(core::objectmodel
switch (kev->getKey())
{
case 'E':
m_currAction = BeamAdapterAction::NO_ACTION;
m_currAction = BeamAdapterAction::EXPORT_ACTION;
m_exportActions = !m_exportActions;
break;
case 'D':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,18 @@ class InterventionalRadiologyController : public MechanicalStateController<DataT
virtual ~InterventionalRadiologyController() = default;

////////////////////// Inherited from BaseObject ///////////////////////////////////////////////
virtual void init() override ;
virtual void bwdInit() override ;
void init() override;
void bwdInit() override;
////////////////////////////////////////////////////////////////////////////////////////////////


////////////////////// Inherited from Controller ///////////////////////////////////////////////
virtual void onMouseEvent(core::objectmodel::MouseEvent *) override ;
virtual void onKeyPressedEvent(core::objectmodel::KeypressedEvent *) override ;
virtual void onBeginAnimationStep(const double dt) override ;
void onMouseEvent(core::objectmodel::MouseEvent*) override {};
void onKeyPressedEvent(core::objectmodel::KeypressedEvent *) override;
void onBeginAnimationStep(const double dt) override;
////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////

virtual bool modifyTopology(void);
void interventionalRadiologyCollisionControls(type::vector<Real> &x_point_list,
type::vector<int> &id_instrument_list,
type::vector<int> &removeEdge);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,6 @@ void InterventionalRadiologyController<DataTypes>::bwdInit()
}


/*!
* \todo fix the mouse event with better controls
*/
template <class DataTypes>
void InterventionalRadiologyController<DataTypes>::onMouseEvent(MouseEvent * mev)
{
SOFA_UNUSED(mev);
}


template <class DataTypes>
void InterventionalRadiologyController<DataTypes>::onKeyPressedEvent(KeypressedEvent *kev)
{
Expand Down Expand Up @@ -1040,11 +1030,6 @@ void InterventionalRadiologyController<DataTypes>::fixFirstNodesWithUntil(unsign
d_indexFirstNode = firstSimulatedNode-1 ;
}

template <class DataTypes>
bool InterventionalRadiologyController<DataTypes>::modifyTopology(void)
{
return false;
}

template <class DataTypes>
void InterventionalRadiologyController<DataTypes>::getInstrumentList(type::vector<fem::WireBeamInterpolation<DataTypes>*>& list)
Expand Down
4 changes: 2 additions & 2 deletions src/BeamAdapter/component/engine/WireRestShape.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ class WireRestShape : public core::objectmodel::BaseObject
void computeOrientation(const Vec3& AB, const Quat& Q, Quat &result);


Real getLength() ;
const Real& getLength() const;
void getCollisionSampling(Real &dx, const Real &x_curv);
void getNumberOfCollisionSegment(Real &dx, unsigned int &numLines) ;
void getNumberOfCollisionSegment(Real &dx, unsigned int &numLines);



Expand Down
2 changes: 1 addition & 1 deletion src/BeamAdapter/component/engine/WireRestShape.inl
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ const BeamSection& WireRestShape<DataTypes>::getBeamSection(const Real& x_curv)


template <class DataTypes>
typename WireRestShape<DataTypes>::Real WireRestShape<DataTypes>::getLength()
const typename WireRestShape<DataTypes>::Real& WireRestShape<DataTypes>::getLength() const
{
return d_keyPoints.getValue().back();
}
Expand Down
2 changes: 2 additions & 0 deletions src/BeamAdapter/component/mapping/AdaptiveBeamMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class AdaptiveBeamMapping : public Mapping<TIn, TOut>
Data<type::vector<Real>> d_segmentsCurvAbs; /*!< (output) the abscissa of each created point on the collision model */
Data<bool> d_parallelMapping; /*!< flag to enable parallel internal computation of apply/applyJ */

Data<bool> d_onlyVisual;

SingleLink<AdaptiveBeamMapping<TIn, TOut>,
BInterpolation, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK> l_adaptativebeamInterpolation;

Expand Down
7 changes: 7 additions & 0 deletions src/BeamAdapter/component/mapping/AdaptiveBeamMapping.inl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ AdaptiveBeamMapping<TIn,TOut>::AdaptiveBeamMapping(State< In >* from, State< Out
, d_nbPointsPerBeam(initData(&d_nbPointsPerBeam, 0.0, "nbPointsPerBeam", "if non zero, we will adapt the points depending on the discretization, with this num of points per beam (compatible with useCurvAbs)"))
, d_segmentsCurvAbs(initData(&d_segmentsCurvAbs, "segmentsCurvAbs", "the abscissa of each point on the collision model", true, true))
, d_parallelMapping(initData(&d_parallelMapping, false, "parallelMapping", "flag to enable parallel internal computation"))
, d_onlyVisual(initData(&d_onlyVisual, (bool)false, "onlyVisual", "Really not mechanical mapping"))
, l_adaptativebeamInterpolation(initLink("interpolation", "Path to the Interpolation component on scene"), interpolation)
, m_inputMapping(nullptr)
, m_isSubMapping(isSubMapping)
Expand Down Expand Up @@ -291,6 +292,9 @@ void AdaptiveBeamMapping< TIn, TOut>::apply(const MechanicalParams* mparams, Dat
template <class TIn, class TOut>
void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mparams, Data<VecDeriv>& dOut, const Data<InVecDeriv>& dIn)
{
if (d_onlyVisual.getValue())
return;

SOFA_UNUSED(mparams);
SCOPED_TIMER("AdaptiveBeamMapping_applyJ");

Expand Down Expand Up @@ -376,6 +380,9 @@ void AdaptiveBeamMapping< TIn, TOut>::applyJ(const core::MechanicalParams* mpara
template <class TIn, class TOut>
void AdaptiveBeamMapping< TIn, TOut>::applyJT(const core::MechanicalParams* mparams, Data<InVecDeriv>& dOut, const Data<VecDeriv>& dIn)
{
if (d_onlyVisual.getValue())
return;

SOFA_UNUSED(mparams);

SCOPED_TIMER("AdaptiveBeamMapping_applyJT");
Expand Down
1 change: 1 addition & 0 deletions src/BeamAdapter/utils/BeamActions.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ namespace sofa::beamadapter
USE_TOOL_0,
USE_TOOL_1,
USE_TOOL_2,
EXPORT_ACTION
};

/// \brief map of action as string keyword instead of int for better clarity in scene scripting
Expand Down
Loading