29 #ifndef __DiscontinuousInterfaces_H
30 #define __DiscontinuousInterfaces_H 1
53 static const bool is_continuous =
false;
54 static const bool is_discontinuous_locally =
true;
55 static const bool is_discontinuous_totally =
false;
57 static const uint16_type n_discontinuities = fusion::result_of::size<A0>::type::value;
67 typedef A0 discontinuity_markers_type;
84 M_d_faces( d.M_d_faces )
102 M_d_faces = d.M_d_faces;
114 discontinuity_markers_type
const& discontinuityMarkers()
const
138 template<
typename MeshType,
typename DofType>
143 typedef MeshType mesh_type;
144 typedef DofType dof_type;
145 typedef typename dof_type::fe_type fe_type;
147 apply( MeshType& M, DofType& D )
153 #if BOOST_VERSION < 104200
154 result_type operator()(
const T& t,
const size_type& start )
156 result_type operator()(
const size_type& start,
const T& t )
159 boost::tuple<size_type,size_type,size_type> disc = boost::make_tuple( mpl::at<T,mpl::int_<0> >::type::value,
160 mpl::at<T,mpl::int_<1> >::type::value,
161 mpl::at<T,mpl::int_<2> >::type::value );
163 return build( disc, start );
176 build( boost::tuple<size_type,size_type,size_type>
const& marker,
size_type start )
181 typedef typename mesh_type::element_type element_type;
183 typedef typename mesh_type::element_const_iterator element_const_iterator;
185 element_const_iterator fit, fen;
187 boost::tie( fit, fen ) = M_mesh.elementsRange();
188 DVLOG(2) <<
"[DiscontinuousInterfaces::build] n_elements = " << std::distance( fit, fen )
189 <<
" with marker " << boost::get<1>( marker ) <<
"\n";
194 if ( fit->marker().value() != boost::get<1>( marker ) )
200 DVLOG(2) <<
"found element with marker " << fit->marker().value() <<
"\n";
201 typename element_type::face_const_iterator it, en;
202 boost::tie( it, en ) = fit->faces();
205 for ( ; it != en; ++it )
207 DVLOG(2) <<
"face with marker " << ( *it )->marker().value() <<
"\n";
210 DVLOG(2) <<
"------------------------------------------------------------\n";
211 DVLOG(2) <<
"face " << ( *it )->id()
212 <<
" marker = " << boost::get<0>( marker )
213 <<
" elt marker 0 = " << boost::get<1>( marker )
214 <<
" elt marker 1 = " << boost::get<2>( marker ) <<
"\n";
215 DVLOG(2) <<
"element marker " << fit->marker() <<
"\n";
217 addVertexDof( *fit, *( *it ), next_free_dof, 0, mpl::bool_<fe_type::nDofPerVertex>() );
218 addEdgeDof( *fit, *( *it ), next_free_dof, 0, mpl::bool_<fe_type::nDofPerEdge>(), mpl::int_<mesh_type::nDim>() );
228 boost::tie( fit, fen ) = M_mesh.elementsRange();
232 if ( fit->marker().value() == ( int )boost::get<1>( marker ) )
234 M_dof.addDofFromElement( *fit, next_free_dof, 0 );
242 n_dof = next_free_dof;
244 DVLOG(2) <<
"[DiscontinuousInterfaces::build] n_dof = " << n_dof <<
"\n";
247 boost::tie( fit, fen ) = M_mesh.elementsRange();
248 DVLOG(2) <<
"[DiscontinuousInterfaces::build] n_elements = " << std::distance( fit, fen )
249 <<
" with marker " << boost::get<2>( marker ) <<
"\n";
254 if ( fit->marker().value() != boost::get<2>( marker ) )
260 DVLOG(2) <<
"found element with marker " << fit->marker().value() <<
"\n";
261 typename element_type::face_const_iterator it, en;
262 boost::tie( it, en ) = fit->faces();
265 for ( ; it != en; ++it )
267 DVLOG(2) <<
"face with marker " << ( *it )->marker().value() <<
"\n";
270 DVLOG(2) <<
"------------------------------------------------------------\n";
271 DVLOG(2) <<
"face " << ( *it )->id()
272 <<
" marker = " << boost::get<0>( marker )
273 <<
" elt marker 0 = " << boost::get<1>( marker )
274 <<
" elt marker 1 = " << boost::get<2>( marker ) <<
"\n";
275 DVLOG(2) <<
"element marker " << fit->marker() <<
"\n";
277 addVertexDof( *fit, *( *it ), next_free_dof, n_dof, mpl::bool_<fe_type::nDofPerVertex>() );
278 addEdgeDof( *fit, *( *it ), next_free_dof, n_dof, mpl::bool_<fe_type::nDofPerEdge>(), mpl::int_<mesh_type::nDim>() );
290 typedef typename DofType::dof_map_type dof_map_type;
291 dof_map_type m1( M_dof.mapGDof() );
292 M_dof.clearMapGDof();
293 boost::tie( fit, fen ) = M_mesh.elementsRange();
297 if ( fit->marker().value() == boost::get<2>( marker ) )
299 M_dof.addDofFromElement( *fit, next_free_dof );
306 dof_map_type m2( M_dof.mapGDof() );
307 M_dof.clearMapGDof();
308 std::merge( m1.begin(), m1.end(), m2.begin(), m2.end(), M_dof.mapGDof().begin() );
310 dof_map_type m2( M_dof.mapGDof() );
311 M_dof.clearMapGDof();
312 typename dof_map_type::iterator it = m1.begin();
313 typename dof_map_type::iterator en = m1.end();
315 for ( ; it != en; ++it )
317 M_dof.mapGDof().insert( *it );
323 for ( ; it != en; ++it )
325 M_dof.mapGDof().insert( *it );
328 DVLOG(2) <<
"size dictionnary = " << M_dof.mapGDof().size() <<
" next_free_dof = " << next_free_dof+n_dof <<
"\n";
332 return next_free_dof;
334 template<
typename element_type,
typename face_type>
336 addVertexDof( element_type
const& elt, face_type
const& face,
size_type& next_free_dof,
size_type shift, mpl::bool_<false> )
340 template<
typename element_type,
typename face_type>
342 addVertexDof( element_type
const& elt, face_type
const& face,
size_type& next_free_dof,
size_type shift, mpl::bool_<true> )
346 if ( face.ad_first() == elt.id() )
347 iFaEl = face.pos_first();
349 else if ( face.ad_second() == elt.id() )
350 iFaEl = face.pos_second();
352 for ( uint16_type iVeFa = 0; iVeFa < face_type::numVertices; ++iVeFa )
355 uint16_type iVeEl = element_type::fToP( iFaEl, iVeFa );
356 Feel::detail::ignore_unused_variable_warning( iVeEl );
361 for ( uint16_type l = 0; l < fe_type::nDofPerVertex; ++l )
363 uint16_type lid = iVeEl * fe_type::nDofPerVertex + l;
364 const size_type gDof = ( elt.point( iVeEl ).id() ) * fe_type::nDofPerVertex + l;
366 DVLOG(2) <<
"add vertex discontinuous dof " << next_free_dof <<
" in element " << elt.id() <<
" lid = " << lid <<
"\n";
367 bool inserted = M_dof.insertDof( elt.id(), lid, iVeEl, boost::make_tuple( 0, 0, gDof ), 0, next_free_dof, 1,
false, shift );
371 FEELPP_ASSERT( inserted ==
false )( elt.id() )
372 ( lid )( gDof )( next_free_dof ).error(
"should have inserted unique dof" );
375 DVLOG(2) <<
"vertex discontinuous dof inserted : " << inserted <<
"\n";
377 DVLOG(2) <<
"added vertex discontinuous dof " << elt.id() <<
", "
379 << boost::get<0>( M_dof.localToGlobal( elt.id(), lid, 0 ) ) <<
"\n";
386 template<
typename element_type,
typename face_type>
388 addEdgeDof( element_type
const& elt, face_type
const& face,
size_type& next_free_dof,
size_type shift, mpl::bool_<false>, mpl::int_<1> )
390 template<
typename element_type,
typename face_type>
392 addEdgeDof( element_type
const& elt, face_type
const& face,
size_type& next_free_dof,
size_type shift, mpl::bool_<true>, mpl::int_<1> )
395 template<
typename element_type,
typename face_type>
397 addEdgeDof( element_type
const& elt, face_type
const& face,
size_type& next_free_dof,
size_type shift, mpl::bool_<false>, mpl::int_<2> )
399 template<
typename element_type,
typename face_type>
401 addEdgeDof( element_type
const& elt, face_type
const& face,
size_type& next_free_dof,
size_type shift, mpl::bool_<true>, mpl::int_<2> )
405 if ( face.ad_first() == elt.id() )
406 iFaEl = face.pos_first();
408 else if ( face.ad_second() == elt.id() )
409 iFaEl = face.pos_second();
412 for ( uint16_type l = 0; l < fe_type::nDofPerEdge; ++l )
414 uint16_type lid = element_type::numVertices*fe_type::nDofPerVertex + iFaEl * fe_type::nDofPerEdge + l;
415 const size_type gDof = ( elt.edge( iFaEl ).id() ) * fe_type::nDofPerEdge + l;
417 DVLOG(2) <<
"add edge discontinuous dof " << next_free_dof <<
" in element " << elt.id() <<
" lid = " << lid <<
"\n";
418 bool inserted = M_dof.insertDof( elt.id(), lid, iFaEl, boost::make_tuple( 1, 0, gDof ), 0, next_free_dof, 1,
false, shift );
419 DVLOG(2) <<
"edge discontinuous dof inserted (1 or 0) : " << inserted <<
"\n";
421 DVLOG(2) <<
"added edge discontinuous dof "
424 << boost::get<0>( M_dof.localToGlobal( elt.id(), lid, 0 ) ) <<
"\n";
435 discontinuity_markers_type M_d_faces;
const uint16_type invalid_uint16_type_value
Definition: feelcore/feel.hpp:338
describes discontinuous interfaces and provide dof creation
Definition: discontinuousinterfaces.hpp:44
DiscontinuousInterfaces()
default constructor
Definition: discontinuousinterfaces.hpp:76
~DiscontinuousInterfaces()
destructor
Definition: discontinuousinterfaces.hpp:88
DiscontinuousInterfaces & operator=(DiscontinuousInterfaces const &d)
copy operator
Definition: discontinuousinterfaces.hpp:98
size_t size_type
Indices (starting from 0)
Definition: feelcore/feel.hpp:319
DiscontinuousInterfaces(DiscontinuousInterfaces const &d)
copy constructor
Definition: discontinuousinterfaces.hpp:82