easier to read and without file access
This commit is contained in:
parent
680ed535d7
commit
9ea91b84e8
|
@ -135,12 +135,13 @@ subroutine mesh_init(ip,el)
|
||||||
myDebug = (iand(debug_level(debug_mesh),debug_levelBasic) /= 0)
|
myDebug = (iand(debug_level(debug_mesh),debug_levelBasic) /= 0)
|
||||||
|
|
||||||
! parsing Marc input file
|
! parsing Marc input file
|
||||||
call IO_open_inputFile(FILEUNIT,modelName)
|
|
||||||
fileFormatVersion = mesh_marc_get_fileFormat(inputFile)
|
fileFormatVersion = mesh_marc_get_fileFormat(inputFile)
|
||||||
call mesh_marc_get_tableStyles(initialcondTableStyle,hypoelasticTableStyle,inputFile)
|
call mesh_marc_get_tableStyles(initialcondTableStyle,hypoelasticTableStyle,inputFile)
|
||||||
if (fileFormatVersion > 12) &
|
if (fileFormatVersion > 12) &
|
||||||
marc_matNumber = mesh_marc_get_matNumber(FILEUNIT,hypoelasticTableStyle)
|
marc_matNumber = mesh_marc_get_matNumber(hypoelasticTableStyle,inputFile)
|
||||||
call mesh_marc_count_nodesAndElements(mesh_nNodes, mesh_nElems, FILEUNIT)
|
call mesh_marc_count_nodesAndElements(mesh_nNodes, mesh_nElems, inputFile)
|
||||||
|
|
||||||
|
call IO_open_inputFile(FILEUNIT,modelName)
|
||||||
call mesh_marc_count_elementSets(mesh_NelemSets,mesh_maxNelemInSet,FILEUNIT)
|
call mesh_marc_count_elementSets(mesh_NelemSets,mesh_maxNelemInSet,FILEUNIT)
|
||||||
allocate(mesh_nameElemSet(mesh_NelemSets)); mesh_nameElemSet = 'n/a'
|
allocate(mesh_nameElemSet(mesh_NelemSets)); mesh_nameElemSet = 'n/a'
|
||||||
allocate(mesh_mapElemSet(1+mesh_maxNelemInSet,mesh_NelemSets),source=0)
|
allocate(mesh_mapElemSet(1+mesh_maxNelemInSet,mesh_NelemSets),source=0)
|
||||||
|
@ -258,8 +259,8 @@ end function mesh_marc_get_fileFormat
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine mesh_marc_get_tableStyles(initialcond,hypoelastic,fileContent)
|
subroutine mesh_marc_get_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=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines
|
||||||
|
|
||||||
integer, allocatable, dimension(:) :: chunkPos
|
integer, allocatable, dimension(:) :: chunkPos
|
||||||
integer :: l
|
integer :: l
|
||||||
|
@ -282,73 +283,63 @@ end subroutine mesh_marc_get_tableStyles
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Figures out material number of hypoelastic material
|
!> @brief Figures out material number of hypoelastic material
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
function mesh_marc_get_matNumber(fileUnit,tableStyle)
|
function mesh_marc_get_matNumber(tableStyle,fileContent)
|
||||||
|
|
||||||
|
integer, intent(in) :: tableStyle
|
||||||
|
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines
|
||||||
|
|
||||||
integer, intent(in) :: fileUnit, tableStyle
|
|
||||||
integer, dimension(:), allocatable :: mesh_marc_get_matNumber
|
integer, dimension(:), allocatable :: mesh_marc_get_matNumber
|
||||||
|
|
||||||
integer, allocatable, dimension(:) :: chunkPos
|
integer, allocatable, dimension(:) :: chunkPos
|
||||||
integer :: i, j, data_blocks
|
integer :: i, j, data_blocks, l
|
||||||
character(len=300) :: line
|
|
||||||
|
|
||||||
data_blocks = 1
|
do l = 1, size(fileContent)
|
||||||
rewind(fileUnit)
|
chunkPos = IO_stringPos(fileContent(l))
|
||||||
do
|
if ( IO_lc(IO_stringValue(fileContent(l),chunkPos,1)) == 'hypoelastic') then
|
||||||
read (fileUnit,'(A300)',END=620) line
|
if (len(trim(fileContent(l+1)))/=0) then
|
||||||
chunkPos = IO_stringPos(line)
|
chunkPos = IO_stringPos(fileContent(l+1))
|
||||||
|
data_blocks = IO_intValue(fileContent(l+1),chunkPos,1)
|
||||||
if ( IO_lc(IO_stringValue(line,chunkPos,1)) == 'hypoelastic') then
|
else
|
||||||
read (fileUnit,'(A300)',END=620) line
|
data_blocks = 1
|
||||||
if (len(trim(line))/=0) then
|
endif
|
||||||
chunkPos = IO_stringPos(line)
|
allocate(mesh_marc_get_matNumber(data_blocks), source = 0)
|
||||||
data_blocks = IO_intValue(line,chunkPos,1)
|
do i = 0, data_blocks - 1
|
||||||
endif
|
j = i*(2+tableStyle) + 1
|
||||||
allocate(mesh_marc_get_matNumber(data_blocks), source = 0)
|
chunkPos = IO_stringPos(fileContent(l+1+j))
|
||||||
do i=1,data_blocks ! read all data blocks
|
mesh_marc_get_matNumber(i+1) = IO_intValue(fileContent(l+1+j),chunkPos,1)
|
||||||
read (fileUnit,'(A300)',END=620) line
|
enddo
|
||||||
chunkPos = IO_stringPos(line)
|
exit
|
||||||
mesh_marc_get_matNumber(i) = IO_intValue(line,chunkPos,1)
|
endif
|
||||||
do j=1,2 + tableStyle ! read 2 or 3 remaining lines of data block
|
|
||||||
read (fileUnit,'(A300)') line
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
620 end function mesh_marc_get_matNumber
|
end function mesh_marc_get_matNumber
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
!> @brief Count overall number of nodes and elements
|
!> @brief Count overall number of nodes and elements
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
subroutine mesh_marc_count_nodesAndElements(nNodes, nElems, fileUnit)
|
subroutine mesh_marc_count_nodesAndElements(nNodes, nElems, fileContent)
|
||||||
|
|
||||||
integer, intent(in) :: fileUnit
|
integer, intent(out) :: nNodes, nElems
|
||||||
integer, intent(out) :: nNodes, nElems
|
character(len=pStringLen), dimension(:), intent(in) :: fileContent !< file content, separated per lines
|
||||||
|
|
||||||
integer, allocatable, dimension(:) :: chunkPos
|
integer, allocatable, dimension(:) :: chunkPos
|
||||||
character(len=300) :: line
|
integer :: l
|
||||||
|
|
||||||
nNodes = 0
|
nNodes = 0
|
||||||
nElems = 0
|
nElems = 0
|
||||||
|
|
||||||
rewind(fileUnit)
|
do l = 1, size(fileContent)
|
||||||
do
|
chunkPos = IO_stringPos(fileContent(l))
|
||||||
read (fileUnit,'(A300)',END=620) line
|
if (IO_lc(IO_StringValue(fileContent(l),chunkPos,1)) == 'sizing') then
|
||||||
chunkPos = IO_stringPos(line)
|
nElems = IO_IntValue (fileContent(l),chunkPos,3)
|
||||||
|
elseif (IO_lc(IO_StringValue(fileContent(l),chunkPos,1)) == 'coordinates') then
|
||||||
if ( IO_lc(IO_StringValue(line,chunkPos,1)) == 'sizing') &
|
chunkPos = IO_stringPos(fileContent(l+1))
|
||||||
nElems = IO_IntValue (line,chunkPos,3)
|
nNodes = IO_IntValue (fileContent(l+1),chunkPos,2)
|
||||||
if ( IO_lc(IO_StringValue(line,chunkPos,1)) == 'coordinates') then
|
|
||||||
read (fileUnit,'(A300)') line
|
|
||||||
chunkPos = IO_stringPos(line)
|
|
||||||
nNodes = IO_IntValue (line,chunkPos,2)
|
|
||||||
exit ! assumes that "coordinates" comes later in file
|
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
620 end subroutine mesh_marc_count_nodesAndElements
|
end subroutine mesh_marc_count_nodesAndElements
|
||||||
|
|
||||||
|
|
||||||
!--------------------------------------------------------------------------------------------------
|
!--------------------------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue