Skip to content
Snippets Groups Projects
Select Git revision
  • 298d74b3c28a96c6c074008e97a5db10fffd7604
  • master default protected
  • alphashapes
  • patch_releases_4_14
  • fix_alphaShapes
  • hierarchical-basis-refactor
  • hierarchical-basis
  • revert-ef4a3a4f
  • overlaps_tags_and_distributed_export
  • overlaps_tags_and_distributed_export_rebased
  • relaying
  • steplayer
  • bl
  • pluginMeshQuality
  • fixBugsAmaury
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • gmsh_4_14_1
  • gmsh_4_14_0
  • gmsh_4_13_1
  • gmsh_4_13_0
  • gmsh_4_12_2
  • gmsh_4_12_1
  • gmsh_4_12_0
  • gmsh_4_11_1
  • gmsh_4_11_0
  • gmsh_4_10_5
  • gmsh_4_10_4
  • gmsh_4_10_3
  • gmsh_4_10_2
  • gmsh_4_10_1
  • gmsh_4_10_0
  • gmsh_4_9_5
  • gmsh_4_9_4
  • gmsh_4_9_3
  • gmsh_4_9_2
  • gmsh_4_9_1
41 results

OCC_Connect.h

Blame
  • OCC_Connect.h 2.49 KiB
    // Gmsh - Copyright (C) 1997-2017 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <gmsh@onelab.info>.
    //
    // Contributed by Mark van Doesburg, Technolution B.V.
    
    #ifndef _OCC_CONNECT_H_
    #define _OCC_CONNECT_H_
    
    #include <stdlib.h>
    #include <math.h>
    #include <string.h>
    #include <deque>
    #include <map>
    #include <vector>
    #include <set>
    
    #include "GmshConfig.h"
    
    #if defined(HAVE_OCC)
    
    #include <Standard_Version.hxx>
    #if !defined(HAVE_NO_OCC_CONFIG_H) && (OCC_VERSION_MAJOR < 7)
    #include <config.h>
    #endif
    
    #include <TopoDS_Shape.hxx>
    #include <TopoDS_Edge.hxx>
    #include <TopoDS_Wire.hxx>
    #include <TopoDS_Face.hxx>
    #include <TopTools_IndexedMapOfShape.hxx>
    
    #include <BRep_Builder.hxx>
    #include <LocOpe_SplitShape.hxx>
    
    class OCC_Connect {
        struct LessThanIntegerSet {
            bool operator()(std::set<int> const &a, std::set<int> const &b) const;
        };
        typedef std::map<std::set<int>,std::set<int>,LessThanIntegerSet> mapping_t;
    
        class FaceCutters:public std::vector<TopoDS_Wire> {
            std::vector<TopoDS_Edge> edges;
            int rebuilt;
        public:
            FaceCutters(void) { rebuilt=0; }
            void Build(TopoDS_Face const &,TopoDS_Shape&,int);
            void Add(TopoDS_Edge const&);
        private:
            int FindConnectedEdge(int v, std::vector<int> &done,
                std::vector<std::vector<int> > &v_edge);
        };
        typedef std::map<int,FaceCutters> cutmap_t;
    
        std::deque<TopoDS_Shape> assembly;
    protected:
        int verbose;
    
    public:
        enum Verbose { Cutting=1, CuttingReject=4, CuttingIntermediate=8 };
        OCC_Connect(int v=0) { verbose=v; }
        int SaveBRep(char const *);
        void Connect(void);
        void Collect(void);
        void Add(TopoDS_Shape const &a) { assembly.push_back(a); }
        void Dump(std::ostream &) const;
        operator TopoDS_Shape(void) { return assembly.front(); }
    private:
        void MergeVertices(TopoDS_Shape&,TopoDS_Shape&) const;
        void MergeEdges(TopoDS_Shape&,TopoDS_Shape&) const;
        void MergeFaces(TopoDS_Shape&) const;
        void PerformBoolean(union tree*);
        void Intersect(BRep_Builder &BB, TopoDS_Shape &target,
            TopoDS_Shape &shape, TopoDS_Shape &tool);
        bool CanMergeCurve(TopoDS_Edge edge1,TopoDS_Edge edge2) const;
        bool CanMergeFace(TopoDS_Face face1,TopoDS_Face face2) const;
        void PrintItemCount(TopoDS_Shape const &shape) const;
        cutmap_t SelectCuttingEdges(TopTools_IndexedMapOfShape &edges,
            TopTools_IndexedMapOfShape &faces);
    };
    
    #endif
    
    #endif