41 #ifndef DTK_COARSEGLOBALSEARCH_HPP 42 #define DTK_COARSEGLOBALSEARCH_HPP 45 #include "DTK_EntityIterator.hpp" 46 #include "DTK_EntityLocalMap.hpp" 47 #include "DTK_Types.hpp" 49 #include <Teuchos_Array.hpp> 50 #include <Teuchos_ArrayView.hpp> 51 #include <Teuchos_Comm.hpp> 52 #include <Teuchos_ParameterList.hpp> 53 #include <Teuchos_RCP.hpp> 54 #include <Teuchos_Tuple.hpp> 69 const int physical_dimension,
71 const Teuchos::ParameterList ¶meters );
76 const Teuchos::RCP<EntityLocalMap> &range_local_map,
77 const Teuchos::ParameterList ¶meters,
78 Teuchos::Array<EntityId> &range_entity_ids,
79 Teuchos::Array<int> &range_owner_ranks,
80 Teuchos::Array<double> &range_centroids )
const;
94 Teuchos::Tuple<double, 6> &bounding_box )
const;
97 inline bool boxesIntersect(
const Teuchos::Tuple<double, 6> &box_A,
98 const Teuchos::Tuple<double, 6> &box_B,
99 const double tolerance )
const;
102 inline bool pointInBox(
const Teuchos::ArrayView<const double> &point,
103 const Teuchos::Tuple<double, 6> &box,
104 const double tolerance )
const;
108 Teuchos::RCP<const Teuchos::Comm<int>> d_comm;
114 Teuchos::Array<Teuchos::Tuple<double, 6>> d_domain_boxes;
117 bool d_track_missed_range_entities;
121 mutable Teuchos::Array<EntityId> d_missed_range_entity_ids;
124 double d_inclusion_tol;
131 bool CoarseGlobalSearch::boxesIntersect(
const Teuchos::Tuple<double, 6> &box_A,
132 const Teuchos::Tuple<double, 6> &box_B,
133 const double tolerance )
const 135 double x_tol_A = ( box_A[3] - box_A[0] ) * tolerance;
136 double y_tol_A = ( box_A[4] - box_A[1] ) * tolerance;
137 double z_tol_A = ( box_A[5] - box_A[2] ) * tolerance;
139 double x_tol_B = ( box_B[3] - box_B[0] ) * tolerance;
140 double y_tol_B = ( box_B[4] - box_B[1] ) * tolerance;
141 double z_tol_B = ( box_B[5] - box_B[2] ) * tolerance;
143 return !( ( ( box_A[0] - x_tol_A ) > ( box_B[3] + x_tol_B ) ||
144 ( box_A[3] + x_tol_A ) < ( box_B[0] - x_tol_B ) ) ||
145 ( ( box_A[1] - y_tol_A ) > ( box_B[4] + y_tol_B ) ||
146 ( box_A[4] + y_tol_A ) < ( box_B[1] - y_tol_B ) ) ||
147 ( ( box_A[2] - z_tol_A ) > ( box_B[5] + z_tol_B ) ||
148 ( box_A[5] + z_tol_A ) < ( box_B[2] - z_tol_B ) ) );
153 bool CoarseGlobalSearch::pointInBox(
154 const Teuchos::ArrayView<const double> &point,
155 const Teuchos::Tuple<double, 6> &box,
const double tolerance )
const 157 double x_tol = ( box[3] - box[0] ) * tolerance;
158 double y_tol = ( box[4] - box[1] ) * tolerance;
159 double z_tol = ( box[5] - box[2] ) * tolerance;
161 if ( 3 == point.size() )
163 if ( point[0] >= ( box[0] - x_tol ) && point[1] >= ( box[1] - y_tol ) &&
164 point[2] >= ( box[2] - z_tol ) && point[0] <= ( box[3] + x_tol ) &&
165 point[1] <= ( box[4] + y_tol ) && point[2] <= ( box[5] + z_tol ) )
170 else if ( 2 == point.size() )
172 if ( point[0] >= ( box[0] - x_tol ) && point[1] >= ( box[1] - y_tol ) &&
173 point[0] <= ( box[3] + x_tol ) && point[1] <= ( box[4] + y_tol ) )
178 else if ( 1 == point.size() )
180 if ( point[0] >= ( box[0] - x_tol ) && point[0] <= ( box[3] + x_tol ) )
193 #endif // DTK_COARSEGLOBALSEARCH_HPP Entity iterator interface.
Assertions and Design-by-Contract for error handling.
Teuchos::ArrayView< const EntityId > getMissedRangeEntityIds() const
Return the ids of the range entities that were not during the last search (i.e. those that are guaran...
A CoarseGlobalSearch data structure for global entity coarse search.