| 372 | |
| 373 | |
| 374 | void Finalize() |
| 375 | { |
| 376 | static Timer timer ("BDDC Finalize"); |
| 377 | RegionTimer reg(timer); |
| 378 | |
| 379 | // auto fes = bfa->GetFESpace(); |
| 380 | int ndof = fes->GetNDof(); |
| 381 | |
| 382 | if (!local) |
| 383 | if (auto pd = fes->GetParallelDofs(); pd) |
| 384 | pd -> AllReduceDofData (weight, NG_MPI_SUM); |
| 385 | |
| 386 | ParallelFor (weight.Size(), |
| 387 | [&] (size_t i) |
| 388 | { |
| 389 | if (weight[i]) weight[i] = 1.0/weight[i]; |
| 390 | }); |
| 391 | |
| 392 | ParallelFor (sparse_innersolve->Height(), |
| 393 | [&] (size_t i) |
| 394 | { |
| 395 | FlatArray cols = sparse_innersolve -> GetRowIndices(i); |
| 396 | FlatVector<SCAL> values = sparse_innersolve->GetRowValues(i); |
| 397 | double wi = weight[i]; |
| 398 | for (int j = 0; j < cols.Size(); j++) |
| 399 | values(j) *= wi * weight[cols[j]]; |
| 400 | }, TasksPerThread(5)); |
| 401 | |
| 402 | ParallelFor (sparse_harmonicext->Height(), |
| 403 | [&] (size_t i) |
| 404 | { |
| 405 | sparse_harmonicext->GetRowValues(i) *= weight[i]; |
| 406 | }, TasksPerThread(5)); |
| 407 | |
| 408 | if (!bfa->SymmetricStorage()) |
| 409 | { |
| 410 | ParallelFor (// sparse_harmonicexttrans->Height(), |
| 411 | sparse_harmonicexttrans->GetBalancing(), |
| 412 | [&] (size_t i) |
| 413 | { |
| 414 | FlatArray rowind = sparse_harmonicexttrans->GetRowIndices(i); |
| 415 | FlatVector<SCAL> values = sparse_harmonicexttrans->GetRowValues(i); |
| 416 | for (int j = 0; j < rowind.Size(); j++) |
| 417 | values[j] *= weight[rowind[j]]; |
| 418 | }, TasksPerThread(5)); |
| 419 | } |
| 420 | |
| 421 | // now generate wire-basked solver |
| 422 | |
| 423 | if (block) |
| 424 | { |
| 425 | if (coarse) |
| 426 | throw Exception("combination of coarse and block not implemented! "); |
| 427 | |
| 428 | //Smoothing Blocks |
| 429 | Flags flags; |
| 430 | flags.SetFlag("eliminate_internal"); |
| 431 | flags.SetFlag("subassembled"); |
no test coverage detected