https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMWeakForm.C
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#include "MFEMWeakForm.h"
13#include "MFEMIntegratedBC.h"
14#include "MFEMEssentialBC.h"
15
17
20{
22 params.addClassDescription("Builds a real-valued MFEM EquationSystem from the kernels and "
23 "boundary conditions named by this weak form.");
24 return params;
25}
26
28
29void
30MFEMWeakForm::addBoundaryCondition(const std::string & name,
31 std::shared_ptr<MFEMBoundaryCondition> bc)
32{
33 if (auto integrated_bc = std::dynamic_pointer_cast<MFEMIntegratedBC>(bc))
34 _equation_system->AddIntegratedBC(std::move(integrated_bc));
35 else if (auto essential_bc = std::dynamic_pointer_cast<MFEMEssentialBC>(bc))
36 _equation_system->AddEssentialBC(std::move(essential_bc));
37 else
38 mooseError("Unsupported bc of name '", name, "' detected.");
39}
40
41void
42MFEMWeakForm::addKernel(const std::string & /*name*/, std::shared_ptr<MFEMKernel> kernel)
43{
44 _equation_system->AddKernel(std::move(kernel));
45}
46
47std::shared_ptr<Moose::MFEM::EquationSystem>
49{
50 return std::make_shared<Moose::MFEM::EquationSystem>();
51}
52
53#endif
registerMooseObject("MooseApp", MFEMWeakForm)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
Base class for MOOSE objects that construct objects derived from Moose::MFEM::EquationSystem.
std::shared_ptr< Moose::MFEM::EquationSystem > _equation_system
Stores the constructed EquationSystem.
static InputParameters validParams()
Constructs and stores a Moose::MFEM::EquationSystem object.
virtual void addKernel(const std::string &name, std::shared_ptr< MFEMKernel > kernel) override
static InputParameters validParams()
virtual std::shared_ptr< Moose::MFEM::EquationSystem > makeEquationSystem() override
Constructs the empty EquationSystem of the type this weak form builds.
MFEMWeakForm(const InputParameters &parameters)
virtual void addBoundaryCondition(const std::string &name, std::shared_ptr< MFEMBoundaryCondition > bc) override
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103