10 #ifdef MOOSE_MFEM_ENABLED 18 mfem::Vector & node_positions,
19 mfem::Ordering::Type & node_ordering)
21 const int nelem = fespace.GetParMesh()->GetNE();
22 const int dim = fespace.GetParMesh()->Dimension();
27 nnodes += fespace.GetFE(i)->GetNodes().GetNPoints();
29 node_positions.SetSize(nnodes *
dim);
34 const mfem::IntegrationRule ir = fespace.GetFE(i)->GetNodes();
35 const int nqpt = ir.GetNPoints();
37 mfem::DenseMatrix pos;
38 fespace.GetElementTransformation(i)->Transform(ir, pos);
43 row.SetDataAndSize(node_positions.GetData() + nodal_offset + d * nnodes, nqpt);
49 node_ordering = mfem::Ordering::Type::byNODES;
54 const mfem::Ordering::Type & nodal_val_ordering,
55 mfem::ParGridFunction & gridfunction)
57 mfem::ParFiniteElementSpace & fespace = *gridfunction.ParFESpace();
58 const int nelem = fespace.GetParMesh()->GetNE();
59 const int gf_ncomp = gridfunction.VectorDim();
61 fespace.GetParMesh()->EnsureNodes();
64 const auto map = fespace.FEColl()->GetMapType(fespace.GetParMesh()->Dimension());
65 const bool H1L2 = map == mfem::FiniteElement::VALUE || map == mfem::FiniteElement::INTEGRAL;
66 const bool RTND = map == mfem::FiniteElement::H_DIV || map == mfem::FiniteElement::H_CURL;
68 mooseError(
"FESpace type not supported yet in transfers.");
71 mfem::Ordering::Type dof_ordering = H1L2 ? mfem::Ordering::byNODES : mfem::Ordering::byVDIM;
72 mfem::Array<int> vdofs;
77 const int nqpt = fespace.GetFE(el)->GetNodes().GetNPoints();
78 mfem::Vector dof_vals(nqpt * gf_ncomp);
79 fespace.GetElementVDofs(el, vdofs);
86 gridfunction.SetSubVector(vdofs, dof_vals);
89 vals.SetSize(vdofs.Size());
90 fespace.GetFE(el)->ProjectFromNodes(dof_vals, *fespace.GetElementTransformation(el), vals);
91 gridfunction.SetSubVector(vdofs, vals);
94 nodal_offset += nqpt * gf_ncomp;
96 gridfunction.SetTrueVector();
void projectNodalValues(const mfem::Vector &nodal_vals, const mfem::Ordering::Type &nodal_val_ordering, mfem::ParGridFunction &gridfunction)
Project a vector of values provided at projection points (nodes) to set GridFunction DoFs...
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
std::size_t MFEMIndex(const std::size_t i_dim, const std::size_t i_point, const std::size_t num_dims, const std::size_t num_points, const mfem::Ordering::Type ordering)
Convert an index of a vector of libMesh::Points to an MFEM vector index, given an MFEM ordering...
void extractNodePositions(const mfem::ParFiniteElementSpace &fespace, mfem::Vector &node_positions, mfem::Ordering::Type &node_ordering)
Extract node positions from MFEM FESpace at which projection will take place.
IntRange< T > make_range(T beg, T end)