Example #1
0
ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
                         std::string const& project_directory,
                         std::string const& output_directory)
{
    std::string const geometry_file = BaseLib::copyPathToFileName(
        //! \ogs_file_param{prj__geometry}
        project_config.getConfigParameter<std::string>("geometry"),
        project_directory);
    detail::readGeometry(geometry_file, *_geoObjects);

    {
        //! \ogs_file_param{prj__mesh}
        auto const mesh_param = project_config.getConfigParameter("mesh");

        std::string const mesh_file = BaseLib::copyPathToFileName(
            mesh_param.getValue<std::string>(), project_directory);

        MeshLib::Mesh* const mesh = MeshLib::IO::readMeshFromFile(mesh_file);
        if (!mesh)
        {
            OGS_FATAL("Could not read mesh from \'%s\' file. No mesh added.",
                      mesh_file.c_str());
        }

        if (auto const axially_symmetric =
                //! \ogs_file_attr{prj__mesh__axially_symmetric}
            mesh_param.getConfigAttributeOptional<bool>("axially_symmetric"))
        {
            mesh->setAxiallySymmetric(*axially_symmetric);
        }
        _mesh_vec.push_back(mesh);
    }

    //! \ogs_file_param{prj__curves}
    parseCurves(project_config.getConfigSubtreeOptional("curves"));

    //! \ogs_file_param{prj__parameters}
    parseParameters(project_config.getConfigSubtree("parameters"));

    //! \ogs_file_param{prj__process_variables}
    parseProcessVariables(project_config.getConfigSubtree("process_variables"));

    //! \ogs_file_param{prj__processes}
    parseProcesses(project_config.getConfigSubtree("processes"),
                   project_directory, output_directory);

    //! \ogs_file_param{prj__linear_solvers}
    parseLinearSolvers(project_config.getConfigSubtree("linear_solvers"));

    //! \ogs_file_param{prj__nonlinear_solvers}
    parseNonlinearSolvers(project_config.getConfigSubtree("nonlinear_solvers"));

    //! \ogs_file_param{prj__time_loop}
    parseTimeLoop(project_config.getConfigSubtree("time_loop"),
                  output_directory);
}
Example #2
0
ProjectData::ProjectData(BaseLib::ConfigTree const& project_config,
	std::string const& path)
{
	// geometry
	std::string const geometry_file = BaseLib::copyPathToFileName(
			project_config.getConfParam<std::string>("geometry"), path
		);
	detail::readGeometry(geometry_file, *_geoObjects);

	// mesh
	std::string const mesh_file = BaseLib::copyPathToFileName(
			project_config.getConfParam<std::string>("mesh"), path
		);

	MeshLib::Mesh* const mesh = FileIO::readMeshFromFile(mesh_file);
	if (!mesh) {
		ERR("Could not read mesh from \'%s\' file. No mesh added.",
			mesh_file.c_str());
		std::abort();
	}
	_mesh_vec.push_back(mesh);

	// process variables

	parseProcessVariables(project_config.getConfSubtree("process_variables"));

	// parameters
	parseParameters(project_config.getConfSubtree("parameters"));

	// processes
	parseProcesses(project_config.getConfSubtree("processes"));

	// output
	parseOutput(project_config.getConfSubtree("output"), path);

	// timestepping
	parseTimeStepping(project_config.getConfSubtree("time_stepping"));

	parseLinearSolvers(project_config.getConfSubtree("linear_solvers"));

	parseNonlinearSolvers(project_config.getConfSubtree("nonlinear_solvers"));
}