Address compiler warnings

This commit is contained in:
Thomas Krijnen
2024-03-14 11:05:29 +01:00
parent ca0488892c
commit bf1d2befd8
7 changed files with 31 additions and 29 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ namespace {
template <> template <>
struct dispatch_conversion<ifcopenshell::geometry::taxonomy::type_by_kind::max> { struct dispatch_conversion<ifcopenshell::geometry::taxonomy::type_by_kind::max> {
static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel*, ifcopenshell::geometry::taxonomy::kinds item_kind, const ifcopenshell::geometry::taxonomy::ptr item, IfcGeom::ConversionResults&) { static bool dispatch(ifcopenshell::geometry::kernels::AbstractKernel*, ifcopenshell::geometry::taxonomy::kinds, const ifcopenshell::geometry::taxonomy::ptr item, IfcGeom::ConversionResults&) {
Logger::Error("No conversion for " + std::to_string(item->kind())); Logger::Error("No conversion for " + std::to_string(item->kind()));
return false; return false;
} }
+1 -1
View File
@@ -70,7 +70,7 @@ namespace IfcGeom {
bool calculate_surface_area(double&) const; bool calculate_surface_area(double&) const;
bool calculate_projected_surface_area(const ifcopenshell::geometry::taxonomy::matrix4& ax, double& along_x, double& along_y, double& along_z) const; bool calculate_projected_surface_area(const ifcopenshell::geometry::taxonomy::matrix4& ax, double& along_x, double& along_y, double& along_z) const;
int size() const { return shapes_.size(); } int size() const { return (int) shapes_.size(); }
const IfcGeom::ConversionResultShape* item(int i) const; const IfcGeom::ConversionResultShape* item(int i) const;
int item_id(int i) const; int item_id(int i) const;
}; };
+1 -1
View File
@@ -231,7 +231,7 @@ namespace IfcGeom {
task_result_index_ = 0; task_result_index_ = 0;
done = 0; done = 0;
total = tasks_.size(); total = (int) tasks_.size();
if (num_threads_ != 1) { if (num_threads_ != 1) {
init_future_ = std::async(std::launch::async, [this]() { process_concurrently(); }); init_future_ = std::async(std::launch::async, [this]() { process_concurrently(); });
@@ -168,7 +168,7 @@ void ifcopenshell::geometry::CgalShape::Triangulate(ifcopenshell::geometry::Sett
vidx = it->second; vidx = it->second;
} }
vertexidx[i++] = vidx; vertexidx[i++] = (int) vidx;
++num_vertices; ++num_vertices;
++current_halfedge; ++current_halfedge;
@@ -216,7 +216,7 @@ double ifcopenshell::geometry::CgalShape::bounding_box(void *& b) const {
} }
int ifcopenshell::geometry::CgalShape::num_vertices() const { int ifcopenshell::geometry::CgalShape::num_vertices() const {
return static_cast<cgal_shape_t>(*this).size_of_vertices(); return (int) static_cast<cgal_shape_t>(*this).size_of_vertices();
} }
void ifcopenshell::geometry::CgalShape::set_box(void * b) { void ifcopenshell::geometry::CgalShape::set_box(void * b) {
@@ -228,14 +228,14 @@ void ifcopenshell::geometry::CgalShape::set_box(void * b) {
int ifcopenshell::geometry::CgalShape::surface_genus() const { int ifcopenshell::geometry::CgalShape::surface_genus() const {
to_poly(); to_poly();
int nv = shape_->size_of_vertices(); auto nv = shape_->size_of_vertices();
int ne = shape_->size_of_halfedges() / 2; auto ne = shape_->size_of_halfedges() / 2;
int nf = shape_->size_of_facets(); auto nf = shape_->size_of_facets();
const int euler = nv - ne + nf; auto euler = nv - ne + nf;
const int genus = (2 - euler) / 2; auto genus = (2 - euler) / 2;
return genus; return (int) genus;
} }
bool ifcopenshell::geometry::CgalShape::is_manifold() const { bool ifcopenshell::geometry::CgalShape::is_manifold() const {
@@ -247,18 +247,18 @@ bool ifcopenshell::geometry::CgalShape::is_manifold() const {
int ifcopenshell::geometry::CgalShape::num_edges() const int ifcopenshell::geometry::CgalShape::num_edges() const
{ {
to_poly(); to_poly();
return shape_->size_of_halfedges() / 2; return (int) shape_->size_of_halfedges() / 2;
} }
int ifcopenshell::geometry::CgalShape::num_faces() const int ifcopenshell::geometry::CgalShape::num_faces() const
{ {
#ifndef IFOPSH_SIMPLE_KERNEL #ifndef IFOPSH_SIMPLE_KERNEL
if (nef_) { if (nef_) {
return nef_->number_of_facets(); return (int) nef_->number_of_facets();
} else } else
#endif #endif
if (shape_) { if (shape_) {
return shape_->size_of_facets(); return (int) shape_->size_of_facets();
} else { } else {
return 0; return 0;
} }
@@ -537,11 +537,11 @@ ConversionResultShape* ifcopenshell::geometry::CgalShape::moved(ifcopenshell::ge
return new CgalShape(s, convex_tag_); return new CgalShape(s, convex_tag_);
} }
void ifcopenshell::geometry::CgalShape::map(OpaqueCoordinate<4>& from, OpaqueCoordinate<4>& to) { void ifcopenshell::geometry::CgalShape::map(OpaqueCoordinate<4>&, OpaqueCoordinate<4>&) {
throw std::runtime_error("Not implemented"); throw std::runtime_error("Not implemented");
} }
void ifcopenshell::geometry::CgalShape::map(const std::vector<OpaqueCoordinate<4>>& from, const std::vector<OpaqueCoordinate<4>>& to) { void ifcopenshell::geometry::CgalShape::map(const std::vector<OpaqueCoordinate<4>>&, const std::vector<OpaqueCoordinate<4>>&) {
throw std::runtime_error("Not implemented"); throw std::runtime_error("Not implemented");
} }
@@ -252,12 +252,13 @@ enum tree_type { TT_NARY_BRANCH, TT_PLANE };
template <typename Kernel> template <typename Kernel>
class halfspace_tree { class halfspace_tree {
public: public:
virtual CGAL::Nef_polyhedron_3<Kernel> evaluate(int level = 0) const = 0; virtual CGAL::Nef_polyhedron_3<Kernel> evaluate() const = 0;
virtual void accumulate(std::list<typename Kernel::Plane_3>&) const = 0; virtual void accumulate(std::list<typename Kernel::Plane_3>&) const = 0;
virtual std::unique_ptr<halfspace_tree> map(const plane_map<Kernel>&) const = 0; virtual std::unique_ptr<halfspace_tree> map(const plane_map<Kernel>&) const = 0;
virtual std::string dump(int level = 0) const = 0; virtual std::string dump(int level = 0) const = 0;
virtual tree_type kind() const = 0; virtual tree_type kind() const = 0;
virtual void merge(CGAL::Nef_polyhedron_3<Kernel>&) const = 0; virtual void merge(CGAL::Nef_polyhedron_3<Kernel>&) const = 0;
virtual ~halfspace_tree() {}
}; };
// Halfspace tree component as n-ary operands // Halfspace tree component as n-ary operands
@@ -291,18 +292,18 @@ public:
ss << std::string(level * 2, ' ') << ")" << std::endl; ss << std::string(level * 2, ' ') << ")" << std::endl;
return ss.str(); return ss.str();
} }
virtual CGAL::Nef_polyhedron_3<Kernel> evaluate(int level) const { virtual CGAL::Nef_polyhedron_3<Kernel> evaluate() const {
CGAL::Nef_polyhedron_3<Kernel> result; CGAL::Nef_polyhedron_3<Kernel> result;
if (operation_ == OP_SUBTRACTION) { if (operation_ == OP_SUBTRACTION) {
if (operands_.size() != 2) { if (operands_.size() != 2) {
throw std::runtime_error(""); throw std::runtime_error("");
} }
result = operands_.front()->evaluate(level + 1) - operands_.back()->evaluate(level + 1); result = operands_.front()->evaluate() - operands_.back()->evaluate();
} else if (operation_ == OP_UNION) { } else if (operation_ == OP_UNION) {
CGAL::Nef_nary_union_3<CGAL::Nef_polyhedron_3<Kernel>> builder; CGAL::Nef_nary_union_3<CGAL::Nef_polyhedron_3<Kernel>> builder;
for (auto& op : operands_) { for (auto& op : operands_) {
builder.add_polyhedron(op->evaluate(level + 1)); builder.add_polyhedron(op->evaluate());
} }
result = builder.get_union(); result = builder.get_union();
} else if (operation_ == OP_INTERSECTION) { } else if (operation_ == OP_INTERSECTION) {
@@ -320,7 +321,7 @@ public:
bool first = true; bool first = true;
for (auto& op : operands_) { for (auto& op : operands_) {
if (first) { if (first) {
result = op->evaluate(level + 1); result = op->evaluate();
first = false; first = false;
} else { } else {
op->merge(result); op->merge(result);
@@ -329,7 +330,7 @@ public:
} else { } else {
CGAL::Nef_nary_intersection_3<CGAL::Nef_polyhedron_3<Kernel>> builder; CGAL::Nef_nary_intersection_3<CGAL::Nef_polyhedron_3<Kernel>> builder;
for (auto& op : operands_) { for (auto& op : operands_) {
builder.add_polyhedron(op->evaluate(level + 1)); builder.add_polyhedron(op->evaluate());
} }
result = builder.get_intersection(); result = builder.get_intersection();
} }
@@ -339,11 +340,11 @@ public:
bool first = true; bool first = true;
for (auto& op : operands_) { for (auto& op : operands_) {
if (first) { if (first) {
r = op->evaluate(level + 1); r = op->evaluate();
first = false; first = false;
continue; continue;
} }
r = r * op->evaluate(level + 1); r = r * op->evaluate();
} }
return r; return r;
*/ */
@@ -451,7 +452,7 @@ public:
ss << std::string(level * 2, ' ') << "p " << std::setprecision(15) << plane_ << std::endl; ss << std::string(level * 2, ' ') << "p " << std::setprecision(15) << plane_ << std::endl;
return ss.str(); return ss.str();
} }
virtual CGAL::Nef_polyhedron_3<Kernel> evaluate(int level) const { virtual CGAL::Nef_polyhedron_3<Kernel> evaluate() const {
if constexpr(CGAL::Is_extended_kernel<Kernel>::value_type::value) { if constexpr(CGAL::Is_extended_kernel<Kernel>::value_type::value) {
throw std::runtime_error("Not implemented yet"); throw std::runtime_error("Not implemented yet");
// typename Kernel::Plane_3 plane(plane_.a().exact(), plane_.b().exact(), plane_.c().exact(), plane_.d().exact()); // typename Kernel::Plane_3 plane(plane_.a().exact(), plane_.b().exact(), plane_.c().exact(), plane_.d().exact());
@@ -430,10 +430,10 @@ ConversionResultShape* ifcopenshell::geometry::OpenCascadeShape::moved(ifcopensh
return new OpenCascadeShape(IfcGeom::util::apply_transformation(shape_, *t)); return new OpenCascadeShape(IfcGeom::util::apply_transformation(shape_, *t));
} }
void ifcopenshell::geometry::OpenCascadeShape::map(OpaqueCoordinate<4>& from, OpaqueCoordinate<4>& to) { void ifcopenshell::geometry::OpenCascadeShape::map(OpaqueCoordinate<4>&, OpaqueCoordinate<4>&) {
throw std::runtime_error("Not implemented"); throw std::runtime_error("Not implemented");
} }
void ifcopenshell::geometry::OpenCascadeShape::map(const std::vector<OpaqueCoordinate<4>>& from, const std::vector<OpaqueCoordinate<4>>& to) { void ifcopenshell::geometry::OpenCascadeShape::map(const std::vector<OpaqueCoordinate<4>>&, const std::vector<OpaqueCoordinate<4>>&) {
throw std::runtime_error("Not implemented"); throw std::runtime_error("Not implemented");
} }
+3 -2
View File
@@ -289,7 +289,7 @@ typedef item const* ptr;
boost::hash_combine(h, std::hash<typename T::Scalar>()(elem)); boost::hash_combine(h, std::hash<typename T::Scalar>()(elem));
} }
} }
return h; return (uint32_t) h;
} }
}; };
@@ -741,7 +741,8 @@ typedef item const* ptr;
for (auto& c : children) { for (auto& c : children) {
boost::hash_combine(h, c->hash()); boost::hash_combine(h, c->hash());
} }
return h; // @todo should we really use uint32_t instead of size_t for hashes?
return (uint32_t) h;
} }
}; };