@@ -338,6 +338,13 @@ function solve(solver::Solver, body_aero::BodyAerodynamics, gamma_distribution=n
338338 )
339339 return results
340340end
341+
342+ @inline @inbounds function calc_norm_array! (va_norm_array, va_array)
343+ for i in 1 : size (va_array, 1 )
344+ va_norm_array[i] = norm (MVec3 (view (va_array, i, :)))
345+ end
346+ end
347+
341348function solve_base (solver:: Solver , body_aero:: BodyAerodynamics , gamma_distribution= nothing ;
342349 log= false , reference_point= zeros (MVec3))
343350
@@ -366,12 +373,12 @@ function solve_base(solver::Solver, body_aero::BodyAerodynamics, gamma_distribut
366373 end
367374
368375 # Calculate unit vectors
369- va_norm_array = norm .( eachrow ( solver. sol. va_array)) # TODO : replace with for loop
370- va_unit_array = solver. sol. va_array ./ va_norm_array
376+ calc_norm_array! (solver . br . va_norm_array, solver. sol. va_array)
377+ solver . br . va_unit_array . = solver. sol. va_array ./ solver . br . va_norm_array
371378
372379 # Calculate AIC matrices
373- calculate_AIC_matrices! (body_aero, solver. aerodynamic_model_type, solver. core_radius_fraction, va_norm_array,
374- va_unit_array)
380+ calculate_AIC_matrices! (body_aero, solver. aerodynamic_model_type, solver. core_radius_fraction, solver . br . va_norm_array,
381+ solver . br . va_unit_array)
375382
376383 # Initialize gamma distribution
377384 gamma_initial = if isnothing (gamma_distribution)
@@ -399,8 +406,8 @@ function solve_base(solver::Solver, body_aero::BodyAerodynamics, gamma_distribut
399406
400407 # Return results
401408 return (
402- va_norm_array,
403- va_unit_array
409+ solver . br . va_norm_array,
410+ solver . br . va_unit_array
404411 )
405412end
406413
0 commit comments