32 #include <boost/multi_index_container.hpp>
33 #include <boost/multi_index/member.hpp>
34 #include <boost/multi_index/mem_fun.hpp>
35 #include <boost/multi_index/ordered_index.hpp>
37 #include <feel/feelmesh/geoelement.hpp>
41 namespace multi_index = boost::multi_index;
51 template<u
int16_type nDim>
61 typedef GeoElement0D<nDim> point_type;
62 typedef multi_index::multi_index_container<
64 multi_index::indexed_by<
66 multi_index::ordered_unique<multi_index::identity<point_type> >,
68 multi_index::ordered_non_unique<multi_index::tag<detail::by_marker>,
69 multi_index::const_mem_fun<point_type,
71 &point_type::marker> >,
74 multi_index::ordered_non_unique<multi_index::tag<detail::by_pid>,
75 multi_index::const_mem_fun<point_type,
77 &point_type::processId> >,
80 multi_index::ordered_non_unique<multi_index::tag<detail::by_location>,
81 multi_index::const_mem_fun<point_type,
83 &point_type::isOnBoundary> >
88 typedef typename points_type::iterator point_iterator;
89 typedef typename points_type::const_iterator point_const_iterator;
91 typedef typename points_type::template index<detail::by_marker>::type marker_points;
92 typedef typename marker_points::iterator marker_point_iterator;
93 typedef typename marker_points::const_iterator marker_point_const_iterator;
95 typedef typename points_type::template index<detail::by_pid>::type pid_points;
96 typedef typename pid_points::iterator pid_point_iterator;
97 typedef typename pid_points::const_iterator pid_point_const_iterator;
99 typedef typename points_type::template index<detail::by_location>::type location_points;
100 typedef typename location_points::iterator location_point_iterator;
101 typedef typename location_points::const_iterator location_point_const_iterator;
111 Points( WorldComm
const& worldComm = Environment::worldComm() )
113 M_worldCommPoints( worldComm ),
117 Points( Points
const & f )
119 M_worldCommPoints( f.M_worldCommPoints ),
120 M_points( f.M_points )
136 M_worldCommPoints = e.M_worldCommPoints;
137 M_points = e.M_points;
160 points_type
const&
points()
const
168 return M_points.empty();
170 bool isBoundaryPoint( point_type
const & e )
const
172 return M_points.find( e )->isOnBoundary();
174 bool isBoundaryPoint(
size_type const &
id )
const
176 return M_points.find( point_type(
id ) )->isOnBoundary();
180 point_type
const& point(
size_type i )
const
182 return *M_points.find( point_type( i ) );
185 point_iterator beginPoint()
187 return M_points.begin();
189 point_const_iterator beginPoint()
const
191 return M_points.begin();
193 point_iterator endPoint()
195 return M_points.end();
197 point_const_iterator endPoint()
const
199 return M_points.end();
203 marker_point_iterator beginPointWithMarker(
size_type m )
205 return M_points.template get<detail::by_marker>().lower_bound( Marker1(m) );
207 marker_point_const_iterator beginPointWithMarker(
size_type m )
const
209 return M_points.template get<detail::by_marker>().lower_bound( Marker1(m) );
211 marker_point_iterator endPointWithMarker(
size_type m )
213 return M_points.template get<detail::by_marker>().upper_bound( Marker1(m) );
215 marker_point_const_iterator endPointWithMarker(
size_type m )
const
217 return M_points.template get<detail::by_marker>().upper_bound( Marker1(m) );
220 point_iterator pointIterator(
size_type i )
const
222 return M_points.find( point_type( i ) );
227 return M_points.find( point_type( i ) ) != M_points.end();
235 typename points_type::template nth_index<0>::type &
238 return M_points.template get<0>();
247 typename points_type::template nth_index<0>::type
const&
250 return M_points.template get<0>();
262 return M_points.template get<detail::by_marker>();
272 pointsByMarker()
const
274 return M_points.template get<detail::by_marker>();
285 return M_points.template get<detail::by_location>();
294 location_points
const&
295 pointsByLocation()
const
297 return M_points.template get<detail::by_location>();
305 location_point_iterator beginInternalPoint()
307 return M_points.template get<detail::by_location>().lower_bound( INTERNAL );
314 location_point_iterator endInternalPoint()
316 return M_points.template get<detail::by_location>().upper_bound( INTERNAL );
324 location_point_const_iterator beginInternalPoint()
const
326 return M_points.template get<detail::by_location>().lower_bound( INTERNAL );
334 location_point_const_iterator endInternalPoint()
const
336 return M_points.template get<detail::by_location>().upper_bound( INTERNAL );
344 location_point_iterator beginPointOnBoundary()
346 return M_points.template get<detail::by_location>().lower_bound( ON_BOUNDARY );
353 location_point_iterator endPointOnBoundary()
355 return M_points.template get<detail::by_location>().upper_bound( ON_BOUNDARY );
363 location_point_const_iterator beginPointOnBoundary()
const
365 return M_points.template get<detail::by_location>().lower_bound( ON_BOUNDARY );
373 location_point_const_iterator endPointOnBoundary()
const
375 return M_points.template get<detail::by_location>().upper_bound( ON_BOUNDARY );
379 std::pair<pid_point_iterator, pid_point_iterator>
382 return M_points.template get<detail::by_pid>().equal_range( p );
403 point_type
const& addPoint( point_type
const& f )
405 return *M_points.insert( f ).first;
408 WorldComm
const& worldCommPoints()
const
410 return M_worldCommPoints;
413 void setWorldCommPoints( WorldComm
const& _worldComm )
415 M_worldCommPoints = _worldComm;
422 friend class boost::serialization::access;
423 template<
class Archive>
424 void serialize( Archive & ar,
const unsigned int version )
430 WorldComm M_worldCommPoints;
432 points_type M_points;