Skip to content
Snippets Groups Projects
Select Git revision
  • 44c0ffb045dd814cccd85811bb5c012a80e9e910
  • 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

t7.cpp

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    t7.cpp 1.07 KiB
    // This file reimplements gmsh/tutorial/t7.geo in C++.
    //
    // Background mesh
    
    #include <gmsh.h>
    
    namespace model = gmsh::model;
    namespace factory = gmsh::model::geo;
    
    int main(int argc, char **argv)
    {
      gmsh::initialize();
      gmsh::option::setNumber("General.Terminal", 1);
    
      model::add("t7");
    
      // Copied from t1.cpp...
      double lc = 1e-2;
      factory::addPoint(0, 0, 0, lc, 1);
      factory::addPoint(.1, 0,  0, lc, 2);
      factory::addPoint(.1, .3, 0, lc, 3);
      factory::addPoint(0,  .3, 0, lc, 4);
      factory::addLine(1, 2, 1);
      factory::addLine(3, 2, 2);
      factory::addLine(3, 4, 3);
      factory::addLine(4, 1, 4);
      factory::addCurveLoop({4, 1, -2, 3}, 1);
      factory::addPlaneSurface({1}, 1);
      factory::synchronize();
    
      // add the background mesh file as a view
      gmsh::merge("../t7_bgmesh.pos");
    
      // add the post-processing view as a new size field
      int bg_field = model::mesh::field::add("PostView");
      model::mesh::field::setAsBackgroundMesh(bg_field);
    
      model::mesh::generate(2);
      gmsh::write("t7.msh");
    
      // show the mesh file
      gmsh::fltk::run();
    
      gmsh::finalize();
      return 0;
    }