From 54c78095fce59569fbf536e9038d84173cba2dec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bey=C3=9F=2C=20Martin?= Date: Wed, 9 Feb 2022 09:57:06 +0100 Subject: [PATCH] fix constraints on input pools Input pools are not allowed to be constrained (equality or inequality) The name of input pools was checked against all constraints, erroneously claiming that pool was constrained if a flux of the same name was constrained. We now check if the constraint actually applies to a pool refs #16 --- fluxml/FluxMLInput.cc | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/fluxml/FluxMLInput.cc b/fluxml/FluxMLInput.cc index edc7bbf..34feff7 100644 --- a/fluxml/FluxMLInput.cc +++ b/fluxml/FluxMLInput.cc @@ -99,11 +99,19 @@ void FluxMLInput::parseInput(DOMNode * input) for (eqConstraints_it=eqConstraints.begin(); eqConstraints_it!=eqConstraints.end(); eqConstraints_it++) { - charptr_array constraintsVars = eqConstraints_it->getConstraint()->getVarNames(); - if(constraintsVars.find((char const*)utf_pool_name)!=constraintsVars.end()) - fTHROW(XMLException,input, - "input pool \"%s\" specified in equality constraint", - (char const*)utf_pool_name); + if (eqConstraints_it->getParameterType() == data::POOL) + { + charptr_array constraintsVars = eqConstraints_it->getConstraint()->getVarNames(); + if(constraintsVars.find((char const*)utf_pool_name)!=constraintsVars.end()) + { + fTHROW(XMLException,input, + "input pool \"%s\" specified in equality constraint:\n%s", + (char const*)utf_pool_name, + eqConstraints_it->getConstraint()->toString().data()); + + } + + } } @@ -112,11 +120,17 @@ void FluxMLInput::parseInput(DOMNode * input) for (ineqConstraints_it=ineqConstraints.begin(); ineqConstraints_it!=ineqConstraints.end(); ineqConstraints_it++) { - charptr_array constraintsVars = ineqConstraints_it->getConstraint()->getVarNames(); - if(constraintsVars.find((char const*)utf_pool_name)!=constraintsVars.end()) - fTHROW(XMLException,input, - "input pool \"%s\" specified in inequality constraint", - (char const*)utf_pool_name); + if (ineqConstraints_it->getParameterType() == data::POOL) + { + charptr_array constraintsVars = ineqConstraints_it->getConstraint()->getVarNames(); + if(constraintsVars.find((char const*)utf_pool_name)!=constraintsVars.end()) + { + fTHROW(XMLException,input, + "input pool \"%s\" specified in inequality constraint:\n%s", + (char const*)utf_pool_name, + ineqConstraints_it->getConstraint()->toString().data()); + } + } } // Anzahl der Atome / Init. der Maske natoms = ipool->getNumAtoms();