Skip to content

Commit 9583d2b

Browse files
authored
Merge pull request #57 from nschloe/cgal5-second-attempt
add cgal 5 compatibility
2 parents 868b404 + 2d4f9ff commit 9583d2b

6 files changed

Lines changed: 27 additions & 36 deletions

File tree

.circleci/config.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,27 @@ jobs:
77
steps:
88
- checkout
99
- run: pip3 install -U black flake8 --user
10-
- run: LC_ALL=C.UTF-8 black --check .
10+
- run: black --check .
1111
- run: flake8 .
1212
build:
1313
working_directory: ~/work
1414
docker:
1515
- image: circleci/python:3
1616
steps:
17-
- run: sudo apt-get install -y git-lfs libcgal-dev libeigen3-dev python3-pip clang
17+
- run: sudo apt-get install -y git-lfs libeigen3-dev clang
18+
# install cgal 5 from ppa
19+
- run: sudo apt-get install -y software-properties-common
20+
- run: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECD154D280FEB8AC
21+
- run: sudo apt-add-repository -y ppa:nschloe/cgal-backports
22+
- run: sudo apt update
23+
- run: sudo apt install -y libcgal-dev
24+
#
1825
- run: pip3 install -U pytest pytest-cov pybind11 lxml --user
1926
- checkout
2027
- run: git lfs pull
2128
# install
22-
# Use clang++ for its smaller memory footprint.
23-
- run: CC="clang++" pip3 install . --user
29+
# Use clang for its smaller memory footprint.
30+
- run: CC="clang" pip3 install . --user --verbose
2431
# The actual test
2532
- run:
2633
command: pytest

.github/workflows/ci.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,16 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
sudo apt-get install -y libcgal-dev libeigen3-dev python3-pip clang
35+
- name: install cgal-5 from ppa
36+
run: |
37+
sudo apt-get install -y software-properties-common
38+
sudo apt-add-repository -y ppa:nschloe/cgal-backports
39+
sudo apt update
40+
sudo apt install -y libcgal-dev
3541
- name: Install package
3642
run: |
3743
pip install --upgrade pip
38-
pip install .[all]
44+
CC="clang" pip install .[all]
3945
pip install pytest pytest-cov
4046
- name: Test with pytest
4147
run: |

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# CMake is used for debugging in pygalmesh. Like every other Python package, the
2+
# production build system is setuptools.
13
cmake_minimum_required(VERSION 3.0)
24

35
project(pygalmesh CXX)

pygalmesh/__about__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
__author_email__ = "nico.schloemer@gmail.com"
33
__copyright__ = "Copyright (C) 2016-2019 {} <{}>".format(__author__, __author_email__)
44
__license__ = "License :: OSI Approved :: MIT License"
5-
__version__ = "0.4.0"
6-
__maintainer__ = u"Nico Schlömer"
5+
__version__ = "0.5.0"
6+
__maintainer__ = "Nico Schlömer"
77
__status__ = "Development Status :: 4 - Beta"
88
__url__ = "https://github.com/nschloe/pygalmesh"

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def read(fname):
4848
get_pybind_include(),
4949
get_pybind_include(user=True),
5050
],
51-
# CGAL_ImageIO for generate_from_inr
52-
libraries=["CGAL", "CGAL_ImageIO", "gmp", "mpfr"],
51+
# no CGAL libraries necessary from CGAL 5.0 onwards
52+
libraries=["stdc++", "gmp", "mpfr"],
5353
)
5454
]
5555

src/generate.cpp

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -118,32 +118,6 @@ generate_mesh(
118118
return;
119119
}
120120

121-
// same but with sizing field in cell_size
122-
// It'd be nice if we could replace this clumsy class by a simple function wrapper (like
123-
// domain), but CGAL expects the type FT to be present. :(
124-
// https://github.com/CGAL/cgal/issues/4146
125-
class Sizing_field_wrapper
126-
{
127-
public:
128-
typedef K::FT FT;
129-
130-
Sizing_field_wrapper(const std::shared_ptr<pygalmesh::SizingFieldBase> & cell_size):
131-
cell_size_(cell_size)
132-
{
133-
}
134-
135-
virtual ~Sizing_field_wrapper() = default;
136-
137-
K::FT operator()(const K::Point_3& p, const int, const Mesh_domain::Index&) const
138-
{
139-
auto out = cell_size_->eval({p.x(), p.y(), p.z()});
140-
return out;
141-
}
142-
143-
private:
144-
const std::shared_ptr<pygalmesh::SizingFieldBase> & cell_size_;
145-
};
146-
147121
void
148122
generate_with_sizing_field(
149123
const std::shared_ptr<pygalmesh::DomainBase> & domain,
@@ -193,7 +167,9 @@ generate_with_sizing_field(
193167
std::cerr.setstate(std::ios_base::failbit);
194168
}
195169
if (cell_size) {
196-
Sizing_field_wrapper size(cell_size);
170+
const auto size = [&](K::Point_3 p, const int, const Mesh_domain::Index&) {
171+
return cell_size->eval({p.x(), p.y(), p.z()});
172+
};
197173
auto criteria = Mesh_criteria(
198174
CGAL::parameters::edge_size=edge_size,
199175
CGAL::parameters::facet_angle=facet_angle,

0 commit comments

Comments
 (0)