From 1abe7472045a2099c70e2172d5cf8b98811177d7 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 26 Jun 2018 20:30:41 +0200 Subject: [PATCH] possibility to deallocate material.config parts --- src/config.f90 | 61 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/src/config.f90 b/src/config.f90 index 1fffbddcd..e97bfa3f8 100644 --- a/src/config.f90 +++ b/src/config.f90 @@ -77,10 +77,15 @@ module config MATERIAL_localFileExt = 'materialConfig' !< extension of solver job name depending material configuration file -public :: config_init + public :: & + config_init, & + config_deallocate contains +!-------------------------------------------------------------------------------------------------- +!> @brief reads material.config and stores its content per part +!-------------------------------------------------------------------------------------------------- subroutine config_init() #if defined(__GFORTRAN__) || __INTEL_COMPILER >= 1800 use, intrinsic :: iso_fortran_env, only: & @@ -109,13 +114,12 @@ subroutine config_init() line, & part - - myDebug = debug_level(debug_material) - write(6,'(/,a)') ' <<<+- config init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" + myDebug = debug_level(debug_material) + if (.not. IO_open_jobFile_stat(FILEUNIT,material_localFileExt)) & ! no local material configuration present... call IO_open_file(FILEUNIT,material_configFile) ! ...open material.config file @@ -164,7 +168,6 @@ subroutine config_init() material_Ntexture = size(textureConfig) if (material_Ntexture < 1_pInt) call IO_error(160_pInt,ext_msg=material_partTexture) - end subroutine config_init @@ -234,6 +237,54 @@ subroutine parseFile(line,& end subroutine parseFile +subroutine config_deallocate(what) + use IO, only: & + IO_error + + implicit none + character(len=*), intent(in) :: what + integer(pInt) :: i + + select case(what) + + case('material.config/phase') + do i=1, size(phaseConfig) + call phaseConfig(i)%free + enddo + deallocate(phaseConfig) + + case('material.config/microstructure') + do i=1, size(microstructureConfig) + call microstructureConfig(i)%free + enddo + deallocate(microstructureConfig) + + case('material.config/crystallite') + do i=1, size(crystalliteConfig) + call crystalliteConfig(i)%free + enddo + deallocate(crystalliteConfig) + + case('material.config/homogenization') + do i=1, size(homogenizationConfig) + call homogenizationConfig(i)%free + enddo + deallocate(homogenizationConfig) + + case('material.config/texture') + do i=1, size(textureConfig) + call textureConfig(i)%free + enddo + deallocate(textureConfig) + + case default + call IO_error(0_pInt,ext_msg='config_deallocate') + + end select + +end subroutine config_deallocate + + !-------------------------------------------------------------------------------------------------- !> @brief add element !> @details Adds a string together with the start/end position of chunks in this string. The new