Skip to content

Coverity errors in RotateSampleShape #38268

@RichardWaiteSTFC

Description

@RichardWaiteSTFC

*** CID 1563810: Performance inefficiencies (AUTO_CAUSES_COPY)
/jenkins_workdir/workspace/coverity_build_and_submit/Framework/DataHandling/src/RotateSampleShape.cpp: 86 in Mantid::DataHandling::RotateSampleShape::exec()()
80 if (sampleShapeRotation == Kernel::Matrix(3, 3, true)) {
81 // If the resulting rotationMatrix is Identity, ignore the calculatrion
82 g_log.warning("Rotation matrix set via RotateSampleShape is an Identity matrix. Ignored rotating sample shape");
83 return;
84 }
85

CID 1563810:  Performance inefficiencies  (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type "Mantid::Kernel::DblMatrix".

86 const auto oldRotation = ei->run().getGoniometer().getR();
87 auto newSampleShapeRot = sampleShapeRotation * oldRotation;
88 if (isMeshShape) {
89 auto meshShape = std::dynamic_pointer_cast(ei->sample().getShapePtr());
90 meshShape->rotate(newSampleShapeRot);
91 } else {

** CID 1563809: Performance inefficiencies (AUTO_CAUSES_COPY)
/jenkins_workdir/workspace/coverity_build_and_submit/Framework/DataHandling/src/RotateSampleShape.cpp: 79 in Mantid::DataHandling::RotateSampleShape::exec()()


*** CID 1563809: Performance inefficiencies (AUTO_CAUSES_COPY)
/jenkins_workdir/workspace/coverity_build_and_submit/Framework/DataHandling/src/RotateSampleShape.cpp: 79 in Mantid::DataHandling::RotateSampleShape::exec()()
73 Goniometer gon;
74 prepareGoniometerAxes(gon);
75 if (gon.getNumberAxes() == 0)
76 g_log.warning() << "Empty goniometer created; will always return an "
77 "identity rotation matrix.\n";
78

CID 1563809:  Performance inefficiencies  (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type "Mantid::Kernel::DblMatrix".

79 const auto sampleShapeRotation = gon.getR();
80 if (sampleShapeRotation == Kernel::Matrix(3, 3, true)) {
81 // If the resulting rotationMatrix is Identity, ignore the calculatrion
82 g_log.warning("Rotation matrix set via RotateSampleShape is an Identity matrix. Ignored rotating sample shape");
83 return;
84 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIssues and pull requests that are regressions or would be considered a bug by users (e.g. crashing)DiffractionIssues and pull requests related to diffractionISIS: DiffractionIssue and pull requests relating to Diffraction at ISISSingle CrystalIssues and pull requests related to single crystal

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions