From 85762ad3f38e7584f6b2ef2cb7bbdbe124792c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20L=C3=BCbke?= Date: Mon, 3 Mar 2025 13:37:26 +0100 Subject: [PATCH] chore: Add LICENSE.txt for poet directory refactor: Rename 'poet' directory to 'litephreeqc' --- CMakeLists.txt | 4 +- {poet => litephreeqc}/CMakeLists.txt | 0 litephreeqc/LICENSE.txt | 10 ++ .../include/PhreeqcEngine.hpp | 13 ++ .../include/PhreeqcKnobs.hpp | 13 ++ .../include/PhreeqcMatrix.hpp | 13 ++ .../include/PhreeqcRunner.hpp | 13 ++ {poet => litephreeqc}/src/Engine.cpp | 13 ++ {poet => litephreeqc}/src/Knobs.cpp | 13 ++ .../src/PhreeqcMatrix/Access.cpp | 13 ++ .../src/PhreeqcMatrix/Ctor.cpp | 13 ++ .../src/PhreeqcMatrix/Init.cpp | 13 ++ .../src/PhreeqcMatrix/Misc.cpp | 13 ++ {poet => litephreeqc}/src/Runner.cpp | 13 ++ .../src/Wrapper/EquilibriumCompWrapper.cpp | 13 ++ .../src/Wrapper/EquilibriumWrapper.cpp | 13 ++ .../src/Wrapper/EquilibriumWrapper.hpp | 13 ++ .../src/Wrapper/ExchangeCompWrapper.cpp | 13 ++ .../src/Wrapper/ExchangeWrapper.cpp | 59 ++++--- .../src/Wrapper/ExchangeWrapper.hpp | 13 ++ .../src/Wrapper/KineticCompWrapper.cpp | 13 ++ .../src/Wrapper/KineticWrapper.cpp | 13 ++ .../src/Wrapper/KineticWrapper.hpp | 13 ++ .../src/Wrapper/SolutionWrapper.cpp | 13 ++ .../src/Wrapper/SolutionWrapper.hpp | 13 ++ .../src/Wrapper/SurfaceChargeWrapper.cpp | 13 ++ .../src/Wrapper/SurfaceCompWrapper.cpp | 13 ++ .../src/Wrapper/SurfaceWrapper.cpp | 13 ++ .../src/Wrapper/SurfaceWrapper.hpp | 13 ++ litephreeqc/src/Wrapper/WrapperBase.hpp | 31 ++++ {poet => litephreeqc}/test/IPhreeqcReader.cpp | 0 {poet => litephreeqc}/test/IPhreeqcReader.hpp | 0 {poet => litephreeqc}/test/barite_db.dat | 0 {poet => litephreeqc}/test/barite_het.pqi | 0 {poet => litephreeqc}/test/dolo.pqi | 0 {poet => litephreeqc}/test/phreeqc_kin.dat | 0 .../test/run_kin_cor_end2.pqi | 0 {poet => litephreeqc}/test/testGetters.cpp | 0 litephreeqc/test/testGolemRunner.cpp | 147 ++++++++++++++++++ {poet => litephreeqc}/test/testInput.hpp.in | 0 .../test/testPhreeqcEngine.cpp | 13 ++ .../test/testPhreeqcKnobs.cpp | 13 ++ .../test/testPhreeqcMatrix.cpp | 13 ++ .../test/testPhreeqcRunner.cpp | 13 ++ {poet => litephreeqc}/test/utils.cpp | 13 ++ litephreeqc/test/utils.hpp | 18 +++ poet/src/Wrapper/WrapperBase.hpp | 18 --- poet/test/testGolemRunner.cpp | 144 ----------------- poet/test/utils.hpp | 5 - .../{GFZ.cpp => litephreeqc_funcs.cpp} | 13 ++ 50 files changed, 647 insertions(+), 192 deletions(-) rename {poet => litephreeqc}/CMakeLists.txt (100%) create mode 100644 litephreeqc/LICENSE.txt rename {poet => litephreeqc}/include/PhreeqcEngine.hpp (73%) rename {poet => litephreeqc}/include/PhreeqcKnobs.hpp (84%) rename {poet => litephreeqc}/include/PhreeqcMatrix.hpp (96%) rename {poet => litephreeqc}/include/PhreeqcRunner.hpp (85%) rename {poet => litephreeqc}/src/Engine.cpp (94%) rename {poet => litephreeqc}/src/Knobs.cpp (68%) rename {poet => litephreeqc}/src/PhreeqcMatrix/Access.cpp (95%) rename {poet => litephreeqc}/src/PhreeqcMatrix/Ctor.cpp (81%) rename {poet => litephreeqc}/src/PhreeqcMatrix/Init.cpp (94%) rename {poet => litephreeqc}/src/PhreeqcMatrix/Misc.cpp (75%) rename {poet => litephreeqc}/src/Runner.cpp (85%) rename {poet => litephreeqc}/src/Wrapper/EquilibriumCompWrapper.cpp (63%) rename {poet => litephreeqc}/src/Wrapper/EquilibriumWrapper.cpp (85%) rename {poet => litephreeqc}/src/Wrapper/EquilibriumWrapper.hpp (71%) rename {poet => litephreeqc}/src/Wrapper/ExchangeCompWrapper.cpp (74%) rename {poet => litephreeqc}/src/Wrapper/ExchangeWrapper.cpp (57%) rename {poet => litephreeqc}/src/Wrapper/ExchangeWrapper.hpp (67%) rename {poet => litephreeqc}/src/Wrapper/KineticCompWrapper.cpp (70%) rename {poet => litephreeqc}/src/Wrapper/KineticWrapper.cpp (83%) rename {poet => litephreeqc}/src/Wrapper/KineticWrapper.hpp (67%) rename {poet => litephreeqc}/src/Wrapper/SolutionWrapper.cpp (85%) rename {poet => litephreeqc}/src/Wrapper/SolutionWrapper.hpp (67%) rename {poet => litephreeqc}/src/Wrapper/SurfaceChargeWrapper.cpp (83%) rename {poet => litephreeqc}/src/Wrapper/SurfaceCompWrapper.cpp (77%) rename {poet => litephreeqc}/src/Wrapper/SurfaceWrapper.cpp (88%) rename {poet => litephreeqc}/src/Wrapper/SurfaceWrapper.hpp (81%) create mode 100644 litephreeqc/src/Wrapper/WrapperBase.hpp rename {poet => litephreeqc}/test/IPhreeqcReader.cpp (100%) rename {poet => litephreeqc}/test/IPhreeqcReader.hpp (100%) rename {poet => litephreeqc}/test/barite_db.dat (100%) rename {poet => litephreeqc}/test/barite_het.pqi (100%) rename {poet => litephreeqc}/test/dolo.pqi (100%) rename {poet => litephreeqc}/test/phreeqc_kin.dat (100%) rename {poet => litephreeqc}/test/run_kin_cor_end2.pqi (100%) rename {poet => litephreeqc}/test/testGetters.cpp (100%) create mode 100644 litephreeqc/test/testGolemRunner.cpp rename {poet => litephreeqc}/test/testInput.hpp.in (100%) rename {poet => litephreeqc}/test/testPhreeqcEngine.cpp (76%) rename {poet => litephreeqc}/test/testPhreeqcKnobs.cpp (82%) rename {poet => litephreeqc}/test/testPhreeqcMatrix.cpp (94%) rename {poet => litephreeqc}/test/testPhreeqcRunner.cpp (87%) rename {poet => litephreeqc}/test/utils.cpp (54%) create mode 100644 litephreeqc/test/utils.hpp delete mode 100644 poet/src/Wrapper/WrapperBase.hpp delete mode 100644 poet/test/testGolemRunner.cpp delete mode 100644 poet/test/utils.hpp rename src/phreeqcpp/{GFZ.cpp => litephreeqc_funcs.cpp} (86%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e0d83e0..fd709542 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,7 +220,7 @@ target_sources(IPhreeqc src/phreeqcpp/UserPunch.cpp src/phreeqcpp/UserPunch.h src/phreeqcpp/utilities.cpp - src/phreeqcpp/GFZ.cpp + src/phreeqcpp/litephreeqc_funcs.cpp src/thread.h src/Var.c src/Var.h @@ -470,7 +470,7 @@ if (STANDALONE_BUILD) endif() endif() -add_subdirectory(poet) +add_subdirectory(litephreeqc) # get_cmake_property(_variableNames VARIABLES) # list (SORT _variableNames) diff --git a/poet/CMakeLists.txt b/litephreeqc/CMakeLists.txt similarity index 100% rename from poet/CMakeLists.txt rename to litephreeqc/CMakeLists.txt diff --git a/litephreeqc/LICENSE.txt b/litephreeqc/LICENSE.txt new file mode 100644 index 00000000..7a9f35de --- /dev/null +++ b/litephreeqc/LICENSE.txt @@ -0,0 +1,10 @@ +This project is subject to the original PHREEQC license. `litephreeqc` is a +version of the PHREEQC code that has been modified to be used as a library. + +It adds a C++ interface on top of the original PHREEQC code, with small changes +to the original code base. + +Authors of Modifications: +- Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam +- Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + diff --git a/poet/include/PhreeqcEngine.hpp b/litephreeqc/include/PhreeqcEngine.hpp similarity index 73% rename from poet/include/PhreeqcEngine.hpp rename to litephreeqc/include/PhreeqcEngine.hpp index 5bb3132c..86936450 100644 --- a/poet/include/PhreeqcEngine.hpp +++ b/litephreeqc/include/PhreeqcEngine.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include "PhreeqcMatrix.hpp" diff --git a/poet/include/PhreeqcKnobs.hpp b/litephreeqc/include/PhreeqcKnobs.hpp similarity index 84% rename from poet/include/PhreeqcKnobs.hpp rename to litephreeqc/include/PhreeqcKnobs.hpp index ff599e9f..62a060d1 100644 --- a/poet/include/PhreeqcKnobs.hpp +++ b/litephreeqc/include/PhreeqcKnobs.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include diff --git a/poet/include/PhreeqcMatrix.hpp b/litephreeqc/include/PhreeqcMatrix.hpp similarity index 96% rename from poet/include/PhreeqcMatrix.hpp rename to litephreeqc/include/PhreeqcMatrix.hpp index d95b71a7..3632dc57 100644 --- a/poet/include/PhreeqcMatrix.hpp +++ b/litephreeqc/include/PhreeqcMatrix.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include diff --git a/poet/include/PhreeqcRunner.hpp b/litephreeqc/include/PhreeqcRunner.hpp similarity index 85% rename from poet/include/PhreeqcRunner.hpp rename to litephreeqc/include/PhreeqcRunner.hpp index ef95a5c3..77c9c1bb 100644 --- a/poet/include/PhreeqcRunner.hpp +++ b/litephreeqc/include/PhreeqcRunner.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include "PhreeqcEngine.hpp" diff --git a/poet/src/Engine.cpp b/litephreeqc/src/Engine.cpp similarity index 94% rename from poet/src/Engine.cpp rename to litephreeqc/src/Engine.cpp index 7c81b3c3..cc36466d 100644 --- a/poet/src/Engine.cpp +++ b/litephreeqc/src/Engine.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "PhreeqcEngine.hpp" #include #include diff --git a/poet/src/Knobs.cpp b/litephreeqc/src/Knobs.cpp similarity index 68% rename from poet/src/Knobs.cpp rename to litephreeqc/src/Knobs.cpp index f77d4294..fc969003 100644 --- a/poet/src/Knobs.cpp +++ b/litephreeqc/src/Knobs.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "PhreeqcKnobs.hpp" #include diff --git a/poet/src/PhreeqcMatrix/Access.cpp b/litephreeqc/src/PhreeqcMatrix/Access.cpp similarity index 95% rename from poet/src/PhreeqcMatrix/Access.cpp rename to litephreeqc/src/PhreeqcMatrix/Access.cpp index 01d77b49..87387d16 100644 --- a/poet/src/PhreeqcMatrix/Access.cpp +++ b/litephreeqc/src/PhreeqcMatrix/Access.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include #include #include diff --git a/poet/src/PhreeqcMatrix/Ctor.cpp b/litephreeqc/src/PhreeqcMatrix/Ctor.cpp similarity index 81% rename from poet/src/PhreeqcMatrix/Ctor.cpp rename to litephreeqc/src/PhreeqcMatrix/Ctor.cpp index 0c0b4ad0..a5b6e9fb 100644 --- a/poet/src/PhreeqcMatrix/Ctor.cpp +++ b/litephreeqc/src/PhreeqcMatrix/Ctor.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "IPhreeqc.hpp" #include "PhreeqcKnobs.hpp" #include "PhreeqcMatrix.hpp" diff --git a/poet/src/PhreeqcMatrix/Init.cpp b/litephreeqc/src/PhreeqcMatrix/Init.cpp similarity index 94% rename from poet/src/PhreeqcMatrix/Init.cpp rename to litephreeqc/src/PhreeqcMatrix/Init.cpp index 5fdc9bd7..82b359f3 100644 --- a/poet/src/PhreeqcMatrix/Init.cpp +++ b/litephreeqc/src/PhreeqcMatrix/Init.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "PhreeqcMatrix.hpp" #include "../Wrapper/EquilibriumWrapper.hpp" diff --git a/poet/src/PhreeqcMatrix/Misc.cpp b/litephreeqc/src/PhreeqcMatrix/Misc.cpp similarity index 75% rename from poet/src/PhreeqcMatrix/Misc.cpp rename to litephreeqc/src/PhreeqcMatrix/Misc.cpp index d953c71d..fdb0b09e 100644 --- a/poet/src/PhreeqcMatrix/Misc.cpp +++ b/litephreeqc/src/PhreeqcMatrix/Misc.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "PhreeqcMatrix.hpp" #include diff --git a/poet/src/Runner.cpp b/litephreeqc/src/Runner.cpp similarity index 85% rename from poet/src/Runner.cpp rename to litephreeqc/src/Runner.cpp index 3d9e7cf6..15cecf40 100644 --- a/poet/src/Runner.cpp +++ b/litephreeqc/src/Runner.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "PhreeqcEngine.hpp" #include "PhreeqcMatrix.hpp" #include "PhreeqcRunner.hpp" diff --git a/poet/src/Wrapper/EquilibriumCompWrapper.cpp b/litephreeqc/src/Wrapper/EquilibriumCompWrapper.cpp similarity index 63% rename from poet/src/Wrapper/EquilibriumCompWrapper.cpp rename to litephreeqc/src/Wrapper/EquilibriumCompWrapper.cpp index e2dee0a0..3d4c2324 100644 --- a/poet/src/Wrapper/EquilibriumCompWrapper.cpp +++ b/litephreeqc/src/Wrapper/EquilibriumCompWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "EquilibriumWrapper.hpp" EquilibriumWrapper::EquilibriumCompWrapper::EquilibriumCompWrapper( diff --git a/poet/src/Wrapper/EquilibriumWrapper.cpp b/litephreeqc/src/Wrapper/EquilibriumWrapper.cpp similarity index 85% rename from poet/src/Wrapper/EquilibriumWrapper.cpp rename to litephreeqc/src/Wrapper/EquilibriumWrapper.cpp index 007203bb..3e2bd617 100644 --- a/poet/src/Wrapper/EquilibriumWrapper.cpp +++ b/litephreeqc/src/Wrapper/EquilibriumWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "EquilibriumWrapper.hpp" #include diff --git a/poet/src/Wrapper/EquilibriumWrapper.hpp b/litephreeqc/src/Wrapper/EquilibriumWrapper.hpp similarity index 71% rename from poet/src/Wrapper/EquilibriumWrapper.hpp rename to litephreeqc/src/Wrapper/EquilibriumWrapper.hpp index be3efb03..e3cf5e28 100644 --- a/poet/src/Wrapper/EquilibriumWrapper.hpp +++ b/litephreeqc/src/Wrapper/EquilibriumWrapper.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include "PPassemblage.h" diff --git a/poet/src/Wrapper/ExchangeCompWrapper.cpp b/litephreeqc/src/Wrapper/ExchangeCompWrapper.cpp similarity index 74% rename from poet/src/Wrapper/ExchangeCompWrapper.cpp rename to litephreeqc/src/Wrapper/ExchangeCompWrapper.cpp index 57689420..2b20e368 100644 --- a/poet/src/Wrapper/ExchangeCompWrapper.cpp +++ b/litephreeqc/src/Wrapper/ExchangeCompWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "ExchangeWrapper.hpp" ExchangeWrapper::ExchangeCompWrapper::ExchangeCompWrapper(cxxExchComp &comp) diff --git a/poet/src/Wrapper/ExchangeWrapper.cpp b/litephreeqc/src/Wrapper/ExchangeWrapper.cpp similarity index 57% rename from poet/src/Wrapper/ExchangeWrapper.cpp rename to litephreeqc/src/Wrapper/ExchangeWrapper.cpp index 378e10e0..26002ce2 100644 --- a/poet/src/Wrapper/ExchangeWrapper.cpp +++ b/litephreeqc/src/Wrapper/ExchangeWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "ExchangeWrapper.hpp" ExchangeWrapper::ExchangeWrapper(cxxExchange *exch, @@ -21,36 +34,36 @@ ExchangeWrapper::ExchangeWrapper(cxxExchange *exch, num_elements += exchange_comps.back()->size(); } - // const std::size_t defined_comps = exchange->Get_exchange_comps().size(); + // const std::size_t defined_comps = exchange->Get_exchange_comps().size(); - // auto header_it = remaining_field_header.begin(); + // auto header_it = remaining_field_header.begin(); - // while (header_it != remaining_field_header.end() && - // exchange_comps.size() < defined_comps) { - // const std::string formular = *header_it; + // while (header_it != remaining_field_header.end() && + // exchange_comps.size() < defined_comps) { + // const std::string formular = *header_it; - // auto it = std::find_if(exchange->Get_exchange_comps().begin(), - // exchange->Get_exchange_comps().end(), - // [&](const cxxExchComp &comp) { - // return comp.Get_formula() == formular; - // }); + // auto it = std::find_if(exchange->Get_exchange_comps().begin(), + // exchange->Get_exchange_comps().end(), + // [&](const cxxExchComp &comp) { + // return comp.Get_formula() == formular; + // }); - // if (it != exchange->Get_exchange_comps().end()) { - // const size_t i = this->exchange_comps.size(); + // if (it != exchange->Get_exchange_comps().end()) { + // const size_t i = this->exchange_comps.size(); - // exchange_comps.push_back(std::make_unique(*it)); - // header_it += this->exchange_comps[i]->size(); - // num_elements += this->exchange_comps[i]->size(); - // continue; - // } + // exchange_comps.push_back(std::make_unique(*it)); + // header_it += this->exchange_comps[i]->size(); + // num_elements += this->exchange_comps[i]->size(); + // continue; + // } - // header_it++; - // } + // header_it++; + // } - // if (exchange_comps.size() != defined_comps) { - // throw std::runtime_error( - // "Not all exchange components found in Phreeqc variables"); - // } + // if (exchange_comps.size() != defined_comps) { + // throw std::runtime_error( + // "Not all exchange components found in Phreeqc variables"); + // } } void ExchangeWrapper::get(std::span &exchange) const { diff --git a/poet/src/Wrapper/ExchangeWrapper.hpp b/litephreeqc/src/Wrapper/ExchangeWrapper.hpp similarity index 67% rename from poet/src/Wrapper/ExchangeWrapper.hpp rename to litephreeqc/src/Wrapper/ExchangeWrapper.hpp index dd4824cf..2c9f8e00 100644 --- a/poet/src/Wrapper/ExchangeWrapper.hpp +++ b/litephreeqc/src/Wrapper/ExchangeWrapper.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include "ExchComp.h" diff --git a/poet/src/Wrapper/KineticCompWrapper.cpp b/litephreeqc/src/Wrapper/KineticCompWrapper.cpp similarity index 70% rename from poet/src/Wrapper/KineticCompWrapper.cpp rename to litephreeqc/src/Wrapper/KineticCompWrapper.cpp index ff601977..a0d32be8 100644 --- a/poet/src/Wrapper/KineticCompWrapper.cpp +++ b/litephreeqc/src/Wrapper/KineticCompWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "KineticWrapper.hpp" #include #include diff --git a/poet/src/Wrapper/KineticWrapper.cpp b/litephreeqc/src/Wrapper/KineticWrapper.cpp similarity index 83% rename from poet/src/Wrapper/KineticWrapper.cpp rename to litephreeqc/src/Wrapper/KineticWrapper.cpp index f77396b1..97565af1 100644 --- a/poet/src/Wrapper/KineticWrapper.cpp +++ b/litephreeqc/src/Wrapper/KineticWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "KineticWrapper.hpp" #include diff --git a/poet/src/Wrapper/KineticWrapper.hpp b/litephreeqc/src/Wrapper/KineticWrapper.hpp similarity index 67% rename from poet/src/Wrapper/KineticWrapper.hpp rename to litephreeqc/src/Wrapper/KineticWrapper.hpp index ba1aeda7..f7a67b89 100644 --- a/poet/src/Wrapper/KineticWrapper.hpp +++ b/litephreeqc/src/Wrapper/KineticWrapper.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include "KineticsComp.h" diff --git a/poet/src/Wrapper/SolutionWrapper.cpp b/litephreeqc/src/Wrapper/SolutionWrapper.cpp similarity index 85% rename from poet/src/Wrapper/SolutionWrapper.cpp rename to litephreeqc/src/Wrapper/SolutionWrapper.cpp index 0f8e1c34..9156b382 100644 --- a/poet/src/Wrapper/SolutionWrapper.cpp +++ b/litephreeqc/src/Wrapper/SolutionWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "SolutionWrapper.hpp" #include "NameDouble.h" #include diff --git a/poet/src/Wrapper/SolutionWrapper.hpp b/litephreeqc/src/Wrapper/SolutionWrapper.hpp similarity index 67% rename from poet/src/Wrapper/SolutionWrapper.hpp rename to litephreeqc/src/Wrapper/SolutionWrapper.hpp index 26521fd0..ee909aec 100644 --- a/poet/src/Wrapper/SolutionWrapper.hpp +++ b/litephreeqc/src/Wrapper/SolutionWrapper.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include "Solution.h" diff --git a/poet/src/Wrapper/SurfaceChargeWrapper.cpp b/litephreeqc/src/Wrapper/SurfaceChargeWrapper.cpp similarity index 83% rename from poet/src/Wrapper/SurfaceChargeWrapper.cpp rename to litephreeqc/src/Wrapper/SurfaceChargeWrapper.cpp index 1eccfe7e..a173a5ee 100644 --- a/poet/src/Wrapper/SurfaceChargeWrapper.cpp +++ b/litephreeqc/src/Wrapper/SurfaceChargeWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "SurfaceWrapper.hpp" SurfaceWrapper::SurfaceChargeWrapper::SurfaceChargeWrapper( diff --git a/poet/src/Wrapper/SurfaceCompWrapper.cpp b/litephreeqc/src/Wrapper/SurfaceCompWrapper.cpp similarity index 77% rename from poet/src/Wrapper/SurfaceCompWrapper.cpp rename to litephreeqc/src/Wrapper/SurfaceCompWrapper.cpp index 2bc45d1d..410d965f 100644 --- a/poet/src/Wrapper/SurfaceCompWrapper.cpp +++ b/litephreeqc/src/Wrapper/SurfaceCompWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "SurfaceWrapper.hpp" SurfaceWrapper::SurfaceCompWrapper::SurfaceCompWrapper(cxxSurfaceComp &comp) diff --git a/poet/src/Wrapper/SurfaceWrapper.cpp b/litephreeqc/src/Wrapper/SurfaceWrapper.cpp similarity index 88% rename from poet/src/Wrapper/SurfaceWrapper.cpp rename to litephreeqc/src/Wrapper/SurfaceWrapper.cpp index 6fe396a9..c85bebc7 100644 --- a/poet/src/Wrapper/SurfaceWrapper.cpp +++ b/litephreeqc/src/Wrapper/SurfaceWrapper.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "SurfaceWrapper.hpp" #include "SurfaceComp.h" diff --git a/poet/src/Wrapper/SurfaceWrapper.hpp b/litephreeqc/src/Wrapper/SurfaceWrapper.hpp similarity index 81% rename from poet/src/Wrapper/SurfaceWrapper.hpp rename to litephreeqc/src/Wrapper/SurfaceWrapper.hpp index b96b902a..9b9b5a5e 100644 --- a/poet/src/Wrapper/SurfaceWrapper.hpp +++ b/litephreeqc/src/Wrapper/SurfaceWrapper.hpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #pragma once #include "Surface.h" diff --git a/litephreeqc/src/Wrapper/WrapperBase.hpp b/litephreeqc/src/Wrapper/WrapperBase.hpp new file mode 100644 index 00000000..40311942 --- /dev/null +++ b/litephreeqc/src/Wrapper/WrapperBase.hpp @@ -0,0 +1,31 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + +#pragma once + +#include +#include + +class WrapperBase { +public: + virtual ~WrapperBase() = default; + + std::size_t size() const { return this->num_elements; }; + + virtual void get(std::span &data) const = 0; + + virtual void set(const std::span &data) = 0; + +protected: + std::size_t num_elements = 0; +}; \ No newline at end of file diff --git a/poet/test/IPhreeqcReader.cpp b/litephreeqc/test/IPhreeqcReader.cpp similarity index 100% rename from poet/test/IPhreeqcReader.cpp rename to litephreeqc/test/IPhreeqcReader.cpp diff --git a/poet/test/IPhreeqcReader.hpp b/litephreeqc/test/IPhreeqcReader.hpp similarity index 100% rename from poet/test/IPhreeqcReader.hpp rename to litephreeqc/test/IPhreeqcReader.hpp diff --git a/poet/test/barite_db.dat b/litephreeqc/test/barite_db.dat similarity index 100% rename from poet/test/barite_db.dat rename to litephreeqc/test/barite_db.dat diff --git a/poet/test/barite_het.pqi b/litephreeqc/test/barite_het.pqi similarity index 100% rename from poet/test/barite_het.pqi rename to litephreeqc/test/barite_het.pqi diff --git a/poet/test/dolo.pqi b/litephreeqc/test/dolo.pqi similarity index 100% rename from poet/test/dolo.pqi rename to litephreeqc/test/dolo.pqi diff --git a/poet/test/phreeqc_kin.dat b/litephreeqc/test/phreeqc_kin.dat similarity index 100% rename from poet/test/phreeqc_kin.dat rename to litephreeqc/test/phreeqc_kin.dat diff --git a/poet/test/run_kin_cor_end2.pqi b/litephreeqc/test/run_kin_cor_end2.pqi similarity index 100% rename from poet/test/run_kin_cor_end2.pqi rename to litephreeqc/test/run_kin_cor_end2.pqi diff --git a/poet/test/testGetters.cpp b/litephreeqc/test/testGetters.cpp similarity index 100% rename from poet/test/testGetters.cpp rename to litephreeqc/test/testGetters.cpp diff --git a/litephreeqc/test/testGolemRunner.cpp b/litephreeqc/test/testGolemRunner.cpp new file mode 100644 index 00000000..ecabbe07 --- /dev/null +++ b/litephreeqc/test/testGolemRunner.cpp @@ -0,0 +1,147 @@ +// Time-stamp: "Last modified 2025-07-28 13:03:01 delucia" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "PhreeqcEngine.hpp" +#include "PhreeqcMatrix.hpp" +#include "PhreeqcRunner.hpp" + +std::string readFile(const std::string &path) { + std::string string_rpath(PATH_MAX, '\0'); + + if (realpath(path.c_str(), string_rpath.data()) == nullptr) { + throw std::runtime_error(":: Failed to resolve the realpath to file " + + path); + } + + std::ifstream file(string_rpath); + + if (!file.is_open()) { + throw std::runtime_error(":: Failed to open file: " + path); + } + + std::stringstream buffer; + buffer << file.rdbuf(); + + return buffer.str(); +} + +// pretty print a vector, standard implementation from stackoverflow +template +std::ostream &operator<<(std::ostream &os, std::vector vec) { + os << "{ "; + std::copy(vec.begin(), vec.end(), std::ostream_iterator(os, ", ")); + os << " }"; + return os; +} + +int main(int argc, char *argv[]) { + + if (argc < 3) { + std::cout << "::" << argv[0] << ": two args needed, script and database\n"; + return 1; + } + + ////// INITIALISATION + // read Script and Database and put it in a std::string + auto script = readFile(argv[1]); + auto db = readFile(argv[2]); + + // Create the matrix directly from database and init script + PhreeqcMatrix pqc_mat(db, script, true, true); + + // How many different SOLUTIONS ("CELLS") are defined in the script? + const auto ids = pqc_mat.getIds(); + + int n = ids.size(); + + std::cout << ":: Found " << n << " distinct PHREEQC problems \n"; + std::cout << ids << "\n"; + + const auto solutes = pqc_mat.getSolutionNames(); + std::cout << ":: These are the common solutes across all the " << n + << " problems: \n"; + std::cout << solutes << "\n"; + + // iterate on the ids (THEY start at 1!!) + for (const auto &i : ids) { + auto pphases = pqc_mat.getEquilibriumNames(i); + if (!pphases.empty()) { + std::cout << ":: Equilibrium phases [" << (int)i << "]: \n"; + std::cout << pphases << "\n"; + } + + auto kinetics = pqc_mat.getKineticsNames(i); + if (!kinetics.empty()) { + std::cout << ":: Kinetics [" << i << "]: \n"; + std::cout << kinetics << "\n"; + } + } + + // The exported data type holds the matrix in a "STL format" with + // a "header" of names and their accompanying values. The values + // are stored in a row-major order per default. + auto exported_mat = pqc_mat.get(); + // Get the total number of solutes + const int len = exported_mat.names.size(); + // Get the values as reference to modify them in place + std::vector &cell_values = exported_mat.values; + + std::cout << ":: Values in the PhreeqcMatrix: \n"; + + //// Phreeqc RUN through the new Runner class + + // optional SUBSET the matrix (i.e., the unique ids defined in + // golem map as input) + // const auto subsetted_pqc_mat = pqc_mat.subset({1, 2}); + PhreeqcRunner runner(pqc_mat); + + const auto stl_mat = pqc_mat.get(); + const auto matrix_values = stl_mat.values; + const auto num_columns = stl_mat.names.size(); + const auto spec_names = stl_mat.names; + + // container to pass in/out + std::vector> simulationInOut; + + // copy the values to the InOut vector. We replicate cell 1 + for (std::size_t index = 0; index < n; ++index) { + simulationInOut.push_back( + std::vector(matrix_values.begin() + num_columns * index, + matrix_values.begin() + num_columns * (index + 1))); + } + + const double timestep = 100.; + + // compute 1 timestep + runner.run(simulationInOut, timestep); + + for (std::size_t cell_index = 0; cell_index < simulationInOut.size(); + ++cell_index) { + + std::cout << "Grid element: " << cell_index << " \n"; + for (std::size_t spec = 0; spec < num_columns; ++spec) { + std::cout << ":" << spec_names[spec] << "=" + << simulationInOut[cell_index][spec]; + } + std::cout << "\n"; + } + + return 0; +} + +// Oneliner for rz-vm278 relative to iphreeqc/poet/test!! + +// g++ testGolemRunner.cpp -o testG -Wall -I../../poet/include -I../../src +// -I../../src/phreeqcpp -I../../src/phreeqcpp/common +// -I../../src/phreeqcpp/PhreeqcKeywords -lIPhreeqc -lIPhreeqcPOET +// -L../../bbuild/ -L../../bbuild/poet diff --git a/poet/test/testInput.hpp.in b/litephreeqc/test/testInput.hpp.in similarity index 100% rename from poet/test/testInput.hpp.in rename to litephreeqc/test/testInput.hpp.in diff --git a/poet/test/testPhreeqcEngine.cpp b/litephreeqc/test/testPhreeqcEngine.cpp similarity index 76% rename from poet/test/testPhreeqcEngine.cpp rename to litephreeqc/test/testPhreeqcEngine.cpp index 631dc789..d50969ce 100644 --- a/poet/test/testPhreeqcEngine.cpp +++ b/litephreeqc/test/testPhreeqcEngine.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include #include diff --git a/poet/test/testPhreeqcKnobs.cpp b/litephreeqc/test/testPhreeqcKnobs.cpp similarity index 82% rename from poet/test/testPhreeqcKnobs.cpp rename to litephreeqc/test/testPhreeqcKnobs.cpp index dce39e52..4e1dd427 100644 --- a/poet/test/testPhreeqcKnobs.cpp +++ b/litephreeqc/test/testPhreeqcKnobs.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include #include diff --git a/poet/test/testPhreeqcMatrix.cpp b/litephreeqc/test/testPhreeqcMatrix.cpp similarity index 94% rename from poet/test/testPhreeqcMatrix.cpp rename to litephreeqc/test/testPhreeqcMatrix.cpp index 987295ef..f3151e8a 100644 --- a/poet/test/testPhreeqcMatrix.cpp +++ b/litephreeqc/test/testPhreeqcMatrix.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include #include #include diff --git a/poet/test/testPhreeqcRunner.cpp b/litephreeqc/test/testPhreeqcRunner.cpp similarity index 87% rename from poet/test/testPhreeqcRunner.cpp rename to litephreeqc/test/testPhreeqcRunner.cpp index a00c627b..3ee54676 100644 --- a/poet/test/testPhreeqcRunner.cpp +++ b/litephreeqc/test/testPhreeqcRunner.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "PhreeqcRunner.hpp" #include "utils.hpp" diff --git a/poet/test/utils.cpp b/litephreeqc/test/utils.cpp similarity index 54% rename from poet/test/utils.cpp rename to litephreeqc/test/utils.cpp index 53ed1563..79de1123 100644 --- a/poet/test/utils.cpp +++ b/litephreeqc/test/utils.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "utils.hpp" #include diff --git a/litephreeqc/test/utils.hpp b/litephreeqc/test/utils.hpp new file mode 100644 index 00000000..b532767e --- /dev/null +++ b/litephreeqc/test/utils.hpp @@ -0,0 +1,18 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + +#pragma once + +#include + +std::string readFile(const std::string &path); \ No newline at end of file diff --git a/poet/src/Wrapper/WrapperBase.hpp b/poet/src/Wrapper/WrapperBase.hpp deleted file mode 100644 index b12d36eb..00000000 --- a/poet/src/Wrapper/WrapperBase.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include - -class WrapperBase { -public: - virtual ~WrapperBase() = default; - - std::size_t size() const { return this->num_elements; }; - - virtual void get(std::span &data) const = 0; - - virtual void set(const std::span &data) = 0; - -protected: - std::size_t num_elements = 0; -}; \ No newline at end of file diff --git a/poet/test/testGolemRunner.cpp b/poet/test/testGolemRunner.cpp deleted file mode 100644 index 103e1a58..00000000 --- a/poet/test/testGolemRunner.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// Time-stamp: "Last modified 2025-07-28 13:03:01 delucia" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "PhreeqcMatrix.hpp" -#include "PhreeqcEngine.hpp" -#include "PhreeqcRunner.hpp" - - -std::string readFile(const std::string &path) { - std::string string_rpath(PATH_MAX, '\0'); - - if (realpath(path.c_str(), string_rpath.data()) == nullptr) { - throw std::runtime_error(":: Failed to resolve the realpath to file " + path); - } - - std::ifstream file(string_rpath); - - if (!file.is_open()) { - throw std::runtime_error(":: Failed to open file: " + path); - } - - std::stringstream buffer; - buffer << file.rdbuf(); - - return buffer.str(); -} - -// pretty print a vector, standard implementation from stackoverflow -template -std::ostream & operator<<(std::ostream & os, std::vector vec) -{ - os << "{ "; - std::copy(vec.begin(), vec.end(), std::ostream_iterator(os, ", ")); - os << " }"; - return os; -} - - -int main(int argc, char *argv[]) { - - if (argc < 3) { - std::cout << "::" << argv[0] << ": two args needed, script and database\n"; - return 1; - } - - - ////// INITIALISATION - // read Script and Database and put it in a std::string - auto script = readFile(argv[1]); - auto db = readFile(argv[2]); - - // Create the matrix directly from database and init script - PhreeqcMatrix pqc_mat(db, script, true, true); - - // How many different SOLUTIONS ("CELLS") are defined in the script? - const auto ids = pqc_mat.getIds(); - - int n = ids.size(); - - std::cout << ":: Found " << n << " distinct PHREEQC problems \n"; - std::cout << ids << "\n"; - - const auto solutes = pqc_mat.getSolutionNames(); - std::cout << ":: These are the common solutes across all the " << n << " problems: \n"; - std::cout << solutes << "\n"; - - // iterate on the ids (THEY start at 1!!) - for (const auto & i : ids) { - auto pphases = pqc_mat.getEquilibriumNames(i); - if (!pphases.empty()) { - std::cout << ":: Equilibrium phases [" << (int) i << "]: \n"; - std::cout << pphases << "\n"; - } - - auto kinetics = pqc_mat.getKineticsNames(i); - if (!kinetics.empty()) { - std::cout << ":: Kinetics [" << i << "]: \n"; - std::cout << kinetics << "\n"; - } - } - - // The exported data type holds the matrix in a "STL format" with - // a "header" of names and their accompanying values. The values - // are stored in a row-major order per default. - auto exported_mat = pqc_mat.get(); - // Get the total number of solutes - const int len = exported_mat.names.size(); - // Get the values as reference to modify them in place - std::vector &cell_values = exported_mat.values; - - std::cout << ":: Values in the PhreeqcMatrix: \n"; - - //// Phreeqc RUN through the new Runner class - - // optional SUBSET the matrix (i.e., the unique ids defined in - // golem map as input) - // const auto subsetted_pqc_mat = pqc_mat.subset({1, 2}); - PhreeqcRunner runner(pqc_mat); - - const auto stl_mat = pqc_mat.get(); - const auto matrix_values = stl_mat.values; - const auto num_columns = stl_mat.names.size(); - const auto spec_names = stl_mat.names; - - // container to pass in/out - std::vector> simulationInOut; - - // copy the values to the InOut vector. We replicate cell 1 - for (std::size_t index = 0; index < n; ++index) { - simulationInOut.push_back(std::vector( - matrix_values.begin() + num_columns*index, matrix_values.begin() + num_columns*(index +1))); - } - - const double timestep = 100.; - - // compute 1 timestep - runner.run(simulationInOut, timestep); - - for (std::size_t cell_index = 0; cell_index < simulationInOut.size(); ++cell_index) { - - std::cout << "Grid element: " << cell_index << " \n"; - for (std::size_t spec = 0; spec < num_columns; ++spec) { - std::cout << ":" << spec_names[spec] << "=" << simulationInOut[cell_index][spec]; - } - std::cout << "\n"; - } - - - return 0; -} - -// Oneliner for rz-vm278 relative to iphreeqc/poet/test!! - -// g++ testGolemRunner.cpp -o testG -Wall -I../../poet/include -I../../src -I../../src/phreeqcpp -I../../src/phreeqcpp/common -I../../src/phreeqcpp/PhreeqcKeywords -lIPhreeqc -lIPhreeqcPOET -L../../bbuild/ -L../../bbuild/poet diff --git a/poet/test/utils.hpp b/poet/test/utils.hpp deleted file mode 100644 index 4266c3f0..00000000 --- a/poet/test/utils.hpp +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -#include - -std::string readFile(const std::string &path); \ No newline at end of file diff --git a/src/phreeqcpp/GFZ.cpp b/src/phreeqcpp/litephreeqc_funcs.cpp similarity index 86% rename from src/phreeqcpp/GFZ.cpp rename to src/phreeqcpp/litephreeqc_funcs.cpp index d3412546..a68103b9 100644 --- a/src/phreeqcpp/GFZ.cpp +++ b/src/phreeqcpp/litephreeqc_funcs.cpp @@ -1,3 +1,16 @@ +/* + * This project is subject to the original PHREEQC license. `litephreeqc` is a + * version of the PHREEQC code that has been modified to be used as a library. + * + * It adds a C++ interface on top of the original PHREEQC code, with small + * changes to the original code base. + * + * Authors of Modifications: + * - Max Luebke (mluebke@uni-potsdam.de) - University of Potsdam + * - Marco De Lucia (delucia@gfz.de) - GFZ Helmholz Centre for Geosciences + * + */ + #include "Phreeqc.h" #include