leapUtils Module

Utilities for LEAP.

Currently implemented: - A utility that helps with file/directory operations - A utility to process filenames (removing extensions, paths,...) - Singly-linked lists - Hash table with chaining



Uses

  • module~~leaputils~~UsesGraph module~leaputils leapUtils module~leapkinds leapKinds module~leaputils->module~leapkinds iso_fortran_env iso_fortran_env module~leapkinds->iso_fortran_env

Used by

  • module~~leaputils~~UsedByGraph module~leaputils leapUtils module~collisions collisions module~collisions->module~leaputils module~leapmonitor leapMonitor module~collisions->module~leapmonitor module~leaptimer leapTimer module~collisions->module~leaptimer module~leapblock leapBlock module~collisions->module~leapblock module~particles_point particles_point module~collisions->module~particles_point module~particles_resolved particles_resolved module~collisions->module~particles_resolved module~immersed_boundaries immersed_boundaries module~collisions->module~immersed_boundaries module~leapbc leapBC module~leapbc->module~leaputils module~leapeulerian leapEulerian module~leapbc->module~leapeulerian module~leapbc->module~leapblock module~leapio leapIO module~leapbc->module~leapio module~leapeulerian->module~leaputils module~leapeulerian->module~leapblock module~leapeulerian->module~leapio module~leapio_hdf5 leapIO_hdf5 module~leapio_hdf5->module~leaputils module~leapio_silo leapIO_silo module~leapio_silo->module~leaputils module~leapio_xdmf leapIO_xdmf module~leapio_xdmf->module~leaputils module~leaplagrangian leapLagrangian module~leaplagrangian->module~leaputils module~leaplagrangian->module~leapblock module~leaplagrangian->module~leapio module~leapmonitor->module~leaputils module~leaptimer->module~leaputils proc~eulerian_set_readhdf5 eulerian_set%eulerian_set_ReadHDF5 proc~eulerian_set_readhdf5->module~leaputils proc~eulerian_set_writehdf5 eulerian_set%eulerian_set_WriteHDF5 proc~eulerian_set_writehdf5->module~leaputils proc~marker_set_readhdf5 marker_set%marker_set_ReadHDF5 proc~marker_set_readhdf5->module~leaputils proc~marker_set_writehdf5 marker_set%marker_set_WriteHDF5 proc~marker_set_writehdf5->module~leaputils proc~particle_set_readhdf5 particle_set%particle_set_ReadHDF5 proc~particle_set_readhdf5->module~leaputils proc~particle_set_writehdf5 particle_set%particle_set_WriteHDF5 proc~particle_set_writehdf5->module~leaputils proc~respart_set_readhdf5 ResPart_set%ResPart_set_ReadHDF5 proc~respart_set_readhdf5->module~leaputils proc~respart_set_writehdf5 ResPart_set%ResPart_set_WriteHDF5 proc~respart_set_writehdf5->module~leaputils proc~solid_set_readhdf5 solid_set%solid_set_ReadHDF5 proc~solid_set_readhdf5->module~leaputils proc~solid_set_writehdf5 solid_set%solid_set_WriteHDF5 proc~solid_set_writehdf5->module~leaputils module~cdifs cdifs module~cdifs->module~collisions module~cdifs->module~leapbc module~cdifs->module~leapeulerian module~cdifs->module~leapmonitor module~cdifs->module~leaptimer module~cdifs->module~leapblock module~leapdiffop leapDiffOp module~cdifs->module~leapdiffop module~leaphypre leapHypre module~cdifs->module~leaphypre module~cdifs->module~leapio module~leapsolver leapSolver module~cdifs->module~leapsolver module~cdifs->module~particles_resolved module~cdifs->module~immersed_boundaries module~grans grans module~grans->module~collisions module~grans->module~leapbc module~grans->module~leapeulerian module~grans->module~leapmonitor module~grans->module~leaptimer module~grans->module~leapblock module~grans->module~leapdiffop module~grans->module~leaphypre module~grans->module~leapio module~grans->module~leapsolver module~grans->module~particles_point module~grans->module~particles_resolved module~grans->module~immersed_boundaries module~immersed_boundaries_markers immersed_boundaries_markers module~immersed_boundaries_markers->module~leapbc module~immersed_boundaries_markers->module~leapeulerian module~immersed_boundaries_markers->module~leaplagrangian module~immersed_boundaries_markers->module~leapmonitor module~immersed_boundaries_markers->module~leaptimer module~immersed_boundaries_markers->module~leapblock module~immersed_boundaries_markers->module~leapdiffop module~immersed_boundaries_markers->module~leaphypre module~immersed_boundaries_markers->module~leapio module~immersed_boundaries_solids immersed_boundaries_solids module~immersed_boundaries_solids->module~leapeulerian module~immersed_boundaries_solids->module~leaplagrangian module~immersed_boundaries_solids->module~immersed_boundaries_markers module~immersed_boundaries_solids->module~leapblock module~immersed_boundaries_solids->module~leapio module~leapblock->module~leapio_hdf5 module~leapdiffop->module~leapbc module~leapdiffop->module~leapeulerian module~leapdiffop->module~leapblock module~leaphypre->module~leapeulerian module~leaphypre->module~leapblock module~leapio->module~leapio_hdf5 module~leapio->module~leapio_silo module~leapio->module~leapio_xdmf module~leapio_h5hut leapIO_h5hut module~leapio->module~leapio_h5hut module~leapio_h5hut->module~leapio_hdf5 module~leapsolver->module~leaptimer module~leapsolver->module~leapio module~particles_point->module~leapeulerian module~particles_point->module~leaplagrangian module~particles_point->module~leapmonitor module~particles_point->module~leaptimer module~particles_point->module~leapblock module~particles_point->module~leapdiffop module~particles_point->module~leapio module~particles_point->module~immersed_boundaries module~particles_resolved->module~leapbc module~particles_resolved->module~leapeulerian module~particles_resolved->module~leaplagrangian module~particles_resolved->module~leapmonitor module~particles_resolved->module~leaptimer module~particles_resolved->module~leapblock module~particles_resolved->module~leapdiffop module~particles_resolved->module~leapio module~particles_resolved->module~immersed_boundaries proc~bc_set_buildmask bc_set%bc_set_BuildMask proc~bc_set_buildmask->module~leapeulerian proc~cdifs_obj_preparesolverbodyforce cdifs_obj_PrepareSolverBodyforce proc~cdifs_obj_preparesolverbodyforce->module~leapbc proc~cdifs_obj_preparesolveroperators cdifs_obj_PrepareSolverOperators proc~cdifs_obj_preparesolveroperators->module~leapbc proc~cdifs_obj_preparesolveroperatorsdiv cdifs_obj_PrepareSolverOperatorsDIV proc~cdifs_obj_preparesolveroperatorsdiv->module~leapbc proc~cdifs_obj_preparesolveroperatorspgrad cdifs_obj_PrepareSolverOperatorsPGRAD proc~cdifs_obj_preparesolveroperatorspgrad->module~leapbc proc~cdifs_obj_preparesolveroperatorsvlap cdifs_obj_PrepareSolverOperatorsVLAP proc~cdifs_obj_preparesolveroperatorsvlap->module~leapbc program~main main program~main->module~leaptimer program~main->module~cdifs program~main->module~grans program~main->module~leapio program~main->module~leapsolver module~cdifs_advancesolution_smod cdifs_AdvanceSolution_smod module~cdifs_advancesolution_smod->module~cdifs module~cdifs_monitor_smod cdifs_Monitor_smod module~cdifs_monitor_smod->module~cdifs module~cdifs_preparesolver_smod cdifs_PrepareSolver_smod module~cdifs_preparesolver_smod->module~cdifs module~cdifs_writeoutputdata_smod cdifs_WriteOutputData_smod module~cdifs_writeoutputdata_smod->module~cdifs module~cdifs_writerestartdata_smod cdifs_WriteRestartData_smod module~cdifs_writerestartdata_smod->module~cdifs module~grans_advancesolution_smod grans_AdvanceSolution_smod module~grans_advancesolution_smod->module~grans module~grans_module_smod grans_module_smod module~grans_module_smod->module~grans module~grans_preparesolver_smod grans_PrepareSolver_smod module~grans_preparesolver_smod->module~grans module~grans_writeoutputdata_smod grans_WriteOutputData_smod module~grans_writeoutputdata_smod->module~grans module~grans_writerestartdata_smod grans_WriteRestartData_smod module~grans_writerestartdata_smod->module~grans module~immersed_boundaries->module~immersed_boundaries_markers module~immersed_boundaries->module~immersed_boundaries_solids proc~collision_obj_setupcollisionblock2 collision_obj%collision_obj_SetupCollisionBlock2 proc~collision_obj_setupcollisionblock2->module~leapblock proc~grans_obj_preparesolveroperators grans_obj_PrepareSolverOperators proc~grans_obj_preparesolveroperators->module~leapdiffop proc~marker_set_computesolidvolfrac marker_set%marker_set_ComputeSolidVolFrac proc~marker_set_computesolidvolfrac->module~leapdiffop

Derived Types

type, public ::  hashtbl_obj

A hash table. E.g. of a hash table with vec_len=4

Read more…

Components

Type Visibility Attributes Name Initial
type(sllist_obj), public, allocatable :: vec(:)
integer, public :: vec_len = 0

Type-Bound Procedures

procedure, public :: Finalize => hashtbl_obj_Final
generic, public :: Get => hashtbl_obj_Get_int4, hashtbl_obj_Get_int8, hashtbl_obj_Get_real_sp, hashtbl_obj_Get_real_dp
procedure, public, nopass :: HashString => hashtbl_obj_HashString
procedure, public :: Initialize => hashtbl_obj_Init
procedure, public :: Print => hashtbl_obj_Print
procedure, public :: Put => hashtbl_obj_Put
procedure, public :: Remove => hashtbl_obj_Remove
procedure, private :: hashtbl_obj_Get_int4
procedure, private :: hashtbl_obj_Get_int8
procedure, private :: hashtbl_obj_Get_real_dp
procedure, private :: hashtbl_obj_Get_real_sp

type, public ::  sllist_obj

Singly-linked list. Defines a sequence of key-value pairs E.g.: with 4 nodes key1 --> key2 --> key3 --> key4 --> nul() | | | | val1 val2 val3 val4

Components

Type Visibility Attributes Name Initial
type(sllist_obj), public, pointer :: child => null()
integer, public :: key = -1
class(*), public, allocatable :: val

Type-Bound Procedures

procedure, public :: Free => sllist_obj_Free
generic, public :: Get => sllist_obj_Get_int4, sllist_obj_Get_int8, sllist_obj_Get_real_sp, sllist_obj_Get_real_dp
procedure, public :: Put => sllist_obj_Put
procedure, public :: Remove => sllist_obj_Remove
procedure, private :: sllist_obj_Get_int4
procedure, private :: sllist_obj_Get_int8
procedure, private :: sllist_obj_Get_real_dp
procedure, private :: sllist_obj_Get_real_sp

type, public ::  stringtool_obj

A utility to help with parsing and reformating strings.

Type-Bound Procedures

procedure, public, nopass :: RemoveExtension => stringtool_obj_RemoveExtension
procedure, public, nopass :: RemovePath => stringtool_obj_RemovePath

type, public ::  sysutils_obj

A utility to help with file and directory operations.

Type-Bound Procedures

procedure, public, nopass :: CreateDirectory => sysutils_obj_CreateDirectory
procedure, public, nopass :: DeleteDirectory => sysutils_obj_DeleteDirectory
procedure, public, nopass :: DeleteFile => sysutils_obj_DeleteFile
procedure, public, nopass :: DirectoryExists => sysutils_obj_DirectoryExists
procedure, public, nopass :: FileExists => sysutils_obj_FileExists

Functions

private pure function hashtbl_obj_HashString(str) result(val)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str

String to hash

Return Value integer

Returned hash

private pure function stringtool_obj_RemoveExtension(filename) result(val)

Removes file extension from filename while preserving scientific notation and dots in paths.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

File name

Return Value character(len=:), allocatable

Returned string with extension removed

private pure function stringtool_obj_RemovePath(filename) result(val)

Removes path from filename.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

File name

Return Value character(len=:), allocatable

Returned string with path removed

private impure function sysutils_obj_DirectoryExists(dirname) result(val)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: dirname

Directory name

Return Value logical

private impure function sysutils_obj_FileExists(filename) result(val)

Checks whether a file exists.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

File name

Return Value logical


Subroutines

private pure subroutine hashtbl_obj_Final(this)

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(inout) :: this

Hashtable object

private pure subroutine hashtbl_obj_Get_int4(this, key, val)

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(in) :: this

Hashtable object

integer, intent(in) :: key

Key from key-val pair to retrieve from hashtable

integer(kind=leapI4), intent(out) :: val

Val from key-val pair to retrieve from hashtable

private pure subroutine hashtbl_obj_Get_int8(this, key, val)

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(in) :: this

Hashtable object

integer, intent(in) :: key

Key from key-val pair to retrieve from hashtable

integer(kind=leapI8), intent(out) :: val

Val from key-val pair to retrieve from hashtable

private pure subroutine hashtbl_obj_Get_real_dp(this, key, val)

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(in) :: this

Hashtable object

integer, intent(in) :: key

Key from key-val pair to retrieve from hashtable

real(kind=leapDP), intent(out) :: val

Val from key-val pair to retrieve from hashtable

private pure subroutine hashtbl_obj_Get_real_sp(this, key, val)

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(in) :: this

Hashtable object

integer, intent(in) :: key

Key from key-val pair to retrieve from hashtable

real(kind=leapSP), intent(out) :: val

Val from key-val pair to retrieve from hashtable

private pure subroutine hashtbl_obj_Init(this, tbl_len)

Initializes the hashtable.

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(inout) :: this

Hashtable object

integer, intent(in) :: tbl_len

Hashtable vector length

private impure subroutine hashtbl_obj_Print(this)

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(inout), target :: this

Hashtable object

private pure subroutine hashtbl_obj_Put(this, key, val)

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(inout) :: this

Hashtable object

integer, intent(in) :: key

Key from key-val pair to add in hashtable

class(*), intent(in) :: val

Val from key-val pair to add in hashtable

private pure subroutine hashtbl_obj_Remove(this, key)

Arguments

Type IntentOptional Attributes Name
class(hashtbl_obj), intent(inout) :: this

Hashtable object

integer, intent(in) :: key

Key from key-val pair to remove from hashtable

private pure recursive subroutine sllist_obj_Free(this)

Free all data associated with this list.

Arguments

Type IntentOptional Attributes Name
class(sllist_obj), intent(inout) :: this

List object

private pure recursive subroutine sllist_obj_Get_int4(this, key, val)

Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.

Arguments

Type IntentOptional Attributes Name
class(sllist_obj), intent(in) :: this

list object

integer, intent(in) :: key

Key in list

integer(kind=leapI4), intent(out) :: val

Value associated with key to return

private pure recursive subroutine sllist_obj_Get_int8(this, key, val)

Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.

Arguments

Type IntentOptional Attributes Name
class(sllist_obj), intent(in) :: this

List object

integer, intent(in) :: key

Key in list

integer(kind=leapI8), intent(out) :: val

Value associated with key to return

private pure recursive subroutine sllist_obj_Get_real_dp(this, key, val)

Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.

Arguments

Type IntentOptional Attributes Name
class(sllist_obj), intent(in) :: this

List object

integer, intent(in) :: key

Key in list

real(kind=leapDP), intent(out) :: val

Value associated with key to return

private pure recursive subroutine sllist_obj_Get_real_sp(this, key, val)

Traverse the list until key is found. Returns the associated value to the key, or -1 if key not found.

Arguments

Type IntentOptional Attributes Name
class(sllist_obj), intent(in) :: this

List object

integer, intent(in) :: key

Key in list

real(kind=leapSP), intent(out) :: val

Value associated with key to return

private pure recursive subroutine sllist_obj_Put(this, key, val)

Adds a pair key-value to the list.

Arguments

Type IntentOptional Attributes Name
class(sllist_obj), intent(inout) :: this

List object

integer, intent(in) :: key

Key in key-val pair to add to list

class(*), intent(in) :: val

Val in key-val pair to add to list

private pure subroutine sllist_obj_Remove(this, key)

Remove key-value pair from list.

Arguments

Type IntentOptional Attributes Name
class(sllist_obj), intent(inout), target :: this

List object

integer, intent(in) :: key

Key of key-val pair to remove

private impure subroutine sysutils_obj_CreateDirectory(dirname)

Creates a directory using system commands.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: dirname

Directory name

private impure subroutine sysutils_obj_DeleteDirectory(dirname)

Deletes a directory using system commands.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: dirname

Directory name

private impure subroutine sysutils_obj_DeleteFile(filename)

Deletes a file.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

File name