diff --git a/src/IO.f90 b/src/IO.f90 index a00559708..08e0f9422 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -1587,6 +1587,8 @@ subroutine IO_error(error_ID,el,ip,g,instance,ext_msg) ! DAMASK_marc errors case (700_pInt) msg = 'invalid materialpoint result requested' + case (701_pInt) + msg = 'not supported input file format, use Marc 2016 or earlier' !------------------------------------------------------------------------------------------------- ! errors related to spectral solver diff --git a/src/mesh.f90 b/src/mesh.f90 index b7b1ad8da..75e6886fe 100644 --- a/src/mesh.f90 +++ b/src/mesh.f90 @@ -706,7 +706,6 @@ integer(pInt) function mesh_FEasCP(what,myID) mesh_FEasCP = lookupMap(2_pInt,upper) return endif - ! this might be the reason for the heap problems binarySearch: do while (upper-lower > 1_pInt) center = (lower+upper)/2_pInt if (lookupMap(1_pInt,center) < myID) then @@ -1692,13 +1691,15 @@ subroutine mesh_marc_count_cpElements(fileUnit) use IO, only: IO_lc, & IO_stringValue, & IO_stringPos, & - IO_countContinuousIntValues + IO_countContinuousIntValues, & + IO_error, & + IO_intValue implicit none integer(pInt), intent(in) :: fileUnit integer(pInt), allocatable, dimension(:) :: chunkPos - integer(pInt) :: i + integer(pInt) :: i, version character(len=300):: line mesh_NcpElems = 0_pInt @@ -1709,15 +1710,26 @@ subroutine mesh_marc_count_cpElements(fileUnit) do read (fileUnit,610,END=620) line chunkPos = IO_stringPos(line) - - if ( IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == 'hypoelastic') then - do i=1_pInt,3_pInt+hypoelasticTableStyle ! Skip 3 or 4 lines + if ( IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == 'version') then + version = IO_intValue(line,chunkPos,2_pInt) + if (version < 13) then ! Marc 2016 or earlier + rewind(fileUnit) + do read (fileUnit,610,END=620) line + chunkPos = IO_stringPos(line) + if ( IO_lc(IO_stringValue(line,chunkPos,1_pInt)) == 'hypoelastic') then + do i=1_pInt,3_pInt+hypoelasticTableStyle ! Skip 3 or 4 lines + read (fileUnit,610,END=620) line + enddo + mesh_NcpElems = mesh_NcpElems + IO_countContinuousIntValues(fileUnit) ! why not simply mesh_NcpElems = IO_countContinuousIntValues(fileUnit)? keyword hypoelastic might appear several times + exit + endif enddo - mesh_NcpElems = mesh_NcpElems + IO_countContinuousIntValues(fileUnit) ! why not simply mesh_NcpElems = IO_countContinuousIntValues(fileUnit)? - exit - endif - enddo + else ! Marc2017 and later + call IO_error(error_ID=701_pInt) + end if + end if + enddo 620 end subroutine mesh_marc_count_cpElements