OGS
ProjectData.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <map>
7#include <memory>
8#include <optional>
9#include <string>
10
17#include "ProcessLib/Process.h"
19
20#ifdef OGS_EMBED_PYTHON_INTERPRETER
21#include <pybind11/embed.h>
22#endif
23
24namespace GeoLib
25{
26struct NamedRaster;
27}
28
29namespace MeshLib
30{
31class Mesh;
32}
33
34namespace NumLib
35{
37}
38
39namespace ProcessLib
40{
41class TimeLoop;
42}
43
49class ProjectData final
50{
51public:
55
65 ProjectData(BaseLib::ConfigTree const& project_config,
66 std::string const& output_directory,
67 std::string const& mesh_directory,
68 [[maybe_unused]] std::string const& script_directory);
69
71
72 //
73 // Process interface
74 //
75
77 std::vector<std::unique_ptr<ProcessLib::Process>> const& getProcesses()
78 const
79 {
80 return _processes;
81 }
82
84
85 MeshLib::Mesh& getMesh(std::string const& mesh_name) const;
86 std::vector<std::string> getMeshNames() const;
87
88 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> const&
89 getMedia() const
90 {
91 return _media;
92 }
93
94private:
99 BaseLib::ConfigTree const& process_variables_config);
100
104 std::vector<std::string> parseParameters(
105 BaseLib::ConfigTree const& parameters_config);
106
108 void parseMedia(std::optional<BaseLib::ConfigTree> const& media_config);
109
113 void parseProcesses(BaseLib::ConfigTree const& processes_config,
114 std::string const& output_directory,
115 std::unique_ptr<ChemistryLib::ChemicalSolverInterface>&&
116 chemical_solver_interface);
117
119 void parseTimeLoop(BaseLib::ConfigTree const& config,
120 const std::string& output_directory);
121
122 void parseLinearSolvers(BaseLib::ConfigTree const& config);
123
124 void parseNonlinearSolvers(BaseLib::ConfigTree const& config);
125
126 void parseCurves(std::optional<BaseLib::ConfigTree> const& config);
127
128 std::unique_ptr<ChemistryLib::ChemicalSolverInterface>
130 std::optional<BaseLib::ConfigTree> const& config,
131 const std::string& output_directory);
132
133 std::vector<std::unique_ptr<MeshLib::Mesh>> _mesh_vec;
134 std::vector<GeoLib::NamedRaster> _named_rasters;
135 std::vector<std::unique_ptr<ProcessLib::Process>> _processes;
136 std::vector<ProcessLib::ProcessVariable> _process_variables;
137
139 std::vector<std::unique_ptr<ParameterLib::ParameterBase>> _parameters;
140
141 std::optional<ParameterLib::CoordinateSystem> _local_coordinate_system;
142
143 std::map<int, std::shared_ptr<MaterialPropertyLib::Medium>> _media;
144
146 std::unique_ptr<ProcessLib::TimeLoop> _time_loop;
147
148 std::map<std::string, std::unique_ptr<GlobalLinearSolver>> _linear_solvers;
149
150 std::map<std::string, std::unique_ptr<NumLib::NonlinearSolverBase>>
152 std::map<std::string,
153 std::unique_ptr<MathLib::PiecewiseLinearInterpolation>>
155
156#ifdef OGS_EMBED_PYTHON_INTERPRETER
157 std::optional<pybind11::scoped_interpreter> _py_scoped_interpreter;
158#endif
159};
Interface for coupling OpenGeoSys with an external geochemical solver.
Time loop capable of time-integrating several processes at once.
Definition TimeLoop.h:33
std::map< std::string, std::unique_ptr< GlobalLinearSolver > > _linear_solvers
std::optional< ParameterLib::CoordinateSystem > _local_coordinate_system
ProcessLib::TimeLoop & getTimeLoop()
Definition ProjectData.h:83
std::map< std::string, std::unique_ptr< NumLib::NonlinearSolverBase > > _nonlinear_solvers
MeshLib::Mesh & getMesh(std::string const &mesh_name) const
std::unique_ptr< ChemistryLib::ChemicalSolverInterface > parseChemicalSolverInterface(std::optional< BaseLib::ConfigTree > const &config, const std::string &output_directory)
void parseMedia(std::optional< BaseLib::ConfigTree > const &media_config)
Parses media configuration and saves them in an object.
void parseLinearSolvers(BaseLib::ConfigTree const &config)
void parseProcesses(BaseLib::ConfigTree const &processes_config, std::string const &output_directory, std::unique_ptr< ChemistryLib::ChemicalSolverInterface > &&chemical_solver_interface)
std::vector< std::unique_ptr< ParameterLib::ParameterBase > > _parameters
Buffer for each parameter config passed to the process.
std::vector< std::unique_ptr< ProcessLib::Process > > _processes
std::vector< GeoLib::NamedRaster > _named_rasters
void parseNonlinearSolvers(BaseLib::ConfigTree const &config)
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > const & getMedia() const
Definition ProjectData.h:89
std::vector< ProcessLib::ProcessVariable > _process_variables
void parseProcessVariables(BaseLib::ConfigTree const &process_variables_config)
std::map< std::string, std::unique_ptr< MathLib::PiecewiseLinearInterpolation > > _curves
void parseCurves(std::optional< BaseLib::ConfigTree > const &config)
std::vector< std::unique_ptr< MeshLib::Mesh > > _mesh_vec
std::vector< std::string > getMeshNames() const
void parseTimeLoop(BaseLib::ConfigTree const &config, const std::string &output_directory)
Parses the time loop configuration.
std::map< int, std::shared_ptr< MaterialPropertyLib::Medium > > _media
ProjectData(ProjectData &)=delete
std::vector< std::string > parseParameters(BaseLib::ConfigTree const &parameters_config)
std::vector< std::unique_ptr< ProcessLib::Process > > const & getProcesses() const
Provides read access to the process container.
Definition ProjectData.h:77
std::unique_ptr< ProcessLib::TimeLoop > _time_loop
The time loop used to solve this project's processes.