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

added SIM_singlerigidbody #1762

Merged
merged 4 commits into from
Oct 16, 2024
Merged

added SIM_singlerigidbody #1762

merged 4 commits into from
Oct 16, 2024

Conversation

bnwalla1
Copy link
Contributor

No description provided.

@sharmeye
Copy link
Contributor

There are a few sections of the README that include information that's already contained in the tutorial. We would like that removed before merging. Specifically the sections Building the Sim, Running the Sim, and Recorded Data contain info that is already covered elsewhere.

@sharmeye
Copy link
Contributor

It appears the "sims" directory located in your SIM_singlerrigidbody directory is redundant and contains a lot of autogenerated files. Can you please delete it?

for(int i = 2; i<3; i++)
for(int j = 2; j<3; j++)
inertia_matrix[i][j] = inertia;

Copy link
Contributor

Choose a reason for hiding this comment

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

For lines 115-125, there's no need to run nested for-loops to assign these constants. Assigning the inertia_matrix elements you want (inertia_matrix[0][0], inertia_matrix[1][1], etc) can be done in three lines of direct assignment instead of nested for-loops that only iterate 1 time each. Try something like this:

inertia_matrix[0][0] = inertia_matrix[1][1] = inertia_matrix[2][2] = inertia;

for(int i = 2; i<3; i++)
for(int j = 2; j<3; j++)
massmatrix[i][j] = mass;

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above about unnecessary nested for-loops

for(int j = 3; j<6; j++)
mat_mass[i][j] = inertia_matrix[i-3][j-3];

};
Copy link
Contributor

Choose a reason for hiding this comment

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

If all of these values are constant, is there a reason that this routine is called in the derivative loop instead of at init? There's no reason, if the mass matrix is constant, to continually reassign and recalculate the matrix. It can just be done at init.

// Dynamic memory set up
double **mat_mass_dyn;
double **mat_L;
mat_L = new double*[6];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you repeatedly allocating and de-allocating the same memory during the derivative jobs? These matrices are always the same size, and could be define in the header and allocated once during init and de-allocated at shutdown.

***************************************************************************/
void BODY::derivative() {

mass_matrix();
Copy link
Contributor

Choose a reason for hiding this comment

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

see comment above about moving mass matrix calculation out of derivative job call

PURPOSE: (Sets up trick integration)
***************************************************************************/

#ifndef IN_MAKE
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this #define for?

@coveralls
Copy link

Coverage Status

coverage: 55.848% (+0.009%) from 55.839%
when pulling 1325cd6 on bnwalla1:singlerigidbody
into 26f6a02 on nasa:master.

@sharmeye sharmeye merged commit 7bc6ab7 into nasa:master Oct 16, 2024
13 checks passed
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.

3 participants