40 #ifndef _SELECTMARKER_HH_ 41 #define _SELECTMARKER_HH_ 1
44 #include <lifev/core/mesh/Marker.hpp> 45 #include <lifev/core/mesh/MeshEntityContainer.hpp> 61 class InternalEntitySelector
71 InternalEntitySelector();
109 class MarkerMapTraits
116 bool operator() ( rangeID_Type
const& a, rangeID_Type
const& b )
const 118 return a.first < b.first;
152 class SetFlagAccordingToMarkerRanges
158 typedef Utility::MarkerMapTraits::rangeID_Type rangeID_Type;
161 explicit SetFlagAccordingToMarkerRanges (
const flagPolicy_ptr& flagPolicy = &
Flag::turnOn ) :
162 M_flagPolicy (flagPolicy) {};
173 void insert (rangeID_Type
const& key,
flag_Type flag);
190 template<
typename MeshEntity>
191 void operator() (MeshEntity& e)
const 193 std::pair<
flag_Type,
bool> tmp =
this->findFlag ( e.markerID() );
196 e.replaceFlag ( M_flagPolicy ( e.flag(), tmp.first ) );
201 typedef std::map<rangeID_Type, flag_Type, Utility::MarkerMapTraits> map_Type;
202 typedef map_Type::const_iterator const_iterator_Type;
204 flagPolicy_ptr M_flagPolicy;
244 class SetFlagAccordingToWatermark
257 SetFlagAccordingToWatermark (
const flag_Type& flagToSet,
260 M_flagToSet ( flagToSet ),
261 M_watermark ( watermark ),
262 M_policy ( Policy() ),
263 M_flagPolicy ( flagPolicy ) {}
270 template<
typename MeshEntity>
271 void operator() ( MeshEntity& e )
const 273 if ( M_policy (e.markerID(), M_watermark) )
275 e.replaceFlag ( M_flagPolicy ( e.flag(), M_flagToSet ) );
282 const Policy M_policy;
283 const flagPolicy_ptr M_flagPolicy;
307 class SetFlagAccordingToWatermarks
320 SetFlagAccordingToWatermarks (
const flag_Type& flagToSet,
321 const std::vector<markerID_Type>& watermarks,
329 template<
typename MeshEntity>
330 void operator() ( MeshEntity& e )
const 332 if ( std::binary_search ( M_watermarks.begin(), M_watermarks.end(), e.markerID() ) )
334 e.replaceFlag ( M_flagPolicy ( e.flag(), M_flagToSet ) );
340 std::vector<markerID_Type> M_watermarks;
341 const flagPolicy_ptr M_flagPolicy;
363 template <
typename MeshEntityList>
365 ChangeMarkersAccordingToMap ( MeshEntityList& entityList,
366 std::map<UInt, UInt>
const& locDof,
367 UInt const newMarker )
369 typedef std::map<UInt, UInt>::const_iterator it_type;
370 for ( it_type it = locDof.begin(); it != locDof.end(); ++it )
372 entityList[ it->second ].setMarkerID ( newMarker );
uint32_type flag_Type
bit-flag with up to 32 different flags
flag_Type turnOn(flag_Type const &inputFlag, flag_Type const &refFlag)
turns on the refFlag active bits in inputFlag
ID markerID_Type
markerID_Type is the type used to store the geometric entity marker IDs
flag related free functions and functors
uint32_type UInt
generic unsigned integer (used mainly for addressing)