Skip to content

Commit

Permalink
clang-tidy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
deslaughter committed Jan 10, 2025
1 parent e521f69 commit 5e0c9b8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
28 changes: 17 additions & 11 deletions src/model/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,12 @@ class Model {
}

private:
Array_3 gravity_ = {0., 0., 0.}; //< Gravity components
std::vector<Node> nodes_ = {}; //< Nodes in the model
std::vector<BeamElement> beam_elements_ = {}; //< Beam elements in the model
std::vector<MassElement> mass_elements_ = {}; //< Mass elements in the model
std::vector<SpringElement> spring_elements_ = {}; //< Spring elements in the model
std::vector<Constraint> constraints_ = {}; //< Constraints in the model
Array_3 gravity_ = {0., 0., 0.}; //< Gravity components
std::vector<Node> nodes_; //< Nodes in the model
std::vector<BeamElement> beam_elements_; //< Beam elements in the model
std::vector<MassElement> mass_elements_; //< Mass elements in the model
std::vector<SpringElement> spring_elements_; //< Spring elements in the model
std::vector<Constraint> constraints_; //< Constraints in the model
};

/// @brief Compute freedom tables for state, elements, and constraints, then construct and return
Expand All @@ -298,12 +298,18 @@ class Model {
compute_node_freedom_map_table(state);
create_element_freedom_table(elements, state);
create_constraint_freedom_table(constraints, state);
return Solver(
state.ID, state.node_freedom_allocation_table, state.node_freedom_map_table,
elements.NumberOfNodesPerElement(), elements.NodeStateIndices(), constraints.num_dofs,
constraints.type, constraints.base_node_freedom_table, constraints.target_node_freedom_table,
return {
state.ID,
state.node_freedom_allocation_table,
state.node_freedom_map_table,
elements.NumberOfNodesPerElement(),
elements.NodeStateIndices(),
constraints.num_dofs,
constraints.type,
constraints.base_node_freedom_table,
constraints.target_node_freedom_table,
constraints.row_range
);
};
}

} // namespace openturbine
22 changes: 11 additions & 11 deletions src/model/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,25 @@ struct Node {

/// Translate node by a displacement vector
void Translate(const Array_3& displacement) {
x[0] += displacement[0];
x[1] += displacement[1];
x[2] += displacement[2];
this->x[0] += displacement[0];
this->x[1] += displacement[1];
this->x[2] += displacement[2];
}

/// Rotate node by a quaternion
void Rotate(const Array_4& q) {
// Rotate position
auto x_rot = RotateVectorByQuaternion(q, {x[0], x[1], x[2]});
x[0] = x_rot[0];
x[1] = x_rot[1];
x[2] = x_rot[2];
this->x[0] = x_rot[0];
this->x[1] = x_rot[1];
this->x[2] = x_rot[2];

// Rotate orientation
auto q_rot = QuaternionCompose(q, {x[3], x[4], x[5], x[6]});
x[3] = q_rot[0];
x[4] = q_rot[1];
x[5] = q_rot[2];
x[6] = q_rot[3];
this->x[3] = q_rot[0];
this->x[4] = q_rot[1];
this->x[5] = q_rot[2];
this->x[6] = q_rot[3];
}

/// Rotate node by a rotation axis and angle
Expand All @@ -60,7 +60,7 @@ struct Node {
cos(angle / 2.), sin(angle / 2.) * axis[0], sin(angle / 2.) * axis[1],
sin(angle / 2.) * axis[2]
};
Rotate(q);
this->Rotate(q);
}
};

Expand Down

0 comments on commit 5e0c9b8

Please sign in to comment.