Skip to content
Snippets Groups Projects
Commit d1fefb91 authored by Tom Fischer's avatar Tom Fischer Committed by Dmitri Naumov
Browse files

[PL] Impl. static method createBalance.

parent d5fe945c
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "MeshLib/IO/writeMeshToFile.h" #include "MeshLib/IO/writeMeshToFile.h"
#include "ProcessLib/CalculateSurfaceFlux/CalculateSurfaceFlux.h" #include "ProcessLib/CalculateSurfaceFlux/CalculateSurfaceFlux.h"
#include "ProcessLib/CalculateSurfaceFlux/ParseCalculateSurfaceFluxData.h"
namespace ProcessLib namespace ProcessLib
{ {
...@@ -46,6 +47,28 @@ struct Balance ...@@ -46,6 +47,28 @@ struct Balance
output_mesh_file_name.c_str()); output_mesh_file_name.c_str());
} }
static std::unique_ptr<Balance> createBalance(
BaseLib::ConfigTree const& config,
std::vector<std::unique_ptr<MeshLib::Mesh>> const& meshes,
std::string const& output_directory)
{
std::string mesh_name; // surface mesh the balance will computed on
std::string balance_pv_name;
std::string balance_out_fname;
ProcessLib::parseCalculateSurfaceFluxData(
config, mesh_name, balance_pv_name, balance_out_fname);
if (mesh_name.empty())
{
return std::unique_ptr<ProcessLib::Balance>(nullptr);
}
balance_out_fname =
BaseLib::copyPathToFileName(balance_out_fname, output_directory);
return std::make_unique<Balance>(std::move(mesh_name), meshes,
std::move(balance_pv_name),
std::move(balance_out_fname));
}
void integrate(GlobalVector const& x, double const t, Process const& p, void integrate(GlobalVector const& x, double const t, Process const& p,
int const process_id, int const integration_order, int const process_id, int const integration_order,
MeshLib::Mesh const& bulk_mesh) MeshLib::Mesh const& bulk_mesh)
...@@ -76,6 +99,7 @@ struct Balance ...@@ -76,6 +99,7 @@ struct Balance
MeshLib::IO::writeMeshToFile(surface_mesh, fname); MeshLib::IO::writeMeshToFile(surface_mesh, fname);
} }
private:
MeshLib::Mesh& surface_mesh; MeshLib::Mesh& surface_mesh;
std::string const mesh_name; std::string const mesh_name;
std::string const property_vector_name; std::string const property_vector_name;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment