Skip to content

Commit

Permalink
Address compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
aothms committed Mar 14, 2024
1 parent ca04888 commit bf1d2be
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/ifcgeom/AbstractKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ifcgeom/IfcGeomRepresentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion src/ifcgeom/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); });
Expand Down
26 changes: 13 additions & 13 deletions src/ifcgeom/kernels/cgal/CgalConversionResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand All @@ -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;
}
Expand Down Expand Up @@ -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");
}

Expand Down
19 changes: 10 additions & 9 deletions src/ifcgeom/kernels/cgal/nef_to_halfspace_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -291,18 +292,18 @@ class halfspace_tree_nary_branch : public halfspace_tree<Kernel> {
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) {
Expand All @@ -320,7 +321,7 @@ class halfspace_tree_nary_branch : public halfspace_tree<Kernel> {
bool first = true;
for (auto& op : operands_) {
if (first) {
result = op->evaluate(level + 1);
result = op->evaluate();
first = false;
} else {
op->merge(result);
Expand All @@ -329,7 +330,7 @@ class halfspace_tree_nary_branch : public halfspace_tree<Kernel> {
} 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();
}
Expand All @@ -339,11 +340,11 @@ class halfspace_tree_nary_branch : public halfspace_tree<Kernel> {
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;
*/
Expand Down Expand Up @@ -451,7 +452,7 @@ class halfspace_tree_plane : public halfspace_tree<Kernel> {
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
5 changes: 3 additions & 2 deletions src/ifcgeom/taxonomy.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ typedef item const* ptr;
boost::hash_combine(h, std::hash<typename T::Scalar>()(elem));
}
}
return h;
return (uint32_t) h;
}
};

Expand Down Expand Up @@ -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;
}
};

Expand Down

0 comments on commit bf1d2be

Please sign in to comment.