MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
fespacehierarchy.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_FESPACEHIERARCHY
13#define MFEM_FESPACEHIERARCHY
14
15#include "fespace.hpp"
16
17#ifdef MFEM_USE_MPI
18#include "pfespace.hpp"
19#endif
20
21namespace mfem
22{
23
24/// Class bundling a hierarchy finite element spaces together with the
25/// corresponding prolongation operators
27{
28protected:
35
36public:
37
38 /// Construct an empty finite element space hierarchy. This is useful if the
39 /// hierarchy is constructed by coarsening a fine space, rather than refining
40 /// a coarse space.
42
43 /// @brief Constructs a space hierarchy with the given mesh and space on the
44 /// coarsest level.
45 /** The ownership of the mesh and space may be transferred to the
46 FiniteElementSpaceHierarchy by setting the according boolean variables. */
47 FiniteElementSpaceHierarchy(Mesh* mesh, FiniteElementSpace* fespace, bool ownM,
48 bool ownFES);
49
50 /// Destructor deleting all meshes and spaces that are owned
52
53 /// Returns the number of levels in the hierarchy
54 int GetNumLevels() const;
55
56 /// Returns the index of the finest level
57 int GetFinestLevelIndex() const;
58
59 /// Adds one level to the hierarchy
60 void AddLevel(Mesh* mesh, FiniteElementSpace* fespace, Operator* prolongation,
61 bool ownM, bool ownFES, bool ownP);
62
63 /// @brief Adds one level to the hierarchy by uniformly refining the mesh on the
64 /// previous level
65 virtual void AddUniformlyRefinedLevel(int dim = 1,
66 int ordering = Ordering::byVDIM);
67
68 /// @brief Adds one level to the hierarchy by using a different finite element
69 /// order defined through FiniteElementCollection
70 virtual void AddOrderRefinedLevel(FiniteElementCollection* fec, int dim = 1,
71 int ordering = Ordering::byVDIM);
72
73 /// Returns the finite element space at the given level
74 virtual const FiniteElementSpace& GetFESpaceAtLevel(int level) const;
75
76 /// Returns the finite element space at the given level
77 virtual FiniteElementSpace& GetFESpaceAtLevel(int level);
78
79 /// Returns the finite element space at the finest level
80 virtual const FiniteElementSpace& GetFinestFESpace() const;
81
82 /// Returns the finite element space at the finest level
84
85 /// @brief Returns the prolongation operator from the finite element space at
86 /// level to the finite element space at level + 1
87 Operator* GetProlongationAtLevel(int level) const;
88};
89
90#ifdef MFEM_USE_MPI
92{
93public:
95 /// @brief Constructs a parallel space hierarchy with the given mesh and spaces
96 /// on level zero.
97 /** The ownership of the mesh and space may be transferred to the
98 ParFiniteElementSpaceHierarchy by setting the according boolean variables. */
100 bool ownM,
101 bool ownFES);
102
103 /// @brief Adds one level to the hierarchy by uniformly refining the mesh on the
104 /// previous level
105 void AddUniformlyRefinedLevel(int dim = 1,
106 int ordering = Ordering::byVDIM) override;
107
108 /// @brief Adds one level to the hierarchy by using a different finite element
109 /// order defined through FiniteElementCollection
111 int ordering = Ordering::byVDIM) override;
112
113 /// Returns the finite element space at the given level
114 const ParFiniteElementSpace& GetFESpaceAtLevel(int level) const override;
115
116 /// Returns the finite element space at the given level
117 ParFiniteElementSpace& GetFESpaceAtLevel(int level) override;
118
119 /// Returns the finite element space at the finest level
120 const ParFiniteElementSpace& GetFinestFESpace() const override;
121
122 /// Returns the finite element space at the finest level
124};
125#endif
126
127} // namespace mfem
128
129#endif
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Definition fe_coll.hpp:27
int GetNumLevels() const
Returns the number of levels in the hierarchy.
virtual const FiniteElementSpace & GetFinestFESpace() const
Returns the finite element space at the finest level.
int GetFinestLevelIndex() const
Returns the index of the finest level.
Operator * GetProlongationAtLevel(int level) const
Returns the prolongation operator from the finite element space at level to the finite element space ...
void AddLevel(Mesh *mesh, FiniteElementSpace *fespace, Operator *prolongation, bool ownM, bool ownFES, bool ownP)
Adds one level to the hierarchy.
virtual void AddUniformlyRefinedLevel(int dim=1, int ordering=Ordering::byVDIM)
Adds one level to the hierarchy by uniformly refining the mesh on the previous level.
virtual ~FiniteElementSpaceHierarchy()
Destructor deleting all meshes and spaces that are owned.
virtual const FiniteElementSpace & GetFESpaceAtLevel(int level) const
Returns the finite element space at the given level.
virtual void AddOrderRefinedLevel(FiniteElementCollection *fec, int dim=1, int ordering=Ordering::byVDIM)
Adds one level to the hierarchy by using a different finite element order defined through FiniteEleme...
Array< FiniteElementSpace * > fespaces
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:220
Mesh data type.
Definition mesh.hpp:56
Abstract operator.
Definition operator.hpp:25
void AddUniformlyRefinedLevel(int dim=1, int ordering=Ordering::byVDIM) override
Adds one level to the hierarchy by uniformly refining the mesh on the previous level.
void AddOrderRefinedLevel(FiniteElementCollection *fec, int dim=1, int ordering=Ordering::byVDIM) override
Adds one level to the hierarchy by using a different finite element order defined through FiniteEleme...
const ParFiniteElementSpace & GetFinestFESpace() const override
Returns the finite element space at the finest level.
const ParFiniteElementSpace & GetFESpaceAtLevel(int level) const override
Returns the finite element space at the given level.
Abstract parallel finite element space.
Definition pfespace.hpp:29
Class for parallel meshes.
Definition pmesh.hpp:34
int dim
Definition ex24.cpp:53