https://mooseframework.inl.gov
FVInitialConditionWarehouse.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 
11 
12 // MOOSE includes
13 #include "FVInitialConditionBase.h"
14 #include "MooseVariableFE.h"
15 
18 {
19 }
20 
21 void
23 {
25  for (const auto & ic : _active_objects[tid])
26  ic->initialSetup();
27 }
28 
29 void
30 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  const auto & var = object->variable();
36 
37  // Block Restricted
38  if (object->blockRestricted())
39  {
40  auto iter = _block_ics[tid].find(var.name());
41  if (iter != _block_ics[tid].end() &&
42  (object->hasBlocks(iter->second) ||
43  (iter->second.find(Moose::ANY_BLOCK_ID) != iter->second.end())))
44  mooseError("The initial condition '",
45  object->name(),
46  "' is being defined on a block that already has an initial condition defined.");
47  else
48  _block_ics[tid][var.name()].insert(object->blockIDs().begin(), object->blockIDs().end());
49  }
50  // Non-restricted
51  else
52  {
53  auto iter = _block_ics[tid].find(var.name());
54  if (iter != _block_ics[tid].end())
55  mooseError("The initial condition '",
56  object->name(),
57  "' is being defined on a block that already has an initial condition defined.");
58  else
59  _block_ics[tid][var.name()].insert(Moose::ANY_BLOCK_ID);
60  }
61 
62  // Add the IC to the storage
64 }
void sort(THREAD_ID tid=0)
Sort the objects using the DependencyResolver.
unsigned int n_threads()
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
void initialSetup(THREAD_ID tid)
Initial setup.
std::vector< std::map< std::string, std::set< SubdomainID > > > _block_ics
const SubdomainID ANY_BLOCK_ID
Definition: MooseTypes.C:19
virtual void addObject(std::shared_ptr< T > object, THREAD_ID tid=0, bool recurse=true)
Adds an object to the storage structure.
std::vector< std::vector< std::shared_ptr< FVInitialConditionBase > > > _active_objects
All active objects (THREAD_ID on outer vector)
void addObject(std::shared_ptr< FVInitialConditionBase > object, THREAD_ID tid, bool recurse=true)
Add object to the warehouse.
A base storage container for MooseObjects.
unsigned int THREAD_ID
Definition: MooseTypes.h:209