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

Function CalcDifference

comp/postproc.cpp:1078–1178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1076
1077 template <class SCAL>
1078 void CalcDifference (const S_GridFunction<SCAL> & u1,
1079 const S_GridFunction<SCAL> & u2,
1080 shared_ptr<BilinearFormIntegrator> bli1,
1081 shared_ptr<BilinearFormIntegrator> bli2,
1082 FlatVector<double> & diff,
1083 int domain, LocalHeap & lh)
1084 {
1085 shared_ptr<MeshAccess> ma = u1.GetFESpace()->GetMeshAccess();
1086 BaseStatusHandler::PushStatus ("Calc Difference");
1087
1088 const FESpace & fes1 = *u1.GetFESpace();
1089 const FESpace & fes2 = *u2.GetFESpace();
1090
1091 bool bound1 = bli1->BoundaryForm();
1092 bool bound2 = bli2->BoundaryForm();
1093
1094
1095 if(bound1!=bound2)
1096 {
1097 cout << " ERROR: CalcDifference :: bli1->BoundaryForm != bl2.BoundaryForm there is something wrong?" << endl;
1098 diff = 0;
1099 return;
1100 }
1101
1102 int ne = bound1 ? ma->GetNSE() : ma->GetNE();
1103 int dim1 = fes1.GetDimension();
1104 int dim2 = fes2.GetDimension();
1105 int dimflux1 = bli1->DimFlux();
1106 int dimflux2 = bli2->DimFlux();
1107
1108 if(dimflux1 != dimflux2)
1109 {
1110 cout << " ERROR: CalcDifference :: dimflux1 != dimflux2 !!!!! -> set diff = 0" << endl;
1111 diff = 0;
1112 return;
1113 }
1114
1115 bool applyd1 = 0;
1116 bool applyd2 = 0;
1117
1118 Array<int> dnums1;
1119 Array<int> dnums2;
1120
1121 // double sum = 0;
1122 for (int i = 0; i < ne; i++)
1123 {
1124 ElementId ei(bound1 ? BND : VOL, i);
1125 HeapReset hr (lh);
1126 BaseStatusHandler::SetThreadPercentage ( 100.0*i / ne );
1127
1128 int eldom = ma->GetElIndex(ei);
1129 // bound1 ? ma->GetSElIndex(i) : ma->GetElIndex(i);
1130
1131 if ((domain != -1) && (domain != eldom))
1132 continue;
1133
1134 const FiniteElement & fel1 = fes1.GetFE (ei, lh);
1135 const FiniteElement & fel2 = fes2.GetFE (ei, lh);

Callers

nothing calls this directly

Calls 15

fabsFunction · 0.85
GetMeshAccessMethod · 0.80
GetFESpaceMethod · 0.80
DimFluxMethod · 0.80
TransformVecMethod · 0.80
L2Norm2Function · 0.50
sqrtFunction · 0.50
BoundaryFormMethod · 0.45
GetDimensionMethod · 0.45
GetDofNrsMethod · 0.45
SizeMethod · 0.45
OrderMethod · 0.45

Tested by

no test coverage detected