MFEM  v4.1.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
restriction.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2020, 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_RESTRICTION
13 #define MFEM_RESTRICTION
14 
15 #include "../linalg/operator.hpp"
16 #include "../mesh/mesh.hpp"
17 
18 namespace mfem
19 {
20 
21 class FiniteElementSpace;
22 enum class ElementDofOrdering;
23 
24 /** An enum type to specify if only e1 value is requested (SingleValued) or both
25  e1 and e2 (DoubleValued). */
26 enum class L2FaceValues : bool {SingleValued, DoubleValued};
27 
28 /// Operator that converts FiniteElementSpace L-vectors to E-vectors.
29 /** Objects of this type are typically created and owned by FiniteElementSpace
30  objects, see FiniteElementSpace::GetElementRestriction(). */
32 {
33 protected:
35  const int ne;
36  const int vdim;
37  const bool byvdim;
38  const int ndofs;
39  const int dof;
40  const int nedofs;
44 
45 public:
47  void Mult(const Vector &x, Vector &y) const;
48  void MultTranspose(const Vector &x, Vector &y) const;
49 
50  /// Compute MultTranspose without applying signs based on DOF orientations.
51  void MultTransposeUnsigned(const Vector &x, Vector &y) const;
52 };
53 
54 /// Operator that converts L2 FiniteElementSpace L-vectors to E-vectors.
55 /** Objects of this type are typically created and owned by FiniteElementSpace
56  objects, see FiniteElementSpace::GetElementRestriction(). L-vectors
57  corresponding to grid functions in L2 finite element spaces differ from
58  E-vectors only in the ordering of the degrees of freedom. */
60 {
61  const int ne;
62  const int vdim;
63  const bool byvdim;
64  const int ndof;
65  const int ndofs;
66 public:
68  void Mult(const Vector &x, Vector &y) const;
69  void MultTranspose(const Vector &x, Vector &y) const;
70 };
71 
72 /// Operator that extracts Face degrees of freedom.
73 /** Objects of this type are typically created and owned by FiniteElementSpace
74  objects, see FiniteElementSpace::GetFaceRestriction(). */
76 {
77 protected:
79  const int nf;
80  const int vdim;
81  const bool byvdim;
82  const int ndofs;
83  const int dof;
84  const int nfdofs;
88 
89 public:
91  const FaceType);
92  void Mult(const Vector &x, Vector &y) const;
93  void MultTranspose(const Vector &x, Vector &y) const;
94 };
95 
96 /// Operator that extracts Face degrees of freedom.
97 /** Objects of this type are typically created and owned by FiniteElementSpace
98  objects, see FiniteElementSpace::GetFaceRestriction(). */
100 {
101 protected:
103  const int nf;
104  const int vdim;
105  const bool byvdim;
106  const int ndofs;
107  const int dof;
109  const int nfdofs;
114 
115 public:
117  const FaceType,
119  void Mult(const Vector &x, Vector &y) const;
120  void MultTranspose(const Vector &x, Vector &y) const;
121 };
122 
123 // Return the face degrees of freedom returned in Lexicographic order.
124 void GetFaceDofs(const int dim, const int face_id,
125  const int dof1d, Array<int> &faceMap);
126 
127 // Convert from Native ordering to lexicographic ordering
128 int ToLexOrdering(const int dim, const int face_id, const int size1d,
129  const int index);
130 
131 // Permute dofs or quads on a face for e2 to match with the ordering of e1
132 int PermuteFaceL2(const int dim, const int face_id1,
133  const int face_id2, const int orientation,
134  const int size1d, const int index);
135 
136 
137 }
138 
139 #endif //MFEM_RESTRICTION
void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
L2FaceValues
Definition: restriction.hpp:26
void MultTransposeUnsigned(const Vector &x, Vector &y) const
Compute MultTranspose without applying signs based on DOF orientations.
Operator that extracts Face degrees of freedom.
Definition: restriction.hpp:75
L2FaceRestriction(const FiniteElementSpace &, const ElementDofOrdering, const FaceType, const L2FaceValues m=L2FaceValues::DoubleValued)
Array< int > gather_indices
Definition: restriction.hpp:87
void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
H1FaceRestriction(const FiniteElementSpace &, const ElementDofOrdering, const FaceType)
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 ...
const L2FaceValues m
Array< int > gather_indices
L2ElementRestriction(const FiniteElementSpace &)
Definition: restriction.cpp:20
FaceType
Definition: mesh.hpp:42
const FiniteElementSpace & fes
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 ...
Definition: restriction.cpp:50
Operator that extracts Face degrees of freedom.
Definition: restriction.hpp:99
const FiniteElementSpace & fes
Definition: restriction.hpp:78
ElementRestriction(const FiniteElementSpace &, ElementDofOrdering)
Definition: restriction.cpp:69
int ToLexOrdering(const int dim, const int face_id, const int size1d, const int index)
const FiniteElementSpace & fes
Definition: restriction.hpp:34
void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
Definition: restriction.cpp:31
Operator that converts FiniteElementSpace L-vectors to E-vectors.
Definition: restriction.hpp:31
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:87
void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
void GetFaceDofs(const int dim, const int face_id, const int dof1d, Array< int > &faceMap)
Return the face degrees of freedom returned in Lexicographic order.
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 ...
Array< int > scatter_indices1
ElementDofOrdering
Constants describing the possible orderings of the DOFs in one element.
Definition: fespace.hpp:65
int dim
Definition: ex24.cpp:43
int index(int i, int j, int nx, int ny)
Definition: life.cpp:241
Vector data type.
Definition: vector.hpp:48
int PermuteFaceL2(const int dim, const int face_id1, const int face_id2, const int orientation, const int size1d, const int index)
Permute dofs or quads on a face for e2 to match with the ordering of e1.
Abstract operator.
Definition: operator.hpp:24
Operator that converts L2 FiniteElementSpace L-vectors to E-vectors.
Definition: restriction.hpp:59
Array< int > scatter_indices
Definition: restriction.hpp:85
Array< int > scatter_indices2
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 ...