LCOV - code coverage report
Current view: top level - src/fvics - FVInitialConditionWarehouse.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 16 25 64.0 %
Date: 2025-07-17 01:28:37 Functions: 2 3 66.7 %
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 "FVInitialConditionWarehouse.h"
      11             : 
      12             : // MOOSE includes
      13             : #include "FVInitialConditionBase.h"
      14             : #include "MooseVariableFE.h"
      15             : 
      16       57974 : FVInitialConditionWarehouse::FVInitialConditionWarehouse()
      17       57974 :   : MooseObjectWarehouseBase<FVInitialConditionBase>(), _block_ics(libMesh::n_threads())
      18             : {
      19       57974 : }
      20             : 
      21             : void
      22           0 : FVInitialConditionWarehouse::initialSetup(THREAD_ID tid)
      23             : {
      24           0 :   MooseObjectWarehouseBase<FVInitialConditionBase>::sort(tid);
      25           0 :   for (const auto & ic : _active_objects[tid])
      26           0 :     ic->initialSetup();
      27           0 : }
      28             : 
      29             : void
      30        2595 : FVInitialConditionWarehouse::addObject(std::shared_ptr<FVInitialConditionBase> object,
      31             :                                        THREAD_ID tid,
      32             :                                        bool recurse)
      33             : {
      34             :   // Check that when object is boundary restricted that the variable is nodal
      35        2595 :   const auto & var = object->variable();
      36             : 
      37             :   // Block Restricted
      38        2595 :   if (object->blockRestricted())
      39             :   {
      40         567 :     auto iter = _block_ics[tid].find(var.name());
      41         580 :     if (iter != _block_ics[tid].end() &&
      42          26 :         (object->hasBlocks(iter->second) ||
      43         580 :          (iter->second.find(Moose::ANY_BLOCK_ID) != iter->second.end())))
      44           0 :       mooseError("The initial condition '",
      45           0 :                  object->name(),
      46             :                  "' is being defined on a block that already has an initial condition defined.");
      47             :     else
      48         567 :       _block_ics[tid][var.name()].insert(object->blockIDs().begin(), object->blockIDs().end());
      49             :   }
      50             :   // Non-restricted
      51             :   else
      52             :   {
      53        2028 :     auto iter = _block_ics[tid].find(var.name());
      54        2028 :     if (iter != _block_ics[tid].end())
      55           0 :       mooseError("The initial condition '",
      56           0 :                  object->name(),
      57             :                  "' is being defined on a block that already has an initial condition defined.");
      58             :     else
      59        2028 :       _block_ics[tid][var.name()].insert(Moose::ANY_BLOCK_ID);
      60             :   }
      61             : 
      62             :   // Add the IC to the storage
      63        2595 :   MooseObjectWarehouseBase<FVInitialConditionBase>::addObject(object, tid, recurse);
      64        2595 : }

Generated by: LCOV version 1.14