diff --git a/src/sbml/packages/comp/util/CompFlatteningConverter.cpp b/src/sbml/packages/comp/util/CompFlatteningConverter.cpp index ffa478a114..f5526dc222 100644 --- a/src/sbml/packages/comp/util/CompFlatteningConverter.cpp +++ b/src/sbml/packages/comp/util/CompFlatteningConverter.cpp @@ -385,6 +385,8 @@ CompFlatteningConverter::performConversion() mDocument->getVersion(), "The subsequent errors are from this attempt."); + unsetExplicitlyListed(); + // setup callback that will enable the packages on submodels disable_info mainDoc; mainDoc.doc = mDocument; @@ -1253,6 +1255,19 @@ CompFlatteningConverter::restoreNamespaces() mDocument->enablePackage((*pkg).first, (*pkg).second, true); } } + +void CompFlatteningConverter::unsetExplicitlyListed() +{ + List* elements = mDocument->getAllElements(); + for (unsigned int el = 0; el < elements->getSize(); el++) { + SBase* element = static_cast(elements->get(el)); + if (element->getTypeCode() == SBML_LIST_OF) { + ListOf* lo = static_cast(element); + lo->setExplicitlyListed(false); + } + } +} + /** @endcond */ /** @cond doxygenLibsbmlInternal */ diff --git a/src/sbml/packages/comp/util/CompFlatteningConverter.h b/src/sbml/packages/comp/util/CompFlatteningConverter.h index 181067d520..15f6c721a7 100644 --- a/src/sbml/packages/comp/util/CompFlatteningConverter.h +++ b/src/sbml/packages/comp/util/CompFlatteningConverter.h @@ -656,6 +656,8 @@ class LIBSBML_EXTERN CompFlatteningConverter : public SBMLConverter void restoreNamespaces(); + void unsetExplicitlyListed(); + std::set > mDisabledPackages; #ifndef SWIG diff --git a/src/sbml/util/ElementFilter.h b/src/sbml/util/ElementFilter.h index 93a0039c40..89a2fa0069 100644 --- a/src/sbml/util/ElementFilter.h +++ b/src/sbml/util/ElementFilter.h @@ -87,6 +87,10 @@ LIBSBML_CPP_NAMESPACE_BEGIN pResult->transferFrom(pSublist);\ delete pSublist;\ }\ + else {\ + if ((pFilter == NULL || pFilter->filter(&list)) && list.getLevel() >= 3 && list.getVersion() >= 2 && list.isExplicitlyListed())\ + pResult->add(&list);\ + }\ } #define ADD_FILTERED_PLIST(pResult,pSublist,pList,pFilter)\