void modifVec(std::list<ElementRange> const& __r, eltType const& u,vectorType & UnVec,ExprType const& expr, size_type rowstart, int ComponentShiftFactor, mpl::int_<MESH_POINTS> /**/ ) { const size_type context = ExprType::context|vm::POINT; auto mesh = u.functionSpace()->mesh().get(); auto const* dof = u.functionSpace()->dof().get(); auto const* fe = u.functionSpace()->fe().get(); if ( __r.size() == 0 ) return; auto point_it = __r.begin()->template get<1>(); auto point_en = __r.begin()->template get<2>(); bool findAPoint = false; for( auto lit = __r.begin(), len = __r.end(); lit != len; ++lit ) { point_it = lit->template get<1>(); point_en = lit->template get<2>(); if ( point_it != point_en ) { findAPoint=true; break; } } if ( !findAPoint ) return; auto const& pointForInit = boost::unwrap_ref( *point_it ); size_type eid = pointForInit.elements().begin()->first; size_type ptid_in_element = pointForInit.elements().begin()->second; auto const& elt = mesh->element( eid ); auto gm = mesh->gm(); auto geopc = gm->preCompute( fe->vertexPoints(ptid_in_element) ); auto ctx = gm->template context<context>( elt, geopc ); auto expr_evaluator = expr.evaluator( mapgmc(ctx) ); auto IhLoc = fe->vertexLocalInterpolant(); std::vector<bool> dofdone( dof->nLocalDofWithGhost(), false ); for( auto const& lit : __r ) { point_it = lit.template get<1>(); point_en = lit.template get<2>(); DVLOG(2) << "point " << point_it->id() << " with marker " << point_it->marker() << " nb: " << std::distance(point_it,point_en); if ( point_it == point_en ) continue; for ( ; point_it != point_en;++point_it ) { auto const& thept = boost::unwrap_ref( *point_it ); size_type eid = thept.elements().begin()->first; size_type ptid_in_element = thept.elements().begin()->second; auto const& elt = mesh->element( eid ); geopc = gm->preCompute( fe->vertexPoints(ptid_in_element) ); ctx->update( elt, ptid_in_element, geopc, mpl::int_<0>() ); expr_evaluator.update( mapgmc( ctx ) ); fe->vertexInterpolate( expr_evaluator, IhLoc ); for (int c1=0;c1<eltType::nComponents1;c1++) //for( int c = 0; c < (is_product?nComponents:1); ++c ) { size_type index = dof->localToGlobal( eid, ptid_in_element, c1 ).index(); //size_type thedof = u.start()+ (is_comp_space?Elem1::nComponents:1)*index; // global dof size_type thedof = u.start() + ComponentShiftFactor*index; if ( dofdone[index] ) continue; double value = IhLoc( c1 ); UnVec->set(rowstart+thedof,value); dofdone[index] = true; } } } }
void modifVec(std::list<ElementRange> const& __r, eltType const& u,vectorType & UnVec,ExprType const& expr, size_type rowstart, int ComponentShiftFactor, mpl::int_<MESH_EDGES> /**/ ) { const size_type context = ExprType::context|vm::POINT; auto mesh = u.functionSpace()->mesh().get(); auto const* dof = u.functionSpace()->dof().get(); auto const* fe = u.functionSpace()->fe().get(); if ( __r.size() == 0 ) return; auto edge_it = __r.begin()->template get<1>(); auto edge_en = __r.begin()->template get<2>(); bool findAEdge = false; for( auto lit = __r.begin(), len = __r.end(); lit != len; ++lit ) { edge_it = lit->template get<1>(); edge_en = lit->template get<2>(); if ( edge_it != edge_en ) { findAEdge=true; break; } } if ( !findAEdge ) return; auto const& edgeForInit = boost::unwrap_ref( *edge_it ); auto gm = mesh->gm(); //auto const& firstEntity = *entity_it; size_type eid = edgeForInit.elements().begin()->first; size_type ptid_in_element = edgeForInit.elements().begin()->second; auto const& elt = mesh->element( eid ); auto geopc = gm->preCompute( fe->edgePoints(ptid_in_element) ); auto ctx = gm->template context<context>( elt, geopc ); auto expr_evaluator = expr.evaluator( mapgmc(ctx) ); auto IhLoc = fe->edgeLocalInterpolant(); std::vector<bool> dofdone( dof->nLocalDofWithGhost(), false ); for( auto const& lit : __r ) { edge_it = lit.template get<1>(); edge_en = lit.template get<2>(); for ( ; edge_it != edge_en;++edge_it ) { auto const& theedge = boost::unwrap_ref( *edge_it ); if ( theedge.isGhostCell() ) { LOG(WARNING) << "edge id : " << theedge.id() << " is a ghost edge"; continue; } size_type eid = theedge.elements().begin()->first; size_type edgeid_in_element = theedge.elements().begin()->second; auto const& elt = mesh->element( eid ); geopc = gm->preCompute( fe->edgePoints(edgeid_in_element) ); ctx->update( elt, geopc ); expr_evaluator.update( mapgmc( ctx ) ); fe->edgeInterpolate( expr_evaluator, IhLoc ); for( auto const& ldof : u.functionSpace()->dof()->edgeLocalDof( eid, edgeid_in_element ) ) { size_type index = ldof.index(); if ( dofdone[index] ) continue; //size_type thedof = u.start()+ (is_comp_space?Elem1::nComponents:1)*ldof.index(); size_type thedof = u.start() + ComponentShiftFactor*index; double value = ldof.sign()*IhLoc( ldof.localDofInFace() ); UnVec->set(rowstart+thedof,value); dofdone[index] = true; } } // edge_it } // lit }