29 #ifndef __BilinearFormContext_H
30 #define __BilinearFormContext_H 1
41 template<
typename FE1,
typename FE2,
typename ElemContType>
42 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
43 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::Context( form_type& __form,
44 map_test_geometric_mapping_context_type
const& _gmcTest,
45 map_trial_geometric_mapping_context_type
const& _gmcTrial,
46 map_geometric_mapping_expr_context_type
const & gmcExpr,
51 M_lb( __form.blockList() ),
52 M_test_dof( __form.testSpace()->dof().get() ),
53 M_trial_dof( __form.trialSpace()->dof().get() ),
56 M_test_pc( new test_precompute_type( M_form.testSpace()->fe(), fusion::at_key<gmc<0> >( _gmcTest )->pc()->nodes() ) ),
57 M_test_pc_face( precomputeTestBasisAtPoints( im ) ),
58 M_trial_pc( new trial_precompute_type( M_form.trialSpace()->fe(), fusion::at_key<gmc<0> >( _gmcTrial )->pc()->nodes() ) ),
59 M_trial_pc_face( precomputeTrialBasisAtPoints( im ) ),
61 M_test_gmc( _gmcTest ),
62 M_trial_gmc( _gmcTrial ),
64 M_test_fec( fusion::transform( _gmcTest,
65 vf::detail::FEContextInit<0,form_context_type>( __form.testSpace()->fe(),
67 M_test_fec0( fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) ) ),
68 M_trial_fec( getMap( M_test_fec, fusion::transform( _gmcTrial,
69 vf::detail::FEContextInit<1,form_context_type>( __form.trialSpace()->fe(),
71 M_trial_fec0( getMapL( M_test_fec0, fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_trial_fec ) ) ) ),
75 M_eval_expr00( new eval00_expr_type( expr, gmcExpr, M_test_fec0, M_trial_fec0 ) ),
83 M_eval_expr00->init( im );
86 template<
typename FE1,
typename FE2,
typename ElemContType>
87 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
88 template<
typename IM2>
89 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::Context( form_type& __form,
90 map_test_geometric_mapping_context_type
const& _gmcTest,
91 map_trial_geometric_mapping_context_type
const& _gmcTrial,
92 map_geometric_mapping_expr_context_type
const & _gmcExpr,
98 M_lb( __form.blockList() ),
99 M_test_dof( __form.testSpace()->dof().get() ),
100 M_trial_dof( __form.trialSpace()->dof().get() ),
102 M_test_pc( new test_precompute_type( M_form.testSpace()->fe(), im2.
points() ) ),
103 M_test_pc_face( precomputeTestBasisAtPoints( im2 ) ),
104 M_trial_pc( new trial_precompute_type( M_form.trialSpace()->fe(), im2.
points() ) ),
105 M_trial_pc_face( precomputeTrialBasisAtPoints( im2 ) ),
107 M_test_gmc( _gmcTest ),
108 M_trial_gmc( _gmcTrial ),
110 M_test_fec( fusion::transform( _gmcTest, vf::detail::FEContextInit<0,form_context_type>( __form.testSpace()->fe(), *this ) ) ),
111 M_test_fec0( fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) ) ),
112 M_trial_fec( getMap( M_test_fec, fusion::transform( _gmcTrial, vf::detail::FEContextInit<1,form_context_type>( __form.trialSpace()->fe(), *this ) ) ) ),
113 M_trial_fec0( getMapL( M_test_fec0, fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_trial_fec ) ) ) ),
116 M_eval_expr00( new eval00_expr_type( expr, _gmcExpr, M_test_fec0, M_trial_fec0 ) ),
123 M_eval_expr00->init( im2 );
126 template<
typename FE1,
typename FE2,
typename ElemContType>
127 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
128 template<
typename IMTest,
typename IMTrial>
129 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::Context( form_type& __form,
130 map_test_geometric_mapping_context_type
const& _gmcTest,
131 map_trial_geometric_mapping_context_type
const& _gmcTrial,
132 map_geometric_mapping_expr_context_type
const & _gmcExpr,
136 IMTest
const& imTest, IMTrial
const& imTrial )
139 M_lb( __form.blockList() ),
140 M_test_dof( __form.testSpace()->dof().get() ),
141 M_trial_dof( __form.trialSpace()->dof().get() ),
143 M_test_pc( new test_precompute_type( M_form.testSpace()->fe(), fusion::at_key<gmc<0> >( _gmcTest )->pc()->nodes() ) ),
144 M_test_pc_face( precomputeTestBasisAtPoints( imTest ) ),
145 M_trial_pc( new trial_precompute_type( M_form.trialSpace()->fe(), fusion::at_key<gmc<0> >( _gmcTrial )->pc()->nodes() ) ),
146 M_trial_pc_face( precomputeTrialBasisAtPoints( imTrial ) ),
153 M_test_gmc( _gmcTest ),
154 M_trial_gmc( _gmcTrial ),
156 M_test_fec( fusion::transform( _gmcTest, vf::detail::FEContextInit<0,form_context_type>( __form.testSpace()->fe(), *this ) ) ),
157 M_test_fec0( fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) ) ),
158 M_trial_fec( getMap( M_test_fec, fusion::transform( _gmcTrial, vf::detail::FEContextInit<1,form_context_type>( __form.trialSpace()->fe(), *this ) ) ) ),
159 M_trial_fec0( getMapL( M_test_fec0, fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_trial_fec ) ) ) ),
162 M_eval_expr00( new eval00_expr_type( expr, _gmcExpr, M_test_fec0, M_trial_fec0 ) ),
169 M_eval_expr00->init( im );
172 template<
typename FE1,
typename FE2,
typename ElemContType>
173 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
174 template<
typename IM2>
175 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::Context( form_type& __form,
176 map_test_geometric_mapping_context_type
const& _gmcTest,
177 map_trial_geometric_mapping_context_type
const& _gmcTrial,
178 map_geometric_mapping_expr_context_type
const & _gmcExpr,
185 M_lb( __form.blockList() ),
186 M_test_dof( __form.testSpace()->dof().get() ),
187 M_trial_dof( __form.trialSpace()->dof().get() ),
189 M_test_pc( new test_precompute_type( M_form.testSpace()->fe(), im2.
points() ) ),
190 M_test_pc_face( precomputeTestBasisAtPoints( im2 ) ),
191 M_trial_pc( new trial_precompute_type( M_form.trialSpace()->fe(), im2.
points() ) ),
192 M_trial_pc_face( precomputeTrialBasisAtPoints( im2 ) ),
194 M_test_gmc( _gmcTest ),
195 M_trial_gmc( _gmcTrial ),
197 M_test_fec( fusion::transform( _gmcTest, vf::detail::FEContextInit<0,form_context_type>( __form.testSpace()->fe(), *this ) ) ),
198 M_test_fec0( fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) ) ),
199 M_test_fec1( fusion::make_map<test_gmc1 >( fusion::at_key<test_gmc1 >( M_test_fec ) ) ),
200 M_trial_fec( fusion::transform( _gmcTrial, vf::detail::FEContextInit<1,form_context_type>( __form.trialSpace()->fe(), *this ) ) ),
201 M_trial_fec0( fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_trial_fec ) ) ),
202 M_trial_fec1( fusion::make_map<trial_gmc1 >( fusion::at_key<trial_gmc1 >( M_trial_fec ) ) ),
205 M_eval_expr00( new eval00_expr_type( expr, _gmcExpr, M_test_fec0, M_trial_fec0 ) ),
206 M_eval_expr01( new eval01_expr_type( expr, _gmcExpr, M_test_fec0, M_trial_fec1 ) ),
207 M_eval_expr10( new eval10_expr_type( expr, _gmcExpr, M_test_fec1, M_trial_fec0 ) ),
208 M_eval_expr11( new eval11_expr_type( expr, _gmcExpr, M_test_fec1, M_trial_fec1 ) ),
211 FEELPP_ASSERT( fusion::at_key<gmc<0> >( M_test_fec0 ).
get() != 0 ).error(
"invalid test_fec" );
212 FEELPP_ASSERT( fusion::at_key<test_gmc1 >( M_test_fec1 ).
get() != 0 ).error(
"invalid test_fec" );
213 FEELPP_ASSERT( fusion::at_key<gmc<0> >( M_trial_fec0 ).
get() != 0 ).error(
"invalid trial_fec" );
214 FEELPP_ASSERT( fusion::at_key<trial_gmc1 >( M_trial_fec1 ).
get() != 0 ).error(
"invalid trial_fec" );
216 M_eval_expr00->init( im2 );
217 M_eval_expr01->init( im2 );
218 M_eval_expr10->init( im2 );
219 M_eval_expr11->init( im2 );
222 template<
typename FE1,
typename FE2,
typename ElemContType>
223 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
225 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::update( map_test_geometric_mapping_context_type
const& _gmcTest,
226 map_trial_geometric_mapping_context_type
const& _gmcTrial,
227 map_geometric_mapping_expr_context_type
const& _gmcExpr )
229 update( _gmcTest, _gmcTrial, _gmcExpr, boost::is_same<map_test_fecontext_type, map_trial_fecontext_type>() );
231 M_integrator.update( *fusion::at_key<gmc<0> >( _gmcExpr ) );
233 template<
typename FE1,
typename FE2,
typename ElemContType>
234 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
236 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::update( map_test_geometric_mapping_context_type
const& _gmcTest,
237 map_trial_geometric_mapping_context_type
const& _gmcTrial,
238 map_geometric_mapping_expr_context_type
const& _gmcExpr,
241 fusion::for_each( M_test_fec, vf::detail::FEContextUpdate<0,form_context_type>( _gmcTest, *
this ) );
242 M_test_fec0 = fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) );
243 fusion::for_each( M_trial_fec, vf::detail::FEContextUpdate<1,form_context_type>( _gmcTrial, *
this ) );
244 M_trial_fec0 = fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_trial_fec ) );
245 M_eval_expr00->update( _gmcExpr, M_test_fec0, M_trial_fec0 );
247 template<
typename FE1,
typename FE2,
typename ElemContType>
248 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
250 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::update( map_test_geometric_mapping_context_type
const& _gmcTest,
251 map_trial_geometric_mapping_context_type
const& _gmcTrial,
252 map_geometric_mapping_expr_context_type
const& _gmcExpr,
255 fusion::for_each( M_test_fec, vf::detail::FEContextUpdate<0,form_context_type>( _gmcTest, *
this ) );
256 M_test_fec0 = fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) );
257 M_eval_expr00->update( _gmcExpr, M_test_fec0, M_test_fec0 );
259 template<
typename FE1,
typename FE2,
typename ElemContType>
260 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
262 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::update( map_test_geometric_mapping_context_type
const& _gmcTest,
263 map_trial_geometric_mapping_context_type
const& _gmcTrial,
264 map_geometric_mapping_expr_context_type
const& _gmcExpr,
267 fusion::for_each( M_test_fec, vf::detail::FEContextUpdate<0,form_context_type>( _gmcTest, *
this ) );
268 M_test_fec0 = fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) );
269 M_test_fec1 = fusion::make_map<test_gmc1 >( fusion::at_key<test_gmc1 >( M_test_fec ) );
270 fusion::for_each( M_trial_fec, vf::detail::FEContextUpdate<1,form_context_type>( _gmcTrial, *
this ) );
271 M_trial_fec0 = fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_trial_fec ) );
272 M_trial_fec1 = fusion::make_map<trial_gmc1 >( fusion::at_key<trial_gmc1 >( M_trial_fec ) );
274 FEELPP_ASSERT( fusion::at_key<gmc<0> >( M_test_fec0 ).
get() != 0 )
275 ( 0 ).error(
"invalid test_fec0" );
276 FEELPP_ASSERT( fusion::at_key<gmc<1> >( M_test_fec1 ).
get() != 0 )
277 ( 1 ).error(
"invalid test_fec1" );
278 FEELPP_ASSERT( fusion::at_key<gmc<0> >( M_trial_fec0 ).
get() != 0 )
279 ( 0 ).error(
"invalid trial_fec0" );
280 FEELPP_ASSERT( fusion::at_key<gmc<1> >( M_trial_fec1 ).
get() != 0 )
281 ( 0 ).error(
"invalid trial_fec1" );
283 M_eval_expr00->update( _gmcExpr, M_test_fec0, M_trial_fec0 );
284 M_eval_expr01->update( _gmcExpr, M_test_fec0, M_trial_fec1 );
285 M_eval_expr10->update( _gmcExpr, M_test_fec1, M_trial_fec0 );
286 M_eval_expr11->update( _gmcExpr, M_test_fec1, M_trial_fec1 );
288 M_integrator.update( *fusion::at_key<gmc<0> >( _gmcTest ) );
291 template<
typename FE1,
typename FE2,
typename ElemContType>
292 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
294 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::updateInCaseOfInterpolate( map_test_geometric_mapping_context_type
const& _gmcTest,
295 map_trial_geometric_mapping_context_type
const& _gmcTrial,
296 map_geometric_mapping_expr_context_type
const& _gmcExpr,
297 std::vector<boost::tuple<size_type,size_type> >
const& indexLocalToQuad )
299 M_test_gmc = _gmcTest;
300 M_trial_gmc = _gmcTrial;
301 precomputeBasisAtPoints( fusion::at_key<gmc<0> >( _gmcTest )->xRefs(),
302 fusion::at_key<gmc<0> >( _gmcTrial )->xRefs() );
304 updateInCaseOfInterpolate( _gmcTest, _gmcTrial, _gmcExpr, mpl::bool_<false>() );
305 M_integrator.update( *fusion::at_key<gmc<0> >( _gmcExpr ), indexLocalToQuad );
307 template<
typename FE1,
typename FE2,
typename ElemContType>
308 template<
typename GeomapContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
310 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::updateInCaseOfInterpolate( map_test_geometric_mapping_context_type
const& _gmcTest,
311 map_trial_geometric_mapping_context_type
const& _gmcTrial,
312 map_geometric_mapping_expr_context_type
const& _gmcExpr,
315 fusion::for_each( M_test_fec, vf::detail::FEContextUpdate<0,form_context_type>( _gmcTest, *
this ) );
316 M_test_fec0 = fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) );
317 fusion::for_each( M_trial_fec, vf::detail::FEContextUpdate<1,form_context_type>( _gmcTrial, *
this ) );
318 M_trial_fec0 = fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_trial_fec ) );
319 M_eval_expr00->update( _gmcExpr, M_test_fec0, M_trial_fec0 );
321 template<
typename FE1,
typename FE2,
typename ElemContType>
322 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
324 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::updateInCaseOfInterpolate( map_test_geometric_mapping_context_type
const& _gmcTest,
325 map_trial_geometric_mapping_context_type
const& _gmcTrial,
326 map_geometric_mapping_expr_context_type
const& _gmcExpr,
329 fusion::for_each( M_test_fec, vf::detail::FEContextUpdate<0,form_context_type>( _gmcTest, *
this ) );
330 M_test_fec0 = fusion::make_map<gmc<0> >( fusion::at_key<gmc<0> >( M_test_fec ) );
331 M_eval_expr00->update( _gmcExpr, M_test_fec0, M_test_fec0 );
336 template<
typename FE1,
typename FE2,
typename ElemContType>
337 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
342 typedef test_geometric_mapping_context_type gmc_type;
343 typedef typename eval00_expr_type::shape shape;
344 static const bool cond = ( shape::M == 1 && shape::N == 1 );
345 BOOST_MPL_ASSERT_MSG( cond,
346 INVALID_TENSOR_SHAPE_SHOULD_BE_RANK_0,
347 ( mpl::int_<shape::M>, mpl::int_<shape::N> ) );
350 test_geometric_mapping_context_type
const& _gmc = *fusion::at_key<gmc<0> >( M_test_gmc );
351 DVLOG(2) <<
"[BilinearForm::integrate] local assembly in element " << _gmc.id() <<
"\n";
354 if ( M_form.isPatternDefault() && boost::is_same<trial_dof_type,test_dof_type>::value &&
355 trial_dof_type::is_product )
357 M_rep = local_matrix_type::Zero();
359 if ( M_form.isPatternSymmetric() )
361 for ( uint16_type c = 0; c < trial_dof_type::nComponents1; ++c )
362 for ( uint16_type j = 0; j < trial_dof_type::fe_type::nLocalDof; ++j )
363 for ( uint16_type i = 0; i <= j; ++i )
365 uint16_type testLocalDofIndex = i+c*test_dof_type::fe_type::nLocalDof;
366 uint16_type trialLocalDofIndex = j+c*trial_dof_type::fe_type::nLocalDof;
367 M_rep( testLocalDofIndex, trialLocalDofIndex ) = M_integrator( *M_eval_expr00, testLocalDofIndex, trialLocalDofIndex, 0, 0 );
368 M_rep( trialLocalDofIndex, testLocalDofIndex ) = M_rep( testLocalDofIndex, trialLocalDofIndex );
374 for ( uint16_type c = 0; c < trial_dof_type::nComponents1; ++c )
375 for ( uint16_type j = 0; j < trial_dof_type::fe_type::nLocalDof; ++j )
376 for ( uint16_type i = 0; i < test_dof_type::fe_type::nLocalDof; ++i )
378 uint16_type testLocalDofIndex = i+c*test_dof_type::fe_type::nLocalDof;
379 uint16_type trialLocalDofIndex = j+c*trial_dof_type::fe_type::nLocalDof;
380 M_rep( testLocalDofIndex, trialLocalDofIndex ) = M_integrator( *M_eval_expr00, testLocalDofIndex, trialLocalDofIndex, 0, 0 );
387 if ( boost::is_same<trial_dof_type,test_dof_type>::value && M_form.isPatternSymmetric() )
389 for ( uint16_type j = 0; j < trial_dof_type::nDofPerElement; ++j )
390 for ( uint16_type i = 0; i <= j; ++i )
392 M_rep( i, j ) = M_integrator( *M_eval_expr00, i, j, 0, 0 );
393 M_rep( j,i )=M_rep( i,j );
399 for ( uint16_type j = 0; j < trial_dof_type::nDofPerElement; ++j )
400 for ( uint16_type i = 0; i < test_dof_type::nDofPerElement; ++i )
402 M_rep( i, j ) = M_integrator( *M_eval_expr00, i, j, 0, 0 );
407 template<
typename FE1,
typename FE2,
typename ElemContType>
408 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
413 typedef test_geometric_mapping_context_type gmc_type;
414 typedef typename eval00_expr_type::shape shape;
415 BOOST_MPL_ASSERT_MSG( ( mpl::and_<mpl::equal_to<mpl::int_<shape::M>,mpl::int_<1> >,
416 mpl::equal_to<mpl::int_<shape::N>,mpl::int_<1> > >::value ),
417 INVALID_TENSOR_SHAPE_SHOULD_BE_RANK_0,
418 ( mpl::int_<shape::M>, mpl::int_<shape::N> ) );
421 for ( uint16_type j = 0; j < trial_dof_type::nDofPerElement; ++j )
422 for ( uint16_type i = 0; i < test_dof_type::nDofPerElement; ++i )
427 M_rep_2( i, j ) = M_integrator( *M_eval_expr00, i, j, 0, 0 );
430 jj = j + trial_dof_type::nDofPerElement;
432 M_rep_2( ii,jj ) = M_integrator( *M_eval_expr01, i, j, 0, 0 );
434 ii = i + test_dof_type::nDofPerElement;
437 M_rep_2( ii,jj ) = M_integrator( *M_eval_expr10, i, j, 0, 0 );
439 ii = i + test_dof_type::nDofPerElement;
440 jj = j + trial_dof_type::nDofPerElement;
442 M_rep_2( ii,jj ) = M_integrator( *M_eval_expr11, i, j, 0, 0 );
445 template<
typename FE1,
typename FE2,
typename ElemContType>
446 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
448 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::integrateInCaseOfInterpolate( mpl::int_<1>,
449 std::vector<boost::tuple<size_type,size_type> >
const& indexLocalToQuad,
450 bool isFirstExperience )
453 typedef test_geometric_mapping_context_type gmc_type;
454 typedef typename eval00_expr_type::shape shape;
455 static const bool cond = ( shape::M == 1 && shape::N == 1 );
456 BOOST_MPL_ASSERT_MSG( cond,
457 INVALID_TENSOR_SHAPE_SHOULD_BE_RANK_0,
458 ( mpl::int_<shape::M>, mpl::int_<shape::N> ) );
461 test_geometric_mapping_context_type
const& _gmc = *fusion::at_key<gmc<0> >( M_test_gmc );
462 DVLOG(2) <<
"[BilinearForm::integrate] local assembly in element " << _gmc.id() <<
"\n";
465 if ( isFirstExperience )
466 for ( uint16_type j = 0; j < trial_dof_type::nDofPerElement; ++j )
467 for ( uint16_type i = 0; i < test_dof_type::nDofPerElement; ++i )
469 M_rep( i, j ) = M_integrator( *M_eval_expr00, i, j, 0, 0, indexLocalToQuad );
473 for ( uint16_type j = 0; j < trial_dof_type::nDofPerElement; ++j )
474 for ( uint16_type i = 0; i < test_dof_type::nDofPerElement; ++i )
476 M_rep( i, j ) += M_integrator( *M_eval_expr00, i, j, 0, 0, indexLocalToQuad );
479 template<
typename FE1,
typename FE2,
typename ElemContType>
480 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
482 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::assemble(
size_type elt_0 )
484 size_type row_start = M_lb.front().globalRowStart();
485 size_type col_start = M_lb.front().globalColumnStart();
488 DVLOG(2) <<
"[BilinearForm::assemble] global assembly in element " << elt_0 <<
"\n";
489 DVLOG(2) <<
"[BilinearForm::assemble] row start " << row_start <<
"\n";
490 DVLOG(2) <<
"[BilinearForm::assemble] col start " << col_start <<
"\n";
492 bool do_less = ( ( M_form.isPatternDefault() &&
493 ( M_test_dof->nComponents == M_trial_dof->nComponents ) ) &&
494 !M_form.isPatternCoupled() );
498 for ( uint16_type c = 0; c < trial_dof_type::nComponents1; ++c )
500 M_c_rep = M_rep.block( c*test_dof_type::fe_type::nLocalDof, c*trial_dof_type::fe_type::nLocalDof,
501 test_dof_type::fe_type::nLocalDof, trial_dof_type::fe_type::nLocalDof );
502 M_c_local_rows.array() = M_test_dof->localToGlobalIndices( elt_0 ).array().segment( c*test_dof_type::fe_type::nLocalDof,
503 test_dof_type::fe_type::nLocalDof ) + row_start;
504 M_c_local_cols.array() = M_trial_dof->localToGlobalIndices( elt_0 ).array().segment( c*trial_dof_type::fe_type::nLocalDof,
505 trial_dof_type::fe_type::nLocalDof ) + col_start;
507 if ( test_dof_type::is_modal || trial_dof_type::is_modal )
509 M_c_local_rowsigns = M_test_dof->localToGlobalSigns( elt_0 ).segment( c*test_dof_type::fe_type::nLocalDof,test_dof_type::fe_type::nLocalDof );
510 M_c_local_colsigns = M_trial_dof->localToGlobalSigns( elt_0 ).segment( c*trial_dof_type::fe_type::nLocalDof,trial_dof_type::fe_type::nLocalDof );
511 M_c_rep.array() *= ( M_c_local_rowsigns*M_c_local_colsigns.transpose() ).array().template cast<value_type>();
514 M_form.addMatrix( M_c_local_rows.data(), M_c_local_rows.size(),
515 M_c_local_cols.data(), M_c_local_cols.size(),
522 size_type trial_eid= this->trialElementId( elt_0 );
525 <<
"this case should have been taken care of earlier before the assembly process\n";
527 M_local_rows.array() = M_test_dof->localToGlobalIndices( elt_0 ).array() + row_start;
528 M_local_cols.array() = M_trial_dof->localToGlobalIndices( trial_eid ).array() + col_start;
531 if ( test_dof_type::is_modal || trial_dof_type::is_modal )
533 M_local_rowsigns = M_test_dof->localToGlobalSigns( elt_0 );
534 M_local_colsigns = M_trial_dof->localToGlobalSigns( trial_eid );
535 M_rep.array() *= ( M_local_rowsigns*M_local_colsigns.transpose() ).array().template cast<value_type>();
538 M_form.addMatrix( M_local_rows.data(), M_local_rows.size(),
539 M_local_cols.data(), M_local_cols.size(),
544 template<
typename FE1,
typename FE2,
typename ElemContType>
545 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
547 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::assemble(
size_type elt_0,
size_type elt_1 )
549 size_type row_start = M_lb.front().globalRowStart();
550 size_type col_start = M_lb.front().globalColumnStart();
552 auto local_rows_0 = M_test_dof->localToGlobalIndices( elt_0 ).array() + row_start;
553 auto local_rows_1 = M_test_dof->localToGlobalIndices( elt_1 ).array() + row_start;
554 M_local_rows_2.template head<test_dof_type::nDofPerElement>().array() = local_rows_0;
555 M_local_rows_2.template tail<test_dof_type::nDofPerElement>().array() = local_rows_1;
557 auto local_cols_0 = M_trial_dof->localToGlobalIndices( elt_0 ).array() + col_start;
558 auto local_cols_1 = M_trial_dof->localToGlobalIndices( elt_1 ).array() + col_start;
559 M_local_cols_2.template head<trial_dof_type::nDofPerElement>().array() = local_cols_0;
560 M_local_cols_2.template tail<trial_dof_type::nDofPerElement>().array() = local_cols_1;
563 if ( test_dof_type::is_modal || trial_dof_type::is_modal )
565 auto local_rowsigns_0 = M_test_dof->localToGlobalSigns( elt_0 );
566 auto local_rowsigns_1 = M_test_dof->localToGlobalSigns( elt_1 );
567 M_local_rowsigns_2.template head<test_dof_type::nDofPerElement>() = local_rowsigns_0;
568 M_local_rowsigns_2.template tail<test_dof_type::nDofPerElement>() = local_rowsigns_1;
570 auto local_colsigns_0 = M_trial_dof->localToGlobalSigns( elt_0 );
571 auto local_colsigns_1 = M_trial_dof->localToGlobalSigns( elt_1 );
572 M_local_colsigns_2.template head<trial_dof_type::nDofPerElement>() = local_colsigns_0;
573 M_local_colsigns_2.template tail<trial_dof_type::nDofPerElement>() = local_colsigns_1;
575 M_rep_2.array() *= ( M_local_rowsigns_2*M_local_colsigns_2.transpose() ).array().template cast<value_type>();
578 M_form.addMatrix( M_local_rows_2.data(), M_local_rows_2.size(),
579 M_local_cols_2.data(), M_local_cols_2.size(),
583 template<
typename FE1,
typename FE2,
typename ElemContType>
584 template<
typename GeomapTestContext,
typename ExprT,
typename IM,
typename GeomapExprContext,
typename GeomapTrialContext>
586 BilinearForm<FE1,FE2,ElemContType>::Context<GeomapTestContext,ExprT,IM,GeomapExprContext,GeomapTrialContext>::assembleInCaseOfInterpolate()
588 size_type row_start = M_lb.front().globalRowStart();
589 size_type col_start = M_lb.front().globalColumnStart();
591 auto eltTest = fusion::at_key<gmc<0> >( M_test_gmc )->
id();
592 auto eltTrial = fusion::at_key<gmc<0> >( M_trial_gmc )->
id();
594 M_local_rows.array() = M_test_dof->localToGlobalIndices( eltTest ).array() + row_start;
595 M_local_cols.array() = M_trial_dof->localToGlobalIndices( eltTrial ).array() + col_start;
598 bool do_less = ( ( M_form.isPatternDefault() &&
599 ( M_test_dof->nComponents == M_trial_dof->nComponents ) ) &&
600 !M_form.isPatternCoupled() );
603 if ( test_dof_type::is_modal || trial_dof_type::is_modal )
605 M_local_rowsigns = M_test_dof->localToGlobalSigns( eltTest );
606 M_local_colsigns = M_trial_dof->localToGlobalSigns( eltTrial );
607 M_rep.array() *= ( M_local_rowsigns*M_local_colsigns.transpose() ).array().template cast<value_type>();
610 M_form.addMatrix( M_local_rows.data(), M_local_rows.size(),
611 M_local_cols.data(), M_local_cols.size(),