diff --git a/include/openmc/cell.h b/include/openmc/cell.h index 5ba714570a..7206938c40 100644 --- a/include/openmc/cell.h +++ b/include/openmc/cell.h @@ -232,15 +232,6 @@ protected: find_left_parenthesis(std::vector::iterator start, const std::vector& rpn); - //! Returns the ending position of a parenthesis block (immediately after two - //! operator tokens) in the RPN given a starting position at the beginning of - //! that block (immediately before two surface tokens) - //! \param start Starting position of the search - //! \param rpn The rpn being searched - static std::vector::iterator - find_right_parenthesis(std::vector::iterator start, - const std::vector& rpn); - }; //============================================================================== diff --git a/src/cell.cpp b/src/cell.cpp index 914391ae22..3a7a2598fc 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -642,38 +642,6 @@ CSGCell::find_left_parenthesis(std::vector::iterator start, return it; } -std::vector::iterator -CSGCell::find_right_parenthesis(std::vector::iterator start, - const std::vector& rpn) { - int parenthesis_level = 0; - auto it = start; - while (it != rpn.end()) { - // look at two tokens at a time - int32_t one = *it; - int32_t two = *(it + 1); - - // increment parenthesis level if there are two adjacent surfaces - if (one < OP_UNION && two < OP_UNION) { - parenthesis_level++; - // decrement if there are two adjacent operators - } else if (one >= OP_UNION && two >= OP_UNION) { - parenthesis_level--; - } - - // if the level gets to zero, return the position - if (parenthesis_level == 0) { - // move the iterator forward one before leaving the loop - // so that all tokens in the parenthesis block are included - it++; - break; - } - - // continue loop, one token at a time - it++; - } - return it; -} - void CSGCell::remove_complement_ops(std::vector& rpn) { auto it = std::find(rpn.begin(), rpn.end(), OP_COMPLEMENT); while (it != rpn.end()) { @@ -711,12 +679,8 @@ BoundingBox CSGCell::bounding_box_complex(std::vector rpn) { } } - if (i_stack == 0) { - return stack[i_stack]; - } else { - return BoundingBox(); - } - + Ensures(i_stack == 0); + return stack.front(); } BoundingBox CSGCell::bounding_box() const {