Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "LogLevelsInfo.hpp"

#include "constitutive/ConstitutiveManager.hpp"
#include "dataRepository/ProblemManagerBase.hpp"

#include "common/format/table/TableFormatter.hpp"
#include "common/format/StringUtilities.hpp"
Expand Down Expand Up @@ -246,12 +247,12 @@ void ConstitutiveDriver::allocateTable( integer const numColumns,

ConstitutiveManager & ConstitutiveDriver::getConstitutiveManager()
{
return this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" );
return getProblemManagerBase( *this ).getConstitutiveManager();
}

ConstitutiveManager const & ConstitutiveDriver::getConstitutiveManager() const
{
return this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" );
return getProblemManagerBase( *this ).getConstitutiveManager();
}

} /* namespace geos */
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void ReactiveFluidDriver::postInputInitialization()
{
// get number of phases and components

ConstitutiveManager & constitutiveManager = this->getGroupByPath< ConstitutiveManager >( "/Problem/domain/Constitutive" );
ConstitutiveManager & constitutiveManager = getProblemManagerBase( *this ).getConstitutiveManager();
ReactiveMultiFluid & fluid = constitutiveManager.getGroup< ReactiveMultiFluid >( m_fluidName );

m_numPhases = fluid.numFluidPhases();
Expand Down Expand Up @@ -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 = getProblemManagerBase( *this ).getConstitutiveManager();
ReactiveMultiFluid & baseFluid = constitutiveManager.getGroup< ReactiveMultiFluid >( m_fluidName );

// depending on logLevel, print some useful info
Expand Down
2 changes: 2 additions & 0 deletions src/coreComponents/dataRepository/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set( dataRepository_headers
ConduitRestart.hpp
DefaultValue.hpp
ExecutableGroup.hpp
GlobalViewKeys.hpp
Group.hpp
HistoryDataSpec.hpp
InputFlags.hpp
Expand All @@ -37,6 +38,7 @@ set( dataRepository_headers
LogLevelsRegistry.hpp
MappedVector.hpp
ObjectCatalog.hpp
ProblemManagerBase.hpp
ReferenceWrapper.hpp
RestartFlags.hpp
Utilities.hpp
Expand Down
69 changes: 69 additions & 0 deletions src/coreComponents/dataRepository/GlobalViewKeys.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* ------------------------------------------------------------------------------------------------------------
* 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 GlobalViewKeys.hpp
*/

#ifndef GEOS_DATAREPOSITORY_GLOBALVIEWKEYS_HPP_
#define GEOS_DATAREPOSITORY_GLOBALVIEWKEYS_HPP_


namespace geos
{
namespace dataRepository
{


/**
* @struct GlobalViewKeys
*/
struct GlobalViewKeys
{
/// @return Root problem group name
static constexpr char const * problem() { return "Problem"; }
/// @return Command-line group name
static constexpr char const * commandLine() { return "commandLine"; }
/// @return Domain partition group name
static constexpr char const * domain() { return "domain"; }
/// @return Constitutive manager group name
static constexpr char const * constitutiveManager() { return "Constitutive"; }
/// @return Event manager group name
static constexpr char const * eventManager() { return "Events"; }
/// @return External data source manager group name
static constexpr char const * externalDataSourceManager() { return "ExternalDataSource"; }
/// @return FieldSpecification manager group name
static constexpr char const * fieldSpecificationManager() { return "FieldSpecifications"; }
/// @return Function manager group name
static constexpr char const * functionManager() { return "Functions"; }
/// @return Geometric object manager group name
static constexpr char const * geometricObjectManager() { return "Geometry"; }
/// @return Mesh manager group name
static constexpr char const * meshManager() { return "Mesh"; }
/// @return Numerical methods manager group name
static constexpr char const * numericalMethodsManager() { return "NumericalMethods"; }
/// @return Outputs manager group name
static constexpr char const * outputManager() { return "Outputs"; }
/// @return Physics solvers manager group name
static constexpr char const * physicsSolverManager() { return "Solvers"; }
/// @return Tasks manager group name
static constexpr char const * tasksManager() { return "Tasks"; }
};

} /* namespace dataRepository */
} /* namespace geos */


#endif /* GEOS_DATAREPOSITORY_GLOBALVIEWKEYS_HPP_ */
4 changes: 3 additions & 1 deletion src/coreComponents/dataRepository/KeyNames.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef GEOS_DATAREPOSITORY__KEYNAMES_HPP_
#define GEOS_DATAREPOSITORY__KEYNAMES_HPP_

#include "GlobalViewKeys.hpp"

#include <string>

namespace geos
Expand All @@ -31,7 +33,7 @@ namespace keys

/// @cond DO_NOT_DOCUMENT

static constexpr auto ProblemManager = "Problem";
static constexpr auto ProblemManager = GlobalViewKeys::problem();
static constexpr auto cellManager = "cellManager";
static constexpr auto particleManager = "particleManager";

Expand Down
135 changes: 135 additions & 0 deletions src/coreComponents/dataRepository/ProblemManagerBase.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
/*
* ------------------------------------------------------------------------------------------------------------
* 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 ProblemManagerBase.hpp
*/

#ifndef GEOS_DATAREPOSITORY_PROBLEMMANAGERBASE_HPP_
#define GEOS_DATAREPOSITORY_PROBLEMMANAGERBASE_HPP_

#include "dataRepository/Group.hpp"

namespace geos
{

class DomainPartition;
class EventManager;
class ExternalDataSourceManager;
class FieldSpecificationManager;
class FunctionManager;
class GeometricObjectManager;
class MeshManager;
class NumericalMethodsManager;
class OutputManager;
class PhysicsSolverManager;
class TasksManager;
namespace constitutive
{
class ConstitutiveManager;
}

namespace dataRepository
{


/**
* @class ProblemManagerBase
*/
class ProblemManagerBase : public Group
{
public:

using Group::Group;

virtual DomainPartition & getDomainPartition() = 0;
virtual DomainPartition const & getDomainPartition() const = 0;

virtual constitutive::ConstitutiveManager & getConstitutiveManager() = 0;
virtual constitutive::ConstitutiveManager const & getConstitutiveManager() const = 0;

virtual EventManager & getEventManager() = 0;
virtual EventManager const & getEventManager() const = 0;

virtual ExternalDataSourceManager & getExternalDataSourceManager() = 0;
virtual ExternalDataSourceManager const & getExternalDataSourceManager() const = 0;

virtual FieldSpecificationManager & getFieldSpecificationManager() = 0;
virtual FieldSpecificationManager const & getFieldSpecificationManager() const = 0;

virtual FunctionManager & getFunctionManager() = 0;
virtual FunctionManager const & getFunctionManager() const = 0;

virtual GeometricObjectManager & getGeometricObjectManager() = 0;
virtual GeometricObjectManager const & getGeometricObjectManager() const = 0;

virtual MeshManager & getMeshManager() = 0;
virtual MeshManager const & getMeshManager() const = 0;

virtual NumericalMethodsManager & getNumericalMethodsManager() = 0;
virtual NumericalMethodsManager const & getNumericalMethodsManager() const = 0;

virtual OutputManager & getOutputManager() = 0;
virtual OutputManager const & getOutputManager() const = 0;

virtual PhysicsSolverManager & getPhysicsSolverManager() = 0;
virtual PhysicsSolverManager const & getPhysicsSolverManager() const = 0;

virtual TasksManager & getTasksManager() = 0;
virtual TasksManager const & getTasksManager() const = 0;


virtual string const & getProblemName() const = 0;
virtual string const & getInputFileName() const = 0;
virtual string const & getRestartFileName() const = 0;
virtual string const & getSchemaFileName() const = 0;

};

/**
* @brief Gives the ProblemManagerBase from the given Group
* @param group The current Group in the Problem tree
* @return A reference to the ProblemManagerBase
*/
inline ProblemManagerBase & getProblemManagerBase( Group & group )
{
Group * current = &group;
while( current->hasParent() )
{
current = &current->getParent();
}
ProblemManagerBase * const root = dynamic_cast< ProblemManagerBase * >( current );
return *root;
}

/**
* @copydoc getProblemManagerBase( Group & )
*/
inline ProblemManagerBase const & getProblemManagerBase( Group const & group )
{
Group const * current = &group;
while( current->hasParent() )
{
current = &current->getParent();
}
ProblemManagerBase const * const root = dynamic_cast< ProblemManagerBase const * >( current );
return *root;
}

} /* namespace dataRepository */
} /* namespace geos */


#endif /* GEOS_DATAREPOSITORY_PROBLEMMANAGERBASE_HPP_ */
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

#include "FieldSpecificationManager.hpp"
#include "dataRepository/ProblemManagerBase.hpp"
#include "mesh/DomainPartition.hpp"
#include "mesh/MeshBody.hpp"
#include "mesh/MeshObjectPath.hpp"
Expand Down Expand Up @@ -70,7 +71,7 @@ void FieldSpecificationManager::expandObjectCatalogs()

void FieldSpecificationManager::validateBoundaryConditions( MeshLevel & mesh ) const
{
DomainPartition const & domain = this->getGroupByPath< DomainPartition >( "/Problem/domain" );
DomainPartition const & domain = getProblemManagerBase( *this ).getDomainPartition();
Group const & meshBodies = domain.getMeshBodies();
// loop over all the FieldSpecification of the XML file
this->forSubGroups< FieldSpecification >( [&] ( FieldSpecification const & fs )
Expand Down
3 changes: 2 additions & 1 deletion src/coreComponents/fileIO/Outputs/RestartOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include "RestartOutput.hpp"
#include "dataRepository/ProblemManagerBase.hpp"

namespace geos
{
Expand All @@ -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 = getProblemManagerBase( *this );
string const fileName = GEOS_FMT( "{}_restart_{:09}", getFileNameRoot(), cycleNumber );
rootGroup.prepareToWrite();
writeTree( joinPath( getOutputDirectory(), fileName ), *(rootGroup.getConduitNode().parent()) );
Expand Down
3 changes: 2 additions & 1 deletion src/coreComponents/fileIO/Outputs/TimeHistoryOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "TimeHistoryOutput.hpp"

#include "dataRepository/ProblemManagerBase.hpp"
#include "fileIO/timeHistory/HDFFile.hpp"
#include "fileIO/LogLevelsInfo.hpp"

Expand Down Expand Up @@ -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 = getProblemManagerBase( *this ).getDomainPartition();
GEOS_LOG_LEVEL_BY_RANK( logInfo::DataCollectorInitialization,
GEOS_FMT( "TimeHistory: '{}' initializing data collectors.", this->getName() ) );
for( auto collectorPath : m_collectorPaths )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -147,7 +148,7 @@ static const string basicSimXml =
</Problem>
)xml";

static const string memOutputPath = "/Outputs/memoryOutput";
static const string memOutputName = "memoryOutput";
static const string memOutputFileName = "MemoryStats_umpireStats.csv";

CommandLineOptions g_commandLineOptions;
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/fileIO/python/PyHistoryCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static PyObject * collect( PyHistoryCollection * self, PyObject * args )
return nullptr;
}

geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" );
geos::DomainPartition & domain = geos::dataRepository::getProblemManagerBase( *self->group ).getDomainPartition();

try
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/fileIO/python/PyHistoryOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static PyObject * output( PyHistoryOutput * self, PyObject * args )
return nullptr;
}

geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" );
geos::DomainPartition & domain = geos::dataRepository::getProblemManagerBase( *self->group ).getDomainPartition();

try
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreComponents/fileIO/python/PyVTKOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static PyObject * output( PyVTKOutput * self, PyObject * args )
return nullptr;
}

geos::DomainPartition & domain = self->group->getGroupByPath< DomainPartition >( "/Problem/domain" );
geos::DomainPartition & domain = geos::dataRepository::getProblemManagerBase( *self->group ).getDomainPartition();

try
{
Expand Down
Loading
Loading