Select Git revision
spherical_surf.py
-
Christophe Geuzaine authored
tutorial/ -> tutorials/
Christophe Geuzaine authoredtutorial/ -> tutorials/
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()