Skip to content

Commit f5e7d9f

Browse files
authored
Merge pull request #123 from nschloe/remove-false-warning
Remove false warning
2 parents 2c064c2 + 09367e8 commit f5e7d9f

8 files changed

Lines changed: 32 additions & 22 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ circ.append(circ[0])
130130

131131
mesh = pygalmesh.generate_mesh(
132132
u,
133-
feature_edges=[circ],
133+
extra_feature_edges=[circ],
134134
max_cell_circumradius=0.15,
135135
max_edge_size_at_feature_edges=max_edge_size_at_feature_edges,
136136
min_facet_angle=25,

pygalmesh/main.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import math
22
import os
33
import tempfile
4-
import warnings
54

65
import meshio
76
import numpy
@@ -29,7 +28,7 @@ def eval(self, x):
2928

3029
def generate_mesh(
3130
domain,
32-
feature_edges=None,
31+
extra_feature_edges=None,
3332
bounding_sphere_radius=0.0,
3433
lloyd=False,
3534
odt=False,
@@ -66,7 +65,7 @@ def generate_mesh(
6665
a scalar field (resp. a constant) describing a space varying (resp. a uniform)
6766
upper-bound for the circumradii of the mesh tetrahedra.
6867
"""
69-
feature_edges = [] if feature_edges is None else feature_edges
68+
extra_feature_edges = [] if extra_feature_edges is None else extra_feature_edges
7069

7170
fh, outfile = tempfile.mkstemp(suffix=".mesh")
7271
os.close(fh)
@@ -90,20 +89,20 @@ def _select(obj):
9089
) = _select(max_radius_surface_delaunay_ball)
9190
max_facet_distance_value, max_facet_distance_field = _select(max_facet_distance)
9291

93-
if feature_edges:
94-
if max_edge_size_at_feature_edges == 0.0:
95-
raise ValueError(
96-
"Need a positive max_edge_size_at_feature_edges bound if feature_edges are present."
97-
)
98-
elif max_edge_size_at_feature_edges != 0.0:
99-
warnings.warn(
100-
"No feature edges. The max_edge_size_at_feature_edges argument has no effect."
101-
)
92+
# if feature_edges:
93+
# if max_edge_size_at_feature_edges == 0.0:
94+
# raise ValueError(
95+
# "Need a positive max_edge_size_at_feature_edges bound if feature_edges are present."
96+
# )
97+
# elif max_edge_size_at_feature_edges != 0.0:
98+
# warnings.warn(
99+
# "No feature edges. The max_edge_size_at_feature_edges argument has no effect."
100+
# )
102101

103102
_generate_mesh(
104103
domain,
105104
outfile,
106-
feature_edges=feature_edges,
105+
extra_feature_edges=extra_feature_edges,
107106
bounding_sphere_radius=bounding_sphere_radius,
108107
lloyd=lloyd,
109108
odt=odt,

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = pygalmesh
3-
version = 0.9.0
3+
version = 0.9.1
44
url = https://github.com/nschloe/pygalmesh
55
author = Nico Schlömer
66
author_email = nico.schloemer@gmail.com

src/generate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void
4949
generate_mesh(
5050
const std::shared_ptr<pygalmesh::DomainBase> & domain,
5151
const std::string & outfile,
52-
const std::vector<std::vector<std::array<double, 3>>> & feature_edges,
52+
const std::vector<std::vector<std::array<double, 3>>> & extra_feature_edges,
5353
const double bounding_sphere_radius,
5454
const bool lloyd,
5555
const bool odt,
@@ -98,7 +98,7 @@ generate_mesh(
9898
const auto native_features = translate_feature_edges(domain->get_features());
9999
cgal_domain.add_features(native_features.begin(), native_features.end());
100100

101-
const auto polylines = translate_feature_edges(feature_edges);
101+
const auto polylines = translate_feature_edges(extra_feature_edges);
102102
cgal_domain.add_features(polylines.begin(), polylines.end());
103103

104104
// perhaps there's a more elegant solution here

src/generate.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace pygalmesh {
1414
void generate_mesh(
1515
const std::shared_ptr<pygalmesh::DomainBase> & domain,
1616
const std::string & outfile,
17-
const std::vector<std::vector<std::array<double, 3>>> & feature_edges = {},
17+
const std::vector<std::vector<std::array<double, 3>>> & extra_feature_edges = {},
1818
const double bounding_sphere_radius = 0.0,
1919
const bool lloyd = false,
2020
const bool odt = false,

src/primitives.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
// Note:
2+
// One could also implement the primitives as Python classes and have much more readable
3+
// code. Unfortunately, this approach would be a lot slower. The reason is that CGAL
4+
// calls the eval() method with individual points, and this many CPP-to-Python calls are
5+
// very expensive. It would be a lot better if CGAL called the method with batches of X
6+
// at once, which would also enable users to employ some optimization, but this isn't
7+
// the case yet. It's not clear if the mesh building algorithm allows for such
8+
// optimziation at all.
9+
// The corresponding issue hasn't gained much traction
10+
// <https://github.com/CGAL/cgal/issues/3874>.
11+
//
112
#ifndef PRIMITIVES_HPP
213
#define PRIMITIVES_HPP
314

src/pybind11.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ PYBIND11_MODULE(_pygalmesh, m) {
270270
"_generate_mesh", &generate_mesh,
271271
py::arg("domain"),
272272
py::arg("outfile"),
273-
py::arg("feature_edges") = std::vector<std::vector<std::array<double, 3>>>(),
273+
py::arg("extra_feature_edges") = std::vector<std::vector<std::array<double, 3>>>(),
274274
py::arg("bounding_sphere_radius") = 0.0,
275275
py::arg("lloyd") = false,
276276
py::arg("odt") = false,

test/test_volume_mesh.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_balls_union():
3737

3838
mesh = pygalmesh.generate_mesh(
3939
u,
40-
feature_edges=[circ],
40+
extra_feature_edges=[circ],
4141
max_cell_circumradius=0.15,
4242
max_edge_size_at_feature_edges=max_edge_size_at_feature_edges,
4343
verbose=False,
@@ -77,7 +77,7 @@ def test_balls_intersection():
7777

7878
mesh = pygalmesh.generate_mesh(
7979
u,
80-
feature_edges=[circ],
80+
extra_feature_edges=[circ],
8181
max_cell_circumradius=0.15,
8282
max_edge_size_at_feature_edges=max_edge_size_at_feature_edges,
8383
verbose=False,
@@ -115,7 +115,7 @@ def test_balls_difference():
115115

116116
mesh = pygalmesh.generate_mesh(
117117
u,
118-
feature_edges=[circ],
118+
extra_feature_edges=[circ],
119119
max_cell_circumradius=0.15,
120120
max_edge_size_at_feature_edges=max_edge_size_at_feature_edges,
121121
min_facet_angle=25,

0 commit comments

Comments
 (0)