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