Skip to content
Snippets Groups Projects
Select Git revision
  • gmsh_4_13_0
  • master default protected
  • hierarchical-basis
  • alphashapes
  • bl
  • relaying
  • new_export_boris
  • oras_vs_osm
  • reassign_partitions
  • distributed_fwi
  • rename-classes
  • fix/fortran-api-example-t4
  • robust_partitions
  • reducing_files
  • fix_overlaps
  • 3115-issue-fix
  • 3023-Fillet2D-Update
  • convert_fdivs
  • tmp_jcjc24
  • fixedMeshIF
  • save_edges
  • gmsh_4_14_0
  • gmsh_4_13_1
  • 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
  • gmsh_4_9_0
40 results

spherical_surf.py

Blame
  • t3.f90 6.93 KiB
    ! ------------------------------------------------------------------------------
    !
    !  Gmsh Fortran tutorial 3
    !
    !  Extruded meshes, ONELAB parameters, options
    !
    ! ------------------------------------------------------------------------------
    program t3
    use, intrinsic :: iso_c_binding
    use gmsh
    
    implicit none
    type(gmsh_t) :: gmsh
    integer(c_int) :: i, r, g, b, a
    real(c_double) :: lc
    character(len=GMSH_API_MAX_STR_LEN), allocatable :: argv(:)
    
    allocate(argv(command_argument_count() + 1))
    do i = 0, size(argv) - 1
        call get_command_argument(i, argv(i+1))
        argv(i+1) = trim(argv(i+1))
    end do
    call gmsh%initialize(argv)
    
    ! Let us now change some options... Since all interactive options are accessible
    ! through the API, we can for example make point tags visible or redefine some
    ! colors:
    call gmsh%option%setNumber("Geometry.PointNumbers", 1d0)
    call gmsh%option%setColor("Geometry.Color.Points", 255, 165, 0)
    call gmsh%option%setColor("General.Color.Text", 255, 255, 255)
    call gmsh%option%setColor("Mesh.Color.Points", 255, 0, 0)
    
    ! Note that for conciseness "Color." can be omitted in color options:
    call gmsh%option%getColor("Geometry.Points", r, g, b, a)
    call gmsh%option%setColor("Geometry.Surfaces", r, g, b, a)
    
    ! We create a ONELAB parameter to define the angle of the twist. ONELAB
    ! parameters can be modified interactively in the GUI, and can be exchanged with
    ! other codes connected to the same ONELAB database. The database can be
    ! accessed through the Gmsh Fortran API using JSON-formatted strings (see
    ! https://gitlab.onelab.info/doc/tutorials/-/wikis/ONELAB-JSON-interface for
    ! more information):
    call gmsh%onelab%set('['//&
      '{'//&
        '"type":"number",'//&
        '"name":"Parameters/Twisting angle",'//&
        '"values":[90],'//&
        '"min":0,'//&
        '"max":120,'//&
        '"step":1'//&
      '}'//&
    ']')
    
    ! Create the geometry and mesh it:
    call createGeometryAndMesh()
    
    if (.not. any(argv == "-nopopup")) then
    call gmsh%fltk%initialize()
      do while (transfer(gmsh%fltk%isAvailable(), .true.) .and. checkForEvent())
        call gmsh%fltk%wait()
      end do
    end if
    
    ! When the GUI is launched, you can use the `Help->Current Options and
    ! Workspace' menu to see the current values of all options. To save the options
    ! in a file, use `File->Export->Gmsh Options', or through the api:
    
    ! gmsh%write("t3.opt");
    
    call gmsh%finalize()