continuousIntValues is very specific for Marc

define where it is used
This commit is contained in:
Martin Diehl 2020-01-23 08:25:49 +01:00
parent 246187865e
commit 1bfd8a8c21
1 changed files with 78 additions and 22 deletions

View File

@ -242,7 +242,7 @@ end subroutine inputRead
subroutine inputRead_fileFormat(fileFormat,fileContent) subroutine inputRead_fileFormat(fileFormat,fileContent)
integer, intent(out) :: fileFormat integer, intent(out) :: fileFormat
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: l integer :: l
@ -264,7 +264,7 @@ end subroutine inputRead_fileFormat
subroutine inputRead_tableStyles(initialcond,hypoelastic,fileContent) subroutine inputRead_tableStyles(initialcond,hypoelastic,fileContent)
integer, intent(out) :: initialcond, hypoelastic integer, intent(out) :: initialcond, hypoelastic
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: l integer :: l
@ -292,8 +292,7 @@ subroutine inputRead_matNumber(matNumber, &
integer, allocatable, dimension(:), intent(out) :: matNumber integer, allocatable, dimension(:), intent(out) :: matNumber
integer, intent(in) :: tableStyle integer, intent(in) :: tableStyle
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i, j, data_blocks, l integer :: i, j, data_blocks, l
@ -327,7 +326,7 @@ subroutine inputRead_NnodesAndElements(nNodes,nElems,&
fileContent) fileContent)
integer, intent(out) :: nNodes, nElems integer, intent(out) :: nNodes, nElems
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: l integer :: l
@ -355,7 +354,7 @@ subroutine inputRead_NelemSets(nElemSets,maxNelemInSet,&
fileContent) fileContent)
integer, intent(out) :: nElemSets, maxNelemInSet integer, intent(out) :: nElemSets, maxNelemInSet
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i,l,elemInCurrentSet integer :: i,l,elemInCurrentSet
@ -401,7 +400,7 @@ subroutine inputRead_mapElemSets(nameElemSet,mapElemSet,fileUnit,fileContent)
character(len=64), dimension(:), allocatable, intent(out) :: nameElemSet character(len=64), dimension(:), allocatable, intent(out) :: nameElemSet
integer, dimension(:,:), allocatable, intent(out) :: mapElemSet integer, dimension(:,:), allocatable, intent(out) :: mapElemSet
integer, intent(in) :: fileUnit integer, intent(in) :: fileUnit
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
character(len=300) :: line character(len=300) :: line
@ -428,7 +427,6 @@ subroutine inputRead_mapElemSets(nameElemSet,mapElemSet,fileUnit,fileContent)
620 end subroutine inputRead_mapElemSets 620 end subroutine inputRead_mapElemSets
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
!> @brief Maps elements from FE ID to internal (consecutive) representation. !> @brief Maps elements from FE ID to internal (consecutive) representation.
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
@ -437,7 +435,7 @@ subroutine inputRead_mapElems(nNodes,nElem,fileContent)
integer, intent(in) :: & integer, intent(in) :: &
nElem, & nElem, &
nNodes !< number of nodes per element nNodes !< number of nodes per element
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i,j,l,nNodesAlreadyRead integer :: i,j,l,nNodesAlreadyRead
@ -470,7 +468,7 @@ end subroutine inputRead_mapElems
!-------------------------------------------------------------------------------------------------- !--------------------------------------------------------------------------------------------------
subroutine inputRead_mapNodes(fileContent) subroutine inputRead_mapNodes(fileContent)
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i, l integer :: i, l
@ -499,7 +497,7 @@ subroutine inputRead_elemNodes(nodes, &
real(pReal), allocatable, dimension(:,:), intent(out) :: nodes real(pReal), allocatable, dimension(:,:), intent(out) :: nodes
integer, intent(in) :: nNode integer, intent(in) :: nNode
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i,j,m,l integer :: i,j,m,l
@ -531,7 +529,7 @@ subroutine inputRead_elemType(elem, &
type(tElement), intent(out) :: elem type(tElement), intent(out) :: elem
integer, intent(in) :: nElem integer, intent(in) :: nElem
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, allocatable, dimension(:) :: chunkPos integer, allocatable, dimension(:) :: chunkPos
integer :: i,j,t,l,remainingChunks integer :: i,j,t,l,remainingChunks
@ -617,7 +615,7 @@ function inputRead_connectivityElem(nElem,nNodes,fileContent)
integer, intent(in) :: & integer, intent(in) :: &
nElem, & nElem, &
nNodes !< number of nodes per element nNodes !< number of nodes per element
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, dimension(nNodes,nElem) :: & integer, dimension(nNodes,nElem) :: &
inputRead_connectivityElem inputRead_connectivityElem
@ -1092,4 +1090,62 @@ integer function mesh_FEasCP(what,myID)
end function mesh_FEasCP end function mesh_FEasCP
!--------------------------------------------------------------------------------------------------
!> @brief return integer list corresponding to items in consecutive lines.
!! First integer in array is counter
!> @details ints concatenated by "c" as last char, range of a "to" b, or named set
!--------------------------------------------------------------------------------------------------
function continuousIntValues(fileContent,maxN,lookupName,lookupMap,lookupMaxN)
character(len=*), dimension(:), intent(in) :: fileContent !< file content, separated per lines
integer, intent(in) :: maxN
integer, intent(in) :: lookupMaxN
integer, dimension(:,:), intent(in) :: lookupMap
character(len=*), dimension(:), intent(in) :: lookupName
integer, dimension(1+maxN) :: continuousIntValues
integer :: l,i,first,last
integer, allocatable, dimension(:) :: chunkPos
logical :: rangeGeneration
continuousIntValues = 0
rangeGeneration = .false.
do l = 1, size(fileContent)
chunkPos = IO_stringPos(fileContent(l))
if (chunkPos(1) < 1) then ! empty line
exit
elseif (verify(IO_stringValue(fileContent(l),chunkPos,1),'0123456789') > 0) then ! a non-int, i.e. set name
do i = 1, lookupMaxN ! loop over known set names
if (IO_stringValue(fileContent(l),chunkPos,1) == lookupName(i)) then ! found matching name
continuousIntValues = lookupMap(:,i) ! return resp. entity list
exit
endif
enddo
exit
else if (chunkPos(1) > 2 .and. IO_lc(IO_stringValue(fileContent(l),chunkPos,2)) == 'to' ) then ! found range indicator
first = IO_intValue(fileContent(l),chunkPos,1)
last = IO_intValue(fileContent(l),chunkPos,3)
do i = first, last, sign(1,last-first)
continuousIntValues(1) = continuousIntValues(1) + 1
continuousIntValues(1+continuousIntValues(1)) = i
enddo
exit
else
do i = 1,chunkPos(1)-1 ! interpret up to second to last value
continuousIntValues(1) = continuousIntValues(1) + 1
continuousIntValues(1+continuousIntValues(1)) = IO_intValue(fileContent(l),chunkPos,i)
enddo
if ( IO_lc(IO_stringValue(fileContent(l),chunkPos,chunkPos(1))) /= 'c' ) then ! line finished, read last value
continuousIntValues(1) = continuousIntValues(1) + 1
continuousIntValues(1+continuousIntValues(1)) = IO_intValue(fileContent(l),chunkPos,chunkPos(1))
exit
endif
endif
enddo
end function continuousIntValues
end module mesh end module mesh