33 MFEM_VERIFY(!preserve,
"Differing sign conventions for the serial and "
34 "parallel grid functions will prevent preserving the serial "
35 "GridFunctions in this context.");
48 const int *partitioning)
65 int element_counter = 0;
67 const int glob_ne = glob_fes->
GetNE();
69 for (
int i = 0; i < glob_ne; i++)
71 if (partitioning[i] == MyRank)
108 MFEM_ASSERT(
pfes != NULL,
"not a ParFiniteElementSpace");
123 MFEM_ASSERT(
pfes != NULL,
"not a ParFiniteElementSpace");
138 MFEM_ASSERT(
pfes != NULL,
"not a ParFiniteElementSpace");
151 prolong->
Mult(*tv, *
this);
242 MPI_Request *requests =
new MPI_Request[2*num_face_nbrs];
243 MPI_Request *send_requests = requests;
244 MPI_Request *recv_requests = requests + num_face_nbrs;
245 MPI_Status *statuses =
new MPI_Status[num_face_nbrs];
247 auto d_data = this->
Read();
251 const int ldof = d_send_ldof[i];
252 d_send_data[i] = d_data[ldof >= 0 ? ldof : -1-ldof];
260 if (mpi_gpu_aware) { MFEM_STREAM_SYNC; }
261 for (
int fn = 0; fn < num_face_nbrs; fn++)
266 MPI_Isend(&send_data_ptr[send_offset[fn]],
267 send_offset[fn+1] - send_offset[fn],
270 MPI_Irecv(&face_nbr_data_ptr[recv_offset[fn]],
271 recv_offset[fn+1] - recv_offset[fn],
275 MPI_Waitall(num_face_nbrs, send_requests, statuses);
276 MPI_Waitall(num_face_nbrs, recv_requests, statuses);
300 int s = dofs.
Size()/fes_vdim;
345 return (DofVal * LocVec);
361 int dof = FElem->
GetDof();
378 for (
int k = 0; k < vdim; k++)
380 val(k) = shape * (&loc_data[dof * k]);
403 int comp,
Vector *tr)
const
444 return (DofVal * LocVec);
479 const int dof = fe->
GetDof();
493 for (
int k = 0; k < vdim; k++)
495 val(k) = shape * (&loc_data[dof * k]);
515 gcomm.
Bcast(elem_per_vdof);
527 gcomm.
Bcast(overlap);
533 for (
int i = 0; i < overlap.
Size(); i++)
535 der(i) /= overlap[i];
545 "ParGridFunction::GetElementDofValues: ExchangeFaceNbrData "
546 "must be called before accessing face neighbor elements.");
561 "Cannot project scalar coefficient onto vector ParGridFunction");
585 real_t loc_integral, glob_integral;
593 (*this) *= (delta_c->
Scale() / glob_integral);
642 cg.SetPreconditioner(*prec);
645 a.RecoverFEMSolution(X,
b, x);
695 cg.SetPreconditioner(*prec);
698 a.RecoverFEMSolution(X,
b, x);
745 std::variant<Coefficient*, VectorCoefficient*> coeff)
755 ldof_attr.
Copy(gdof_attr);
758 gcomm.
Bcast(gdof_attr);
764 if (gdof_attr[i] > ldof_attr[i])
778 gcomm.
Bcast(gdof_attr);
782 (*this)(i) /= gdof_attr[i];
794 "Cannot project scalar coefficient onto a vector ParGridFunction");
805 gcomm.
Bcast(zones_per_vdof);
829 gcomm.
Bcast(zones_per_vdof);
845 for (
int i = 0; i < values.
Size(); i++)
847 values(i) = values_counter[i] ? (*this)(i) : 0.0;
856 for (
int i = 0; i < values.
Size(); i++)
858 if (values_counter[i])
860 (*this)(i) = values(i)/values_counter[i];
871 ess_vdofs_marker.SetSize(
Size());
872 ess_vdofs_marker = 0;
875 if (!coeff[i]) {
continue; }
878 for (
int j = 0; j<
Size(); j++)
880 ess_vdofs_marker[j] = bool(ess_vdofs_marker[j]) ||
881 bool(component_dof_marker[j]);
886 for (
int i = 0; i < values_counter.
Size(); i++)
888 MFEM_ASSERT(
bool(values_counter[i]) ==
bool(ess_vdofs_marker[i]),
907 for (
int i = 0; i < values.
Size(); i++)
909 values(i) = values_counter[i] ? (*this)(i) : 0.0;
918 for (
int i = 0; i < values.
Size(); i++)
920 if (values_counter[i])
922 (*this)(i) = values(i)/values_counter[i];
932 for (
int i = 0; i < values_counter.
Size(); i++)
934 MFEM_ASSERT(
bool(values_counter[i]) ==
bool(ess_vdofs_marker[i]),
948 int fdof, intorder, k;
950 Vector shape, el_dofs, err_val, ell_coeff_val;
957 std::map<int,int> local_to_shared;
961 local_to_shared[i_local] = i;
966 real_t shared_face_factor = 1.0;
967 bool shared_face =
false;
968 int iel1, iel2, info1, info2;
977 if (info2 >= 0 && iel2 < 0)
979 int ishared = local_to_shared[i];
983 if ( (k = fe2->
GetOrder()) > intorder )
988 shared_face_factor = 0.5;
996 if ( (k = fe2->
GetOrder()) > intorder )
1010 intorder = 2 * intorder;
1023 transf = face_elem_transf->
Elem1;
1029 for (k = 0; k < fdof; k++)
1032 el_dofs(k) = (*this)(vdofs[k]);
1036 el_dofs(k) = - (*this)(-1-vdofs[k]);
1043 ell_coeff_val(j) = ell_coeff->
Eval(*transf, eip);
1044 err_val(j) = exsol->
Eval(*transf, eip) - (shape * el_dofs);
1049 transf = face_elem_transf->
Elem2;
1056 for (k = 0; k < fdof; k++)
1069 for (k = 0; k < fdof; k++)
1072 el_dofs(k) = (*this)(vdofs[k]);
1076 el_dofs(k) = - (*this)(-1 - vdofs[k]);
1084 ell_coeff_val(j) += ell_coeff->
Eval(*transf, eip);
1085 ell_coeff_val(j) *= 0.5;
1086 err_val(j) -= (exsol->
Eval(*transf, eip) - (shape * el_dofs));
1090 transf = face_elem_transf;
1096 face_error += shared_face_factor*(ip.
weight * nu * ell_coeff_val(j) *
1098 err_val(j) * err_val(j));
1101 error += fabs(face_error);
1104 error = sqrt(error);
1126 ostringstream fname_with_suffix;
1127 fname_with_suffix << fname <<
"." << setfill(
'0') << setw(6) << rank;
1128 ofstream ofs(fname_with_suffix.str().c_str());
1129 ofs.precision(precision);
1140 ofs.precision(precision);
1146 int save_rank)
const
1154 serialgf.
Save(fname, precision);
1156 MPI_Barrier(pmesh->
GetComm());
1171 const int vdim = pfespace->
GetVDim();
1175 MPI_Comm comm = pmesh->
GetComm();
1177 if (my_rank == save_rank)
1182 for (
int e = 0; e < pmesh->
GetNE(); e++)
1189 for (
int p = 0;
p < nranks;
p++)
1191 if (
p == save_rank) {
continue; }
1193 MPI_Recv(&n_send_recv, 1, MPI_INT,
p, 448, comm, &status);
1200 for (
int i = 0; i < n_send_recv; )
1210 int n_send_recv = 0;
1212 for (
int e = 0; e < pmesh->
GetNE(); e++)
1215 n_send_recv += vdim*fe->
GetDof();
1217 MPI_Send(&n_send_recv, 1, MPI_INT, save_rank, 448, comm);
1220 for (
int e = 0; e < pmesh->
GetNE(); e++)
1223 for (
int j = 0; j < nodeval.
Size(); j++)
1239 Mesh &serial_mesh)
const
1251#ifdef MFEM_USE_ADIOS2
1253 const std::string& variable_name,
1257 for (
int i = 0; i <
size; i++)
1264 for (
int i = 0; i <
size; i++)
1279 MyComm =
pfes -> GetComm();
1281 MPI_Comm_size(MyComm, &NRanks);
1282 MPI_Comm_rank(MyComm, &MyRank);
1285 int *nv =
new int[NRanks];
1286 int *nvdofs =
new int[NRanks];
1287 int *nedofs =
new int[NRanks];
1288 int *nfdofs =
new int[NRanks];
1289 int *nrdofs =
new int[NRanks];
1300 nv[0] =
pfes -> GetVSize();
1301 nvdofs[0] =
pfes -> GetNVDofs();
1302 nedofs[0] =
pfes -> GetNEDofs();
1303 nfdofs[0] =
pfes -> GetNFDofs();
1310 for (
p = 1;
p < NRanks;
p++)
1312 MPI_Recv(&nv[
p], 1, MPI_INT,
p, 455, MyComm, &status);
1313 MPI_Recv(&nvdofs[
p], 1, MPI_INT,
p, 456, MyComm, &status);
1314 MPI_Recv(&nedofs[
p], 1, MPI_INT,
p, 457, MyComm, &status);
1315 MPI_Recv(&nfdofs[
p], 1, MPI_INT,
p, 458, MyComm, &status);
1321 int vdim =
pfes -> GetVDim();
1323 for (
p = 0;
p < NRanks;
p++)
1325 nrdofs[
p] = nv[
p]/vdim - nvdofs[
p] - nedofs[
p] - nfdofs[
p];
1330 for (
int d = 0; d < vdim; d++)
1332 for (
p = 0;
p < NRanks;
p++)
1333 for (i = 0; i < nvdofs[
p]; i++)
1335 os << *values[
p]++ <<
'\n';
1338 for (
p = 0;
p < NRanks;
p++)
1339 for (i = 0; i < nedofs[
p]; i++)
1341 os << *values[
p]++ <<
'\n';
1344 for (
p = 0;
p < NRanks;
p++)
1345 for (i = 0; i < nfdofs[
p]; i++)
1347 os << *values[
p]++ <<
'\n';
1350 for (
p = 0;
p < NRanks;
p++)
1351 for (i = 0; i < nrdofs[
p]; i++)
1353 os << *values[
p]++ <<
'\n';
1359 for (
p = 0;
p < NRanks;
p++)
1360 for (i = 0; i < nvdofs[
p]; i++)
1361 for (
int d = 0; d < vdim; d++)
1363 os << *values[
p]++ <<
'\n';
1366 for (
p = 0;
p < NRanks;
p++)
1367 for (i = 0; i < nedofs[
p]; i++)
1368 for (
int d = 0; d < vdim; d++)
1370 os << *values[
p]++ <<
'\n';
1373 for (
p = 0;
p < NRanks;
p++)
1374 for (i = 0; i < nfdofs[
p]; i++)
1375 for (
int d = 0; d < vdim; d++)
1377 os << *values[
p]++ <<
'\n';
1380 for (
p = 0;
p < NRanks;
p++)
1381 for (i = 0; i < nrdofs[
p]; i++)
1382 for (
int d = 0; d < vdim; d++)
1384 os << *values[
p]++ <<
'\n';
1388 for (
p = 1;
p < NRanks;
p++)
1391 delete [] values[
p];
1397 MPI_Send(&nv[0], 1, MPI_INT, 0, 455, MyComm);
1398 MPI_Send(&nvdofs[0], 1, MPI_INT, 0, 456, MyComm);
1399 MPI_Send(&nedofs[0], 1, MPI_INT, 0, 457, MyComm);
1400 MPI_Send(&nfdofs[0], 1, MPI_INT, 0, 458, MyComm);
1419 loc_norm = fabs(loc_norm);
1423 loc_norm = pow(loc_norm,
p);
1428 glob_norm = pow(fabs(glob_norm), 1.0/
p);
1445 MFEM_VERIFY(ffes,
"the flux FE space must be ParFiniteElementSpace");
1458 for (
int i = 0; i < count.
Size(); i++)
1460 if (count[i] != 0) { flux(i) /= count[i]; }
1493 P.
Mult(*
this, *xMax);
1496 return std::unique_ptr<ParGridFunction>(xMax);
1504 int norm_p,
real_t solver_tol,
int solver_max_it)
1515 for (
int i = 0; i < xfes->
GetNE(); i++)
1523 *flux_fes.
GetFE(i), el_f,
false);
1541 a->AddDomainIntegrator(vmass);
1589 real_t total_error = 0.0;
1591 for (
int i = 0; i < xfes->
GetNE(); i++)
1594 total_error += pow(errors(i), norm_p);
1602 return pow(glob_error, 1.0/norm_p);
1606 const int ref_factor,
const int vdim)
const
1618 const int vdim,
const PLBound &plb,
const int max_depth,
1621 std::pair<real_t, real_t> minmax =
1624 real_t glob_min_lower = minmax.first;
1625 real_t glob_min_upper = minmax.second;
1626 MPI_Allreduce(MPI_IN_PLACE, &glob_min_lower, 1,
1628 MPI_Allreduce(MPI_IN_PLACE, &glob_min_upper, 1,
1631 return std::make_pair(glob_min_lower, glob_min_upper);
1635 const int vdim,
const PLBound &plb,
const int max_depth,
1638 std::pair<real_t, real_t> minmax =
1641 real_t glob_max_lower = minmax.first;
1642 real_t glob_max_upper = minmax.second;
1643 MPI_Allreduce(MPI_IN_PLACE, &glob_max_lower, 1,
1645 MPI_Allreduce(MPI_IN_PLACE, &glob_max_upper, 1,
1647 return std::make_pair(glob_max_lower, glob_max_upper);
void Reserve(int capacity)
Ensures that the allocated size is at least the given size.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
void Copy(Array ©) const
Create a copy of the internal array to the provided copy.
T * HostReadWrite()
Shortcut for mfem::ReadWrite(a.GetMemory(), a.Size(), false).
Conjugate gradient method.
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
virtual real_t Eval(ElementTransformation &T, const IntegrationPoint &ip)=0
Evaluate the coefficient in the element described by T at the point ip.
Delta function coefficient optionally multiplied by a weight coefficient and a scaled time dependent ...
real_t Scale()
Return the scale factor times the optional time dependent function. Returns with when not set by th...
Data type dense matrix using column-major storage.
void MultTranspose(const real_t *x, real_t *y) const
Multiply a vector with the transpose matrix.
static bool GetGPUAwareMPI()
Get the status of GPU-aware MPI flag.
Class for domain integration .
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
int GetRangeType(int dim) const
static FiniteElementCollection * New(const char *name)
Factory method: return a newly allocated FiniteElementCollection according to the given name.
int GetOrder() const
Return the order (polynomial degree) of the FE collection, corresponding to the order/degree returned...
virtual FiniteElementCollection * Clone(int p) const
Instantiate a new collection of the same type with a different order.
virtual const char * Name() const
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
void GetVDofs(int vd, Array< int > &dofs, int ndofs=-1) const
Returns the indices of all of the VDofs for the specified dimension 'vd'.
bool IsVariableOrder() const
Returns true if the space contains elements of varying polynomial orders.
void DofsToVDofs(Array< int > &dofs, int ndofs=-1) const
Compute the full set of vdofs corresponding to each entry in dofs.
DofTransformation * GetElementDofs(int elem, Array< int > &dofs) const
Returns indices of degrees of freedom of element 'elem'. The returned indices are offsets into an ldo...
ElementTransformation * GetElementTransformation(int i) const
int GetNDofs() const
Returns number of degrees of freedom. This is the number of Local Degrees of Freedom.
const NURBSExtension * GetNURBSext() const
DofTransformation * GetElementVDofs(int i, Array< int > &vdofs) const
Returns indices of degrees of freedom for the i'th element. The returned indices are offsets into an ...
virtual const FiniteElement * GetFE(int i) const
Returns pointer to the FiniteElement in the FiniteElementCollection associated with i'th element in t...
Ordering::Type GetOrdering() const
Return the ordering method.
int GetNE() const
Returns number of elements in the mesh.
const FiniteElementCollection * FEColl() const
Mesh * GetMesh() const
Returns the mesh.
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
int GetVDim() const
Returns the vector dimension of the finite element space.
const FiniteElement * GetTypicalFE() const
Return GetFE(0) if the local mesh is not empty; otherwise return a typical FE based on the Geometry t...
Abstract class for all finite elements.
virtual void CalcVShape(const IntegrationPoint &ip, DenseMatrix &shape) const
Evaluate the values of all shape functions of a vector finite element in reference space at the given...
int GetRangeDim() const
Returns the vector dimension for vector-valued finite elements, which is also the dimension of the in...
int GetOrder() const
Returns the order of the finite element. In the case of anisotropic orders, returns the maximum order...
int GetMapType() const
Returns the FiniteElement::MapType of the element describing how reference functions are mapped to ph...
int GetRangeType() const
Returns the FiniteElement::RangeType of the element, one of {SCALAR, VECTOR}.
virtual void CalcShape(const IntegrationPoint &ip, Vector &shape) const =0
Evaluate the values of all shape functions of a scalar finite element in reference space at the given...
int GetDof() const
Returns the number of degrees of freedom in the finite element.
void CalcPhysShape(ElementTransformation &Trans, Vector &shape) const
Evaluate the values of all shape functions of a scalar finite element in physical space at the point ...
Class for grid function - Vector with associated FE space.
void AccumulateAndCountBdrTangentValues(VectorCoefficient &vcoeff, const Array< int > &bdr_attr, Array< int > &values_counter)
virtual void CountElementsPerVDof(Array< int > &elem_per_vdof) const
For each vdof, counts how many elements contain the vdof, as containment is determined by FiniteEleme...
virtual real_t GetValue(int i, const IntegrationPoint &ip, int vdim=1) const
void AccumulateAndCountBdrValues(Coefficient *coeff[], VectorCoefficient *vcoeff, const Array< int > &attr, Array< int > &values_counter)
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual PLBound GetBounds(Vector &lower, Vector &upper, const int ref_factor=1, const int vdim=-1) const
virtual void MakeRef(FiniteElementSpace *f, real_t *v)
Make the GridFunction reference external data on a new FiniteElementSpace.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
void MakeOwner(FiniteElementCollection *fec_)
Make the GridFunction the owner of fec_owned and fes.
virtual void GetElementDofValues(int el, Vector &dof_vals) const
virtual void ProjectDiscCoefficient(std::variant< Coefficient *, VectorCoefficient * > coeff, Array< int > &dof_attr)
Project a discontinuous (vector) coefficient as a grid function on a continuous finite element space....
FiniteElementSpace * FESpace()
std::pair< real_t, real_t > EstimateFunctionMinimum(const int elem, const PLBound &plb, const int vdim, const int max_depth, const real_t tol, real_t &min_threshold) const
Estimate the minimum value of the GridFunction in element elem if it is below a certain min_threshold...
void ComputeMeans(AvgType type, const Array< int > &zones_per_vdof)
std::pair< real_t, real_t > EstimateFunctionMaximum(const int elem, const PLBound &plb, const int vdim, const int max_depth, const real_t tol, real_t &max_threshold) const
Estimate the maximum value of the GridFunction in element elem if it is above a certain max_threshold...
void ProjectDeltaCoefficient(DeltaCoefficient &delta_coeff, real_t &integral)
FiniteElementSpace * fes
FE space on which the grid function lives. Owned if fec_owned is not NULL.
int VectorDim() const
Shortcut for calling FiniteElementSpace::GetVectorDim() on the underlying fes.
FiniteElementCollection * fec_owned
Used when the grid function is read from a file. It can also be set explicitly, see MakeOwner().
void SumFluxAndCount(BilinearFormIntegrator &blfi, GridFunction &flux, Array< int > &counts, bool wcoef, int subdomain)
virtual void ProjectCoefficient(Coefficient &coeff, ProjectType type=ProjectType::DEFAULT)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
void AccumulateAndCountDerivativeValues(int comp, int der_comp, GridFunction &der, Array< int > &zones_per_dof) const
Used for the serial and parallel implementations of the GetDerivative() method; see its documentation...
void ProjectCoefficientElementL2_(Coefficient &coeff, Vector &sol, Vector &Va)
virtual void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const
void AccumulateAndCountZones(Coefficient &coeff, AvgType type, Array< int > &zones_per_vdof)
Accumulates (depending on type) the values of coeff at all shared vdofs and counts in how many zones ...
virtual void SetSpace(FiniteElementSpace *f)
Associate a new FiniteElementSpace with the GridFunction.
Communicator performing operations within groups defined by a GroupTopology with arbitrary-size data ...
void Reduce(T *ldata, void(*Op)(OpData< T >)) const
Reduce within each group where the master is the root, host version.
static void Sum(OpData< T >)
Reduce operation Sum, instantiated for int, double and float.
void Bcast(T *ldata, int layout) const
Broadcast within each group where the master is the root.
static void Max(OpData< T >)
Reduce operation Max, instantiated for int, double and float.
The BoomerAMG solver in hypre.
void SetPrintLevel(int print_level)
void Mult(const HypreParVector &b, HypreParVector &x) const override
Solve Ax=b with hypre's PCG.
void SetPrintLevel(int print_lvl)
void SetPreconditioner(HypreSolver &precond)
Set the hypre solver to be used as a preconditioner.
void SetMaxIter(int max_iter)
Wrapper for hypre's ParCSR matrix class.
HYPRE_Int Mult(HypreParVector &x, HypreParVector &y, real_t alpha=1.0, real_t beta=0.0) const
Computes y = alpha * A * x + beta * y.
Wrapper for hypre's parallel vector class.
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
real_t Eval(real_t h, int p) const
void GetFaceInfos(int Face, int *Inf1, int *Inf2) const
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
int GetNE() const
Returns number of elements.
real_t GetElementSize(int i, int type=0)
Get the size of the i-th element relative to the perfect reference element.
void GetFaceElements(int Face, int *Elem1, int *Elem2) const
Return the indices of the elements sharing face Face.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
Pointer to an Operator of a specified type.
virtual void Mult(const Vector &x, Vector &y) const =0
Operator application: y=A(x).
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
Matrix-free transfer operator between finite element spaces on the same mesh.
void Mult(const Vector &x, Vector &y) const override
Interpolation or prolongation of a vector x corresponding to the coarse space to the vector y corresp...
Abstract parallel finite element space.
int GetMaxElementOrder() const override
Returns the maximum polynomial order over all elements globally.
int GetLocalTDofNumber(int ldof) const
int GetDofSign(int i) const
Return -1 if the given (vector) DOF i has a sign opposite of the DOF in the respective serial FE spac...
void DivideByGroupSize(real_t *vec)
Scale a vector of true dofs.
void ExchangeFaceNbrData()
HypreParVector * NewTrueDofVector()
const FiniteElement * GetFaceNbrFE(int i, int ndofs=0) const
GroupCommunicator & GroupComm()
Return a reference to the internal GroupCommunicator (on VDofs)
bool Nonconforming() const
const Operator * GetProlongationMatrix() const override
bool HaveDofSigns() const
Return true if the parallel FE space has DOFs with signs opposite of the DOFs in the respective seria...
void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_dofs, int component=-1) const override
Determine the boundary degrees of freedom.
HypreParMatrix * Dof_TrueDof_Matrix() const
The true dof-to-dof interpolation matrix.
void GetFaceNbrElementVDofs(int i, Array< int > &vdofs, DofTransformation &doftrans) const
int GetFaceNbrVSize() const
void ApplyDofSigns(real_t *h_data) const
Apply the DOF signs to the given host data h_data which must be of size GetVSize() if HaveDofSigns() ...
const SparseMatrix * GetRestrictionMatrix() const override
Get the R matrix which restricts a local dof vector to true dof vector.
ParMesh * GetParMesh() const
const FiniteElement * GetFE(int i) const override
ElementTransformation * GetFaceNbrElementTransformation(int i) const
Class for parallel grid function.
void CountElementsPerVDof(Array< int > &elem_per_vdof) const override
For each vdof, counts how many elements contain the vdof, as containment is determined by FiniteEleme...
void ExchangeFaceNbrData()
void GetDerivative(int comp, int der_comp, ParGridFunction &der) const
Parallel version of GridFunction::GetDerivative(); see its documentation.
HypreParVector * ParallelAverage() const
Returns a new vector averaged on the true dofs.
real_t ComputeDGFaceJumpError(Coefficient *exsol, Coefficient *ell_coeff, JumpScaling jump_scaling, const IntegrationRule *irs[]=NULL) const override
Returns the Face Jumps error for L2 elements.
void Save(std::ostream &out) const override
void ProjectCoefficient(Coefficient &coeff, ProjectType type=ProjectType::DEFAULT) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
real_t GetValue(int i, const IntegrationPoint &ip, int vdim=1) const override
HypreParVector * GetTrueDofs() const
Returns the true dofs in a new HypreParVector.
void ProjectCoefficientGlobalL2(Coefficient &coeff, real_t rtol=1e-12, int iter=1000) override
Project coeff Coefficient to this GridFunction. The projection is a global L2 projection....
void ComputeFlux(BilinearFormIntegrator &blfi, GridFunction &flux, bool wcoef=true, int subdomain=-1) override
void ProjectBdrCoefficient(Coefficient *coeff[], VectorCoefficient *vcoeff, const Array< int > &attr)
std::pair< real_t, real_t > EstimateFunctionMaximum(const int vdim, const PLBound &plb, const int max_depth, const real_t tol) const override
Estimate the GridFunction maximum across all elements.
ParFiniteElementSpace * pfes
Points to the same object as fes.
Vector send_data
Vector used as an MPI buffer to send face-neighbor data in ExchangeFaceNbrData() to neighboring proce...
HypreParVector * ParallelProject() const
Returns a new vector restricted to the true dofs.
HypreParVector * ParallelAssemble() const
Returns a new vector assembled on the true dofs.
std::pair< real_t, real_t > EstimateFunctionMinimum(const int vdim, const PLBound &plb, const int max_depth, const real_t tol) const override
Estimate the GridFunction minimum across all elements.
ParFiniteElementSpace * ParFESpace() const
void AddDistribute(real_t a, const Vector *tv)
void MakeRef(FiniteElementSpace *f, real_t *v) override
Make the ParGridFunction reference external data on a new FiniteElementSpace.
void GetVectorValue(int i, const IntegrationPoint &ip, Vector &val) const override
virtual void ProjectDiscCoefficient(std::variant< Coefficient *, VectorCoefficient * > coeff) override
Project a discontinuous (vector) coefficient as a grid function on a continuous finite element space....
void ProjectCoefficientElementL2(Coefficient &coeff) override
Project coeff Coefficient to this GridFunction. The projection is an element local L2 projection,...
void SaveAsSerial(const char *fname, int precision=16, int save_rank=0) const
Vector face_nbr_data
Vector used to store data from face-neighbor processors, initialized by ExchangeFaceNbrData().
void SaveAsOne(const char *fname, int precision=16) const
GridFunction GetSerialGridFunction(int save_rank, Mesh &serial_mesh) const
Returns a GridFunction on MPI rank save_rank that does not have any duplication of vertices/nodes at ...
PLBound GetBounds(Vector &lower, Vector &upper, const int ref_factor=1, const int vdim=-1) const override
void ParallelProject(Vector &tv) const
Returns the vector restricted to the true dofs.
void Update() override
Transform by the Space UpdateMatrix (e.g., on Mesh change).
void SetSpace(FiniteElementSpace *f) override
Associate a new FiniteElementSpace with the ParGridFunction.
void Distribute(const Vector *tv)
std::unique_ptr< ParGridFunction > ProlongateToMaxOrder() const
Return a GridFunction with the values of this, prolongated to the maximum order of all elements in th...
void GetElementDofValues(int el, Vector &dof_vals) const override
void ProjectBdrCoefficientTangent(VectorCoefficient &vcoeff, const Array< int > &bdr_attr) override
Project the tangential components of the given VectorCoefficient on the boundary.
Class for parallel meshes.
Mesh GetSerialMesh(int save_rank) const
ElementTransformation * GetFaceNbrElementTransformation(int FaceNo)
Returns a pointer to the transformation defining the i-th face neighbor.
int GetNSharedFaces() const
Return the number of shared faces (3D), edges (2D), vertices (1D)
FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31) override
int GetSharedFace(int sface) const
Return the local face index for the given shared face.
int GetNFaceNeighbors() const
real_t GetFaceNbrElementSize(int i, int type=0)
int GetFaceNbrRank(int fn) const
FaceElementTransformations * GetSharedFaceTransformations(int sf, bool fill2=true)
Get the FaceElementTransformations for the given shared face (edge 2D) using the shared face index sf...
void Mult(const Vector &x, Vector &y) const override
Matrix vector multiplication.
int Size_of_connections() const
Returns the number of connections in the table.
Memory< int > & GetJMemory()
Base class for vector Coefficients that optionally depend on time and space.
int GetVDim()
Returns dimension of the vector.
Scalar coefficient defined as component of a vector coefficient.
void SetComponent(int c)
Set the component.
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Vector coefficient defined by a vector GridFunction.
virtual const real_t * HostRead() const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), false).
virtual const real_t * Read(bool on_dev=true) const
Shortcut for mfem::Read(vec.GetMemory(), vec.Size(), on_dev).
void SetDataAndSize(real_t *d, int s)
Set the Vector data and size.
void SetSubVector(const Array< int > &dofs, const real_t value)
Set the entries listed in dofs to the given value.
void Destroy()
Destroy a vector.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
virtual real_t * HostWrite()
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), false).
real_t * GetData() const
Return a pointer to the beginning of the Vector data.
virtual real_t * HostReadWrite()
Shortcut for mfem::ReadWrite(vec.GetMemory(), vec.Size(), false).
void GetSubVector(const Array< int > &dofs, Vector &elemvect) const
Extract entries listed in dofs to the output Vector elemvect.
virtual real_t * Write(bool on_dev=true)
Shortcut for mfem::Write(vec.GetMemory(), vec.Size(), on_dev).
const int * ess_tdof_list
ProjectType
This enumerated type describes the main projection types used by GridFunction::ProjectCoefficient():
const T * Read(const Memory< T > &mem, int size, bool on_dev=true)
Get a pointer for read access to mem with the mfem::Device's DeviceMemoryClass, if on_dev = true,...
real_t L2ZZErrorEstimator(BilinearFormIntegrator &flux_integrator, const ParGridFunction &x, ParFiniteElementSpace &smooth_flux_fes, ParFiniteElementSpace &flux_fes, Vector &errors, int norm_p, real_t solver_tol, int solver_max_it)
real_t GlobalLpNorm(const real_t p, real_t loc_norm, MPI_Comm comm)
Compute a global Lp norm from the local Lp norms computed by each processor.
real_t ComputeElementLpDistance(real_t p, int i, GridFunction &gf1, GridFunction &gf2)
Compute the Lp distance between two grid functions on the given element.
std::function< real_t(const Vector &)> f(real_t mass_coeff)
void forall(int N, lambda &&body)
constexpr real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
real_t p(const Vector &x, real_t t)
Helper struct to convert a C++ type to an MPI type.