VisualizationSceneVector3d::VisualizationSceneVector3d(GridFunction &vgf) { FiniteElementSpace *fes = vgf.FESpace(); if (fes == NULL || fes->GetVDim() != 3) { cout << "VisualizationSceneVector3d::VisualizationSceneVector3d" << endl; exit(1); } VecGridF = &vgf; mesh = fes->GetMesh(); sfes = new FiniteElementSpace(mesh, fes->FEColl(), 1, fes->GetOrdering()); GridF = new GridFunction(sfes); solx = new Vector(mesh->GetNV()); soly = new Vector(mesh->GetNV()); solz = new Vector(mesh->GetNV()); vgf.GetNodalValues(*solx, 1); vgf.GetNodalValues(*soly, 2); vgf.GetNodalValues(*solz, 3); sol = new Vector(mesh->GetNV()); Init(); }
void ParGridFunction::ComputeFlux( BilinearFormIntegrator &blfi, GridFunction &flux, int wcoef, int subdomain) { ParFiniteElementSpace *ffes = dynamic_cast<ParFiniteElementSpace*>(flux.FESpace()); MFEM_VERIFY(ffes, "the flux FE space must be ParFiniteElementSpace"); Array<int> count(flux.Size()); SumFluxAndCount(blfi, flux, count, wcoef, subdomain); // Accumulate flux and counts in parallel ffes->GroupComm().Reduce<double>(flux, GroupCommunicator::Sum); ffes->GroupComm().Bcast<double>(flux); ffes->GroupComm().Reduce<int>(count, GroupCommunicator::Sum); ffes->GroupComm().Bcast<int>(count); // complete averaging for (int i = 0; i < count.Size(); i++) { if (count[i] != 0) { flux(i) /= count[i]; } } if (ffes->Nonconforming()) { // On a partially conforming flux space, project on the conforming space. // Using this code may lead to worse refinements in ex6, so we do not use // it by default. // Vector conf_flux; // flux.ConformingProject(conf_flux); // flux.ConformingProlongate(conf_flux); } }
/// Check if the mesh of the solution was modified. bool MeshIsModified() { long mesh_sequence = solution->FESpace()->GetMesh()->GetSequence(); MFEM_ASSERT(mesh_sequence >= current_sequence, ""); return (mesh_sequence > current_sequence); }