| 71 | |
| 72 | template <class M> |
| 73 | void Run(M& m, Vars& var) { |
| 74 | auto sem = m.GetSem(__func__); |
| 75 | using Scal = typename M::Scal; |
| 76 | using Expr = typename M::Expr; |
| 77 | using EB = Embed<M>; |
| 78 | struct { |
| 79 | std::unique_ptr<EB> eb; |
| 80 | FieldCell<Scal> fcp; |
| 81 | FieldEmbed<Scal> feg; |
| 82 | FieldCell<Scal> fcdiv; |
| 83 | FieldNode<Scal> fnl; |
| 84 | std::shared_ptr<linear::Solver<M>> linsolver; |
| 85 | typename UInitEmbedBc<M>::PlainBc bc; |
| 86 | std::array<FieldCell<Scal>, M::dim + 1> comps; |
| 87 | FieldCell<Scal> fc_residual; |
| 88 | size_t nsteps; |
| 89 | FieldCell<Scal> fc_gradexp; |
| 90 | FieldCell<Expr> fc_system; |
| 91 | std::array<FieldCell<Scal>, Expr::dim> fc_system_comps; |
| 92 | } * ctx(sem); |
| 93 | auto& t = *ctx; |
| 94 | |
| 95 | if (sem("ctor")) { |
| 96 | m.flags.linreport = var.Int["linreport"]; |
| 97 | m.flags.check_symmetry = var.Int["check_symmetry"]; |
| 98 | t.eb.reset(new EB(m)); |
| 99 | t.linsolver = ULinear<M>::MakeLinearSolver(var, "symm", m); |
| 100 | t.nsteps = var.Int["nsteps"]; |
| 101 | t.fcp.Reinit(m, 0); |
| 102 | } |
| 103 | if (sem.Nested("levelset")) { |
| 104 | UEmbed<M>::InitLevelSet(t.fnl, m, var, m.IsRoot()); |
| 105 | } |
| 106 | if (sem.Nested("init")) { |
| 107 | t.eb->Init(t.fnl); |
| 108 | } |
| 109 | if (sem("bc")) { |
| 110 | t.bc = UInitEmbedBc<M>::GetPlainBc(var.String["bc_path"], *t.eb, {}); |
| 111 | if (m.IsRoot()) { |
| 112 | std::ofstream fdesc("bc_groups.dat"); |
| 113 | for (size_t i = 0; i < t.bc.vdesc.size(); ++i) { |
| 114 | fdesc << i << " " << t.bc.vdesc[i] << std::endl; |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | if (sem.Nested("dump-eb")) { |
| 119 | t.eb->DumpPoly(); |
| 120 | } |
| 121 | if (sem.Nested("dump-bc")) { |
| 122 | UInitEmbedBc<M>::DumpBcPoly("bc.vtk", t.bc.me_group, *t.eb, m); |
| 123 | } |
| 124 | for (size_t i = 0; i < t.nsteps; ++i) { |
| 125 | if (sem.Nested("potential")) { |
| 126 | CalcPotential( |
| 127 | t.bc.mebc, m, *t.eb, t.fcp, t.feg, t.fc_residual, t.linsolver, |
| 128 | t.fc_system); |
| 129 | } |
| 130 | if (sem("dump-solution")) { |
nothing calls this directly
no test coverage detected