diff --git a/docs/cpp-api/Doxyfile b/docs/cpp-api/Doxyfile index fa2a850162..0264b2e811 100644 --- a/docs/cpp-api/Doxyfile +++ b/docs/cpp-api/Doxyfile @@ -2390,17 +2390,17 @@ PREDEFINED = IFC_PARSE_API= \ EXPAND_AS_DEFINED = Kernel_ \ cgal_shape \ cgal_kernel \ - cgal_placement_t \ - cgal_point_t \ - cgal_direction_t \ - cgal_vector_t \ - cgal_plane_t \ - cgal_curve_t \ - cgal_wire_t \ - cgal_face_t \ - cgal_shape_t \ - cgal_vertex_descriptor_t \ - cgal_face_descriptor_t \ + cgal_placement \ + cgal_point \ + cgal_direction \ + cgal_vector \ + cgal_plane \ + cgal_curve \ + cgal_wire \ + cgal_face \ + cgal_polyhedron \ + cgal_vertex_descriptor \ + cgal_face_descriptor \ create_cube \ create_polyhedron diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 2a6afbe730..6f0408dd49 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -247,7 +247,7 @@ struct exclusion_traverse_filter : public geom_filter { exclusion_traverse_filte size_t read_filters_from_file(const std::string&, inclusion_filter&, inclusion_traverse_filter&, exclusion_filter&, exclusion_traverse_filter&); void parse_filter(geom_filter &, const std::vector&); -std::vector setup_filters(const std::vector&, const std::string&); +std::vector setup_filters(const std::vector&, const std::string&); bool init_input_file(const std::string& filename, ifcopenshell::file*& ifc_file, bool no_progress, bool mmap, bool bypass_properties=false, ifcopenshell::logger& logger = ifcopenshell::logger::root()); @@ -694,7 +694,7 @@ int main(int argc, char** argv) { if (exclude_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_filter); } if (exclude_traverse_filter.type != geom_filter::UNUSED) { used_filters.push_back(exclude_traverse_filter); } - std::vector filter_funcs = setup_filters(used_filters, ifcopenshell::path::to_utf8(output_extension)); + std::vector filter_funcs = setup_filters(used_filters, ifcopenshell::path::to_utf8(output_extension)); if (filter_funcs.empty()) { cerr_ << "[error] Failed to set up geometry filters\n"; return EXIT_FAILURE; @@ -1260,9 +1260,9 @@ void validate(boost::any& v, const std::vector& values, exclusion_t /// @todo Clean up this filter initialization code further. /// @return References to the used filter functors, if none an error occurred. -std::vector setup_filters(const std::vector& filters, const std::string& output_extension) +std::vector setup_filters(const std::vector& filters, const std::string& output_extension) { - std::vector filter_funcs; + std::vector filter_funcs; for(auto& f: filters) { if (f.type == geom_filter::ENTITY_TYPE) { entity_filter.include = f.include; diff --git a/src/ifcconvert/validate_space_boundaries.cpp b/src/ifcconvert/validate_space_boundaries.cpp index 5e4bf74331..c90eeeee1b 100644 --- a/src/ifcconvert/validate_space_boundaries.cpp +++ b/src/ifcconvert/validate_space_boundaries.cpp @@ -112,7 +112,7 @@ void fix_spaceboundaries(ifcopenshell::file& f, bool no_progress, bool quiet, bo guid_pairs_visited.insert({ Aguid, Bguid }); - cgal_shape_t x_poly; + cgal_polyhedron x_poly; x.convert_to_polyhedron(x_poly); { diff --git a/src/ifcconvert/validate_storey_containment.cpp b/src/ifcconvert/validate_storey_containment.cpp index 6ffc486c3d..5d4606458e 100644 --- a/src/ifcconvert/validate_storey_containment.cpp +++ b/src/ifcconvert/validate_storey_containment.cpp @@ -19,7 +19,7 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, settings.get().value = ifcopenshell::geom::settings::NATIVE; settings.get().value = true; - std::vector no_openings_and_spaces = { + std::vector no_openings_and_spaces = { ifcopenshell::geom::entity_filter(false, false, {"IfcOpeningElement", "IfcSpace"}) }; @@ -138,12 +138,12 @@ void fix_storeycontainment(ifcopenshell::file& f, bool no_progress, bool quiet, const auto& m = g.Placement()->ccomponents(); const auto& n = geom_object->transformation().data()->ccomponents(); - const cgal_placement_t trsf( + const cgal_placement trsf( m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(2, 0), m(2, 1), m(2, 2), m(2, 3)); - const cgal_placement_t trsf2( + const cgal_placement trsf2( n(0, 0), n(0, 1), n(0, 2), n(0, 3), n(1, 0), n(1, 1), n(1, 2), n(1, 3), n(2, 0), n(2, 1), n(2, 2), n(2, 3)); diff --git a/src/ifcconvert/validate_wall_connectivity.cpp b/src/ifcconvert/validate_wall_connectivity.cpp index 423f5a7f66..7c44821f84 100644 --- a/src/ifcconvert/validate_wall_connectivity.cpp +++ b/src/ifcconvert/validate_wall_connectivity.cpp @@ -90,7 +90,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b } std::clock_t poly_begin = std::clock(); - cgal_shape_t x_poly; + cgal_polyhedron x_poly; x.convert_to_polyhedron(x_poly); std::clock_t poly_end = std::clock(); conversion_to_poly += (poly_end - poly_begin) / (double)CLOCKS_PER_SEC; @@ -136,7 +136,7 @@ void fix_wallconnectivity(ifcopenshell::file& f, bool no_progress, bool quiet, b std::vector parameters; - std::transform(vertices(x_poly).begin(), vertices(x_poly).end(), std::back_inserter(parameters), [&P0, D](cgal_vertex_descriptor_t& v) { + std::transform(vertices(x_poly).begin(), vertices(x_poly).end(), std::back_inserter(parameters), [&P0, D](cgal_vertex_descriptor& v) { return (v->point() - P0) * D; }); diff --git a/src/ifcconvert/validation_utils.cpp b/src/ifcconvert/validation_utils.cpp index e4e591f853..87044a4fc2 100644 --- a/src/ifcconvert/validation_utils.cpp +++ b/src/ifcconvert/validation_utils.cpp @@ -2,14 +2,14 @@ #include "validation_utils.h" -double facet_area(const cgal_shape_t::Facet_handle& f) { +double facet_area(const cgal_polyhedron::Facet_handle& f) { auto p0 = f->facet_begin()->vertex()->point(); auto p1 = f->facet_begin()->next()->vertex()->point(); auto p2 = f->facet_begin()->next()->next()->vertex()->point(); return std::sqrt(CGAL::to_double(CGAL::cross_product(p0 - p1, p2 - p1).squared_length())); } -void dump_facet(const cgal_shape_t::Facet_handle& f) { +void dump_facet(const cgal_polyhedron::Facet_handle& f) { auto p0 = f->facet_begin()->vertex()->point(); auto p1 = f->facet_begin()->next()->vertex()->point(); auto p2 = f->facet_begin()->next()->next()->vertex()->point(); diff --git a/src/ifcconvert/validation_utils.h b/src/ifcconvert/validation_utils.h index a717084b00..fa7e24ba5d 100644 --- a/src/ifcconvert/validation_utils.h +++ b/src/ifcconvert/validation_utils.h @@ -39,7 +39,7 @@ T enlarge(const T& t, double d = 1.e-5) { template struct Build_Offset : public CGAL::Modifier_base { - std::list input; + std::list input; void operator()(HDS& hds) { // Postcondition: hds is a valid polyhedral surface. @@ -81,12 +81,12 @@ struct Build_Offset : public CGAL::Modifier_base { }; template -std::list connected_faces(cgal_shape_t::Facet_handle f, const Ts& excluded) { - std::set fs = { f }; +std::list connected_faces(cgal_polyhedron::Facet_handle f, const Ts& excluded) { + std::set fs = { f }; - std::function process; - process = [&fs, &process, &excluded](cgal_shape_t::Facet_handle& f) { - cgal_shape_t::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); + std::function process; + process = [&fs, &process, &excluded](cgal_polyhedron::Facet_handle& f) { + cgal_polyhedron::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); do { auto ff = circ->opposite()->facet(); if (excluded.find(ff) == excluded.end()) { @@ -99,12 +99,12 @@ std::list connected_faces(cgal_shape_t::Facet_handle }; process(f); - return std::list(fs.begin(), fs.end()); + return std::list(fs.begin(), fs.end()); } template struct Builder_With_Map : public CGAL::Modifier_base { - std::list input; + std::list input; std::map mapping; void operator()(HDS& hds) { @@ -114,7 +114,7 @@ struct Builder_With_Map : public CGAL::Modifier_base { std::set used_points; for (auto& f : input) { - cgal_shape_t::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); + cgal_polyhedron::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); do { auto P = circ->vertex()->point(); auto it = mapping.find(P); @@ -135,7 +135,7 @@ struct Builder_With_Map : public CGAL::Modifier_base { for (auto& f : input) { B.begin_facet(); - cgal_shape_t::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); + cgal_polyhedron::Halfedge_around_facet_circulator circ = f->facet_begin(), end(circ); do { auto P = circ->vertex()->point(); auto it = mapping.find(P); @@ -161,9 +161,9 @@ struct Builder_With_Map : public CGAL::Modifier_base { } }; -double facet_area(const cgal_shape_t::Facet_handle& f); +double facet_area(const cgal_polyhedron::Facet_handle& f); -void dump_facet(const cgal_shape_t::Facet_handle& f); +void dump_facet(const cgal_polyhedron::Facet_handle& f); struct remove_thickness { typedef Kernel_::Point_3 Point; @@ -182,17 +182,17 @@ struct remove_thickness { typedef CGAL::AABB_tree Tree; typedef boost::optional::Type> Ray_intersection; - cgal_shape_t polyhedron, polyhedron2, flattened; + cgal_polyhedron polyhedron, polyhedron2, flattened; - remove_thickness(const cgal_shape_t& p) + remove_thickness(const cgal_polyhedron& p) // edge_collapse(p) still does not work :( : polyhedron(p) , polyhedron2(p) { CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron); CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron2); - std::list non_degenerate, degenerate, longitudinal; - std::set thin_sides; + std::list non_degenerate, degenerate, longitudinal; + std::set thin_sides; std::wcout << "ALL FACES:" << std::endl; @@ -211,8 +211,8 @@ struct remove_thickness { dump_facet(f); } - cgal_shape_t enlarged_non_degenerate_triangles; - Build_Offset bo; + cgal_polyhedron enlarged_non_degenerate_triangles; + Build_Offset bo; bo.input = non_degenerate; enlarged_non_degenerate_triangles.delegate(bo); @@ -220,8 +220,8 @@ struct remove_thickness { Tree tree(faces(enlarged_non_degenerate_triangles).first, faces(enlarged_non_degenerate_triangles).second, enlarged_non_degenerate_triangles); - std::map face_normals; - boost::associative_property_map> face_normals_map(face_normals); + std::map face_normals; + boost::associative_property_map> face_normals_map(face_normals); CGAL::Polygon_mesh_processing::compute_face_normals(polyhedron, face_normals_map); for (auto& f : non_degenerate) { @@ -269,8 +269,8 @@ struct remove_thickness { std::wcout << "faces " << faces(polyhedron).size() << "long " << longitudinal.size() << "thin " << thin_sides.size() << "non-degen " << non_degenerate.size() << std::endl; - cgal_shape_t enlarged_indiv_triangles; - Build_Offset bo2; + cgal_polyhedron enlarged_indiv_triangles; + Build_Offset bo2; bo2.input = longitudinal; enlarged_indiv_triangles.delegate(bo2); @@ -301,9 +301,9 @@ struct remove_thickness { Kernel_::Vector_3 norm; Kernel_::Vector_3 accum; int count = 0; - CGAL::Face_around_target_circulator it(v->halfedge(), polyhedron), end(it); + CGAL::Face_around_target_circulator it(v->halfedge(), polyhedron), end(it); do { - cgal_shape_t::Facet_handle fh = (*it)->halfedge()->facet(); + cgal_polyhedron::Facet_handle fh = (*it)->halfedge()->facet(); auto jt = std::find(non_degenerate.begin(), non_degenerate.end(), fh); std::wcout << "non degen: " << (jt != non_degenerate.end()) << std::endl; @@ -408,8 +408,8 @@ struct remove_thickness { if (std::find(connected.begin(), connected.end(), f) == connected.end()) { connected_opposing = connected_faces(f, thin_sides_degenerate); - std::set longi(longitudinal.begin(), longitudinal.end()); - std::set both_sides(connected.begin(), connected.end()); + std::set longi(longitudinal.begin(), longitudinal.end()); + std::set both_sides(connected.begin(), connected.end()); both_sides.insert(connected_opposing.begin(), connected_opposing.end()); if (longi == both_sides) { @@ -422,7 +422,7 @@ struct remove_thickness { } } - Builder_With_Map b2; + Builder_With_Map b2; b2.input = connected; b2.mapping = new_points; @@ -432,11 +432,11 @@ struct remove_thickness { struct intersection_validator { - typedef std::list> > nefs_t; - typedef CGAL::Box_intersection_d::Box_with_handle_d Box; + typedef std::list> > nef_list; + typedef CGAL::Box_intersection_d::Box_with_handle_d Box; std::vector boxes; - nefs_t nefs; + nef_list nefs; double total_map_time = 0.; double total_geom_time = 0.; @@ -456,7 +456,7 @@ struct intersection_validator { settings.get().value = ifcopenshell::geom::settings::NATIVE; settings.get().value = true; - std::vector spaces_and_walls = { + std::vector spaces_and_walls = { ifcopenshell::geom::entity_filter(true, false, entities) }; @@ -491,16 +491,16 @@ struct intersection_validator { std::wcout << sss.c_str() << std::endl; for (auto& g : geom_object->geometry()) { - cgal_shape_t s = *std::static_pointer_cast(g.Shape()); + cgal_polyhedron s = *std::static_pointer_cast(g.Shape()); const auto& m = g.Placement()->ccomponents(); const auto& n = geom_object->transformation().data()->ccomponents(); - const cgal_placement_t trsf( + const cgal_placement trsf( m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(2, 0), m(2, 1), m(2, 2), m(2, 3)); - const cgal_placement_t trsf2( + const cgal_placement trsf2( n(0, 0), n(0, 1), n(0, 2), n(0, 3), n(1, 0), n(1, 1), n(1, 2), n(1, 3), n(2, 0), n(2, 1), n(2, 2), n(2, 3)); diff --git a/src/ifcgeom/abstract_mapping.h b/src/ifcgeom/abstract_mapping.h index fb095630f2..ca0e15e005 100644 --- a/src/ifcgeom/abstract_mapping.h +++ b/src/ifcgeom/abstract_mapping.h @@ -44,7 +44,7 @@ namespace geom { /// The filter function (free or member function) or function object (use boost::ref() to reference to it) /// should return true if the geometry for the product is wanted to be included in the output. /// http://www.boost.org/doc/libs/1_62_0/doc/html/function/tutorial.html - typedef boost::function filter_t; + typedef boost::function filter_function; class IFC_GEOM_API abstract_mapping { protected: @@ -58,7 +58,7 @@ namespace geom { virtual ~abstract_mapping() {} virtual ifcopenshell::geom::taxonomy::ptr map(const express::base&) = 0; - virtual void get_representations(std::vector& tasks, std::vector& filters) = 0; + virtual void get_representations(std::vector& tasks, std::vector& filters) = 0; virtual express::base get_decomposing_entity(const express::base& product, bool include_openings = true) = 0; virtual std::map get_layers(const express::base&) = 0; virtual std::vector find_openings(const express::base&) = 0; diff --git a/src/ifcgeom/filter.h b/src/ifcgeom/filter.h index e3fa34f52a..48d8fa234f 100644 --- a/src/ifcgeom/filter.h +++ b/src/ifcgeom/filter.h @@ -56,7 +56,7 @@ namespace ifcopenshell::geom { /// Optional description for the filtering criteria of this filter. std::string description; - bool match(const express::base& prod, const ifcopenshell::geom::filter_t& pred) const { + bool match(const express::base& prod, const ifcopenshell::geom::filter_function& pred) const { bool is_match = pred(prod); if (!is_match && traverse) { is_match = traverse_match(prod, pred); @@ -64,7 +64,7 @@ namespace ifcopenshell::geom { return is_match == include; } - bool traverse_match(const express::base& prod, const ifcopenshell::geom::filter_t& pred) const + bool traverse_match(const express::base& prod, const ifcopenshell::geom::filter_function& pred) const { express::base parent, current = prod; // @todo examine if this can indeed be static. For now usage is only @@ -171,7 +171,7 @@ namespace ifcopenshell::geom { }; struct layer_filter : public wildcard_filter { - typedef std::map layer_map_t; + typedef std::map layer_map; layer_filter() {} layer_filter(bool include, bool traverse, const std::set& patterns) @@ -181,7 +181,7 @@ namespace ifcopenshell::geom { // @todo ifcopenshell::geom::settings s; static auto mapping = ifcopenshell::geom::impl::mapping_implementations().construct(prod.file(), s); - layer_map_t layers = mapping->get_layers(prod); + layer_map layers = mapping->get_layers(prod); return std::find_if(layers.begin(), layers.end(), wildcards_match(values)) != layers.end(); } @@ -191,7 +191,7 @@ namespace ifcopenshell::geom { struct wildcards_match { wildcards_match(const std::set& patterns) : patterns(patterns) {} - bool operator()(const layer_map_t::value_type& layer_map_value) const { + bool operator()(const layer_map::value_type& layer_map_value) const { return wildcard_filter::match_values(patterns, layer_map_value.first); } diff --git a/src/ifcgeom/iterator.h b/src/ifcgeom/iterator.h index a5932a5684..d6306b7b35 100644 --- a/src/ifcgeom/iterator.h +++ b/src/ifcgeom/iterator.h @@ -125,7 +125,7 @@ namespace ifcopenshell::geom { ifcopenshell::geom::settings settings_; ifcopenshell::file* ifc_file; - std::vector filters_; + std::vector filters_; int num_threads_; std::string geometry_library_; ifcopenshell::logger& logger_; @@ -183,7 +183,7 @@ namespace ifcopenshell::geom { ifcopenshell::geom::taxonomy::direction3::ptr remove_offset_(); public: - iterator(std::unique_ptr&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, const std::vector& filters, int num_threads, ifcopenshell::logger& logger = ifcopenshell::logger::root()) + iterator(std::unique_ptr&& geometry_library, const ifcopenshell::geom::settings& settings, ifcopenshell::file* file, const std::vector& filters, int num_threads, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : settings_(settings) , ifc_file(file) , filters_(filters) @@ -280,8 +280,8 @@ namespace ifcopenshell::geom { ifcopenshell::file* file() const { return ifc_file; } - const std::vector& filters() const { return filters_; } - std::vector& filters() { return filters_; } + const std::vector& filters() const { return filters_; } + std::vector& filters() { return filters_; } const ifcopenshell::geom::taxonomy::point3& bounds_min() const { return bounds_min_; } const ifcopenshell::geom::taxonomy::point3& bounds_max() const { return bounds_max_; } diff --git a/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp b/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp index 1029f0baa8..d2b31c5695 100644 --- a/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp +++ b/src/ifcgeom/kernels/cgal/cgal_conversion_result.cpp @@ -31,15 +31,15 @@ typedef polyhedron::Facet_const_handle facet_const_handle; typedef polyhedron::Halfedge_around_facet_const_circulator halfedge_around_facet_circulator; namespace { - cgal_placement_t make_transform(const ifcopenshell::geom::taxonomy::matrix4& place) { + cgal_placement make_transform(const ifcopenshell::geom::taxonomy::matrix4& place) { const auto& m = place.ccomponents(); - return cgal_placement_t( + return cgal_placement( m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(2, 0), m(2, 1), m(2, 2), m(2, 3)); } - opaque_coordinate<3> opaque_point(const cgal_point_t& p) { + opaque_coordinate<3> opaque_point(const cgal_point& p) { return opaque_coordinate<3>( NumberType(p.cartesian(0)), NumberType(p.cartesian(1)), @@ -54,7 +54,7 @@ namespace { return ((-*minel) > *maxel) ? (-*minel) : *maxel; } - opaque_coordinate<3> opaque_axis(const cgal_vector_t& v) { + opaque_coordinate<3> opaque_axis(const cgal_vector& v) { auto maxval = max_abs3(v.x(), v.y(), v.z()); if (maxval == 0) { throw std::runtime_error("Invalid shape type"); @@ -66,7 +66,7 @@ namespace { ); } - opaque_coordinate<4> opaque_plane(const cgal_plane_t& p) { + opaque_coordinate<4> opaque_plane(const cgal_plane& p) { auto maxval = max_abs3(p.a(), p.b(), p.c()); if (maxval == 0) { throw std::runtime_error("Invalid shape type"); @@ -79,16 +79,16 @@ namespace { ); } - cgal_plane_t plane_from_opaque(const opaque_coordinate<4>& p) { + cgal_plane plane_from_opaque(const opaque_coordinate<4>& p) { #ifdef IFOPSH_SIMPLE_KERNEL - return cgal_plane_t( + return cgal_plane( p.get(0).to_double(), p.get(1).to_double(), p.get(2).to_double(), p.get(3).to_double() ); #else - return cgal_plane_t( + return cgal_plane( p.get(0).value_as(), p.get(1).value_as(), p.get(2).value_as(), @@ -104,7 +104,7 @@ namespace { }); } - void apply_normalized_plane_map(const plane_map& mp, std::list& planes) { + void apply_normalized_plane_map(const plane_map& mp, std::list& planes) { for (auto& plane : planes) { auto it = mp.find(normalized_plane_for_map(plane)); if (it != mp.end()) { @@ -113,10 +113,10 @@ namespace { } } - cgal_vector_t wire_normal(const cgal_wire_t& wire) { + cgal_vector wire_normal(const cgal_wire& wire) { typename kernel_::FT a(0), b(0), c(0); if (wire.size() < 3) { - return cgal_vector_t(a, b, c); + return cgal_vector(a, b, c); } for (std::size_t i = 0; i < wire.size(); ++i) { const auto& curr = wire[i]; @@ -125,10 +125,10 @@ namespace { b += (curr.z() - next.z()) * (curr.x() + next.x()); c += (curr.x() - next.x()) * (curr.y() + next.y()); } - return cgal_vector_t(a, b, c); + return cgal_vector(a, b, c); } - cgal_point_t wire_centroid(const cgal_wire_t& wire) { + cgal_point wire_centroid(const cgal_wire& wire) { if (wire.empty()) { throw std::runtime_error("Invalid shape type"); } @@ -139,10 +139,10 @@ namespace { } } kernel_::FT n(wire.size()); - return cgal_point_t(p[0] / n, p[1] / n, p[2] / n); + return cgal_point(p[0] / n, p[1] / n, p[2] / n); } - kernel_::FT wire_length(const cgal_wire_t& wire) { + kernel_::FT wire_length(const cgal_wire& wire) { kernel_::FT len(0); if (wire.size() < 2) { return len; @@ -156,7 +156,7 @@ namespace { return len; } - kernel_::FT wire_area(const cgal_wire_t& wire) { + kernel_::FT wire_area(const cgal_wire& wire) { kernel_::FT area(0); if (wire.size() < 3) { return area; @@ -170,8 +170,8 @@ namespace { return area; } - cgal_wire_t moved_wire(const cgal_wire_t& wire, const cgal_placement_t& trsf) { - cgal_wire_t result; + cgal_wire moved_wire(const cgal_wire& wire, const cgal_placement& trsf) { + cgal_wire result; result.reserve(wire.size()); for (const auto& point : wire) { result.push_back(point.transform(trsf)); @@ -179,12 +179,12 @@ namespace { return result; } - void write_off_point(std::stringstream& sstream, const cgal_point_t& point) { + void write_off_point(std::stringstream& sstream, const cgal_point& point) { sstream << "OFF\n1 0 0\n"; sstream << point.x() << " " << point.y() << " " << point.z() << "\n"; } - void write_off_wire(std::stringstream& sstream, const cgal_wire_t& wire) { + void write_off_wire(std::stringstream& sstream, const cgal_wire& wire) { const bool face = wire.size() >= 3; sstream << "OFF\n" << wire.size() << " " << (face ? 1 : 0) << " 0\n"; for (const auto& point : wire) { @@ -268,12 +268,12 @@ namespace { } } -ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_shape_t& shape, bool convex, ifcopenshell::logger& logger) { +ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_polyhedron& shape, bool convex, ifcopenshell::logger& logger) { shape_ = shape; convex_tag_ = convex; - auto& poly = std::get(*shape_); + auto& poly = std::get(*shape_); - std::set faces_to_remove; + std::set faces_to_remove; for (const auto& face : CGAL::faces(poly)) { auto V = newell(*face).to_vector(); @@ -315,30 +315,30 @@ ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_shape_t& shape, bool conve } } -ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_point_t& point, bool convex) { +ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_point& point, bool convex) { shape_ = point; convex_tag_ = convex; } -ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_wire_t& wire, bool convex) { +ifcopenshell::geom::cgal_shape::cgal_shape(const cgal_wire& wire, bool convex) { shape_ = wire; convex_tag_ = convex; } -const cgal_shape_t& ifcopenshell::geom::cgal_shape::poly() const { +const cgal_polyhedron& ifcopenshell::geom::cgal_shape::poly() const { #ifndef IFOPSH_SIMPLE_KERNEL to_poly(); #endif - if (!shape_ || !std::holds_alternative(*shape_)) { + if (!shape_ || !std::holds_alternative(*shape_)) { throw std::runtime_error("Invalid shape type"); } - return std::get(*shape_); + return std::get(*shape_); } #ifndef IFOPSH_SIMPLE_KERNEL void ifcopenshell::geom::cgal_shape::to_poly() const { if (!shape_) { - cgal_shape_t poly; + cgal_polyhedron poly; convert_to_polyhedron(*nef_, poly, std::numeric_limits::max()); if (poly.size_of_vertices() > 0) { // @todo why is this necessary? we have the mark of the volumes? @@ -372,15 +372,15 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se const bool all_triangles = std::all_of(base_shape.facets_begin(), base_shape.facets_end(), [](auto f) { return f.is_triangle(); }); const bool has_iden_transform = place.is_identity(); - std::unique_ptr shape_copy_holder; - cgal_shape_t* shape_to_use; + std::unique_ptr shape_copy_holder; + cgal_polyhedron* shape_to_use; if (!all_triangles || !has_iden_transform) { // A copy is made when triangulate_faces() is required or when vertex positions need be transformed - shape_copy_holder.reset(new cgal_shape_t(base_shape)); + shape_copy_holder.reset(new cgal_polyhedron(base_shape)); shape_to_use = shape_copy_holder.get(); } else { - shape_to_use = const_cast(&base_shape); + shape_to_use = const_cast(&base_shape); } const bool setting_use_original_edges = settings.get().get(); @@ -396,7 +396,7 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se const auto& m = place.ccomponents(); // @todo check - const cgal_placement_t trsf( + const cgal_placement trsf( m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(2, 0), m(2, 1), m(2, 2), m(2, 3)); @@ -455,8 +455,8 @@ void ifcopenshell::geom::cgal_shape::Triangulate(ifcopenshell::geom::settings se } } - // std::map vertex_normals; - // boost::associative_property_map> vertex_normals_map(vertex_normals); + // std::map vertex_normals; + // boost::associative_property_map> vertex_normals_map(vertex_normals); // Triangulate the shape and compute the normals std::map face_normals; @@ -601,7 +601,7 @@ void ifcopenshell::geom::cgal_shape::Serialize(const ifcopenshell::geom::taxonom } write_off_wire(sstream, w); } else { - cgal_shape_t s = poly(); + cgal_polyhedron s = poly(); if (!place.is_identity()) { const auto trsf = make_transform(place); @@ -794,7 +794,7 @@ opaque_coordinate<3> ifcopenshell::geom::cgal_shape::axis() auto shp = poly(); if (shp.size_of_facets() == 1) { auto pl = facet_plane_equation()(*shp.facets_begin()); - return opaque_axis(cgal_vector_t(pl.a(), pl.b(), pl.c())); + return opaque_axis(cgal_vector(pl.a(), pl.b(), pl.c())); } else { throw std::runtime_error("Invalid shape type"); } @@ -804,7 +804,7 @@ opaque_coordinate<4> ifcopenshell::geom::cgal_shape::plane_equation() { if (is_wire() && wire().size() >= 3) { auto normal = wire_normal(wire()); - return opaque_plane(cgal_plane_t(wire().front(), CGAL::Direction_3(normal))); + return opaque_plane(cgal_plane(wire().front(), CGAL::Direction_3(normal))); } auto shp = poly(); if (shp.size_of_facets() == 1) { @@ -891,15 +891,15 @@ std::vector ifcopenshell::geom::cgal_shape::edges() if (is_wire()) { const auto& w = wire(); for (std::size_t i = 1; i < w.size(); ++i) { - result.push_back(new cgal_shape(cgal_wire_t{ w[i - 1], w[i] })); + result.push_back(new cgal_shape(cgal_wire{ w[i - 1], w[i] })); } if (w.size() > 2) { - result.push_back(new cgal_shape(cgal_wire_t{ w.back(), w.front() })); + result.push_back(new cgal_shape(cgal_wire{ w.back(), w.front() })); } return result; } for (auto ed : poly().edges()) { - result.push_back(new cgal_shape(cgal_wire_t{ ed.vertex()->point(), ed.opposite()->vertex()->point() })); + result.push_back(new cgal_shape(cgal_wire{ ed.vertex()->point(), ed.opposite()->vertex()->point() })); } return result; } @@ -917,7 +917,7 @@ std::vector ifcopenshell::geom::cgal_shape::facets() return result; } for (auto face : faces(poly())) { - std::vector ps; + std::vector ps; auto it = face->facet_begin(); do { @@ -959,7 +959,7 @@ conversion_result_shape* ifcopenshell::geom::cgal_shape::intersect(conversion_re namespace { template void concatenate_polyhedra(polyhedron_type& p1, const polyhedron_type& p2) { - std::vector points1, points2; + std::vector points1, points2; std::vector> faces1, faces2; // Extract soups @@ -1012,7 +1012,7 @@ conversion_result_shape* ifcopenshell::geom::cgal_shape::moved(ifcopenshell::geo return new cgal_shape(moved_wire(wire(), trsf), convex_tag_); } - cgal_shape_t s = poly(); + cgal_polyhedron s = poly(); for (auto &vertex : s.vertex_handles()) { vertex->point() = vertex->point().transform(trsf); } diff --git a/src/ifcgeom/kernels/cgal/cgal_conversion_result.h b/src/ifcgeom/kernels/cgal/cgal_conversion_result.h index 37bdc8b60e..d523236617 100644 --- a/src/ifcgeom/kernels/cgal/cgal_conversion_result.h +++ b/src/ifcgeom/kernels/cgal/cgal_conversion_result.h @@ -47,17 +47,17 @@ #define kernel_ Simplekernel_ #define cgal_shape SimpleCgalShape -#define cgal_placement_t cgal_simple_placement_t -#define cgal_point_t cgal_simple_point_t -#define cgal_direction_t cgal_simple_direction_t -#define cgal_vector_t cgal_simple_vector_t -#define cgal_plane_t cgal_simple_plane_t -#define cgal_curve_t cgal_simple_curve_t -#define cgal_wire_t cgal_simple_wire_t -#define cgal_face_t cgal_simple_face_t -#define cgal_shape_t cgal_simple_shape_t -#define cgal_vertex_descriptor_t cgal_simple_vertex_descriptor_t -#define cgal_face_descriptor_t cgal_simple_face_descriptor_t +#define cgal_placement cgal_simple_placement +#define cgal_point cgal_simple_point +#define cgal_direction cgal_simple_direction +#define cgal_vector cgal_simple_vector +#define cgal_plane cgal_simple_plane +#define cgal_curve cgal_simple_curve +#define cgal_wire cgal_simple_wire +#define cgal_face cgal_simple_face +#define cgal_polyhedron cgal_simple_polyhedron +#define cgal_vertex_descriptor cgal_simple_vertex_descriptor +#define cgal_face_descriptor cgal_simple_face_descriptor typedef CGAL::Exact_predicates_inexact_constructions_kernel kernel_; @@ -69,24 +69,24 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel kernel_; #endif -typedef kernel_::Aff_transformation_3 cgal_placement_t; -typedef kernel_::Point_3 cgal_point_t; -typedef kernel_::Vector_3 cgal_direction_t; -typedef kernel_::Vector_3 cgal_vector_t; -typedef kernel_::Plane_3 cgal_plane_t; -typedef std::vector cgal_curve_t; -typedef std::vector cgal_wire_t; +typedef kernel_::Aff_transformation_3 cgal_placement; +typedef kernel_::Point_3 cgal_point; +typedef kernel_::Vector_3 cgal_direction; +typedef kernel_::Vector_3 cgal_vector; +typedef kernel_::Plane_3 cgal_plane; +typedef std::vector cgal_curve; +typedef std::vector cgal_wire; namespace { - struct cgal_face_t { - cgal_wire_t outer; - std::vector inner; + struct cgal_face { + cgal_wire outer; + std::vector inner; }; } -typedef CGAL::Polyhedron_3 cgal_shape_t; -typedef boost::graph_traits>::vertex_descriptor cgal_vertex_descriptor_t; -typedef boost::graph_traits>::face_descriptor cgal_face_descriptor_t; +typedef CGAL::Polyhedron_3 cgal_polyhedron; +typedef boost::graph_traits>::vertex_descriptor cgal_vertex_descriptor; +typedef boost::graph_traits>::face_descriptor cgal_face_descriptor; #include "../../../ifcgeom/conversion_result.h" @@ -179,18 +179,18 @@ namespace ifcopenshell { namespace geom { class IFC_GEOMLIBRARY_API cgal_shape : public ifcopenshell::geom::conversion_result_shape { private: - typedef std::variant cgal_shape_storage_t; + typedef std::variant cgal_shape_storage; bool convex_tag_ = false; - mutable std::optional shape_; + mutable std::optional shape_; #ifndef IFOPSH_SIMPLE_KERNEL mutable std::optional> nef_; #endif public: - cgal_shape(const cgal_shape_t& shape, bool convex = false, ifcopenshell::logger& logger = ifcopenshell::logger::root()); - cgal_shape(const cgal_point_t& point, bool convex = false); - cgal_shape(const cgal_wire_t& wire, bool convex = false); + cgal_shape(const cgal_polyhedron& shape, bool convex = false, ifcopenshell::logger& logger = ifcopenshell::logger::root()); + cgal_shape(const cgal_point& point, bool convex = false); + cgal_shape(const cgal_wire& wire, bool convex = false); #ifndef IFOPSH_SIMPLE_KERNEL cgal_shape(const CGAL::Nef_polyhedron_3& shape, bool convex = false) { @@ -218,13 +218,13 @@ namespace ifcopenshell { namespace geom { return "cgal"; #endif } - operator const cgal_shape_t& () const { return poly(); } - const cgal_shape_t& poly() const; - bool is_poly() const { return shape_ && std::holds_alternative(*shape_); } - bool is_point() const { return shape_ && std::holds_alternative(*shape_); } - bool is_wire() const { return shape_ && std::holds_alternative(*shape_); } - const cgal_point_t& point() const { return std::get(*shape_); } - const cgal_wire_t& wire() const { return std::get(*shape_); } + operator const cgal_polyhedron& () const { return poly(); } + const cgal_polyhedron& poly() const; + bool is_poly() const { return shape_ && std::holds_alternative(*shape_); } + bool is_point() const { return shape_ && std::holds_alternative(*shape_); } + bool is_wire() const { return shape_ && std::holds_alternative(*shape_); } + const cgal_point& point() const { return std::get(*shape_); } + const cgal_wire& wire() const { return std::get(*shape_); } virtual void Triangulate(ifcopenshell::geom::settings settings, const ifcopenshell::geom::taxonomy::matrix4& place, ifcopenshell::geom::Representation::triangulation* t, int item_id, int surface_style_id, ifcopenshell::logger& logger = ifcopenshell::logger::root()) const; virtual void Serialize(const ifcopenshell::geom::taxonomy::matrix4& place, std::string&) const; diff --git a/src/ifcgeom/kernels/cgal/cgal_kernel.cpp b/src/ifcgeom/kernels/cgal/cgal_kernel.cpp index 402558ee66..b699641b1a 100644 --- a/src/ifcgeom/kernels/cgal/cgal_kernel.cpp +++ b/src/ifcgeom/kernels/cgal/cgal_kernel.cpp @@ -45,16 +45,16 @@ using ifcopenshell::logger; namespace { struct polyhedron_builder : public CGAL::Modifier_base::HalfedgeDS> { private: - std::list *face_list; + std::list *face_list; logger& logger_; public: - std::optional from_soup; - polyhedron_builder(std::list *face_list, logger& logger = ifcopenshell::logger::root()); + std::optional from_soup; + polyhedron_builder(std::list *face_list, logger& logger = ifcopenshell::logger::root()); void operator()(CGAL::Polyhedron_3::HalfedgeDS &hds); }; } -CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_polyhedron(std::list &face_list, bool stitch_borders, logger& logger) { +CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_polyhedron(std::list &face_list, bool stitch_borders, logger& logger) { // Naive creation CGAL::Polyhedron_3 polyhedron; @@ -107,7 +107,7 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_polyhedron(const C } } -CGAL::Nef_polyhedron_3 ifcopenshell::geom::utils::create_nef_polyhedron(std::list &face_list, logger& logger) { +CGAL::Nef_polyhedron_3 ifcopenshell::geom::utils::create_nef_polyhedron(std::list &face_list, logger& logger) { CGAL::Polyhedron_3 polyhedron = create_polyhedron(face_list, true, logger); if (polyhedron.is_closed()) { try { @@ -159,7 +159,7 @@ CGAL::Nef_polyhedron_3 ifcopenshell::geom::utils::create_nef_polyhedron } #endif -bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) { +bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_polyhedron& shape) { for (auto& f : l->children) { if (f->basis && f->basis->kind() != taxonomy::PLANE) { logger().error("UNS", 3, "CGAL Kernel: Non-planar faces not supported at the moment"); @@ -207,7 +207,7 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) { } } - std::list face_list; + std::list face_list; for (auto& f : l->children) { bool success = false; try { @@ -234,7 +234,7 @@ bool cgal_kernel::convert(const taxonomy::shell::ptr l, cgal_shape_t& shape) { return shape.size_of_facets(); } -bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list& result) { +bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list& result) { int num_outer_bounds = 0; for (auto& bound : face->children) { @@ -246,14 +246,14 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list return false; } - cgal_face_t mf; + cgal_face mf; for (auto& bound : face->children) { const bool is_interior = !(bound->external.value_or(false) || face->children.size() == 1); // single face bound is always external... even if not marked as such - cgal_wire_t wire; + cgal_wire wire; if (!convert(bound, wire)) { logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 81, "Failed to process face boundary loop", bound->instance); return false; @@ -267,7 +267,7 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list if (num_outer_bounds > 1) { result.push_back(mf); - mf = cgal_face_t{}; + mf = cgal_face{}; } } @@ -286,16 +286,16 @@ bool cgal_kernel::convert(const taxonomy::face::ptr face, std::list namespace { // @todo obsolete? /* - bool convert_curve(cgal_kernel* kernel, const taxonomy::ptr curve, cgal_wire_t& builder) { + bool convert_curve(cgal_kernel* kernel, const taxonomy::ptr curve, cgal_wire& builder) { if (auto e = taxonomy::dcast(curve)) { if (true || e->basis == nullptr) { if (builder.empty()) { const auto& p = std::get(e->start); - cgal_point_t pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2)); + cgal_point pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2)); builder.push_back(pnt); } const auto& p = std::get(e->end); - cgal_point_t pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2)); + cgal_point pnt(p->ccomponents()(0), p->ccomponents()(1), p->ccomponents()(2)); builder.push_back(pnt); } else if (e->basis->kind() == taxonomy::CIRCLE) { // @todo @@ -552,7 +552,7 @@ namespace { typedef CGAL::Box_intersection_d::Box_with_handle_d box; namespace { - void loop_to_segments(const cgal_wire_t& wire, std::vector& segments) { + void loop_to_segments(const cgal_wire& wire, std::vector& segments) { for (int i = 0; i < wire.size(); ++i) { int j = (i + 1) % wire.size(); segments.emplace_back(wire[i], wire[j]); @@ -604,7 +604,7 @@ namespace { } namespace { - cgal_direction_t newell(const std::vector & loop) { + cgal_direction newell(const std::vector & loop) { kernel_::FT a(0.0), b(0.0), c(0.0); for (size_t i = 0; i < loop.size(); ++i) { auto & curr = loop[i]; @@ -613,7 +613,7 @@ namespace { b += (curr.z() - next.z()) * (curr.x() + next.x()); c += (curr.x() - next.x()) * (curr.y() + next.y()); } - return cgal_direction_t(a, b, c); + return cgal_direction(a, b, c); } } @@ -628,7 +628,7 @@ namespace { return polygon; } - CGAL::Polygon_2 wire_to_polygon_2(const cgal_wire_t& w) { + CGAL::Polygon_2 wire_to_polygon_2(const cgal_wire& w) { CGAL::Polygon_2 polygon; for (auto& p : w) { CGAL::Point_2 pnt(p.cartesian(0), p.cartesian(1)); @@ -637,8 +637,8 @@ namespace { return polygon; } - cgal_face_t wire_to_face(const cgal_wire_t& w) { - cgal_face_t f; + cgal_face wire_to_face(const cgal_wire& w) { + cgal_face f; f.outer = w; return f; } @@ -651,10 +651,10 @@ namespace { polygon_2_to_wire(const CGAL::Aff_transformation_3& t) : t_(t) {} - cgal_wire_t operator()(const CGAL::Polygon_2& p) { - cgal_wire_t w; + cgal_wire operator()(const CGAL::Polygon_2& p) { + cgal_wire w; for (auto it = p.vertices_begin(); it != p.vertices_end(); ++it) { - cgal_point_t P(it->cartesian(0), it->cartesian(1), 0); + cgal_point P(it->cartesian(0), it->cartesian(1), 0); P = t_.transform(P); w.push_back(P); } @@ -662,7 +662,7 @@ namespace { } }; - void transform_in_place(cgal_wire_t& w, const CGAL::Aff_transformation_3& t) { + void transform_in_place(cgal_wire& w, const CGAL::Aff_transformation_3& t) { for (auto& p : w) { p = p.transform(t); } @@ -670,7 +670,7 @@ namespace { } namespace { - void face_to_poly_with_holes(const cgal_face_t& face, CGAL::Polygon_with_holes_2& pwh, CGAL::Aff_transformation_3& place) { + void face_to_poly_with_holes(const cgal_face& face, CGAL::Polygon_with_holes_2& pwh, CGAL::Aff_transformation_3& place) { // static kernel_::Vector_3 Z(0, 0, 1); // static @@ -714,7 +714,7 @@ namespace { } -bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) { +bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire& result) { // @todo only implement polygonal loops std::vector points; @@ -748,9 +748,9 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) { } // Parse and store the points in a sequence - cgal_wire_t polygon = std::vector(); + cgal_wire polygon = std::vector(); for (auto& p : points) { - cgal_point_t pnt(p.ccomponents()(0), p.ccomponents()(1), p.ccomponents()(2)); + cgal_point pnt(p.ccomponents()(0), p.ccomponents()(1), p.ccomponents()(2)); polygon.push_back(pnt); } @@ -772,7 +772,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) { } { - std::set visited_points; + std::set visited_points; for (auto& p : polygon) { if (visited_points.find(p) != visited_points.end()) { logger().error("GEO", 85, "Skipping self-intersecting loop", loop->instance); @@ -841,7 +841,7 @@ bool cgal_kernel::convert(const taxonomy::loop::ptr loop, cgal_wire_t& result) { bool cgal_kernel::convert_impl(const taxonomy::shell::ptr shell, conversion_results& results) { - cgal_shape_t shape; + cgal_polyhedron shape; if (!convert(shell, shape)) { return false; } @@ -862,7 +862,7 @@ bool cgal_kernel::convert_impl(const taxonomy::solid::ptr solid, conversion_resu logger().error("UNS", 5, "Multiple shells in solid not supported at the moment"); return false; } - cgal_shape_t shape; + cgal_polyhedron shape; if (solid->children.empty()) { return false; } @@ -883,16 +883,16 @@ bool cgal_kernel::convert_impl(const taxonomy::solid::ptr solid, conversion_resu } namespace { - bool convert_placement(const Eigen::Matrix4d& m, cgal_placement_t& trsf) { + bool convert_placement(const Eigen::Matrix4d& m, cgal_placement& trsf) { // @todo check - trsf = cgal_placement_t( + trsf = cgal_placement( m(0, 0), m(0, 1), m(0, 2), m(0, 3), m(1, 0), m(1, 1), m(1, 2), m(1, 3), m(2, 0), m(2, 1), m(2, 2), m(2, 3)); return true; } - bool convert_placement(ifcopenshell::geom::taxonomy::matrix4::ptr place, cgal_placement_t& trsf) { + bool convert_placement(ifcopenshell::geom::taxonomy::matrix4::ptr place, cgal_placement& trsf) { return convert_placement(place->ccomponents(), trsf); } } @@ -905,17 +905,17 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b CGAL::Nef_nary_union_3> second_operand_collector; size_t second_operand_collector_size = 0; - std::list>> operands; + std::list>> operands; std::list second_operand_instances; - std::list first_operands, second_operands; + std::list first_operands, second_operands; std::list> first_operands_nef, second_operands_nef; for (auto& shp : entity_shapes) { - cgal_shape_t entity_shape = *std::static_pointer_cast(shp.Shape()); + cgal_polyhedron entity_shape = *std::static_pointer_cast(shp.Shape()); const auto& m = shp.Placement()->ccomponents(); if (!m.isIdentity()) { - cgal_placement_t trsf; + cgal_placement trsf; convert_placement(m, trsf); for (auto &vertex : vertices(entity_shape)) { vertex->point() = vertex->point().transform(trsf); @@ -943,13 +943,13 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b abstract_kernel::convert(op.first, opening_shapes); for (unsigned int i = 0; i < opening_shapes.size(); ++i) { - cgal_shape_t entity_shape_unlocated = *std::static_pointer_cast(opening_shapes[i].Shape()); - cgal_shape_t entity_shape(entity_shape_unlocated); + cgal_polyhedron entity_shape_unlocated = *std::static_pointer_cast(opening_shapes[i].Shape()); + cgal_polyhedron entity_shape(entity_shape_unlocated); auto gtrsf = opening_shapes[i].Placement(); // @todo check Eigen::Matrix4d m = opening_trsf.ccomponents() * gtrsf->ccomponents(); if (!m.isIdentity()) { - cgal_placement_t trsf; + cgal_placement trsf; convert_placement(m, trsf); for (auto &vertex : vertices(entity_shape)) { vertex->point() = vertex->point().transform(trsf); @@ -999,7 +999,7 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b } a -= opening_union; - cgal_shape_t a_poly; + cgal_polyhedron a_poly; try { a.convert_to_polyhedron(a_poly); @@ -1019,7 +1019,7 @@ bool ifcopenshell::geom::kernels::cgal_kernel::convert_openings(const express::b bool cgal_kernel::convert_impl(const taxonomy::extrusion::ptr extrusion, conversion_results& results) { - cgal_shape_t shape; + cgal_polyhedron shape; if (!convert(extrusion, shape)) { return false; } @@ -1032,11 +1032,11 @@ bool cgal_kernel::convert_impl(const taxonomy::extrusion::ptr extrusion, convers return true; } -bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_shape_t& shape) { +bool cgal_kernel::process_extrusion(const cgal_face& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_polyhedron& shape) { bool has_inner_bounds = !bottom_face.inner.empty(); - std::list faces_to_extrude; + std::list faces_to_extrude; std::set> internal_edges; // CGAL::Cartesian_converter> C; @@ -1097,10 +1097,10 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di faces_to_extrude.push_front(bottom_face.outer); } - std::list face_list; + std::list face_list; auto& fs = direction->ccomponents(); - cgal_direction_t dir(fs(0), fs(1), fs(2)); + cgal_direction dir(fs(0), fs(1), fs(2)); int wi = 0; for (auto& w : faces_to_extrude) { @@ -1109,13 +1109,13 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di const bool reverse = fnorm * dir > 0; if (reverse) { - cgal_face_t bottom_face; + cgal_face bottom_face; for (auto vertex = w.rbegin(); vertex != w.rend(); ++vertex) { bottom_face.outer.push_back(*vertex); } face_list.push_back(bottom_face); } else { - face_list.push_back(cgal_face_t{ w }); + face_list.push_back(cgal_face{ w }); } int si = 0; @@ -1131,7 +1131,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di next_vertex = w.begin(); } - cgal_face_t side_face; + cgal_face side_face; if (reverse) { side_face.outer.push_back(*current_vertex + height * dir); side_face.outer.push_back(*next_vertex + height * dir); @@ -1146,7 +1146,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di face_list.push_back(side_face); } - cgal_face_t top_face; + cgal_face top_face; if (reverse) { for (auto vertex = w.begin(); vertex != w.end(); ++vertex) { top_face.outer.push_back(*vertex + height * dir); @@ -1173,7 +1173,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di // std::cout << "Inner wire" << std::endl; face_list.clear(); - cgal_face_t hole_bottom_face; + cgal_face hole_bottom_face; hole_bottom_face.outer = inner; remove_duplicate_points_from_loop(hole_bottom_face.outer); face_list.push_back(hole_bottom_face); @@ -1185,7 +1185,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di ++next_vertex; if (next_vertex == inner.end()) { next_vertex = inner.begin(); - } cgal_face_t hole_side_face; + } cgal_face hole_side_face; hole_side_face.outer.push_back(*next_vertex); hole_side_face.outer.push_back(*current_vertex); hole_side_face.outer.push_back(*current_vertex + height * dir); @@ -1193,7 +1193,7 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di face_list.push_back(hole_side_face); } - cgal_face_t hole_top_face; + cgal_face hole_top_face; for (std::vector::const_reverse_iterator vertex = inner.rbegin(); vertex != inner.rend(); ++vertex) { @@ -1226,14 +1226,14 @@ bool cgal_kernel::process_extrusion(const cgal_face_t& bottom_face, taxonomy::di */ } -bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t &shape) { +bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_polyhedron &shape) { const double& height = extrusion->depth; if (height < settings_.get().get()) { logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 89, "Non-positive extrusion height encountered for:", extrusion->instance); return false; } - std::list bottom_face; + std::list bottom_face; if (!convert(taxonomy::cast(taxonomy::cast(extrusion->basis)), bottom_face) || bottom_face.size() != 1) { return false; } @@ -1242,15 +1242,15 @@ bool cgal_kernel::convert(const taxonomy::extrusion::ptr extrusion, cgal_shape_t } CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_cube(double d) { - cgal_face_t bottom_face; + cgal_face bottom_face; bottom_face.outer.push_back(kernel_::Point_3(-d, -d, -d)); bottom_face.outer.push_back(kernel_::Point_3(+d, -d, -d)); bottom_face.outer.push_back(kernel_::Point_3(+d, +d, -d)); bottom_face.outer.push_back(kernel_::Point_3(-d, +d, -d)); - cgal_direction_t dir(0, 0, 2 * d); + cgal_direction dir(0, 0, 2 * d); - std::list face_list = { bottom_face }; + std::list face_list = { bottom_face }; for (std::vector::const_iterator current_vertex = bottom_face.outer.begin(); current_vertex != bottom_face.outer.end(); @@ -1262,7 +1262,7 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_cube(double d) { next_vertex = bottom_face.outer.begin(); } - cgal_face_t side_face; + cgal_face side_face; side_face.outer.push_back(*next_vertex); side_face.outer.push_back(*current_vertex); @@ -1272,7 +1272,7 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_cube(double d) { face_list.push_back(side_face); } - cgal_face_t top_face; + cgal_face top_face; for (std::vector::const_reverse_iterator vertex = bottom_face.outer.rbegin(); vertex != bottom_face.outer.rend(); @@ -1287,7 +1287,7 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_cube(double d) { CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper) { - cgal_face_t bottom_face; + cgal_face bottom_face; auto a0 = lower.cartesian(0); auto a1 = lower.cartesian(1); @@ -1302,9 +1302,9 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_cube(const kernel_ bottom_face.outer.push_back(kernel_::Point_3(b0, b1, a2)); bottom_face.outer.push_back(kernel_::Point_3(a0, b1, a2)); - cgal_direction_t dir(0, 0, b2 - a2); + cgal_direction dir(0, 0, b2 - a2); - std::list face_list = { bottom_face }; + std::list face_list = { bottom_face }; for (std::vector::const_iterator current_vertex = bottom_face.outer.begin(); current_vertex != bottom_face.outer.end(); @@ -1316,7 +1316,7 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_cube(const kernel_ next_vertex = bottom_face.outer.begin(); } - cgal_face_t side_face; + cgal_face side_face; side_face.outer.push_back(*next_vertex); side_face.outer.push_back(*current_vertex); @@ -1326,7 +1326,7 @@ CGAL::Polyhedron_3 ifcopenshell::geom::utils::create_cube(const kernel_ face_list.push_back(side_face); } - cgal_face_t top_face; + cgal_face top_face; for (std::vector::const_reverse_iterator vertex = bottom_face.outer.rbegin(); vertex != bottom_face.outer.rend(); @@ -1361,8 +1361,8 @@ bool cgal_kernel::thin_solid(const CGAL::Nef_polyhedron_3& a, CGAL::Nef return true; } -bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, const std::list& first_operands, const std::list>& first_operands_nef, const std::list& all_operand_planes, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3& result, boolean_operand_preprocess proc) { - cgal_shape_t shape = shape_const; +bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, const std::list& first_operands, const std::list>& first_operands_nef, const std::list& all_operand_planes, const cgal_polyhedron& shape_const, CGAL::Nef_polyhedron_3& result, boolean_operand_preprocess proc) { + cgal_polyhedron shape = shape_const; if (!shape.is_valid()) { logger().message(ifcopenshell::logger::LOG_ERROR, "GEO", 90, "Conversion to Nef will fail. Invalid geometry:", log_reference); @@ -1397,7 +1397,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, if (proc == PP_SNAP_POINTS_TO_FIRST_OPERAND) { static int NN = 0; - typedef CGAL::AABB_face_graph_triangle_primitive aabb_face_graph_primitive; + typedef CGAL::AABB_face_graph_triangle_primitive aabb_face_graph_primitive; #if CGAL_VERSION_NR >= 1060000000 typedef CGAL::AABB_traits_3 aabb_face_graph_traits; #else @@ -1506,7 +1506,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, int j = 0; for (auto& a : x->operands_) { auto A = a->evaluate(); - cgal_shape_t p; + cgal_polyhedron p; A.convert_to_Polyhedron(p); std::string fn = "debug-orig-" + std::to_string(i) + "-" + std::to_string(j++) + ".off"; std::ofstream(fn.c_str()) << p; @@ -1519,7 +1519,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, int j = 0; for (auto& a : x->operands_) { auto A = a->evaluate(); - cgal_shape_t p; + cgal_polyhedron p; A.convert_to_Polyhedron(p); std::string fn = "debug-mapped-" + std::to_string(i) + "-" + std::to_string(j++) + ".off"; std::ofstream(fn.c_str()) << p; @@ -1559,7 +1559,7 @@ bool cgal_kernel::preprocess_boolean_operand(const express::base& log_reference, */ try { - cgal_shape_t convert_back; + cgal_polyhedron convert_back; result.convert_to_polyhedron(convert_back); } catch (CGAL::Failure_exception& e) { logger().notice("GEO", 99, e); @@ -1655,18 +1655,18 @@ bool cgal_kernel::process_as_2d_polygon(const taxonomy::boolean_result::ptr br, return false; } - std::vector wires; + std::vector wires; try { std::transform(extrusions.begin(), extrusions.end(), std::back_inserter(wires), [this](extrusion_pair& p) { auto ex = p.second; auto ex_basis = taxonomy::cast(ex->basis); if (ex_basis->children.size() == 1 && ex_basis->children[0]->kind() == taxonomy::LOOP) { auto l = (taxonomy::loop::ptr) ex_basis->children[0]; - cgal_wire_t w; - cgal_placement_t trsf; + cgal_wire w; + cgal_placement trsf; convert_placement(ex->matrix, trsf); - cgal_placement_t trsf2; + cgal_placement trsf2; if (p.first) { convert_placement(*p.first, trsf2); } @@ -1717,7 +1717,7 @@ bool cgal_kernel::process_as_2d_polygon(const taxonomy::boolean_result::ptr br, #include namespace { - bool orthogonal_edge_length(const cgal_shape_t& shape, const cgal_direction_t& face_normal, std::pair& distances) { + bool orthogonal_edge_length(const cgal_polyhedron& shape, const cgal_direction& face_normal, std::pair& distances) { static double inf = 1.e9; // std::numeric_limits::infinity(); std::vector lengths; @@ -1767,13 +1767,13 @@ namespace { } } -bool cgal_kernel::process_as_2d_polygon(const std::list>>& operands, std::list>& loops, double& z0, double& z1) { +bool cgal_kernel::process_as_2d_polygon(const std::list>>& operands, std::list>& loops, double& z0, double& z1) { if (operands.front().size() != 1) { return false; } auto& first_op = operands.front().front().second; - cgal_shape_t::Facet_handle largest_face; + cgal_polyhedron::Facet_handle largest_face; kernel_::FT largest_area = 0; for (auto& f : faces(first_op)) { @@ -1785,7 +1785,7 @@ bool cgal_kernel::process_as_2d_polygon(const std::list f_points; + std::vector f_points; CGAL::Polyhedron_3::Halfedge_around_facet_const_circulator current_halfedge = largest_face->facet_begin(); do { f_points.push_back(current_halfedge->vertex()->point()); @@ -1831,7 +1831,7 @@ namespace { void project_onto_plane(const taxonomy::plane& p, It i, It j, Fn fn) { auto mi = p.matrix->ccomponents().inverse(); Eigen::Vector4d v; - std::for_each(i, j, [&mi, &v, &fn](const cgal_shape_t& shp) { + std::for_each(i, j, [&mi, &v, &fn](const cgal_polyhedron& shp) { for (auto& vv : vertices(shp)) { auto& p = vv->point(); v = Eigen::Vector4d(CGAL::to_double(p.cartesian(0)), @@ -1911,7 +1911,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio } std::transform(decom_polies.begin(), decom_polies.end(), std::back_inserter(results), [this, &br, &z0, &z1, &first_item_style](const CGAL::Polygon_2& p2) { - cgal_face_t f; + cgal_face f; std::transform( p2.vertices_begin(), p2.vertices_end(), @@ -1921,13 +1921,13 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio } ); - cgal_shape_t shp; + cgal_polyhedron shp; auto d = taxonomy::make(0, 0, 1); process_extrusion(f, d, z1 - z0, shp); for (auto it = shp.vertices_begin(); it != shp.vertices_end(); ++it) { auto p = it->point(); - it->point() = cgal_point_t(p.cartesian(0), p.cartesian(1), p.cartesian(2) + z0); + it->point() = cgal_point(p.cartesian(0), p.cartesian(1), p.cartesian(2) + z0); } return conversion_result( @@ -1956,7 +1956,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio taxonomy::style::ptr first_item_style = nullptr; - std::list>> operands; + std::list>> operands; for (auto& c : br->children) { // abstract_kernel::convert(c, results); @@ -2005,15 +2005,15 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio kernel_::Point_3 lower(uvw_min[0] - eps, uvw_min[1] - eps, wmin); kernel_::Point_3 upper(uvw_max[0] + eps, uvw_max[1] + eps, wmax); - cgal_shape_t box = utils::create_cube(lower, upper); - cgal_placement_t pl; + cgal_polyhedron box = utils::create_cube(lower, upper); + cgal_placement pl; convert_placement(p.matrix, pl); for (auto& v : vertices(box)) { v->point() = v->point().transform(pl); } if (!face->children.empty()) { - std::list fs; + std::list fs; if (!convert(face, fs) || fs.size() != 1) { return false; } @@ -2030,7 +2030,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio // static auto z = taxonomy::make(0, 0, 1); - cgal_shape_t poly; + cgal_polyhedron poly; process_extrusion(fs.front(), z, 200, poly); for (auto& v : vertices(poly)) { v->point() = kernel_::Point_3( @@ -2039,7 +2039,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio v->point().cartesian(2) - 100 ); }; - cgal_placement_t trsf; + cgal_placement trsf; convert_placement(face->matrix, trsf); for (auto& v : vertices(poly)) { v->point() = v->point().transform(trsf); @@ -2047,7 +2047,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio CGAL::Nef_polyhedron_3 poly_nef(poly); CGAL::Nef_polyhedron_3 box_nef(box); auto intersection = poly_nef * box_nef; - cgal_shape_t intersection_poly; + cgal_polyhedron intersection_poly; intersection.convert_to_polyhedron(intersection_poly); operands.back().second.push_back(intersection_poly); } else { @@ -2068,10 +2068,10 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio } for (auto it = cr.begin(); it != cr.end(); ++it) { - cgal_shape_t entity_shape_unlocated = *std::static_pointer_cast(it->Shape()); - cgal_shape_t entity_shape(entity_shape_unlocated); + cgal_polyhedron entity_shape_unlocated = *std::static_pointer_cast(it->Shape()); + cgal_polyhedron entity_shape(entity_shape_unlocated); if (!it->Placement()->is_identity()) { - cgal_placement_t trsf; + cgal_placement trsf; convert_placement(it->Placement(), trsf); for (auto &vertex : vertices(entity_shape)) { vertex->point() = vertex->point().transform(trsf); @@ -2121,7 +2121,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio first = true; - std::list ops; + std::list ops; std::list> nefops; std::list all_operand_planes; @@ -2162,7 +2162,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio a -= second_operand_collector.get_union(); } - cgal_shape_t a_poly; + cgal_polyhedron a_poly; // CGAL::Nef_polyhedron_3 b; // thin_solid(a, b); @@ -2185,7 +2185,7 @@ bool cgal_kernel::convert_impl(const taxonomy::boolean_result::ptr br, conversio #endif } -polyhedron_builder::polyhedron_builder(std::list* face_list, logger& logger) : face_list(face_list), logger_(logger) { +polyhedron_builder::polyhedron_builder(std::list* face_list, logger& logger) : face_list(face_list), logger_(logger) { } #include diff --git a/src/ifcgeom/kernels/cgal/cgal_kernel.h b/src/ifcgeom/kernels/cgal/cgal_kernel.h index a1ea2bf1df..e8c2a98886 100644 --- a/src/ifcgeom/kernels/cgal/cgal_kernel.h +++ b/src/ifcgeom/kernels/cgal/cgal_kernel.h @@ -60,11 +60,11 @@ namespace ifcopenshell { namespace utils { IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_cube(double d); IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_cube(const kernel_::Point_3& lower, const kernel_::Point_3& upper); - IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_polyhedron(std::list &face_list, bool stitch_borders = false, logger& logger = ifcopenshell::logger::root()); + IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_polyhedron(std::list &face_list, bool stitch_borders = false, logger& logger = ifcopenshell::logger::root()); #ifndef IFOPSH_SIMPLE_KERNEL IFC_GEOMLIBRARY_API CGAL::Polyhedron_3 create_polyhedron(const CGAL::Nef_polyhedron_3 &nef_polyhedron, logger& logger = ifcopenshell::logger::root()); - IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3 create_nef_polyhedron(std::list &face_list, logger& logger = ifcopenshell::logger::root()); + IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3 create_nef_polyhedron(std::list &face_list, logger& logger = ifcopenshell::logger::root()); IFC_GEOMLIBRARY_API CGAL::Nef_polyhedron_3 create_nef_polyhedron(CGAL::Polyhedron_3 &polyhedron, logger& logger = ifcopenshell::logger::root()); #endif } @@ -82,7 +82,7 @@ namespace ifcopenshell { PP_NONE }; - bool preprocess_boolean_operand(const express::base& log_reference, const std::list& first_operands, const std::list>& first_operands_nef, const std::list& all_operand_planes, const cgal_shape_t& shape_const, CGAL::Nef_polyhedron_3& result, boolean_operand_preprocess proc); + bool preprocess_boolean_operand(const express::base& log_reference, const std::list& first_operands, const std::list>& first_operands_nef, const std::list& all_operand_planes, const cgal_polyhedron& shape_const, CGAL::Nef_polyhedron_3& result, boolean_operand_preprocess proc); bool thin_solid(const CGAL::Nef_polyhedron_3& a, CGAL::Nef_polyhedron_3& result); @@ -109,15 +109,15 @@ namespace ifcopenshell { #endif } - bool convert(const taxonomy::extrusion::ptr, cgal_shape_t&); - bool convert(const taxonomy::face::ptr, std::list&); - bool convert(const taxonomy::loop::ptr, cgal_wire_t&); - // bool convert(const taxonomy::matrix4::ptr, cgal_placement_t&); - bool convert(const taxonomy::shell::ptr, cgal_shape_t&); + bool convert(const taxonomy::extrusion::ptr, cgal_polyhedron&); + bool convert(const taxonomy::face::ptr, std::list&); + bool convert(const taxonomy::loop::ptr, cgal_wire&); + // bool convert(const taxonomy::matrix4::ptr, cgal_placement&); + bool convert(const taxonomy::shell::ptr, cgal_polyhedron&); - bool process_extrusion(const cgal_face_t& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_shape_t& shape); + bool process_extrusion(const cgal_face& bottom_face, taxonomy::direction3::ptr direction, double height, cgal_polyhedron& shape); bool process_as_2d_polygon(const taxonomy::boolean_result::ptr br, std::list>& loops, double& z0, double& z1); - bool process_as_2d_polygon(const std::list>>& operands, std::list>& loops, double& z0, double& z1); + bool process_as_2d_polygon(const std::list>>& operands, std::list>& loops, double& z0, double& z1); virtual bool convert_impl(const taxonomy::shell::ptr, ifcopenshell::geom::conversion_results&); virtual bool convert_impl(const taxonomy::extrusion::ptr, ifcopenshell::geom::conversion_results&); diff --git a/src/ifcgeom/kernels/manifold/manifold_kernel.cpp b/src/ifcgeom/kernels/manifold/manifold_kernel.cpp index f3802ad925..c80919d6bf 100644 --- a/src/ifcgeom/kernels/manifold/manifold_kernel.cpp +++ b/src/ifcgeom/kernels/manifold/manifold_kernel.cpp @@ -1470,7 +1470,7 @@ namespace { return bbox; } - std::optional boolean_result_from_operands(const std::vector& operands, taxonomy::boolean_result::operation_t operation) { + std::optional boolean_result_from_operands(const std::vector& operands, taxonomy::boolean_result::operation_type operation) { if (operands.empty()) { return std::nullopt; } diff --git a/src/ifcgeom/kernels/opencascade/boolean_result.cpp b/src/ifcgeom/kernels/opencascade/boolean_result.cpp index c2e7ca8702..1abc6b6fa9 100644 --- a/src/ifcgeom/kernels/opencascade/boolean_result.cpp +++ b/src/ifcgeom/kernels/opencascade/boolean_result.cpp @@ -47,7 +47,7 @@ namespace { } namespace { - BOPAlgo_Operation op_to_occt(taxonomy::boolean_result::operation_t t) { + BOPAlgo_Operation op_to_occt(taxonomy::boolean_result::operation_type t) { switch (t) { case taxonomy::boolean_result::UNION: return BOPAlgo_FUSE; case taxonomy::boolean_result::INTERSECTION: return BOPAlgo_COMMON; diff --git a/src/ifcgeom/kernels/opencascade/tree.h b/src/ifcgeom/kernels/opencascade/tree.h index d25e51e62e..efc91bc228 100644 --- a/src/ifcgeom/kernels/opencascade/tree.h +++ b/src/ifcgeom/kernels/opencascade/tree.h @@ -914,7 +914,7 @@ namespace ifcopenshell::geom { } std::vector select_box(const T& t, bool completely_within = false, double extend=-1.e-5) const { - typename map_t::const_iterator it = shapes_.find(t); + typename shape_map::const_iterator it = shapes_.find(t); if (it == shapes_.end()) { return std::vector(); } @@ -1410,11 +1410,11 @@ namespace ifcopenshell::geom { } protected: - typedef NCollection_UBTree tree_t; - typedef std::map map_t; + typedef NCollection_UBTree spatial_tree; + typedef std::map shape_map; - tree_t tree_; - map_t shapes_; + spatial_tree tree_; + shape_map shapes_; std::map aabbs_; std::map obbs_; std::map max_protrusions_; @@ -1436,11 +1436,11 @@ namespace ifcopenshell::geom { bool enable_face_styles_ = false; - class selector : public tree_t::Selector + class selector : public spatial_tree::Selector { public: selector(const Bnd_Box& b) - : tree_t::Selector() + : spatial_tree::Selector() , bounds_(b) {} @@ -1857,9 +1857,9 @@ namespace ifcopenshell::geom { } protected: - typedef NCollection_DataMap face_style_map_t; + typedef NCollection_DataMap face_style_map; - face_style_map_t face_styles_; + face_style_map face_styles_; std::vector styles_; }; diff --git a/src/ifcgeom/mapping/IfcBooleanResult.cpp b/src/ifcgeom/mapping/IfcBooleanResult.cpp index 524fb66ab7..29668d7fa3 100644 --- a/src/ifcgeom/mapping/IfcBooleanResult.cpp +++ b/src/ifcgeom/mapping/IfcBooleanResult.cpp @@ -24,7 +24,7 @@ using namespace ifcopenshell::geom; namespace { - taxonomy::boolean_result::operation_t boolean_op_type(IfcSchema::IfcBooleanOperator::Value op) { + taxonomy::boolean_result::operation_type boolean_op_type(IfcSchema::IfcBooleanOperator::Value op) { if (op == IfcSchema::IfcBooleanOperator::IfcBooleanOperator_DIFFERENCE) { return taxonomy::boolean_result::SUBTRACTION; } else if (op == IfcSchema::IfcBooleanOperator::IfcBooleanOperator_INTERSECTION) { diff --git a/src/ifcgeom/mapping/IfcCompositeCurve.cpp b/src/ifcgeom/mapping/IfcCompositeCurve.cpp index 3f770d8c6a..fcc0cd086f 100644 --- a/src/ifcgeom/mapping/IfcCompositeCurve.cpp +++ b/src/ifcgeom/mapping/IfcCompositeCurve.cpp @@ -23,7 +23,7 @@ using namespace ifcopenshell::geom; taxonomy::ptr mapping::map_impl(const IfcSchema::IfcCompositeCurve& inst) { auto loop = taxonomy::make(); - taxonomy::piecewise_function::spans_t spans; + taxonomy::piecewise_function::span_list spans; #ifdef SCHEMA_HAS_IfcSegment // 4x3 diff --git a/src/ifcgeom/mapping/IfcGradientCurve.cpp b/src/ifcgeom/mapping/IfcGradientCurve.cpp index 0d6ff4ef9c..c05e8b4b45 100644 --- a/src/ifcgeom/mapping/IfcGradientCurve.cpp +++ b/src/ifcgeom/mapping/IfcGradientCurve.cpp @@ -30,7 +30,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcGradientCurve& inst) { auto segments = inst.Segments(); - taxonomy::piecewise_function::spans_t spans; + taxonomy::piecewise_function::span_list spans; for (auto& segment : segments) { if (segment.as()) { diff --git a/src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp b/src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp index 9a2f1045f8..134dd1d396 100644 --- a/src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp +++ b/src/ifcgeom/mapping/IfcOffsetCurveByDistance.cpp @@ -63,7 +63,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcOffsetCurveByDistances& inst double start = basis_curve_fn->start(); double basis_curve_length = basis_curve_fn->length(); - taxonomy::piecewise_function::spans_t offset_spans; + taxonomy::piecewise_function::span_list offset_spans; #if defined SCHEMA_HAS_IfcDistanceExpression double first_distance = first_offset_value.DistanceAlong(); diff --git a/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp b/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp index 7e23ee5cf9..0c1de6e35a 100644 --- a/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp +++ b/src/ifcgeom/mapping/IfcSegmentedReferenceCurve.cpp @@ -31,7 +31,7 @@ taxonomy::ptr mapping::map_impl(const IfcSchema::IfcSegmentedReferenceCurve& ins auto segments = inst.Segments(); - taxonomy::piecewise_function::spans_t spans; + taxonomy::piecewise_function::span_list spans; for (auto& segment : segments) { if (auto cseg = segment.as()) { // @todo check that we don't get a mixture of implicit and explicit definitions diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index 275aab97eb..f2bee147b6 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -118,10 +118,10 @@ std::vector mapping::products_represented_by(const IfcSch } namespace { -std::vector filter_products(const std::vector& unfiltered_products, const std::vector& filters) { +std::vector filter_products(const std::vector& unfiltered_products, const std::vector& filters) { std::vector ifcproducts; for (auto& prod : unfiltered_products) { - if (boost::all(filters, [prod](const filter_t& f) { return f(prod); })) { + if (boost::all(filters, [prod](const filter_function& f) { return f(prod); })) { ifcproducts.push_back(prod); } } @@ -228,7 +228,7 @@ std::vector mapping::find_openings(const express::base& inst) { } -void mapping::get_representations(std::vector& tasks, std::vector& filters) { +void mapping::get_representations(std::vector& tasks, std::vector& filters) { std::vector representations; const bool has_context_ids = settings_.get().has(); const bool uses_priorities = !has_context_ids && settings_.get().has(); diff --git a/src/ifcgeom/mapping/mapping.h b/src/ifcgeom/mapping/mapping.h index 512eb78d13..16bfbe4cf4 100644 --- a/src/ifcgeom/mapping/mapping.h +++ b/src/ifcgeom/mapping/mapping.h @@ -91,7 +91,7 @@ namespace geom { initialize_units_(); } virtual ifcopenshell::geom::taxonomy::ptr map(const express::base&); - virtual void get_representations(std::vector& tasks, std::vector& filters); + virtual void get_representations(std::vector& tasks, std::vector& filters); virtual std::map get_layers(const express::base&); virtual void initialize_settings(); virtual double get_length_unit() const { return length_unit_; } diff --git a/src/ifcgeom/taxonomy.cpp b/src/ifcgeom/taxonomy.cpp index 3efbd3f111..272b3bc01b 100644 --- a/src/ifcgeom/taxonomy.cpp +++ b/src/ifcgeom/taxonomy.cpp @@ -486,7 +486,7 @@ ifcopenshell::geom::taxonomy::solid::ptr ifcopenshell::geom::create_box(double x } /////////////////// -piecewise_function::piecewise_function(double start, const spans_t& s, const express::base& instance) : function_item(instance), start_(start), spans_(s) { +piecewise_function::piecewise_function(double start, const span_list& s, const express::base& instance) : function_item(instance), start_(start), spans_(s) { } piecewise_function::piecewise_function(double start, const std::vector& pwfs, const express::base& instance) : function_item(instance), start_(start) { @@ -495,7 +495,7 @@ piecewise_function::piecewise_function(double start, const std::vector ifcopenshell::geom::taxonomy::loop_to_function fi_ = loop_->fi; } else { // piecewise_function is a specialization of function_item - callers don't need to know this detail - piecewise_function::spans_t spans; + piecewise_function::span_list spans; spans.reserve(loop_->children.size()); for (auto& edge_ : loop_->children) { if (edge_->basis && edge_->basis->kind() == CIRCLE) { diff --git a/src/ifcgeom/taxonomy.h b/src/ifcgeom/taxonomy.h index 240d4749a5..79782075cd 100644 --- a/src/ifcgeom/taxonomy.h +++ b/src/ifcgeom/taxonomy.h @@ -303,10 +303,10 @@ typedef item const* ptr; public: DECLARE_PTR(matrix4) - enum tag_t { + enum tag_type { IDENTITY, AFFINE_WO_SCALE, AFFINE_W_UNIFORM_SCALE, AFFINE_W_NONUNIFORM_SCALE, OTHER }; - tag_t tag; + tag_type tag; matrix4() : eigen_base(), tag(IDENTITY) {} matrix4(const Eigen::Matrix4d& c) : eigen_base(c), tag(OTHER) {} @@ -476,15 +476,15 @@ typedef item const* ptr; struct IFC_GEOM_API piecewise_function : public function_item { DECLARE_PTR(piecewise_function) - using spans_t = std::vector; + using span_list = std::vector; - piecewise_function(double start, const spans_t& s, const express::base& instance = express::base()); + piecewise_function(double start, const span_list& s, const express::base& instance = express::base()); piecewise_function(double start, const std::vector& pwfs, const express::base& instance = express::base()); piecewise_function(piecewise_function&&) = default; piecewise_function(const piecewise_function&) = default; virtual ~piecewise_function() = default; - const spans_t& spans() const; + const span_list& spans() const; size_t span_count() const {return spans_.size();} function_item::const_ptr span_fn(size_t i) { return spans_[i]; } bool is_empty() const; @@ -502,7 +502,7 @@ typedef item const* ptr; private: double start_ = 0.0; // starting value of the pwf - spans_t spans_; + span_list spans_; }; struct IFC_GEOM_API gradient_function : public function_item { @@ -1271,15 +1271,15 @@ typedef item const* ptr; struct IFC_GEOM_API boolean_result : public collection_base { DECLARE_PTR(boolean_result) - enum operation_t { + enum operation_type { UNION, SUBTRACTION, INTERSECTION }; virtual boolean_result* clone_() const { return new boolean_result(*this); } virtual kinds kind() const { return BOOLEAN_RESULT; } - operation_t operation; + operation_type operation; - static const std::string& operation_str(operation_t op) { + static const std::string& operation_str(operation_type op) { using namespace std::string_literals; static std::string s[] = { "union"s, "subtraction"s, "intersection"s }; return s[(size_t)op]; diff --git a/src/ifcgeom/tests/test_ifcopenshell_geometry.cpp b/src/ifcgeom/tests/test_ifcopenshell_geometry.cpp index 8dc2909abf..3d33c48430 100644 --- a/src/ifcgeom/tests/test_ifcopenshell_geometry.cpp +++ b/src/ifcgeom/tests/test_ifcopenshell_geometry.cpp @@ -129,7 +129,7 @@ std::vector representation_tasks( ifcopenshell::geom::kernels::construct(&file, "passthrough", settings), &file, settings, log); std::vector tasks; - std::vector filters; + std::vector filters; converter.mapping()->get_representations(tasks, filters); return tasks; } diff --git a/src/ifcparse/entity_instance_data.cpp b/src/ifcparse/entity_instance_data.cpp index d238efe7a6..f90b8c9974 100644 --- a/src/ifcparse/entity_instance_data.cpp +++ b/src/ifcparse/entity_instance_data.cpp @@ -18,8 +18,8 @@ public: int operator()(const double& /*i*/) const { return -1; } int operator()(const std::string& /*i*/) const { return -1; } int operator()(const boost::dynamic_bitset<>& /*i*/) const { return -1; } - int operator()(const empty_aggregate_t& /*unused*/) const { return 0; } - int operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { return 0; } + int operator()(const empty_aggregate& /*unused*/) const { return 0; } + int operator()(const empty_aggregate_of_aggregate& /*unused*/) const { return 0; } int operator()(const std::vector& i) const { return (int)i.size(); } int operator()(const std::vector& i) const { return (int)i.size(); } int operator()(const std::vector>& i) const { return (int)i.size(); } @@ -379,17 +379,17 @@ bool ::impl::serialize(std::string& val, const derived&) return true; } -bool ::impl::serialize(std::string& val, const empty_aggregate_t&) +bool ::impl::serialize(std::string& val, const empty_aggregate&) { val.resize(1); - val[0] = type_encoder::encode_type(); + val[0] = type_encoder::encode_type(); return true; } -bool ::impl::serialize(std::string& val, const empty_aggregate_of_aggregate_t&) +bool ::impl::serialize(std::string& val, const empty_aggregate_of_aggregate&) { val.resize(1); - val[0] = type_encoder::encode_type(); + val[0] = type_encoder::encode_type(); return true; } @@ -544,8 +544,8 @@ template IFC_PARSE_API void rocks_db_attribute_storage::set(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const derived& value); -template IFC_PARSE_API void rocks_db_attribute_storage::set(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_t& value); -template IFC_PARSE_API void rocks_db_attribute_storage::set(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_of_aggregate_t& value); +template IFC_PARSE_API void rocks_db_attribute_storage::set(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate& value); +template IFC_PARSE_API void rocks_db_attribute_storage::set(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index, const empty_aggregate_of_aggregate& value); template IFC_PARSE_API bool rocks_db_attribute_storage::has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; template IFC_PARSE_API bool rocks_db_attribute_storage::has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; @@ -567,8 +567,8 @@ template IFC_PARSE_API bool rocks_db_attribute_storage::has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; -template IFC_PARSE_API bool rocks_db_attribute_storage::has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; -template IFC_PARSE_API bool rocks_db_attribute_storage::has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; +template IFC_PARSE_API bool rocks_db_attribute_storage::has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; +template IFC_PARSE_API bool rocks_db_attribute_storage::has(void* storage, const ifcopenshell::declaration* decl, std::size_t identity, size_t index) const; template T* instance_data::get_storage_of_type() const { diff --git a/src/ifcparse/file.h b/src/ifcparse/file.h index 16e65cb882..837400da58 100644 --- a/src/ifcparse/file.h +++ b/src/ifcparse/file.h @@ -138,11 +138,11 @@ private: return bypassed_instances_; } - const ifcopenshell::impl::in_memory_file_storage::entities_by_ref_t& inverses() const { + const ifcopenshell::impl::in_memory_file_storage::entities_by_ref& inverses() const { return storage_.byref_excl_; } - ifcopenshell::impl::in_memory_file_storage::entities_by_ref_t& inverses() { + ifcopenshell::impl::in_memory_file_storage::entities_by_ref& inverses() { return storage_.byref_excl_; } @@ -184,27 +184,27 @@ class uninitialized_tag {}; /// The file takes ownership of instances added to this file and deletes them when the file is deleted. class IFC_PARSE_API file { private: - typedef std::map entity_entity_map_t; + typedef std::map entity_entity_map; // @todo determine the constness of things (probably needs to be all const, we don't want to overwrite) // @todo we have variant_iterator and MapVariant, we probably need to retain only one? public: using const_iterator = variant_iterator; using type_iterator = variant_iterator; - using storage_t = std::variant; + using storage_type = std::variant; - typedef variant_map entity_instance_by_guid_t; - entity_instance_by_guid_t byguid_; - typedef variant_map entity_by_id_t; - entity_by_id_t byid_; - typedef variant_map entities_by_ref_t; - entities_by_ref_t byref_excl_; + typedef variant_map entity_instance_by_guid; + entity_instance_by_guid byguid_; + typedef variant_map entity_by_id; + entity_by_id byid_; + typedef variant_map entities_by_ref; + entities_by_ref byref_excl_; bool check_existance_before_adding = true; bool calculate_unit_factors = true; // @todo temporarily public for header - storage_t storage_; + storage_type storage_; std::set types_to_bypass_loading_; @@ -215,7 +215,7 @@ public: const ifcopenshell::schema_definition* schema_; const ifcopenshell::declaration* ifcroot_type_; - entity_entity_map_t entity_file_map_; + entity_entity_map entity_file_map_; unsigned int max_id_; @@ -293,13 +293,13 @@ public: /// Returns the first entity in the range of instances contained in the model, /// in arbitrary order - entity_by_id_t::iterator begin() const { + entity_by_id::iterator begin() const { return byid_.begin(); } /// Returns the first entity in the range of instances contained in the model, /// in arbitrary order - entity_by_id_t::iterator end() const { + entity_by_id::iterator end() const { return byid_.end(); } @@ -411,7 +411,7 @@ public: void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index); void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::base& entity, int attribute_index); - entity_instance_by_guid_t internal_guid_map() { return byguid_; }; + entity_instance_by_guid internal_guid_map() { return byguid_; }; void add_type_ref(const express::base& new_entity); void remove_type_ref(const express::base& new_entity); diff --git a/src/ifcparse/instance_data.h b/src/ifcparse/instance_data.h index e1fb131d19..7792a9eb02 100644 --- a/src/ifcparse/instance_data.h +++ b/src/ifcparse/instance_data.h @@ -72,8 +72,8 @@ public: }; class IFC_PARSE_API blank {}; class IFC_PARSE_API derived {}; -class IFC_PARSE_API empty_aggregate_t {}; -class IFC_PARSE_API empty_aggregate_of_aggregate_t {}; +class IFC_PARSE_API empty_aggregate {}; +class IFC_PARSE_API empty_aggregate_of_aggregate {}; } // namespace ifcopenshell @@ -134,7 +134,7 @@ namespace impl { }; template <> - struct variant_type_name { + struct variant_type_name { static std::string get() { return "aggregate"; } }; @@ -144,7 +144,7 @@ namespace impl { }; template <> - struct variant_type_name { + struct variant_type_name { static std::string get() { return "aggregate of aggregate"; } }; } @@ -191,7 +191,7 @@ typedef parameter_pack < express::base, // AGGREGATES: - empty_aggregate_t, + empty_aggregate, // An aggregate of integers, e.g. (1,2,3). Stored as int64_t for the // same reason as the scalar int64_t above. std::vector, @@ -207,7 +207,7 @@ typedef parameter_pack < std::vector, // AGGREGATES OF AGGREGATES: - empty_aggregate_of_aggregate_t, + empty_aggregate_of_aggregate, // An aggregate of an aggregate of ints. E.g. ((1, 2), (3)) std::vector>, // An aggregate of an aggregate of floats. E.g. ((1., 2.3), (4.)) @@ -227,17 +227,17 @@ struct pack_to_variant_array> { using in_memory_attribute_storage = pack_to_variant_array::type; template -struct type_encoder_t; +struct type_encoder_impl; template -struct type_encoder_t> { +struct type_encoder_impl> { template static char encode_type() { return 'A' + ::impl::TypeIndex_v; } }; -using type_encoder = type_encoder_t; +using type_encoder = type_encoder_impl; class IFC_PARSE_API mutable_attribute_value { public: @@ -299,8 +299,8 @@ namespace impl { bool serialize(std::string& buffer, const ifcopenshell::blank& value); bool serialize(std::string& buffer, const ifcopenshell::derived& value); - bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_t& value); - bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_of_aggregate_t& value); + bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate& value); + bool serialize(std::string& buffer, const ifcopenshell::empty_aggregate_of_aggregate& value); bool serialize(std::string& buffer, const boost::logic::tribool& value); @@ -475,9 +475,9 @@ public: case ifcopenshell::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE: return visitor((std::vector>)*this); case ifcopenshell::Argument_EMPTY_AGGREGATE: - return visitor(empty_aggregate_t{}); + return visitor(empty_aggregate{}); case ifcopenshell::Argument_AGGREGATE_OF_EMPTY_AGGREGATE: - return visitor(empty_aggregate_of_aggregate_t{}); + return visitor(empty_aggregate_of_aggregate{}); default: return visitor(blank{}); } diff --git a/src/ifcparse/map_transformer.h b/src/ifcparse/map_transformer.h index 6e50f31a91..86598cd48e 100644 --- a/src/ifcparse/map_transformer.h +++ b/src/ifcparse/map_transformer.h @@ -35,13 +35,13 @@ public: static constexpr bool read_only = std::is_void::value; struct back_storage_fallback {}; - using back_storage_t = typename std::conditional::type; + using back_storage = typename std::conditional::type; private: BaseMap* base_map_; Transform transform_; - back_storage_t transform_back_; + back_storage transform_back_; public: // read-only constructor with TransformBack=void diff --git a/src/ifcparse/parse.cpp b/src/ifcparse/parse.cpp index 6e1170760a..a253ce0483 100644 --- a/src/ifcparse/parse.cpp +++ b/src/ifcparse/parse.cpp @@ -1330,8 +1330,8 @@ namespace { } data_ << ")"; } - void operator()(const empty_aggregate_t& /*unused*/) const { data_ << "()"; } - void operator()(const empty_aggregate_of_aggregate_t& /*unused*/) const { data_ << "()"; } + void operator()(const empty_aggregate& /*unused*/) const { data_ << "()"; } + void operator()(const empty_aggregate_of_aggregate& /*unused*/) const { data_ << "()"; } }; template <> @@ -2469,7 +2469,7 @@ template void ifcopenshell::impl::in_memory_file_storage::read_from_stream(file_ void file::recalculate_id_counter() { /* // @todo - entity_by_id_t::key_type k = 0; + entity_by_id::key_type k = 0; for (auto& p : byid_) { if (p.first > k) { k = p.first; @@ -2582,7 +2582,7 @@ express::base file::add_entity(const express::base& entity, int id) { // If this instance has been inserted before, return // a reference to the copy that was created from it. - entity_entity_map_t::iterator mit = entity_file_map_.find(entity.identity()); + entity_entity_map::iterator mit = entity_file_map_.find(entity.identity()); if (mit != entity_file_map_.end()) { return mit->second; } @@ -2593,9 +2593,9 @@ express::base file::add_entity(const express::base& entity, int id) { auto entity_attributes = traverse(entity, 1); for (auto it = entity_attributes.begin() + 1; it != entity_attributes.end(); ++it) { if (*it != entity) { - entity_entity_map_t::iterator mit2 = entity_file_map_.find(it->identity()); + entity_entity_map::iterator mit2 = entity_file_map_.find(it->identity()); if (mit2 == entity_file_map_.end()) { - entity_file_map_.insert(entity_entity_map_t::value_type(it->identity(), add_entity(*it))); + entity_file_map_.insert(entity_entity_map::value_type(it->identity(), add_entity(*it))); } } } @@ -2618,8 +2618,8 @@ express::base file::add_entity(const express::base& entity, int id) { if constexpr (std::is_same_v) { } else if constexpr (std::is_same_v>) { } else if constexpr (std::is_same_v>>) { - } else if constexpr (std::is_same_v) { - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { } else { new_entity.set_attribute_value(i, v); } @@ -2648,7 +2648,7 @@ express::base file::add_entity(const express::base& entity, int id) { } if (attr_type == ifcopenshell::Argument_ENTITY_INSTANCE) { - entity_entity_map_t::const_iterator eit = entity_file_map_.find(((express::base)(attr)).identity()); + entity_entity_map::const_iterator eit = entity_file_map_.find(((express::base)(attr)).identity()); if (eit == entity_file_map_.end()) { throw ifcopenshell::exception("Unable to map instance to file"); } @@ -2658,7 +2658,7 @@ express::base file::add_entity(const express::base& entity, int id) { std::vector instances = attr; std::vector new_instances; for (auto& i : instances) { - entity_entity_map_t::const_iterator eit = entity_file_map_.find(i.identity()); + entity_entity_map::const_iterator eit = entity_file_map_.find(i.identity()); if (eit == entity_file_map_.end()) { throw ifcopenshell::exception("Unable to map instance to file"); } @@ -2672,7 +2672,7 @@ express::base file::add_entity(const express::base& entity, int id) { for (auto& v : instances) { new_instances.emplace_back(); for (auto& i : v) { - entity_entity_map_t::const_iterator eit = entity_file_map_.find(i.identity()); + entity_entity_map::const_iterator eit = entity_file_map_.find(i.identity()); if (eit == entity_file_map_.end()) { throw ifcopenshell::exception("Unable to map instance to file"); } @@ -2719,7 +2719,7 @@ express::base file::add_entity(const express::base& entity, int id) { } } - entity_file_map_.insert(entity_entity_map_t::value_type(entity.identity(), new_entity)); + entity_file_map_.insert(entity_entity_map::value_type(entity.identity(), new_entity)); // For subtypes of IfcRoot, the GUID mapping needs to be updated. /* diff --git a/src/ifcparse/spf_header.cpp b/src/ifcparse/spf_header.cpp index 6af743880e..598e56ea97 100644 --- a/src/ifcparse/spf_header.cpp +++ b/src/ifcparse/spf_header.cpp @@ -108,8 +108,8 @@ void ifcopenshell::spf_header::assign(const spf_header& other) { if constexpr (std::is_same_v) { } else if constexpr (std::is_same_v>) { } else if constexpr (std::is_same_v>>) { - } else if constexpr (std::is_same_v) { - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { } else { new_entity.set_attribute_value(i, v); } diff --git a/src/ifcparse/storage.h b/src/ifcparse/storage.h index a32f618bdc..ae55b34f9c 100644 --- a/src/ifcparse/storage.h +++ b/src/ifcparse/storage.h @@ -220,19 +220,19 @@ namespace ifcopenshell { class inverse_index { public: - typedef std::map, std::vector> legacy_bucket_t; - typedef std::unordered_map legacy_map_t; - typedef legacy_map_t::key_type key_type; - typedef legacy_map_t::mapped_type mapped_type; - typedef legacy_map_t::value_type value_type; - typedef legacy_map_t::iterator iterator; - typedef legacy_map_t::const_iterator const_iterator; + typedef std::map, std::vector> legacy_bucket; + typedef std::unordered_map legacy_map; + typedef legacy_map::key_type key_type; + typedef legacy_map::mapped_type mapped_type; + typedef legacy_map::value_type value_type; + typedef legacy_map::iterator iterator; + typedef legacy_map::const_iterator const_iterator; typedef std::vector::const_iterator record_iterator; private: mutable std::vector records_; mutable bool sorted_ = true; - mutable std::unique_ptr materialized_; + mutable std::unique_ptr materialized_; static bool record_less(const inverse_record& a, const inverse_record& b) { if (a.referenced_id != b.referenced_id) { @@ -259,9 +259,9 @@ namespace ifcopenshell { materialized_.reset(); } - legacy_map_t& materialize() const { + legacy_map& materialize() const { if (!materialized_) { - materialized_ = std::make_unique(); + materialized_ = std::make_unique(); materialized_->reserve(records_.size()); for (const auto& record : records_) { (*materialized_)[(int)record.referenced_id][{(short)record.source_entity, (short)record.attribute_index}].push_back(record.source_id); @@ -421,42 +421,42 @@ namespace ifcopenshell { unresolved_references* references_to_resolve = nullptr; - typedef std::map> entities_by_type_t; - typedef std::unordered_map entity_instance_by_name_storage_t; - typedef map_transformer> entity_instance_by_name_t; - typedef std::unordered_map type_instance_by_name_t; - typedef std::map entity_instance_by_guid_t; - typedef inverse_index entities_by_ref_t; - typedef entity_instance_by_name_t::iterator iterator; + typedef std::map> entities_by_type; + typedef std::unordered_map entity_instance_by_name_storage; + typedef map_transformer> entity_instance_by_name; + typedef std::unordered_map type_instance_by_name; + typedef std::map entity_instance_by_guid; + typedef inverse_index entities_by_ref; + typedef entity_instance_by_name::iterator iterator; in_memory_file_storage(ifcopenshell::file* owner_file = nullptr, ifcopenshell::logger& logger = ifcopenshell::logger::root()) : logger_(logger), file(owner_file), schema(nullptr), byid_read_(&byid_, [this](const shared_pointer_type& data) { return express::base(data); }) {}; in_memory_file_storage(const in_memory_file_storage& other) = delete; in_memory_file_storage(const in_memory_file_storage&& other) = delete; - class type_iterator : public entities_by_type_t::const_iterator { + class type_iterator : public entities_by_type::const_iterator { public: using iterator_category = std::forward_iterator_tag; - using value_type = entities_by_type_t::key_type; - using difference_type = typename entities_by_type_t::const_iterator::difference_type; + using value_type = entities_by_type::key_type; + using difference_type = typename entities_by_type::const_iterator::difference_type; using pointer = value_type const*; using reference = value_type const&; - type_iterator() : entities_by_type_t::const_iterator() {}; + type_iterator() : entities_by_type::const_iterator() {}; - type_iterator(const entities_by_type_t::const_iterator& iterator) - : entities_by_type_t::const_iterator(iterator) {}; + type_iterator(const entities_by_type::const_iterator& iterator) + : entities_by_type::const_iterator(iterator) {}; - entities_by_type_t::key_type const* operator->() const { - return &entities_by_type_t::const_iterator::operator->()->first; + entities_by_type::key_type const* operator->() const { + return &entities_by_type::const_iterator::operator->()->first; } - entities_by_type_t::key_type const& operator*() const { - return entities_by_type_t::const_iterator::operator*().first; + entities_by_type::key_type const& operator*() const { + return entities_by_type::const_iterator::operator*().first; } type_iterator& operator++() { - entities_by_type_t::const_iterator::operator++(); + entities_by_type::const_iterator::operator++(); return *this; } @@ -467,12 +467,12 @@ namespace ifcopenshell { } }; - entity_instance_by_name_storage_t byid_; - type_instance_by_name_t tbyid_; - entities_by_type_t bytype_excl_; - entities_by_ref_t byref_excl_; - entity_instance_by_guid_t byguid_; - entity_instance_by_name_t byid_read_; + entity_instance_by_name_storage byid_; + type_instance_by_name tbyid_; + entities_by_type bytype_excl_; + entities_by_ref byref_excl_; + entity_instance_by_guid byguid_; + entity_instance_by_name byid_read_; template shared_pointer_type load(ifcopenshell::spf_lexer* tokens, std::optional entity_instance_name, const ifcopenshell::declaration* declaration, const ifcopenshell::entity* entity, int attribute_index = -1, bool coerce_attribute_count = true); @@ -529,35 +529,35 @@ namespace ifcopenshell { // to make sure that instance pointer are constant during file lifetime // cache instances because we want stable pointers // @todo this is silly, but we cannot have the same type, this should be just a pointer then on the file side? - typedef std::map entity_by_iden_cache_t; - entity_by_iden_cache_t instance_cache_, type_instance_cache_; + typedef std::map entity_by_iden_cache; + entity_by_iden_cache instance_cache_, type_instance_cache_; std::mutex instance_cache_mutex_; // @todo all these size_ts should probably be uint32_t for consistency with in-mem storage // lookup id->identity - // typedef rocksdb_map_adapter identity_by_id_t; - // identity_by_id_t byid_; - typedef rocksdb_set_view instance_name_view_t; - instance_name_view_t instance_ids_; - typedef set_to_map_transformer> entity_instance_by_name_t; - entity_instance_by_name_t instance_by_name_; + // typedef rocksdb_map_adapter identity_by_id; + // identity_by_id byid_; + typedef rocksdb_set_view instance_name_view; + instance_name_view instance_ids_; + typedef set_to_map_transformer> entity_instance_by_name; + entity_instance_by_name instance_by_name_; - // typedef map_transformer, std::function, std::function> entity_by_id_t; + // typedef map_transformer, std::function, std::function> entity_by_id; // storage is now Instance name -> Identity -> Pointer (cached) - // entity_by_id_t byidentity_; + // entity_by_id byidentity_; // index in schema to binary serialized ids - typedef rocksdb_map_adapter instance_id_str_by_type_t; - instance_id_str_by_type_t bytype_; + typedef rocksdb_map_adapter instance_id_str_by_type; + instance_id_str_by_type bytype_; // guid -> id - typedef rocksdb_map_adapter instance_id_by_guid_str_t; - instance_id_by_guid_str_t byguid_internal_; + typedef rocksdb_map_adapter instance_id_by_guid_str; + instance_id_by_guid_str byguid_internal_; // guid -> id -> instance - typedef map_transformer, std::function, std::function> entity_instance_by_guid_t; - entity_instance_by_guid_t byguid_; + typedef map_transformer, std::function, std::function> entity_instance_by_guid; + entity_instance_by_guid byguid_; typedef std::tuple inverse_attr_record; enum INVERSE_ATTR { @@ -565,8 +565,8 @@ namespace ifcopenshell { INSTANCE_TYPE, ATTRIBUTE_INDEX }; - typedef rocksdb_map_adapter> entities_by_ref_t; - entities_by_ref_t byref_excl_; + typedef rocksdb_map_adapter> entities_by_ref; + entities_by_ref byref_excl_; bool read_only_ = false; @@ -675,7 +675,7 @@ namespace ifcopenshell { }; // @todo rocksdb_instance_iterator? - using const_iterator = entity_instance_by_name_t::iterator; + using const_iterator = entity_instance_by_name::iterator; void register_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, int instance_id, int attribute_index); void unregister_inverse(unsigned referenced_id, const ifcopenshell::entity* from_entity, const express::base& entity, int attribute_index); diff --git a/src/ifcparse/variant_array.h b/src/ifcparse/variant_array.h index c9bf3a5a01..ac4ec34549 100644 --- a/src/ifcparse/variant_array.h +++ b/src/ifcparse/variant_array.h @@ -123,7 +123,7 @@ namespace impl { using type = std::tuple<>; }; template - using map_types_t = typename map_types::type; + using mapped_types = typename map_types::type; // Create aligned_union from paramater pack stored in tuple for storage in variant template @@ -138,7 +138,7 @@ namespace impl { template class variant_array { public: - using types_tuple = ::impl::map_types_t; + using types_tuple = ::impl::mapped_types; variant_array(size_t size) : size_and_indices_(size ? new uint8_t[size + 1] : nullptr) @@ -190,7 +190,7 @@ public: destroy_at_index(index); size_and_indices_[index + 1] = ::impl::TypeIndex_v; - using v = typename std::tuple_element<::impl::TypeIndex_v, ::impl::map_types_t>::type; + using v = typename std::tuple_element<::impl::TypeIndex_v, ::impl::mapped_types>::type; if constexpr (::impl::is_unique_ptr::value) { new(&storage_[index]) v(new u(value)); } else { @@ -221,7 +221,7 @@ public: if (!has(index)) { throw std::bad_cast(); } - using v = typename std::tuple_element<::impl::TypeIndex_v, ::impl::map_types_t>::type; + using v = typename std::tuple_element<::impl::TypeIndex_v, ::impl::mapped_types>::type; if constexpr (::impl::is_unique_ptr::value) { return **reinterpret_cast(&storage_[index]); } else { @@ -249,7 +249,7 @@ public: ::impl::variant_type_name::get(), get_type_name(size_and_indices_[index + 1]) ); } - using v = typename std::tuple_element<::impl::TypeIndex_v, ::impl::map_types_t>::type; + using v = typename std::tuple_element<::impl::TypeIndex_v, ::impl::mapped_types>::type; if constexpr (::impl::is_unique_ptr::value) { return **reinterpret_cast(&storage_[index]); } else { @@ -272,7 +272,7 @@ public: } private: - using storage_type = typename ::impl::make_union_from_tuple<::impl::map_types_t>::type; + using storage_type = typename ::impl::make_union_from_tuple<::impl::mapped_types>::type; uint8_t* size_and_indices_; storage_type* storage_; @@ -294,7 +294,7 @@ private: template void destroy_type_at_index(std::size_t index, std::integral_constant) { if (size_and_indices_[index + 1] == Index - 1) { - using t = typename std::tuple_element_t>; + using t = typename std::tuple_element_t>; if constexpr (!std::is_trivially_destructible::value) { reinterpret_cast(&storage_[index])->~t(); } @@ -311,7 +311,7 @@ private: template auto apply_visitor_impl(Visitor&& visitor, std::size_t index, std::integral_constant) const { if (size_and_indices_[index + 1] == Index - 1) { - using t = typename std::tuple_element_t>; + using t = typename std::tuple_element_t>; if constexpr (::impl::is_unique_ptr::value) { return visitor(**reinterpret_cast(&storage_[index])); } else { @@ -326,8 +326,8 @@ private: static_cast(visitor); static_cast(index); throw std::runtime_error("Invalid variant index"); - if constexpr (!std::is_void_v()(std::declval> &>()))>) { - return decltype(std::declval()(std::declval> &>())){}; + if constexpr (!std::is_void_v()(std::declval> &>()))>) { + return decltype(std::declval()(std::declval> &>())){}; } } diff --git a/src/ifcviewer/GeometryStreamer.cpp b/src/ifcviewer/GeometryStreamer.cpp index d5f3a91bae..036b20b712 100644 --- a/src/ifcviewer/GeometryStreamer.cpp +++ b/src/ifcviewer/GeometryStreamer.cpp @@ -512,7 +512,7 @@ void GeometryStreamer::run(const std::string& path, int num_threads) { auto run_iterator = [&](ifcopenshell::geom::settings& iter_settings) -> bool { if (remaining.empty()) return true; - std::vector filters; + std::vector filters; ifcopenshell::geom::instance_id_filter idf{ /*include=*/true, /*traverse=*/false, remaining}; filters.push_back(idf); diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index d967542566..309eb82c1c 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -1228,7 +1228,7 @@ from .entity_instance import entity_instance_mixin } else { return pythonize_vector(v); } - } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { + } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { Py_INCREF(Py_None); return static_cast(Py_None); } else if constexpr (is_std_vector_v) { @@ -1298,7 +1298,7 @@ from .entity_instance import entity_instance_mixin Py_INCREF(Py_None); return static_cast(Py_None); } - } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { + } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { Py_INCREF(Py_None); return static_cast(Py_None); } else { @@ -1394,7 +1394,7 @@ from .entity_instance import entity_instance_mixin Py_INCREF(Py_None); attribute_val_py = static_cast(Py_None); } - } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { + } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { Py_INCREF(Py_None); attribute_val_py = static_cast(Py_None); } else { diff --git a/src/ifcwrap/utils/typemaps_out.i b/src/ifcwrap/utils/typemaps_out.i index 5f8c8c1774..df99c10703 100644 --- a/src/ifcwrap/utils/typemaps_out.i +++ b/src/ifcwrap/utils/typemaps_out.i @@ -45,7 +45,7 @@ Py_INCREF(Py_None); return static_cast(Py_None); } - } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { + } else if constexpr (std::is_same_v || std::is_same_v || std::is_same_v) { Py_INCREF(Py_None); return static_cast(Py_None); } else { diff --git a/src/serializers/schema_dependent/json_serializer.cpp b/src/serializers/schema_dependent/json_serializer.cpp index f83c30510d..b2ebd593c9 100644 --- a/src/serializers/schema_dependent/json_serializer.cpp +++ b/src/serializers/schema_dependent/json_serializer.cpp @@ -40,7 +40,7 @@ class format_value_visitor : public boost::static_visitor { template json operator()(const T& t) const { - if constexpr (std::is_same_v, ifcopenshell::derived> || std::is_same_v, boost::dynamic_bitset<>> || std::is_same_v, express::base> || std::is_same_v, std::vector> || std::is_same_v, std::vector> || std::is_same_v, std::vector> || std::is_same_v, std::vector>> || std::is_same_v, std::vector> || std::is_same_v, std::vector>> || std::is_same_v, std::vector>> || std::is_same_v, std::vector>> || std::is_same_v, ifcopenshell::empty_aggregate_t> || std::is_same_v, ifcopenshell::empty_aggregate_of_aggregate_t> || std::is_same_v, ifcopenshell::blank>) { + if constexpr (std::is_same_v, ifcopenshell::derived> || std::is_same_v, boost::dynamic_bitset<>> || std::is_same_v, express::base> || std::is_same_v, std::vector> || std::is_same_v, std::vector> || std::is_same_v, std::vector> || std::is_same_v, std::vector>> || std::is_same_v, std::vector> || std::is_same_v, std::vector>> || std::is_same_v, std::vector>> || std::is_same_v, std::vector>> || std::is_same_v, ifcopenshell::empty_aggregate> || std::is_same_v, ifcopenshell::empty_aggregate_of_aggregate> || std::is_same_v, ifcopenshell::blank>) { return ""; } else if constexpr (std::is_same_v, boost::logic::tribool>) { // @todo handle indeterminate diff --git a/src/serializers/svg_serializer.cpp b/src/serializers/svg_serializer.cpp index b45f2c9187..dbd98cc3cb 100644 --- a/src/serializers/svg_serializer.cpp +++ b/src/serializers/svg_serializer.cpp @@ -1627,7 +1627,7 @@ void svg_serializer::write(const geometry_data& data) { if (storey) { auto it = storey_hlr.find(storey); if (it == storey_hlr.end()) { - it = storey_hlr.insert({ storey, hlr_t(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, projection_plane) }).first; + it = storey_hlr.insert({ storey, hlr_engine(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, projection_plane) }).first; } it->second.add(*compound_to_hlr, data.product); for (auto& kv : classified_edge_buckets) { @@ -2188,7 +2188,7 @@ std::array, 3> svg_serializer::resize() { } void svg_serializer::draw_hlr(const gp_Pln& pln, const drawing_key& drawing_name) { - hlr_t& hlr_source = drawing_name.first ? this->storey_hlr.find(drawing_name.first)->second : *hlr; + hlr_engine& hlr_source = drawing_name.first ? this->storey_hlr.find(drawing_name.first)->second : *hlr; auto hlr_items = hlr_source.build(); // SVG edge classification (issue #3668): each item's class is already known -- it was @@ -2518,7 +2518,7 @@ void svg_serializer::finalize() { // @todo do we have always have pln here? if (use_hlr && pln) { - hlr = new hlr_t(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, *pln); + hlr = new hlr_engine(logger(), use_prefiltering_, use_hlr_poly_, segment_projection_, *pln); } section_data_ = std::vector{ sd }; diff --git a/src/serializers/svg_serializer.h b/src/serializers/svg_serializer.h index b9a464e5ae..bbb82d2f0a 100644 --- a/src/serializers/svg_serializer.h +++ b/src/serializers/svg_serializer.h @@ -552,7 +552,7 @@ namespace { }; } -typedef prefiltered_hlr hlr_t; +typedef prefiltered_hlr hlr_engine; class SERIALIZERS_API svg_serializer : public ifcopenshell::geom::write_only_geometry_serializer { public: @@ -602,7 +602,7 @@ protected: express::base storey_; std::multimap paths; std::map drawing_metadata; - std::map storey_hlr; + std::map storey_hlr; float_item_list xcoords, ycoords, radii; size_t xcoords_begin, ycoords_begin, radii_begin; @@ -611,7 +611,7 @@ protected: std::list element_buffer_; - hlr_t* hlr; + hlr_engine* hlr; std::string namespace_prefix_;