Skip to content

Commit

Permalink
Profile with gprof; Reverted minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Horn committed Nov 7, 2023
1 parent 279c0b3 commit ac5c7ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 5 additions & 0 deletions cmake/modules/ALL.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# cmake module for adding ALL

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

option(ENABLE_ALLLBL "Enable ALL load balancing library" OFF)
if(ENABLE_ALLLBL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_ALLLBL")
Expand Down
6 changes: 3 additions & 3 deletions src/molecules/Quaternion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ 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) { // GH#267
if(VECTOR3_ZERO != d) {
double ww = m_qw*m_qw;
double xx = m_qx*m_qx;
double yy = m_qy*m_qy;
Expand All @@ -67,7 +67,7 @@ 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) { // GH#267
if (VECTOR3_ZERO != d) {
double ww = m_qw*m_qw;
double xx = m_qx*m_qx;
double yy = m_qy*m_qy;
Expand Down Expand Up @@ -98,7 +98,7 @@ 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) { // GH#267
if(VECTOR3_ZERO == w) {
dqdt.m_qw = 0; dqdt.m_qx = 0; dqdt.m_qy = 0; dqdt.m_qz = 0;
return;
}
Expand Down
7 changes: 2 additions & 5 deletions src/molecules/Quaternion.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ class Quaternion {
scale( 1./ s);
}
void normalize() {
if (!isNormalized()) { // GH#267 Avoid ASM `call sqrt` for identity
scaleinv(sqrt(magnitude2()));
}
scaleinv(sqrt(magnitude2()));
}
void conjugate() {
m_qx = -m_qx;
Expand Down Expand Up @@ -89,7 +87,7 @@ class Quaternion {
void getRotMatrix(double R[3][3]) const;
void getRotinvMatrix(double R[3][3]) const;

inline bool isNormalized() const {
bool isNormalized() const {
return fabs(magnitude2() - 1.0) <= 1e-15;
}
void check() const{
Expand All @@ -102,7 +100,6 @@ class Quaternion {

private:
double m_qw, m_qx, m_qy, m_qz; // components

};

#endif /*QUATERNION_H_*/

0 comments on commit ac5c7ee

Please sign in to comment.