mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Proper parenthesis handling for De Morgans
This commit is contained in:
parent
bce3cc0da4
commit
a3c15fb07f
1 changed files with 11 additions and 1 deletions
12
src/cell.cpp
12
src/cell.cpp
|
|
@ -773,7 +773,17 @@ void CSGCell::remove_complement_ops(vector<int32_t>& infix)
|
|||
// Define stop given left parenthesis or not
|
||||
auto stop = it;
|
||||
if (*it == OP_LEFT_PAREN) {
|
||||
stop = std::find(it, infix.end(), OP_RIGHT_PAREN);
|
||||
int depth = 1;
|
||||
do {
|
||||
stop++;
|
||||
if (*stop > OP_COMPLEMENT) {
|
||||
if (*stop == OP_RIGHT_PAREN) {
|
||||
depth--;
|
||||
} else {
|
||||
depth++;
|
||||
}
|
||||
}
|
||||
} while (depth > 0);
|
||||
it++;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue