Skip to content

Commit

Permalink
Due to numpy error on python 3.10 in macosx x64
Browse files Browse the repository at this point in the history
The CI build will skip the test at this time
  • Loading branch information
nodtem66 committed Aug 8, 2021
1 parent 91e6f66 commit 699947b
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 220 deletions.
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
jobs:
- job: conda_linux64
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest
strategy:
matrix:
linux_64:
Expand Down
2 changes: 1 addition & 1 deletion .azure-pipelines/azure-pipelines-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ parameters:
jobs:
- job: conda_osx64
pool:
vmImage: macOS-10.15
vmImage: macOS-latest
strategy:
matrix:
osx_64:
Expand Down
74 changes: 9 additions & 65 deletions .github/workflows/wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
env:
CIBW_TEST_COMMAND: python {project}/src/python/test.py
CIBW_TEST_REQUIRES: numpy

CIBW_TEST_SKIP: cp310-macosx_x86_64

jobs:
build_sdist:
Expand Down Expand Up @@ -51,87 +51,31 @@ jobs:
with:
submodules: true

- name: Install libomp for macos
- name: Install libomp and openblas for macos
if: matrix.os == 'macos-latest'
run: brew install libomp

- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.10.0
run: |
brew install libomp
brew install openblas
- name: Build wheel
run: python -m cibuildwheel --output-dir wheelhouse
uses: pypa/cibuildwheel@v2.1.1
env:
# Python 2.7 on Windows requires a workaround for C++11 support,
# built separately below
CIBW_SKIP: pp* cp27-win* cp35-* *-win32 *-manylinux_i686
CIBW_SKIP: pp* cp27* *-win32 *-manylinux_i686 *-manylinux_aarch64 *-manylinux_ppc64le *-manylinux_s390x

- name: Show files
run: ls -lh wheelhouse
shell: bash

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- name: Upload wheels
uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl


# Windows 2.7 (requires workaround for MSVC 2008 replacement)
build_win27_wheels:
name: Py 2.7 wheels on Windows
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
with:
submodules: true

- uses: actions/setup-python@v2

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==1.10.0

- uses: ilammy/msvc-dev-cmd@v1

- name: Build 64-bit wheel
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp27-win_amd64
DISTUTILS_USE_SDK: 1
MSSdk: 1

- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86

- name: Build 32-bit wheel
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: cp27-win32
DISTUTILS_USE_SDK: 1
MSSdk: 1

- name: Show files
run: ls -lh wheelhouse
shell: bash

- name: Verify clean directory
run: git diff --exit-code
shell: bash

- uses: actions/upload-artifact@v2
with:
path: wheelhouse/*.whl


upload_all:
name: Upload if release
needs: [build_wheels, build_win27_wheels, build_sdist]
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event.inputs.upload != false

Expand All @@ -143,7 +87,7 @@ jobs:
name: artifact
path: dist

- uses: pypa/[email protected].1
- uses: pypa/[email protected].2
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
trigger:
branches:
exclude: [ 'master' ]
include: [ 'master' ]

jobs:
- template: ./.azure-pipelines/azure-pipelines-linux.yml
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ Scaffolder.SliceTest --help
```

## Python supports
The current version of `Scaffolder` supports python `2.7`, `3.6`, `3.7`, `3.8`, and `3.9` with only `x86_64` platform on:
The current version of `Scaffolder` supports python `3.6`, `3.7`, `3.8`, and `3.9` with only `x86_64` platform on:

* Window 10 (didn't test with the older version)
* Linux
* OSX 10.9
* OSX 10
!!! note
see the list of available version at [PyPI][]
Expand Down
65 changes: 5 additions & 60 deletions docs/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,6 @@

`PyScaffolder` is a wrapper for `Scaffolder`, which is written in C++.
It used [PyBind11](https://github.com/pybind/pybind11) to interface the C++ core function.

## Pybind11 Definition

```cpp
namespace PyScaffolder {

struct PoreSize {
PoreSize() {}
Eigen::RowVectorXd minFeret;
Eigen::RowVectorXd maxFeret;
};

struct MeshInfo {
Eigen::MatrixXd v;
Eigen::MatrixXi f;
double porosity;
double surface_area;
double surface_area_ratio;
};

struct Parameter {
bool is_build_inverse = false;
bool is_intersect = true;
uint16_t shell = 0;
uint16_t grid_offset = 5;
uint16_t smooth_step = 5;
uint16_t k_slice = 100;
uint16_t k_polygon = 4;
uint16_t fix_self_intersect = 0;
size_t grid_size = 100;
double isolevel = 0.0;
double qsim_percent = 0;
double coff = 3.141592653589793238462643383279502884L;
double minimum_diameter = 0.25;
std::string surface_name = "bcc";
};

PoreSize slice_test(
Eigen::MatrixXd v,
Eigen::MatrixXi f,
size_t k_slice = 100,
size_t k_polygon = 4,
int direction = 0,
const std::function<void(int)>& callback = NULL
);

MeshInfo generate_mesh(
Eigen::MatrixXd v,
Eigen::MatrixXi f,
Parameter params,
const std::function<void(int)>& callback = NULL
);
}
```
The main core functions are `generate_scaffold` and `slice_test` which resemble the standalone program: `Scaffolder` and `Scaffolder.Slice`.

## generate_scaffold
Expand All @@ -73,7 +18,7 @@ def generate_scaffold(vertices, faces, params=Parameter(), callback=None)
[MeshInfo](#meshinfo)
### Example
```python
from PyScaffolder import generate_mesh, Parameter
from PyScaffolder import generate_scaffold, Parameter

# vertices and faces of a 20mm cube
v = [
Expand Down Expand Up @@ -103,19 +48,19 @@ def generate_scaffold(vertices, faces, params=Parameter(), callback=None)
]

# the function required two parameters
mesh_info = generate_mesh(v, f)
mesh_info = generate_scaffold(v, f)

# use custom parameters
parameter = Parameter()
parameter.coff = 1.0

mesh_info = generate_mesh(v, f, parameter)
mesh_info = generate_scaffold(v, f, parameter)

# use callback to show % progression
def progression(n):
print(n)

mesh_info = generate_mesh(v, f, callback=progression)
mesh_info = generate_scaffold(v, f, callback=progression)
```

## slice_test
Expand Down Expand Up @@ -155,8 +100,8 @@ def marching_cubes(f, grid_size=(100,100,100), v_min=(0,0,0), delta=0.01, clean=
### Parameters
* `f`: numpy.array representing a discrete isosurface where F(x,y,z) = 0 is boundary
* `grid_size`: *Optional* array, list, tuple, or int representing the number of voxels
* `delta`: *Optional* array, list, tuple or double representing the dimension of a voxel
* `v_min`: *Optional* array, list, tuple the coordinate of the corner of grid
* `delta`: *Optional* array, list, tuple or double representing the dimension of a voxel
* `clean` *Optional* boolean that enable mesh cleaning after marching cubes
* `callback`: *Optional* function with one `integer` parameter indicating the progression
###Return
Expand Down
2 changes: 1 addition & 1 deletion src/python/PyScaffolder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ PYBIND11_MODULE(PyScaffolder, m) {
m.def("marching_cubes", &PyScaffolder::marching_cubes, py::call_guard<py::gil_scoped_release>(), "A function to generate a triangular mesh (v, f) from isovalues (f)",
py::arg("f"),
py::arg("grid_size") = std::tuple<int32_t, int32_t, int32_t>(100, 100, 100),
py::arg("v_min") = std::tuple<double, double, double>(0, 0, 0),
py::arg("delta") = 0.01,
py::arg("v_min") = std::tuple<double, double, double>(0, 0, 0),
py::arg("clean") = false,
py::arg("callback") = py::none()
);
Expand Down
2 changes: 1 addition & 1 deletion src/python/PyScaffolder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ namespace PyScaffolder {
std::tuple<Eigen::MatrixXd, Eigen::MatrixXi> marching_cubes(
Eigen::VectorXd& Fxyz,
py::object& grid_size,
py::object& Vmin,
py::object& delta,
const std::vector<double>& Vmin,
bool clean = false,
const std::function<void(int)>& callback = NULL
);
Expand Down
Loading

0 comments on commit 699947b

Please sign in to comment.