Skip to content

Commit

Permalink
Bug 3195: Fixed SBML import of function parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
shoops committed Nov 20, 2023
1 parent 50c549b commit df7fd1c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion copasi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ if (APPLE AND CMAKE_GENERATOR STREQUAL "Xcode" OR DISABLE_CORE_OBJECT_LIBRARY)
endif (ENABLE_OMP)
else()
add_library (libCOPASISE-core OBJECT ${COPASI_SOURCES} ${COPASI_HEADERS})
# target_compile_options(libCOPASISE-core PRIVATE -Werror -Wall -Wextra -Wsuggest-override)
target_compile_options(libCOPASISE-core PRIVATE -fstack-protector-all)
target_link_libraries(libCOPASISE-core
${CROSSGUID_LIBRARY}
RAPTOR::RAPTOR
Expand Down
13 changes: 11 additions & 2 deletions copasi/OpenMP/CRandomContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ CRandomContext::CRandomContext(const bool & parallel)
{}

CRandomContext::~CRandomContext()
{}
{
if (Base::master())
{
delete Base::master();
Base: master() = NULL;
}
}

void CRandomContext::init(CRandom::Type type, unsigned C_INT32 seed)
{
Base::init();

if (Base::master())
delete Base::master();
{
delete Base::master();
Base: master() = NULL;
}

Base::setMaster(nullptr);

Expand Down
13 changes: 6 additions & 7 deletions copasi/model/CReaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ CFunction * CReaction::createFunctionFromExpression(const std::string & infix)
continue;

// Check whether we have compartment with that name
for (const CCompartment * pCompartment : mChemEq.getCompartments())
for (const CCompartment * pCompartment : mChemEq.getCompartments())
if (pCompartment->getObjectName() == "Name")
{
it->setUsage(CFunctionParameter::Role::VOLUME);
Expand Down Expand Up @@ -1712,7 +1712,7 @@ CEvaluationNodeVariable* CReaction::object2variable(const CEvaluationNodeObject*
const CModel * CReaction::getFirstCModelOrDefault(std::map< const CDataObject *, SBase * > & copasi2sbmlmap)
{

for (auto & pair : copasi2sbmlmap)
for (auto & pair : copasi2sbmlmap)
{
const CModel * pModel = dynamic_cast<const CModel*>(pair.first->getObjectAncestor("Model"));

Expand Down Expand Up @@ -1866,16 +1866,15 @@ CFunction * CReaction::setFunctionFromExpressionTree(const CExpression & express
{
if (SBMLImporter::areEqualFunctions(pExistingFunction, pTmpFunction))
{

setFunction(pExistingFunction);

// The functions and their signature are equal however the role of the variables
// might not be defined for the existing function if this is the first time it is used
mpFunction->setReversible(pTmpFunction->isReversible());
mpFunction->getVariables() = pTmpFunction->getVariables();
pExistingFunction->setReversible(pTmpFunction->isReversible());
pExistingFunction->getVariables() = pTmpFunction->getVariables();

pdelete(pTmpFunction);

setFunction(pExistingFunction);

// we still need to do the mapping, otherwise global parameters might not be mapped
it = replacementMap.begin();

Expand Down

0 comments on commit df7fd1c

Please sign in to comment.