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 <>
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()));
return false;
}
+1 -1
View File
@@ -70,7 +70,7 @@ namespace IfcGeom {
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;
int size() const { return shapes_.size(); }
int size() const { return (int) shapes_.size(); }
const IfcGeom::ConversionResultShape* item(int i) const;
int item_id(int i) const;
};
+1 -1
View File
@@ -231,7 +231,7 @@ namespace IfcGeom {
task_result_index_ = 0;
done = 0;
total = tasks_.size();
total = (int) tasks_.size();
if (num_threads_ != 1) {
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;
}
vertexidx[i++] = vidx;
vertexidx[i++] = (int) vidx;
++num_vertices;
++current_halfedge;
@@ -216,7 +216,7 @@ double ifcopenshell::geometry::CgalShape::bounding_box(void *& b) 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) {
@@ -228,14 +228,14 @@ void ifcopenshell::geometry::CgalShape::set_box(void * b) {
int ifcopenshell::geometry::CgalShape::surface_genus() const {
to_poly();
int nv = shape_->size_of_vertices();
int ne = shape_->size_of_halfedges() / 2;
int nf = shape_->size_of_facets();
auto nv = shape_->size_of_vertices();
auto ne = shape_->size_of_halfedges() / 2;
auto nf = shape_->size_of_facets();
const int euler = nv - ne + nf;
const int genus = (2 - euler) / 2;
auto euler = nv - ne + nf;
auto genus = (2 - euler) / 2;
return genus;
return (int) genus;
}
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
{
to_poly();
return shape_->size_of_halfedges() / 2;
return (int) shape_->size_of_halfedges() / 2;
}
int ifcopenshell::geometry::CgalShape::num_faces() const
{
#ifndef IFOPSH_SIMPLE_KERNEL
if (nef_) {
return nef_->number_of_facets();
return (int) nef_->number_of_facets();
} else
#endif
if (shape_) {
return shape_->size_of_facets();
return (int) shape_->size_of_facets();
} else {
return 0;
}
@@ -537,11 +537,11 @@ ConversionResultShape* ifcopenshell::geometry::CgalShape::moved(ifcopenshell::ge
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");
}
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");
}
@@ -252,12 +252,13 @@ enum tree_type { TT_NARY_BRANCH, TT_PLANE };
template <typename Kernel>
class halfspace_tree {
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 std::unique_ptr<halfspace_tree> map(const plane_map<Kernel>&) const = 0;
virtual std::string dump(int level = 0) const = 0;
virtual tree_type kind() const = 0;
virtual void merge(CGAL::Nef_polyhedron_3<Kernel>&) const = 0;
virtual ~halfspace_tree() {}
};
// Halfspace tree component as n-ary operands
@@ -291,18 +292,18 @@ public:
ss << std::string(level * 2, ' ') << ")" << std::endl;
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;
if (operation_ == OP_SUBTRACTION) {
if (operands_.size() != 2) {
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) {
CGAL::Nef_nary_union_3<CGAL::Nef_polyhedron_3<Kernel>> builder;
for (auto& op : operands_) {
builder.add_polyhedron(op->evaluate(level + 1));
builder.add_polyhedron(op->evaluate());
}
result = builder.get_union();
} else if (operation_ == OP_INTERSECTION) {
@@ -320,7 +321,7 @@ public:
bool first = true;
for (auto& op : operands_) {
if (first) {
result = op->evaluate(level + 1);
result = op->evaluate();
first = false;
} else {
op->merge(result);
@@ -329,7 +330,7 @@ public:
} else {
CGAL::Nef_nary_intersection_3<CGAL::Nef_polyhedron_3<Kernel>> builder;
for (auto& op : operands_) {
builder.add_polyhedron(op->evaluate(level + 1));
builder.add_polyhedron(op->evaluate());
}
result = builder.get_intersection();
}
@@ -339,11 +340,11 @@ public:
bool first = true;
for (auto& op : operands_) {
if (first) {
r = op->evaluate(level + 1);
r = op->evaluate();
first = false;
continue;
}
r = r * op->evaluate(level + 1);
r = r * op->evaluate();
}
return r;
*/
@@ -451,7 +452,7 @@ public:
ss << std::string(level * 2, ' ') << "p " << std::setprecision(15) << plane_ << std::endl;
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) {
throw std::runtime_error("Not implemented yet");
// 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));
}
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");
}
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");
}
+3 -2
View File
@@ -289,7 +289,7 @@ typedef item const* ptr;
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) {
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;
}
};