Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/runTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
build_and_test_mex:
strategy:
matrix:
platform: [windows-latest, ubuntu-latest, macos-15-intel, macos-latest]
platform: [windows-latest, ubuntu-22.04, macos-15-intel, macos-latest]
runs-on: ${{ matrix.platform }}
needs: [build_cpp]

Expand Down
10 changes: 6 additions & 4 deletions examples/miscellaneous/alternativeLanguages/customBilayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ extern "C" {

LIB_EXPORT void customBilayer(std::vector<double>& params, std::vector<double>& bulkIn, std::vector<double>& bulkOut, int contrast, std::vector<double>& output, double* outputSize, double* rough)
{
# Note - The first contrast number is 1 (not 0) so be careful if you use
# this variable for array indexing.
double subRough = params[0];
double oxideThick = params[1];
double oxideHydration = params[2];
Expand Down Expand Up @@ -65,9 +67,9 @@ extern "C" {

// Manually deal with hydration for layers in
// this example.
double oxSLD = (oxideHydration * bulkOut[contrast]) + ((1 - oxideHydration) * oxideSLD);
double headSLD = (headHydration * bulkOut[contrast]) + ((1 - headHydration) * SLDhead);
double tailSLD = (bilayerHydration * bulkOut[contrast]) + ((1 - bilayerHydration) * SLDtail);
double oxSLD = (oxideHydration * bulkOut[contrast-1]) + ((1 - oxideHydration) * oxideSLD);
double headSLD = (headHydration * bulkOut[contrast-1]) + ((1 - headHydration) * SLDhead);
double tailSLD = (bilayerHydration * bulkOut[contrast-1]) + ((1 - bilayerHydration) * SLDtail);

// Make the layers
// oxide...
Expand All @@ -77,7 +79,7 @@ extern "C" {

// Water...
output.push_back(waterThick);
output.push_back(bulkOut[contrast]);
output.push_back(bulkOut[contrast-1]);
output.push_back(bilayerRough);

// Heads...
Expand Down
10 changes: 6 additions & 4 deletions examples/miscellaneous/alternativeLanguages/customBilayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import numpy as np

def customBilayer(params, bulk_in, bulk_out, contrast):
# Note - The first contrast number is 1 (not 0) so be careful if you use
# this variable for array indexing.
params = params
bulk_in = bulk_in
bulk_out = bulk_out
Expand Down Expand Up @@ -58,13 +60,13 @@ def customBilayer(params, bulk_in, bulk_out, contrast):

# Manually deal with hydration for layers in
# this example.
oxSLD = (oxide_hydration * bulk_out[contrast]) + ((1 - oxide_hydration) * oxide_SLD)
headSLD = (headHydration * bulk_out[contrast]) + ((1 - headHydration) * SLDhead)
tailSLD = (bilayerHydration * bulk_out[contrast]) + ((1 - bilayerHydration) * SLDtail)
oxSLD = (oxide_hydration * bulk_out[contrast-1]) + ((1 - oxide_hydration) * oxide_SLD)
headSLD = (headHydration * bulk_out[contrast-1]) + ((1 - headHydration) * SLDhead)
tailSLD = (bilayerHydration * bulk_out[contrast-1]) + ((1 - bilayerHydration) * SLDtail)

# Make the layers
oxide = [oxide_thick, oxSLD, sub_rough]
water = [waterThick, bulk_out[contrast], bilayerRough]
water = [waterThick, bulk_out[contrast-1], bilayerRough]
head = [headThick, headSLD, bilayerRough]
tail = [tailThick, tailSLD, bilayerRough]

Expand Down
4 changes: 2 additions & 2 deletions targetFunctions/+domainsTF/processCustomFunction.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
[output1, subRoughs(i)] = callMatlabFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 1);
[output2, ~] = callMatlabFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 2);
else
[output1, subRoughs(i)] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i-1, 0);
[output2, ~] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i-1, 1);
[output1, subRoughs(i)] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 1);
[output2, ~] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 2);
end

% If SLD is real, add dummy imaginary column
Expand Down
2 changes: 1 addition & 1 deletion targetFunctions/+normalTF/processCustomFunction.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
if isnan(str2double(functionHandle))
[output, subRoughs(i)] = callMatlabFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 0);
else
[output, subRoughs(i)] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i-1, -1);
[output, subRoughs(i)] = callCppFunction(functionHandle, paramValues, bulkIns(i), bulkOuts, i, 0);
end

% If SLD is real, add dummy imaginary column
Expand Down
4 changes: 2 additions & 2 deletions targetFunctions/common/customModelFunctions/callCppFunction.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
bulkOutArray = coder.opaque('std::vector<double>');
bulkOutArray = coder.ceval('convertPtr2Vector', coder.ref(bulkOut), numel(bulkOut));

% domain should either before 0 or 1. A value less than zero indicates no domains
if (domains < 0)
% domain should either be 1 or 2. A value less than 1 indicates no domains
if (domains < 1)
coder.ceval(['std::mem_fn<void(std::vector<double>&, std::vector<double>&, std::vector<double>&, int, ' ...
'std::vector<double>&, double*, double*)>(&CallbackInterface::invoke)'], ...
callback, paramsArray, bulkInArray, bulkOutArray, contrast, outArray, ...
Expand Down