MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / Transfer2StdMesh

Function Transfer2StdMesh

comp/tpfes.cpp:527–642  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525 }
526
527 void Transfer2StdMesh(const GridFunction * gfutp, GridFunction* gfustd,LocalHeap & lh)
528 {
529 static Timer tall("TPHighOrderFESpace::Transfer2StdMesh"); RegionTimer rall(tall);
530 const shared_ptr<FESpace> fes = gfustd->GetFESpace();
531 TPHighOrderFESpace * tpfes = dynamic_cast<TPHighOrderFESpace *>(gfutp->GetFESpace().get());
532 const shared_ptr<FESpace> & fesx = tpfes->Space(-1);
533 const shared_ptr<FESpace> & fesy = tpfes->Space(0);
534 auto & meshx = fesx->GetMeshAccess();
535 auto & meshy = fesy->GetMeshAccess();
536 //LocalHeap lh(100000000,"heap");
537 BaseVector & baseout = gfustd->GetVector();
538 // auto & els = dynamic_cast<TPHighOrderFE &> (tpfes->GetFE(ElementId(0),lh));
539 IterateElementsTP(*tpfes,VOL,lh,
540 [&] (ElementId ei0,ElementId ei1,LocalHeap & lh)
541 {
542 HeapReset hr(lh);
543 ArrayMem<int,2> ind(2);
544 ind[0] = ei0.Nr(); ind[1] = ei1.Nr();
545 int elnr = tpfes->GetIndex(ind);
546 TPHighOrderFE & tpfel = dynamic_cast<TPHighOrderFE&>(tpfes->GetFE(ElementId(elnr),lh));
547 int elnrstd = elnr;
548 //int elnrstd = ind[1]*fesx->GetMeshAccess()->GetNE() + ind[0];
549 const FiniteElement & fel = fes->GetFE(ElementId(elnrstd),lh);
550 ArrayMem<const IntegrationRule *,2> irs(tpfel.elements.Size());
551 for(int s=0;s<irs.Size();s++)
552 irs[s] = &SelectIntegrationRule(tpfel.elements[s]->ElementType(),2*fel.Order());
553 TPIntegrationRule ir(irs);
554 const ElementTransformation & tptrafo = tpfes->GetTrafo(ElementId(elnr),lh);
555 BaseMappedIntegrationRule & tpmir = tptrafo(ir, lh);
556 IntegrationRule irstd(ir(0).Size()*ir(1).Size(),lh);
557 int ii=0;
558 for(int s=0;s<ir(0).Size();s++)
559 for(int t=0;t<ir(1).Size();t++)
560 {
561 if(meshx->GetDimension() == 1 && meshy->GetDimension() == 1)
562 irstd[ii++] = (IntegrationPoint(ir(0)[s](0),ir(1)[t](0),ir(1)[t](1), ir(0)[s].Weight()*ir(1)[t].Weight()));
563 if(meshx->GetDimension() == 1 && meshy->GetDimension() == 2)
564 irstd[ii++] = (IntegrationPoint(ir(1)[t](0),ir(1)[t](1),ir(0)[s](0), ir(0)[s].Weight()*ir(1)[t].Weight()));
565 if(meshx->GetDimension() == 2 )
566 irstd[ii++] = (IntegrationPoint(ir(0)[s](0),ir(0)[s](1),ir(1)[t](0), ir(0)[s].Weight()*ir(1)[t].Weight()));
567 }
568 const ElementTransformation & trafo = fes->GetMeshAccess()->GetTrafo(ElementId(VOL,elnrstd),lh);
569 BaseMappedIntegrationRule & mirstd = trafo(irstd,lh);
570 int niptp = ir(0).Size()*ir(1).Size();
571 // Evaluate \int u_tp * v_std :
572
573 FlatMatrix<double> flux(niptp,tpfes->GetDimension()*gfutp->GetFESpace()->GetEvaluator()->Dim(),lh);
574 FlatVector<> elvectp(tpfel.GetNDof(),lh);
575 Array<int> tpdofs(tpfel.GetNDof(),lh);
576 gfutp->GetFESpace()->GetDofNrs(ElementId(elnr), tpdofs);
577 gfutp->GetVector().GetIndirect(tpdofs, elvectp);
578 //for(int i=0;i<irstd.Size();i++)
579 //{
580 //cout << mirstd[i].GetPoint()<<endl;
581 ////cout << irstd[i].Point()<<endl;
582 //}
583 dynamic_cast<const TPDifferentialOperator *>(gfutp->GetFESpace()->GetEvaluator().get())->Apply(tpfel, tpmir, elvectp, flux, lh);
584

Callers 7

tp_dg_1d_1d.pyFile · 0.85
RunFunction · 0.85
tp_dg_2d_1d.pyFile · 0.85
StepFunction · 0.85
tp_dg_1d_2d.pyFile · 0.85
StepFunction · 0.85

Calls 15

IterateElementsTPFunction · 0.85
ElementIdClass · 0.85
GetFESpaceMethod · 0.80
GetMeshAccessMethod · 0.80
GetIndirectMethod · 0.80
GetMeasureMethod · 0.80
IntegrationPointClass · 0.70
TransFunction · 0.50
CalcInverseFunction · 0.50
getMethod · 0.45
NrMethod · 0.45
SizeMethod · 0.45

Tested by

no test coverage detected