-
Notifications
You must be signed in to change notification settings - Fork 26
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
Conversation
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. |
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; | ||
|
There was a problem hiding this comment.
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; | ||
|
There was a problem hiding this comment.
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]; | ||
|
||
}; |
There was a problem hiding this comment.
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]; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
No description provided.