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

[FEM] Add method computeVonMisesStress in TetrahedralCorotationalForceField and option to draw them #4945

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

epernod
Copy link
Contributor

@epernod epernod commented Aug 28, 2024

Similar to TetrahedronFEMForceField, compute von mises per element and add option to draw it.


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@epernod epernod added pr: status to review To notify reviewers to review this pull-request pr: new feature Implement a new feature labels Aug 28, 2024
@epernod epernod changed the title Inf 2024 14 draw coro von mises [FEM] Add method computeVonMisesStress in TetrahedralCorotationalForceField and option to draw them Aug 28, 2024
Comment on lines +198 to +200
Data<type::vector<Real> > d_vonMisesPerNode; ///< von Mises Stress per node

sofa::helper::ColorMap* m_VonMisesColorMap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Data<type::vector<Real> > d_vonMisesPerNode; ///< von Mises Stress per node
sofa::helper::ColorMap* m_VonMisesColorMap;
Data<type::vector<Real> > d_vonMisesPerNode; ///< von Mises Stress per node
sofa::helper::ColorMap* m_vonMisesColorMap;

I guess this is a copy-paste from the other file 🫢but it is nice to have consistency

matVert[k][l] = X0[ix][l - 1];
}

const bool canInvert = type::invertMatrix(tetrahedronInf[i].elemShapeFun, matVert);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const bool canInvert = type::invertMatrix(tetrahedronInf[i].elemShapeFun, matVert);
[[maybe_unused]] const bool canInvert = type::invertMatrix(tetrahedronInf[i].elemShapeFun, matVert);

const TetrahedronInformation& tetraInfo = tetrahedronInf[i];

computeRotationLarge(R_0_2, X, tetra[0], tetra[1], tetra[2]);
//tetraInfo.rotation.transpose(R_0_2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//tetraInfo.rotation.transpose(R_0_2);


if (d_drawing.getValue())
{
std::vector< type::Vec3 > points[4];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could reserve the memory beforehand as the size seems computable

@damienmarchal
Copy link
Contributor

damienmarchal commented Sep 3, 2024

To me adding more and more hard coded drawing function by copy-pasting other's drawing function in every components is not desirable.

I see two better solutions:

  1. the drawing code & related datafield should at least be moved in a separated c++ object to factor rendering & UX.
  2. the drawing code & related datafields should be in a separated sofa component so they can be compose in the scene.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: new feature Implement a new feature pr: status to review To notify reviewers to review this pull-request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants