Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dummy PR: changed to drag_coef: VehicleField<f64> #43

Closed
wants to merge 1 commit into from

Conversation

calbaker
Copy link
Collaborator

some tests fail but most pass
despite having std::ops::Mul implemented, requires unwieldy use of clone() method to satisfy borrow checker

some tests fail but most pass
despite having `std::ops::Mul` implemented, requires unwieldy use of `clone()` method to satisfy borrow checker
@calbaker calbaker marked this pull request as draft August 10, 2023 22:35
@@ -332,8 +332,9 @@ impl RustSimDrive {
};
let g = self.props.a_grav_mps2;
let m = self.veh.veh_kg;
let rho_cdfa =
self.props.air_density_kg_per_m3 * self.veh.drag_coef * self.veh.frontal_area_m2;
let rho_cdfa = self.veh.drag_coef.clone()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylecarow , VehiclField<f64> can be multiplied by f64 but not the other order. Because types that are used in math operations normally implement the std::markers::Copy trait and VehicleField<f64> cannot implement that trait due to fields that can't do it, we need to use .clone() a lot, which in my mind negates the benefit of the std::ops implementations.

@@ -180,6 +183,130 @@ impl CostFunction for GetError<'_> {
}
}

macro_rules! array_and_scalar_ops {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylecarow , this is where I've implemented the std::ops traits.

@calbaker calbaker closed this Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant