mirror of https://github.com/CGAL/cgal
Add iwp gradient
This commit is contained in:
parent
fc14e2c87c
commit
62a104f413
|
|
@ -74,10 +74,29 @@ struct IWPValue {
|
|||
}
|
||||
};
|
||||
|
||||
template <class GeomTraits>
|
||||
struct IWPGradient {
|
||||
typedef typename GeomTraits::FT FT;
|
||||
typedef typename GeomTraits::Vector_3 Vector;
|
||||
|
||||
Vector operator()(const typename GeomTraits::Point_3& point) const {
|
||||
const FT alpha = 5.01;
|
||||
// const float alpha = 1.01;
|
||||
const FT x = alpha * (point.x() + 1) * M_PI;
|
||||
const FT y = alpha * (point.y() + 1) * M_PI;
|
||||
const FT z = alpha * (point.z() + 1) * M_PI;
|
||||
|
||||
const FT gx = M_PI * alpha * sin(x) * (cos(y) * (cos(z) - 1.0) - cos(z));
|
||||
const FT gy = M_PI * alpha * sin(y) * (cos(x) * (cos(z) - 1.0) - cos(z));
|
||||
const FT gz = M_PI * alpha * sin(z) * (cos(x) * (cos(y) - 1.0) - cos(y));
|
||||
return Vector(gx, gy, gz);
|
||||
}
|
||||
};
|
||||
|
||||
template <class GeomTraits>
|
||||
struct Implicit_iwp {
|
||||
|
||||
typedef CGAL::Isosurfacing::Implicit_domain<GeomTraits, IWPValue<GeomTraits>, SphereGradient<GeomTraits>> Domain;
|
||||
typedef CGAL::Isosurfacing::Implicit_domain<GeomTraits, IWPValue<GeomTraits>, IWPGradient<GeomTraits>> Domain;
|
||||
typedef typename GeomTraits::Vector_3 Vector;
|
||||
|
||||
Implicit_iwp(const std::size_t N) : res(2.0 / N, 2.0 / N, 2.0 / N) {}
|
||||
|
|
@ -92,7 +111,7 @@ struct Implicit_iwp {
|
|||
|
||||
private:
|
||||
IWPValue<GeomTraits> val;
|
||||
SphereGradient<GeomTraits> grad;
|
||||
IWPGradient<GeomTraits> grad;
|
||||
Vector res;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,14 +6,15 @@ algorithm = "ALGO_MARCHING_CUBES"
|
|||
tag = "TAG_PARALLEL"
|
||||
min_threads = 1
|
||||
max_threads = 12
|
||||
cells = 300
|
||||
n = 300
|
||||
cells = n ** 3
|
||||
|
||||
build(scenario, kernel, algorithm, tag)
|
||||
|
||||
data = []
|
||||
|
||||
for t in range(min_threads, max_threads):
|
||||
time = execute(cells, t)
|
||||
time = execute(n, t)
|
||||
|
||||
data.append([scenario, kernel, algorithm, tag, t, cells, time])
|
||||
|
||||
|
|
|
|||
|
|
@ -44,20 +44,26 @@ if latex_export:
|
|||
plt.rcParams['font.size'] = "17"
|
||||
|
||||
|
||||
data = pd.read_csv("threads_implicit.csv")
|
||||
add_threads_graph(data, "implicit")
|
||||
data = pd.read_csv("implicit_iwp_mc.csv")
|
||||
add_threads_graph(data, "mc")
|
||||
|
||||
data = pd.read_csv("threads_grid.csv")
|
||||
add_threads_graph(data, "grid")
|
||||
#data = pd.read_csv("threads_grid.csv")
|
||||
#add_threads_graph(data, "grid")
|
||||
|
||||
plt.xticks(np.arange(1, max(data["threads"]) + 0.1, 1))
|
||||
xt = np.arange(0, min(max(data["threads"]), 9) + 0.1, 2)
|
||||
if max(data["threads"]) > 10:
|
||||
print("more")
|
||||
xt = np.concatenate((xt, np.arange(10, max(data["threads"]) + 0.1, 2)))
|
||||
|
||||
print(xt)
|
||||
plt.xticks(xt)
|
||||
plot_graph("perf_threads.svg", "", False, "performance [10^3 cubes/s]", "cores")
|
||||
|
||||
|
||||
data = pd.read_csv("size_implicit.csv")
|
||||
add_size_graph(data, "implicit")
|
||||
|
||||
data = pd.read_csv("size_grid.csv")
|
||||
add_size_graph(data, "grid")
|
||||
|
||||
plot_graph("perf_size.svg", "", True, "performance [10^3 cubes/s]", "cubes")
|
||||
#data = pd.read_csv("size_implicit.csv")
|
||||
#add_size_graph(data, "implicit")
|
||||
#
|
||||
#data = pd.read_csv("size_grid.csv")
|
||||
#add_size_graph(data, "grid")
|
||||
#
|
||||
#plot_graph("perf_size.svg", "", True, "performance [10^3 cubes/s]", "cubes")
|
||||
|
|
|
|||
Loading…
Reference in New Issue