LCOV - code coverage report
Current view: top level - src/actions - SetupQuadratureAction.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 32 34 94.1 %
Date: 2025-07-17 01:28:37 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include "SetupQuadratureAction.h"
      11             : #include "Conversion.h"
      12             : #include "FEProblem.h"
      13             : #include "MooseEnum.h"
      14             : 
      15             : registerMooseAction("MooseApp", SetupQuadratureAction, "setup_quadrature");
      16             : 
      17             : InputParameters
      18       62141 : SetupQuadratureAction::validParams()
      19             : {
      20       62141 :   InputParameters params = Action::validParams();
      21       62141 :   params.addClassDescription("Sets the quadrature type for the simulation.");
      22       62141 :   params.addParam<MooseEnum>("type", getQuadratureTypesEnum(), "Type of the quadrature rule");
      23       62141 :   params.addParam<MooseEnum>("order", getQuadratureOrderEnum(), "Order of the quadrature");
      24      186423 :   params.addParam<MooseEnum>(
      25      124282 :       "element_order", getQuadratureOrderEnum(), "Order of the quadrature for elements");
      26      186423 :   params.addParam<MooseEnum>(
      27      124282 :       "side_order", getQuadratureOrderEnum(), "Order of the quadrature for sides");
      28      186423 :   params.addParam<std::vector<SubdomainID>>("custom_blocks",
      29      124282 :                                             std::vector<SubdomainID>{},
      30             :                                             "list of blocks to specify custom quadrature order");
      31      186423 :   params.addParam<MultiMooseEnum>(
      32             :       "custom_orders",
      33      124282 :       getQuadratureOrdersMultiEnum(),
      34             :       "list of quadrature orders for the blocks specified in `custom_blocks`");
      35      186423 :   params.addParam<bool>(
      36      124282 :       "allow_negative_qweights", true, "Whether or not allow negative quadrature weights");
      37             : 
      38       62141 :   return params;
      39           0 : }
      40             : 
      41       61938 : SetupQuadratureAction::SetupQuadratureAction(const InputParameters & parameters)
      42             :   : Action(parameters),
      43       61938 :     _type(Moose::stringToEnum<libMesh::QuadratureType>(getParam<MooseEnum>("type"))),
      44       61938 :     _order(Moose::stringToEnum<Order>(getParam<MooseEnum>("order"))),
      45       61938 :     _element_order(Moose::stringToEnum<Order>(getParam<MooseEnum>("element_order"))),
      46       61938 :     _side_order(Moose::stringToEnum<Order>(getParam<MooseEnum>("side_order"))),
      47       61938 :     _custom_block_orders(getParam<SubdomainID, MooseEnumItem>("custom_blocks", "custom_orders")),
      48      123872 :     _allow_negative_qweights(getParam<bool>("allow_negative_qweights"))
      49             : {
      50       61934 : }
      51             : 
      52             : void
      53       57565 : SetupQuadratureAction::act()
      54             : {
      55       57565 :   if (_problem.get() == nullptr)
      56           0 :     return;
      57             : 
      58             :   // add default/global quadrature rules
      59       57565 :   _problem->createQRules(
      60       57565 :       _type, _order, _element_order, _side_order, Moose::ANY_BLOCK_ID, _allow_negative_qweights);
      61             : 
      62             :   // add custom block-specific quadrature rules
      63       57589 :   for (const auto & [block, order] : _custom_block_orders)
      64          48 :     _problem->createQRules(_type,
      65             :                            _order,
      66             :                            Moose::stringToEnum<Order>(order),
      67             :                            Moose::stringToEnum<Order>(order),
      68          24 :                            block,
      69          24 :                            _allow_negative_qweights);
      70             : }

Generated by: LCOV version 1.14