list does tokenizing automatically

This commit is contained in:
Martin Diehl 2018-06-10 11:07:17 +02:00
parent 08a4da01e0
commit f8ae0ec925
4 changed files with 32 additions and 18 deletions

View File

@ -1,3 +1,10 @@
!--------------------------------------------------------------------------------------------------
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
!> @brief Reads in the material configuration from file
!> @details Reads the material configuration file, where solverJobName.materialConfig takes
!! precedence over material.config. Stores the raw strings and the positions of delimiters for the
!! parts 'homogenization', 'crystallite', 'phase', 'texture', and 'microstucture'
!--------------------------------------------------------------------------------------------------
module config_material
use chained_list
use prec, only: &
@ -189,7 +196,7 @@ subroutine parseFile(partLabel,part,fileUnit,nextLine)
tag = IO_lc(IO_stringValue(trim(line),chunkPos,1_pInt)) ! extract key
inSection: if (h > 0_pInt) then
chunkPos = IO_stringPos(line)
call homogenizationConfig(h)%add(IO_lc(trim(line)),chunkPos)
call part(h)%add(IO_lc(trim(line)))
else inSection
echo = (trim(tag) == '/echo/')
endif inSection

View File

@ -42,18 +42,24 @@ contains
!> @brief add element
!> @details adds raw string and start/end position of chunks in this string
!--------------------------------------------------------------------------------------------------
subroutine add(this,string,stringPos)
subroutine add(this,string)
use IO, only: &
IO_isBlank, &
IO_lc, &
IO_stringPos
implicit none
class(tPartitionedStringList) :: this
type(tPartitionedStringList), pointer :: &
new, &
tmp
character(len=*), intent(in) :: string
integer(pInt), dimension(:), intent(in) :: stringPos
class(tPartitionedStringList) :: this
character(len=*), intent(in) :: string
integer(pInt), allocatable,dimension(:) :: p
type(tPartitionedStringList), pointer :: new, tmp
if (IO_isBlank(string)) return
allocate(new)
new%string%val=string
new%string%pos=stringPos
new%string%val=trim(string)
new%string%pos=IO_stringPos(trim(string))
if (.not. associated(this%next)) then
this%next => new
@ -61,6 +67,7 @@ subroutine add(this,string,stringPos)
tmp => this%next
this%next => new
this%next%next => tmp
!new%prev => this%prev%next
end if
end subroutine add

View File

@ -622,12 +622,13 @@ character(len=65536) function material_parseHomogenization(fileUnit)
chunkPos = IO_stringPos(line)
tag = IO_lc(IO_stringValue(trim(line),chunkPos,1_pInt)) ! extract key
inSection: if (h > 0_pInt) then
chunkPos = IO_stringPos(line)
call homogenizationConfig(h)%add(IO_lc(trim(line)),chunkPos)
call homogenizationConfig(h)%add(line)
else inSection
echo = (trim(tag) == '/echo/')
endif inSection
enddo
if (echo) call homogenizationConfig(1)%show()
material_Nhomogenization = size(homogenizationConfig)
if (material_Nhomogenization < 1_pInt) call IO_error(160_pInt,ext_msg=material_partHomogenization)
@ -814,7 +815,7 @@ character(len=65536) function material_parseMicrostructure(fileUnit)
tag = IO_lc(IO_stringValue(trim(line),chunkPos,1_pInt)) ! extract key
inSection: if (m > 0_pInt) then
chunkPos = IO_stringPos(line)
call microstructureConfig(m)%add(IO_lc(trim(line)),chunkPos)
call microstructureConfig(m)%add(IO_lc(line))
else inSection
echo = (trim(tag) == '/echo/')
endif inSection
@ -919,8 +920,8 @@ character(len=65536) function material_parseCrystallite(fileUnit)
chunkPos = IO_stringPos(line)
tag = IO_lc(IO_stringValue(trim(line),chunkPos,1_pInt)) ! extract key
inSection: if (c > 0_pInt) then
chunkPos = IO_stringPos(line)
call crystalliteConfig(c)%add(IO_lc(trim(line)),chunkPos)
chunkPos = IO_stringPos(trim(line))
call crystalliteConfig(c)%add(IO_lc(line))
else inSection
echo = (trim(tag) == '/echo/')
endif inSection
@ -997,7 +998,7 @@ character(len=65536) function material_parsePhase(fileUnit)
tag = IO_lc(IO_stringValue(trim(line),chunkPos,1_pInt)) ! extract key
inSection: if (p > 0_pInt) then
chunkPos = IO_stringPos(line)
call phaseConfig(p)%add(IO_lc(trim(line)),chunkPos)
call phaseConfig(p)%add(IO_lc(trim(line)))
else inSection
echo = (trim(tag) == '/echo/')
endif inSection
@ -1183,7 +1184,7 @@ character(len=65536) function material_parseTexture(fileUnit)
tag = IO_lc(IO_stringValue(trim(line2),chunkPos,1_pInt)) ! extract key
inSection: if (t > 0_pInt) then
chunkPos = IO_stringPos(line2)
call textureConfig(t)%add(IO_lc(trim(line2)),chunkPos)
call textureConfig(t)%add(IO_lc(trim(line2)))
else inSection
echo = (trim(tag) == '/echo/')
endif inSection

View File

@ -223,7 +223,6 @@ end subroutine math_init
!> @brief check correctness of (some) math functions
!--------------------------------------------------------------------------------------------------
subroutine math_check
use prec, only: tol_math_check
use IO, only: IO_error