Skip to content

Commit

Permalink
Feedback from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Horn committed Nov 7, 2023
1 parent ac5c7ee commit a6ceed8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cmake/modules/ALL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

option(ENABLE_GPROF "Use the GNU profiler (gprof)" OFF)
if(ENABLE_GPROF)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif()

option(ENABLE_ALLLBL "Enable ALL load balancing library" OFF)
Expand Down
15 changes: 4 additions & 11 deletions src/molecules/Quaternion.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "Quaternion.h"
#include <cmath>

#define VECTOR3_ZERO ((std::array<double, 3>){ 0, 0, 0 })

Quaternion::Quaternion(const double& alpha_rad, const std::array<double,3>& n)
{
// normalize rotation axis vector n
Expand Down Expand Up @@ -43,8 +41,8 @@ void Quaternion::multiply_left(const Quaternion& q) {
}

std::array<double, 3> Quaternion::rotate(const std::array<double, 3>& d) const {
std::array<double, 3> drot VECTOR3_ZERO;
if(VECTOR3_ZERO != d) {
std::array<double, 3> drot{};
if(std::array<double, 3>{} != d) {
double ww = m_qw*m_qw;
double xx = m_qx*m_qx;
double yy = m_qy*m_qy;
Expand All @@ -66,8 +64,8 @@ std::array<double, 3> Quaternion::rotate(const std::array<double, 3>& d) const {
}

std::array<double, 3> Quaternion::rotateinv(const std::array<double, 3>& d) const {
std::array<double, 3> drot VECTOR3_ZERO;
if (VECTOR3_ZERO != d) {
std::array<double, 3> drot{};
if (std::array<double, 3>{} != d) {
double ww = m_qw*m_qw;
double xx = m_qx*m_qx;
double yy = m_qy*m_qy;
Expand Down Expand Up @@ -98,11 +96,6 @@ std::array<double, 3> Quaternion::rotateinv(const std::array<double, 3>& d) cons
*/

void Quaternion::differentiate(const std::array<double, 3>& w, Quaternion& dqdt) const {
if(VECTOR3_ZERO == w) {
dqdt.m_qw = 0; dqdt.m_qx = 0; dqdt.m_qy = 0; dqdt.m_qz = 0;
return;
}

dqdt.m_qw = .5 * ( -m_qx*w[0] - m_qy*w[1] - m_qz*w[2] );
dqdt.m_qx = .5 * ( m_qw*w[0] - m_qz*w[1] + m_qy*w[2] );
dqdt.m_qy = .5 * ( m_qz*w[0] + m_qw*w[1] - m_qx*w[2] );
Expand Down

0 comments on commit a6ceed8

Please sign in to comment.