Skip to content
Snippets Groups Projects
Select Git revision
  • 0c50beef37d2b28e55a2f3b3a756c5ad8647a342
  • master default protected
  • alphashapes
  • quadMeshingTools
  • cygwin_conv_path
  • macos_arm64
  • add-transfiniteautomatic-to-geo
  • patch_releases_4_10
  • HierarchicalHDiv
  • isuruf-master-patch-63355
  • hyperbolic
  • hexdom
  • hxt_update
  • jf
  • 1618-pythonocc-and-gmsh-api-integration
  • octreeSizeField
  • hexbl
  • alignIrregularVertices
  • getEdges
  • patch_releases_4_8
  • isuruf-master-patch-51992
  • 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
  • gmsh_4_9_0
  • gmsh_4_8_4
  • gmsh_4_8_3
  • gmsh_4_8_2
  • gmsh_4_8_1
  • gmsh_4_8_0
  • gmsh_4_7_1
  • gmsh_4_7_0
41 results

driverOCC.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    driverOCC.cpp 1.32 KiB
    // g++ -I/usr/local/opencascade/inc driverOCC.cpp -lGmsh -L/usr/local/opencascade/lib -lTKSTEP -lTKSTEP209 -lTKSTEPAttr -lTKSTEPBase -lTKIGES -lTKXSBase -lTKOffset -lTKFeat -lTKFillet -lTKBool -lTKShHealing -lTKMesh -lTKHLR -lTKBO -lTKPrim -lTKTopAlgo -lTKGeomAlgo -lTKBRep -lTKGeomBase -lTKG3d -lTKG2d -lTKAdvTools -lTKMath -lTKernel -lm
    
    #if !defined(WIN32) || defined(__CYGWIN__)
    #include "config.h"
    #endif
    #include "TopoDS_Shape.hxx"
    #include "BRep_Tool.hxx"
    #include "BRep_Builder.hxx"
    #include "BRepTools.hxx"
    
    #include <stdio.h>
    #include <gmsh/Gmsh.h>
    #include <gmsh/GModel.h>
    #include <gmsh/MElement.h>
    
    int main(int argc, char **argv)
    {
      // create an OCC shape (by loading it from a brep file)
      TopoDS_Shape shape;
      BRep_Builder builder;
      BRepTools::Read(shape, argv[1], builder);
      BRepTools::Clean(shape);
    
      // import the shape in gmsh and mesh it
      GmshInitialize(argc, argv);
      GModel *m = new GModel();
      m->importOCCShape((void*)&shape, 0);
      m->mesh(2);
      for(GModel::riter it = m->firstRegion(); it != m->lastRegion(); ++it){
        GRegion *r = *it;
        printf("volume %d contains %d elements:\n", r->tag(), r->getNumMeshElements());
        for(unsigned int i = 0; i < r->getNumMeshElements(); i++)
          printf(" %d", r->getMeshElement(i)->getNum());
        printf("\n");
      }
      m->writeMSH("test.msh");
      delete m;
      GmshFinalize();
    }