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 "Moose.h" 11 : 12 : #include "ParameterRegistry.h" 13 : 14 : namespace Moose 15 : { 16 : ParameterRegistry & 17 15425449 : ParameterRegistry::get() 18 : { 19 : static ParameterRegistry * registry = nullptr; 20 15425449 : if (!registry) 21 56987 : registry = new ParameterRegistry(); 22 15425449 : return *registry; 23 : } 24 : 25 : void 26 2781905 : ParameterRegistry::set(libMesh::Parameters::Value & value, const hit::Field & field) const 27 : { 28 2781905 : const std::type_index key(value.type_info()); 29 2781905 : const auto it = _registry.find(key); 30 2781905 : if (it == _registry.end()) 31 2 : mooseError("ParameterRegistry::set(): Parameter type '", 32 8 : MooseUtils::prettyCppType(value.type()), 33 : "' is not registered"); 34 : 35 : // Catch all mooseErrors so that they can be accumulated during 36 : // parsing and building instead of ending the run 37 2781903 : Moose::ScopedThrowOnError scoped_throw_on_error; 38 : 39 2781903 : it->second(value, field); 40 2781903 : } 41 : }