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

[All] Code cleaning of multiple classes #1116

Merged
merged 14 commits into from
Sep 10, 2019

Conversation

eve-le-guillou
Copy link
Contributor

Code cleaning of multiple classes, by :

  • removing commented code,
  • replacing calls to serr/sout with msg_info()/msg_warning()/msg_error()
  • moving code from headers to put them .inl or .cpp.
  • updating to sofa coding style.
    One commit for one or two clean classes.

This PR:

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

Reviewers will merge only if all these checks are true.

@eve-le-guillou eve-le-guillou changed the title Code cleaning [All] Code cleaning of multiple classes Jul 30, 2019
@hugtalbot hugtalbot added pr: clean Cleaning the code pr: status to review To notify reviewers to review this pull-request labels Jul 30, 2019
@@ -496,27 +496,27 @@ void HexahedronCompositeFEMForceFieldAndMass<T>::computeMechanicalMatricesByCond



_weights.resize( this->_nbVirtualFinerLevels.getValue() );
int finestLevel = this->_sparseGrid->getNbVirtualFinerLevels()-this->_nbVirtualFinerLevels.getValue();
_weights.resize( this->d_nbVirtualFinerLevels.getValue() );
Copy link
Contributor

@hugtalbot hugtalbot Jul 30, 2019

Choose a reason for hiding this comment

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

To be picky, internal variable of a class (like _weights or _finalWeights here) are named m_* (e.g. m_weights)

@hugtalbot
Copy link
Contributor

Very nice work @Wall-E-76 ! Impressive !
Thank you very much, let's wait the continuous integration !

@guparan guparan added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Jul 31, 2019
@marques-bruno
Copy link
Member

[ci-build][with-all-tests]

@hugtalbot
Copy link
Contributor

TODO was to bring TriangleInfo, TriangleState, EdgeInfo, VertexInfo back in TriangularFEMForceFieldOptim.h

@marques-bruno seems to have done the jobs! 👍

@hugtalbot hugtalbot added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Sep 5, 2019
@guparan
Copy link
Contributor

guparan commented Sep 9, 2019

Actually @Wall-E-76 did the TODO, thanks @Wall-E-76 👍

@guparan guparan added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Sep 9, 2019
@@ -107,7 +107,7 @@ void TCapsuleModel<sofa::defaulttype::StdRigidTypes<3,MyReal> >::init()
_mstate = dynamic_cast< core::behavior::MechanicalState<DataTypes>* > (getContext()->getMechanicalState());
if (_mstate==NULL)
{
serr<<"TCapsuleModel requires a Rigid Mechanical Model" << sendl;
msg_warning()<<"TCapsuleModel requires a Rigid Mechanical Model" << msgendl;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is a msg_error, as the component init failed and so it is not usable.

this->Inherited::init();

_topology = this->getContext()->getMeshTopology();

if (_topology->getNbTriangles()==0)
{
serr << "ERROR(FastTriangularBendingSprings): object must have a Triangular Set Topology."<<sendl;
msg_error() << "ERROR(FastTriangularBendingSprings): object must have a Triangular Set Topology."<<msgendl;
Copy link
Contributor

Choose a reason for hiding this comment

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

the Error() can be remove as well as the msgendl

protected:
NonUniformHexahedronFEMForceFieldAndMass();

public:

void init() override;
void reinit() override { serr<<"WARNING : non-uniform mechanical properties can't be updated, changes on mechanical properties (young, poisson, density) are not taken into account."<<sendl; }
void reinit() override { msg_warning()<<"WARNING : non-uniform mechanical properties can't be updated, changes on mechanical properties (young, poisson, density) are not taken into account."<<msgendl; }
Copy link
Contributor

Choose a reason for hiding this comment

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

double warning in msg.

template <class DataTypes>
void HexahedronCompositeFEMForceFieldAndMass<DataTypes>::reinit()
{
msg_warning()<<"WARNING : composite mechanical properties can't be updated, changes on mechanical properties (young, poisson, density) are not taken into account."<<msgendl;
Copy link
Contributor

Choose a reason for hiding this comment

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

double warning in message

@epernod
Copy link
Contributor

epernod commented Sep 9, 2019

sorry for late review, just added some small picky comments.
Changes are not mandatory.
Thanks again for the PR.

@guparan
Copy link
Contributor

guparan commented Sep 10, 2019

Done, time to move on with the PR!

@epernod epernod merged commit 21a0b85 into sofa-framework:master Sep 10, 2019
@guparan guparan added this to the v19.12 milestone Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: clean Cleaning the code pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants