Skip to content

Commit

Permalink
Wave Body: don't use auto with Eigen (#79)
Browse files Browse the repository at this point in the history
Signed-off-by: Rhys Mainwaring <[email protected]>
  • Loading branch information
srmainwaring authored Oct 12, 2022
1 parent 3329124 commit b644d1a
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions gz-waves/src/systems/linear_wave_body/LinearWaveBody.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class gz::sim::systems::LinearWaveBodyPrivate
///
/// 12. Use math::eigen3::convert for converting Matrix and Vector types.
///
///
/// 13. Review use of Eigen.
///

/// \brief WEC-Sim BEMIO hydro data structure (read from HDF5 file)
Expand Down Expand Up @@ -1344,7 +1344,7 @@ void LinearWaveBody::Configure(const Entity &_entity,
if (this->dataPtr->forceFlags.radiationAddedMassOn)
{
// parameters
auto& A = this->dataPtr->hydroForceCoeffs.A;
Eigen::Matrix6d& A = this->dataPtr->hydroForceCoeffs.A;

// convert from Eigen to gz
gz::math::Matrix6d gzA;
Expand Down Expand Up @@ -1843,9 +1843,9 @@ void LinearWaveBodyPrivate::UpdateLinkState(const UpdateInfo &_info,
this->linkState.X_WBcm.Rot().RotateVector(this->linkState.p_BcmBwp_Bcm);

// position vector of body center of buoyancy
auto& cb = this->hydroData.cb;
auto& cg = this->hydroData.cg;
auto p_BcmBcb = cb - cg;
Eigen::Vector3d& cb = this->hydroData.cb;
Eigen::Vector3d& cg = this->hydroData.cg;
Eigen::Vector3d p_BcmBcb = cb - cg;

// position vector of body CoB wrt body CoM in body/world frame
this->linkState.p_BcmBcb_B =
Expand Down Expand Up @@ -1990,17 +1990,17 @@ void LinearWaveBodyPrivate::UpdateHydrostaticForces(const UpdateInfo &_info,
double g = this->simParams.g;
double rho = this->simParams.rho;
double Vo = this->geometry.Vo;
auto& K_hs = this->hydroForceCoeffs.K_hs;
Eigen::Matrix6d& K_hs = this->hydroForceCoeffs.K_hs;

/// \todo check whether to add correction - in WEC-Sim buoyancy force is
/// applied at CoB not CoM, so there is an additional moment. This
/// to be compared with the point of application in the linear model,
/// which seems to apply all forces at the origin of the waterplane?

// center of buoyancy in link frame (i.e. wrt link origin)
// auto& cb = this->hydroData.cb;
// auto& cg = this->hydroData.cg;
// auto p_BcmBcb = cb - cg;
// Eigen::Vector3d& cb = this->hydroData.cb;
// Eigen::Vector3d& cg = this->hydroData.cg;
// Eigen::Vector3d p_BcmBcb = cb - cg;

// link properties
gz::sim::Link baseLink(this->linkEntity);
Expand Down Expand Up @@ -2124,7 +2124,7 @@ void LinearWaveBodyPrivate::UpdateRadiationDampingForces(
return;

// parameters
auto& B = this->hydroForceCoeffs.B;
Eigen::Matrix6d& B = this->hydroForceCoeffs.B;

// link properties
gz::sim::Link baseLink(this->linkEntity);
Expand Down Expand Up @@ -2221,7 +2221,7 @@ void LinearWaveBodyPrivate::UpdateRadiationAddedMassForces(
(currentTime - this->prevTime) < updatePeriod)
{
// parameters
auto& A = this->hydroForceCoeffs.A;
Eigen::Matrix6d& A = this->hydroForceCoeffs.A;

// link properties
gz::sim::Link baseLink(this->linkEntity);
Expand Down Expand Up @@ -2320,12 +2320,12 @@ void LinearWaveBodyPrivate::UpdateExcitationForces(const UpdateInfo &_info,
double height = this->waves.height;
double phase = this->waves.phase;
double omega = this->simParams.w;
auto& ex_re = this->hydroForceCoeffs.ex_re;
auto& ex_im = this->hydroForceCoeffs.ex_im;
auto& fk_re = this->hydroForceCoeffs.fk_re;
auto& fk_im = this->hydroForceCoeffs.fk_im;
auto& sc_re = this->hydroForceCoeffs.sc_re;
auto& sc_im = this->hydroForceCoeffs.sc_im;
Eigen::Vector6d& ex_re = this->hydroForceCoeffs.ex_re;
Eigen::Vector6d& ex_im = this->hydroForceCoeffs.ex_im;
Eigen::Vector6d& fk_re = this->hydroForceCoeffs.fk_re;
Eigen::Vector6d& fk_im = this->hydroForceCoeffs.fk_im;
Eigen::Vector6d& sc_re = this->hydroForceCoeffs.sc_re;
Eigen::Vector6d& sc_im = this->hydroForceCoeffs.sc_im;

// link properties
gz::sim::Link baseLink(this->linkEntity);
Expand Down

0 comments on commit b644d1a

Please sign in to comment.