MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
pfespace.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_PFESPACE
13#define MFEM_PFESPACE
14
15#include "../config/config.hpp"
16
17#ifdef MFEM_USE_MPI
18
19#include "../linalg/hypre.hpp"
20#include "../mesh/pmesh.hpp"
21#include "../mesh/nurbs.hpp"
22#include "fespace.hpp"
23
24namespace mfem
25{
26
27/// Abstract parallel finite element space.
29{
30private:
31 /// MPI data.
32 MPI_Comm MyComm;
33 int NRanks, MyRank;
34
35 /// Parallel mesh; @a mesh points to this object as well. Not owned.
36 ParMesh *pmesh;
37 /** Parallel non-conforming mesh extension object; same as pmesh->pncmesh.
38 Not owned. */
39 ParNCMesh *pncmesh;
40
41 /// GroupCommunicator on the local VDofs. Owned.
42 GroupCommunicator *gcomm;
43
44 /// Number of true dofs in this processor (local true dofs).
45 mutable int ltdof_size;
46
47 /// Number of vertex/edge/face/total ghost DOFs (nonconforming case).
48 int ngvdofs, ngedofs, ngfdofs, ngdofs;
49
50 struct VarOrderDofInfo
51 {
52 unsigned int index; // Index of the entity (edge or face)
53 unsigned short int edof; // Dof index within the entity
54 };
55
56 Array<VarOrderDofInfo> var_edge_dofmap, var_face_dofmap;
57
58 /// For each true DOF on edges and faces, store data about the edge or face.
59 struct TdofLdofInfo
60 {
61 bool set; // Whether the members of this instance are set.
62 int minOrder; // Minimum order for the mesh entity containing this DOF.
63 bool isEdge; // Whether the containing mesh entity is an edge.
64 int idx; // Index of the containing mesh entity in pmesh.
65 };
66
67 /// Data for each true DOF on edges and faces.
68 Array<TdofLdofInfo> tdof2ldof;
69
70 /// The group of each local dof.
71 Array<int> ldof_group;
72
73 /// For a local dof: the local true dof number in the master of its group.
74 mutable Array<int> ldof_ltdof;
75
76 /// Offsets for the dofs in each processor in global numbering.
77 mutable Array<HYPRE_BigInt> dof_offsets;
78
79 /// Offsets for the true dofs in each processor in global numbering.
80 mutable Array<HYPRE_BigInt> tdof_offsets;
81
82 /// Offsets for the true dofs in neighbor processor in global numbering.
83 mutable Array<HYPRE_BigInt> tdof_nb_offsets;
84
85 /// Previous 'dof_offsets' (before Update()), column partition of T.
86 Array<HYPRE_BigInt> old_dof_offsets;
87
88 /// The sign of the basis functions at the scalar local dofs.
89 Array<int> ldof_sign;
90
91 /// The matrix P (interpolation from true dof to dof). Owned.
92 mutable HypreParMatrix *P;
93 /// Optimized action-only prolongation operator for conforming meshes. Owned.
94 mutable Operator *Pconf;
95
96 /** Used to indicate that the space is nonconforming (even if the underlying
97 mesh has NULL @a ncmesh). This occurs in low-order preconditioning on
98 nonconforming meshes. */
99 bool nonconf_P;
100
101 /// The (block-diagonal) matrix R (restriction of dof to true dof). Owned.
102 mutable SparseMatrix *R;
103 /// Optimized action-only restriction operator for conforming meshes. Owned.
104 mutable Operator *Rconf;
105
106 /// Flag indicating the existence of shared triangles with interior ND dofs
107 bool nd_strias;
108
109 /** Stores the previous ParFiniteElementSpace, before p-refinement, in the
110 case that @a PTh is constructed by PRefineAndUpdate(). */
111 std::unique_ptr<ParFiniteElementSpace> pfes_prev;
112
113 /// Ghost element order data, set by CommunicateGhostOrder().
115
116 /// Resets nd_strias flag at construction or after rebalancing
117 void CheckNDSTriaDofs();
118
119 ParNURBSExtension *pNURBSext() const
120 { return dynamic_cast<ParNURBSExtension *>(NURBSext); }
121
122 static ParNURBSExtension *MakeLocalNURBSext(
123 const NURBSExtension *globNURBSext, const NURBSExtension *parNURBSext);
124
125 GroupTopology &GetGroupTopo() const
126 { return (NURBSext) ? pNURBSext()->gtopo : pmesh->gtopo; }
127
128 // Auxiliary method used in constructors
129 void ParInit(ParMesh *pm);
130
131 /// Set ghost_orders.
132 void CommunicateGhostOrder();
133
134 /// Sets @a tdof2ldof. See documentation of @a tdof2ldof for details.
135 void SetTDOF2LDOFinfo(int ntdofs, int vdim_factor, int dof_stride,
136 int allnedofs);
137
138 /** Set the rows of the restriction matrix @a R in a variable-order space,
139 corresponding to true DOFs on edges and faces. */
140 void SetRestrictionMatrixEdgesFaces(int vdim_factor, int dof_stride,
141 int tdof_stride,
142 const Array<int> &dof_tdof,
143 const Array<HYPRE_BigInt> &dof_offs);
144
145 /// Helper function to set var_edge_dofmap or var_face_dofmap
146 void SetVarDofMap(const Table & dofs, Array<VarOrderDofInfo> & dmap);
147
148 void Construct();
149 void Destroy();
150
151 // ldof_type = 0 : DOFs communicator, otherwise VDOFs communicator
152 void GetGroupComm(GroupCommunicator &gcomm, int ldof_type,
153 Array<int> *ldof_sign = NULL);
154
155 /// Construct dof_offsets and tdof_offsets using global communication.
156 void GenerateGlobalOffsets() const;
157
158 /// Construct ldof_group and ldof_ltdof.
159 void ConstructTrueDofs();
160 void ConstructTrueNURBSDofs();
161
162 void ApplyLDofSigns(Array<int> &dofs) const;
163 void ApplyLDofSigns(Table &el_dof) const;
164
165 typedef NCMesh::MeshId MeshId;
166 typedef ParNCMesh::GroupId GroupId;
167
168 void GetGhostVertexDofs(const MeshId &id, Array<int> &dofs) const;
169 void GetGhostEdgeDofs(const MeshId &edge_id, Array<int> &dofs,
170 int variant) const;
171 void GetGhostFaceDofs(const MeshId &face_id, Array<int> &dofs) const;
172 void GetGhostDofs(int entity, const MeshId &id, Array<int> &dofs,
173 int variant) const;
174
175 /// Return the dofs associated with the interior of the given mesh entity.
176 void GetBareDofs(int entity, int index, Array<int> &dofs) const;
177 void GetBareDofsVar(int entity, int index, Array<int> &dofs) const;
178
179 /** @brief Return the local space DOF index for the DOF with index @a edof
180 with respect to the mesh entity @a index of type @a entity (0: vertex,
181 1: edge, 2: face). In the variable-order case, use variant @a var. */
182 int PackDof(int entity, int index, int edof, int var = 0) const;
183 /// Inverse of function @a PackDof, setting order instead of variant.
184 void UnpackDof(int dof, int &entity, int &index, int &edof, int &order) const;
185
186 /// Implementation of function @a PackDof for the variable-order case.
187 int PackDofVar(int entity, int index, int edof, int var = 0) const;
188 /// Implementation of function @a UnpackDof for the variable-order case.
189 void UnpackDofVar(int dof, int &entity, int &index, int &edof,
190 int &order) const;
191
192#ifdef MFEM_PMATRIX_STATS
193 mutable int n_msgs_sent, n_msgs_recv;
194 mutable int n_rows_sent, n_rows_recv, n_rows_fwd;
195#endif
196
197 void ScheduleSendOrder(int ent, int idx, int order,
198 GroupId group_id,
199 std::map<int, class NeighborOrderMessage> &send_msg) const;
200
201 void ScheduleSendRow(const struct PMatrixRow &row, int dof, GroupId group_id,
202 std::map<int, class NeighborRowMessage> &send_msg) const;
203
204 void ForwardRow(const struct PMatrixRow &row, int dof,
205 GroupId group_sent_id, GroupId group_id,
206 std::map<int, class NeighborRowMessage> &send_msg) const;
207
208#ifdef MFEM_DEBUG_PMATRIX
209 void DebugDumpDOFs(std::ostream &os,
210 const SparseMatrix &deps,
211 const Array<GroupId> &dof_group,
212 const Array<GroupId> &dof_owner,
213 const Array<bool> &finalized) const;
214#endif
215
216 /// Helper: create a HypreParMatrix from a list of PMatrixRows.
218 MakeVDimHypreMatrix(const std::vector<struct PMatrixRow> &rows,
219 int local_rows, int local_cols,
220 Array<HYPRE_BigInt> &row_starts,
221 Array<HYPRE_BigInt> &col_starts) const;
222
223 /// Build the P and R matrices.
224 void Build_Dof_TrueDof_Matrix() const;
225
226 /** Used when the ParMesh is non-conforming, i.e. pmesh->pncmesh != NULL.
227 Constructs the matrices P and R, the DOF and true DOF offset arrays,
228 and the DOF -> true DOF map ('dof_tdof'). Returns the number of
229 vector true DOFs. All pointer arguments are optional and can be NULL. */
230 int BuildParallelConformingInterpolation(HypreParMatrix **P, SparseMatrix **R,
231 Array<HYPRE_BigInt> &dof_offs,
232 Array<HYPRE_BigInt> &tdof_offs,
233 Array<int> *dof_tdof,
234 bool partial = false);
235
236 /** Calculate a GridFunction migration matrix after mesh load balancing.
237 The result is a parallel permutation matrix that can be used to update
238 all grid functions defined on this space. */
239 HypreParMatrix* RebalanceMatrix(int old_ndofs,
240 const Table* old_elem_dof,
241 const Table* old_elem_fos);
242
243 /** Calculate a GridFunction restriction matrix after mesh derefinement.
244 The matrix is constructed so that the new grid function interpolates
245 the original function, i.e., the original function is evaluated at the
246 nodes of the coarse function. */
247 HypreParMatrix* ParallelDerefinementMatrix(int old_ndofs,
248 const Table *old_elem_dof,
249 const Table *old_elem_fos);
250
251 /// Updates the internal mesh pointer. @warning @a new_mesh must be
252 /// <b>topologically identical</b> to the existing mesh. Used if the address
253 /// of the Mesh object has changed, e.g. in @a Mesh::Swap.
254 void UpdateMeshPointer(Mesh *new_mesh) override;
255
256 /// Copies the prolongation and restriction matrices from @a fes.
257 ///
258 /// Used for low order preconditioning on non-conforming meshes. If the DOFs
259 /// require a permutation, it will be supplied by non-NULL @a perm. NULL @a
260 /// perm indicates that no permutation is required.
261 void CopyProlongationAndRestriction(const FiniteElementSpace &fes,
262 const Array<int> *perm) override;
263
264public:
265 // Face-neighbor data
266 // Number of face-neighbor dofs
268 // Face-neighbor-element to face-neighbor dof
270 // Face-neighbor-element face orientations
272 // Face-neighbor to ldof in the face-neighbor numbering
274 // The global ldof indices of the face-neighbor dofs
276 // Local face-neighbor data: face-neighbor to ldof
278
279 /** @brief Copy constructor: deep copy all data from @a orig except the
280 ParMesh, the FiniteElementCollection, and some derived data. */
281 /** If the @a pmesh or @a fec pointers are NULL (default), then the new
282 ParFiniteElementSpace will reuse the respective pointers from @a orig. If
283 any of these pointers is not NULL, the given pointer will be used instead
284 of the one used by @a orig.
285
286 @note The objects pointed to by the @a pmesh and @a fec parameters must
287 be either the same objects as the ones used by @a orig, or copies of
288 them. Otherwise, the behavior is undefined.
289
290 @note Derived data objects, such as the parallel prolongation and
291 restriction operators, the update operator, and any of the face-neighbor
292 data, will not be copied, even if they are created in the @a orig object.
293 */
295 ParMesh *pmesh = NULL,
296 const FiniteElementCollection *fec = NULL);
297
298 /** @brief Convert/copy the *local* (Par)FiniteElementSpace @a orig to
299 ParFiniteElementSpace: deep copy all data from @a orig except the Mesh,
300 the FiniteElementCollection, and some derived data. */
302 const FiniteElementCollection *fec = NULL);
303
304 /** @brief Construct the *local* ParFiniteElementSpace corresponding to the
305 global FE space, @a global_fes. */
306 /** The parameter @a pm is the *local* ParMesh obtained by decomposing the
307 global Mesh used by @a global_fes. The array @a partitioning represents
308 the parallel decomposition - it maps global element ids to MPI ranks.
309 If the FiniteElementCollection, @a f, is NULL (default), the FE
310 collection used by @a global_fes will be reused. If @a f is not NULL, it
311 must be the same as, or a copy of, the FE collection used by
312 @a global_fes.
313
314 @note Currently the @a partitioning array is not used by this
315 constructor, it is required for general parallel variable-order support.
316 */
317 ParFiniteElementSpace(ParMesh *pm, const FiniteElementSpace *global_fes,
318 const int *partitioning,
319 const FiniteElementCollection *f = NULL);
320
322 int dim = 1, int ordering = Ordering::byNODES);
323
324 /// Construct a NURBS FE space based on the given NURBSExtension, @a ext.
325 /** The parameter @a ext will be deleted by this constructor, replaced by a
326 ParNURBSExtension owned by the ParFiniteElementSpace.
327 @note If the pointer @a ext is NULL, this constructor is equivalent to
328 the standard constructor with the same arguments minus the
329 NURBSExtension, @a ext. */
332 int dim = 1, int ordering = Ordering::byNODES);
333
334 MPI_Comm GetComm() const { return MyComm; }
335 int GetNRanks() const { return NRanks; }
336 int GetMyRank() const { return MyRank; }
337
338 inline ParMesh *GetParMesh() const { return pmesh; }
339
340 int GetDofSign(int i)
341 { return NURBSext || Nonconforming() ? 1 : ldof_sign[VDofToDof(i)]; }
342 HYPRE_BigInt *GetDofOffsets() const { return dof_offsets; }
343 HYPRE_BigInt *GetTrueDofOffsets() const { return tdof_offsets; }
348
349 /// Return the number of local vector true dofs.
350 int GetTrueVSize() const override { return ltdof_size; }
351
352 /// Returns indexes of degrees of freedom in array dofs for i'th element and
353 /// returns the DofTransformation data in a user-provided object.
355 void GetElementDofs(int i, Array<int> &dofs,
356 DofTransformation &doftrans) const override;
357
358 /// Returns indexes of degrees of freedom for i'th boundary element and
359 /// returns the DofTransformation data in a user-provided object.
361 void GetBdrElementDofs(int i, Array<int> &dofs,
362 DofTransformation &doftrans) const override;
363
364 /** Returns the indexes of the degrees of freedom for i'th face
365 including the dofs for the edges and the vertices of the face. */
366 int GetFaceDofs(int i, Array<int> &dofs, int variant = 0) const override;
367
368 /** Returns pointer to the FiniteElement in the FiniteElementCollection
369 associated with i'th element in the mesh object. If @a i is greater than
370 or equal to the number of local mesh elements, @a i will be interpreted
371 as a shifted index of a face neighbor element. */
372 const FiniteElement *GetFE(int i) const override;
373
374 /** Returns an Operator that converts L-vectors to E-vectors on each face.
375 The parallel version is different from the serial one because of the
376 presence of shared faces. Shared faces are treated as interior faces,
377 the returned operator handles the communication needed to get the
378 shared face values from other MPI ranks */
380 ElementDofOrdering f_ordering, FaceType type,
381 L2FaceValues mul = L2FaceValues::DoubleValued) const override;
382
383 void GetSharedEdgeDofs(int group, int ei, Array<int> &dofs) const;
384 void GetSharedTriangleDofs(int group, int fi, Array<int> &dofs) const;
385 void GetSharedQuadrilateralDofs(int group, int fi, Array<int> &dofs) const;
386
387 /// The true dof-to-dof interpolation matrix
389 { if (!P) { Build_Dof_TrueDof_Matrix(); } return P; }
390
391 /** @brief For a non-conforming mesh, construct and return the interpolation
392 matrix from the partially conforming true dofs to the local dofs. */
393 /** @note The returned pointer must be deleted by the caller. */
395
396 /** Create and return a new HypreParVector on the true dofs, which is
397 owned by (i.e. it must be destroyed by) the calling function. */
400
401 /// Scale a vector of true dofs
402 void DivideByGroupSize(real_t *vec);
403
404 /// Return a reference to the internal GroupCommunicator (on VDofs)
405 GroupCommunicator &GroupComm() { return *gcomm; }
406
407 /// Return a const reference to the internal GroupCommunicator (on VDofs)
408 const GroupCommunicator &GroupComm() const { return *gcomm; }
409
410 /// Return a new GroupCommunicator on scalar dofs, i.e. for VDim = 1.
411 /** @note The returned pointer must be deleted by the caller. */
413
414 /** @brief Given an integer array on the local degrees of freedom, perform
415 a bitwise OR between the shared dofs. */
416 /** For non-conforming mesh, synchronization is performed on the cut (aka
417 "partially conforming") space. */
418 void Synchronize(Array<int> &ldof_marker) const;
419
420 /// Determine the boundary degrees of freedom
421 void GetEssentialVDofs(const Array<int> &bdr_attr_is_ess,
422 Array<int> &ess_dofs,
423 int component = -1) const override;
424
425 /** Get a list of essential true dofs, ess_tdof_list, corresponding to the
426 boundary attributes marked in the array bdr_attr_is_ess. */
427 void GetEssentialTrueDofs(const Array<int> &bdr_attr_is_ess,
428 Array<int> &ess_tdof_list,
429 int component = -1) const override;
430
431 /** Helper function for GetEssentialTrueDofs(), in the case of a
432 variable-order H1 space. */
434 &bdr_attr_is_ess,
435 const Array<int> &ess_dofs,
436 Array<int> &true_ess_dofs,
437 int component) const;
438
439 /// Determine the external degrees of freedom
440 void GetExteriorVDofs(Array<int> &ext_dofs,
441 int component = -1) const override;
442
443 /** Get a list of external true dofs, ext_tdof_list, corresponding to the
444 face on the exterior of the mesh. */
445 void GetExteriorTrueDofs(Array<int> &ext_tdof_list,
446 int component = -1) const override;
447
448 /** If the given ldof is owned by the current processor, return its local
449 tdof number, otherwise return -1 */
450 int GetLocalTDofNumber(int ldof) const;
451 /// Returns the global tdof number of the given local degree of freedom
452 HYPRE_BigInt GetGlobalTDofNumber(int ldof) const;
453 /** Returns the global tdof number of the given local degree of freedom in
454 the scalar version of the current finite element space. The input should
455 be a scalar local dof. */
457
460
461 const Operator *GetProlongationMatrix() const override;
462 /** Get an Operator that performs the action of GetRestrictionMatrix(),
463 but potentially with a non-assembled optimized matrix-free
464 implementation. */
465 const Operator *GetRestrictionOperator() const override;
466 /// Get the R matrix which restricts a local dof vector to true dof vector.
467 const SparseMatrix *GetRestrictionMatrix() const override
468 { Dof_TrueDof_Matrix(); return R; }
469
470 // Face-neighbor functions
471 void ExchangeFaceNbrData();
472 int GetFaceNbrVSize() const { return num_face_nbr_dofs; }
473 void GetFaceNbrElementVDofs(int i, Array<int> &vdofs,
474 DofTransformation &doftrans) const;
476 void GetFaceNbrFaceVDofs(int i, Array<int> &vdofs) const;
477 /** In the variable-order case with @a ndofs > 0, the order is taken such
478 that the number of DOFs is @a ndofs. */
479 const FiniteElement *GetFaceNbrFE(int i, int ndofs = 0) const;
480 const FiniteElement *GetFaceNbrFaceFE(int i) const;
484
486 void LoseDofOffsets() { dof_offsets.LoseData(); }
487 void LoseTrueDofOffsets() { tdof_offsets.LoseData(); }
488
489 bool Conforming() const { return pmesh->pncmesh == NULL && !nonconf_P; }
490 bool Nonconforming() const { return pmesh->pncmesh != NULL || nonconf_P; }
491
492 bool SharedNDTriangleDofs() const { return nd_strias; }
493
494 // Transfer parallel true-dof data from coarse_fes, defined on a coarse mesh,
495 // to this FE space, defined on a refined mesh. See full documentation in the
496 // base class, FiniteElementSpace::GetTrueTransferOperator.
497 void GetTrueTransferOperator(const FiniteElementSpace &coarse_fes,
498 OperatorHandle &T) const override;
499
500 /** Reflect changes in the mesh. Calculate one of the refinement/derefinement
501 /rebalance matrices, unless want_transform is false. */
502 void Update(bool want_transform = true) override;
503
504 /** P-refine and update the space. If @a want_transfer, also maintain the old
505 space and a transfer operator accessible by GetPrefUpdateOperator(). */
506 void PRefineAndUpdate(const Array<pRefinement> & refs,
507 bool want_transfer = true) override;
508
509 /// Free ParGridFunction transformation matrix (if any), to save memory.
510 void UpdatesFinished() override
511 {
513 old_dof_offsets.DeleteAll();
514 }
515
516 /// Returns the maximum polynomial order over all elements globally.
517 int GetMaxElementOrder() const override;
518
519 virtual ~ParFiniteElementSpace() { Destroy(); }
520
521 void PrintPartitionStats();
522
523 /// Obsolete, kept for backward compatibility
524 int TrueVSize() const { return ltdof_size; }
525
526protected:
527 /** Helper function for finalizing intermediate DOFs on edges and faces in a
528 variable-order space, with order strictly between the minimum and
529 maximum. */
530 void MarkIntermediateEntityDofs(int entity, Array<bool> & intermediate) const;
531
532 /** Helper function for variable-order spaces, to apply the order on each
533 ghost element to its edges and faces. */
535 Array<VarOrderBits> &edge_orders,
536 Array<VarOrderBits> &face_orders) const override;
537
538 /** Helper function for variable-order spaces, to apply the lowest order on
539 each ghost face to its edges. */
540 void GhostFaceOrderToEdges(const Array<VarOrderBits> &face_orders,
541 Array<VarOrderBits> &edge_orders)
542 const override;
543
544 /** Performs parallel order propagation, for variable-order spaces. Returns
545 true if order propagation is done. */
546 bool OrderPropagation(const std::set<int> &edges,
547 const std::set<int> &faces,
548 Array<VarOrderBits> &edge_orders,
549 Array<VarOrderBits> &face_orders) const override;
550
551 /// Returns the number of ghost edges.
552 int NumGhostEdges() const override
553 { return pncmesh ? pncmesh->GetNGhostEdges() : 0; }
554
555 /// Returns the number of ghost faces.
556 int NumGhostFaces() const override
557 { return pncmesh ? pncmesh->GetNGhostFaces() : 0; }
558};
559
560
561/// Auxiliary class used by ParFiniteElementSpace.
563{
564protected:
567 bool local;
568
569public:
571 bool local_=false);
572
574 bool local_=false);
575
577
578 void Mult(const Vector &x, Vector &y) const override;
579
580 void MultTranspose(const Vector &x, Vector &y) const override;
581};
582
583/// Auxiliary device class used by ParFiniteElementSpace.
586{
587protected:
594 MPI_Request *requests;
595
596 // Kernel: copy ltdofs from 'src' to 'shr_buf' - prepare for send.
597 // shr_buf[i] = src[shr_ltdof[i]]
598 void BcastBeginCopy(const Vector &src) const;
599
600 // Kernel: copy ltdofs from 'src' to ldofs in 'dst'.
601 // dst[ltdof_ldof[i]] = src[i]
602 void BcastLocalCopy(const Vector &src, Vector &dst) const;
603
604 // Kernel: copy ext. dofs from 'ext_buf' to 'dst' - after recv.
605 // dst[ext_ldof[i]] = ext_buf[i]
606 void BcastEndCopy(Vector &dst) const;
607
608 // Kernel: copy ext. dofs from 'src' to 'ext_buf' - prepare for send.
609 // ext_buf[i] = src[ext_ldof[i]]
610 void ReduceBeginCopy(const Vector &src) const;
611
612 // Kernel: copy owned ldofs from 'src' to ltdofs in 'dst'.
613 // dst[i] = src[ltdof_ldof[i]]
614 void ReduceLocalCopy(const Vector &src, Vector &dst) const;
615
616 // Kernel: assemble dofs from 'shr_buf' into to 'dst' - after recv.
617 // dst[shr_ltdof[i]] += shr_buf[i]
618 void ReduceEndAssemble(Vector &dst) const;
619
620public:
622 const GroupCommunicator &gc_, const SparseMatrix *R, bool local_=false);
623
625 bool local_=false);
626
628
629 void Mult(const Vector &x, Vector &y) const override;
630
631 void MultTranspose(const Vector &x, Vector &y) const override;
632};
633
634}
635
636#endif // MFEM_USE_MPI
637
638#endif
void LoseData()
NULL-ifies the data.
Definition array.hpp:141
void DeleteAll()
Delete the whole array.
Definition array.hpp:925
Auxiliary class used by ParFiniteElementSpace.
Definition pfespace.hpp:563
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
const GroupCommunicator & GetGroupCommunicator() const
ConformingProlongationOperator(int lsize, const GroupCommunicator &gc_, bool local_=false)
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
const GroupCommunicator & gc
Definition pfespace.hpp:566
Auxiliary device class used by ParFiniteElementSpace.
Definition pfespace.hpp:586
void Mult(const Vector &x, Vector &y) const override
Operator application: y=A(x).
void MultTranspose(const Vector &x, Vector &y) const override
Action of the transpose operator: y=A^t(x). The default behavior in class Operator is to generate an ...
void ReduceEndAssemble(Vector &dst) const
void BcastBeginCopy(const Vector &src) const
void ReduceLocalCopy(const Vector &src, Vector &dst) const
void ReduceBeginCopy(const Vector &src) const
DeviceConformingProlongationOperator(const GroupCommunicator &gc_, const SparseMatrix *R, bool local_=false)
void BcastLocalCopy(const Vector &src, Vector &dst) const
Base class for operators that extracts Face degrees of freedom.
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Definition fe_coll.hpp:27
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:244
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...
Definition fespace.cpp:3513
NURBSExtension * NURBSext
Definition fespace.hpp:319
const FiniteElementCollection * fec
Associated FE collection (not owned).
Definition fespace.hpp:255
int VDofToDof(int vdof) const
Compute the inverse of the Dof to VDof mapping for a single index vdof.
Definition fespace.hpp:1146
virtual void UpdatesFinished()
Free the GridFunction update operator (if any), to save memory.
Definition fespace.hpp:1500
int ndofs
Number of degrees of freedom. Number of unknowns is ndofs * vdim.
Definition fespace.hpp:266
Ordering::Type ordering
Definition fespace.hpp:263
DofTransformation * GetBdrElementDofs(int bel, Array< int > &dofs) const
Returns indices of degrees of freedom for boundary element 'bel'. The returned indices are offsets in...
Definition fespace.cpp:3617
Abstract class for all finite elements.
Definition fe_base.hpp:244
Communicator performing operations within groups defined by a GroupTopology with arbitrary-size data ...
Wrapper for hypre's ParCSR matrix class.
Definition hypre.hpp:408
HYPRE_BigInt GetGlobalNumRows() const
Return the global number of rows.
Definition hypre.hpp:699
HYPRE_BigInt GetGlobalNumCols() const
Return the global number of columns.
Definition hypre.hpp:703
Wrapper for hypre's parallel vector class.
Definition hypre.hpp:219
Class used by MFEM to store pointers to host and/or device memory.
Mesh data type.
Definition mesh.hpp:64
NURBSExtension generally contains multiple NURBSPatch objects spanning an entire Mesh....
Definition nurbs.hpp:449
Pointer to an Operator of a specified type.
Definition handle.hpp:34
Abstract operator.
Definition operator.hpp:25
Abstract parallel finite element space.
Definition pfespace.hpp:29
void GetTrueTransferOperator(const FiniteElementSpace &coarse_fes, OperatorHandle &T) const override
Construct and return an Operator that can be used to transfer true-dof data from coarse_fes,...
HYPRE_BigInt GetGlobalScalarTDofNumber(int sldof)
const GroupCommunicator & GroupComm() const
Return a const reference to the internal GroupCommunicator (on VDofs)
Definition pfespace.hpp:408
void GetSharedTriangleDofs(int group, int fi, Array< int > &dofs) const
Definition pfespace.cpp:703
void GetSharedEdgeDofs(int group, int ei, Array< int > &dofs) const
Definition pfespace.cpp:680
int NumGhostEdges() const override
Returns the number of ghost edges.
Definition pfespace.hpp:552
MPI_Comm GetComm() const
Definition pfespace.hpp:334
int GetMaxElementOrder() const override
Returns the maximum polynomial order over all elements globally.
const FaceRestriction * GetFaceRestriction(ElementDofOrdering f_ordering, FaceType type, L2FaceValues mul=L2FaceValues::DoubleValued) const override
Definition pfespace.cpp:634
HYPRE_BigInt * GetTrueDofOffsets() const
Definition pfespace.hpp:343
void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const override
void GetExteriorTrueDofs(Array< int > &ext_tdof_list, int component=-1) const override
void GetExteriorVDofs(Array< int > &ext_dofs, int component=-1) const override
Determine the external degrees of freedom.
HYPRE_BigInt GlobalVSize() const
Definition pfespace.hpp:344
const Operator * GetRestrictionOperator() const override
int GetLocalTDofNumber(int ldof) const
void UpdatesFinished() override
Free ParGridFunction transformation matrix (if any), to save memory.
Definition pfespace.hpp:510
void Synchronize(Array< int > &ldof_marker) const
Given an integer array on the local degrees of freedom, perform a bitwise OR between the shared dofs.
void ApplyGhostElementOrdersToEdgesAndFaces(Array< VarOrderBits > &edge_orders, Array< VarOrderBits > &face_orders) const override
bool SharedNDTriangleDofs() const
Definition pfespace.hpp:492
ParFiniteElementSpace(const ParFiniteElementSpace &orig, ParMesh *pmesh=NULL, const FiniteElementCollection *fec=NULL)
Copy constructor: deep copy all data from orig except the ParMesh, the FiniteElementCollection,...
Definition pfespace.cpp:31
void DivideByGroupSize(real_t *vec)
Scale a vector of true dofs.
HYPRE_BigInt GlobalTrueVSize() const
Definition pfespace.hpp:346
HypreParVector * NewTrueDofVector()
Definition pfespace.hpp:398
int GetTrueVSize() const override
Return the number of local vector true dofs.
Definition pfespace.hpp:350
const FiniteElement * GetFaceNbrFE(int i, int ndofs=0) const
void GhostFaceOrderToEdges(const Array< VarOrderBits > &face_orders, Array< VarOrderBits > &edge_orders) const override
HYPRE_BigInt GetMyDofOffset() const
HYPRE_BigInt * GetDofOffsets() const
Definition pfespace.hpp:342
Array< HYPRE_BigInt > face_nbr_glob_dof_map
Definition pfespace.hpp:275
GroupCommunicator & GroupComm()
Return a reference to the internal GroupCommunicator (on VDofs)
Definition pfespace.hpp:405
void GetEssentialTrueDofsVar(const Array< int > &bdr_attr_is_ess, const Array< int > &ess_dofs, Array< int > &true_ess_dofs, int component) const
void GetFaceNbrFaceVDofs(int i, Array< int > &vdofs) const
const Operator * GetProlongationMatrix() const override
GroupCommunicator * ScalarGroupComm()
Return a new GroupCommunicator on scalar dofs, i.e. for VDim = 1.
bool OrderPropagation(const std::set< int > &edges, const std::set< int > &faces, Array< VarOrderBits > &edge_orders, Array< VarOrderBits > &face_orders) const override
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.
Definition pfespace.hpp:388
void GetFaceNbrElementVDofs(int i, Array< int > &vdofs, DofTransformation &doftrans) const
const HYPRE_BigInt * GetFaceNbrGlobalDofMap()
Definition pfespace.hpp:481
int GetFaceDofs(int i, Array< int > &dofs, int variant=0) const override
Definition pfespace.cpp:611
int NumGhostFaces() const override
Returns the number of ghost faces.
Definition pfespace.hpp:556
HYPRE_BigInt GetMyTDofOffset() const
void GetSharedQuadrilateralDofs(int group, int fi, Array< int > &dofs) const
Definition pfespace.cpp:727
void GetElementDofs(int i, Array< int > &dofs, DofTransformation &doftrans) const override
The same as GetElementDofs(), but with a user-allocated DofTransformation object. doftrans must be al...
Definition pfespace.cpp:561
void PRefineAndUpdate(const Array< pRefinement > &refs, bool want_transfer=true) override
const SparseMatrix * GetRestrictionMatrix() const override
Get the R matrix which restricts a local dof vector to true dof vector.
Definition pfespace.hpp:467
HYPRE_BigInt GetGlobalTDofNumber(int ldof) const
Returns the global tdof number of the given local degree of freedom.
ParMesh * GetParMesh() const
Definition pfespace.hpp:338
void Update(bool want_transform=true) override
HypreParMatrix * GetPartialConformingInterpolation()
For a non-conforming mesh, construct and return the interpolation matrix from the partially conformin...
int TrueVSize() const
Obsolete, kept for backward compatibility.
Definition pfespace.hpp:524
void MarkIntermediateEntityDofs(int entity, Array< bool > &intermediate) const
const FiniteElement * GetFaceNbrFaceFE(int i) const
const FiniteElement * GetFE(int i) const override
Definition pfespace.cpp:627
ElementTransformation * GetFaceNbrElementTransformation(int i) const
Definition pfespace.hpp:482
void GetBdrElementDofs(int i, Array< int > &dofs, DofTransformation &doftrans) const override
The same as GetBdrElementDofs(), but with a user-allocated DofTransformation object....
Definition pfespace.cpp:586
Class for parallel meshes.
Definition pmesh.hpp:34
ElementTransformation * GetFaceNbrElementTransformation(int FaceNo)
Returns a pointer to the transformation defining the i-th face neighbor.
Definition pmesh.cpp:3087
GroupTopology gtopo
Definition pmesh.hpp:456
ParNCMesh * pncmesh
Definition pmesh.hpp:469
A parallel extension of the NCMesh class.
Definition pncmesh.hpp:63
int GetNGhostEdges() const
Definition pncmesh.hpp:117
int GetNGhostFaces() const
Definition pncmesh.hpp:118
Parallel version of NURBSExtension.
Definition nurbs.hpp:924
GroupTopology gtopo
Definition nurbs.hpp:943
Data type sparse matrix.
Definition sparsemat.hpp:51
Vector data type.
Definition vector.hpp:82
int dim
Definition ex24.cpp:53
HYPRE_Int HYPRE_BigInt
int index(int i, int j, int nx, int ny)
Definition life.cpp:236
float real_t
Definition config.hpp:43
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
Definition fespace.hpp:83
std::function< real_t(const Vector &)> f(real_t mass_coeff)
Definition lor_mms.hpp:30
FaceType
Definition mesh.hpp:48
Identifies a vertex/edge/face in both Mesh and NCMesh.
Definition ncmesh.hpp:210