29 #ifndef __Reinit_Fms_H
30 #define __Reinit_Fms_H 1
32 #include <feel/feel.hpp>
41 template<
typename FunctionSpaceType,
typename IteratorRange,
typename periodicity_type = NoPeriodicity>
42 class ReinitializerFMS
51 enum status_type { DONE=0, CLOSE=1, FAR=2 };
53 typedef FunctionSpaceType functionspace_type;
54 typedef boost::shared_ptr<functionspace_type> functionspace_ptrtype;
55 typedef typename functionspace_type::element_type element_type;
56 typedef boost::shared_ptr<element_type> element_ptrtype;
57 typedef typename functionspace_type::value_type value_type;
59 typedef typename functionspace_type::mesh_type mesh_type;
60 typedef typename mesh_type::element_type geoelement_type;
61 static const uint16_type Dim = geoelement_type::nDim;
63 typedef typename boost::tuples::template element<1, IteratorRange>::type iterator_type;
64 typedef IteratorRange range_iterator;
66 ReinitializerFMS( functionspace_ptrtype
const& __functionspace,
67 IteratorRange
const& r ,
68 periodicity_type __periodicity=NoPeriodicity());
81 virtual ~ReinitializerFMS() {}
89 element_type operator() ( element_type
const& phi)
const;
94 typedef typename functionspace_type::fe_type fe_type;
96 typedef typename functionspace_type::gm_type gm_type;
97 typedef typename gm_type::template Context<vm::POINT, geoelement_type>
99 typedef typename fe_type::template Context<vm::POINT, fe_type, gm_type, geoelement_type> fecontext_type;
101 typedef boost::shared_ptr<gm_context_type> gm_context_ptrtype;
103 typedef decltype( vf::P() ) expression_type;
104 typedef fusion::map<fusion::pair<vf::detail::gmc<0>, gm_context_ptrtype> > map_gmc_type;
105 typedef typename expression_type::template tensor<map_gmc_type,fecontext_type> t_expr_type;
107 typedef Feel::details::FmsPoint<value_type, Dim> point_type;
108 typedef std::map<
size_type, std::set<size_type> > neighbors_type;
110 void updatePeriodicPoint(typename Feel::details::FmsHeap<value_type>::heap_entry_type const& newAccepted,
112 std::vector<status_type>& status,
113 Feel::details::FmsHeap<value_type>& theHeap) const;
115 void fmsHeapUpdate( size_type idDone,
116 element_type const& __v,
117 std::vector<status_type>& status,
118 Feel::details::FmsHeap<value_type>& theHeap ) const;
120 value_type fmsDistN( std::vector<size_type> const& ids,
121 element_type const& __v ) const;
123 value_type fmsDistRec( std::vector<size_type> & ids,
125 element_type const& __v,
127 std::vector<status_type> const& status ) const;
129 value_type closerOne( value_type a, value_type b )
const
131 return a*a < b*b ? a : b;
134 functionspace_ptrtype
const& M_functionspace;
135 range_iterator M_range;
136 periodicity_type M_periodicity;
137 neighbors_type M_neighbors;
138 std::vector<point_type> M_coords;
139 vf::node_type M_translation;
143 typedef Mesh< Simplex<2> > mesh_typeLS;
144 typedef boost::shared_ptr<mesh_typeLS> mesh_ptrtypeLS;
145 typedef bases<Lagrange<1, Scalar> > basisP1LS_type;
146 typedef FunctionSpace<mesh_typeLS, basisP1LS_type, Periodicity <NoPeriodicity> > spaceP1LS_type;
147 mesh_ptrtypeLS ___mesh_LS;
148 typedef decltype(
elements( ___mesh_LS ) ) itRangeLS;
150 typedef ReinitializerFMS< spaceP1LS_type, itRangeLS, Periodic<> > fms_2d_type;
151 typedef ReinitializerFMS< spaceP1LS_type, itRangeLS, NoPeriodicity > fms_2d_periodic_type;
153 #if !defined( FEELPP_INSTANTIATE_FMS )
154 extern template class ReinitializerFMS< spaceP1LS_type, itRangeLS, Periodic<> > ;
155 extern template class ReinitializerFMS< spaceP1LS_type, itRangeLS, NoPeriodicity > ;
159 typedef Mesh< Simplex<3> > mesh_3d_typeLS;
160 typedef boost::shared_ptr<mesh_3d_typeLS> mesh_3d_ptrtypeLS;
161 typedef FunctionSpace<mesh_3d_typeLS, basisP1LS_type, Periodicity <NoPeriodicity> > spaceP1LS_3d_type;
162 mesh_3d_ptrtypeLS ___mesh_3d_LS;
163 typedef decltype(
elements( ___mesh_3d_LS ) ) itRange_3d_LS;
165 typedef ReinitializerFMS< spaceP1LS_3d_type, itRange_3d_LS, NoPeriodicity > fms_3d_type;
166 typedef ReinitializerFMS< spaceP1LS_3d_type, itRange_3d_LS, Periodic<> > fms_3d_periodic_type;
168 #if !defined( FEELPP_INSTANTIATE_FMS )
169 extern template class ReinitializerFMS< spaceP1LS_3d_type, itRange_3d_LS, NoPeriodicity > ;
170 extern template class ReinitializerFMS< spaceP1LS_3d_type, itRange_3d_LS, Periodic<> > ;
173 template<
typename FunctionSpaceType,
typename IteratorRange,
typename periodicity_type = NoPeriodicity>
174 boost::shared_ptr<ReinitializerFMS< FunctionSpaceType, IteratorRange, periodicity_type>>
175 fms( boost::shared_ptr<FunctionSpaceType>
const& Xh,
177 periodicity_type p = NoPeriodicity() )
179 boost::shared_ptr<ReinitializerFMS< FunctionSpaceType, IteratorRange, periodicity_type>> ret(
new ReinitializerFMS< FunctionSpaceType, IteratorRange, periodicity_type>( Xh, r ) );
elements_type const & elements() const
Definition: elements.hpp:355
size_t size_type
Indices (starting from 0)
Definition: feelcore/feel.hpp:319