MFEM  v4.5.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
mortarintegrator.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, 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 MFEML2_MORTAR_INTEGRATOR_HPP
13 #define MFEML2_MORTAR_INTEGRATOR_HPP
14 
15 #include "../fem.hpp"
16 
17 namespace mfem
18 {
19 
20 /*!
21  * @brief Interface for mortar element assembly.
22  * The MortarIntegrator interface is used for performing Petrov-Galerkin
23  * finite element assembly on intersections between elements.
24  * The quadrature rules are to be generated by a cut algorithm (e.g.,
25  * mfem::Cut). The quadrature rules are defined in the respective trial and test
26  * reference frames. Trial and test spaces can be associated with different
27  * element shapes (e.g., triangles and quadrilaterals) and different polynomial
28  * orders (e.g., 1 and 4). This class is designed to work in conjunction with
29  * the MFEM/moonolith module but it can be used also for other applications.
30  */
32 {
33 public:
34  /*!
35  * @brief Implements the assembly routine
36  * @param trial is the master/source element
37  * @param trial_ir is the quadrature formula for evaluating quantities within
38  * the trial element
39  * @param trial_Trans the geometric transformation of the trial element
40  * @param test is the slave/destination element
41  * @param test_ir is the quadrature formula for evaluating quantities within
42  * the test element
43  * @param test_Trans the geometric transformation of the test element
44  * @param elemmat the result of the assembly
45  */
46  virtual void AssembleElementMatrix(const FiniteElement &trial,
47  const IntegrationRule &trial_ir,
48  ElementTransformation &trial_Trans,
49  const FiniteElement &test,
50  const IntegrationRule &test_ir,
51  ElementTransformation &test_Trans,
52  DenseMatrix &elemmat) = 0;
53 
54  /*!
55  * @return the additional orders of quadrature required by the integrator.
56  * It is 0 by default, override method to change that.
57  */
58  virtual int GetQuadratureOrder() const { return 0; }
59 
60  virtual ~MortarIntegrator() {}
61 
62  /*!
63  * @return true if it uses vector fe and false otherwise
64  */
65  virtual bool is_vector_fe() const = 0;
66 };
67 
68 /*!
69  * @brief Integrator for scalar finite elements
70  * \f$ (u, v)_{L^2(\mathcal{T}_m \cap \mathcal{T}_s)}, u \in U(\mathcal{T}_m )
71  * and v \in V(\mathcal{T}_s ) \f$
72  */
74 {
75 public:
76  void AssembleElementMatrix(const FiniteElement &trial,
77  const IntegrationRule &trial_ir,
78  ElementTransformation &trial_Trans,
79  const FiniteElement &test,
80  const IntegrationRule &test_ir,
81  ElementTransformation &test_Trans,
82  DenseMatrix &elemmat) override;
83 
84  inline bool is_vector_fe() const override { return false; }
85 };
86 
87 /*!
88  * @brief Integrator for vector finite elements. Experimental.
89  * \f$ (u, v)_{L^2(\mathcal{T}_m \cap \mathcal{T}_s)}, u \in U(\mathcal{T}_m )
90  * and v \in V(\mathcal{T}_s ) \f$
91  */
93 {
94 public:
95 #ifndef MFEM_THREAD_SAFE
101 #endif
102 
103 public:
104  VectorL2MortarIntegrator() { Init(NULL, NULL, NULL); }
105  VectorL2MortarIntegrator(Coefficient *_q) { Init(_q, NULL, NULL); }
106  VectorL2MortarIntegrator(VectorCoefficient *_vq) { Init(NULL, _vq, NULL); }
107  VectorL2MortarIntegrator(MatrixCoefficient *_mq) { Init(NULL, NULL, _mq); }
108 
109  void AssembleElementMatrix(const FiniteElement &trial,
110  const IntegrationRule &trial_ir,
111  ElementTransformation &trial_Trans,
112  const FiniteElement &test,
113  const IntegrationRule &test_ir,
114  ElementTransformation &test_Trans,
115  DenseMatrix &elemmat) override;
116 
117  inline bool is_vector_fe() const override { return true; }
118 
119 private:
120  Coefficient *Q;
121  VectorCoefficient *VQ;
122  MatrixCoefficient *MQ;
123 
125  {
126  Q = q;
127  VQ = vq;
128  MQ = mq;
129  }
130 };
131 
132 } // namespace mfem
133 
134 #endif // MFEML2_MORTAR_INTEGRATOR_HPP
Abstract class for all finite elements.
Definition: fe_base.hpp:235
bool is_vector_fe() const override
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:90
virtual int GetQuadratureOrder() const
VectorL2MortarIntegrator(VectorCoefficient *_vq)
Base class for vector Coefficients that optionally depend on time and space.
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
void AssembleElementMatrix(const FiniteElement &trial, const IntegrationRule &trial_ir, ElementTransformation &trial_Trans, const FiniteElement &test, const IntegrationRule &test_ir, ElementTransformation &test_Trans, DenseMatrix &elemmat) override
Implements the assembly routine.
Integrator for vector finite elements. Experimental. .
Integrator for scalar finite elements .
bool is_vector_fe() const override
Base class Coefficients that optionally depend on space and time. These are used by the BilinearFormI...
Definition: coefficient.hpp:41
Base class for Matrix Coefficients that optionally depend on time and space.
virtual void AssembleElementMatrix(const FiniteElement &trial, const IntegrationRule &trial_ir, ElementTransformation &trial_Trans, const FiniteElement &test, const IntegrationRule &test_ir, ElementTransformation &test_Trans, DenseMatrix &elemmat)=0
Implements the assembly routine.
A class to initialize the size of a Tensor.
Definition: dtensor.hpp:54
VectorL2MortarIntegrator(MatrixCoefficient *_mq)
Vector data type.
Definition: vector.hpp:60
Interface for mortar element assembly. The MortarIntegrator interface is used for performing Petrov-G...
virtual bool is_vector_fe() const =0
void AssembleElementMatrix(const FiniteElement &trial, const IntegrationRule &trial_ir, ElementTransformation &trial_Trans, const FiniteElement &test, const IntegrationRule &test_ir, ElementTransformation &test_Trans, DenseMatrix &elemmat) override
Implements the assembly routine.