gmsh_msh1_reader Module

Fortran module for reading Gmsh MSH file format version 1


Uses

  • module~~gmsh_msh1_reader~~UsesGraph module~gmsh_msh1_reader gmsh_msh1_reader ieee_arithmetic ieee_arithmetic module~gmsh_msh1_reader->ieee_arithmetic iso_fortran_env iso_fortran_env module~gmsh_msh1_reader->iso_fortran_env

Variables

Type Visibility Attributes Name Initial
character(len=*), private, parameter :: elm_section_footer = '$ENDELM'
character(len=*), private, parameter :: elm_section_header = '$ELM'
logical, private, parameter :: initial_flag_allocation_elements = .false.

Whether allocated the array to read elements (Initial value)

logical, private, parameter :: initial_flag_allocation_nodes = .false.

Whether allocated the array to read nodes (Initial value)

logical, private, parameter :: initial_flag_deallocation_elements = .false.

Whether deallocated the array to read elements (Initial value)

logical, private, parameter :: initial_flag_deallocation_nodes = .false.

Whether deallocated the array to read nodes (Initial value)

logical, private, parameter :: initial_flag_elm_section_footer = .false.

Whether found the element section footer
(Initial value)

logical, private, parameter :: initial_flag_elm_section_header = .false.

Whether found the element section header
(Initial value)

logical, private, parameter :: initial_flag_nod_section_footer = .false.

Whether found the node section footer
(Initial value)

logical, private, parameter :: initial_flag_nod_section_header = .false.

Whether found the node section header
(Initial value)

logical, private, parameter :: initial_flag_number_of_elements = .false.

Whether found the number of elements
(Initial value)

logical, private, parameter :: initial_flag_number_of_nodes = .false.

Whether found the number of nodes
(Initial value)

logical, private, parameter :: initial_flag_reading_elements = .false.

Whether the read was successful: element (Initial value)

logical, private, parameter :: initial_flag_reading_node = .false.

Whether the read was successful: node (Initial value)

integer, private, parameter :: iostat_success = 0

iostat value when an I/O statement executes successfully

integer, private, parameter :: msg_len = 512

message length

character(len=*), private, parameter :: nod_section_footer = '$ENDNOD'
character(len=*), private, parameter :: nod_section_header = '$NOD'
integer, private, parameter :: stat_success = 0

stat value when a statement executes successfully


Interfaces

public interface export_node_number

Get the gmsh_msh1_node_number_type from the gmsh_msh1_node_type (as integer).

public interface export_node_number_list

Get the node_number_list from the gmsh_msh1_element_type (as integer).

public interface is_invalid

Checks if the read gmsh_msh1_data_type is invalid.

public interface lookup_element

public interface lookup_node

public interface operator(.eq.)

public interface output_elm_number

public interface output_elm_type

Get the elm_type from the gmsh_msh1_element_type.

public interface output_node_number

Get the gmsh_msh1_node_number_type from the gmsh_msh1_node_type (as derived type).

public interface output_node_number_list

Get the node_number_list from the gmsh_msh1_element_type (as derived type).

public interface output_number_of_elements

Get the number of gmsh_msh1_element_types in the gmsh_msh1_data_type.

public interface output_number_of_nodes

Get the number of gmsh_msh1_node_types.

public interface output_reg_elem

Get the reg_elem from the gmsh_msh1_element_type.

public interface output_reg_phys

Get the reg_phys from the gmsh_msh1_element_type.

public interface output_x_coord

Get the x_coord from the gmsh_msh1_node_type.

public interface output_y_coord

Get the y_coord from the gmsh_msh1_node_type.

public interface output_z_coord

Get the z_coord from the gmsh_msh1_node_type.


Derived Types

type, public ::  gmsh_msh1_data_type

Derived type to for reading Gmsh MSH file format version 1

Components

Type Visibility Attributes Name Initial
type(gmsh_msh1_element_type), private, allocatable, dimension(:) :: element

the elements in the mesh

logical, private :: flag_allocation_elements = initial_flag_allocation_elements

Whether allocated the array to read elements

logical, private :: flag_allocation_nodes = initial_flag_allocation_nodes

Whether allocated the array to read nodes

logical, private :: flag_deallocation_elements = initial_flag_deallocation_elements

Whether deallocated the array to read elements

logical, private :: flag_deallocation_nodes = initial_flag_deallocation_nodes

Whether deallocated the array to read nodes

logical, private :: flag_elm_section_footer = initial_flag_elm_section_footer

Whether found the element section footer

logical, private :: flag_elm_section_header = initial_flag_elm_section_header

Whether found the element section header

logical, private :: flag_nod_section_footer = initial_flag_nod_section_footer

Whether found the node section footer

logical, private :: flag_nod_section_header = initial_flag_nod_section_header

Whether found the node section header

logical, private :: flag_number_of_elements = initial_flag_number_of_elements

Whether found the number of elements

logical, private :: flag_number_of_nodes = initial_flag_number_of_nodes

Whether found the number of nodes

logical, private :: flag_reading_elements = initial_flag_reading_elements

Whether the read was successful: element

logical, private :: flag_reading_nodes = initial_flag_reading_node

Whether the read was successful: node

type(gmsh_msh1_node_type), private, allocatable, dimension(:) :: node

the nodes in the mesh

type(gmsh_msh1_status_type), private :: status

type, public ::  gmsh_msh1_element_type

Derived type to for reading the n-th element in the Gmsh MSH file format version 1

Read more…

Components

Type Visibility Attributes Name Initial
integer, private :: elm_number

the number (index) of the n-th element in the mesh

integer, private :: elm_type

the geometrical type of the n-th element in the mesh

type(gmsh_msh1_node_number_type), private, allocatable, dimension(:) :: node_number_list

the list of the number_of_nodes node numbers of the n-th element.

integer, private :: reg_elem

the tag of the elementary entity to which the element belongs

integer, private :: reg_phys

the tag of the physical entity to which the element belongs

type, public ::  gmsh_msh1_node_number_type

Derived type to for reading the number (index) of the n-th node in the mesh.

Read more…

Components

Type Visibility Attributes Name Initial
integer, private :: number

type, public ::  gmsh_msh1_node_type

Derived type to for reading the n-th node in the Gmsh MSH file format version 1

Components

Type Visibility Attributes Name Initial
type(gmsh_msh1_node_number_type), private :: node_number

the number (index) of the n-th node in the mesh.

real(kind=real64), private :: x_coord

The floating point values giving the X coordinates of the n-th node.

real(kind=real64), private :: y_coord

The floating point values giving the Y coordinates of the n-th node.

real(kind=real64), private :: z_coord

The floating point values giving the Z coordinates of the n-th node.

type, private ::  gmsh_msh1_status_type

Components

Type Visibility Attributes Name Initial
type(gmsh_msh1_status_unit_type), public :: err
type(gmsh_msh1_status_unit_type), public :: io

type, private ::  gmsh_msh1_status_unit_type

Components

Type Visibility Attributes Name Initial
integer, public :: code
character(len=msg_len), public :: msg

Functions

private elemental function all_flag(mesh_data)

License
MIT
Version
experimental

If any of the flags is .false., it indicates that the file read operation failed.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(in) :: mesh_data

Return Value logical

private elemental function export_node_number_gmsh_msh1_node(node) result(node_number)

License
MIT
Version
experimental

Get the gmsh_msh1_node_number_type from the gmsh_msh1_node_type (as integer).

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_node_type), intent(in) :: node

Return Value integer

private pure function export_node_number_list_gmsh_msh1_element(element) result(node_number_list)

License
MIT
Version
experimental

Get the node_number_list from the gmsh_msh1_element_type (as integer).

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(in) :: element

Return Value integer, dimension( output_number_of_nodes(element) )

private elemental function is_equal_gmsh_msh1_node_number_type(number1, number2) result(is_equal)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_node_number_type), intent(in) :: number1
type(gmsh_msh1_node_number_type), intent(in) :: number2

Return Value logical

private elemental function is_invalid_gmsh_msh1_file(mesh_data)

License
MIT
Version
experimental

Checks if the read gmsh_msh1_data_type is invalid.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(in) :: mesh_data

Return Value logical

private elemental function is_iostat_failure(status)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_status_type), intent(in) :: status

Return Value logical

private elemental function is_iostat_success(status)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_status_type), intent(in) :: status

Return Value logical

private elemental function is_stat_failure(status)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_status_type), intent(in) :: status

Return Value logical

private elemental function lookup_node_by_loc_gmsh_msh1_file(mesh_data, location) result(node)

License
MIT
Version
experimental

Look up a gmsh_msh1_node_type in the gmsh_msh1_data_type.

Read more…

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(in) :: mesh_data
integer, intent(in) :: location

location in node

Return Value type(gmsh_msh1_node_type)

private elemental function lookup_node_by_num_gmsh_msh1_file(mesh_data, node_number) result(node)

License
MIT
Version
experimental

Look up a gmsh_msh1_node_type in the gmsh_msh1_data_type.

Read more…

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(in) :: mesh_data
type(gmsh_msh1_node_number_type), intent(in) :: node_number

Return Value type(gmsh_msh1_node_type)

private elemental function output_elm_number_gmsh_msh1_element(element) result(elm_number)

License
MIT
Version
experimental

Get the elm_number from the gmsh_msh1_element_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(in) :: element

Return Value integer

private elemental function output_elm_type_gmsh_msh1_element(element) result(elm_type)

License
MIT
Version
experimental

Get the elm_type from the gmsh_msh1_element_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(in) :: element

Return Value integer

private elemental function output_node_number_gmsh_msh1_element(element, location) result(node_number)

License
MIT
Version
experimental

Get the gmsh_msh1_node_number_type from the gmsh_msh1_node_type (as derived type).

Read more…

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(in) :: element
integer, intent(in) :: location

location in node_number_list

Return Value type(gmsh_msh1_node_number_type)

private elemental function output_node_number_gmsh_msh1_node(node) result(node_number)

License
MIT
Version
experimental

Get the gmsh_msh1_node_number_type from the gmsh_msh1_node_type (as derived type).

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_node_type), intent(in) :: node

Return Value type(gmsh_msh1_node_number_type)

private pure function output_node_number_list_gmsh_msh1_element(element) result(node_number_list)

License
MIT
Version
experimental

Get the node_number_list from the gmsh_msh1_element_type (as derived type).

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(in) :: element

Return Value type(gmsh_msh1_node_number_type), dimension( output_number_of_nodes(element) )

private elemental function output_number_of_elements_gmsh_msh1_file(mesh_data) result(number_of_elements)

License
MIT
Version
experimental

Get the number of gmsh_msh1_element_types in the gmsh_msh1_data_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(in) :: mesh_data

Return Value integer

private elemental function output_number_of_nodes_gmsh_msh1_element(element) result(number_of_nodes)

License
MIT
Version
experimental

Get the number of gmsh_msh1_node_types in the gmsh_msh1_element_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(in) :: element

Return Value integer

private elemental function output_number_of_nodes_gmsh_msh1_file(mesh_data) result(number_of_nodes)

License
MIT
Version
experimental

Get the number of gmsh_msh1_node_types in the gmsh_msh1_data_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(in) :: mesh_data

Return Value integer

private elemental function output_reg_elem_gmsh_msh1_element(element) result(reg_elem)

License
MIT
Version
experimental

Get the reg_elem from the gmsh_msh1_element_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(in) :: element

Return Value integer

private elemental function output_reg_phys_gmsh_msh1_element(element) result(reg_phys)

License
MIT
Version
experimental

Get the reg_phys from the gmsh_msh1_element_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(in) :: element

Return Value integer

private elemental function output_x_coord_gmsh_msh1_node(node) result(x_coord)

License
MIT
Version
experimental

Get the x_coord from the gmsh_msh1_node_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_node_type), intent(in) :: node

Return Value real(kind=real64)

private elemental function output_y_coord_gmsh_msh1_node(node) result(y_coord)

License
MIT
Version
experimental

Get the y_coord from the gmsh_msh1_node_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_node_type), intent(in) :: node

Return Value real(kind=real64)

private elemental function output_z_coord_gmsh_msh1_node(node) result(z_coord)

License
MIT
Version
experimental

Get the z_coord from the gmsh_msh1_node_type.

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_node_type), intent(in) :: node

Return Value real(kind=real64)


Subroutines

public subroutine read_gmsh_msh1_file(mesh_data, msh1_file)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(inout) :: mesh_data

The read data will be stored in this argument

character(len=*), intent(in) :: msh1_file

File path to read from

public subroutine write_stat_msg_gmsh_msh1_file(mesh_data, write_unit)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(in) :: mesh_data
integer, intent(in) :: write_unit

private subroutine clear_msg(msg)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
character(len=msg_len), intent(inout) :: msg

private subroutine initialize_gmsh_msh1_element(element, stat, errmsg)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_element_type), intent(inout) :: element
integer, intent(out) :: stat
character(len=*), intent(inout) :: errmsg

private elemental subroutine initialize_gmsh_msh1_node(node)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_node_type), intent(out) :: node

private elemental subroutine initialize_gmsh_msh1_node_number(node_number)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_node_number_type), intent(out) :: node_number

private subroutine lookup_element_by_loc_gmsh_msh1_file(mesh_data, location, element, stat, errmsg)

License
MIT
Version
experimental

Look up a gmsh_msh1_element_type in the gmsh_msh1_data_type.

Read more…

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(in) :: mesh_data
integer, intent(in) :: location

location in element

type(gmsh_msh1_element_type), intent(inout) :: element
integer, intent(out) :: stat
character(len=*), intent(inout) :: errmsg

private subroutine read_gmsh_msh1_element(file_unit, itr_element, text_line, element, status, flag)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: file_unit
integer, intent(in) :: itr_element
character(len=*), intent(inout) :: text_line
type(gmsh_msh1_element_type), intent(inout) :: element
type(gmsh_msh1_status_type), intent(inout) :: status
logical, intent(out) :: flag

private subroutine read_gmsh_msh1_file_kernel(mesh_data, file_unit)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
type(gmsh_msh1_data_type), intent(inout) :: mesh_data

The read data will be stored in this argument

integer, intent(in) :: file_unit

private subroutine read_gmsh_msh1_header_footer(file_unit, header_footer, text_line, status, flag)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: file_unit
character(len=*), intent(in) :: header_footer
character(len=*), intent(inout) :: text_line
type(gmsh_msh1_status_type), intent(inout) :: status
logical, intent(out) :: flag

private subroutine read_gmsh_msh1_node(file_unit, itr_node, node, status)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: file_unit
integer, intent(in) :: itr_node
type(gmsh_msh1_node_type), intent(out) :: node
type(gmsh_msh1_status_type), intent(inout) :: status

private subroutine read_gmsh_msh1_number_of_items(file_unit, item_name, text_line, number_of_items, status, flag)

License
MIT
Version
experimental

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: file_unit
character(len=*), intent(in) :: item_name
character(len=*), intent(inout) :: text_line
integer, intent(out) :: number_of_items
type(gmsh_msh1_status_type), intent(inout) :: status
logical, intent(out) :: flag