LifeV
InternalEntitySelector.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief This file implements the standard selector for internal entities
30 
31  @author
32  @contributor Nur Aiman Fadel <nur.fadel@mail.polimi.it>
33  @maintainer Nur Aiman Fadel <nur.fadel@mail.polimi.it>
34 
35  @date
36 
37  A more detailed description of the file (if necessary)
38  */
39 
40 #include <lifev/core/mesh/InternalEntitySelector.hpp>
41 
42 namespace LifeV
43 {
44 
45 /*! @todo This class was meant to separate internal from boundary flags. With the
46  * new way of selecting boundary entities this will be useless!
47  */
48 const markerID_Type InternalEntitySelector::defMarkFlag ( markerID_Type ( 100000 ) );
49 
50 // ===================================================
51 // Constructors & Destructor
52 // ===================================================
53 InternalEntitySelector::InternalEntitySelector() :
54  M_watermarkFlag ( defMarkFlag )
55 {}
56 
57 InternalEntitySelector::InternalEntitySelector ( const markerID_Type& w ) :
58  M_watermarkFlag ( w )
59 {}
60 
61 SetFlagAccordingToWatermarks::SetFlagAccordingToWatermarks ( const flag_Type& flagToSet,
62  const std::vector<markerID_Type>& watermarks,
63  const flagPolicy_ptr& flagPolicy) :
64  M_flagToSet (flagToSet),
65  M_watermarks (watermarks),
66  M_flagPolicy (flagPolicy)
67 {
68  std::sort (M_watermarks.begin(), M_watermarks.end() );
69 }
70 
71 // ===================================================
72 // Operators
73 // ===================================================
74 bool InternalEntitySelector::operator() ( markerID_Type const& test ) const
75 {
76  return ( test == markerID_Type ( 0 ) || test > M_watermarkFlag );
77 }
78 
79 //========================================================
80 // Methods
81 //========================================================
82 void SetFlagAccordingToMarkerRanges::insert ( rangeID_Type const& key, flag_Type flag )
83 {
84  M_map[ key ] = flag;
85 }
86 
87 std::pair<flag_Type, bool> SetFlagAccordingToMarkerRanges::findFlag ( markerID_Type const& m ) const
88 {
89  if ( !M_map.empty() )
90  {
91  const_iterator_Type it = M_map.upper_bound ( std::make_pair ( m, markerID_Type ( 0 ) ) );
92  if ( it-- != M_map.begin() ) // go back one
93  {
94  markerID_Type first = it->first.first;
95  markerID_Type second = it->first.second;
96  if ( m >= first && m <= second )
97  {
98  return std::make_pair ( it->second, true );
99  }
100  }
101  }
102  return std::make_pair ( flag_Type ( 0 ), false );
103 }
104 
105 } // Namespace LifeV
uint32_type flag_Type
bit-flag with up to 32 different flags
Definition: LifeV.hpp:197
ID markerID_Type
markerID_Type is the type used to store the geometric entity marker IDs
Definition: Marker.hpp:81
void updateInverseJacobian(const UInt &iQuadPt)