MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
lor_ams.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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_LOR_AMS
13#define MFEM_LOR_AMS
14
16
17#ifdef MFEM_USE_MPI
18
19#include "lor_nd.hpp"
21
22namespace mfem
23{
24
25// Helper class for assembling the discrete gradient and coordinate vectors
26// needed by the AMS solver. Generally, this class should *not* be directly used
27// by users, instead use LORSolver<HypreAMS> (which internally uses this class).
29{
30protected:
31 ParFiniteElementSpace &edge_fes; ///< The Nedelec space.
32 const int dim; ///< Spatial dimension.
33 const int order; ///< Polynomial degree.
34 H1_FECollection vert_fec; ///< The corresponding H1 collection.
35 ParFiniteElementSpace vert_fes; ///< The corresponding H1 space.
36 Vector *xyz_tvec; ///< Mesh vertex coordinates in true-vector format.
37 HypreParMatrix *G; ///< Discrete gradient matrix.
38
39 /// @name Mesh coordinate vectors in HypreParVector format
40 ///@{
42 ///@}
43
44 /// @name Construct the local (elementwise) discrete gradient
45 ///@{
46 void Form2DEdgeToVertex(Array<int> &edge2vert);
47 void Form2DEdgeToVertex_ND(Array<int> &edge2vert);
48 void Form2DEdgeToVertex_RT(Array<int> &edge2vert);
49 void Form3DEdgeToVertex(Array<int> &edge2vert);
50 ///@}
51public:
52 /// @brief Construct the BatchedLOR_AMS object associated with the Nedelec
53 /// space (or RT in 2D) @a pfes_ho_.
54 ///
55 /// The vector @a X_vert represents the LOR mesh coordinates in E-vector
56 /// format, see BatchedLORAssembly::GetLORVertexCoordinates.
58 const Vector &X_vert);
59
60 /// @name These functions steal the discrete gradient and coordinate vectors.
61 ///@{
62 /// The caller assumes ownership and @b must delete the returned objects.
63 /// Subsequent calls will return nullptr.
64
70
71 ///@}
72
73 /// @name These functions return the discrete gradient and coordinate vectors.
74 ///@{
75 /// The caller does not assume ownership, and must not delete the returned
76 /// objects.
77
78 HypreParMatrix *GetGradientMatrix() const { return G; };
79 HypreParVector *GetXCoordinate() const { return x; };
80 HypreParVector *GetYCoordinate() const { return y; };
81 HypreParVector *GetZCoordinate() const { return z; };
82
83 ///@}
84
85 // The following should be protected, but contain mfem::forall kernels
86
87 /// Construct the mesh coordinate vectors (not part of the public API).
88 void FormCoordinateVectors(const Vector &X_vert);
89
90 /// Construct the discrete gradient matrix (not part of the public API).
91 void FormGradientMatrix();
93};
94
95template <typename T> T *StealPointer(T *&ptr)
96{
97 T *tmp = ptr;
98 ptr = nullptr;
99 return tmp;
100}
101
102}
103
104#endif
105
106#endif
HypreParVector * StealZCoordinate()
Definition lor_ams.cpp:343
HypreParVector * StealYCoordinate()
Definition lor_ams.cpp:338
HypreParMatrix * StealGradientMatrix()
Definition lor_ams.cpp:323
HypreParVector * GetZCoordinate() const
Definition lor_ams.hpp:81
const int order
Polynomial degree.
Definition lor_ams.hpp:33
Vector * StealCoordinateVector()
Definition lor_ams.cpp:328
void FormGradientMatrix()
Construct the discrete gradient matrix (not part of the public API).
Definition lor_ams.cpp:139
HypreParVector * StealXCoordinate()
Definition lor_ams.cpp:333
HypreParVector * x
Definition lor_ams.hpp:41
HypreParVector * GetXCoordinate() const
Definition lor_ams.hpp:79
H1_FECollection vert_fec
The corresponding H1 collection.
Definition lor_ams.hpp:34
HypreParMatrix * G
Discrete gradient matrix.
Definition lor_ams.hpp:37
void Form2DEdgeToVertex_RT(Array< int > &edge2vert)
Definition lor_ams.cpp:72
HypreParVector * GetYCoordinate() const
Definition lor_ams.hpp:80
ParFiniteElementSpace & edge_fes
The Nedelec space.
Definition lor_ams.hpp:31
const int dim
Spatial dimension.
Definition lor_ams.hpp:32
BatchedLOR_AMS(ParFiniteElementSpace &pfes_ho_, const Vector &X_vert)
Construct the BatchedLOR_AMS object associated with the Nedelec space (or RT in 2D) pfes_ho_.
Definition lor_ams.cpp:357
Vector * xyz_tvec
Mesh vertex coordinates in true-vector format.
Definition lor_ams.hpp:36
ParFiniteElementSpace vert_fes
The corresponding H1 space.
Definition lor_ams.hpp:35
void FormCoordinateVectors(const Vector &X_vert)
Construct the mesh coordinate vectors (not part of the public API).
Definition lor_ams.cpp:254
HypreParVector * z
Definition lor_ams.hpp:41
void Form2DEdgeToVertex(Array< int > &edge2vert)
Definition lor_ams.cpp:21
HypreParMatrix * GetGradientMatrix() const
Definition lor_ams.hpp:78
void Form3DEdgeToVertex(Array< int > &edge2vert)
Definition lor_ams.cpp:105
void Form2DEdgeToVertex_ND(Array< int > &edge2vert)
Definition lor_ams.cpp:38
HypreParVector * y
Definition lor_ams.hpp:41
Arbitrary order H1-conforming (continuous) finite elements.
Definition fe_coll.hpp:260
Wrapper for hypre's ParCSR matrix class.
Definition hypre.hpp:388
Wrapper for hypre's parallel vector class.
Definition hypre.hpp:206
Abstract parallel finite element space.
Definition pfespace.hpp:29
Vector data type.
Definition vector.hpp:80
T * StealPointer(T *&ptr)
Definition lor_ams.hpp:95