LCOV - code coverage report
Current view: top level - src/actions - NonReflectingBCAction.C (source / functions) Hit Total Coverage
Test: idaholab/mastodon: 55510a Lines: 20 21 95.2 %
Date: 2025-08-26 23:09:31 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*************************************************/
       2             : /*           DO NOT MODIFY THIS HEADER           */
       3             : /*                                               */
       4             : /*                     MASTODON                  */
       5             : /*                                               */
       6             : /*    (c) 2015 Battelle Energy Alliance, LLC     */
       7             : /*            ALL RIGHTS RESERVED                */
       8             : /*                                               */
       9             : /*   Prepared by Battelle Energy Alliance, LLC   */
      10             : /*     With the U. S. Department of Energy       */
      11             : /*                                               */
      12             : /*     See COPYRIGHT for full restrictions       */
      13             : /*************************************************/
      14             : 
      15             : // Mastodon includes
      16             : #include "NonReflectingBC.h"
      17             : #include "NonReflectingBCAction.h"
      18             : 
      19             : registerMooseAction("MastodonApp", NonReflectingBCAction, "add_bc");
      20             : 
      21             : InputParameters
      22           2 : NonReflectingBCAction::validParams()
      23             : {
      24           2 :   InputParameters params = Action::validParams();
      25           2 :   params.addClassDescription("Set up Non-reflecting boundary conditions in different directions.");
      26           2 :   params += NonReflectingBC::commonParameters();
      27           4 :   params.addRequiredParam<std::vector<BoundaryName>>(
      28             :       "boundary",
      29             :       "The list of boundary IDs from the mesh where this boundary "
      30             :       "condition will be applied");
      31           2 :   return params;
      32           0 : }
      33             : 
      34           2 : NonReflectingBCAction::NonReflectingBCAction(const InputParameters & params) : Action(params) {}
      35             : 
      36             : void
      37           2 : NonReflectingBCAction::act()
      38             : {
      39             :   // Apply parameters from the action level to the parameters of a
      40             :   // NonReflectingBC object
      41           4 :   InputParameters params = _factory.getValidParams("NonReflectingBC");
      42           2 :   params.applyParameters(parameters());
      43             : 
      44             :   // Define the name prefix for the objects to be created
      45           2 :   std::string prefix = "mastodon_non_reflecting_BC";
      46             : 
      47             :   // Loop over displacements and add NonReflectingBC object for each variable
      48           2 :   const std::vector<BoundaryName> & boundary = getParam<std::vector<BoundaryName>>("boundary");
      49             :   const std::vector<VariableName> & displacements =
      50           2 :       getParam<std::vector<VariableName>>("displacements");
      51           8 :   for (unsigned int i = 0; i < displacements.size(); ++i)
      52             :   {
      53           6 :     std::stringstream name;
      54             :     name << prefix << i << boundary[0];
      55             : 
      56           6 :     params.set<unsigned int>("component") = i;
      57          12 :     params.set<NonlinearVariableName>("variable") = displacements[i];
      58             : 
      59          12 :     _problem->addBoundaryCondition("NonReflectingBC", name.str(), params);
      60           6 :   }
      61           2 : }

Generated by: LCOV version 1.14