GoldFeniks / delaunay

MIT License
0 stars 0 forks source link

template bug report #1

Open ChiaCheng-Tsai opened 3 years ago

ChiaCheng-Tsai commented 3 years ago

I have compiled dork, zip, acoustics-at-home with g++ -std=c++17. However I failed to comiple delaunay with the following error.

delaunay.hpp||In instantiation of 'constexpr const auto delaunay_triangulation<delaunay_triangulation::point>::eps':| delaunay.hpp|111|required from 'class delaunay_triangulation<delaunay_triangulation::point>'| delaunay.hpp|120| required by substitution of 'template data_value_wrapper(std::vector<_RealType>, int64_t)-> delaunay_triangulation::data_value_wrapper [with V = delaunay_triangulation::point]'| delaunay.hpp|263|required from 'void delaunay_triangulation::triangulate() [with T = double]'| delaunay.hpp|32|required from 'delaunay_triangulation::delaunay_triangulation(const VX&, const VY&) [with VX = std::vector; VY = std::vector; T = double]'| main_delaunary.cpp|34|required from here| delaunay.hpp|111|error: no matching function for call to 'delaunay_triangulation::point::point(double)'| delaunay.hpp|160|note: candidate: delaunay_triangulation::point::point(T, T) [with T = double]| delaunay.hpp|160|note: candidate expects 2 arguments, 1 provided| delaunay.hpp|159|note: candidate: delaunay_triangulation::point::point() [with T = double]| delaunay.hpp|159|note: candidate expects 0 arguments, 1 provided| delaunay.hpp|155|note: candidate: constexpr delaunay_triangulation::point::point(const delaunay_triangulation::point&)| delaunay.hpp|155|note: no known conversion for argument 1 from 'double' to 'const delaunay_triangulation::point&'| delaunay.hpp|155|note: candidate: constexpr delaunay_triangulation::point::point(delaunay_triangulation::point&&)| delaunay.hpp|155|note: no known conversion for argument 1 from 'double' to 'delaunay_triangulation::point&&'| delaunay.hpp||In instantiation of 'void delaunay_triangulation::triangulate() [with T = double]':| delaunay.hpp|32|required from 'delaunay_triangulation::delaunay_triangulation(const VX&, const VY&) [with VX = std::vector; VY = std::vector; T = double]'| main_delaunary.cpp|34|required from here| delaunay.hpp|264|error: use of 'const auto& delaunay_triangulation::data_value_wrapper::get() const [with V = delaunay_triangulation::point; T = delaunay_triangulation::point]' before deduction of 'auto'| delaunay.hpp|270|error: use of 'static auto delaunay_triangulation::_norm(const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|274|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|277|error: use of 'static auto delaunay_triangulation::_circle_center(const delaunay_triangulation::point&, const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|277|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|279|error: use of 'static auto delaunay_triangulation::_circle_center(const delaunay_triangulation::point&, const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|279|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|289|error: use of 'static auto delaunay_triangulation::_is_clockwise(const delaunay_triangulation::point&, const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|289|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|293|error: use of 'static auto delaunay_triangulation::_norm(const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|293|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|296|error: use of 'auto delaunay_triangulation::_add_edge(const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&, const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&) [with T = double]' before deduction of 'auto'| delaunay.hpp|297|error: use of 'auto delaunay_triangulation::_add_edge(const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&, const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&) [with T = double]' before deduction of 'auto'| delaunay.hpp|298|error: use of 'auto delaunay_triangulation::_add_edge(const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&, const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&) [with T = double]' before deduction of 'auto'| delaunay.hpp|309|error: use of 'static auto delaunay_triangulation::_is_clockwise(const delaunay_triangulation::point&, const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|309|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::edge; T = double]' before deduction of 'auto'| delaunay.hpp|309|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::edge; T = double]' before deduction of 'auto'| delaunay.hpp|314|error: use of 'auto delaunay_triangulation::_add_triangle(delaunay_triangulation::data_value_wrapper<delaunay_triangulation::edge>&, const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&) [with T = double]' before deduction of 'auto'| delaunay.hpp|322|error: unable to deduce 'auto' from 'b'| delaunay.hpp|332|error: unable to deduce 'auto' from 'a'| delaunay.hpp|339|error: use of 'auto delaunay_triangulation::_flip_triangles() [with T = double]' before deduction of 'auto'| D:\msys2\mingw64\include\c++\7.3.0\bits\stl_algo.h|4856|error: 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> >, std::vector<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> >, std::allocator<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> > > > >; _Compare = delaunay_triangulation::triangulat| D:\msys2\mingw64\include\c++\7.3.0\bits\stl_algo.h|4856|error: 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> >*, std::vector<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> >, std::allocator<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> > > > >; _Compare = delaunay_triangulation::triangulat| ||=== Build failed: 25 error(s), 8 warning(s) (0 minute(s), 2 second(s)) ===|

GoldFeniks commented 3 years ago

Can you post a minimal example that doesn't compile?

ChiaCheng-Tsai commented 3 years ago

My minimal example is in the below

include "delaunay.hpp"

int main() { std::vector x(1), y(1); x[0]=y[0]=1; delaunay_triangulation tri(x, y); }

When complied with the latest delaunay.hpp, the error messages are

delaunay.hpp||In instantiation of 'constexpr const auto delaunay_triangulation<delaunay_triangulation::point>::eps':| delaunay.hpp|111|required from 'class delaunay_triangulation<delaunay_triangulation::point>'| delaunay.hpp|120| required by substitution of 'template data_value_wrapper(std::vector<V, std::allocator<_Tp1> >, int64_t)-> delaunay_triangulation::data_value_wrapper [with V = delaunay_triangulation::point]'| delaunay.hpp|263|required from 'void delaunay_triangulation::triangulate() [with T = double]'| delaunay.hpp|32|required from 'delaunay_triangulation::delaunay_triangulation(const VX&, const VY&) [with VX = std::vector; VY = std::vector; T = double]'| main_short.cpp|7|required from here| delaunay.hpp|111|error: no matching function for call to 'delaunay_triangulation::point::point(double)'| delaunay.hpp|160|note: candidate: delaunay_triangulation::point::point(T, T) [with T = double]| delaunay.hpp|160|note: candidate expects 2 arguments, 1 provided| delaunay.hpp|159|note: candidate: delaunay_triangulation::point::point() [with T = double]| delaunay.hpp|159|note: candidate expects 0 arguments, 1 provided| delaunay.hpp|155|note: candidate: constexpr delaunay_triangulation::point::point(const delaunay_triangulation::point&)| delaunay.hpp|155|note: no known conversion for argument 1 from 'double' to 'const delaunay_triangulation::point&'| delaunay.hpp|155|note: candidate: constexpr delaunay_triangulation::point::point(delaunay_triangulation::point&&)| delaunay.hpp|155|note: no known conversion for argument 1 from 'double' to 'delaunay_triangulation::point&&'| delaunay.hpp||In instantiation of 'void delaunay_triangulation::triangulate() [with T = double]':| delaunay.hpp|32|required from 'delaunay_triangulation::delaunay_triangulation(const VX&, const VY&) [with VX = std::vector; VY = std::vector; T = double]'| main_short.cpp|7|required from here| delaunay.hpp|264|error: use of 'const auto& delaunay_triangulation::data_value_wrapper::get() const [with V = delaunay_triangulation::point; T = delaunay_triangulation::point]' before deduction of 'auto'| delaunay.hpp|270|error: use of 'static auto delaunay_triangulation::_norm(const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|274|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|277|error: use of 'static auto delaunay_triangulation::_circle_center(const delaunay_triangulation::point&, const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|277|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|279|error: use of 'static auto delaunay_triangulation::_circle_center(const delaunay_triangulation::point&, const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|279|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|289|error: use of 'static auto delaunay_triangulation::_is_clockwise(const delaunay_triangulation::point&, const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|289|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|293|error: use of 'static auto delaunay_triangulation::_norm(const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|293|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|296|error: use of 'auto delaunay_triangulation::_add_edge(const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&, const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&) [with T = double]' before deduction of 'auto'| delaunay.hpp|297|error: use of 'auto delaunay_triangulation::_add_edge(const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&, const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&) [with T = double]' before deduction of 'auto'| delaunay.hpp|298|error: use of 'auto delaunay_triangulation::_add_edge(const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&, const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&) [with T = double]' before deduction of 'auto'| delaunay.hpp|309|error: use of 'static auto delaunay_triangulation::_is_clockwise(const delaunay_triangulation::point&, const delaunay_triangulation::point&, const delaunay_triangulation::point&) [with T = double]' before deduction of 'auto'| delaunay.hpp|309|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::edge; T = double]' before deduction of 'auto'| delaunay.hpp|309|error: use of 'auto& delaunay_triangulation::data_value_wrapper::get() [with V = delaunay_triangulation::edge; T = double]' before deduction of 'auto'| delaunay.hpp|309|error: use of 'const auto& delaunay_triangulation::data_value_wrapper::get() const [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|310|error: use of 'const auto& delaunay_triangulation::data_value_wrapper::get() const [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|311|error: use of 'const auto& delaunay_triangulation::data_value_wrapper::get() const [with V = delaunay_triangulation::point; T = double]' before deduction of 'auto'| delaunay.hpp|314|error: use of 'auto delaunay_triangulation::_add_triangle(delaunay_triangulation::data_value_wrapper<delaunay_triangulation::edge>&, const delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point>&) [with T = double]' before deduction of 'auto'| delaunay.hpp|322|error: unable to deduce 'auto' from 'b'| delaunay.hpp|332|error: unable to deduce 'auto' from 'a'| delaunay.hpp|339|error: use of 'auto delaunay_triangulation::_flip_triangles() [with T = double]' before deduction of 'auto'| D:\msys2\mingw64\include\c++\7.3.0\bits\stl_algo.h|4856|error: 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> >, std::vector<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> >, std::allocator<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> > > > >; _Compare = delaunay_triangulation::triangulat| D:\msys2\mingw64\include\c++\7.3.0\bits\stl_algo.h|4856|error: 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> >*, std::vector<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> >, std::allocator<std::pair<double, delaunay_triangulation::data_value_wrapper<delaunay_triangulation::point> > > > >; _Compare = delaunay_triangulation::triangulat| ||=== Build failed: 28 error(s), 8 warning(s) (0 minute(s), 3 second(s)) ===|

ChiaCheng-Tsai commented 3 years ago

I have solved the problem by seperating the sub classes out of class delaunay_triangulation

GoldFeniks commented 3 years ago

Your example is missing template arguments for vector and delaunay_triangulation. Also the triangulation requires at least 3 points (which should also be unique)

Try to compile the following

#include "delaunay.hpp"

int main() {
    std::vector<double> x(3), y(3);
    x[0] = y[0] = x[2] = 1;
    x[1] = y[1] = y[2] = 2;
    delaunay_triangulation<double> tri(x, y);
}
ChiaCheng-Tsai commented 3 years ago

I tried your example. It also failed. By the way I solved it by an ad-hoc way. And I compiled the Acoustic project. Many thanks for your replies.

GoldFeniks commented 3 years ago

What compiler do you use, I'll try to look at the problem closely? Also I'm glad you could successfully compile Acoustic

ChiaCheng-Tsai commented 3 years ago

I used gcc version 7.3.0 from msys2/mingw in windows. Many thanks for your innovation of Acoustic. By the way, I will be more than happy if you can give me some hint about how to plot results of Acoustic. Take canyon for example, I got 150.txt (two columns) and meta.json as { "binary": false, "dimensions": [ [ 4 ], { "bounds": { "a": 0.0, "b": 10000.0, "d": 100.0 }, "n": 101 }, { "bounds": { "a": -3000.0, "b": 3000.0, "d": 1.0 }, "n": 6001 }, { "bounds": { "a": 10.0, "b": 10.0,

I supposed that I may miss some thing that I will figure out.

Thanks again

GoldFeniks commented 3 years ago

I will look into the gcc problem The Acoustic output is off-topic here, so please create an issue in Acoustic or write me an email, the address is listed on my github page