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

Dfba development #2

Merged
merged 13 commits into from
Oct 28, 2024
Merged

Dfba development #2

merged 13 commits into from
Oct 28, 2024

Conversation

marcorusc
Copy link

Hi Miguel! Here are all the modifications I made in order to solve the segmentation faults we encountered during our coding session.

As I anticipated to you, I have mainly restructured the way metabolites are handled by the dFBAModel and dFBAReaction classes. Below there is a summary of the changes I have made (summary gently offered and powered by chatGPT based on my notes):

Revised Metabolite Management:

Updated the dFBAModel to centrally manage metabolites using metabolite IDs instead of pointers. This ensures better memory management and reduces the risk of dangling pointers when metabolites are referenced across different classes.

Modified the dFBAReaction class to store only metabolite IDs and stoichiometric coefficients, instead of maintaining direct pointers to dFBAMetabolite objects.

Reaction Handling Overhaul:

Updated dFBAModel to manage reactions in a similar way by using reaction IDs. This centralized the responsibility of managing reactions, reducing redundancy and improving overall code clarity.

Adjusted functions across dFBAModel and dFBAReaction to work with IDs, allowing dFBAModel to maintain ownership of metabolites and reactions.

Constructor, Destructor, and Copy Constructor Updates:

Revised constructors, destructors, and copy constructors for dFBAModel and dFBAReaction classes to properly implement deep copying and safe deletion of objects. This change prevents memory leaks and segmentation faults when creating or destroying instances of these classes.

Refactored Intracellular Class:

Updated the intracellular class to be compatible with the new metabolite and reaction management structure. This involved adapting methods for adding, retrieving, and debugging reactions within the model.

Debug Statements:

Added debug statements to print reaction details during initialization to help trace the creation and setup of each reaction. This proved helpful in identifying issues during model setup.

Header and Compilation Fixes:

Fixed several compilation errors by adding forward declarations and updating header files to ensure correct inclusion. This resolved issues related to incomplete types and allowed all classes to correctly reference each other.

End of the summary.

Since I was there, I have also cleaned a bit the code, removed some printing statements and corrected some comments.
Let me know what you think!

I have not tested if the results are actually correct but the code runs with no seg fault for one or more cells on single core and on multiple cores. I have also updated the python script to download the necessary files for fba and the ecoli sample project with the specifics you asked me (two cells on the two half of the domain, oxygen diffusing from the right border).

@migp11 migp11 merged commit 86c98ad into migp11:master Oct 28, 2024
2 of 5 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.

2 participants