mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
chore: Add LICENSE.txt for poet directory
refactor: Rename 'poet' directory to 'litephreeqc'
This commit is contained in:
parent
953c752431
commit
85762ad3f3
@ -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)
|
||||
|
||||
10
litephreeqc/LICENSE.txt
Normal file
10
litephreeqc/LICENSE.txt
Normal file
@ -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
|
||||
|
||||
@ -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"
|
||||
@ -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 <cstdint>
|
||||
@ -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 <map>
|
||||
@ -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"
|
||||
@ -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 <cstddef>
|
||||
#include <iomanip>
|
||||
@ -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 <Phreeqc.h>
|
||||
@ -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 <algorithm>
|
||||
#include <cstddef>
|
||||
@ -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"
|
||||
@ -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"
|
||||
@ -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 <IPhreeqc.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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "PhreeqcEngine.hpp"
|
||||
#include "PhreeqcMatrix.hpp"
|
||||
#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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "EquilibriumWrapper.hpp"
|
||||
|
||||
EquilibriumWrapper::EquilibriumCompWrapper::EquilibriumCompWrapper(
|
||||
@ -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 <algorithm>
|
||||
@ -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"
|
||||
@ -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)
|
||||
@ -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<ExchangeCompWrapper>(*it));
|
||||
// header_it += this->exchange_comps[i]->size();
|
||||
// num_elements += this->exchange_comps[i]->size();
|
||||
// continue;
|
||||
// }
|
||||
// exchange_comps.push_back(std::make_unique<ExchangeCompWrapper>(*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<LDBLE> &exchange) const {
|
||||
@ -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"
|
||||
@ -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 <cstddef>
|
||||
#include <string>
|
||||
@ -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 <vector>
|
||||
|
||||
@ -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"
|
||||
@ -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 <set>
|
||||
@ -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"
|
||||
@ -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(
|
||||
@ -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)
|
||||
@ -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"
|
||||
|
||||
@ -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"
|
||||
31
litephreeqc/src/Wrapper/WrapperBase.hpp
Normal file
31
litephreeqc/src/Wrapper/WrapperBase.hpp
Normal file
@ -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 <phrqtype.h>
|
||||
#include <span>
|
||||
|
||||
class WrapperBase {
|
||||
public:
|
||||
virtual ~WrapperBase() = default;
|
||||
|
||||
std::size_t size() const { return this->num_elements; };
|
||||
|
||||
virtual void get(std::span<LDBLE> &data) const = 0;
|
||||
|
||||
virtual void set(const std::span<LDBLE> &data) = 0;
|
||||
|
||||
protected:
|
||||
std::size_t num_elements = 0;
|
||||
};
|
||||
147
litephreeqc/test/testGolemRunner.cpp
Normal file
147
litephreeqc/test/testGolemRunner.cpp
Normal file
@ -0,0 +1,147 @@
|
||||
// Time-stamp: "Last modified 2025-07-28 13:03:01 delucia"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <linux/limits.h>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#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 <typename T>
|
||||
std::ostream &operator<<(std::ostream &os, std::vector<T> vec) {
|
||||
os << "{ ";
|
||||
std::copy(vec.begin(), vec.end(), std::ostream_iterator<T>(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<double> &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<std::vector<double>> 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<double>(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
|
||||
@ -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 <stdexcept>
|
||||
|
||||
#include <testInput.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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <testInput.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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
@ -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"
|
||||
|
||||
@ -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 <fstream>
|
||||
18
litephreeqc/test/utils.hpp
Normal file
18
litephreeqc/test/utils.hpp
Normal file
@ -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 <string>
|
||||
|
||||
std::string readFile(const std::string &path);
|
||||
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <phrqtype.h>
|
||||
#include <span>
|
||||
|
||||
class WrapperBase {
|
||||
public:
|
||||
virtual ~WrapperBase() = default;
|
||||
|
||||
std::size_t size() const { return this->num_elements; };
|
||||
|
||||
virtual void get(std::span<LDBLE> &data) const = 0;
|
||||
|
||||
virtual void set(const std::span<LDBLE> &data) = 0;
|
||||
|
||||
protected:
|
||||
std::size_t num_elements = 0;
|
||||
};
|
||||
@ -1,144 +0,0 @@
|
||||
// Time-stamp: "Last modified 2025-07-28 13:03:01 delucia"
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <linux/limits.h>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <cmath>
|
||||
|
||||
#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<typename T>
|
||||
std::ostream & operator<<(std::ostream & os, std::vector<T> vec)
|
||||
{
|
||||
os << "{ ";
|
||||
std::copy(vec.begin(), vec.end(), std::ostream_iterator<T>(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<double> &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<std::vector<double>> 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<double>(
|
||||
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
|
||||
@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string readFile(const std::string &path);
|
||||
@ -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 <set>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user