Skip to main content

GmshModel example 1

Following methods of [[GmshModel_]] are tested:

  • [[GmshModel_#Add]]
  • [[GmshModel_#List]]
  • [[GmshModel_#GetCurrent]]
  • [[GmshModel_#SetCurrent]]
  • [[GmshModel_#SetFilename]]
  • [[GmshModel_#GetFilename]]
  • [[GmshModel_#Remove]]

Usage

PROGRAM main
use easifemBase
use easifemClasses

!!! note "declare variables"

  type(gmsh_) :: gmsh
  • Instance of [[Gmsh_]] engine
  integer(i4b) :: ierr, names_n
type(string), allocatable :: names(:)
character(gmsh_api_max_str_len) :: name
type(string), allocatable :: strs(:)

!!! note "Gmsh/Initialize"

  ierr = gmsh%initialize()

!!! note "GmshModel/Add"

  ierr = gmsh%model%add("t1")
ierr = gmsh%model%add("t2")
ierr = gmsh%model%add("t3")

!!! note "GmshModel/List"

  block
INTEGER( I4B ) :: ii
ierr = gmsh%model%list(names)
call display( ierr, "size of names = ")
do ii = 1, ierr
call display( names(ii), "names = ")
end do
end block

!!! note "GmshModel/GetCurrent"

  ierr = gmsh%model%getCurrent(name)
call display(name, 'name: ')

!!! note "GmshModel/SetCurrent"

  ierr = gmsh%model%setCurrent('t1')
ierr = gmsh%model%getCurrent(name)
call display(name, 'name: ')

!!! note "GmshModel/SetFileName"

  ierr = gmsh%model%setFileName('t1.geo')

!!! note "GmshModel/GetFileName"

  ierr = gmsh%model%getFileName(name)
call display(name, 'name: ')

!!! note "GmshModel/Remove"

  ierr = gmsh%model%remove()

!!! note "Gmsh/Clear"

  ierr = gmsh%clear()

!!! note "Gmsh/Finalize"

  ierr = gmsh%finalize()
END PROGRAM main