Celeritas
0.5.0-56+6b053cd
|
#include "CsgTreeUtils.hh"
#include <algorithm>
#include <utility>
#include <variant>
#include <vector>
#include "corecel/cont/Range.hh"
#include "detail/DeMorganSimplifier.hh"
#include "detail/InfixStringBuilder.hh"
#include "detail/NodeReplacer.hh"
Functions | |
std::vector< NodeId > | celeritas::orangeinp::replace_and_simplify (CsgTree *tree, NodeId repl_key, Node repl_value) |
Replace the given node ID with the replacement node. More... | |
NodeId | celeritas::orangeinp::simplify_up (CsgTree *tree, NodeId start) |
Simplify all nodes in the tree starting with this one. More... | |
void | celeritas::orangeinp::simplify (CsgTree *tree, NodeId start) |
Iteratively simplify all nodes in the tree. More... | |
CsgTree | celeritas::orangeinp::transform_negated_joins (CsgTree const &tree) |
Simplify negated joins using De Morgan's law. More... | |
std::string | celeritas::orangeinp::build_infix_string (CsgTree const &tree, NodeId n) |
Convert a node to an infix string expression. | |
std::vector< LocalSurfaceId > | celeritas::orangeinp::calc_surfaces (CsgTree const &tree) |
Construct the sorted set of all surfaces that are part of the tree. More... | |
std::vector< LocalSurfaceId > celeritas::orangeinp::calc_surfaces | ( | CsgTree const & | tree | ) |
Construct the sorted set of all surfaces that are part of the tree.
This list removes surfaces that have been eliminated by logical replacement. Thanks to the CSG tree's deduplication, each surface should appear in the tree at most once.
std::vector< NodeId > celeritas::orangeinp::replace_and_simplify | ( | CsgTree * | tree, |
NodeId | repl_key, | ||
Node | repl_value | ||
) |
Replace the given node ID with the replacement node.
This recurses through daughters of "Joined" to simplify their originating surfaces if possible.
b
This operation is at worst O((number of nodes) * (depth of graph)).
Iteratively simplify all nodes in the tree.
The input 'start' node should be the minimum node from a replace_down
operation. In the worst case, it should take as many sweeps as the depth of the tree.
Simplify all nodes in the tree starting with this one.
CsgTree celeritas::orangeinp::transform_negated_joins | ( | CsgTree const & | tree | ) |
Simplify negated joins using De Morgan's law.
This is required if the tree's logic expression is used with InfixEvaluator
as negated joins are not supported.