Skip to content

Commit

Permalink
fix constraints on input pools
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Beyß, Martin committed Feb 9, 2022
1 parent 3f7bf50 commit 54c7809
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions fluxml/FluxMLInput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());

}

}
}


Expand All @@ -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();
Expand Down

0 comments on commit 54c7809

Please sign in to comment.