diff --git a/src/coreComponents/constitutive/ConstitutiveManager.hpp b/src/coreComponents/constitutive/ConstitutiveManager.hpp index 2e3d7cec562..7248a7ddcbd 100644 --- a/src/coreComponents/constitutive/ConstitutiveManager.hpp +++ b/src/coreComponents/constitutive/ConstitutiveManager.hpp @@ -22,6 +22,7 @@ #include "dataRepository/Group.hpp" #include "dataRepository/ReferenceWrapper.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "ConstitutiveBase.hpp" namespace geos @@ -83,8 +84,6 @@ class ConstitutiveManager : public dataRepository::Group }; }; - - template< typename T > ViewAccessor< T > ConstitutiveManager::getConstitutiveData( string const & name, @@ -104,7 +103,26 @@ ConstitutiveManager::getConstitutiveData( string const & name, return rval; } +} /* namespace constitutive */ + +// ConstitutiveManager Group is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline +constitutive::ConstitutiveManager & dataRepository::ProblemRepository::getManager() +{ + return getRootGroup(). + getGroup( m_gks.domain ). + getGroup< constitutive::ConstitutiveManager >( m_gks.constitutiveManager ); +} + +// ConstitutiveManager Group is available through the ProblemRepository as a const problem-unique manager. +template<> inline +constitutive::ConstitutiveManager const & dataRepository::ProblemRepository::getManager() const +{ + return getRootGroup(). + getGroup( m_gks.domain ). + getGroup< constitutive::ConstitutiveManager >( m_gks.constitutiveManager ); } + } /* namespace geos */ #endif /* GEOS_CONSTITUTIVE_CONSTITUTIVEMANAGER_HPP_ */ diff --git a/src/coreComponents/constitutiveDrivers/ConstitutiveDriver.cpp b/src/coreComponents/constitutiveDrivers/ConstitutiveDriver.cpp index 2126e23da78..adf1564e127 100644 --- a/src/coreComponents/constitutiveDrivers/ConstitutiveDriver.cpp +++ b/src/coreComponents/constitutiveDrivers/ConstitutiveDriver.cpp @@ -21,6 +21,7 @@ #include "LogLevelsInfo.hpp" #include "constitutive/ConstitutiveManager.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "common/format/table/TableFormatter.hpp" #include "common/format/StringUtilities.hpp" @@ -246,12 +247,12 @@ void ConstitutiveDriver::allocateTable( integer const numColumns, ConstitutiveManager & ConstitutiveDriver::getConstitutiveManager() { - return this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); + return ProblemRepository::getManager< ConstitutiveManager >( *this ); } ConstitutiveManager const & ConstitutiveDriver::getConstitutiveManager() const { - return this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); + return ProblemRepository::getManager< ConstitutiveManager >( *this ); } } /* namespace geos */ diff --git a/src/coreComponents/constitutiveDrivers/fluid/multiFluid/reactive/ReactiveFluidDriver.cpp b/src/coreComponents/constitutiveDrivers/fluid/multiFluid/reactive/ReactiveFluidDriver.cpp index 0999865a168..b912c152456 100644 --- a/src/coreComponents/constitutiveDrivers/fluid/multiFluid/reactive/ReactiveFluidDriver.cpp +++ b/src/coreComponents/constitutiveDrivers/fluid/multiFluid/reactive/ReactiveFluidDriver.cpp @@ -78,7 +78,7 @@ void ReactiveFluidDriver::postInputInitialization() { // get number of phases and components - ConstitutiveManager & constitutiveManager = this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); + ConstitutiveManager & constitutiveManager = ProblemRepository::getManager< ConstitutiveManager >( *this ); ReactiveMultiFluid & fluid = constitutiveManager.getGroup< ReactiveMultiFluid >( m_fluidName ); m_numPhases = fluid.numFluidPhases(); @@ -132,7 +132,7 @@ bool ReactiveFluidDriver::execute( real64 const GEOS_UNUSED_PARAM( time_n ), // get the fluid out of the constitutive manager. // for the moment it is of type MultiFluidBase. - ConstitutiveManager & constitutiveManager = this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); + ConstitutiveManager & constitutiveManager = ProblemRepository::getManager< ConstitutiveManager >( *this ); ReactiveMultiFluid & baseFluid = constitutiveManager.getGroup< ReactiveMultiFluid >( m_fluidName ); // depending on logLevel, print some useful info diff --git a/src/coreComponents/dataRepository/CMakeLists.txt b/src/coreComponents/dataRepository/CMakeLists.txt index 521e7d1fad4..dddfa2464cd 100644 --- a/src/coreComponents/dataRepository/CMakeLists.txt +++ b/src/coreComponents/dataRepository/CMakeLists.txt @@ -32,11 +32,12 @@ set( dataRepository_headers HistoryDataSpec.hpp InputFlags.hpp KeyIndexT.hpp - KeyNames.hpp LogLevelsInfo.hpp LogLevelsRegistry.hpp MappedVector.hpp ObjectCatalog.hpp + ProblemRepositoryABC.hpp + ProblemRepository.hpp ReferenceWrapper.hpp RestartFlags.hpp Utilities.hpp @@ -57,6 +58,7 @@ set( dataRepository_sources ConduitRestart.cpp ExecutableGroup.cpp Group.cpp + ProblemRepository.cpp Utilities.cpp WrapperBase.cpp xmlWrapper.cpp diff --git a/src/coreComponents/dataRepository/Group.cpp b/src/coreComponents/dataRepository/Group.cpp index a0ef81eac96..bda26ece209 100644 --- a/src/coreComponents/dataRepository/Group.cpp +++ b/src/coreComponents/dataRepository/Group.cpp @@ -21,6 +21,7 @@ #include "common/format/table/TableLayout.hpp" #include "codingUtilities/Utilities.hpp" #include "GroupContext.hpp" +#include "ProblemRepositoryABC.hpp" #if defined(GEOS_USE_PYGEOSX) #include "python/PyGroupType.hpp" #endif @@ -133,12 +134,7 @@ void Group::reserve( indexType const newSize ) } string Group::getPath() const -{ - // In the Conduit node hierarchy everything begins with 'Problem', we should change it so that - // the ProblemManager actually uses the root Conduit Node but that will require a full rebaseline. - string const noProblem = getConduitNode().path().substr( stringutilities::cstrlen( dataRepository::keys::ProblemManager ) ); - return noProblem.empty() ? "/" : noProblem; -} +{ return ProblemRepositoryABC::getNoProblemPath( getConduitNode().path() ); } string Group::processInputName( xmlWrapper::xmlNode const & targetNode, xmlWrapper::xmlNodePos const & targetNodePos, diff --git a/src/coreComponents/dataRepository/KeyNames.hpp b/src/coreComponents/dataRepository/KeyNames.hpp deleted file mode 100644 index 4c46b69a266..00000000000 --- a/src/coreComponents/dataRepository/KeyNames.hpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * ------------------------------------------------------------------------------------------------------------ - * SPDX-License-Identifier: LGPL-2.1-only - * - * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC - * Copyright (c) 2018-2024 TotalEnergies - * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University - * Copyright (c) 2023-2024 Chevron - * Copyright (c) 2019- GEOS/GEOSX Contributors - * All rights reserved - * - * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. - * ------------------------------------------------------------------------------------------------------------ - */ - -/** - * @file KeyNames.hpp - */ - -#ifndef GEOS_DATAREPOSITORY__KEYNAMES_HPP_ -#define GEOS_DATAREPOSITORY__KEYNAMES_HPP_ - -#include - -namespace geos -{ -namespace dataRepository -{ -namespace keys -{ - -/// @cond DO_NOT_DOCUMENT - -static constexpr auto ProblemManager = "Problem"; -static constexpr auto cellManager = "cellManager"; -static constexpr auto particleManager = "particleManager"; - -/// @endcond - -} -} -} -#endif /* GEOS_DATAREPOSITORY__KEYNAMES_HPP_ */ diff --git a/src/coreComponents/dataRepository/ProblemRepository.cpp b/src/coreComponents/dataRepository/ProblemRepository.cpp new file mode 100644 index 00000000000..f96bc86b7e7 --- /dev/null +++ b/src/coreComponents/dataRepository/ProblemRepository.cpp @@ -0,0 +1,68 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file MeshLevel.cpp + */ + +#include "ProblemRepository.hpp" + +namespace geos +{ +namespace dataRepository +{ + +/** + * @name Inline functions implementation + */ +///@{ + +string ProblemRepositoryABC::getNoProblemPath( string const & originalPath ) +{ + // In the Conduit node hierarchy everything begins with 'Problem', we should change it so that + // the ProblemManager actually uses the root Conduit Node but that will require a full rebaseline. + size_t const lengthToRemove = stringutilities::cstrlen( ProblemGroupKeys::problemString() ); + string const noProblem = originalPath.substr( lengthToRemove ); + return noProblem.empty() ? "/" : noProblem; +} + +ProblemRepository & ProblemRepository::get( Group & group ) +{ + // the ProblemRepository is expected to always be the root Group instance. + Group * current = &group; + while( current->hasParent() ) + { + current = ¤t->getParent(); + } + + ProblemRepository * const root = dynamic_cast< ProblemRepository * >( current ); + return *root; +} + +ProblemRepository const & ProblemRepository::get( Group const & group ) +{ + // the ProblemRepository is expected to always be the root Group instance. + Group const * current = &group; + while( current->hasParent() ) + { + current = ¤t->getParent(); + } + + ProblemRepository const * const root = dynamic_cast< ProblemRepository const * >( current ); + return *root; +} + +} /* namespace dataRepository */ +} /* namespace geos */ diff --git a/src/coreComponents/dataRepository/ProblemRepository.hpp b/src/coreComponents/dataRepository/ProblemRepository.hpp new file mode 100644 index 00000000000..f7bf963ec44 --- /dev/null +++ b/src/coreComponents/dataRepository/ProblemRepository.hpp @@ -0,0 +1,186 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ProblemRepository.hpp + */ + +#ifndef GEOS_DATAREPOSITORY_PROBLEMREPOSITORY_HPP_ +#define GEOS_DATAREPOSITORY_PROBLEMREPOSITORY_HPP_ + +#include "dataRepository/ProblemRepositoryABC.hpp" +#include "dataRepository/Group.hpp" + +namespace geos +{ +namespace dataRepository +{ + +/** + * @brief Base class for the problem data-repository repository, gives access to all the roots Groups. + * Usage examples: + * - to consult other managers: + * * from a FS instance: ProblemRepository::getManager< FunctionManager >( myFieldSpec ) + * * form a solver instance: ProblemRepository::getManager< FieldSpecificationManager >( mySolver ) + * - to consult data from the ProblemManager (mainInterface / high-level testing): + * * get the physics solvers manager: problemManager.getManager< PhysicsSolverManager >() + * * get the CommandLine Group: problemManager.getManager< CommandLine >() + * - to make a mutable problem-unique manager available (DomainPartition here): + * // EventManager is available through the ProblemRepository as a mutable problem-unique manager. + * template<> inline EventManager & dataRepository::ProblemRepository::getManager() + * { return getRootGroup().getGroup< EventManager >( m_gks.domain ); } + * - to make a const problem-unique manager available (DomainPartition here): + * // EventManager is available through the ProblemRepository as a const problem-unique manager. + * template<> inline EventManager const & dataRepository::ProblemRepository::getManager() const + * { return getRootGroup().getGroup< EventManager >( m_gks.domain ); } + * + * Manager that are unique per-problem should provides a getManager() template specialization in its header. + */ +class ProblemRepository : public ProblemRepositoryABC +{ +public: + + /** + * @brief Gives the problem data repository interface from the given Group + * @param group The current Group in the Problem tree + * @return A reference to the problem data repository interface + */ + static ProblemRepository & get( Group & group ); + + /** + * @copydoc get( Group & ) + */ + static ProblemRepository const & get( Group const & group ); + + /** + * @brief Get a root data-repository object (a manager) of a given problem. For each manager: + * - The consumer(s) need to include the type definition, + * - The manager implementation needs to implement a specialization. + * @tparam ManagerType the type of the root data-repository object we want to get (DomainPartition, EventManager...) + * @return ManagerType& the root data-repository object instance reference + */ + template< typename ManagerType > + ManagerType & getManager(); + + /** + * @copydoc getManager() + */ + template< typename ManagerType > + ManagerType const & getManager() const; + + /** + * @copydoc getManager() + */ + template< typename ManagerType > + static ManagerType & getManager( Group & group ) + { return ProblemRepository::get( group ).getManager< ManagerType >(); } + + /** + * @copydoc getManager() + */ + template< typename ManagerType > + static ManagerType const & getManager( Group const & group ) + { return ProblemRepository::get( group ).getManager< ManagerType >(); } + + /** + * @return the root Group which contain all the problem data-repository + */ + Group & getRootGroup() + { return m_rootGroup; } + + /** + * @return the root Group which contain all the problem data-repository + */ + Group const & getRootGroup() const + { return m_rootGroup; } + + // if an abstract Group getting method is absolutely needed, we can add: + // + // Group & getManager( string_view managerKey ) = 0; + // Group const & getManager( string_view managerKey ) const = 0; + // + // ... but ideally, we don't want to propose these to remove any "invisible" circular dependency practice. + +protected: + + /** + * @brief Standard GEOS data-managers Group keys for efficient getManager() lookup. + * Note that this list is not a constraint, it can be extended with any type by adding a new + * getManager() specialization. + * This struct remains internal to avoid "invisible dependancies": being dependent of the + * existence of a Group through a specific data-repository path without of mention its type, + * complicating dependencies visibility. + * When adding a new key, const, and optionnally mutable specializations of getManager must be + * added in the Group type header. + */ + struct ProblemGroupKeys : ProblemRepositoryABC::ProblemGroupKeys + { + dataRepository::GroupKey commandLine = { "commandLine" }; + dataRepository::GroupKey domain = { "domain" }; + dataRepository::GroupKey constitutiveManager = { "Constitutive" }; + dataRepository::GroupKey eventManager = { "Events" }; + dataRepository::GroupKey externalDataSourceManager = { "ExternalDataSource" }; + dataRepository::GroupKey fieldSpecificationManager = { "FieldSpecifications" }; + dataRepository::GroupKey functionManager = { "Functions" }; + dataRepository::GroupKey geometricObjectManager = { "Geometry" }; + dataRepository::GroupKey meshManager = { "Mesh" }; + dataRepository::GroupKey numericalMethodsManager = { "NumericalMethods" }; + dataRepository::GroupKey outputManager = { "Outputs" }; + dataRepository::GroupKey physicsSolverManager = { "Solvers" }; + dataRepository::GroupKey tasksManager = { "Tasks" }; + } m_gks; + + /** + * @brief Construct a new ProblemRepository object + * @param rootGroup The Problem root group reference. + */ + ProblemRepository( Group & rootGroup ) + : ProblemRepositoryABC() + , m_rootGroup( rootGroup ) + {} + + /** + * @brief Deleted copy constructor for m_rootGroup reference validity. + */ + ProblemRepository( ProblemRepository const & ) = delete; + + /** + * @brief Deleted move constructor for m_rootGroup reference validity. + */ + ProblemRepository( ProblemRepository && ) = delete; + + /** + * @brief Deleted move operator for m_rootGroup reference validity. + */ + ProblemRepository & operator=( ProblemRepository const & ) = delete; + + /** + * @brief Deleted move operator for m_rootGroup reference validity. + */ + ProblemRepository & operator=( ProblemRepository && ) = delete; + +private: + + /** + * @brief The Problem root group. + */ + Group & m_rootGroup; + +}; + +} /* namespace dataRepository */ +} /* namespace geos */ + +#endif /* GEOS_DATAREPOSITORY_PROBLEMREPOSITORY_HPP_ */ diff --git a/src/coreComponents/dataRepository/ProblemRepositoryABC.hpp b/src/coreComponents/dataRepository/ProblemRepositoryABC.hpp new file mode 100644 index 00000000000..ae57d97f050 --- /dev/null +++ b/src/coreComponents/dataRepository/ProblemRepositoryABC.hpp @@ -0,0 +1,70 @@ +/* + * ------------------------------------------------------------------------------------------------------------ + * SPDX-License-Identifier: LGPL-2.1-only + * + * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC + * Copyright (c) 2018-2024 TotalEnergies + * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University + * Copyright (c) 2023-2024 Chevron + * Copyright (c) 2019- GEOS/GEOSX Contributors + * All rights reserved + * + * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. + * ------------------------------------------------------------------------------------------------------------ + */ + +/** + * @file ProblemRepositoryABC.hpp + */ + +#ifndef GEOS_DATAREPOSITORY_PROBLEMREPOSITORYABC_HPP_ +#define GEOS_DATAREPOSITORY_PROBLEMREPOSITORYABC_HPP_ + +#include "common/DataTypes.hpp" + +namespace geos +{ +namespace dataRepository +{ + +/** + * @brief Interface for an object which gives access all the problem data-repository. + * No dependancy on Group since Group needs some features (getNoProblemPath()). + * - No exposure of the problem GroupKey string, to avoid "invisible dependancies": + * being dependent of the existence + * of a Group at a specific data-repository path without mentionning its type (making it + * hard to see/find the dependency). + */ +class ProblemRepositoryABC +{ +public: + + /** + * @brief Utility function to output a Group/Wrapper path without "Problem": "Problem/commandLine" -> "/commandLine" + * @param originalPath Group/Wrapper conduit node path + * @return string without "Problem" at start + */ + static string getNoProblemPath( string const & originalPath ); + +protected: + + /** + * @brief Group keys for faster lookup. + * Remain internal data to avoid "invisible dependancies": being dependent of the existence + * of a Group at a specific data-repository path without mentionning its type (making it + * hard to see/find the dependency). + */ + struct ProblemGroupKeys + { + static constexpr char const * problemString() { return "Problem"; } + }; + + ProblemRepositoryABC() + {} + +}; + +} /* namespace dataRepository */ +} /* namespace geos */ + +#endif /* GEOS_DATAREPOSITORY_PROBLEMREPOSITORYABC_HPP_ */ diff --git a/src/coreComponents/dataRepository/Wrapper.hpp b/src/coreComponents/dataRepository/Wrapper.hpp index 3cd2573c222..0dc86ebb5d4 100644 --- a/src/coreComponents/dataRepository/Wrapper.hpp +++ b/src/coreComponents/dataRepository/Wrapper.hpp @@ -22,7 +22,6 @@ // Source inclues #include "wrapperHelpers.hpp" -#include "KeyNames.hpp" #include "LvArray/src/limits.hpp" #include "common/DataTypes.hpp" #include "codingUtilities/SFINAE_Macros.hpp" diff --git a/src/coreComponents/dataRepository/WrapperBase.cpp b/src/coreComponents/dataRepository/WrapperBase.cpp index ff499a6f63e..b3f57550ddb 100644 --- a/src/coreComponents/dataRepository/WrapperBase.cpp +++ b/src/coreComponents/dataRepository/WrapperBase.cpp @@ -20,6 +20,7 @@ #include "Group.hpp" #include "RestartFlags.hpp" #include "WrapperContext.hpp" +#include "ProblemRepositoryABC.hpp" namespace geos @@ -68,10 +69,7 @@ void WrapperBase::copyWrapperAttributes( WrapperBase const & source ) string WrapperBase::getPath() const { - // In the Conduit node hierarchy everything begins with 'Problem', we should change it so that - // the ProblemManager actually uses the root Conduit Node but that will require a full rebaseline. - string const noProblem = m_conduitNode.path().substr( std::strlen( dataRepository::keys::ProblemManager ) - 1 ); - return noProblem.empty() ? "/" : noProblem; + return ProblemRepositoryABC::getNoProblemPath( m_conduitNode.path() ); } #if defined(USE_TOTALVIEW_OUTPUT) diff --git a/src/coreComponents/dataRepository/xmlWrapper.cpp b/src/coreComponents/dataRepository/xmlWrapper.cpp index 0c5a469a570..dff58bde59d 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.cpp +++ b/src/coreComponents/dataRepository/xmlWrapper.cpp @@ -23,7 +23,6 @@ #include "common/format/StringUtilities.hpp" #include "common/MpiWrapper.hpp" -#include "dataRepository/KeyNames.hpp" namespace geos { @@ -233,6 +232,7 @@ void xmlDocument::addIncludedXML( xmlNode & targetNode, int const level ) } string buildMultipleInputXML( string_array const & inputFileList, + string const & rootNodeName, string const & outputDir ) { if( inputFileList.empty() ) @@ -250,7 +250,7 @@ string buildMultipleInputXML( string_array const & inputFileList, if( MpiWrapper::commRank() == 0 ) { xmlWrapper::xmlDocument compositeTree; - xmlWrapper::xmlNode compositeRoot = compositeTree.appendChild( dataRepository::keys::ProblemManager ); + xmlWrapper::xmlNode compositeRoot = compositeTree.appendChild( rootNodeName ); xmlWrapper::xmlNode includedRoot = compositeRoot.append_child( includedListTag ); for( auto & fileName: inputFileList ) diff --git a/src/coreComponents/dataRepository/xmlWrapper.hpp b/src/coreComponents/dataRepository/xmlWrapper.hpp index 494eb2db119..023cef2ae5d 100644 --- a/src/coreComponents/dataRepository/xmlWrapper.hpp +++ b/src/coreComponents/dataRepository/xmlWrapper.hpp @@ -299,6 +299,7 @@ constexpr char const includedFileTag[] = "File"; * a new input xml file with an included block if neccesary */ string buildMultipleInputXML( string_array const & inputFileList, + string const & rootNodeName, string const & outputDir = {} ); /** diff --git a/src/coreComponents/discretizationMethods/NumericalMethodsManager.hpp b/src/coreComponents/discretizationMethods/NumericalMethodsManager.hpp index 503647f206a..7acfeb0012c 100644 --- a/src/coreComponents/discretizationMethods/NumericalMethodsManager.hpp +++ b/src/coreComponents/discretizationMethods/NumericalMethodsManager.hpp @@ -21,6 +21,7 @@ #define GEOS_DISCRETIZATIONMETHODS_NUMERICALMETHODSMANAGER_HPP_ #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "finiteElement/FiniteElementDiscretizationManager.hpp" #include "finiteVolume/FiniteVolumeManager.hpp" @@ -101,6 +102,14 @@ class NumericalMethodsManager : public dataRepository::Group }; +// NumericalMethodsManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline NumericalMethodsManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< NumericalMethodsManager >( m_gks.numericalMethodsManager ); } + +// NumericalMethodsManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline NumericalMethodsManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< NumericalMethodsManager >( m_gks.numericalMethodsManager ); } + } /* namespace geos */ #endif /* GEOS_DISCRETIZATIONMETHODS_NUMERICALMETHODSMANAGER_HPP_ */ diff --git a/src/coreComponents/events/EventManager.hpp b/src/coreComponents/events/EventManager.hpp index 0e5024fb07c..e1e23b31eba 100644 --- a/src/coreComponents/events/EventManager.hpp +++ b/src/coreComponents/events/EventManager.hpp @@ -18,6 +18,7 @@ #define GEOS_EVENTS_EVENTMANAGER_HPP_ #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "EventBase.hpp" #include "common/format/LogPart.hpp" @@ -183,6 +184,14 @@ ENUM_STRINGS( EventManager::TimeOutputFormat, "years", "full" ); +// EventManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline EventManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< EventManager >( m_gks.eventManager ); } + +// EventManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline EventManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< EventManager >( m_gks.domain ); } + } /* namespace geos */ #endif /* GEOS_EVENTS_EVENTMANAGER_HPP_ */ diff --git a/src/coreComponents/events/tasks/TasksManager.hpp b/src/coreComponents/events/tasks/TasksManager.hpp index 852e0fd8cf4..05384169f88 100644 --- a/src/coreComponents/events/tasks/TasksManager.hpp +++ b/src/coreComponents/events/tasks/TasksManager.hpp @@ -21,6 +21,7 @@ #define GEOS_EVENTS_TASKS_TASKSMANAGER_HPP_ #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "TaskBase.hpp" namespace geos @@ -49,6 +50,14 @@ class TasksManager : public dataRepository::Group }; +// TasksManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline TasksManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< TasksManager >( m_gks.tasksManager ); } + +// TasksManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline TasksManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< TasksManager >( m_gks.tasksManager ); } + } /* namespace geos */ #endif diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp index f5fe8126991..0a8573d5b73 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.cpp @@ -14,6 +14,7 @@ */ #include "FieldSpecificationManager.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "mesh/DomainPartition.hpp" #include "mesh/MeshBody.hpp" #include "mesh/MeshObjectPath.hpp" @@ -70,7 +71,7 @@ void FieldSpecificationManager::expandObjectCatalogs() void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) const { - DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition const & domain = ProblemRepository::getManager< DomainPartition >( *this ); Group const & meshBodies = domain.getMeshBodies(); // loop over all the FieldSpecification of the XML file this->forSubGroups< FieldSpecification >( [&] ( FieldSpecification const & fs ) diff --git a/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp b/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp index cd033d27b62..3bb3be9ad25 100644 --- a/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp +++ b/src/coreComponents/fieldSpecification/FieldSpecificationManager.hpp @@ -299,6 +299,14 @@ FieldSpecificationManager:: } ); } +// FieldSpecificationManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline FieldSpecificationManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< FieldSpecificationManager >( m_gks.fieldSpecificationManager ); } + +// FieldSpecificationManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline FieldSpecificationManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< FieldSpecificationManager >( m_gks.fieldSpecificationManager ); } + } /* namespace geos */ #endif /* GEOS_FIELDSPECIFICATION_FIELDSPECIFICATIONMANAGER_HPP_ */ diff --git a/src/coreComponents/fileIO/Outputs/OutputManager.hpp b/src/coreComponents/fileIO/Outputs/OutputManager.hpp index 38a68c06568..2c417828cea 100644 --- a/src/coreComponents/fileIO/Outputs/OutputManager.hpp +++ b/src/coreComponents/fileIO/Outputs/OutputManager.hpp @@ -21,6 +21,7 @@ #define GEOS_FILEIO_OUTPUTS_OUTPUTMANAGER_HPP_ #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" namespace geos @@ -60,6 +61,13 @@ class OutputManager : public dataRepository::Group /// @endcond }; +// OutputManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline OutputManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< OutputManager >( m_gks.outputManager ); } + +// OutputManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline OutputManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< OutputManager >( m_gks.outputManager ); } } /* namespace geos */ diff --git a/src/coreComponents/fileIO/Outputs/RestartOutput.cpp b/src/coreComponents/fileIO/Outputs/RestartOutput.cpp index ee9038f3f2a..2ef48c6a769 100644 --- a/src/coreComponents/fileIO/Outputs/RestartOutput.cpp +++ b/src/coreComponents/fileIO/Outputs/RestartOutput.cpp @@ -18,6 +18,7 @@ */ #include "RestartOutput.hpp" +#include "dataRepository/ProblemRepository.hpp" namespace geos { @@ -44,7 +45,7 @@ bool RestartOutput::execute( real64 const GEOS_UNUSED_PARAM( time_n ), { Timer timer( m_outputTimer ); - Group & rootGroup = this->getGroupByPath( "/Problem" ); + Group & rootGroup = ProblemRepository::get( *this ).getRootGroup(); string const fileName = GEOS_FMT( "{}_restart_{:09}", getFileNameRoot(), cycleNumber ); rootGroup.prepareToWrite(); writeTree( joinPath( getOutputDirectory(), fileName ), *(rootGroup.getConduitNode().parent()) ); diff --git a/src/coreComponents/fileIO/Outputs/TimeHistoryOutput.cpp b/src/coreComponents/fileIO/Outputs/TimeHistoryOutput.cpp index fd885431dcd..4bc7bb1ac94 100644 --- a/src/coreComponents/fileIO/Outputs/TimeHistoryOutput.cpp +++ b/src/coreComponents/fileIO/Outputs/TimeHistoryOutput.cpp @@ -15,6 +15,7 @@ #include "TimeHistoryOutput.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "fileIO/timeHistory/HDFFile.hpp" #include "fileIO/LogLevelsInfo.hpp" @@ -130,7 +131,7 @@ void TimeHistoryOutput::initializePostInitialConditionsPostSubGroups() HDFFile( outputFile, (m_recordCount == 0), true, MPI_COMM_GEOS ); } - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); GEOS_LOG_LEVEL_BY_RANK( logInfo::DataCollectorInitialization, GEOS_FMT( "TimeHistory: '{}' initializing data collectors.", this->getName() ) ); for( auto collectorPath : m_collectorPaths ) diff --git a/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp b/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp index 84cd000bc60..119274e650b 100644 --- a/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp +++ b/src/coreComponents/fileIO/Outputs/unitTests/testMemoryStats.cpp @@ -17,6 +17,7 @@ #include "mainInterface/initialization.hpp" #include "mainInterface/GeosxState.hpp" #include "fileIO/Outputs/MemoryStatsOutput.hpp" +#include "fileIO/Outputs/OutputManager.hpp" #include "codingUtilities/Parsing.hpp" #include "common/format/table/TableFormatter.hpp" @@ -147,7 +148,7 @@ static const string basicSimXml = )xml"; -static const string memOutputPath = "/Outputs/memoryOutput"; +static const string memOutputName = "memoryOutput"; static const string memOutputFileName = "MemoryStats_umpireStats.csv"; CommandLineOptions g_commandLineOptions; @@ -166,7 +167,7 @@ TEST( testXML, testMemoryCSVOutput ) // do a MemoryStats test output with a dummy entry integer const dummyCycle = 123456; string const dummyCycleStr = std::to_string( dummyCycle ); - MemoryStatsOutput & memOutput = problem.getGroupByPath< MemoryStatsOutput >( memOutputPath ); + MemoryStatsOutput & memOutput = problem.getOutputManager().getGroup< MemoryStatsOutput >( memOutputName ); memOutput.execute( 0.0, 0.0, dummyCycle, 0, 0.0, problem.getDomainPartition() ); // read the CSV output (parseFile() will throw if no CSV is generated) diff --git a/src/coreComponents/fileIO/python/PyHistoryCollection.cpp b/src/coreComponents/fileIO/python/PyHistoryCollection.cpp index 7bd2a08ea4d..c0de1e55ae8 100644 --- a/src/coreComponents/fileIO/python/PyHistoryCollection.cpp +++ b/src/coreComponents/fileIO/python/PyHistoryCollection.cpp @@ -20,6 +20,7 @@ #include "fileIO/timeHistory/HistoryCollection.hpp" #include "PyHistoryCollectionType.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "dataRepository/python/PyGroupType.hpp" @@ -97,7 +98,7 @@ static PyObject * collect( PyHistoryCollection * self, PyObject * args ) return nullptr; } - geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" ); + geos::DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *self->group ); try { diff --git a/src/coreComponents/fileIO/python/PyHistoryOutput.cpp b/src/coreComponents/fileIO/python/PyHistoryOutput.cpp index e7fff852ef5..be9a5bb5b58 100644 --- a/src/coreComponents/fileIO/python/PyHistoryOutput.cpp +++ b/src/coreComponents/fileIO/python/PyHistoryOutput.cpp @@ -21,6 +21,7 @@ #include "PyHistoryOutputType.hpp" #include "dataRepository/python/PyGroupType.hpp" +#include "dataRepository/ProblemRepository.hpp" #define VERIFY_NON_NULL_SELF( self ) \ @@ -95,7 +96,7 @@ static PyObject * output( PyHistoryOutput * self, PyObject * args ) return nullptr; } - geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" ); + geos::DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *self->group ); try { diff --git a/src/coreComponents/fileIO/python/PyVTKOutput.cpp b/src/coreComponents/fileIO/python/PyVTKOutput.cpp index 89cc2c4026f..572627a6b2b 100644 --- a/src/coreComponents/fileIO/python/PyVTKOutput.cpp +++ b/src/coreComponents/fileIO/python/PyVTKOutput.cpp @@ -13,6 +13,8 @@ * ------------------------------------------------------------------------------------------------------------ */ +#include "dataRepository/ProblemRepository.hpp" +#include "mesh/DomainPartition.hpp" #define PY_SSIZE_T_CLEAN #include @@ -93,7 +95,7 @@ static PyObject * output( PyVTKOutput * self, PyObject * args ) return nullptr; } - geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = dataRepository::ProblemRepository::getManager< DomainPartition >( *self->group ); try { diff --git a/src/coreComponents/fileIO/timeHistory/PackCollection.cpp b/src/coreComponents/fileIO/timeHistory/PackCollection.cpp index ee18e7e1e48..e5ab6ac0999 100644 --- a/src/coreComponents/fileIO/timeHistory/PackCollection.cpp +++ b/src/coreComponents/fileIO/timeHistory/PackCollection.cpp @@ -14,6 +14,7 @@ */ #include "PackCollection.hpp" +#include "dataRepository/ProblemRepository.hpp" namespace geos { @@ -60,7 +61,7 @@ void PackCollection::initializePostSubGroups( ) { if( !m_initialized ) { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); m_collectionCount = collectAll() ? 1 : m_setNames.size(); // determine whether we're collecting from a mesh object manager Group const * const targetObject = this->getTargetObject( domain, m_objectPath ); diff --git a/src/coreComponents/finiteElement/elementFormulations/unitTests/testConformingVirtualElementOrder1.cpp b/src/coreComponents/finiteElement/elementFormulations/unitTests/testConformingVirtualElementOrder1.cpp index dea9c0437fc..f46495864bb 100644 --- a/src/coreComponents/finiteElement/elementFormulations/unitTests/testConformingVirtualElementOrder1.cpp +++ b/src/coreComponents/finiteElement/elementFormulations/unitTests/testConformingVirtualElementOrder1.cpp @@ -282,17 +282,16 @@ TEST( ConformingVirtualElementOrder1, hexahedra ) GEOS_LOG_RANK_0( "Error description: " << xmlResult.description()); GEOS_LOG_RANK_0( "Error offset: " << xmlResult.offset ); } - xmlWrapper::xmlNode xmlProblemNode = inputFile.getChild( dataRepository::keys::ProblemManager ); GeosxState state( std::make_unique< CommandLineOptions >( g_commandLineOptions ) ); ProblemManager & problemManager = state.getProblemManager(); + xmlWrapper::xmlNode xmlProblemNode = inputFile.getChild( problemManager.getName()); problemManager.processInputFileRecursive( inputFile, xmlProblemNode ); // Open mesh levels DomainPartition & domain = problemManager.getDomainPartition(); - MeshManager & meshManager = problemManager.getGroup< MeshManager >( problemManager.groupKeys - .meshManager ); + MeshManager & meshManager = problemManager.getMeshManager(); meshManager.generateMeshLevels( domain ); MeshLevel & mesh = domain.getMeshBody( 0 ).getBaseDiscretization(); ElementRegionManager & elementManager = mesh.getElemManager(); @@ -335,17 +334,16 @@ TEST( ConformingVirtualElementOrder1, wedges ) GEOS_LOG_RANK_0( "Error description: " << xmlResult.description()); GEOS_LOG_RANK_0( "Error offset: " << xmlResult.offset ); } - xmlWrapper::xmlNode xmlProblemNode = inputFile.getChild( dataRepository::keys::ProblemManager ); GeosxState state( std::make_unique< CommandLineOptions >( g_commandLineOptions ) ); ProblemManager & problemManager = state.getProblemManager(); + xmlWrapper::xmlNode xmlProblemNode = inputFile.getChild( problemManager.getName() ); problemManager.processInputFileRecursive( inputFile, xmlProblemNode ); // Open mesh levels DomainPartition & domain = problemManager.getDomainPartition(); - MeshManager & meshManager = problemManager.getGroup< MeshManager > - ( problemManager.groupKeys.meshManager ); + MeshManager & meshManager = problemManager.getMeshManager(); meshManager.generateMeshLevels( domain ); MeshLevel & mesh = domain.getMeshBody( 0 ).getBaseDiscretization(); ElementRegionManager & elementManager = mesh.getElemManager(); diff --git a/src/coreComponents/finiteVolume/FluxApproximationBase.cpp b/src/coreComponents/finiteVolume/FluxApproximationBase.cpp index 4104ab292b9..8fdfffb3a37 100644 --- a/src/coreComponents/finiteVolume/FluxApproximationBase.cpp +++ b/src/coreComponents/finiteVolume/FluxApproximationBase.cpp @@ -20,6 +20,7 @@ #include "FluxApproximationBase.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "fieldSpecification/FieldSpecificationManager.hpp" #include "fieldSpecification/AquiferBoundaryCondition.hpp" @@ -72,7 +73,7 @@ void FluxApproximationBase::initializePreSubGroups() { GEOS_MARK_FUNCTION; - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); domain.forMeshBodies( [&]( MeshBody & meshBody ) { @@ -113,7 +114,7 @@ void FluxApproximationBase::initializePostInitialConditionsPreSubGroups() { GEOS_MARK_FUNCTION; - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); FieldSpecificationManager & fsManager = FieldSpecificationManager::getInstance(); for( auto const & [meshBodyName, meshBodyRegions] : m_targetRegions ) diff --git a/src/coreComponents/functions/FunctionManager.hpp b/src/coreComponents/functions/FunctionManager.hpp index dac7ad85b0a..eb36c44d664 100644 --- a/src/coreComponents/functions/FunctionManager.hpp +++ b/src/coreComponents/functions/FunctionManager.hpp @@ -23,6 +23,7 @@ #include "FunctionBase.hpp" #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" namespace geos { @@ -72,6 +73,14 @@ class FunctionManager : public dataRepository::Group static FunctionManager * m_instance; }; +// FunctionManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline FunctionManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< FunctionManager >( m_gks.functionManager ); } + +// FunctionManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline FunctionManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< FunctionManager >( m_gks.functionManager ); } + } /* namespace geos */ #endif /* GEOS_FUNCTIONS_FUNCTIONMANAGER_HPP_ */ diff --git a/src/coreComponents/integrationTests/fieldSpecificationTests/testRecursiveFieldApplication.cpp b/src/coreComponents/integrationTests/fieldSpecificationTests/testRecursiveFieldApplication.cpp index e257939aa0c..4b085bb473f 100644 --- a/src/coreComponents/integrationTests/fieldSpecificationTests/testRecursiveFieldApplication.cpp +++ b/src/coreComponents/integrationTests/fieldSpecificationTests/testRecursiveFieldApplication.cpp @@ -82,7 +82,8 @@ TEST( FieldSpecification, Recursive ) // Cell blocks should only be used to define the sub regions. // This scope protection is there to make them disappear from the rest of the test. { - CellBlockManager & cellBlockManager = domain.registerGroup< CellBlockManager >( keys::cellManager ); + CellBlockManager & cellBlockManager = + domain.registerGroup< CellBlockManager >( MeshBody::groupStructKeys::cellManagerString() ); CellBlock & reg0Hex = cellBlockManager.registerCellBlock( "reg0hex" ); reg0Hex.setElementType( geos::ElementType::Hexahedron ); @@ -111,7 +112,7 @@ TEST( FieldSpecification, Recursive ) reg1.generateMesh( cellBlocks ); // The cell block manager should not be used anymore. - domain.deregisterGroup( keys::cellManager ); + domain.deregisterGroup( MeshBody::groupStructKeys::cellManagerString() ); } /// Field Definition diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testCompFlowUtils.hpp b/src/coreComponents/integrationTests/fluidFlowTests/testCompFlowUtils.hpp index c5e2492cb16..81f391551c6 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testCompFlowUtils.hpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testCompFlowUtils.hpp @@ -77,13 +77,12 @@ void setupProblemFromXML( ProblemManager & problemManager, char const * const xm int mpiSize = MpiWrapper::commSize( MPI_COMM_GEOS ); - dataRepository::Group & commandLine = - problemManager.getGroup< dataRepository::Group >( problemManager.groupKeys.commandLine ); + CommandLine & commandLine = problemManager.getCommandLine(); - commandLine.registerWrapper< integer >( problemManager.viewKeys.xPartitionsOverride.key() ). + commandLine.registerWrapper< integer >( commandLine.m_vks.xPartitionsOverride ). setApplyDefaultValue( mpiSize ); - xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( dataRepository::keys::ProblemManager ); + xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( problemManager.getName() ); problemManager.processInputFileRecursive( xmlDocument, xmlProblemNode ); DomainPartition & domain = problemManager.getDomainPartition(); @@ -92,7 +91,7 @@ void setupProblemFromXML( ProblemManager & problemManager, char const * const xm xmlWrapper::xmlNode topLevelNode = xmlProblemNode.child( constitutiveManager.getName().c_str()); constitutiveManager.processInputFileRecursive( xmlDocument, topLevelNode ); - MeshManager & meshManager = problemManager.getGroup< MeshManager >( problemManager.groupKeys.meshManager ); + MeshManager & meshManager = problemManager.getMeshManager(); meshManager.generateMeshLevels( domain ); ElementRegionManager & elementManager = domain.getMeshBody( 0 ).getBaseDiscretization().getElemManager(); diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testReactiveCompositionalMultiphaseOBL.cpp b/src/coreComponents/integrationTests/fluidFlowTests/testReactiveCompositionalMultiphaseOBL.cpp index f5b6c74be36..0db779825f0 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testReactiveCompositionalMultiphaseOBL.cpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testReactiveCompositionalMultiphaseOBL.cpp @@ -477,7 +477,9 @@ class CompositionalMultiphaseFlowTest : public ::testing::Test setupProblemFromXML( state.getProblemManager(), xmlInput ); removeFile( "obl_3comp_static.txt" ); - solver = &state.getProblemManager().getPhysicsSolverManager().getGroup< ReactiveCompositionalMultiphaseOBL >( "compflow" ); + solver = &state.getProblemManager(). + getPhysicsSolverManager(). + getGroup< ReactiveCompositionalMultiphaseOBL >( "compflow" ); DomainPartition & domain = state.getProblemManager().getDomainPartition(); diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testSingleFlowUtils.hpp b/src/coreComponents/integrationTests/fluidFlowTests/testSingleFlowUtils.hpp index 24f57efc242..926b4b52869 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testSingleFlowUtils.hpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testSingleFlowUtils.hpp @@ -63,13 +63,11 @@ void setupProblemFromXML( ProblemManager & problemManager, char const * const xm int mpiSize = MpiWrapper::commSize( MPI_COMM_GEOS ); - dataRepository::Group & commandLine = - problemManager.getGroup< dataRepository::Group >( problemManager.groupKeys.commandLine ); - - commandLine.registerWrapper< integer >( problemManager.viewKeys.xPartitionsOverride.key() ). + CommandLine & commandLine = problemManager.getCommandLine(); + commandLine.registerWrapper< integer >( commandLine.m_vks.xPartitionsOverride ). setApplyDefaultValue( mpiSize ); - xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( dataRepository::keys::ProblemManager ); + xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( problemManager.getName() ); problemManager.processInputFileRecursive( xmlDocument, xmlProblemNode ); DomainPartition & domain = problemManager.getDomainPartition(); @@ -78,7 +76,7 @@ void setupProblemFromXML( ProblemManager & problemManager, char const * const xm xmlWrapper::xmlNode topLevelNode = xmlProblemNode.child( constitutiveManager.getName().c_str()); constitutiveManager.processInputFileRecursive( xmlDocument, topLevelNode ); - MeshManager & meshManager = problemManager.getGroup< MeshManager >( problemManager.groupKeys.meshManager ); + MeshManager & meshManager = problemManager.getMeshManager(); meshManager.generateMeshLevels( domain ); ElementRegionManager & elementManager = domain.getMeshBody( 0 ).getBaseDiscretization().getElemManager(); diff --git a/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseReactiveTransportUtils.hpp b/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseReactiveTransportUtils.hpp index 2cd58eeb87d..6549b3ea229 100644 --- a/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseReactiveTransportUtils.hpp +++ b/src/coreComponents/integrationTests/fluidFlowTests/testSinglePhaseReactiveTransportUtils.hpp @@ -65,13 +65,11 @@ void setupProblemFromXML( ProblemManager & problemManager, char const * const xm int mpiSize = MpiWrapper::commSize( MPI_COMM_GEOS ); - dataRepository::Group & commandLine = - problemManager.getGroup< dataRepository::Group >( problemManager.groupKeys.commandLine ); - - commandLine.registerWrapper< integer >( problemManager.viewKeys.xPartitionsOverride.key() ). + CommandLine & commandLine = problemManager.getCommandLine(); + commandLine.registerWrapper< integer >( commandLine.m_vks.xPartitionsOverride ). setApplyDefaultValue( mpiSize ); - xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( dataRepository::keys::ProblemManager ); + xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( problemManager.getName() ); problemManager.processInputFileRecursive( xmlDocument, xmlProblemNode ); DomainPartition & domain = problemManager.getDomainPartition(); @@ -80,7 +78,7 @@ void setupProblemFromXML( ProblemManager & problemManager, char const * const xm xmlWrapper::xmlNode topLevelNode = xmlProblemNode.child( constitutiveManager.getName().c_str()); constitutiveManager.processInputFileRecursive( xmlDocument, topLevelNode ); - MeshManager & meshManager = problemManager.getGroup< MeshManager >( problemManager.groupKeys.meshManager ); + MeshManager & meshManager = problemManager.getMeshManager(); meshManager.generateMeshLevels( domain ); ElementRegionManager & elementManager = domain.getMeshBody( 0 ).getBaseDiscretization().getElemManager(); diff --git a/src/coreComponents/integrationTests/linearAlgebraTests/testDofManagerUtils.hpp b/src/coreComponents/integrationTests/linearAlgebraTests/testDofManagerUtils.hpp index 02dd0d8090c..022bdd1b0a8 100644 --- a/src/coreComponents/integrationTests/linearAlgebraTests/testDofManagerUtils.hpp +++ b/src/coreComponents/integrationTests/linearAlgebraTests/testDofManagerUtils.hpp @@ -22,6 +22,7 @@ #include "common/DataTypes.hpp" #include "mesh/MeshLevel.hpp" +#include "mainInterface/ProblemManager.hpp" #include @@ -48,17 +49,16 @@ void setupProblemFromXML( ProblemManager * const problemManager, char const * co } int mpiSize = MpiWrapper::commSize( MPI_COMM_GEOS ); - dataRepository::Group & commandLine = - problemManager->getGroup< dataRepository::Group >( problemManager->groupKeys.commandLine ); - commandLine.registerWrapper< integer >( problemManager->viewKeys.xPartitionsOverride.key() ). + CommandLine & commandLine = problemManager->getCommandLine(); + commandLine.registerWrapper< integer >( commandLine.m_vks.xPartitionsOverride ). setApplyDefaultValue( mpiSize ); - xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( dataRepository::keys::ProblemManager ); + xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( problemManager->getName() ); problemManager->processInputFileRecursive( xmlDocument, xmlProblemNode ); // Open mesh levels DomainPartition & domain = problemManager->getDomainPartition(); - MeshManager & meshManager = problemManager->getGroup< MeshManager >( problemManager->groupKeys.meshManager ); + MeshManager & meshManager = problemManager->getMeshManager(); meshManager.generateMeshLevels( domain ); ElementRegionManager & elementManager = domain.getMeshBody( 0 ).getBaseDiscretization().getElemManager(); diff --git a/src/coreComponents/integrationTests/meshTests/testMeshGeneration.cpp b/src/coreComponents/integrationTests/meshTests/testMeshGeneration.cpp index 913dbeeb628..c438e25ba48 100644 --- a/src/coreComponents/integrationTests/meshTests/testMeshGeneration.cpp +++ b/src/coreComponents/integrationTests/meshTests/testMeshGeneration.cpp @@ -106,13 +106,13 @@ class MeshGenerationTest : public ::testing::Test xmlWrapper::xmlResult xmlResult = xmlDocument.loadString( inputStream ); ASSERT_TRUE( xmlResult ); - xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( dataRepository::keys::ProblemManager ); ProblemManager & problemManager = getGlobalState().getProblemManager(); + xmlWrapper::xmlNode xmlProblemNode = xmlDocument.getChild( problemManager.getName() ); problemManager.processInputFileRecursive( xmlDocument, xmlProblemNode ); // Open mesh levels DomainPartition & domain = problemManager.getDomainPartition(); - MeshManager & meshManager = problemManager.getGroup< MeshManager >( problemManager.groupKeys.meshManager ); + MeshManager & meshManager = problemManager.getMeshManager(); meshManager.generateMeshLevels( domain ); ElementRegionManager & elementManager = domain.getMeshBody( 0 ).getBaseDiscretization().getElemManager(); @@ -523,7 +523,7 @@ TEST_F( MeshGenerationTest, highOrderMapsSizes ) ProblemManager & problemManager = getGlobalState().getProblemManager(); DomainPartition & domain = problemManager.getDomainPartition(); MeshBody & meshBody = domain.getMeshBody( 0 ); - MeshManager & meshManager = problemManager.getGroup< MeshManager >( problemManager.groupKeys.meshManager ); + MeshManager & meshManager = problemManager.getMeshManager(); meshManager.generateMeshes( domain ); for( int order = minOrder; order < maxOrder; order++ ) { diff --git a/src/coreComponents/integrationTests/meshTests/testVTKImport.cpp b/src/coreComponents/integrationTests/meshTests/testVTKImport.cpp index a2f13b88748..53b7254e97c 100644 --- a/src/coreComponents/integrationTests/meshTests/testVTKImport.cpp +++ b/src/coreComponents/integrationTests/meshTests/testVTKImport.cpp @@ -84,7 +84,7 @@ void TestMeshImport( string const & meshFilePath, V const & validate, string con // TODO Field import is not tested yet. Proper refactoring needs to be done first. - validate( domain.getMeshBody( "mesh" ).getGroup< CellBlockManagerABC >( keys::cellManager ) ); + validate( domain.getMeshBody( "mesh" ).getCellBlockManager() ); } diff --git a/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp b/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp index 2b254d517f8..442eb60a6c2 100644 --- a/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp +++ b/src/coreComponents/integrationTests/solverStatisticsTests/testSolverStats.cpp @@ -216,7 +216,7 @@ TEST( testSolverStats, testLog ) problem.applyInitialConditions(); problem.runSimulation(); - PhysicsSolverBase & solver = problem.getGroupByPath< PhysicsSolverBase >( string( "/Solvers/SinglePhaseFlow" ) ); + PhysicsSolverBase & solver = problem.getPhysicsSolverManager().getGroup< PhysicsSolverBase >( "SinglePhaseFlow" ); IterationTest & solverStat = static_cast< IterationTest & >(solver.getIterationStats()); solverStat.AssertIterationValuesEquals(); @@ -234,7 +234,7 @@ TEST( testSolverStats, testOutputFiles ) problem.applyInitialConditions(); problem.runSimulation(); - PhysicsSolverBase & solver = problem.getGroupByPath< PhysicsSolverBase >( string( "/Solvers/SinglePhaseFlow" ) ); + PhysicsSolverBase & solver = problem.getPhysicsSolverManager().getGroup< PhysicsSolverBase >( "SinglePhaseFlow" ); ConvergenceTest & convergenceStat = static_cast< ConvergenceTest & >(solver.getConvergenceStats()); IterationTest & iterationStat = static_cast< IterationTest & >(solver.getIterationStats()); diff --git a/src/coreComponents/integrationTests/xmlTests/testXMLFile.cpp b/src/coreComponents/integrationTests/xmlTests/testXMLFile.cpp index 8c0fd3aad89..9d7423f3970 100644 --- a/src/coreComponents/integrationTests/xmlTests/testXMLFile.cpp +++ b/src/coreComponents/integrationTests/xmlTests/testXMLFile.cpp @@ -192,8 +192,8 @@ TEST( testXML, testXMLFileLines ) { problemManager.parseCommandLineInput(); - Group & commandLine = problemManager.getGroup( problemManager.groupKeys.commandLine ); - string const & inputFileName = commandLine.getReference< string >( problemManager.viewKeys.inputFileName ); + CommandLine & commandLine = problemManager.getCommandLine(); + string const & inputFileName = commandLine.getReference< string >( commandLine.m_vks.inputFileName ); xmlDoc.loadFile( inputFileName, true ); problemManager.parseXMLDocument( xmlDoc ); } diff --git a/src/coreComponents/mainInterface/GeosxState.cpp b/src/coreComponents/mainInterface/GeosxState.cpp index 1fcb001bc18..6452b81a35c 100644 --- a/src/coreComponents/mainInterface/GeosxState.cpp +++ b/src/coreComponents/mainInterface/GeosxState.cpp @@ -188,16 +188,4 @@ void GeosxState::run() } } -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -dataRepository::Group & GeosxState::getProblemManagerAsGroup() -{ return getProblemManager(); } - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -FieldSpecificationManager & GeosxState::getFieldSpecificationManager() -{ return getProblemManager().getFieldSpecificationManager(); } - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -FunctionManager & GeosxState::getFunctionManager() -{ return getProblemManager().getFunctionManager(); } - } // namespace geos diff --git a/src/coreComponents/mainInterface/GeosxState.hpp b/src/coreComponents/mainInterface/GeosxState.hpp index 43d44de6674..7f3c86a04d4 100644 --- a/src/coreComponents/mainInterface/GeosxState.hpp +++ b/src/coreComponents/mainInterface/GeosxState.hpp @@ -181,19 +181,11 @@ class GeosxState * @note This is useful if you only need at @c dataRepository::Group and don't want to * include @c ProblemManager.hpp. */ - dataRepository::Group & getProblemManagerAsGroup(); - - /** - * @brief Return the FieldSpecificationManager. - * @return The FieldSpecificationManager. - */ - FieldSpecificationManager & getFieldSpecificationManager(); - - /** - * @brief Return the FunctionManager. - * @return The FunctionManager. - */ - FunctionManager & getFunctionManager(); + dataRepository::Group & getProblemManagerAsGroup() + { + GEOS_ERROR_IF( m_problemManager == nullptr, "Not initialized." ); + return *(dataRepository::Group *)m_problemManager.get(); + } /** * @brief Return the CommunicationTools. diff --git a/src/coreComponents/mainInterface/ProblemManager.cpp b/src/coreComponents/mainInterface/ProblemManager.cpp index bdf792ea36d..0e7726699a7 100644 --- a/src/coreComponents/mainInterface/ProblemManager.cpp +++ b/src/coreComponents/mainInterface/ProblemManager.cpp @@ -27,7 +27,6 @@ #include "constitutiveDrivers/solid/TriaxialDriver.hpp" #include "dataRepository/ConduitRestart.hpp" #include "dataRepository/RestartFlags.hpp" -#include "dataRepository/KeyNames.hpp" #include "discretizationMethods/NumericalMethodsManager.hpp" #include "events/tasks/TasksManager.hpp" #include "events/EventManager.hpp" @@ -68,6 +67,81 @@ namespace geos using namespace dataRepository; using namespace constitutive; +CommandLine::CommandLine( string const & name, Group * parent ) + : Group( name, parent ) +{ + registerWrapper< string >( m_vks.inputFileName ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Name of the input xml file." ); + + registerWrapper< string >( m_vks.restartFileName ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Name of the restart file." ); + + registerWrapper< integer >( m_vks.beginFromRestart ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Flag to indicate restart run." ); + + registerWrapper< string >( m_vks.problemName ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Used in writing the output files, if not specified defaults to the name of the input file." ); + + registerWrapper< string >( m_vks.outputDirectory ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Directory in which to put the output files, if not specified defaults to the current directory." ); + + registerWrapper< integer >( m_vks.xPartitionsOverride ). + setApplyDefaultValue( 1 ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Number of partitions in the x-direction" ); + + registerWrapper< integer >( m_vks.yPartitionsOverride ). + setApplyDefaultValue( 1 ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Number of partitions in the y-direction" ); + + registerWrapper< integer >( m_vks.zPartitionsOverride ). + setApplyDefaultValue( 1 ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Number of partitions in the z-direction" ); + + registerWrapper< integer >( m_vks.overridePartitionNumbers ). + setApplyDefaultValue( 0 ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Flag to indicate partition number override" ); + + registerWrapper< string >( m_vks.schemaFileName ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Name of the output schema" ); + + registerWrapper< integer >( m_vks.useNonblockingMPI ). + setApplyDefaultValue( 0 ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Whether to prefer using non-blocking MPI communication where implemented (results in non-deterministic DOF numbering)." ); + + registerWrapper< integer >( m_vks.suppressPinned ). + setApplyDefaultValue( 0 ). + setRestartFlags( RestartFlags::WRITE ). + setDescription( "Whether to disallow using pinned memory allocations for MPI communication buffers." ); +} + +void CommandLine::setValues( CommandLineOptions const & opts, + string_view inputFileName ) +{ + getReference< string >( m_vks.inputFileName ) = inputFileName; + getReference< string >( m_vks.restartFileName ) = opts.restartFileName; + getReference< integer >( m_vks.beginFromRestart ) = opts.beginFromRestart; + getReference< integer >( m_vks.xPartitionsOverride ) = opts.xPartitionsOverride; + getReference< integer >( m_vks.yPartitionsOverride ) = opts.yPartitionsOverride; + getReference< integer >( m_vks.zPartitionsOverride ) = opts.zPartitionsOverride; + getReference< integer >( m_vks.overridePartitionNumbers ) = opts.overridePartitionNumbers; + getReference< string >( m_vks.schemaFileName ) = opts.schemaName; + getReference< string >( m_vks.problemName ) = opts.problemName; + getReference< string >( m_vks.outputDirectory ) = opts.outputDirectory; + getReference< integer >( m_vks.useNonblockingMPI ) = opts.useNonblockingMPI; + getReference< integer >( m_vks.suppressPinned ) = opts.suppressPinned; +} + #ifdef GEOS_USE_HYPREDRV namespace { @@ -159,86 +233,29 @@ void logHypredriveInputs( PhysicsSolverManager & physicsSolverManager, #endif ProblemManager::ProblemManager( conduit::Node & root ): - Group( keys::ProblemManager, root ), - m_physicsSolverManager( nullptr ), - m_eventManager( nullptr ), - m_functionManager( nullptr ), - m_fieldSpecificationManager( nullptr ) + dataRepository::Group( ProblemGroupKeys::problemString(), root ), + dataRepository::ProblemRepository( (Group &)*this ) { - // Groups that do not read from the xml - registerGroup< DomainPartition >( groupKeys.domain ); - Group & commandLine = registerGroup< Group >( groupKeys.commandLine ); - commandLine.setRestartFlags( RestartFlags::WRITE ); - setInputFlags( InputFlags::PROBLEM_ROOT ); - registerGroup< ExternalDataSourceManager >( groupKeys.externalDataSourceManager ); - - m_fieldSpecificationManager = ®isterGroup< FieldSpecificationManager >( groupKeys.fieldSpecificationManager ); - - m_eventManager = ®isterGroup< EventManager >( groupKeys.eventManager ); - registerGroup< NumericalMethodsManager >( groupKeys.numericalMethodsManager ); - registerGroup< GeometricObjectManager >( groupKeys.geometricObjectManager ); - registerGroup< MeshManager >( groupKeys.meshManager ); - registerGroup< OutputManager >( groupKeys.outputManager ); - m_physicsSolverManager = ®isterGroup< PhysicsSolverManager >( groupKeys.physicsSolverManager ); - m_tasksManager = ®isterGroup< TasksManager >( groupKeys.tasksManager ); - m_functionManager = ®isterGroup< FunctionManager >( groupKeys.functionManager ); - - // Command line entries - commandLine.registerWrapper< string >( viewKeys.inputFileName.key() ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Name of the input xml file." ); - - commandLine.registerWrapper< string >( viewKeys.restartFileName.key() ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Name of the restart file." ); - - commandLine.registerWrapper< integer >( viewKeys.beginFromRestart.key() ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Flag to indicate restart run." ); - - commandLine.registerWrapper< string >( viewKeys.problemName.key() ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Used in writing the output files, if not specified defaults to the name of the input file." ); - - commandLine.registerWrapper< string >( viewKeys.outputDirectory.key() ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Directory in which to put the output files, if not specified defaults to the current directory." ); - - commandLine.registerWrapper< integer >( viewKeys.xPartitionsOverride.key() ). - setApplyDefaultValue( 1 ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Number of partitions in the x-direction" ); - - commandLine.registerWrapper< integer >( viewKeys.yPartitionsOverride.key() ). - setApplyDefaultValue( 1 ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Number of partitions in the y-direction" ); - - commandLine.registerWrapper< integer >( viewKeys.zPartitionsOverride.key() ). - setApplyDefaultValue( 1 ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Number of partitions in the z-direction" ); - - commandLine.registerWrapper< integer >( viewKeys.overridePartitionNumbers.key() ). - setApplyDefaultValue( 0 ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Flag to indicate partition number override" ); - - commandLine.registerWrapper< string >( viewKeys.schemaFileName.key() ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Name of the output schema" ); - - commandLine.registerWrapper< integer >( viewKeys.useNonblockingMPI.key() ). - setApplyDefaultValue( 0 ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Whether to prefer using non-blocking MPI communication where implemented (results in non-deterministic DOF numbering)." ); + // Groups that do not read from the xml + CommandLine & commandLine = registerGroup< CommandLine >( m_gks.commandLine ); + commandLine.setRestartFlags( RestartFlags::WRITE ); - commandLine.registerWrapper< integer >( viewKeys.suppressPinned.key( ) ). - setApplyDefaultValue( 0 ). - setRestartFlags( RestartFlags::WRITE ). - setDescription( "Whether to disallow using pinned memory allocations for MPI communication buffers." ); + DomainPartition & domain = registerGroup< DomainPartition >( m_gks.domain ); + domain.registerGroup< constitutive::ConstitutiveManager >( m_gks.constitutiveManager ); + domain.groupKeys.constitutiveManager = m_gks.constitutiveManager.index(); + + registerGroup< ExternalDataSourceManager >( m_gks.externalDataSourceManager ); + registerGroup< FieldSpecificationManager >( m_gks.fieldSpecificationManager ); + registerGroup< EventManager >( m_gks.eventManager ); + registerGroup< NumericalMethodsManager >( m_gks.numericalMethodsManager ); + registerGroup< GeometricObjectManager >( m_gks.geometricObjectManager ); + registerGroup< MeshManager >( m_gks.meshManager ); + registerGroup< OutputManager >( m_gks.outputManager ); + registerGroup< PhysicsSolverManager >( m_gks.physicsSolverManager ); + registerGroup< TasksManager >( m_gks.tasksManager ); + registerGroup< FunctionManager >( m_gks.functionManager ); } ProblemManager::~ProblemManager() @@ -280,12 +297,12 @@ void ProblemManager::problemSetup() applyNumericalMethods(); numericalMethodLog.end(); - registerDataOnMeshRecursive( getDomainPartition().getMeshBodies() ); + registerDataOnMeshRecursive( getManager< DomainPartition >().getMeshBodies() ); initialize(); #ifdef GEOS_USE_HYPREDRV - logHypredriveInputs( *m_physicsSolverManager, getDomainPartition() ); + logHypredriveInputs( getManager< PhysicsSolverManager >(), getManager< DomainPartition >() ); #endif LogPart importFieldsLog( "Import fields", MpiWrapper::commRank() == 0 ); @@ -297,45 +314,29 @@ void ProblemManager::problemSetup() void ProblemManager::parseCommandLineInput() { - Group & commandLine = getGroup< Group >( groupKeys.commandLine ); - CommandLineOptions const & opts = getGlobalState().getCommandLineOptions(); - commandLine.getReference< string >( viewKeys.restartFileName ) = opts.restartFileName; - commandLine.getReference< integer >( viewKeys.beginFromRestart ) = opts.beginFromRestart; - commandLine.getReference< integer >( viewKeys.xPartitionsOverride ) = opts.xPartitionsOverride; - commandLine.getReference< integer >( viewKeys.yPartitionsOverride ) = opts.yPartitionsOverride; - commandLine.getReference< integer >( viewKeys.zPartitionsOverride ) = opts.zPartitionsOverride; - commandLine.getReference< integer >( viewKeys.overridePartitionNumbers ) = opts.overridePartitionNumbers; - commandLine.getReference< integer >( viewKeys.useNonblockingMPI ) = opts.useNonblockingMPI; - commandLine.getReference< integer >( viewKeys.suppressPinned ) = opts.suppressPinned; - - string & outputDirectory = commandLine.getReference< string >( viewKeys.outputDirectory ); - outputDirectory = opts.outputDirectory; - OutputBase::setOutputDirectory( outputDirectory ); - TaskBase::setOutputDirectory( outputDirectory ); - - string & inputFileName = commandLine.getReference< string >( viewKeys.inputFileName ); - - for( string const & xmlFile : opts.inputFileNames ) + string inputFileName = xmlWrapper::buildMultipleInputXML( opts.inputFileNames, + getName(), + opts.outputDirectory ); + if( opts.schemaName.empty()) { - string const absPath = getAbsolutePath( xmlFile ); - GEOS_LOG_RANK_0( "Opened XML file: " << absPath ); + inputFileName = getAbsolutePath( inputFileName ); + Path::setPathPrefix( splitPath( inputFileName ).first ); } - inputFileName = xmlWrapper::buildMultipleInputXML( opts.inputFileNames, outputDirectory ); + CommandLine & commandLine = getManager< CommandLine >(); + commandLine.setValues( opts, inputFileName.c_str() ); - string & schemaName = commandLine.getReference< string >( viewKeys.schemaFileName ); - schemaName = opts.schemaName; + OutputBase::setOutputDirectory( opts.outputDirectory ); + TaskBase::setOutputDirectory( opts.outputDirectory ); - string & problemName = commandLine.getReference< string >( viewKeys.problemName ); - problemName = opts.problemName; - OutputBase::setFileNameRoot( problemName ); + OutputBase::setFileNameRoot( opts.problemName ); - if( schemaName.empty()) + for( string const & xmlFile : opts.inputFileNames ) { - inputFileName = getAbsolutePath( inputFileName ); - Path::setPathPrefix( splitPath( inputFileName ).first ); + string const absPath = getAbsolutePath( xmlFile ); + GEOS_LOG_RANK_0( "Opened XML file: " << absPath ); } if( opts.traceDataMigration ) @@ -346,6 +347,7 @@ void ProblemManager::parseCommandLineInput() { chai::ArrayManager::getInstance()->disableCallbacks(); } + } @@ -394,16 +396,16 @@ void ProblemManager::generateDocumentation() { // Documentation output GEOS_LOG_RANK_0( "Trying to generate schema..." ); - Group & commandLine = getGroup< Group >( groupKeys.commandLine ); - string const & schemaName = commandLine.getReference< string >( viewKeys.schemaFileName ); + CommandLine const & commandLine = getManager< CommandLine >(); + string const & schemaName = commandLine.getReference< string >( commandLine.m_vks.schemaFileName ); if( !schemaName.empty() ) { // Generate an extensive data structure generateDataStructureSkeleton( 0 ); - MeshManager & meshManager = this->getGroup< MeshManager >( groupKeys.meshManager ); - DomainPartition & domain = getDomainPartition(); + MeshManager & meshManager = getManager< MeshManager >(); + DomainPartition & domain = getManager< DomainPartition >(); meshManager.generateMeshLevels( domain ); registerDataOnMeshRecursive( domain.getMeshBodies() ); @@ -431,18 +433,20 @@ void ProblemManager::setSchemaDeviations( xmlWrapper::xmlNode schemaRoot, // These objects are handled differently during the xml read step, // so we need to explicitly add them into the schema structure - DomainPartition & domain = getDomainPartition(); + DomainPartition & domain = getManager< DomainPartition >(); - m_functionManager->generateDataStructureSkeleton( 0 ); - schemaUtilities::SchemaConstruction( *m_functionManager, schemaRoot, targetChoiceNode, documentationType ); + FunctionManager & functionManager = getManager< FunctionManager >(); + functionManager.generateDataStructureSkeleton( 0 ); + schemaUtilities::SchemaConstruction( functionManager, schemaRoot, targetChoiceNode, documentationType ); - m_fieldSpecificationManager->generateDataStructureSkeleton( 0 ); - schemaUtilities::SchemaConstruction( *m_fieldSpecificationManager, schemaRoot, targetChoiceNode, documentationType ); + FieldSpecificationManager & fieldSpecificationManager = getManager< FieldSpecificationManager >(); + fieldSpecificationManager.generateDataStructureSkeleton( 0 ); + schemaUtilities::SchemaConstruction( fieldSpecificationManager, schemaRoot, targetChoiceNode, documentationType ); - ConstitutiveManager & constitutiveManager = domain.getGroup< ConstitutiveManager >( groupKeys.constitutiveManager ); + ConstitutiveManager & constitutiveManager = domain.getConstitutiveManager(); schemaUtilities::SchemaConstruction( constitutiveManager, schemaRoot, targetChoiceNode, documentationType ); - MeshManager & meshManager = this->getGroup< MeshManager >( groupKeys.meshManager ); + MeshManager & meshManager = getManager< MeshManager >(); meshManager.generateMeshLevels( domain ); ElementRegionManager & elementManager = domain.getMeshBody( 0 ).getBaseDiscretization().getElemManager(); elementManager.generateDataStructureSkeleton( 0 ); @@ -525,8 +529,8 @@ void ProblemManager::setSchemaDeviations( xmlWrapper::xmlNode schemaRoot, void ProblemManager::parseInputFile() { - Group & commandLine = getGroup( groupKeys.commandLine ); - string const & inputFileName = commandLine.getReference< string >( viewKeys.inputFileName ); + CommandLine const & commandLine = getManager< CommandLine >(); + string const & inputFileName = commandLine.getReference< string >( commandLine.m_vks.inputFileName ); // Load preprocessed xml file xmlWrapper::xmlDocument xmlDocument; @@ -560,13 +564,13 @@ void ProblemManager::parseXMLDocument( xmlWrapper::xmlDocument & xmlDocument ) // The objects in domain are handled separately for now { - DomainPartition & domain = getDomainPartition(); - ConstitutiveManager & constitutiveManager = domain.getGroup< ConstitutiveManager >( groupKeys.constitutiveManager ); + DomainPartition & domain = getManager< DomainPartition >(); + ConstitutiveManager & constitutiveManager = domain.getConstitutiveManager(); xmlWrapper::xmlNode topLevelNode = xmlProblemNode.child( constitutiveManager.getName().c_str()); constitutiveManager.processInputFileRecursive( xmlDocument, topLevelNode ); // Open mesh levels - MeshManager & meshManager = this->getGroup< MeshManager >( groupKeys.meshManager ); + MeshManager & meshManager = getManager< MeshManager >(); meshManager.generateMeshLevels( domain ); Group & meshBodies = domain.getMeshBodies(); @@ -618,17 +622,17 @@ void ProblemManager::parseXMLDocument( xmlWrapper::xmlDocument & xmlDocument ) void ProblemManager::postInputInitialization() { - DomainPartition & domain = getDomainPartition(); + DomainPartition & domain = getManager< DomainPartition >(); - Group const & commandLine = getGroup< Group >( groupKeys.commandLine ); - integer const & xparCL = commandLine.getReference< integer >( viewKeys.xPartitionsOverride ); - integer const & yparCL = commandLine.getReference< integer >( viewKeys.yPartitionsOverride ); - integer const & zparCL = commandLine.getReference< integer >( viewKeys.zPartitionsOverride ); + CommandLine const & commandLine = getManager< CommandLine >(); + integer const & xparCL = commandLine.getReference< integer >( commandLine.m_vks.xPartitionsOverride ); + integer const & yparCL = commandLine.getReference< integer >( commandLine.m_vks.yPartitionsOverride ); + integer const & zparCL = commandLine.getReference< integer >( commandLine.m_vks.zPartitionsOverride ); - integer const & suppressPinned = commandLine.getReference< integer >( viewKeys.suppressPinned ); + integer const & suppressPinned = commandLine.getReference< integer >( commandLine.m_vks.suppressPinned ); setPreferPinned((suppressPinned == 0)); - PartitionBase & partition = domain.getReference< PartitionBase >( keys::partitionManager ); + PartitionBase & partition = domain.getPartitionManager(); bool repartition = false; integer xpar = 1; integer ypar = 1; @@ -666,19 +670,19 @@ void ProblemManager::initializationOrder( string_array & order ) set< string > usedNames; // first, numerical methods - order.emplace_back( groupKeys.numericalMethodsManager.key() ); - usedNames.insert( groupKeys.numericalMethodsManager.key() ); + order.emplace_back( m_gks.numericalMethodsManager.key() ); + usedNames.insert( m_gks.numericalMethodsManager.key() ); // next, domain - order.emplace_back( groupKeys.domain.key() ); - usedNames.insert( groupKeys.domain.key() ); + order.emplace_back( m_gks.domain.key() ); + usedNames.insert( m_gks.domain.key() ); // next, events - order.emplace_back( groupKeys.eventManager.key() ); - usedNames.insert( groupKeys.eventManager.key() ); + order.emplace_back( m_gks.eventManager.key() ); + usedNames.insert( m_gks.eventManager.key() ); // (keeping outputs for the end) - usedNames.insert( groupKeys.outputManager.key() ); + usedNames.insert( m_gks.outputManager.key() ); // next, everything... for( auto const & subGroup : this->getSubGroups() ) @@ -690,16 +694,16 @@ void ProblemManager::initializationOrder( string_array & order ) } // end with outputs (in order to define the chunk sizes after any data source) - order.emplace_back( groupKeys.outputManager.key() ); + order.emplace_back( m_gks.outputManager.key() ); } void ProblemManager::generateMesh() { GEOS_MARK_FUNCTION; - DomainPartition & domain = getDomainPartition(); + DomainPartition & domain = getManager< DomainPartition >(); - MeshManager & meshManager = this->getGroup< MeshManager >( groupKeys.meshManager ); + MeshManager & meshManager = getManager< MeshManager >(); meshManager.generateMeshes( domain ); @@ -716,7 +720,7 @@ void ProblemManager::generateMesh() if( meshBody.hasParticles() ) // mesh bodies with particles load their data into particle blocks, not cell blocks { - ParticleBlockManagerABC & particleBlockManager = meshBody.getGroup< ParticleBlockManagerABC >( keys::particleManager ); + ParticleBlockManagerABC & particleBlockManager = meshBody.getParticleBlockManager(); this->generateMeshLevel( baseMesh, particleBlockManager, @@ -724,7 +728,7 @@ void ProblemManager::generateMesh() } else { - CellBlockManagerABC & cellBlockManager = meshBody.getGroup< CellBlockManagerABC >( keys::cellManager ); + CellBlockManagerABC & cellBlockManager = meshBody.getCellBlockManager(); this->generateMeshLevel( baseMesh, cellBlockManager, @@ -737,8 +741,8 @@ void ProblemManager::generateMesh() } } ); - Group const & commandLine = this->getGroup< Group >( groupKeys.commandLine ); - integer const useNonblockingMPI = commandLine.getReference< integer >( viewKeys.useNonblockingMPI ); + CommandLine const & commandLine = getManager< CommandLine >(); + integer const useNonblockingMPI = commandLine.getReference< integer >( commandLine.m_vks.useNonblockingMPI ); domain.setupBaseLevelMeshGlobalInfo(); // setup the MeshLevel associated with the discretizations @@ -827,13 +831,12 @@ void ProblemManager::generateMesh() domain.forMeshBodies( [&]( MeshBody & meshBody ) { - if( meshBody.hasGroup( keys::particleManager ) ) + if( meshBody.hasParticleBlockManager() ) { - meshBody.deregisterGroup( keys::particleManager ); + meshBody.deregisterParticleBlockManager(); } - else if( meshBody.hasGroup( keys::cellManager ) ) + else if( meshBody.hasCellBlockManager() ) { - // meshBody.deregisterGroup( keys::cellManager ); meshBody.deregisterCellBlockManager(); } @@ -874,16 +877,16 @@ void ProblemManager::generateMesh() void ProblemManager::importFields() { GEOS_MARK_FUNCTION; - DomainPartition & domain = getDomainPartition(); - MeshManager & meshManager = this->getGroup< MeshManager >( groupKeys.meshManager ); + DomainPartition & domain = getManager< DomainPartition >(); + MeshManager & meshManager = getManager< MeshManager >(); meshManager.importFields( domain ); } void ProblemManager::applyNumericalMethods() { - DomainPartition & domain = getDomainPartition(); - ConstitutiveManager & constitutiveManager = domain.getGroup< ConstitutiveManager >( groupKeys.constitutiveManager ); + DomainPartition & domain = getManager< DomainPartition >(); + ConstitutiveManager & constitutiveManager = domain.getConstitutiveManager(); Group & meshBodies = domain.getMeshBodies(); // this contains a key tuple< mesh body name, mesh level name, region name, subregion name> with a value of the number of quadrature @@ -896,13 +899,13 @@ void ProblemManager::applyNumericalMethods() map< std::pair< string, Group const * const >, string_array const & > -ProblemManager::getDiscretizations() const +ProblemManager::getDiscretizations() { map< std::pair< string, Group const * const >, string_array const & > meshDiscretizations; NumericalMethodsManager const & - numericalMethodManager = getGroup< NumericalMethodsManager >( groupKeys.numericalMethodsManager.key() ); + numericalMethodManager = getManager< NumericalMethodsManager >(); FiniteElementDiscretizationManager const & feDiscretizationManager = numericalMethodManager.getFiniteElementDiscretizationManager(); @@ -910,10 +913,12 @@ ProblemManager::getDiscretizations() const FiniteVolumeManager const & fvDiscretizationManager = numericalMethodManager.getFiniteVolumeManager(); - DomainPartition const & domain = getDomainPartition(); + DomainPartition const & domain = getManager< DomainPartition >(); Group const & meshBodies = domain.getMeshBodies(); - m_physicsSolverManager->forSubGroups< PhysicsSolverBase >( [&]( PhysicsSolverBase & solver ) + PhysicsSolverManager & physicsSolverManager = getManager< PhysicsSolverManager >(); + + physicsSolverManager.forSubGroups< PhysicsSolverBase >( [&]( PhysicsSolverBase & solver ) { solver.generateMeshTargetsFromTargetRegions( meshBodies ); @@ -981,7 +986,7 @@ void ProblemManager::generateMeshLevel( MeshLevel & meshLevel, nodeManager.constructGlobalToLocalMap( cellBlockManager ); // Edge, face and element region managers rely on the sets provided by the node manager. // This is why `nodeManager.buildSets` is called first. - nodeManager.buildSets( cellBlockManager, this->getGroup< GeometricObjectManager >( groupKeys.geometricObjectManager ) ); + nodeManager.buildSets( cellBlockManager, getManager< GeometricObjectManager >() ); edgeManager.buildSets( nodeManager ); faceManager.buildSets( nodeManager ); elemRegionManager.buildSets( nodeManager ); @@ -1051,17 +1056,19 @@ void ProblemManager::generateMeshLevel( MeshLevel & meshLevel, } -map< std::tuple< string, string, string, string >, localIndex > ProblemManager::calculateRegionQuadrature( Group & meshBodies ) +map< std::tuple< string, string, string, string >, localIndex > +ProblemManager::calculateRegionQuadrature( Group & meshBodies ) { - NumericalMethodsManager const & - numericalMethodManager = getGroup< NumericalMethodsManager >( groupKeys.numericalMethodsManager.key() ); + NumericalMethodsManager const & numericalMethodManager = getManager< NumericalMethodsManager >(); + + PhysicsSolverManager & physicsSolverManager = getManager< PhysicsSolverManager >(); map< std::tuple< string, string, string, string >, localIndex > regionQuadrature; - for( localIndex solverIndex=0; solverIndexnumSubGroups(); ++solverIndex ) + for( localIndex solverIndex=0; solverIndexgetGroupPointer< PhysicsSolverBase >( solverIndex ); + PhysicsSolverBase const * const solver = physicsSolverManager.getGroupPointer< PhysicsSolverBase >( solverIndex ); if( solver != nullptr ) { @@ -1267,36 +1274,51 @@ void ProblemManager::setRegionQuadrature( Group & meshBodies, bool ProblemManager::runSimulation() { - return m_eventManager->run( getDomainPartition() ); + return getManager< EventManager >().run( getManager< DomainPartition >() ); +} + +string const & ProblemManager::getProblemName() const +{ + CommandLine const & commandLine = getManager< CommandLine >(); + return commandLine.getReference< string >( commandLine.m_vks.problemName ); +} + +string const & ProblemManager::getInputFileName() const +{ + CommandLine const & commandLine = getManager< CommandLine >(); + return commandLine.getReference< string >( commandLine.m_vks.inputFileName ); } -DomainPartition & ProblemManager::getDomainPartition() +string const & ProblemManager::getRestartFileName() const { - return getGroup< DomainPartition >( groupKeys.domain ); + CommandLine const & commandLine = getManager< CommandLine >(); + return commandLine.getReference< string >( commandLine.m_vks.restartFileName ); } -DomainPartition const & ProblemManager::getDomainPartition() const +string const & ProblemManager::getSchemaFileName() const { - return getGroup< DomainPartition >( groupKeys.domain ); + CommandLine const & commandLine = getManager< CommandLine >(); + return commandLine.getReference< string >( commandLine.m_vks.schemaFileName ); } void ProblemManager::applyInitialConditions() { + FieldSpecificationManager & fsManager = getManager< FieldSpecificationManager >(); - m_fieldSpecificationManager->forSubGroups< FieldSpecification >( [&]( FieldSpecification & fs ) + fsManager.forSubGroups< FieldSpecification >( [&]( FieldSpecification & fs ) { - fs.setMeshObjectPath( getDomainPartition().getMeshBodies() ); + fs.setMeshObjectPath( getManager< DomainPartition >().getMeshBodies() ); } ); - getDomainPartition().forMeshBodies( [&] ( MeshBody & meshBody ) + getManager< DomainPartition >().forMeshBodies( [&] ( MeshBody & meshBody ) { meshBody.forMeshLevels( [&] ( MeshLevel & meshLevel ) { if( !meshLevel.isShallowCopy() ) // to avoid messages printed three times { - m_fieldSpecificationManager->validateBoundaryConditions( meshLevel ); + fsManager.validateBoundaryConditions( meshLevel ); } - m_fieldSpecificationManager->applyInitialConditions( meshLevel ); + fsManager.applyInitialConditions( meshLevel ); } ); } ); initializePostInitialConditions(); diff --git a/src/coreComponents/mainInterface/ProblemManager.hpp b/src/coreComponents/mainInterface/ProblemManager.hpp index 447ac419885..190342f3f47 100644 --- a/src/coreComponents/mainInterface/ProblemManager.hpp +++ b/src/coreComponents/mainInterface/ProblemManager.hpp @@ -21,33 +21,89 @@ #ifndef GEOS_MAININTERFACE_PROBLEMMANAGER_HPP_ #define GEOS_MAININTERFACE_PROBLEMMANAGER_HPP_ -#include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" +#include "common/initializeEnvironment.hpp" + +// for helper functions +#include "physicsSolvers/PhysicsSolverManager.hpp" +#include "functions/FunctionManager.hpp" +#include "fieldSpecification/FieldSpecificationManager.hpp" +#include "events/EventManager.hpp" +#include "events/tasks/TasksManager.hpp" +#include "discretizationMethods/NumericalMethodsManager.hpp" +#include "mesh/MeshManager.hpp" +#include "fileIO/Outputs/OutputManager.hpp" +#include "mesh/simpleGeometricObjects/GeometricObjectManager.hpp" +#include "constitutive/ConstitutiveManager.hpp" namespace geos { -class PhysicsSolverManager; -class DomainPartition; -class GeometricObjectManager; -class FiniteElementDiscretization; -class MeshLevel; -namespace constitutive +/** + * @brief A Group to contain the command line options within the data-repository + */ +class CommandLine : public dataRepository::Group { -class ConstitutiveManager; -} -class EventManager; -class TasksManager; -class FunctionManager; -class FieldSpecificationManager; -struct CommandLineOptions; -class CellBlockManagerABC; -class ParticleBlockManagerABC; +public: + + /// @cond DO_NOT_DOCUMENT + + struct viewKeysStruct + { + dataRepository::ViewKey inputFileName = {"inputFileName"}; ///< Input file name key + dataRepository::ViewKey restartFileName = {"restartFileName"}; ///< Restart file name key + dataRepository::ViewKey beginFromRestart = {"beginFromRestart"}; ///< Flag to begin from restart key + dataRepository::ViewKey xPartitionsOverride = {"xPartitionsOverride"}; ///< Override of number of + ///< subdivisions in x key + dataRepository::ViewKey yPartitionsOverride = {"yPartitionsOverride"}; ///< Override of number of + ///< subdivisions in y key + dataRepository::ViewKey zPartitionsOverride = {"zPartitionsOverride"}; ///< Override of number of + ///< subdivisions in z key + dataRepository::ViewKey overridePartitionNumbers = {"overridePartitionNumbers"}; ///< Flag to override partitioning + ///< key + dataRepository::ViewKey schemaFileName = {"schemaFileName"}; ///< Schema file name key + dataRepository::ViewKey problemName = {"problemName"}; ///< Problem name key + dataRepository::ViewKey outputDirectory = {"outputDirectory"}; ///< Output directory key + dataRepository::ViewKey useNonblockingMPI = {"useNonblockingMPI"}; ///< Flag to use non-block MPI key + dataRepository::ViewKey suppressPinned = {"suppressPinned"}; ///< Flag to suppress use of pinned + ///< memory key + } m_vks; ///< Command line input viewKeys + + /// @endcond + + /** + * @brief Construct a new CommandLine Group to contain the command line options within the data-repository. + * @param name + * @param parent + */ + CommandLine( string const & name, Group * parent ); + + /** + * @brief Setup all the command line Group values from the provided inputs + * @param options provided input options + * @param inputFileName final composed main input filename (returned by `xmlWrapper::buildMultipleInputXML()`) + */ + void setValues( CommandLineOptions const & options, + string_view inputFileName ); + +}; + +// CommandLine Group is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline CommandLine & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< CommandLine >( m_gks.commandLine ); } + +// CommandLine Group is available through the ProblemRepository as a const problem-unique manager. +template<> inline CommandLine const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< CommandLine >( m_gks.commandLine ); } + +namespace constitutive +{ class ConstitutiveManager; } /** * @class ProblemManager * @brief This is the class handling the operation flow of the problem being ran in GEOS */ -class ProblemManager : public dataRepository::Group +class ProblemManager : public dataRepository::Group, public dataRepository::ProblemRepository { public: @@ -172,159 +228,110 @@ class ProblemManager : public dataRepository::Group */ void applyInitialConditions(); - /** - * @brief Returns a pointer to the DomainPartition - * @return Pointer to the DomainPartition - */ - DomainPartition & getDomainPartition(); - - /** - * @brief Returns a pointer to the DomainPartition - * @return Const pointer to the DomainPartition - */ - DomainPartition const & getDomainPartition() const; - /** * @brief Returns the problem name * @return The problem name */ - string const & getProblemName() const - { return getGroup< Group >( groupKeys.commandLine ).getReference< string >( viewKeys.problemName ); } + string const & getProblemName() const; /** * @brief Returns the input file name * @return The input file name */ - string const & getInputFileName() const - { return getGroup< Group >( groupKeys.commandLine ).getReference< string >( viewKeys.inputFileName ); } + string const & getInputFileName() const; /** * @brief Returns the restart file name * @return The restart file name */ - string const & getRestartFileName() const - { return getGroup< Group >( groupKeys.commandLine ).getReference< string >( viewKeys.restartFileName ); } + string const & getRestartFileName() const; /** * @brief Returns the schema file name * @return The schema file name */ - string const & getSchemaFileName() const - { return getGroup< Group >( groupKeys.commandLine ).getReference< string >( viewKeys.schemaFileName ); } - - /// Command line input viewKeys - struct viewKeysStruct - { - dataRepository::ViewKey inputFileName = {"inputFileName"}; ///< Input file name key - dataRepository::ViewKey restartFileName = {"restartFileName"}; ///< Restart file name key - dataRepository::ViewKey beginFromRestart = {"beginFromRestart"}; ///< Flag to begin from restart key - dataRepository::ViewKey xPartitionsOverride = {"xPartitionsOverride"}; ///< Override of number of - ///< subdivisions in x key - dataRepository::ViewKey yPartitionsOverride = {"yPartitionsOverride"}; ///< Override of number of - ///< subdivisions in y key - dataRepository::ViewKey zPartitionsOverride = {"zPartitionsOverride"}; ///< Override of number of - ///< subdivisions in z key - dataRepository::ViewKey overridePartitionNumbers = {"overridePartitionNumbers"}; ///< Flag to override partitioning - ///< key - dataRepository::ViewKey schemaFileName = {"schemaFileName"}; ///< Schema file name key - dataRepository::ViewKey problemName = {"problemName"}; ///< Problem name key - dataRepository::ViewKey outputDirectory = {"outputDirectory"}; ///< Output directory key - dataRepository::ViewKey useNonblockingMPI = {"useNonblockingMPI"}; ///< Flag to use non-block MPI key - dataRepository::ViewKey suppressPinned = {"suppressPinned"}; ///< Flag to suppress use of pinned - ///< memory key - } viewKeys; ///< Command line input viewKeys - - /// Child group viewKeys - struct groupKeysStruct - { - /// @return Numerical methods string - static constexpr char const * numericalMethodsManagerString() { return "NumericalMethods"; } - dataRepository::GroupKey commandLine = { "commandLine" }; ///< Command line key - dataRepository::GroupKey constitutiveManager = { "Constitutive" }; ///< Constitutive key - dataRepository::GroupKey domain = { "domain" }; ///< Domain key - dataRepository::GroupKey eventManager = { "Events" }; ///< Events key - dataRepository::GroupKey externalDataSourceManager = { "ExternalDataSource" }; ///< External Data Source key - dataRepository::GroupKey fieldSpecificationManager = { "FieldSpecifications" }; ///< Field specification key - dataRepository::GroupKey functionManager = { "Functions" }; ///< Functions key - dataRepository::GroupKey geometricObjectManager = { "Geometry" }; ///< Geometry key - dataRepository::GroupKey meshManager = { "Mesh" }; ///< Mesh key - dataRepository::GroupKey numericalMethodsManager = { numericalMethodsManagerString() }; ///< Numerical methods key - dataRepository::GroupKey outputManager = { "Outputs" }; ///< Outputs key - dataRepository::GroupKey physicsSolverManager = { "Solvers" }; ///< Solvers key - dataRepository::GroupKey tasksManager = { "Tasks" }; ///< Tasks key - } groupKeys; ///< Child group viewKeys + string const & getSchemaFileName() const; /** - * @brief Returns the PhysicsSolverManager - * @return Reference to the PhysicsSolverManager + * @name Managers access-helper functions for tests */ + ///@{ + /// @cond DO_NOT_DOCUMENT + + CommandLine & getCommandLine() + { return getManager< CommandLine >(); } + + CommandLine const & getCommandLine() const + { return getManager< CommandLine >(); } + + DomainPartition & getDomainPartition() + { return getManager< DomainPartition >(); } + + DomainPartition const & getDomainPartition() const + { return getManager< DomainPartition >(); } + PhysicsSolverManager & getPhysicsSolverManager() - { - return *m_physicsSolverManager; - } + { return getManager< PhysicsSolverManager >(); } - /** - * @brief Returns the PhysicsSolverManager - * @return Const reference to the PhysicsSolverManager - */ PhysicsSolverManager const & getPhysicsSolverManager() const - { - return *m_physicsSolverManager; - } + { return getManager< PhysicsSolverManager >(); } - /** - * @brief Returns the FunctionManager. - * @return The FunctionManager. - */ FunctionManager & getFunctionManager() - { - GEOS_ERROR_IF( m_functionManager == nullptr, "Not initialized." ); - return *m_functionManager; - } + { return getManager< FunctionManager >(); } - /** - * @brief Returns the const FunctionManager. - * @return The const FunctionManager. - */ FunctionManager const & getFunctionManager() const - { - GEOS_ERROR_IF( m_functionManager == nullptr, "Not initialized." ); - return *m_functionManager; - } + { return getManager< FunctionManager >(); } - /** - * @brief Returns the FieldSpecificationManager. - * @return The FieldSpecificationManager. - */ FieldSpecificationManager & getFieldSpecificationManager() - { - GEOS_ERROR_IF( m_fieldSpecificationManager == nullptr, "Not initialized." ); - return *m_fieldSpecificationManager; - } + { return getManager< FieldSpecificationManager >(); } - /** - * @brief Returns the const FunctionManager. - * @return The const FunctionManager. - */ FieldSpecificationManager const & getFieldSpecificationManager() const - { - GEOS_ERROR_IF( m_fieldSpecificationManager == nullptr, "Not initialized." ); - return *m_fieldSpecificationManager; - } + { return getManager< FieldSpecificationManager >(); } - /** - * @brief Returns the EventManager. - * @return The EventManager. - */ EventManager & getEventManager() - {return *m_eventManager;} + { return getManager< EventManager >(); } + + EventManager const & getEventManager() const + { return getManager< EventManager >(); } - /** - * @brief Returns the TasksManager. - * @return The TasksManager. - */ TasksManager & getTasksManager() - {return *m_tasksManager;} + { return getManager< TasksManager >(); } + + TasksManager const & getTasksManager() const + { return getManager< TasksManager >(); } + + NumericalMethodsManager & getNumericalMethodsManager() + { return getManager< NumericalMethodsManager >(); } + + NumericalMethodsManager const & getNumericalMethodsManager() const + { return getManager< NumericalMethodsManager >(); } + + MeshManager & getMeshManager() + { return getManager< MeshManager >(); } + + MeshManager const & getMeshManager() const + { return getManager< MeshManager >(); } + + OutputManager & getOutputManager() + { return getManager< OutputManager >(); } + + OutputManager const & getOutputManager() const + { return getManager< OutputManager >(); } + + GeometricObjectManager & getGeometricObjectManager() + { return getManager< GeometricObjectManager >(); } + + GeometricObjectManager const & getGeometricObjectManager() const + { return getManager< GeometricObjectManager >(); } + + constitutive::ConstitutiveManager & getConstitutiveManager() + { return getManager< constitutive::ConstitutiveManager >(); } + + constitutive::ConstitutiveManager const & getConstitutiveManager() const + { return getManager< constitutive::ConstitutiveManager >(); } + + /// @endcond + ///@} protected: /** @@ -347,8 +354,7 @@ class ProblemManager : public dataRepository::Group map< std::tuple< string, string, string, string >, localIndex > calculateRegionQuadrature( Group & meshBodies ); - map< std::pair< string, Group const * const >, string_array const & > - getDiscretizations() const; + map< std::pair< string, Group const * const >, string_array const & > getDiscretizations(); void generateMeshLevel( MeshLevel & meshLevel, CellBlockManagerABC const & cellBlockManager, @@ -371,20 +377,6 @@ class ProblemManager : public dataRepository::Group constitutive::ConstitutiveManager const & constitutiveManager, map< std::tuple< string, string, string, string >, localIndex > const & regionQuadrature ); - /// The PhysicsSolverManager - PhysicsSolverManager * m_physicsSolverManager; - - /// The EventManager - EventManager * m_eventManager; - - /// The TasksManager - TasksManager * m_tasksManager; - - /// The FunctionManager - FunctionManager * m_functionManager; - - /// The FieldSpecificationManager - FieldSpecificationManager * m_fieldSpecificationManager; }; } /* namespace geos */ diff --git a/src/coreComponents/mesh/DomainPartition.cpp b/src/coreComponents/mesh/DomainPartition.cpp index 943c6366974..2ad00414fcc 100644 --- a/src/coreComponents/mesh/DomainPartition.cpp +++ b/src/coreComponents/mesh/DomainPartition.cpp @@ -18,10 +18,10 @@ */ #include "DomainPartition.hpp" + #include "common/format/table/TableData.hpp" #include "common/format/table/TableFormatter.hpp" #include "common/format/table/TableLayout.hpp" - #include "common/DataTypes.hpp" #include "common/TimingMacros.hpp" #include "constitutive/ConstitutiveManager.hpp" @@ -43,31 +43,31 @@ DomainPartition::DomainPartition( string const & name, setRestartFlags( RestartFlags::NO_WRITE ). setSizedFromParent( false ); - this->registerWrapper< SpatialPartition, PartitionBase >( keys::partitionManager ). + this->registerWrapper< SpatialPartition, PartitionBase >( m_vks.partitionManager ). setRestartFlags( RestartFlags::NO_WRITE ). setSizedFromParent( false ); registerGroup( groupKeys.meshBodies ); - registerGroup< constitutive::ConstitutiveManager >( groupKeys.constitutiveManager ); addLogLevel< logInfo::PartitionCommunication >(); } - DomainPartition::~DomainPartition() {} void DomainPartition::initializationOrder( string_array & order ) { + constitutive::ConstitutiveManager const & constitutiveManager = getConstitutiveManager(); + set< string > usedNames; { - order.emplace_back( string( groupKeysStruct::constitutiveManagerString() ) ); - usedNames.insert( groupKeysStruct::constitutiveManagerString() ); + order.emplace_back( string( constitutiveManager.getName() ) ); + usedNames.insert( constitutiveManager.getName() ); } { - order.emplace_back( string( groupKeysStruct::meshBodiesString() ) ); - usedNames.insert( groupKeysStruct::meshBodiesString() ); + order.emplace_back( groupKeys.meshBodies.key() ); + usedNames.insert( groupKeys.meshBodies.key() ); } @@ -85,7 +85,7 @@ void DomainPartition::setupBaseLevelMeshGlobalInfo() GEOS_MARK_FUNCTION; #if defined(GEOS_USE_MPI) - PartitionBase & partition1 = getReference< PartitionBase >( keys::partitionManager ); + PartitionBase & partition1 = getPartitionManager(); SpatialPartition & partition = dynamic_cast< SpatialPartition & >(partition1); const std::set< int > metisNeighborList = partition.getMetisNeighborList(); @@ -279,7 +279,7 @@ void DomainPartition::addNeighbors( const unsigned int idim, MPI_Comm & cartcomm, int * ncoords ) { - PartitionBase & partition1 = getReference< PartitionBase >( keys::partitionManager ); + PartitionBase & partition1 = getPartitionManager(); SpatialPartition & partition = dynamic_cast< SpatialPartition & >(partition1); if( idim == partition.m_nsdof ) @@ -522,4 +522,10 @@ void DomainPartition::outputPartitionInformation() const } +PartitionBase & DomainPartition::getPartitionManager() +{ return this->getReference< PartitionBase >( m_vks.partitionManager ); } + +PartitionBase const & DomainPartition::getPartitionManager() const +{ return this->getReference< PartitionBase >( m_vks.partitionManager ); } + } /* namespace geos */ diff --git a/src/coreComponents/mesh/DomainPartition.hpp b/src/coreComponents/mesh/DomainPartition.hpp index 870ad00bec2..3a4d4a93cc8 100644 --- a/src/coreComponents/mesh/DomainPartition.hpp +++ b/src/coreComponents/mesh/DomainPartition.hpp @@ -23,6 +23,7 @@ #include "common/MpiWrapper.hpp" #include "constitutive/ConstitutiveManager.hpp" #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "discretizationMethods/NumericalMethodsManager.hpp" #include "mesh/MeshBody.hpp" #include "mesh/mpiCommunications/NeighborCommunicator.hpp" @@ -31,15 +32,6 @@ namespace geos { class SiloFile; -namespace dataRepository -{ -namespace keys -{ -/// @return PartitionManager string key -string const partitionManager( "partitionManager" ); -} -} - class ObjectManagerBase; class PartitionBase; @@ -124,24 +116,23 @@ class DomainPartition : public dataRepository::Group ///@} + /** + * @brief struct to serve as a container for wrapper accesses + */ + struct viewKeyStruct + { + dataRepository::ViewKey partitionManager = { "partitionManager" }; + } m_vks; /** - * @brief struct to serve as a container for group strings and keys - * @struct groupKeysStruct + * @brief struct to serve as a container for group accesses */ struct groupKeysStruct { - /// @return String key to the Group holding the MeshBodies - static constexpr char const * meshBodiesString() { return "MeshBodies"; } - /// @return String key to the Group holding the ConstitutiveManager - static constexpr char const * constitutiveManagerString() { return "Constitutive"; } - /// View key to the Group holding the MeshBodies - dataRepository::GroupKey meshBodies = { meshBodiesString() }; + dataRepository::GroupKey meshBodies = { "MeshBodies" }; /// View key to the Group holding the ConstitutiveManager - dataRepository::GroupKey constitutiveManager = { constitutiveManagerString() }; - /// View key to the Group holding the CommunicationManager - dataRepository::GroupKey communicationManager = { "communicationManager" }; + dataRepository::GroupKey::index_type constitutiveManager; } /// groupKey struct for the DomainPartition class groupKeys; @@ -164,13 +155,23 @@ class DomainPartition : public dataRepository::Group * @brief @return Return a reference to const NumericalMethodsManager from ProblemManager */ NumericalMethodsManager const & getNumericalMethodManager() const - { return this->getParent().getGroup< NumericalMethodsManager >( "NumericalMethods" ); } + { return dataRepository::ProblemRepository::getManager< NumericalMethodsManager >( *this ); } /** * @brief @return Return a reference to NumericalMethodsManager from ProblemManager */ NumericalMethodsManager & getNumericalMethodManager() - { return this->getParent().getGroup< NumericalMethodsManager >( "NumericalMethods" ); } + { return dataRepository::ProblemRepository::getManager< NumericalMethodsManager >( *this ); } + + /** + * @return Get the global partition. + */ + PartitionBase & getPartitionManager(); + + /** + * @return Get the global partition. + */ + PartitionBase const & getPartitionManager() const; /** * @brief Get the mesh bodies, const version. @@ -297,6 +298,14 @@ class DomainPartition : public dataRepository::Group stdVector< NeighborCommunicator > m_neighbors; }; +// DomainPartition Group is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline DomainPartition & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< DomainPartition >( m_gks.domain ); } + +// DomainPartition Group is available through the ProblemRepository as a const problem-unique manager. +template<> inline DomainPartition const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< DomainPartition >( m_gks.domain ); } + } /* namespace geos */ #endif /* GEOS_MESH_DOMAINPARTITION_HPP_ */ diff --git a/src/coreComponents/mesh/ExternalDataSourceManager.hpp b/src/coreComponents/mesh/ExternalDataSourceManager.hpp index 28ccecb2fc1..c6fb2d207a1 100644 --- a/src/coreComponents/mesh/ExternalDataSourceManager.hpp +++ b/src/coreComponents/mesh/ExternalDataSourceManager.hpp @@ -71,6 +71,14 @@ class ExternalDataSourceManager : public dataRepository::Group }; +// ExternalDataSourceManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline ExternalDataSourceManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< ExternalDataSourceManager >( m_gks.externalDataSourceManager ); } + +// ExternalDataSourceManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline ExternalDataSourceManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< ExternalDataSourceManager >( m_gks.externalDataSourceManager ); } + } /* namespace geos */ #endif /* GEOS_MESH_EXTERNALDATASOURCEMANAGER_HPP_ */ diff --git a/src/coreComponents/mesh/MeshBody.cpp b/src/coreComponents/mesh/MeshBody.cpp index 17d558f0fb7..d8d9a686dd2 100644 --- a/src/coreComponents/mesh/MeshBody.cpp +++ b/src/coreComponents/mesh/MeshBody.cpp @@ -51,6 +51,7 @@ MeshLevel & MeshBody::createMeshLevel( string const & sourceLevelName, return m_meshLevels.registerGroup( newLevelName, std::make_unique< MeshLevel >( newLevelName, this, + getCellBlockManager(), sourceMeshLevel, order ) ); } diff --git a/src/coreComponents/mesh/MeshBody.hpp b/src/coreComponents/mesh/MeshBody.hpp index a8f8cbe70af..33a4db11993 100644 --- a/src/coreComponents/mesh/MeshBody.hpp +++ b/src/coreComponents/mesh/MeshBody.hpp @@ -21,7 +21,6 @@ #define GEOS_MESH_MESHBODY_HPP_ #include "MeshLevel.hpp" -#include "dataRepository/KeyNames.hpp" namespace geos { @@ -188,17 +187,52 @@ class MeshBody : public dataRepository::Group * @return The CellBlockManager. */ CellBlockManagerABC const & getCellBlockManager() const - { - return this->getGroup< CellBlockManagerABC >( dataRepository::keys::cellManager ); - } + { return this->getGroup< CellBlockManagerABC >( groupStructKeys::cellManagerString() ); } + + /** + * @return True if a cell-block manager is registered. + */ + bool hasCellBlockManager() const + { return this->hasGroup( groupStructKeys::cellManagerString() ); } + + /** + * @brief Get the Abstract representation of the CellBlockManager attached to the MeshBody. + * @return The CellBlockManager. + */ + CellBlockManagerABC & getCellBlockManager() + { return this->getGroup< CellBlockManagerABC >( groupStructKeys::cellManagerString() ); } + + /** + * @brief Get the Abstract representation of the ParticleBlockManager attached to the MeshBody. + * @return The ParticleBlockManager. + */ + ParticleBlockManagerABC const & getParticleBlockManager() const + { return this->getGroup< ParticleBlockManagerABC >( groupStructKeys::particleManagerString() ); } + + /** + * @return True if a particle-block manager is registered. + */ + bool hasParticleBlockManager() const + { return this->hasGroup( groupStructKeys::particleManagerString() ); } + + /** + * @brief Get the Abstract representation of the ParticleBlockManager attached to the MeshBody. + * @return The ParticleBlockManager. + */ + ParticleBlockManagerABC & getParticleBlockManager() + { return this->getGroup< ParticleBlockManagerABC >( groupStructKeys::particleManagerString() ); } /** * @brief De register the CellBlockManager from this meshBody */ void deregisterCellBlockManager() - { - this->deregisterGroup( dataRepository::keys::cellManager ); - } + { this->deregisterGroup( groupStructKeys::cellManagerString() ); } + + /** + * @brief De register the CellBlockManager from this meshBody + */ + void deregisterParticleBlockManager() + { this->deregisterGroup( groupStructKeys::particleManagerString() ); } /** * @brief Data repository keys @@ -213,9 +247,17 @@ class MeshBody : public dataRepository::Group { /// @return The key/string used to register/access the Group that contains the MeshLevel objects. static constexpr char const * meshLevelsString() { return "meshLevels"; } - /// @return The key/string used to register/access the Group that contains the base discretization. static constexpr char const * baseDiscretizationString() { return "Level0"; } + /// @return the key/string used to register/access the cell block manager + static constexpr char const * cellManagerString() { return "cellManager"; } + /// @return the key/string used to register/access the particle block manager + static constexpr char const * particleManagerString() { return "particleManager"; } + + dataRepository::GroupKey meshLevels = { meshLevelsString() }; + dataRepository::GroupKey baseDiscretization = { baseDiscretizationString() }; + dataRepository::GroupKey cellManager = { cellManagerString() }; + dataRepository::GroupKey particleManager = { particleManagerString() }; } groupKeys; ///< groupKeys diff --git a/src/coreComponents/mesh/MeshLevel.cpp b/src/coreComponents/mesh/MeshLevel.cpp index bd288c826c4..da7e8974a7f 100644 --- a/src/coreComponents/mesh/MeshLevel.cpp +++ b/src/coreComponents/mesh/MeshLevel.cpp @@ -111,6 +111,7 @@ MeshLevel::MeshLevel( string const & name, MeshLevel::MeshLevel( string const & name, Group * const meshBody, + CellBlockManagerABC & cellBlockManager, MeshLevel const & source, int const order ): MeshLevel( name, meshBody ) @@ -244,8 +245,6 @@ MeshLevel::MeshLevel( string const & name, } ); - CellBlockManagerABC & cellBlockManager = meshBody->getGroup< CellBlockManagerABC >( keys::cellManager ); - cellBlockManager.generateHighOrderMaps( order, maxVertexGlobalID, maxEdgeGlobalID, diff --git a/src/coreComponents/mesh/MeshLevel.hpp b/src/coreComponents/mesh/MeshLevel.hpp index 085ab9519ee..9850a8c246e 100644 --- a/src/coreComponents/mesh/MeshLevel.hpp +++ b/src/coreComponents/mesh/MeshLevel.hpp @@ -66,11 +66,13 @@ class MeshLevel : public dataRepository::Group * @brief Constructor for the MeshLevel object. * @param[in] name the name of the MeshLevel object in the repository * @param[in] parent the parent group of the MeshLevel object being constructed + * @param[in] cellBlockManager the cellBlockManager of the destination MeshBody * @param[in] source The source MeshLevel to build the new one from * @param[in] order The order of the MeshLevel */ MeshLevel( string const & name, Group * const parent, + CellBlockManagerABC & cellBlockManager, MeshLevel const & source, int const order ); diff --git a/src/coreComponents/mesh/MeshManager.cpp b/src/coreComponents/mesh/MeshManager.cpp index 2a67aa8db22..431c4664753 100644 --- a/src/coreComponents/mesh/MeshManager.cpp +++ b/src/coreComponents/mesh/MeshManager.cpp @@ -68,7 +68,7 @@ void MeshManager::generateMeshes( DomainPartition & domain ) { MeshBody & meshBody = domain.getMeshBodies().registerGroup< MeshBody >( meshGen.getName() ); meshBody.createMeshLevel( 0 ); - SpatialPartition & partition = dynamic_cast< SpatialPartition & >(domain.getReference< PartitionBase >( keys::partitionManager ) ); + SpatialPartition & partition = dynamic_cast< SpatialPartition & >( domain.getPartitionManager() ); meshGen.generateMesh( meshBody, partition ); diff --git a/src/coreComponents/mesh/MeshManager.hpp b/src/coreComponents/mesh/MeshManager.hpp index 886d85692d8..0be3db4d167 100644 --- a/src/coreComponents/mesh/MeshManager.hpp +++ b/src/coreComponents/mesh/MeshManager.hpp @@ -100,6 +100,14 @@ class MeshManager : public dataRepository::Group }; +// MeshManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline MeshManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< MeshManager >( m_gks.meshManager ); } + +// MeshManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline MeshManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< MeshManager >( m_gks.meshManager ); } + } /* namespace geos */ #endif /* GEOS_MESH_MESHMANAGER_HPP_ */ diff --git a/src/coreComponents/mesh/generators/MeshGeneratorBase.cpp b/src/coreComponents/mesh/generators/MeshGeneratorBase.cpp index 6f6516d7de0..72d5eb54c9e 100644 --- a/src/coreComponents/mesh/generators/MeshGeneratorBase.cpp +++ b/src/coreComponents/mesh/generators/MeshGeneratorBase.cpp @@ -78,7 +78,8 @@ void MeshGeneratorBase::generateMesh( Group & parent, SpatialPartition & partiti MeshBody & meshBody = dynamic_cast< MeshBody & >( parent ); if( meshBody.hasParticles() ) { - ParticleBlockManager & particleBlockManager = parent.registerGroup< ParticleBlockManager >( keys::particleManager ); + ParticleBlockManager & particleBlockManager = + parent.registerGroup< ParticleBlockManager >( MeshBody::groupStructKeys::particleManagerString() ); MeshLevel & meshLevel0 = meshBody.getBaseDiscretization(); ParticleManager & particleManager = meshLevel0.getParticleManager(); @@ -87,7 +88,8 @@ void MeshGeneratorBase::generateMesh( Group & parent, SpatialPartition & partiti } else { - CellBlockManager & cellBlockManager = parent.registerGroup< CellBlockManager >( keys::cellManager ); + CellBlockManager & cellBlockManager = + parent.registerGroup< CellBlockManager >( MeshBody::groupStructKeys::cellManagerString() ); fillCellBlockManager( cellBlockManager, partition ); diff --git a/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp b/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp index 4a881414782..cfd333734c9 100644 --- a/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp +++ b/src/coreComponents/mesh/generators/VTKMeshGenerator.cpp @@ -20,6 +20,7 @@ #include "VTKMeshGenerator.hpp" #include "common/DataTypes.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "mesh/ExternalDataSourceManager.hpp" #include "mesh/LogLevelsInfo.hpp" #include "mesh/generators/VTKFaceBlockUtilities.hpp" @@ -118,7 +119,8 @@ void VTKMeshGenerator::postInputInitialization() if( !m_dataSourceName.empty()) { - ExternalDataSourceManager & externalDataManager = getGroupByPath< ExternalDataSourceManager >( "/Problem/ExternalDataSource" ); + ExternalDataSourceManager & externalDataManager = + ProblemRepository::getManager< ExternalDataSourceManager >( *this ); m_dataSource = externalDataManager.getGroupPointer< VTKHierarchicalDataSource >( m_dataSourceName ); diff --git a/src/coreComponents/mesh/simpleGeometricObjects/GeometricObjectManager.hpp b/src/coreComponents/mesh/simpleGeometricObjects/GeometricObjectManager.hpp index 7aef070b24f..cdc52072d6a 100644 --- a/src/coreComponents/mesh/simpleGeometricObjects/GeometricObjectManager.hpp +++ b/src/coreComponents/mesh/simpleGeometricObjects/GeometricObjectManager.hpp @@ -21,6 +21,7 @@ #define GEOS_MESH_SIMPLEGEOMETRICOBJECTS_GEOMETRICOBJECTMANAGER_HPP_ #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "mesh/simpleGeometricObjects/SimpleGeometricObjectBase.hpp" @@ -84,6 +85,14 @@ class GeometricObjectManager : public dataRepository::Group }; +// GeometricObjectManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline GeometricObjectManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< GeometricObjectManager >( m_gks.geometricObjectManager ); } + +// GeometricObjectManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline GeometricObjectManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< GeometricObjectManager >( m_gks.geometricObjectManager ); } + } /* namespace geos */ #endif /* GEOS_MESH_SIMPLEGEOMETRICOBJECTS_GEOMETRICOBJECTMANAGER_HPP_ */ diff --git a/src/coreComponents/mesh/simpleGeometricObjects/SimpleGeometricObjectBase.cpp b/src/coreComponents/mesh/simpleGeometricObjects/SimpleGeometricObjectBase.cpp index 12097ec516d..298dffae9e8 100644 --- a/src/coreComponents/mesh/simpleGeometricObjects/SimpleGeometricObjectBase.cpp +++ b/src/coreComponents/mesh/simpleGeometricObjects/SimpleGeometricObjectBase.cpp @@ -19,6 +19,7 @@ #include "SimpleGeometricObjectBase.hpp" #include "dataRepository/InputFlags.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "mesh/DomainPartition.hpp" namespace geos @@ -49,7 +50,7 @@ void SimpleGeometricObjectBase::postInputInitialization() { // determine m_epsilon m_epsilon = std::numeric_limits< real64 >::max(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = dataRepository::ProblemRepository::getManager< DomainPartition >( *this ); domain.forMeshBodies( [&]( MeshBody const & meshBody ) { m_epsilon = std::min( m_epsilon, 1e-6 * meshBody.getGlobalLengthScale() ); diff --git a/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp b/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp index 1548ed4b6e6..6756add7343 100644 --- a/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp +++ b/src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp @@ -20,6 +20,7 @@ #ifndef SRC_CORECOMPONENTS_PHYSICSSOLVERS_FIELDSTATISTICSBASE_HPP_ #define SRC_CORECOMPONENTS_PHYSICSSOLVERS_FIELDSTATISTICSBASE_HPP_ +#include "dataRepository/ProblemRepository.hpp" #include "events/tasks/TaskBase.hpp" #include "physicsSolvers/PhysicsSolverManager.hpp" #include "mesh/MeshLevel.hpp" @@ -95,8 +96,8 @@ class FieldStatisticsBase : public TaskBase void postInputInitialization() override { - Group & problemManager = this->getGroupByPath( "/Problem" ); - Group & physicsSolverManager = problemManager.getGroup( "Solvers" ); + PhysicsSolverManager & physicsSolverManager = + dataRepository::ProblemRepository::get( *this ).template getManager< PhysicsSolverManager >(); m_solver = physicsSolverManager.getGroupPointer< SOLVER >( m_solverName ); GEOS_THROW_IF( m_solver == nullptr, diff --git a/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp b/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp index 8d05dfd6958..8111e2dbfa3 100644 --- a/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp @@ -20,6 +20,7 @@ #include "codingUtilities/RTTypes.hpp" #include "common/format/EnumStrings.hpp" #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "physicsSolvers/LogLevelsInfo.hpp" #include "common/format/LogPart.hpp" #include "common/TimingMacros.hpp" @@ -158,10 +159,20 @@ void PhysicsSolverBase::postInputInitialization() PhysicsSolverBase::~PhysicsSolverBase() = default; +DomainPartition & PhysicsSolverBase::getDomainPartition() +{ + return ProblemRepository::get( *this ).getManager< DomainPartition >(); +} + +DomainPartition const & PhysicsSolverBase::getDomainPartition() const +{ + return ProblemRepository::get( *this ).getManager< DomainPartition >(); +} + void PhysicsSolverBase::initialize_postMeshGeneration() { ExecutableGroup::initialize_postMeshGeneration(); - DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition const & domain = getDomainPartition(); generateMeshTargetsFromTargetRegions( domain.getMeshBodies()); } diff --git a/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp b/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp index a174b485e67..923e55abfdf 100644 --- a/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/PhysicsSolverBase.hpp @@ -1014,6 +1014,17 @@ class PhysicsSolverBase : public ExecutableGroup protected: + /** + * @brief Get the DomainPartition from the Problem + * @return A reference to the DomainPartition + */ + DomainPartition & getDomainPartition(); + + /** + * @copydoc getDomainPartition() + */ + DomainPartition const & getDomainPartition() const; + virtual void postInputInitialization() override; /** diff --git a/src/coreComponents/physicsSolvers/PhysicsSolverManager.hpp b/src/coreComponents/physicsSolvers/PhysicsSolverManager.hpp index 8ef3ba43312..c00e0f74866 100644 --- a/src/coreComponents/physicsSolvers/PhysicsSolverManager.hpp +++ b/src/coreComponents/physicsSolvers/PhysicsSolverManager.hpp @@ -17,6 +17,7 @@ #define GEOS_PHYSICSSOLVERS_PHYSICSSOLVERMANAGER_HPP_ #include "dataRepository/Group.hpp" +#include "dataRepository/ProblemRepository.hpp" namespace geos { @@ -48,6 +49,14 @@ class PhysicsSolverManager : public dataRepository::Group R1Tensor m_gravityVector; }; +// PhysicsSolverManager is available through the ProblemRepository as a mutable problem-unique manager. +template<> inline PhysicsSolverManager & dataRepository::ProblemRepository::getManager() +{ return getRootGroup().getGroup< PhysicsSolverManager >( m_gks.physicsSolverManager ); } + +// PhysicsSolverManager is available through the ProblemRepository as a const problem-unique manager. +template<> inline PhysicsSolverManager const & dataRepository::ProblemRepository::getManager() const +{ return getRootGroup().getGroup< PhysicsSolverManager >( m_gks.physicsSolverManager ); } + } /* namespace geos */ #endif /* GEOS_PHYSICSSOLVERS_PHYSICSSOLVERMANAGER_HPP_ */ diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp index 41ccbe71b93..074e1b69beb 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseBase.cpp @@ -276,7 +276,7 @@ void CompositionalMultiphaseBase::registerDataOnMesh( Group & meshBodies ) { FlowSolverBase::registerDataOnMesh( meshBodies ); - DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition const & domain = getDomainPartition(); ConstitutiveManager const & cm = domain.getConstitutiveManager(); // 0. Find a "reference" fluid model name (at this point, models are already attached to subregions) @@ -568,7 +568,7 @@ void CompositionalMultiphaseBase::initializePreSubGroups() { FlowSolverBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); ConstitutiveManager const & cm = domain.getConstitutiveManager(); // 1. Validate various models against each other (must have same phases and components) @@ -980,7 +980,7 @@ void CompositionalMultiphaseBase::initializeFluidState( MeshLevel & mesh, // check if comp fractions need to be corrected to avoid zero diags etc if( m_formulationType == CompositionalMultiphaseFormulationType::OverallComposition && m_allowCompDensChopping ) { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); chopNegativeCompFractions( domain ); } @@ -1618,7 +1618,7 @@ void CompositionalMultiphaseBase::initializePostInitialConditionsPreSubGroups() FlowSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp index 9e40db7e20c..432ba1bac6e 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseFVM.cpp @@ -139,7 +139,7 @@ void CompositionalMultiphaseFVM::postInputInitialization() getWrapperDataContext( viewKeyStruct::useDBCString() ) ); } - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); FluxApproximationBase const & fluxApprox = fvManager.getFluxApproximation( m_discretizationName ); @@ -201,7 +201,7 @@ void CompositionalMultiphaseFVM::initializePreSubGroups() checkDiscretizationName(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); FluxApproximationBase const & fluxApprox = fvManager.getFluxApproximation( m_discretizationName ); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp index 6fd5cba3a5c..c2cd8e2cdf2 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.cpp @@ -120,7 +120,7 @@ void CompositionalMultiphaseHybridFVM::initializePreSubGroups() { CompositionalMultiphaseBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); @@ -137,7 +137,7 @@ void CompositionalMultiphaseHybridFVM::initializePostInitialConditionsPreSubGrou { GEOS_MARK_FUNCTION; - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatisticsTask.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatisticsTask.cpp index d80db9040c1..8732a21045a 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatisticsTask.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatisticsTask.cpp @@ -20,6 +20,7 @@ #include "CompositionalMultiphaseStatisticsTask.hpp" #include "constitutive/fluid/multifluid/MultiFluidBase.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "physicsSolvers/LogLevelsInfo.hpp" #include "physicsSolvers/fluidFlow/LogLevelsInfo.hpp" #include "physicsSolvers/fluidFlow/CompositionalMultiphaseHybridFVM.hpp" @@ -119,7 +120,7 @@ void StatsTask::prepareFluidMetaData() { using namespace constitutive; - ConstitutiveManager const & constitutiveManager = this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" ); + ConstitutiveManager const & constitutiveManager = ProblemRepository::get( *this ).getManager< ConstitutiveManager >(); MultiFluidBase const & fluid = constitutiveManager.getGroup< MultiFluidBase >( m_solver->referenceFluidModelName() ); m_fluid.m_numPhases = fluid.numFluidPhases(); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index 3a948b6fee9..3cf1b560de6 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -252,7 +252,7 @@ void FlowSolverBase::registerDataOnMesh( Group & meshBodies ) } ); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); // fill stencil targetRegions NumericalMethodsManager & numericalMethodManager = domain.getNumericalMethodManager(); @@ -365,7 +365,7 @@ void FlowSolverBase::initializePreSubGroups() { PhysicsSolverBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); // fill stencil targetRegions NumericalMethodsManager & numericalMethodManager = domain.getNumericalMethodManager(); @@ -393,7 +393,7 @@ void FlowSolverBase::initializePreSubGroups() void FlowSolverBase::checkDiscretizationName() const { - DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition const & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteVolumeManager const & finiteVolumeManager = numericalMethodManager.getFiniteVolumeManager(); @@ -493,7 +493,7 @@ void FlowSolverBase::initializePostInitialConditionsPreSubGroups() { PhysicsSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlow.cpp b/src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlow.cpp index 1531799faeb..b90af0e2eba 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlow.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ImmiscibleMultiphaseFlow.cpp @@ -191,7 +191,7 @@ void ImmiscibleMultiphaseFlow::initializePreSubGroups() FlowSolverBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, @@ -461,7 +461,7 @@ void ImmiscibleMultiphaseFlow::initializePostInitialConditionsPreSubGroups() FlowSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp b/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp index 6ba70a82cf5..c9e031513cf 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/ReactiveCompositionalMultiphaseOBL.cpp @@ -540,7 +540,7 @@ void ReactiveCompositionalMultiphaseOBL::initializePostInitialConditionsPreSubGr FlowSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp index 82fd666b07c..45d39715f8d 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseBase.cpp @@ -181,7 +181,7 @@ void SinglePhaseBase::initializePreSubGroups() { FlowSolverBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); // 1. Validate various models against each other (must have same phases and components) validateConstitutiveModels( domain ); @@ -392,7 +392,7 @@ void SinglePhaseBase::initializePostInitialConditionsPreSubGroups() FlowSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); initializeState( domain ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp index fdaf8496edb..e1d565fb17c 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseHybridFVM.cpp @@ -99,7 +99,7 @@ void SinglePhaseHybridFVM::initializePreSubGroups() "The thermal option is not supported by SinglePhaseHybridFVM", InputError, getDataContext() ); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteVolumeManager const & fvManager = numericalMethodManager.getFiniteVolumeManager(); @@ -113,7 +113,7 @@ void SinglePhaseHybridFVM::initializePostInitialConditionsPreSubGroups() GEOS_MARK_FUNCTION; SinglePhaseBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseReactiveTransport.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseReactiveTransport.cpp index b5c850662d3..5daeff72a86 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseReactiveTransport.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseReactiveTransport.cpp @@ -115,7 +115,7 @@ void SinglePhaseReactiveTransport::registerDataOnMesh( Group & meshBodies ) SinglePhaseBase::registerDataOnMesh( meshBodies ); - DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition const & domain = getDomainPartition(); ConstitutiveManager const & cm = domain.getConstitutiveManager(); // 0. Find a reactive fluid model name (at this point, models are already attached to subregions) @@ -828,7 +828,7 @@ void SinglePhaseReactiveTransport::initializePostInitialConditionsPreSubGroups() FlowSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp b/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp index f94bf37302e..65885ca92cc 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/StencilDataCollection.cpp @@ -20,11 +20,13 @@ #include "StencilDataCollection.hpp" #include "common/Units.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "finiteVolume/FluxApproximationBase.hpp" #include "finiteVolume/TwoPointFluxApproximation.hpp" #include "constitutive/permeability/PermeabilityBase.hpp" #include "constitutive/permeability/PermeabilityFields.hpp" #include "mesh/MeshLevel.hpp" +#include "physicsSolvers/PhysicsSolverManager.hpp" #include "physicsSolvers/fluidFlow/FlowSolverBase.hpp" #include "physicsSolvers/fluidFlow/LogLevelsInfo.hpp" #include "physicsSolvers/fluidFlow/StencilAccessors.hpp" @@ -62,10 +64,10 @@ StencilDataCollection::StencilDataCollection( const string & name, void StencilDataCollection::postInputInitialization() { - Group & problemManager = this->getGroupByPath( "/Problem" ); + ProblemRepository & problem = ProblemRepository::get( *this ); { // find targeted solver - Group & physicsSolverManager = problemManager.getGroup( "Solvers" ); + PhysicsSolverManager & physicsSolverManager = problem.getManager< PhysicsSolverManager >(); m_solver = physicsSolverManager.getGroupPointer< FlowSolverBase >( m_solverName ); GEOS_THROW_IF( m_solver == nullptr, @@ -74,8 +76,7 @@ void StencilDataCollection::postInputInitialization() } { // find mesh & discretization -// DomainPartition & domain = problemManager.getDomainPartition(); - DomainPartition & domain = problemManager.getGroup< DomainPartition >( "domain" ); + DomainPartition & domain = problem.getManager< DomainPartition >(); MeshBody const & meshBody = domain.getMeshBody( m_meshName ); m_meshLevel = &meshBody.getBaseDiscretization(); diff --git a/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp b/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp index 3087c47b322..0369e2519bf 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/proppantTransport/ProppantTransport.cpp @@ -137,7 +137,7 @@ void ProppantTransport::initializePreSubGroups() { FlowSolverBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); ConstitutiveManager & cm = domain.getConstitutiveManager(); // Validate proppant models in regions @@ -289,7 +289,7 @@ void ProppantTransport::initializePostInitialConditionsPreSubGroups() FlowSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); integer const numComponents = m_numComponents; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp index 66ad4b387dd..fc75c911bb5 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/CompositionalMultiphaseWell.cpp @@ -215,8 +215,7 @@ void CompositionalMultiphaseWell::setConstitutiveNames( ElementSubRegionBase & s void CompositionalMultiphaseWell::registerWellDataOnMesh( WellElementSubRegion & subRegion ) { - - DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition const & domain = ProblemRepository::getManager< DomainPartition >( *this ); ConstitutiveManager const & cm = domain.getConstitutiveManager(); setConstitutiveNames ( subRegion ); if( m_referenceFluidModelName.empty() ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellManager.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellManager.cpp index 74348a400b2..0e35c4a79e3 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellManager.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellManager.cpp @@ -305,7 +305,7 @@ void WellManager::initializePostSubGroups() // Validate constitutive models if( isCompositional() ) { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); constitutive::ConstitutiveManager const & cm = domain.getConstitutiveManager(); CompositionalMultiphaseBase const & flowSolver = getParent().getGroup< CompositionalMultiphaseBase >( getFlowSolverName() ); string const referenceFluidName = flowSolver.referenceFluidModelName(); @@ -472,7 +472,7 @@ void WellManager::postRestartInitialization() void WellManager::initializePostInitialConditionsPreSubGroups() { PhysicsSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); forDiscretizationOnMeshTargets ( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) @@ -493,7 +493,7 @@ void WellManager::initializePostInitialConditionsPreSubGroups() } void WellManager::setKeepVariablesConstantDuringInitStep( bool const keepVariablesConstantDuringInitStep ) { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp index 830833212b2..5b750298a72 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/wells/WellSolverBase.cpp @@ -153,7 +153,7 @@ void WellSolverBase::registerDataOnMesh( Group & meshBodies ) void WellSolverBase::initializePostSubGroups() { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); FunctionManager & functionManager = FunctionManager::getInstance(); Group & meshBodies = domain.getMeshBodies(); forDiscretizationOnMeshTargets( meshBodies, [&] ( string const &, @@ -344,7 +344,7 @@ void WellSolverBase::initializePostInitialConditionsPreSubGroups() { PhysicsSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); // make sure that nextWellElementIndex is up-to-date (will be used in well initialization and assembly) forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, diff --git a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp index 11a8ed584e4..ba7467a7f16 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CompositionalMultiphaseReservoirAndWells.cpp @@ -165,7 +165,7 @@ initializePreSubGroups() CompositionalMultiphaseBase::viewKeyStruct::isThermalString(), Base::reservoirSolver()->getName(), Base::wellSolver()->getName() ), InputError, this->getDataContext(), Base::reservoirSolver()->getDataContext(), Base::wellSolver()->getDataContext() ); - DomainPartition & domain = this->template getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::template getManager< DomainPartition >( *this ); Group & meshBodies = domain.getMeshBodies(); this->template forDiscretizationOnMeshTargets<>( meshBodies, [&] ( string const &, diff --git a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp index c7a1f3ea030..c5ea6fb0f9f 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/CoupledReservoirAndWellsBase.hpp @@ -167,7 +167,8 @@ class CoupledReservoirAndWellsBase : public CoupledSolver< RESERVOIR_SOLVER, WEL { Base::initializePostInitialConditionsPreSubGroups( ); - DomainPartition & domain = this->template getGroupByPath< DomainPartition >( "/Problem/domain" ); + using namespace dataRepository; + DomainPartition & domain = ProblemRepository::template getManager< DomainPartition >( *this ); // Validate well perforations: Ensure that each perforation is in a region targeted by the solver if( !validateWellPerforations( domain )) diff --git a/src/coreComponents/physicsSolvers/multiphysics/FieldApplicator.cpp b/src/coreComponents/physicsSolvers/multiphysics/FieldApplicator.cpp index 98595748809..1e1c23c6d8d 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/FieldApplicator.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/FieldApplicator.cpp @@ -14,6 +14,7 @@ */ #include "FieldApplicator.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "events/tasks/TasksManager.hpp" #include "fieldSpecification/FieldSpecification.hpp" #include "fieldSpecification/FieldSpecificationImpl.hpp" @@ -25,6 +26,7 @@ #include "mesh/CellElementSubRegion.hpp" #include "mesh/SurfaceElementSubRegion.hpp" #include "functions/TableFunction.hpp" +#include "physicsSolvers/PhysicsSolverManager.hpp" #include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp" #include "physicsSolvers/fluidFlow/CompositionalMultiphaseBaseFields.hpp" #include "constitutive/fluid/multifluid/MultiFluidBase.hpp" @@ -105,7 +107,7 @@ FieldApplicator:: // Find the flow solver to delegate initialization to. // Use m_solverName if provided, otherwise find the first FlowSolverBase. FlowSolverBase * flowSolver = nullptr; - Group & solversGroup = this->getGroupByPath< Group >( "/Problem/Solvers" ); + PhysicsSolverManager & solversGroup = ProblemRepository::get( *this ).getManager< PhysicsSolverManager >(); if( !m_solverName.empty() ) { @@ -239,7 +241,7 @@ void FieldApplicator::initializeSubRegionFluidState( DomainPartition & domain, E // Use m_solverName if provided, otherwise search all solvers. CompositionalMultiphaseBase * flowSolver = nullptr; - Group & solversGroup = this->getGroupByPath< Group >( "/Problem/Solvers" ); + PhysicsSolverManager & solversGroup = ProblemRepository::get( *this ).getManager< PhysicsSolverManager >(); if( !m_solverName.empty() ) { diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp index 40cb0eaba82..fa698781197 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsInitialization.cpp @@ -75,8 +75,7 @@ void PoromechanicsInitialization< POROMECHANICS_SOLVER >:: postInputInitialization() { - Group & problemManager = this->getGroupByPath( "/Problem" ); - Group & physicsSolverManager = problemManager.getGroup( "Solvers" ); + PhysicsSolverManager & physicsSolverManager = ProblemRepository::getManager< PhysicsSolverManager >( *this ); GEOS_THROW_IF( !physicsSolverManager.hasGroup( m_poromechanicsSolverName ), GEOS_FMT( "{} solver named {} not found", @@ -88,7 +87,7 @@ postInputInitialization() if( !m_solidMechanicsStatisticsName.empty()) { - TasksManager & tasksManager = problemManager.getGroup< TasksManager >( "Tasks" ); + TasksManager & tasksManager = ProblemRepository::getManager< TasksManager >( *this ); GEOS_THROW_IF( !tasksManager.hasGroup( m_solidMechanicsStatisticsName ), GEOS_FMT( "{} task named {} not found", diff --git a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp index 1b34ab94f65..700abac2898 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp +++ b/src/coreComponents/physicsSolvers/multiphysics/PoromechanicsSolver.hpp @@ -26,6 +26,7 @@ #include "physicsSolvers/fluidFlow/FlowSolverBaseFields.hpp" #include "physicsSolvers/multiphysics/PoromechanicsFields.hpp" #include "physicsSolvers/solidMechanics/SolidMechanicsFields.hpp" + #include "constitutive/solid/CoupledSolidBase.hpp" #include "constitutive/contact/HydraulicApertureBase.hpp" #include "mesh/DomainPartition.hpp" @@ -161,7 +162,8 @@ class PoromechanicsSolver : public CoupledSolver< FLOW_SOLVER, MECHANICS_SOLVER this->getWrapperDataContext( viewKeyStruct::stabilizationTypeString() ) ), InputError, this->getWrapperDataContext( viewKeyStruct::stabilizationTypeString() ) ); - DomainPartition & domain = this->template getGroupByPath< DomainPartition >( "/Problem/domain" ); + using namespace dataRepository; + DomainPartition & domain = ProblemRepository::template getManager< DomainPartition >( *this ); this->template forDiscretizationOnMeshTargets<>( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp index 9ac8d570c7f..9c47d05b142 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhasePoromechanicsEmbeddedFractures.cpp @@ -92,7 +92,8 @@ void SinglePhasePoromechanicsEmbeddedFractures::initializePostInitialConditionsP { Base::initializePostInitialConditionsPreSubGroups(); - updateState( this->getGroupByPath< DomainPartition >( "/Problem/domain" ) ); + updateState( getDomainPartition() ); + } void SinglePhasePoromechanicsEmbeddedFractures::setupCoupling( DomainPartition const & domain, diff --git a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp index 898be9c3055..ee59985785e 100644 --- a/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp +++ b/src/coreComponents/physicsSolvers/multiphysics/SinglePhaseReservoirAndWells.cpp @@ -145,7 +145,7 @@ initializePreSubGroups() this->getDataContext(), SinglePhaseBase::viewKeyStruct::isThermalString(), Base::reservoirSolver()->getDataContext(), Base::wellSolver()->getDataContext() ), InputError, this->getDataContext(), Base::reservoirSolver()->getDataContext(), Base::wellSolver()->getDataContext() ); - DomainPartition & domain = this->template getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::template getManager< DomainPartition >( *this ); this->template forDiscretizationOnMeshTargets<>( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/python/PySolver.cpp b/src/coreComponents/physicsSolvers/python/PySolver.cpp index d8c7ada2ae2..5a07765fbac 100644 --- a/src/coreComponents/physicsSolvers/python/PySolver.cpp +++ b/src/coreComponents/physicsSolvers/python/PySolver.cpp @@ -92,7 +92,7 @@ static PyObject * execute( PySolver * self, PyObject * args ) return nullptr; } - geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" ); + geos::DomainPartition & domain = self->group->getDomainPartition(); self->group->execute( time, dt, cycleNumber, 0, 0, domain ); @@ -123,7 +123,7 @@ static PyObject * cleanup( PySolver * self, PyObject *args ) return nullptr; } - geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" ); + geos::DomainPartition & domain = self->group->getDomainPartition(); self->group->cleanup( time, 0, 0, 0.0, domain ); Py_RETURN_NONE; diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsInitialization.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsInitialization.cpp index 19fca8f4c4f..f49939d2b5f 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsInitialization.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsInitialization.cpp @@ -26,6 +26,7 @@ #include "physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.hpp" #include "physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.hpp" #include "physicsSolvers/LogLevelsInfo.hpp" +#include "dataRepository/ProblemRepository.hpp" namespace geos { @@ -67,8 +68,8 @@ SolidMechanicsInitialization< SOLID_SOLVER >::~SolidMechanicsInitialization() = template< typename SOLID_SOLVER > void SolidMechanicsInitialization< SOLID_SOLVER >::postInputInitialization() { - Group & problemManager = this->getGroupByPath( "/Problem" ); - Group & physicsSolverManager = problemManager.getGroup( "Solvers" ); + ProblemRepository & problemManager = ProblemRepository::get( *this ); + PhysicsSolverManager & physicsSolverManager = problemManager.getManager< PhysicsSolverManager >(); GEOS_THROW_IF( !physicsSolverManager.hasGroup( m_solidSolverName ), GEOS_FMT( "{}: {} solver named {} not found", @@ -81,7 +82,7 @@ void SolidMechanicsInitialization< SOLID_SOLVER >::postInputInitialization() if( !m_solidMechanicsStatisticsName.empty() ) { - TasksManager & tasksManager = problemManager.getGroup< TasksManager >( "Tasks" ); + TasksManager & tasksManager = problemManager.getManager< TasksManager >(); GEOS_THROW_IF( !tasksManager.hasGroup( m_solidMechanicsStatisticsName ), GEOS_FMT( "{}: {} task named {} not found", diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp index 4072b5683a9..6baa1bec6fc 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.cpp @@ -45,6 +45,7 @@ #include "mesh/CellElementSubRegion.hpp" #include "mesh/mpiCommunications/NeighborCommunicator.hpp" #include "fileIO/Outputs/ChomboIO.hpp" +#include "fileIO/Outputs/OutputManager.hpp" #include "physicsSolvers/LogLevelsInfo.hpp" #include "physicsSolvers/solidMechanics/kernels/SolidMechanicsKernelsDispatchTypeList.hpp" @@ -200,7 +201,7 @@ void SolidMechanicsLagrangianFEM::registerDataOnMesh( Group & meshBodies ) nodes.registerField< solidMechanics::incrementalDisplacement >( getName() ). reference().resizeDimension< 1 >( 3 ); - Group const & outputs = Group::getGroupByPath( GEOS_FMT( "/{}", ProblemManager::groupKeysStruct().outputManager.key() ) ); + Group const & outputs = ProblemRepository::getManager< OutputManager >( *this ); if( m_timeIntegrationOption != TimeIntegrationOption::QuasiStatic || outputs.hasSubGroupOfType< ChomboIO >() ) { nodes.registerField< solidMechanics::velocity >( getName() ). @@ -270,7 +271,7 @@ void SolidMechanicsLagrangianFEM::initializePreSubGroups() { PhysicsSolverBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteElementDiscretizationManager const & feDiscretizationManager = numericalMethodManager.getFiniteElementDiscretizationManager(); @@ -380,7 +381,7 @@ void SolidMechanicsLagrangianFEM::initializeMass( MeshLevel & mesh, CellElementS void SolidMechanicsLagrangianFEM::initializePostInitialConditionsPreSubGroups() { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&]( string const &, diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp index bf1814610e5..0acdf0cc022 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsMPM.cpp @@ -30,6 +30,7 @@ #include "common/TimingMacros.hpp" #include "constitutive/ConstitutiveManager.hpp" #include "constitutive/contact/FrictionBase.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "finiteElement/FiniteElementDiscretizationManager.hpp" #include "finiteElement/FiniteElementDiscretization.hpp" #include "finiteElement/Kinematics.h" @@ -469,7 +470,7 @@ void SolidMechanicsMPM::initializePreSubGroups() { PhysicsSolverBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); Group & meshBodies = domain.getMeshBodies(); @@ -927,7 +928,7 @@ real64 SolidMechanicsMPM::explicitStep( real64 const & time_n, //####################################################################################### solverProfiling( "Get spatial partition, get node and particle managers. Resize m_iComm." ); //####################################################################################### - SpatialPartition & partition = dynamic_cast< SpatialPartition & >(domain.getReference< PartitionBase >( keys::partitionManager ) ); + SpatialPartition & partition = dynamic_cast< SpatialPartition & >( domain.getPartitionManager() ); // ***** We assume that there are exactly two mesh bodies, and that one has particles and one does not. ***** Group & meshBodies = domain.getMeshBodies(); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp index a67fabbf24b..81680426123 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStateReset.cpp @@ -19,6 +19,7 @@ #include "SolidMechanicsStateReset.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "physicsSolvers/PhysicsSolverManager.hpp" #include "physicsSolvers/solidMechanics/contact/ContactFields.hpp" #include "physicsSolvers/solidMechanics/SolidMechanicsLagrangianFEM.hpp" @@ -62,8 +63,7 @@ SolidMechanicsStateReset::~SolidMechanicsStateReset() void SolidMechanicsStateReset::postInputInitialization() { - Group & problemManager = this->getGroupByPath( "/Problem" ); - Group & physicsSolverManager = problemManager.getGroup( "Solvers" ); + PhysicsSolverManager & physicsSolverManager = ProblemRepository::get( *this ).getManager< PhysicsSolverManager >(); GEOS_THROW_IF( !physicsSolverManager.hasGroup( m_solidSolverName ), GEOS_FMT( "physics solver named {} not found", m_solidSolverName ), diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp index a928891a726..87556209c4d 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsAugmentedLagrangianContact.cpp @@ -38,8 +38,10 @@ #include "constitutive/solid/PorousSolid.hpp" #include "constitutive/solid/SolidFields.hpp" #include "physicsSolvers/solidMechanics/contact/kernels/SolidMechanicsALMContactPorousKernelsDispatchTypeList.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "finiteElement/FiniteElementDiscretization.hpp" #include "mesh/DomainPartition.hpp" +#include "dataRepository/ProblemRepository.hpp" #include @@ -193,7 +195,7 @@ void SolidMechanicsAugmentedLagrangianContact::initializePostInitialConditionsPr { ContactSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); validateTetrahedralQuadrature( domain.getMeshBodies() ); } @@ -202,7 +204,7 @@ void SolidMechanicsAugmentedLagrangianContact::validateTetrahedralQuadrature( Gr string const discretizationName = getDiscretizationName(); NumericalMethodsManager const & numericalMethodManager = - this->getGroupByPath< DomainPartition >( "/Problem/domain" ).getNumericalMethodManager(); + ProblemRepository::getManager< NumericalMethodsManager >( *this ); FiniteElementDiscretizationManager const & feDiscretizationManager = numericalMethodManager.getFiniteElementDiscretizationManager(); FiniteElementDiscretization const & feDiscretization = @@ -328,7 +330,7 @@ void SolidMechanicsAugmentedLagrangianContact::postInputInitialization() { ContactSolverBase::postInputInitialization(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = ProblemRepository::getManager< DomainPartition >( *this ); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteElementDiscretizationManager const & feDiscretizationManager = numericalMethodManager.getFiniteElementDiscretizationManager(); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.cpp index d2f9af55b01..cbdbe208579 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsEmbeddedFractures.cpp @@ -110,7 +110,7 @@ void SolidMechanicsEmbeddedFractures::registerDataOnMesh( dataRepository::Group void SolidMechanicsEmbeddedFractures::initializePostInitialConditionsPreSubGroups() { ContactSolverBase::initializePostInitialConditionsPreSubGroups(); - updateState( getGroupByPath< DomainPartition >( "/Problem/domain" ) ); + updateState( getDomainPartition() ); } void SolidMechanicsEmbeddedFractures::resetStateToBeginningOfStep( DomainPartition & domain ) diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp index b12a67de3ca..45c31284894 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContact.cpp @@ -180,7 +180,7 @@ void SolidMechanicsLagrangeContact::initializePreSubGroups() { ContactSolverBase::initializePreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); // fill stencil targetRegions NumericalMethodsManager & numericalMethodManager = domain.getNumericalMethodManager(); diff --git a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContactBubbleStab.cpp b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContactBubbleStab.cpp index 34417df75db..ddb6b2402c8 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContactBubbleStab.cpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/contact/SolidMechanicsLagrangeContactBubbleStab.cpp @@ -119,7 +119,7 @@ void SolidMechanicsLagrangeContactBubbleStab::initializePostInitialConditionsPre { ContactSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); validateTetrahedralQuadrature( domain.getMeshBodies() ); } @@ -128,7 +128,7 @@ void SolidMechanicsLagrangeContactBubbleStab::validateTetrahedralQuadrature( Gro string const discretizationName = getDiscretizationName(); NumericalMethodsManager const & numericalMethodManager = - this->getGroupByPath< DomainPartition >( "/Problem/domain" ).getNumericalMethodManager(); + getDomainPartition().getNumericalMethodManager(); FiniteElementDiscretizationManager const & feDiscretizationManager = numericalMethodManager.getFiniteElementDiscretizationManager(); FiniteElementDiscretization const & feDiscretization = @@ -225,7 +225,7 @@ void SolidMechanicsLagrangeContactBubbleStab::postInputInitialization() { ContactSolverBase::postInputInitialization(); - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); FiniteElementDiscretizationManager const & feDiscretizationManager = numericalMethodManager.getFiniteElementDiscretizationManager(); diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/EmbeddedSurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/EmbeddedSurfaceGenerator.cpp index d96124bf8c6..500c488ca61 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/EmbeddedSurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/EmbeddedSurfaceGenerator.cpp @@ -86,7 +86,7 @@ void EmbeddedSurfaceGenerator::initializePostSubGroups() */ // Get domain - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); // Get geometric object manager GeometricObjectManager & geometricObjManager = GeometricObjectManager::getInstance(); diff --git a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp index ef2b09b7e6a..91e49e4e1db 100644 --- a/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp +++ b/src/coreComponents/physicsSolvers/surfaceGeneration/SurfaceGenerator.cpp @@ -19,6 +19,7 @@ #include "SurfaceGenerator.hpp" +#include "dataRepository/ProblemRepository.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" #include "mesh/mpiCommunications/NeighborCommunicator.hpp" #include "mesh/mpiCommunications/SpatialPartition.hpp" @@ -286,8 +287,7 @@ void SurfaceGenerator::registerDataOnMesh( Group & meshBodies ) // TODO: handle this in registerField(). faceManager.getField< surfaceGeneration::K_IC >().resizeDimension< 1 >( 3 ); - Group & problemManager = this->getGroupByPath( "/Problem" ); - FieldSpecificationManager & fsm = problemManager.getGroup< FieldSpecificationManager >( "FieldSpecifications" ); + FieldSpecificationManager & fsm = ProblemRepository::get( *this ).getManager< FieldSpecificationManager >(); fsm.setIsSurfaceGenerationCase( true ); } ); @@ -296,7 +296,7 @@ void SurfaceGenerator::registerDataOnMesh( Group & meshBodies ) void SurfaceGenerator::initializePostInitialConditionsPreSubGroups() { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & meshLevel, string_array const & ) @@ -427,7 +427,7 @@ void SurfaceGenerator::initializePostInitialConditionsPreSubGroups() void SurfaceGenerator::postRestartInitialization() { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager & numericalMethodManager = domain.getNumericalMethodManager(); @@ -481,7 +481,7 @@ real64 SurfaceGenerator::solverStep( real64 const & time_n, MeshLevel & meshLevel, string_array const & ) { - SpatialPartition & partition = dynamicCast< SpatialPartition & >( domain.getReference< PartitionBase >( dataRepository::keys::partitionManager ) ); + SpatialPartition & partition = dynamicCast< SpatialPartition & >( domain.getPartitionManager() ); int const tileColor=partition.getColor(); int const numTileColorsLocal=partition.numColor(); int const numTileColors = MpiWrapper::allReduce( numTileColorsLocal, MpiWrapper::Reduction::Max ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/dg/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationDG.cpp b/src/coreComponents/physicsSolvers/wavePropagation/dg/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationDG.cpp index d2ed40b724b..b83f68b2fc4 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/dg/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationDG.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/dg/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationDG.cpp @@ -245,7 +245,7 @@ void AcousticWaveEquationDG::initializePostInitialConditionsPreSubGroups() WaveSolverBase::initializePostInitialConditionsPreSubGroups(); } - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const & meshBodyName, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/firstOrderEqn/isotropic/AcousticFirstOrderWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/firstOrderEqn/isotropic/AcousticFirstOrderWaveEquationSEM.cpp index e56ca81c75c..0c13b012b5b 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/firstOrderEqn/isotropic/AcousticFirstOrderWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/firstOrderEqn/isotropic/AcousticFirstOrderWaveEquationSEM.cpp @@ -274,7 +274,7 @@ void AcousticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGro { WaveSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); applyFreeSurfaceBC( 0.0, domain ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp index 1cd6fafaa2f..754ae26be43 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/anisotropic/AcousticVTIWaveEquationSEM.cpp @@ -261,7 +261,7 @@ void AcousticVTIWaveEquationSEM::initializePostInitialConditionsPreSubGroups() WaveSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); applyFreeSurfaceBC( 0.0, domain ); precomputeSurfaceFieldIndicator( domain ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationSEM.cpp index 69c5bdbd525..cfdff0d1d89 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustic/secondOrderEqn/isotropic/AcousticWaveEquationSEM.cpp @@ -228,7 +228,7 @@ void AcousticWaveEquationSEM::precomputeSourceAndReceiverTerm( MeshLevel & baseM bool useSourceWaveletTables = m_useSourceWaveletTables; //Correct size for sourceValue - EventManager const & event = getGroupByPath< EventManager >( "/Problem/Events" ); + EventManager const & event = ProblemRepository::getManager< EventManager >( *this ); real64 const & maxTime = event.getReference< real64 >( EventManager::viewKeyStruct::maxTimeString() ); real64 const & minTime = event.getReference< real64 >( EventManager::viewKeyStruct::minTimeString() ); real64 dt = 0; @@ -359,7 +359,7 @@ void AcousticWaveEquationSEM::initializePostInitialConditionsPreSubGroups() AcousticWaveEquationSEM::initializePML(); } - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); applyFreeSurfaceBC( 0.0, domain ); @@ -447,7 +447,7 @@ void AcousticWaveEquationSEM::initializePostInitialConditionsPreSubGroups() //We use the timeStep defined inside the xml else if( m_timestepStabilityLimit==0 ) { - EventManager const & event = getGroupByPath< EventManager >( "/Problem/Events" ); + EventManager const & event = ProblemRepository::getManager< EventManager >( *this ); for( localIndex numSubEvent = 0; numSubEvent < event.numSubGroups(); ++numSubEvent ) { EventBase const * subEvent = static_cast< EventBase const * >( event.getSubGroups()[numSubEvent] ); @@ -503,7 +503,7 @@ void AcousticWaveEquationSEM::initializePostInitialConditionsPreSubGroups() real64 AcousticWaveEquationSEM::computeTimeStep( real64 & dtOut ) { - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, @@ -697,7 +697,7 @@ void AcousticWaveEquationSEM::initializePML() } ); /// Now compute the PML parameters above internally - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & ) @@ -1115,7 +1115,7 @@ real64 AcousticWaveEquationSEM::explicitStepBackward( real64 const & time_n, p_nm1[a] = (p_np1[a] - 2*p_n[a] + p_nm1[a]) / pow( dt, 2 ); } ); - EventManager const & event = getGroupByPath< EventManager >( "/Problem/Events" ); + EventManager const & event = ProblemRepository::getManager< EventManager >( *this ); real64 const & maxTime = event.getReference< real64 >( EventManager::viewKeyStruct::maxTimeString() ); int const maxCycle = int(round( maxTime / dt )); @@ -1292,7 +1292,7 @@ void AcousticWaveEquationSEM::computeUnknowns( real64 const & time_n, } //Modification of cycleNember useful when minTime < 0 - EventManager const & event = getGroupByPath< EventManager >( "/Problem/Events" ); + EventManager const & event = ProblemRepository::getManager< EventManager >( *this ); real64 const & minTime = event.getReference< real64 >( EventManager::viewKeyStruct::minTimeString() ); //localIndex const cycleNumber = time_n/dt; integer const cycleForSource = int(round( -minTime / dt + cycleNumber )); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustoelastic/secondOrderEqn/isotropic/AcousticElasticWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustoelastic/secondOrderEqn/isotropic/AcousticElasticWaveEquationSEM.cpp index b543c6643d5..473b68bc6d2 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustoelastic/secondOrderEqn/isotropic/AcousticElasticWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/acoustoelastic/secondOrderEqn/isotropic/AcousticElasticWaveEquationSEM.cpp @@ -66,7 +66,7 @@ void AcousticElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups m_acousRegions = &(acousSolver->getReference< string_array >( PhysicsSolverBase::viewKeyStruct::targetRegionsString() )); m_elasRegions = &(elasSolver->getReference< string_array >( PhysicsSolverBase::viewKeyStruct::targetRegionsString() )); - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/firstOrderEqn/isotropic/ElasticFirstOrderWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/firstOrderEqn/isotropic/ElasticFirstOrderWaveEquationSEM.cpp index 833d8a76c0d..b79b3134c63 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/firstOrderEqn/isotropic/ElasticFirstOrderWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/firstOrderEqn/isotropic/ElasticFirstOrderWaveEquationSEM.cpp @@ -325,7 +325,7 @@ void ElasticFirstOrderWaveEquationSEM::initializePostInitialConditionsPreSubGrou WaveSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); real64 const time = 0.0; applyFreeSurfaceBC( time, domain ); diff --git a/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/secondOrderEqn/isotropic/ElasticWaveEquationSEM.cpp b/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/secondOrderEqn/isotropic/ElasticWaveEquationSEM.cpp index 07f7c4ad5e4..fcea5255998 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/secondOrderEqn/isotropic/ElasticWaveEquationSEM.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/sem/elastic/secondOrderEqn/isotropic/ElasticWaveEquationSEM.cpp @@ -396,7 +396,7 @@ void ElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups() WaveSolverBase::initializePostInitialConditionsPreSubGroups(); - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); applyFreeSurfaceBC( 0.0, domain ); @@ -486,7 +486,7 @@ void ElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups() //We use the timeStep defined inside the xml else if( m_timestepStabilityLimit==0 ) { - EventManager const & event = getGroupByPath< EventManager >( "/Problem/Events" ); + EventManager const & event = ProblemRepository::getManager< EventManager >( *this ); for( localIndex numSubEvent = 0; numSubEvent < event.numSubGroups(); ++numSubEvent ) { EventBase const * subEvent = static_cast< EventBase const * >( event.getSubGroups()[numSubEvent] ); @@ -539,7 +539,7 @@ void ElasticWaveEquationSEM::initializePostInitialConditionsPreSubGroups() real64 ElasticWaveEquationSEM::computeTimeStep( real64 & dtOut ) { - DomainPartition & domain = getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, diff --git a/src/coreComponents/physicsSolvers/wavePropagation/shared/WaveSolverBase.cpp b/src/coreComponents/physicsSolvers/wavePropagation/shared/WaveSolverBase.cpp index ca598f505df..85f96876898 100644 --- a/src/coreComponents/physicsSolvers/wavePropagation/shared/WaveSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/wavePropagation/shared/WaveSolverBase.cpp @@ -20,7 +20,6 @@ #include "WaveSolverBase.hpp" -#include "dataRepository/KeyNames.hpp" #include "finiteElement/FiniteElementDiscretization.hpp" #include "physicsSolvers/wavePropagation/LogLevelsInfo.hpp" @@ -406,7 +405,7 @@ void WaveSolverBase::postInputInitialization() "Invalid number of physical coordinates for the receivers", InputError, getDataContext() ); - EventManager const & event = getGroupByPath< EventManager >( "/Problem/Events" ); + EventManager const & event = ProblemRepository::getManager< EventManager >( *this ); real64 const & maxTime = event.getReference< real64 >( EventManager::viewKeyStruct::maxTimeString() ); if( m_dtSeismoTrace > 0 ) @@ -450,7 +449,7 @@ real64 WaveSolverBase::explicitStep( real64 const & time_n, localIndex WaveSolverBase::getNumNodesPerElem() { - DomainPartition & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" ); + DomainPartition & domain = getDomainPartition(); NumericalMethodsManager const & numericalMethodManager = domain.getNumericalMethodManager(); diff --git a/src/coreComponents/schema/schema.xsd.other b/src/coreComponents/schema/schema.xsd.other index 1d9ea57c5f2..acd3c24b757 100644 --- a/src/coreComponents/schema/schema.xsd.other +++ b/src/coreComponents/schema/schema.xsd.other @@ -526,7 +526,7 @@ A field can represent a physical variable. (pressure, temperature, global compos - + @@ -1638,7 +1638,7 @@ A field can represent a physical variable. (pressure, temperature, global compos - +