https://mooseframework.inl.gov
MFEMIndicator.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #ifdef MOOSE_MFEM_ENABLED
11 
12 #pragma once
13 
14 #include "MFEMObject.h"
15 #include "MFEMContainers.h"
16 #include "MFEMVariable.h"
17 
18 /*
19  * Wrapper class for mfem::ErrorEstimator objects. To keep the
20  * naming consistent with MOOSE, we refer to it as an Indicator.
21  */
22 class MFEMIndicator : public MFEMObject
23 {
24 public:
26 
27  MFEMIndicator(const InputParameters & params);
28 
29  virtual ~MFEMIndicator() = default;
30 
32  virtual void createEstimator() = 0;
33 
35  mfem::ParFiniteElementSpace & getFESpace() const { return _fespace; }
36 
38  mfem::ParMesh & getParMesh() const { return *(_fespace.GetParMesh()); }
39 
41  std::shared_ptr<mfem::ErrorEstimator> getEstimator() const;
42 
43 protected:
45  const VariableName & _var_name;
46 
48  const std::string & _kernel_name;
49 
51  std::shared_ptr<mfem::ErrorEstimator> _error_estimator;
52 
53  // FE space that the variable lives in
54  mfem::ParFiniteElementSpace & _fespace;
55 };
56 
57 inline std::shared_ptr<mfem::ErrorEstimator>
59 {
60  mooseAssert(_error_estimator,
61  "Attempting to retrieve error estimator before it's been constructed");
62  return _error_estimator;
63 }
64 
65 #endif
Thin base for MFEM objects backed directly by MooseObject instead of UserObject.
Definition: MFEMObject.h:25
std::shared_ptr< mfem::ErrorEstimator > getEstimator() const
Method to fetch the error estimator after creation.
Definition: MFEMIndicator.h:58
const VariableName & _var_name
Name of the variable associated with the weak form that the kernel is applied to. ...
Definition: MFEMIndicator.h:45
static InputParameters validParams()
Definition: MFEMIndicator.C:16
mfem::ParMesh & getParMesh() const
Get reference to the FE space&#39;s underlying mesh.
Definition: MFEMIndicator.h:38
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MFEMIndicator(const InputParameters &params)
Definition: MFEMIndicator.C:27
mfem::ParFiniteElementSpace & getFESpace() const
Get reference to FE space using the name we store when setting up this class.
Definition: MFEMIndicator.h:35
mfem::ParFiniteElementSpace & _fespace
Definition: MFEMIndicator.h:54
virtual ~MFEMIndicator()=default
const std::string & _kernel_name
Name of the kernel providing the error estimate.
Definition: MFEMIndicator.h:48
std::shared_ptr< mfem::ErrorEstimator > _error_estimator
Shared pointer to the MFEM estimator wrapped by this class.
Definition: MFEMIndicator.h:51
virtual void createEstimator()=0
Create the estimator internally.