| 1264 | |
| 1265 | template <typename KERNEL> |
| 1266 | void PotentialCF<KERNEL> :: |
| 1267 | BuildLocalExpansion(const Region & reg) |
| 1268 | { |
| 1269 | LocalHeapMem<100000> lh("PotentialCF::BuildLocalExpansion"); |
| 1270 | |
| 1271 | auto space = this->gf->GetFESpace(); |
| 1272 | auto mesh = space->GetMeshAccess(); |
| 1273 | |
| 1274 | |
| 1275 | Vec<3> smax(-1e99, -1e99, -1e99); |
| 1276 | Vec<3> smin(1e99, 1e99, 1e99); |
| 1277 | |
| 1278 | for (size_t i = 0; i < mesh->GetNE(source_vb); i++) |
| 1279 | { |
| 1280 | HeapReset hr(lh); |
| 1281 | ElementId ei(source_vb, i); |
| 1282 | if (!space->DefinedOn(ei)) continue; |
| 1283 | if (definedon && !(*definedon).Mask().Test(mesh->GetElIndex(ei))) continue; |
| 1284 | |
| 1285 | // const FiniteElement &fel = space->GetFE(ei, lh); |
| 1286 | const ElementTransformation &trafo = mesh->GetTrafo(ei, lh); |
| 1287 | IntegrationRule ir(trafo.GetElementType(), intorder); |
| 1288 | auto & miry = trafo(ir, lh); |
| 1289 | |
| 1290 | for (int k = 0; k < miry.Size(); k++) |
| 1291 | for (int j = 0; j < 3; j++) |
| 1292 | { |
| 1293 | smin(j) = min(smin(j), miry[k].GetPoint()(j)); |
| 1294 | smax(j) = max(smax(j), miry[k].GetPoint()(j)); |
| 1295 | } |
| 1296 | } |
| 1297 | |
| 1298 | Vec<3> cs = 0.5*(smin+smax); |
| 1299 | double rs = MaxNorm(smax-smin); |
| 1300 | |
| 1301 | // cout << "cs = " << cs << ", rs = " << rs << endl; |
| 1302 | auto singmp = kernel.source.CreateMultipoleExpansion(cs, rs, io_params); |
| 1303 | |
| 1304 | typedef typename KERNEL::value_type T; |
| 1305 | for (size_t i = 0; i < mesh->GetNE(source_vb); i++) |
| 1306 | { |
| 1307 | HeapReset hr(lh); |
| 1308 | ElementId ei(source_vb, i); |
| 1309 | |
| 1310 | if (!space->DefinedOn(ei)) continue; |
| 1311 | if (definedon && !(*definedon).Mask().Test(mesh->GetElIndex(ei))) continue; |
| 1312 | |
| 1313 | const FiniteElement &fel = space->GetFE(ei, lh); |
| 1314 | const ElementTransformation &trafo = mesh->GetTrafo(ei, lh); |
| 1315 | |
| 1316 | Array<DofId> dnums(fel.GetNDof(), lh); |
| 1317 | space->GetDofNrs(ei, dnums); |
| 1318 | FlatVector<T> elvec(fel.GetNDof(), lh); |
| 1319 | gf->GetElementVector(dnums, elvec); |
| 1320 | |
| 1321 | IntegrationRule ir(fel.ElementType(), intorder); |
| 1322 | auto & miry = trafo(ir, lh); |
| 1323 | FlatMatrix<T> vals(miry.Size(), evaluator->Dim(), lh); |
nothing calls this directly
no test coverage detected