Repository navigation
Make comp flattening more efficient - #516
Merged
Merged
Conversation
CompSBMLDocumentPlugin::checkConsistency set mCheckingDummyDoc and mFlattenAndCheck on the plugin of the document it checks, to make the dummy documents it copies from it skip their model definitions and their flat model. mCheckingDummyDoc was never reset, and mFlattenAndCheck not after an error in a model definition, so a second check of the document and a copy of it skipped the model definitions, and after such an error also the flat model. The flags are now set on the dummy document only. Refs #505.
Every modelDefinition was checked in a copy of the whole document, so a document of N modelDefinitions was copied N times and the check was quadratic in N, also with every check category disabled. One dummy document is copied now and used for all modelDefinitions: its model is swapped for the modelDefinition under check, which is held out of its modelDefinitions during the check and put back afterwards, and the model of the document is added to its modelDefinitions once. The dummy also keeps the documents of the externalModelDefinitions it resolved, which every copy read again. Refs #505.
Merge Mattias's changes to local branch
The intent of 'enablePackage' was to give the model the comp plugins again, but it didn't; we need enablePackageInternal instead.
Pull Mattias's other fix in.
Main change: don't double-validate the dummy comp model during flattening. Other changes: don't call 'loadPlugins' more than once. Went ahead and fixed this globally; we fixed this once before, but not everywhere, it seems. This fixed a latent infinite (!) 'operator=' bug, and copying comp objects no longer keeps adding a new plugin object every time it gets copied. Also, the plugins were *only* getting created when copied, instead of when they were constructed. This is now fixed.
fbergmann
approved these changes
Nov 12, 2026
fbergmann
left a comment
Member
There was a problem hiding this comment.
Thanks!, unfortunately that leaves some merge conflicts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests added for some of the new copying fixes, plus Matthias's earlier test fix, plus simply not crashing on other changes.