Skip to content

Commit

Permalink
Merge cf07a80 into 432f049
Browse files Browse the repository at this point in the history
  • Loading branch information
hpwxf committed Nov 9, 2022
2 parents 432f049 + cf07a80 commit 4fd827f
Show file tree
Hide file tree
Showing 40 changed files with 360 additions and 198 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
mode: Debug
enable_python: on
- name: "macOS Debug"
os: macOS-11
os: macOS-12
mode: Debug
enable_python: on
- name: "Windows Debug"
Expand All @@ -79,7 +79,7 @@ jobs:
enable_octave: on
force_update: on
- name: "Octave macOS"
os: macOS-11
os: macOS-12
mode: Release
enable_python: off
enable_octave: on
Expand All @@ -101,7 +101,7 @@ jobs:
mode: Release
enable_R: on
- name: "R macOS"
os: macOS-11
os: macOS-12
mode: Release
enable_R: on
- name: "R Windows"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-18.04, ubuntu-20.04, macos-11]
os: [ubuntu-18.04, ubuntu-20.04, macos-12]
exclude: # not supported
- os: ubuntu-20.04
python-version: 3.6
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ macOS-11 ]
os: [ macOS-12 ]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
include:
- os: ubuntu-18.04
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
os: ubuntu-20.04
force_update: on
- name: "Octave macOS"
os: macOS-11
os: macOS-12
- name: "Octave Windows"
os: windows-2019

Expand Down Expand Up @@ -270,7 +270,7 @@ jobs:
- name: "R Linux"
os: ubuntu-20.04
- name: "R macOS"
os: macOS-11
os: macOS-12
- name: "R Windows"
os: windows-2019

Expand Down
11 changes: 10 additions & 1 deletion .travis-ci/linux-macos/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ else

# Cleanup compiled libs to check right path finding
rm -fr src/lib

# add library directory search PATH for executables
export LD_LIBRARY_PATH=$PWD/installed/lib:${LD_LIBRARY_PATH}
case "$(uname -s)" in
Darwin)
export DYLD_LIBRARY_PATH=$PWD/installed/lib:${DYLD_LIBRARY_PATH}
;;

*)
export LD_LIBRARY_PATH=$PWD/installed/lib:${LD_LIBRARY_PATH}
;;
esac

ctest -C "${MODE}" ${CTEST_FLAGS}
fi
4 changes: 4 additions & 0 deletions bindings/Octave/Kriging.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
% fprintf("New Kriging\n");
obj.ref = mLibKriging("Kriging::new", varargin{:});
end

function varargout = copy(obj, varargin)
[varargout{1:nargout}] = mLibKriging("Kriging::copy", obj.ref, varargin{:});
end

function delete(obj, varargin)
% disp(["ObjectRef = ", num2str(obj.ref)])
Expand Down
11 changes: 11 additions & 0 deletions bindings/Octave/Kriging_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ void build(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
output.set(0, km, "new object reference");
}

void copy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
MxMapper input{"Input",
nrhs,
const_cast<mxArray**>(prhs), // NOLINT(cppcoreguidelines-pro-type-const-cast)
RequiresArg::Exactly{1}};
MxMapper output{"Output", nlhs, plhs, RequiresArg::Exactly{1}};
const auto* km = input.getObjectFromRef<Kriging>(0, "Kriging reference");
auto km_copy = buildObject<Kriging>(*km, ExplicitCopySpecifier{});
output.set(0, km_copy, "copied object reference");
}

void destroy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
MxMapper input{"Input",
nrhs,
Expand Down
1 change: 1 addition & 0 deletions bindings/Octave/Kriging_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace KrigingBinding {
void build(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void copy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void destroy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void fit(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void predict(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
Expand Down
4 changes: 4 additions & 0 deletions bindings/Octave/NoiseKriging.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
obj.ref = mLibKriging("NoiseKriging::new", varargin{:});
end

function varargout = copy(obj, varargin)
[varargout{1:nargout}] = mLibKriging("NoiseKriging::copy", obj.ref, varargin{:});
end

function delete(obj, varargin)
% disp(["ObjectRef = ", num2str(obj.ref)])
% destroy the mex backend
Expand Down
11 changes: 11 additions & 0 deletions bindings/Octave/NoiseKriging_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ void build(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
output.set(0, km, "new object reference");
}

void copy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
MxMapper input{"Input",
nrhs,
const_cast<mxArray**>(prhs), // NOLINT(cppcoreguidelines-pro-type-const-cast)
RequiresArg::Exactly{1}};
MxMapper output{"Output", nlhs, plhs, RequiresArg::Exactly{1}};
const auto* km = input.getObjectFromRef<NoiseKriging>(0, "NoiseKriging reference");
auto km_copy = buildObject<NoiseKriging>(*km, ExplicitCopySpecifier{});
output.set(0, km_copy, "copied object reference");
}

void destroy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
MxMapper input{"Input",
nrhs,
Expand Down
1 change: 1 addition & 0 deletions bindings/Octave/NoiseKriging_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace NoiseKrigingBinding {
void build(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void copy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void destroy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void fit(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void predict(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
Expand Down
6 changes: 5 additions & 1 deletion bindings/Octave/NuggetKriging.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
% printf("New NuggetKriging\n");
obj.ref = mLibKriging("NuggetKriging::new", varargin{:});
end


function varargout = copy(obj, varargin)
[varargout{1:nargout}] = mLibKriging("NuggetKriging::copy", obj.ref, varargin{:});
end

function delete(obj, varargin)
% disp(["ObjectRef = ", num2str(obj.ref)])
% destroy the mex backend
Expand Down
11 changes: 11 additions & 0 deletions bindings/Octave/NuggetKriging_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ void build(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
output.set(0, km, "new object reference");
}

void copy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
MxMapper input{"Input",
nrhs,
const_cast<mxArray**>(prhs), // NOLINT(cppcoreguidelines-pro-type-const-cast)
RequiresArg::Exactly{1}};
MxMapper output{"Output", nlhs, plhs, RequiresArg::Exactly{1}};
const auto* km = input.getObjectFromRef<NuggetKriging>(0, "NuggetKriging reference");
auto km_copy = buildObject<NuggetKriging>(*km, ExplicitCopySpecifier{});
output.set(0, km_copy, "copied object reference");
}

void destroy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs) {
MxMapper input{"Input",
nrhs,
Expand Down
1 change: 1 addition & 0 deletions bindings/Octave/NuggetKriging_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace NuggetKrigingBinding {
void build(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void copy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void destroy(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void fit(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
void predict(int nlhs, mxArray** plhs, int nrhs, const mxArray** prhs);
Expand Down
6 changes: 6 additions & 0 deletions bindings/Octave/mLibKriging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) try

case "Kriging::new"_hash:
return KrigingBinding::build(nlhs, plhs, nrhs - 1, prhs + 1);
case "Kriging::copy"_hash:
return KrigingBinding::copy(nlhs, plhs, nrhs - 1, prhs + 1);
case "Kriging::delete"_hash:
return KrigingBinding::destroy(nlhs, plhs, nrhs - 1, prhs + 1);
case "Kriging::fit"_hash:
Expand Down Expand Up @@ -143,6 +145,8 @@ void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) try

case "NuggetKriging::new"_hash:
return NuggetKrigingBinding::build(nlhs, plhs, nrhs - 1, prhs + 1);
case "NuggetKriging::copy"_hash:
return NuggetKrigingBinding::copy(nlhs, plhs, nrhs - 1, prhs + 1);
case "NuggetKriging::delete"_hash:
return NuggetKrigingBinding::destroy(nlhs, plhs, nrhs - 1, prhs + 1);
case "NuggetKriging::fit"_hash:
Expand Down Expand Up @@ -213,6 +217,8 @@ void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) try

case "NoiseKriging::new"_hash:
return NoiseKrigingBinding::build(nlhs, plhs, nrhs - 1, prhs + 1);
case "NoiseKriging::copy"_hash:
return NoiseKrigingBinding::copy(nlhs, plhs, nrhs - 1, prhs + 1);
case "NoiseKriging::delete"_hash:
return NoiseKrigingBinding::destroy(nlhs, plhs, nrhs - 1, prhs + 1);
case "NoiseKriging::fit"_hash:
Expand Down
2 changes: 1 addition & 1 deletion bindings/Octave/tools/ObjectAccessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct ObjectRef {};
struct EmptyObject {};

template <typename T, typename... Args>
ObjectCollector::ref_t buildObject(Args... args) {
ObjectCollector::ref_t buildObject(Args&&... args) {
return ObjectCollector::registerObject(new T{args...});
}

Expand Down
7 changes: 7 additions & 0 deletions bindings/Python/src/_pylibkriging/Kriging_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ PyKriging::PyKriging(const py::array_t<double>& y,

PyKriging::~PyKriging() {}

PyKriging::PyKriging(const PyKriging& other)
: m_internal{std::make_unique<Kriging>(*other.m_internal, ExplicitCopySpecifier{})} {}

PyKriging PyKriging::copy() const {
return PyKriging(*this);
}

void PyKriging::fit(const py::array_t<double>& y,
const py::array_t<double>& X,
const Trend::RegressionModel& regmodel,
Expand Down
7 changes: 7 additions & 0 deletions bindings/Python/src/_pylibkriging/Kriging_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
namespace py = pybind11;

class PyKriging {
private:
PyKriging(std::unique_ptr<Kriging>&& internal) : m_internal(std::move(internal)) {}

public:
PyKriging(const std::string& kernel);
PyKriging(const py::array_t<double>& y,
Expand All @@ -33,6 +36,10 @@ class PyKriging {
const py::dict& dict);
~PyKriging();

PyKriging(const PyKriging& other);

[[nodiscard]] PyKriging copy() const;

void fit(const py::array_t<double>& y,
const py::array_t<double>& X,
const Trend::RegressionModel& regmodel,
Expand Down
7 changes: 7 additions & 0 deletions bindings/Python/src/_pylibkriging/NoiseKriging_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ PyNoiseKriging::PyNoiseKriging(const py::array_t<double>& y,

PyNoiseKriging::~PyNoiseKriging() {}

PyNoiseKriging::PyNoiseKriging(const PyNoiseKriging& other)
: m_internal{std::make_unique<NoiseKriging>(*other.m_internal, ExplicitCopySpecifier{})} {}

PyNoiseKriging PyNoiseKriging::copy() const {
return PyNoiseKriging(*this);
}

void PyNoiseKriging::fit(const py::array_t<double>& y,
const py::array_t<double>& noise,
const py::array_t<double>& X,
Expand Down
7 changes: 7 additions & 0 deletions bindings/Python/src/_pylibkriging/NoiseKriging_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
namespace py = pybind11;

class PyNoiseKriging {
private:
PyNoiseKriging(std::unique_ptr<NoiseKriging>&& internal) : m_internal(std::move(internal)) {}

public:
PyNoiseKriging(const std::string& kernel);
PyNoiseKriging(const py::array_t<double>& y,
Expand All @@ -35,6 +38,10 @@ class PyNoiseKriging {
const py::dict& dict);
~PyNoiseKriging();

PyNoiseKriging(const PyNoiseKriging& other);

PyNoiseKriging copy() const;

void fit(const py::array_t<double>& y,
const py::array_t<double>& noise,
const py::array_t<double>& X,
Expand Down
9 changes: 8 additions & 1 deletion bindings/Python/src/_pylibkriging/NuggetKriging_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ PyNuggetKriging::PyNuggetKriging(const py::array_t<double>& y,

PyNuggetKriging::~PyNuggetKriging() {}

PyNuggetKriging::PyNuggetKriging(const PyNuggetKriging& other)
: m_internal{std::make_unique<NuggetKriging>(*other.m_internal, ExplicitCopySpecifier{})} {}

PyNuggetKriging PyNuggetKriging::copy() const {
return PyNuggetKriging(*this);
}

void PyNuggetKriging::fit(const py::array_t<double>& y,
const py::array_t<double>& X,
const Trend::RegressionModel& regmodel,
Expand Down Expand Up @@ -210,4 +217,4 @@ double PyNuggetKriging::nugget() {

bool PyNuggetKriging::is_nugget_estim() {
return m_internal->is_nugget_estim();
}
}
7 changes: 7 additions & 0 deletions bindings/Python/src/_pylibkriging/NuggetKriging_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
namespace py = pybind11;

class PyNuggetKriging {
private:
PyNuggetKriging(std::unique_ptr<NuggetKriging>&& internal) : m_internal(std::move(internal)) {}

public:
PyNuggetKriging(const std::string& kernel);
PyNuggetKriging(const py::array_t<double>& y,
Expand All @@ -33,6 +36,10 @@ class PyNuggetKriging {
const py::dict& dict);
~PyNuggetKriging();

PyNuggetKriging(const PyNuggetKriging& other);

PyNuggetKriging copy() const;

void fit(const py::array_t<double>& y,
const py::array_t<double>& X,
const Trend::RegressionModel& regmodel,
Expand Down

0 comments on commit 4fd827f

Please sign in to comment.