From c2543b8f741206987ebb0fa0eab27eceefd473d1 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed, 29 Aug 2018 15:06:46 +0200 Subject: [PATCH] [PL/ComponentTransport] Use mesh from ProjectData. --- Applications/ApplicationsLib/ProjectData.cpp | 2 +- .../ComponentTransportProcess.h | 1 + .../CreateComponentTransportProcess.cpp | 19 ++++++++++++------- .../CreateComponentTransportProcess.h | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 8911920b780..d995718043a 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -465,7 +465,7 @@ void ProjectData::parseProcesses(BaseLib::ConfigTree const& processes_config, ProcessLib::ComponentTransport::createComponentTransportProcess( *_mesh_vec[0], std::move(jacobian_assembler), _process_variables, _parameters, integration_order, - process_config, project_directory, output_directory); + process_config, _mesh_vec, output_directory); } else #endif diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.h b/ProcessLib/ComponentTransport/ComponentTransportProcess.h index 9bf42b2c8f5..9b805dc8c51 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.h +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.h @@ -16,6 +16,7 @@ namespace ProcessLib { + namespace ComponentTransport { /** diff --git a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp index bbedc8956f2..0c1bdf14431 100644 --- a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp @@ -33,7 +33,7 @@ std::unique_ptr<Process> createComponentTransportProcess( std::vector<std::unique_ptr<ParameterBase>> const& parameters, unsigned const integration_order, BaseLib::ConfigTree const& config, - std::string const& project_directory, + std::vector<std::unique_ptr<MeshLib::Mesh>> const& meshes, std::string const& output_directory) { //! \ogs_file_param{prj__processes__process__type} @@ -171,26 +171,31 @@ std::unique_ptr<Process> createComponentTransportProcess( named_function_caller); // for the balance - std::string mesh_name; // surface mesh the balance will computed on + std::string balance_mesh_name; // surface mesh the balance will computed on std::string balance_pv_name; std::string balance_out_fname; std::unique_ptr<MeshLib::Mesh> surface_mesh; ProcessLib::parseCalculateSurfaceFluxData( - config, mesh_name, balance_pv_name, balance_out_fname); + config, balance_mesh_name, balance_pv_name, balance_out_fname); if (!mesh_name.empty()) // balance is optional { - mesh_name = BaseLib::copyPathToFileName(mesh_name, project_directory); + // find the mesh for the specified mesh_name + auto balance_mesh = BaseLib::findElementOrError( + meshes.begin(), meshes.end(), + [&balance_mesh_name](auto const& m) { + return balance_mesh_name == m->getName(); + }, + "Expected to find o mesh named " + balance_mesh_name + + " for balance calculation."); balance_out_fname = BaseLib::copyPathToFileName(balance_out_fname, output_directory); - surface_mesh.reset(MeshLib::IO::readMeshFromFile(mesh_name)); - DBUG( "read balance meta data:\n\tbalance mesh:\"%s\"\n\tproperty name: " "\"%s\"\n\toutput to: \"%s\"", - mesh_name.c_str(), balance_pv_name.c_str(), + balance_mesh_name.c_str(), balance_pv_name.c_str(), balance_out_fname.c_str()); // Surface mesh and bulk mesh must have equal axial symmetry flags! diff --git a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.h b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.h index 30c666a9356..8249620bb7a 100644 --- a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.h +++ b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.h @@ -23,7 +23,7 @@ std::unique_ptr<Process> createComponentTransportProcess( std::vector<std::unique_ptr<ParameterBase>> const& parameters, unsigned const integration_order, BaseLib::ConfigTree const& config, - std::string const& project_directory, + std::vector<std::unique_ptr<MeshLib::Mesh>> const& meshes, std::string const& output_directory); } // namespace ComponentTransport -- GitLab