| FEAT 3
    Finite Element Analysis Toolbox | 
Boolean operations on mesh parts. More...
#include <mesh_part_ops.hpp>
| Static Public Member Functions | |
| static MeshPartType | meshpart_difference (const MeshPartType &left, const MeshPartType &right) | 
| Compute the difference of two meshparts.  More... | |
| template<typename AttributeFn_ > | |
| static MeshPartType | meshpart_intersection (const MeshPartType &left, const MeshPartType &right, const AttributeFn_ &attribute_merge) | 
| Compute the intersection of two meshparts.  More... | |
| static MeshPartType | meshpart_symmetric_difference (const MeshPartType &left, const MeshPartType &right) | 
| Compute the symmetric difference of two meshparts.  More... | |
| template<typename AttributeFn_ > | |
| static MeshPartType | meshpart_union (const MeshPartType &left, const MeshPartType &right, const AttributeFn_ &attribute_merge) | 
| Compute the union of two meshparts.  More... | |
| Private Types | |
| using | AttributeDataType = typename MeshPartType::AttributeDataType | 
| Data types for meshpart attributes.  More... | |
| using | AttributeSetType = typename MeshPartType::AttributeSetType | 
| AttributeSet type.  More... | |
| using | IndexSetHolderType = IndexSetHolder< ShapeType > | 
| IndexSetHolder type.  More... | |
| using | Join = Inner::DimVector< ShapeType, JoinEntry > | 
| JoinVecs for all dimensions.  More... | |
| using | JoinEntry = Inner::JoinEntry | 
| Type for tracking relationships between meshpart entities.  More... | |
| using | JoinVec = std::vector< JoinEntry > | 
| Collection of JoinEntries.  More... | |
| using | MeshPartType = MeshPart< MeshType > | 
| Meshpart type.  More... | |
| using | MeshType = MeshType_ | 
| Mesh type underlying all mesh parts.  More... | |
| using | ShapeType = typename MeshType::ShapeType | 
| Shape type.  More... | |
| using | TargetSetHolderType = TargetSetHolder< ShapeType > | 
| TargetSetHolder type.  More... | |
| Static Private Member Functions | |
| template<int dim_ = ShapeType::dimension> | |
| static void | build_target_set_holder (TargetSetHolderType &output_tsh, Join &join, const std::function< bool(const JoinEntry &)> &pred, const TargetSetHolderType &left_tsh, const TargetSetHolderType &right_tsh) | 
| Construct target sets out of the join.  More... | |
| template<int dim_ = ShapeType::dimension> | |
| static void | build_topology (IndexSetHolderType &output_ish, Join &join, const IndexSetHolderType &left_ish, const TargetSetHolderType &left_tsh, const IndexSetHolderType &right_ish, const TargetSetHolderType &right_tsh) | 
| Outer wrapper for topology construction.  More... | |
| template<int dim_, int codim_> | |
| static void | build_topology_inner (IndexSetHolderType &output_ish, Join &join, const IndexSetHolderType &left_ish, const TargetSetHolderType &left_tsh, const IndexSetHolderType &right_ish, const TargetSetHolderType &right_tsh) | 
| Inner logc for topology construction.  More... | |
| static std::set< String > | common_attributes (const MeshPartType &left, const MeshPartType &right) | 
| Find common attributes of two meshparts.  More... | |
| template<typename AttributeFn_ > | |
| static void | copy_attributes (const AttributeFn_ &fn, const Join &join, MeshPartType &result, const MeshPartType &left, const MeshPartType &right) | 
| Attribute copy logic.  More... | |
| template<int dim_ = ShapeType::dimension> | |
| static void | join_elements (Join &join, const TargetSetHolderType &left_tsh, const TargetSetHolderType &right_tsh) | 
| Construct a join of entities.  More... | |
| template<typename AttributeFn_ , typename PredFn_ > | |
| static MeshPartType | meshpart_op (const MeshPartType &left, const MeshPartType &right, const AttributeFn_ &attribute_merge, const PredFn_ &join_pred, const bool create_topology) | 
| Common logic for all meshpart operations.  More... | |
| template<typename Iter_ , typename T_ > | |
| static std::optional< Index > | search (Iter_ begin, Iter_ end, const T_ &value) | 
| Binary search.  More... | |
| template<typename Iter_ , typename T_ , typename CompFn_ > | |
| static std::optional< Index > | search (Iter_ begin, Iter_ end, const T_ &value, const CompFn_ &fn) | 
| Binary search.  More... | |
Boolean operations on mesh parts.
| MeshType_ | The type of the mesh underlying the meshparts, i.e. this class template can operate on meshparts of type MeshPart<MeshType_>. | 
Available operations are:
This class template serves as a common namespace for boolean operations on meshparts. The operations are essentially free functions, this template is just for convenience to store common type aliases.
Definition at line 187 of file mesh_part_ops.hpp.
| 
 | private | 
Data types for meshpart attributes.
Definition at line 200 of file mesh_part_ops.hpp.
| 
 | private | 
AttributeSet type.
Definition at line 203 of file mesh_part_ops.hpp.
| 
 | private | 
IndexSetHolder type.
Definition at line 218 of file mesh_part_ops.hpp.
| 
 | private | 
JoinVecs for all dimensions.
Definition at line 212 of file mesh_part_ops.hpp.
| 
 | private | 
Type for tracking relationships between meshpart entities.
Definition at line 206 of file mesh_part_ops.hpp.
| 
 | private | 
Collection of JoinEntries.
Definition at line 209 of file mesh_part_ops.hpp.
| 
 | private | 
Meshpart type.
Definition at line 197 of file mesh_part_ops.hpp.
| 
 | private | 
Mesh type underlying all mesh parts.
Definition at line 191 of file mesh_part_ops.hpp.
| 
 | private | 
Shape type.
Definition at line 194 of file mesh_part_ops.hpp.
| 
 | private | 
TargetSetHolder type.
Definition at line 215 of file mesh_part_ops.hpp.
| 
 | inlinestaticprivate | 
Construct target sets out of the join.
| dim_ | Current dimension | 
| [in,out] | output_tsh | Output target set holder. Target sets are written to this. | 
| [in,out] | join | Entity join. For entities that are part of the result meshpart, target set indices are added to the join. | 
| [in] | pred | Join predicate | 
| [in] | left_tsh | Left target set holder | 
| [in] | right_tsh | Right target set holder | 
This function walks over the join and uses the join predicate to determine what entities should be added to the result meshpart. If it finds an entity that should be added, it pulls the correct mesh-index from the left or right target set.
Definition at line 795 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPartOperations< MeshType_ >::build_target_set_holder(), and XABORTM.
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::build_target_set_holder(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_op().
| 
 | inlinestaticprivate | 
Outer wrapper for topology construction.
| dim_ | Current dimension | 
| [in,out] | output_ish | Output index set holder | 
| [in] | join | Entity join. Used to determine where to pull topology from | 
| [in] | left_ish | Left index set holder | 
| [in] | left_tsh | Left target set holder | 
| [in] | right_ish | Right index set holder | 
| [in] | right_tsh | Right target set holder | 
In order to build the topology of the result meshpart, each apair of dimension needs to be visited. This wrapper recursively runs through the b dimensions.
Definition at line 600 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPartOperations< MeshType_ >::build_topology(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::build_topology_inner().
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::build_topology(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_op().
| 
 | inlinestaticprivate | 
Inner logc for topology construction.
| diim_ | Current "cell" dimension | 
| codim_ | Current "face" dimension | 
| [in,out] | output_ish | Output index set holder | 
| [in] | join | Entity join. Used to determine where to pull topology from | 
| [in] | left_ish | Left index set holder | 
| [in] | left_tsh | Left target set holder | 
| [in] | right_ish | Right index set holder | 
| [in] | right_tsh | Right target set holder | 
In order to build the topology of the result meshpart, each apair of dimension needs to be visited. This wrapper recursively runs through the a dimensions and constructs the actual topologies.
Definition at line 637 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPartOperations< MeshType_ >::build_topology_inner(), FEAT::Geometry::Inner::JoinEntry::index, FEAT::Geometry::MeshPartOperations< MeshType_ >::search(), and XASSERT.
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::build_topology(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::build_topology_inner().
| 
 | inlinestaticprivate | 
Find common attributes of two meshparts.
| [in] | left | Left meshpart | 
| [in] | right | Right meshpart | 
Definition at line 486 of file mesh_part_ops.hpp.
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::copy_attributes().
| 
 | inlinestaticprivate | 
Attribute copy logic.
| AttributeFn_ | Type of attribute merge function | 
| [in] | fn | Attribute merge function instance | 
| [in] | join | Entity join. Used to determine where to pull attribute values from | 
| [in,out] | result | The result meshpart. Attributes will be added to this meshpart. | 
| [in] | left | Left meshpart of operation | 
| [in] | right | Right meshpart of operation | 
Copies, and merges (if required), attributes that exist with the same dimension on both left and right. 
Definition at line 517 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPart< MeshType_ >::add_attribute(), FEAT::Geometry::MeshPartOperations< MeshType_ >::common_attributes(), FEAT::Geometry::MeshPart< MeshType_ >::get_num_entities(), and XABORTM.
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_op().
| 
 | inlinestaticprivate | 
Construct a join of entities.
| dim_ | Current dimension | 
| [in,out] | join | Join to write to | 
| [in] | left_tsh | Left target set holder | 
| [in] | right_tsh | Right target set holder | 
This function construct the entity join. The join tracks which entities of the left and right meshparts correspond to the same mesh entity, (and later also to which entity of the result meshpart). This is calculated for all entities, which allows implementing the different boolean operations via a simple predicate later.
Definition at line 872 of file mesh_part_ops.hpp.
References FEAT::Geometry::TargetSet::get_indices(), FEAT::Geometry::TargetSet::get_num_entities(), FEAT::Geometry::MeshPartOperations< MeshType_ >::join_elements(), FEAT::Geometry::Inner::JoinEntry::left, FEAT::Geometry::Inner::JoinEntry::right, and FEAT::Geometry::MeshPartOperations< MeshType_ >::search().
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::join_elements(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_op().
| 
 | inlinestatic | 
Compute the difference of two meshparts.
| [in] | left | Lefthand-side of difference | 
| [in] | right | Righthand-side of difference | 
Computes a new meshpart that contains all entities that occur in left but not in right.
Assume the following 2D mesh with quads A, B, C.
* +--------+--------+--------+ * | | | | * | A | B | C | * | | | | * +--------+--------+--------+ *
Further assume that left is a meshpart consisting of the quads A, B and all their vertices and edges and that right is a meshpart consisting of quad B and all its vertices and edges. Then the difference of left and right consists of the quad A, the leftmost two vertices of the mesh, the leftmost edge of the mesh, and the top and bottom edges of A. Note that the right edge of A is not part of the result meshpart, as it is an entity of right and has as such been removed.
This function does not support mesparts with topology.
This function supports meshparts with attributes. If both left and right contain an attribute with the same name and dimension, then an attribute with the same name and dimension will be created on the result meshpart. Values will be copied over from left. 
Definition at line 344 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_op(), and XASSERTM.
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_symmetric_difference().
| 
 | inlinestatic | 
Compute the intersection of two meshparts.
| AttributeFn_ | Type of attribute merging function. Must be a callable that accepts a signature of DT(const DT&, const DT&), whereDT = typename MeshPart<MeshType_>::AttributeDataType | 
| [in] | left | Lefthand-side of intersection | 
| [in] | right | Righthand-side of intersection | 
| [in] | attribute_merge | Attribute merging function | 
Computes a new meshpart that contains all entities that occur in both left and right.
Assume the following 2D mesh with quads A, B, C.
* +--------+--------+--------+ * | | | | * | A | B | C | * | | | | * +--------+--------+--------+ *
Further assume that left is a meshpart consisting of the quads A, B and all their vertices and edges and that right is a meshpart consisting of quads B, C and all their vertices and edges. Then the intersection of left and right consists of the quad B and all its vertices and edges.
This function supports meshparts with topology. If left or right contain a topology, then the applicable parts of the topologies will be copied to the result meshpart. Precedence is given to right, if an entitiy appears in both meshparts.
This function supports meshparts with attributes. If both left and right contain an attribute with the same name and dimension, then an attribute with the same name and dimension will be created on the result meshpart. For each value the attribute_merge function gets called to decide how to merge the existing attribute values. 
Definition at line 259 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_op().
| 
 | inlinestaticprivate | 
Common logic for all meshpart operations.
| AttributeFn_ | Type of attribute merging function. See actual docs of operations for details | 
| PredFn_ | Type of join predicate. Callable with signature bool(const JoinEntry&) | 
| [in] | left | Lefthand-side of operation | 
| [in] | right | Righthand-side of operation | 
| [in] | attribute_merge | Attribute merging function | 
| [in] | join_pred | Join predicate | 
This function forms the common basis for all current meshpart operations. The left, right, and attribute_merge parameters are the same as the operations parameters. The join_pred determines the actual operation, by selecting which entities should be included in the final meshpart. A join_pred that only selects entities that occur in both left and right implements an intersection, a join_pred that selects all entities implements a union, etc. 
Definition at line 427 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPartOperations< MeshType_ >::build_target_set_holder(), FEAT::Geometry::MeshPartOperations< MeshType_ >::build_topology(), FEAT::Geometry::MeshPartOperations< MeshType_ >::copy_attributes(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::join_elements().
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_difference(), FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_intersection(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_union().
| 
 | inlinestatic | 
Compute the symmetric difference of two meshparts.
| [in] | left | Lefthand-side of symmetric difference | 
| [in] | right | Righthand-side of symmetric difference | 
Computes a new meshpart that contains all entities that occur either in left but not right, or right but not left.
Assume the following 2D mesh with quads A, B, C.
* +--------+--------+--------+ * | | | | * | A | B | C | * | | | | * +--------+--------+--------+ *
Further assume that left is a meshpart consisting of the quads A, B and all their vertices and edges and that right is a meshpart consisting of quads B, C and all their vertices and edges. Then the symmetric difference of left and right consists of the quads A, C, the two leftmost vertices of the mesh the two rightmost vertices of the mesh, and the boundary edges of A and C. Note that the right edge of A and the left edge of C are not part of the result meshpart. They have been removed as part of quad B.
This function does not support mesparts with topology.
This function supports meshparts with attributes. If both left and right contain an attribute with the same name and dimension, then an attribute with the same name and dimension will be created on the result meshpart. Values will be copied over from left and right. 
Definition at line 399 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_difference(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_union().
| 
 | inlinestatic | 
Compute the union of two meshparts.
| AttributeFn_ | Type of attribute merging function. Must be a callable that accepts a signature of DT(const DT&, const DT&), whereDT = typename MeshPart<MeshType_>::AttributeDataType | 
| [in] | left | Lefthand-side of union | 
| [in] | right | Righthand-side of union | 
| [in] | attribute_merge | Attribute merging function | 
Computes a new meshpart that contains all entities that occur in either left or right.
Assume the following 2D mesh with quads A, B, C.
* +--------+--------+--------+ * | | | | * | A | B | C | * | | | | * +--------+--------+--------+ *
Further assume that left is a meshpart consisting of the quad A and all its vertices and edges and that right is a meshpart consisting of quad C and all its vertices and edges. Then the union of left and right consists of the quads A, B, and all their vertices and edges.
This function supports meshparts with topology. If left or right contain a topology, then the applicable parts of the topologies will be copied to the result meshpart. Precedence is given to right, if an entitiy appears in both meshparts.
This function supports meshparts with attributes. If both left and right contain an attribute with the same name and dimension, then an attribute with the same name and dimension will be created on the result meshpart. If an entity occurs in both meshparts, then the attribute_merge function gets called to decide how to merge the existing attribute values. Otherwise the attribute values get copied as is. 
Definition at line 306 of file mesh_part_ops.hpp.
References FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_op().
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::meshpart_symmetric_difference().
| 
 | inlinestaticprivate | 
Binary search.
| Iter_ | Iterator type | 
| T_ | Target value type | 
| [in] | begin | Start iterator | 
| [in] | end | End iterator | 
| [in] | value | Target value | 
Definition at line 993 of file mesh_part_ops.hpp.
References FEAT::value.
Referenced by FEAT::Geometry::MeshPartOperations< MeshType_ >::build_topology_inner(), and FEAT::Geometry::MeshPartOperations< MeshType_ >::join_elements().
| 
 | inlinestaticprivate | 
Binary search.
| Iter_ | Iterator type | 
| T_ | Target value type | 
| CompFn_ | Custom comparison function | 
| [in] | begin | Start iterator | 
| [in] | end | End iterator | 
| [in] | value | Target value | 
| [in] | fn | Comparison function | 
Definition at line 1021 of file mesh_part_ops.hpp.
References FEAT::value.