2011-04-07 12:50:28 +05:30
|
|
|
! Copyright 2011 Max-Planck-Institut für Eisenforschung GmbH
|
2011-04-04 19:39:54 +05:30
|
|
|
!
|
|
|
|
! This file is part of DAMASK,
|
2011-04-07 12:50:28 +05:30
|
|
|
! the Düsseldorf Advanced MAterial Simulation Kit.
|
2011-04-04 19:39:54 +05:30
|
|
|
!
|
|
|
|
! DAMASK is free software: you can redistribute it and/or modify
|
|
|
|
! it under the terms of the GNU General Public License as published by
|
|
|
|
! the Free Software Foundation, either version 3 of the License, or
|
|
|
|
! (at your option) any later version.
|
|
|
|
!
|
|
|
|
! DAMASK is distributed in the hope that it will be useful,
|
|
|
|
! but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
! GNU General Public License for more details.
|
|
|
|
!
|
|
|
|
! You should have received a copy of the GNU General Public License
|
|
|
|
! along with DAMASK. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
!
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! $Id$
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @author Franz Roters, Max-Planck-Institut für Eisenforschung GmbH
|
|
|
|
!> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH
|
|
|
|
!> @author Christoph Kords, Max-Planck-Institut für Eisenforschung GmbH
|
|
|
|
!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
|
|
|
|
!> @brief input/output functions, partly depending on chosen solver
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
module IO
|
2013-02-11 15:14:17 +05:30
|
|
|
use prec, only: &
|
|
|
|
pInt, &
|
|
|
|
pReal
|
2012-02-10 16:54:53 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
|
|
|
private
|
2013-02-11 15:14:17 +05:30
|
|
|
public :: &
|
|
|
|
IO_init, &
|
|
|
|
IO_checkAndRewind, &
|
|
|
|
IO_open_file_stat, &
|
|
|
|
IO_open_jobFile_stat, &
|
|
|
|
IO_open_file, &
|
|
|
|
IO_open_jobFile, &
|
|
|
|
IO_write_jobFile, &
|
|
|
|
IO_write_jobBinaryFile, &
|
|
|
|
IO_write_jobBinaryIntFile, &
|
|
|
|
IO_read_jobBinaryFile, &
|
|
|
|
IO_read_jobBinaryIntFile, &
|
|
|
|
IO_hybridIA, &
|
|
|
|
IO_isBlank, &
|
|
|
|
IO_getTag, &
|
|
|
|
IO_countSections, &
|
|
|
|
IO_countTagInPart, &
|
|
|
|
IO_spotTagInPart, &
|
|
|
|
IO_globalTagInPart, &
|
|
|
|
IO_stringPos, &
|
|
|
|
IO_stringValue, &
|
|
|
|
IO_fixedStringValue ,&
|
|
|
|
IO_floatValue, &
|
|
|
|
IO_fixedNoEFloatValue, &
|
|
|
|
IO_intValue, &
|
|
|
|
IO_fixedIntValue, &
|
|
|
|
IO_lc, &
|
|
|
|
IO_skipChunks, &
|
|
|
|
IO_extractValue, &
|
|
|
|
IO_countDataLines, &
|
|
|
|
IO_countContinuousIntValues, &
|
|
|
|
IO_continuousIntValues, &
|
|
|
|
IO_error, &
|
|
|
|
IO_warning, &
|
2013-02-25 22:04:59 +05:30
|
|
|
IO_intOut, &
|
|
|
|
IO_timeStamp
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifndef Spectral
|
2013-02-11 15:14:17 +05:30
|
|
|
public :: &
|
|
|
|
IO_open_inputFile, &
|
|
|
|
IO_open_logFile
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
|
|
|
#ifdef Abaqus
|
2013-02-11 15:14:17 +05:30
|
|
|
public :: &
|
|
|
|
IO_abaqus_hasNoPart
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2013-02-11 15:14:17 +05:30
|
|
|
private :: &
|
|
|
|
IO_fixedFloatValue, &
|
|
|
|
IO_lcInplace ,&
|
2013-02-13 00:30:41 +05:30
|
|
|
IO_verifyFloatValue, &
|
|
|
|
IO_verifyIntValue, &
|
2013-02-11 15:14:17 +05:30
|
|
|
hybridIA_reps
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifdef Abaqus
|
2013-02-11 15:14:17 +05:30
|
|
|
private :: &
|
|
|
|
abaqus_assembleInputFile
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
external :: &
|
|
|
|
quit
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
contains
|
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief only output of revision number
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_init
|
2012-06-18 20:57:01 +05:30
|
|
|
use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment)
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2013-02-25 22:04:59 +05:30
|
|
|
write(6,'(/,a)') ' <<<+- IO init -+>>>'
|
|
|
|
write(6,'(a)') ' $Id$'
|
|
|
|
write(6,'(a16,a)') ' Current time : ',IO_timeStamp()
|
2012-02-01 00:48:55 +05:30
|
|
|
#include "compilation_info.f90"
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_init
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Checks if unit is opened for reading, if true rewinds. Otherwise stops with
|
|
|
|
!! error message 102
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-04-20 17:28:41 +05:30
|
|
|
subroutine IO_checkAndRewind(myUnit)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
logical :: fileOpened
|
|
|
|
character(len=15) :: fileRead
|
|
|
|
inquire(unit=myUnit, opened=fileOpened, read = fileRead)
|
|
|
|
if (fileOpened .neqv. .true. .or. trim(fileRead)/='YES') call IO_error(102_pInt)
|
|
|
|
rewind(myUnit)
|
|
|
|
|
|
|
|
end subroutine IO_checkAndRewind
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2011-07-18 14:45:20 +05:30
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Open existing file to given unit path to file is relative to working directory
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
logical function IO_open_file_stat(myUnit,relPath)
|
|
|
|
use DAMASK_interface, &
|
|
|
|
only: getSolverWorkingDirectoryName
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
character(len=*), intent(in) :: relPath
|
2011-07-18 14:45:20 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
path = trim(getSolverWorkingDirectoryName())//relPath
|
|
|
|
open(myUnit,status='old',iostat=myStat,file=path)
|
|
|
|
IO_open_file_stat = (myStat == 0_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_open_file_stat
|
2011-09-13 21:24:06 +05:30
|
|
|
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Open (write) file related to current job but with different extension to given unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
logical function IO_open_jobFile_stat(myUnit,newExt)
|
2012-06-18 20:57:01 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverWorkingDirectoryName, &
|
|
|
|
getSolverJobName
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2010-07-13 15:56:07 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
character(len=*), intent(in) :: newExt
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
|
|
|
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.'//newExt
|
|
|
|
open(myUnit,status='old',iostat=myStat,file=path)
|
|
|
|
IO_open_jobFile_stat = (myStat == 0_pInt)
|
|
|
|
|
|
|
|
end function IO_open_JobFile_stat
|
2010-07-13 15:56:07 +05:30
|
|
|
|
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Open existing file to given unit path to file is relative to working directory
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_open_file(myUnit,relPath)
|
2013-02-11 15:14:17 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverWorkingDirectoryName
|
2012-02-10 16:54:53 +05:30
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
character(len=*), intent(in) :: relPath
|
|
|
|
|
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2012-02-13 23:11:27 +05:30
|
|
|
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//relPath
|
2012-03-06 20:22:48 +05:30
|
|
|
open(myUnit,status='old',iostat=myStat,file=path)
|
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_open_file
|
2012-02-13 23:11:27 +05:30
|
|
|
|
|
|
|
|
2012-06-18 20:57:01 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief Open (write) file related to current job but with different extension to given unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_open_jobFile(myUnit,newExt)
|
2013-02-11 15:14:17 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverWorkingDirectoryName, &
|
|
|
|
getSolverJobName
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
character(len=*), intent(in) :: newExt
|
|
|
|
|
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
|
|
|
|
|
|
|
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.'//newExt
|
|
|
|
open(myUnit,status='old',iostat=myStat,file=path)
|
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_open_jobFile
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifndef Spectral
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief open FEM input file to given unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_open_inputFile(myUnit,model)
|
2012-06-15 21:40:21 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverWorkingDirectoryName,&
|
|
|
|
getSolverJobName, &
|
|
|
|
inputFileExtension
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
character(len=*), intent(in) :: model
|
2010-05-10 20:32:59 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifdef Abaqus
|
2013-02-13 16:26:50 +05:30
|
|
|
integer(pInt) :: fileType
|
|
|
|
|
|
|
|
fileType = 1_pInt ! assume .pes
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(model)//inputFileExtension(fileType) ! attempt .pes, if it exists: it should be used
|
2012-06-15 21:40:21 +05:30
|
|
|
open(myUnit+1,status='old',iostat=myStat,file=path)
|
2013-02-13 16:26:50 +05:30
|
|
|
if(myStat /= 0_pInt) then ! if .pes does not work / exist; use conventional extension, i.e.".inp"
|
|
|
|
fileType = 2_pInt
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(model)//inputFileExtension(fileType)
|
2013-02-04 13:59:58 +05:30
|
|
|
open(myUnit+1,status='old',iostat=myStat,file=path)
|
|
|
|
endif
|
2013-02-13 16:26:50 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path) ! ensure that any file opened works
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2013-02-13 16:26:50 +05:30
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(model)//inputFileExtension(fileType)//'_assembly'
|
2012-06-15 21:40:21 +05:30
|
|
|
open(myUnit,iostat=myStat,file=path)
|
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
|
2013-02-13 16:26:50 +05:30
|
|
|
if (.not.abaqus_assembleInputFile(myUnit,myUnit+1_pInt)) call IO_error(103_pInt) ! strip comments and concatenate any "include"s
|
2012-06-15 21:40:21 +05:30
|
|
|
close(myUnit+1_pInt)
|
|
|
|
#endif
|
|
|
|
#ifdef Marc
|
2013-02-13 16:26:50 +05:30
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(model)//inputFileExtension
|
2012-03-06 20:22:48 +05:30
|
|
|
open(myUnit,status='old',iostat=myStat,file=path)
|
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_open_inputFile
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief open FEM log file to given Unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_open_logFile(myUnit)
|
2012-06-15 21:40:21 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverWorkingDirectoryName, &
|
|
|
|
getSolverJobName, &
|
|
|
|
LogFileExtension
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2009-07-22 21:37:19 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
2009-07-22 21:37:19 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2011-08-02 15:44:16 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//LogFileExtension
|
|
|
|
open(myUnit,status='old',iostat=myStat,file=path)
|
|
|
|
if (myStat /= 0) call IO_error(100_pInt,ext_msg=path)
|
2011-08-02 15:44:16 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_open_logFile
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief open (write) file related to current job with given extension to given unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_write_jobFile(myUnit,newExt)
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
use DAMASK_interface, only: getSolverWorkingDirectoryName,&
|
|
|
|
getSolverJobName
|
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
character(len=*), intent(in) :: newExt
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2012-02-13 23:11:27 +05:30
|
|
|
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.'//newExt
|
2012-03-06 20:22:48 +05:30
|
|
|
open(myUnit,status='replace',iostat=myStat,file=path)
|
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
|
2011-08-02 15:44:16 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_write_jobFile
|
2011-08-02 15:44:16 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-08-16 17:27:15 +05:30
|
|
|
!> @brief open (write) binary file of pReal array related to current job with given extension to
|
|
|
|
!> given unit
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_write_jobBinaryFile(myUnit,newExt,recMultiplier)
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
use DAMASK_interface, only: getSolverWorkingDirectoryName, &
|
|
|
|
getSolverJobName
|
|
|
|
|
2010-11-03 20:09:18 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
integer(pInt), intent(in), optional :: recMultiplier
|
|
|
|
character(len=*), intent(in) :: newExt
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.'//newExt
|
2010-11-03 20:09:18 +05:30
|
|
|
if (present(recMultiplier)) then
|
2012-03-06 20:22:48 +05:30
|
|
|
open(myUnit,status='replace',form='unformatted',access='direct', &
|
|
|
|
recl=pReal*recMultiplier,iostat=myStat,file=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
else
|
2012-03-06 20:22:48 +05:30
|
|
|
open(myUnit,status='replace',form='unformatted',access='direct', &
|
|
|
|
recl=pReal,iostat=myStat,file=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
endif
|
2012-04-24 22:29:38 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_write_jobBinaryFile
|
2010-11-03 20:09:18 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-08-16 17:27:15 +05:30
|
|
|
!> @brief open (write) binary file of pInt array related to current job with given extension to
|
|
|
|
!> given unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
subroutine IO_write_jobBinaryIntFile(myUnit,newExt,recMultiplier)
|
2013-02-11 15:14:17 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverWorkingDirectoryName, &
|
|
|
|
getSolverJobName
|
2012-08-16 17:27:15 +05:30
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
integer(pInt), intent(in), optional :: recMultiplier
|
|
|
|
character(len=*), intent(in) :: newExt
|
|
|
|
|
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
|
|
|
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.'//newExt
|
|
|
|
if (present(recMultiplier)) then
|
|
|
|
open(myUnit,status='replace',form='unformatted',access='direct', &
|
|
|
|
recl=pInt*recMultiplier,iostat=myStat,file=path)
|
|
|
|
else
|
|
|
|
open(myUnit,status='replace',form='unformatted',access='direct', &
|
|
|
|
recl=pInt,iostat=myStat,file=path)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
|
|
|
|
|
|
|
|
end subroutine IO_write_jobBinaryIntFile
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief open (read) binary file of pReal array related to restored job with given extension to
|
|
|
|
!> given unit
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_read_jobBinaryFile(myUnit,newExt,jobName,recMultiplier)
|
2013-02-11 15:14:17 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverWorkingDirectoryName
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2010-11-03 20:09:18 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
integer(pInt), intent(in), optional :: recMultiplier
|
|
|
|
character(len=*), intent(in) :: newExt, jobName
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(jobName)//'.'//newExt
|
2010-11-03 20:09:18 +05:30
|
|
|
if (present(recMultiplier)) then
|
2012-03-06 20:22:48 +05:30
|
|
|
open(myUnit,status='old',form='unformatted',access='direct', &
|
|
|
|
recl=pReal*recMultiplier,iostat=myStat,file=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
else
|
2012-03-06 20:22:48 +05:30
|
|
|
open(myUnit,status='old',form='unformatted',access='direct', &
|
|
|
|
recl=pReal,iostat=myStat,file=path)
|
2012-02-13 23:11:27 +05:30
|
|
|
endif
|
2012-04-20 17:28:41 +05:30
|
|
|
if (myStat /= 0) call IO_error(100_pInt,ext_msg=path)
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_read_jobBinaryFile
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
|
2012-08-16 17:27:15 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief open (read) binary file of pInt array related to restored job with given extension to
|
|
|
|
!> given unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
subroutine IO_read_jobBinaryIntFile(myUnit,newExt,jobName,recMultiplier)
|
2013-02-11 15:14:17 +05:30
|
|
|
use DAMASK_interface, only: &
|
|
|
|
getSolverWorkingDirectoryName
|
2012-08-16 17:27:15 +05:30
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
integer(pInt), intent(in), optional :: recMultiplier
|
|
|
|
character(len=*), intent(in) :: newExt, jobName
|
|
|
|
|
|
|
|
integer(pInt) :: myStat
|
|
|
|
character(len=1024) :: path
|
|
|
|
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(jobName)//'.'//newExt
|
|
|
|
if (present(recMultiplier)) then
|
|
|
|
open(myUnit,status='old',form='unformatted',access='direct', &
|
|
|
|
recl=pInt*recMultiplier,iostat=myStat,file=path)
|
|
|
|
else
|
|
|
|
open(myUnit,status='old',form='unformatted',access='direct', &
|
|
|
|
recl=pInt,iostat=myStat,file=path)
|
|
|
|
endif
|
|
|
|
if (myStat /= 0) call IO_error(100_pInt,ext_msg=path)
|
|
|
|
|
|
|
|
end subroutine IO_read_jobBinaryIntFile
|
|
|
|
|
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifdef Abaqus
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief check if the input file for Abaqus contains part info
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
logical function IO_abaqus_hasNoPart(myUnit)
|
2007-03-21 18:02:15 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
|
|
|
|
integer(pInt), parameter :: maxNchunks = 1_pInt
|
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: myPos
|
|
|
|
character(len=300) :: line
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
IO_abaqus_hasNoPart = .true.
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
610 FORMAT(A300)
|
|
|
|
rewind(myUnit)
|
|
|
|
do
|
|
|
|
read(myUnit,610,END=620) line
|
|
|
|
myPos = IO_stringPos(line,maxNchunks)
|
|
|
|
if (IO_lc(IO_stringValue(line,myPos,1_pInt)) == '*part' ) then
|
|
|
|
IO_abaqus_hasNoPart = .false.
|
|
|
|
exit
|
|
|
|
endif
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
620 end function IO_abaqus_hasNoPart
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief hybrid IA sampling of ODFfile
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
function IO_hybridIA(Nast,ODFfileName)
|
2007-03-21 18:02:15 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: Nast
|
2007-03-26 20:33:21 +05:30
|
|
|
real(pReal), dimension(3,Nast) :: IO_hybridIA
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=*), intent(in) :: ODFfileName
|
2013-02-11 15:14:17 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! math module is not available
|
2012-03-06 20:22:48 +05:30
|
|
|
real(pReal), parameter :: PI = 3.14159265358979323846264338327950288419716939937510_pReal
|
|
|
|
real(pReal), parameter :: INRAD = PI/180.0_pReal
|
|
|
|
character(len=*), parameter :: fileFormat = '(A80)'
|
|
|
|
|
|
|
|
integer(pInt) :: i,j,bin,NnonZero,Nset,Nreps,reps,phi1,Phi,phi2
|
|
|
|
integer(pInt), dimension(7) :: myPos
|
|
|
|
integer(pInt), dimension(3) :: steps
|
|
|
|
integer(pInt), dimension(:), allocatable :: binSet
|
|
|
|
real(pReal) :: center,sum_dV_V,prob,dg_0,C,lowerC,upperC,rnd
|
|
|
|
real(pReal), dimension(3) :: limits, &
|
|
|
|
deltas
|
|
|
|
|
|
|
|
real(pReal), dimension(:,:,:), allocatable :: dV_V
|
|
|
|
character(len=80) :: line
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! parse header of ODF file
|
2012-11-07 15:01:46 +05:30
|
|
|
call IO_open_file(999_pInt,ODFfileName)
|
|
|
|
IO_hybridIA = -1.0_pReal ! initialize return value for case of error
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! limits in phi1, Phi, phi2
|
2007-03-21 18:02:15 +05:30
|
|
|
read(999,fmt=fileFormat,end=100) line
|
2012-02-16 00:28:38 +05:30
|
|
|
myPos = IO_stringPos(line,3_pInt)
|
2012-11-07 15:01:46 +05:30
|
|
|
if (myPos(1) == 3) then ! found 3 chunks
|
2013-02-06 22:11:09 +05:30
|
|
|
do i = 1_pInt, 3_pInt
|
|
|
|
limits(i) = IO_floatValue(line,myPos,i)*INRAD
|
|
|
|
enddo
|
2012-11-07 15:01:46 +05:30
|
|
|
else ! wrong line format
|
|
|
|
close(999)
|
|
|
|
return
|
|
|
|
endif
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! deltas in phi1, Phi, phi2
|
2007-03-21 18:02:15 +05:30
|
|
|
read(999,fmt=fileFormat,end=100) line
|
2012-02-16 00:28:38 +05:30
|
|
|
myPos = IO_stringPos(line,3_pInt)
|
2012-11-07 15:01:46 +05:30
|
|
|
if (myPos(1) == 3) then ! found 3 chunks
|
2013-02-06 22:11:09 +05:30
|
|
|
do i = 1_pInt, 3_pInt
|
|
|
|
deltas(i) = IO_floatValue(line,myPos,i)*INRAD
|
|
|
|
enddo
|
2012-11-07 15:01:46 +05:30
|
|
|
else ! wrong line format
|
|
|
|
close(999)
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
2007-03-21 18:02:15 +05:30
|
|
|
steps = nint(limits/deltas,pInt)
|
|
|
|
allocate(dV_V(steps(3),steps(2),steps(1)))
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! box boundary/center at origin?
|
2007-03-21 18:02:15 +05:30
|
|
|
read(999,fmt=fileFormat,end=100) line
|
|
|
|
if (index(IO_lc(line),'bound')>0) then
|
|
|
|
center = 0.5_pReal
|
|
|
|
else
|
|
|
|
center = 0.0_pReal
|
2009-06-15 18:41:21 +05:30
|
|
|
endif
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
read(999,fmt=fileFormat,end=100) line ! skip blank line
|
2007-03-21 18:02:15 +05:30
|
|
|
|
|
|
|
sum_dV_V = 0.0_pReal
|
|
|
|
dV_V = 0.0_pReal
|
|
|
|
dg_0 = deltas(1)*deltas(3)*2.0_pReal*sin(deltas(2)/2.0_pReal)
|
|
|
|
NnonZero = 0_pInt
|
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
do phi1=1_pInt,steps(1)
|
|
|
|
do Phi=1_pInt,steps(2)
|
|
|
|
do phi2=1_pInt,steps(3)
|
2008-03-12 19:23:00 +05:30
|
|
|
read(999,fmt=*,end=100) prob
|
2007-03-21 18:02:15 +05:30
|
|
|
if (prob > 0.0_pReal) then
|
2012-02-16 00:28:38 +05:30
|
|
|
NnonZero = NnonZero+1_pInt
|
2007-03-21 18:02:15 +05:30
|
|
|
sum_dV_V = sum_dV_V+prob
|
|
|
|
else
|
|
|
|
prob = 0.0_pReal
|
2009-06-15 18:41:21 +05:30
|
|
|
endif
|
2007-03-21 18:02:15 +05:30
|
|
|
dV_V(phi2,Phi,phi1) = prob*dg_0*sin((Phi-1.0_pReal+center)*deltas(2))
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2009-08-13 18:51:22 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
dV_V = dV_V/sum_dV_V ! normalize to 1
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! now fix bounds
|
|
|
|
Nset = max(Nast,NnonZero) ! if less than non-zero voxel count requested, sample at least that much
|
2007-03-21 18:02:15 +05:30
|
|
|
lowerC = 0.0_pReal
|
|
|
|
upperC = real(Nset, pReal)
|
|
|
|
|
|
|
|
do while (hybridIA_reps(dV_V,steps,upperC) < Nset)
|
|
|
|
lowerC = upperC
|
|
|
|
upperC = upperC*2.0_pReal
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2013-02-11 15:14:17 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! binary search for best C
|
2007-03-21 18:02:15 +05:30
|
|
|
do
|
|
|
|
C = (upperC+lowerC)/2.0_pReal
|
|
|
|
Nreps = hybridIA_reps(dV_V,steps,C)
|
|
|
|
if (abs(upperC-lowerC) < upperC*1.0e-14_pReal) then
|
|
|
|
C = upperC
|
|
|
|
Nreps = hybridIA_reps(dV_V,steps,C)
|
|
|
|
exit
|
|
|
|
elseif (Nreps < Nset) then
|
|
|
|
lowerC = C
|
|
|
|
elseif (Nreps > Nset) then
|
|
|
|
upperC = C
|
|
|
|
else
|
|
|
|
exit
|
2009-06-15 18:41:21 +05:30
|
|
|
endif
|
|
|
|
enddo
|
2009-08-13 18:51:22 +05:30
|
|
|
|
2007-03-21 18:02:15 +05:30
|
|
|
allocate(binSet(Nreps))
|
2013-02-11 15:14:17 +05:30
|
|
|
bin = 0_pInt ! bin counter
|
|
|
|
i = 1_pInt ! set counter
|
2012-02-16 00:28:38 +05:30
|
|
|
do phi1=1_pInt,steps(1)
|
|
|
|
do Phi=1_pInt,steps(2)
|
|
|
|
do phi2=1_pInt,steps(3)
|
2007-03-21 18:02:15 +05:30
|
|
|
reps = nint(C*dV_V(phi2,Phi,phi1), pInt)
|
|
|
|
binSet(i:i+reps-1) = bin
|
2013-02-11 15:14:17 +05:30
|
|
|
bin = bin+1_pInt ! advance bin
|
|
|
|
i = i+reps ! advance set
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
do i=1_pInt,Nast
|
2007-03-21 18:02:15 +05:30
|
|
|
if (i < Nast) then
|
|
|
|
call random_number(rnd)
|
2009-08-13 18:51:22 +05:30
|
|
|
j = nint(rnd*(Nreps-i)+i+0.5_pReal,pInt)
|
2007-03-21 18:02:15 +05:30
|
|
|
else
|
|
|
|
j = i
|
2009-06-15 18:41:21 +05:30
|
|
|
endif
|
2007-03-21 18:02:15 +05:30
|
|
|
bin = binSet(j)
|
2012-02-10 16:54:53 +05:30
|
|
|
IO_hybridIA(1,i) = deltas(1)*(real(mod(bin/(steps(3)*steps(2)),steps(1)),pReal)+center) ! phi1
|
|
|
|
IO_hybridIA(2,i) = deltas(2)*(real(mod(bin/ steps(3) ,steps(2)),pReal)+center) ! Phi
|
|
|
|
IO_hybridIA(3,i) = deltas(3)*(real(mod(bin ,steps(3)),pReal)+center) ! phi2
|
2007-03-21 18:02:15 +05:30
|
|
|
binSet(j) = binSet(i)
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2007-03-21 18:02:15 +05:30
|
|
|
|
2012-11-07 15:01:46 +05:30
|
|
|
100 close(999)
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_hybridIA
|
2007-03-21 18:02:15 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief identifies lines without content
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
logical pure function IO_isBlank(line)
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
implicit none
|
|
|
|
character(len=*), intent(in) :: line
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
character(len=*), parameter :: blankChar = achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
|
|
|
|
character(len=*), parameter :: comment = achar(35) ! comment id '#'
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
integer :: posNonBlank, posComment ! no pInt
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
posNonBlank = verify(line,blankChar)
|
2009-03-04 17:18:54 +05:30
|
|
|
posComment = scan(line,comment)
|
|
|
|
IO_isBlank = posNonBlank == 0 .or. posNonBlank == posComment
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_isBlank
|
|
|
|
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief get tagged content of line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
pure function IO_getTag(line,openChar,closeChar)
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=*), intent(in) :: line
|
|
|
|
character(len=len_trim(line)) :: IO_getTag
|
|
|
|
|
|
|
|
character(len=*), intent(in) :: openChar, &
|
|
|
|
closeChar
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
character(len=*), parameter :: sep=achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
integer :: left,right ! no pInt
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
IO_getTag = ''
|
|
|
|
left = scan(line,openChar)
|
|
|
|
right = scan(line,closeChar)
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
if (left == verify(line,sep) .and. right > left) & ! openChar is first and closeChar occurs
|
2009-03-04 17:18:54 +05:30
|
|
|
IO_getTag = line(left+1:right-1)
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_getTag
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief count sections in given part
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) function IO_countSections(myFile,part)
|
|
|
|
|
2009-03-04 17:18:54 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myFile
|
|
|
|
character(len=*), intent(in) :: part
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-03-07 15:37:29 +05:30
|
|
|
character(len=1024) :: line
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-03-09 20:52:52 +05:30
|
|
|
line = ''
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_countSections = 0_pInt
|
2012-03-06 20:22:48 +05:30
|
|
|
rewind(myFile)
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
do while (IO_getTag(line,'<','>') /= part) ! search for part
|
2012-03-06 20:22:48 +05:30
|
|
|
read(myFile,'(a1024)',END=100) line
|
2009-03-04 17:18:54 +05:30
|
|
|
enddo
|
|
|
|
|
|
|
|
do
|
2012-03-06 20:22:48 +05:30
|
|
|
read(myFile,'(a1024)',END=100) line
|
2013-02-11 15:14:17 +05:30
|
|
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
|
|
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
|
|
|
|
if (IO_getTag(line,'[',']') /= '') & ! found [section] identifier
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_countSections = IO_countSections + 1_pInt
|
2009-03-04 17:18:54 +05:30
|
|
|
enddo
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
100 end function IO_countSections
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return array of myTag counts within <part> for at most N[sections]
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
function IO_countTagInPart(myFile,part,myTag,Nsections)
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: Nsections
|
|
|
|
integer(pInt), dimension(Nsections) :: IO_countTagInPart
|
|
|
|
|
|
|
|
integer(pInt), intent(in) :: myFile
|
|
|
|
character(len=*),intent(in) :: part, &
|
|
|
|
myTag
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), parameter :: maxNchunks = 1_pInt
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), dimension(Nsections) :: counter
|
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: positions
|
2012-03-07 15:37:29 +05:30
|
|
|
integer(pInt) :: section
|
|
|
|
character(len=1024) :: line, &
|
2012-03-06 20:22:48 +05:30
|
|
|
tag
|
2012-03-09 20:52:52 +05:30
|
|
|
line = ''
|
2012-03-06 20:22:48 +05:30
|
|
|
counter = 0_pInt
|
2012-03-07 15:37:29 +05:30
|
|
|
section = 0_pInt
|
2012-03-09 20:52:52 +05:30
|
|
|
|
|
|
|
rewind(myFile)
|
2013-02-11 15:14:17 +05:30
|
|
|
do while (IO_getTag(line,'<','>') /= part) ! search for part
|
2012-03-06 20:22:48 +05:30
|
|
|
read(myFile,'(a1024)',END=100) line
|
2009-03-04 17:18:54 +05:30
|
|
|
enddo
|
|
|
|
|
|
|
|
do
|
2012-03-06 20:22:48 +05:30
|
|
|
read(myFile,'(a1024)',END=100) line
|
2013-02-11 15:14:17 +05:30
|
|
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
|
|
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
|
|
|
|
if (IO_getTag(line,'[',']') /= '') & ! found [section] identifier
|
2012-02-16 00:28:38 +05:30
|
|
|
section = section + 1_pInt
|
2009-03-04 17:18:54 +05:30
|
|
|
if (section > 0) then
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
2013-02-11 15:14:17 +05:30
|
|
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
|
|
|
if (tag == myTag) & ! match
|
2012-02-02 18:49:02 +05:30
|
|
|
counter(section) = counter(section) + 1_pInt
|
2009-03-04 17:18:54 +05:30
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
|
|
|
100 IO_countTagInPart = counter
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_countTagInPart
|
2009-03-04 17:18:54 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return array of myTag presence within <part> for at most N[sections]
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
function IO_spotTagInPart(myFile,part,myTag,Nsections)
|
2009-04-03 16:00:18 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: Nsections
|
2009-04-03 16:00:18 +05:30
|
|
|
logical, dimension(Nsections) :: IO_spotTagInPart
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
integer(pInt), intent(in) :: myFile
|
|
|
|
character(len=*), intent(in) :: part, &
|
|
|
|
myTag
|
|
|
|
|
2012-06-26 15:54:54 +05:30
|
|
|
integer(pInt), parameter :: maxNchunks = 1_pInt
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2009-04-03 16:00:18 +05:30
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: positions
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: section
|
|
|
|
character(len=1024) :: line, &
|
|
|
|
tag
|
2009-04-03 16:00:18 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
IO_spotTagInPart = .false. ! assume to nowhere spot tag
|
2009-04-03 16:00:18 +05:30
|
|
|
section = 0_pInt
|
2012-03-09 20:52:52 +05:30
|
|
|
line =''
|
2009-04-03 16:00:18 +05:30
|
|
|
|
2012-03-09 20:52:52 +05:30
|
|
|
rewind(myFile)
|
2013-02-11 15:14:17 +05:30
|
|
|
do while (IO_getTag(line,'<','>') /= part) ! search for part
|
2012-03-06 20:22:48 +05:30
|
|
|
read(myFile,'(a1024)',END=100) line
|
2009-04-03 16:00:18 +05:30
|
|
|
enddo
|
|
|
|
|
|
|
|
do
|
2012-03-06 20:22:48 +05:30
|
|
|
read(myFile,'(a1024)',END=100) line
|
2013-02-11 15:14:17 +05:30
|
|
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
|
|
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
|
|
|
|
if (IO_getTag(line,'[',']') /= '') & ! found [section] identifier
|
2012-02-16 00:28:38 +05:30
|
|
|
section = section + 1_pInt
|
|
|
|
if (section > 0_pInt) then
|
2009-04-03 16:00:18 +05:30
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
2013-02-11 15:14:17 +05:30
|
|
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
|
|
|
if (tag == myTag) & ! match
|
2009-04-03 16:00:18 +05:30
|
|
|
IO_spotTagInPart(section) = .true.
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
100 end function IO_spotTagInPart
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return logical whether myTag is present within <part> before any [sections]
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-06-26 15:54:54 +05:30
|
|
|
logical function IO_globalTagInPart(myFile,part,myTag)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: myFile
|
|
|
|
character(len=*), intent(in) :: part, &
|
|
|
|
myTag
|
|
|
|
|
|
|
|
integer(pInt), parameter :: maxNchunks = 1_pInt
|
|
|
|
|
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: positions
|
|
|
|
integer(pInt) :: section
|
|
|
|
character(len=1024) :: line, &
|
|
|
|
tag
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
IO_globalTagInPart = .false. ! assume to nowhere spot tag
|
2012-06-26 15:54:54 +05:30
|
|
|
section = 0_pInt
|
|
|
|
line =''
|
|
|
|
|
|
|
|
rewind(myFile)
|
2013-02-11 15:14:17 +05:30
|
|
|
do while (IO_getTag(line,'<','>') /= part) ! search for part
|
2012-06-26 15:54:54 +05:30
|
|
|
read(myFile,'(a1024)',END=100) line
|
|
|
|
enddo
|
|
|
|
|
|
|
|
do
|
|
|
|
read(myFile,'(a1024)',END=100) line
|
2013-02-11 15:14:17 +05:30
|
|
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
|
|
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
|
|
|
|
if (IO_getTag(line,'[',']') /= '') & ! found [section] identifier
|
2012-06-26 15:54:54 +05:30
|
|
|
section = section + 1_pInt
|
|
|
|
if (section == 0_pInt) then
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
|
|
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
|
|
|
if (tag == myTag) & ! match
|
|
|
|
IO_globalTagInPart = .true.
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
|
|
|
100 end function IO_globalTagInPart
|
|
|
|
|
|
|
|
|
2013-02-13 00:30:41 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief verify integer value in given string
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
integer(pInt) function IO_verifyIntValue (line,validChars,myName)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
character(len=*), intent(in) :: line,validChars,myName
|
|
|
|
integer(pInt) :: readStatus, invalidWhere
|
|
|
|
character(len=len(trim(adjustl(line)))) :: trimmed
|
|
|
|
|
|
|
|
trimmed = trim(adjustl(line))
|
2013-02-13 21:17:00 +05:30
|
|
|
IO_verifyIntValue = 0_pInt
|
2013-02-13 00:30:41 +05:30
|
|
|
|
|
|
|
invalidWhere = verify(trimmed,validChars)
|
|
|
|
if (invalidWhere == 0_pInt) then
|
|
|
|
read(UNIT=trimmed,iostat=readStatus,FMT=*) IO_verifyIntValue ! no offending chars found
|
|
|
|
if (readStatus /= 0_pInt) & ! error during string to float conversion
|
|
|
|
call IO_warning(203,ext_msg=myName//'"'//trimmed//'"')
|
|
|
|
else
|
|
|
|
call IO_warning(202,ext_msg=myName//'"'//trimmed//'"') ! complain about offending characters
|
|
|
|
read(UNIT=trimmed(1_pInt:invalidWhere-1_pInt),iostat=readStatus,FMT=*) IO_verifyIntValue ! interpret remaining string
|
|
|
|
if (readStatus /= 0_pInt) & ! error during string to float conversion
|
|
|
|
call IO_warning(203,ext_msg=myName//'"'//trimmed(1_pInt:invalidWhere-1_pInt)//'"')
|
|
|
|
endif
|
|
|
|
|
|
|
|
end function IO_verifyIntValue
|
|
|
|
|
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief verify float value in given string
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
real(pReal) function IO_verifyFloatValue (line,validChars,myName)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
character(len=*), intent(in) :: line,validChars,myName
|
|
|
|
integer(pInt) :: readStatus, invalidWhere
|
|
|
|
character(len=len(trim(adjustl(line)))) :: trimmed
|
|
|
|
|
|
|
|
trimmed = trim(adjustl(line))
|
|
|
|
IO_verifyFloatValue = 0.0_pReal
|
|
|
|
|
|
|
|
invalidWhere = verify(trimmed,validChars)
|
|
|
|
if (invalidWhere == 0_pInt) then
|
|
|
|
read(UNIT=trimmed,iostat=readStatus,FMT=*) IO_verifyFloatValue ! no offending chars found
|
|
|
|
if (readStatus /= 0_pInt) & ! error during string to float conversion
|
|
|
|
call IO_warning(203,ext_msg=myName//'"'//trimmed//'"')
|
|
|
|
else
|
|
|
|
call IO_warning(202,ext_msg=myName//'"'//trimmed//'"') ! complain about offending characters
|
|
|
|
read(UNIT=trimmed(1_pInt:invalidWhere-1_pInt),iostat=readStatus,FMT=*) IO_verifyFloatValue ! interpret remaining string
|
|
|
|
if (readStatus /= 0_pInt) & ! error during string to float conversion
|
|
|
|
call IO_warning(203,ext_msg=myName//'"'//trimmed(1_pInt:invalidWhere-1_pInt)//'"')
|
|
|
|
endif
|
|
|
|
|
|
|
|
end function IO_verifyFloatValue
|
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief locate at most N space-separated parts in line return array containing number of parts
|
|
|
|
!> in line and the left/right positions of at most N to be used by IO_xxxVal
|
2013-01-29 15:58:01 +05:30
|
|
|
!> IMPORTANT: first element contains number of chunks!
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
pure function IO_stringPos(line,N)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2013-02-06 22:11:09 +05:30
|
|
|
integer(pInt), intent(in) :: N
|
|
|
|
integer(pInt), dimension(1_pInt+N*2_pInt) :: IO_stringPos
|
|
|
|
character(len=*), intent(in) :: line
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2012-11-06 22:46:01 +05:30
|
|
|
character(len=*), parameter :: sep=achar(44)//achar(32)//achar(9)//achar(10)//achar(13) ! comma and whitespaces
|
2013-02-06 22:11:09 +05:30
|
|
|
integer :: left, right ! no pInt (verify and scan return default integer)
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2007-04-25 20:08:22 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_stringPos = -1_pInt
|
|
|
|
IO_stringPos(1) = 0_pInt
|
2009-12-15 21:33:53 +05:30
|
|
|
right = 0
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2009-12-15 21:33:53 +05:30
|
|
|
do while (verify(line(right+1:),sep)>0)
|
|
|
|
left = right + verify(line(right+1:),sep)
|
|
|
|
right = left + scan(line(left:),sep) - 2
|
2011-05-30 14:39:19 +05:30
|
|
|
if ( line(left:left) == '#' ) then
|
|
|
|
exit
|
|
|
|
endif
|
2009-12-15 21:33:53 +05:30
|
|
|
if ( IO_stringPos(1)<N ) then
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_stringPos(1_pInt+IO_stringPos(1)*2_pInt+1_pInt) = int(left, pInt)
|
|
|
|
IO_stringPos(1_pInt+IO_stringPos(1)*2_pInt+2_pInt) = int(right, pInt)
|
2009-12-15 21:33:53 +05:30
|
|
|
endif
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_stringPos(1) = IO_stringPos(1)+1_pInt
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2009-12-15 21:33:53 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_stringPos
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief read string value at myPos from line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-02-08 21:25:53 +05:30
|
|
|
function IO_stringValue(line,positions,myPos,silent)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2013-02-15 13:56:38 +05:30
|
|
|
character(len=*), intent(in) :: line
|
2013-02-06 22:11:09 +05:30
|
|
|
integer(pInt), dimension(:), intent(in) :: positions
|
|
|
|
integer(pInt), intent(in) :: myPos
|
2013-02-08 21:25:53 +05:30
|
|
|
logical, optional,intent(in) :: silent
|
2013-02-15 13:56:38 +05:30
|
|
|
character(len=16), parameter :: myName = 'IO_stringValue: '
|
|
|
|
character(len=1+positions(myPos*2+1)-positions(myPos*2)) :: IO_stringValue
|
2013-02-08 21:25:53 +05:30
|
|
|
logical :: warn
|
|
|
|
|
|
|
|
if (.not. present(silent)) then
|
|
|
|
warn = .false.
|
|
|
|
else
|
|
|
|
warn = silent
|
|
|
|
endif
|
|
|
|
|
|
|
|
IO_stringValue = ''
|
|
|
|
if (myPos > positions(1) .or. myPos < 1_pInt) then ! trying to access non-present value
|
2013-02-15 13:56:38 +05:30
|
|
|
if (warn) call IO_warning(201,e=myPos,ext_msg=myName//trim(line))
|
2007-03-28 15:30:49 +05:30
|
|
|
else
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_stringValue = line(positions(myPos*2):positions(myPos*2+1))
|
2007-03-28 15:30:49 +05:30
|
|
|
endif
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_stringValue
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief read string value at myPos from fixed format line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
pure function IO_fixedStringValue (line,ends,myPos)
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
implicit none
|
2013-02-06 22:11:09 +05:30
|
|
|
integer(pInt), intent(in) :: myPos
|
|
|
|
integer(pInt), dimension(:), intent(in) :: ends
|
|
|
|
character(len=ends(myPos+1)-ends(myPos)) :: IO_fixedStringValue
|
|
|
|
character(len=*), intent(in) :: line
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_fixedStringValue = line(ends(myPos)+1:ends(myPos+1))
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_fixedStringValue
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief read float value at myPos from line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-02-06 22:11:09 +05:30
|
|
|
real(pReal) function IO_floatValue (line,positions,myPos)
|
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
implicit none
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=*), intent(in) :: line
|
|
|
|
integer(pInt), dimension(:), intent(in) :: positions
|
|
|
|
integer(pInt), intent(in) :: myPos
|
2013-02-08 21:25:53 +05:30
|
|
|
character(len=15), parameter :: myName = 'IO_floatValue: '
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=17), parameter :: validCharacters = '0123456789eEdD.+-'
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2013-02-06 22:11:09 +05:30
|
|
|
IO_floatValue = 0.0_pReal
|
2013-02-13 00:30:41 +05:30
|
|
|
|
2013-02-08 21:25:53 +05:30
|
|
|
if (myPos > positions(1) .or. myPos < 1_pInt) then ! trying to access non-present value
|
2013-02-15 13:56:38 +05:30
|
|
|
call IO_warning(201,e=myPos,ext_msg=myName//trim(line))
|
2009-06-19 12:39:39 +05:30
|
|
|
else
|
2013-02-13 00:30:41 +05:30
|
|
|
IO_floatValue = IO_verifyFloatValue(line(positions(myPos*2):positions(myPos*2+1)),&
|
|
|
|
validCharacters,myName)
|
2007-03-28 15:30:49 +05:30
|
|
|
endif
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_floatValue
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief read float value at myPos from fixed format line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-02-06 22:11:09 +05:30
|
|
|
real(pReal) function IO_fixedFloatValue (line,ends,myPos)
|
2013-02-13 00:30:41 +05:30
|
|
|
|
2007-03-21 20:15:03 +05:30
|
|
|
implicit none
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=*), intent(in) :: line
|
|
|
|
integer(pInt), intent(in) :: myPos
|
|
|
|
integer(pInt), dimension(:), intent(in) :: ends
|
2013-02-08 21:25:53 +05:30
|
|
|
character(len=20), parameter :: myName = 'IO_fixedFloatValue: '
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=17), parameter :: validCharacters = '0123456789eEdD.+-'
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2013-02-13 00:30:41 +05:30
|
|
|
IO_fixedFloatValue = IO_verifyFloatValue(line(ends(myPos)+1_pInt:ends(myPos+1_pInt)),&
|
|
|
|
validCharacters,myName)
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_fixedFloatValue
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-02-13 00:30:41 +05:30
|
|
|
!> @brief read float x.y+z value at myPos from format line
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-02-06 22:11:09 +05:30
|
|
|
real(pReal) function IO_fixedNoEFloatValue (line,ends,myPos)
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2007-03-21 20:15:03 +05:30
|
|
|
implicit none
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=*), intent(in) :: line
|
|
|
|
integer(pInt), intent(in) :: myPos
|
|
|
|
integer(pInt), dimension(:), intent(in) :: ends
|
2013-02-08 21:25:53 +05:30
|
|
|
character(len=22), parameter :: myName = 'IO_fixedNoEFloatValue '
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=13), parameter :: validBase = '0123456789.+-'
|
|
|
|
character(len=12), parameter :: validExp = '0123456789+-'
|
2013-02-13 00:30:41 +05:30
|
|
|
real(pReal) :: base
|
|
|
|
integer(pInt) :: expon
|
|
|
|
integer :: pos_exp
|
2013-02-06 22:11:09 +05:30
|
|
|
|
2013-02-13 00:30:41 +05:30
|
|
|
pos_exp = scan(line(ends(myPos)+1:ends(myPos+1)),'+-',back=.true.)
|
|
|
|
if (pos_exp > 1) then
|
|
|
|
base = IO_verifyFloatValue(line(ends(myPos)+1_pInt:ends(myPos)+pos_exp-1_pInt),&
|
|
|
|
validBase,myName//'(base): ')
|
|
|
|
expon = IO_verifyIntValue(line(ends(myPos)+pos_exp:ends(myPos+1_pInt)),&
|
|
|
|
validExp,myName//'(exp): ')
|
2007-03-21 20:15:03 +05:30
|
|
|
else
|
2013-02-13 00:30:41 +05:30
|
|
|
base = IO_verifyFloatValue(line(ends(myPos)+1_pInt:ends(myPos+1_pInt)),&
|
|
|
|
validBase,myName//'(base): ')
|
|
|
|
expon = 0_pInt
|
2007-03-21 20:15:03 +05:30
|
|
|
endif
|
2013-02-13 00:30:41 +05:30
|
|
|
IO_fixedNoEFloatValue = base*10.0_pReal**real(expon,pReal)
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_fixedNoEFloatValue
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief read int value at myPos from line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-02-06 22:11:09 +05:30
|
|
|
integer(pInt) function IO_intValue(line,positions,myPos)
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
implicit none
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=*), intent(in) :: line
|
|
|
|
integer(pInt), dimension(:), intent(in) :: positions
|
|
|
|
integer(pInt), intent(in) :: myPos
|
2013-02-08 21:25:53 +05:30
|
|
|
character(len=13), parameter :: myName = 'IO_intValue: '
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=12), parameter :: validCharacters = '0123456789+-'
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2013-02-13 21:17:00 +05:30
|
|
|
IO_intValue = 0_pInt
|
2013-02-13 00:30:41 +05:30
|
|
|
|
2013-02-08 21:25:53 +05:30
|
|
|
if (myPos > positions(1) .or. myPos < 1_pInt) then ! trying to access non-present value
|
2013-02-15 13:56:38 +05:30
|
|
|
call IO_warning(201,e=myPos,ext_msg=myName//trim(line))
|
2009-06-19 12:39:39 +05:30
|
|
|
else
|
2013-02-13 00:30:41 +05:30
|
|
|
IO_intValue = IO_verifyIntValue(line(positions(myPos*2):positions(myPos*2+1)),&
|
|
|
|
validCharacters,myName)
|
2007-04-25 20:08:22 +05:30
|
|
|
endif
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_intValue
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief read int value at myPos from fixed format line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-02-06 22:11:09 +05:30
|
|
|
integer(pInt) function IO_fixedIntValue(line,ends,myPos)
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
implicit none
|
2013-02-06 22:11:09 +05:30
|
|
|
character(len=*), intent(in) :: line
|
|
|
|
integer(pInt), intent(in) :: myPos
|
|
|
|
integer(pInt), dimension(:), intent(in) :: ends
|
2013-02-13 00:30:41 +05:30
|
|
|
character(len=20), parameter :: myName = 'IO_fixedIntValue: '
|
|
|
|
character(len=12), parameter :: validCharacters = '0123456789+-'
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2013-02-13 00:30:41 +05:30
|
|
|
IO_fixedIntValue = IO_verifyIntValue(line(ends(myPos)+1_pInt:ends(myPos+1_pInt)),&
|
|
|
|
validCharacters,myName)
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_fixedIntValue
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief change character in line to lower case
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
pure function IO_lc(line)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-06-02 19:53:28 +05:30
|
|
|
character(26), parameter :: lower = 'abcdefghijklmnopqrstuvwxyz'
|
|
|
|
character(26), parameter :: upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=*), intent(in) :: line
|
|
|
|
character(len=len(line)) :: IO_lc
|
|
|
|
|
2013-02-06 22:11:09 +05:30
|
|
|
integer :: i,n ! no pInt (len returns default integer)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2007-03-21 18:02:15 +05:30
|
|
|
IO_lc = line
|
2007-04-25 20:08:22 +05:30
|
|
|
do i=1,len(line)
|
2012-06-02 19:53:28 +05:30
|
|
|
n = index(upper,IO_lc(i:i))
|
|
|
|
if (n/=0) IO_lc(i:i) = lower(n:n)
|
2007-04-25 20:08:22 +05:30
|
|
|
enddo
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_lc
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief in place change of character in line to lower case
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-01-11 16:10:16 +05:30
|
|
|
pure subroutine IO_lcInplace(line)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-06-02 19:53:28 +05:30
|
|
|
character(26), parameter :: lower = 'abcdefghijklmnopqrstuvwxyz'
|
|
|
|
character(26), parameter :: upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=*), intent(inout) :: line
|
|
|
|
character(len=len(line)) :: IO_lc
|
2012-03-07 15:37:29 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
integer :: i,n ! no pInt (len returns default integer)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2007-04-25 20:08:22 +05:30
|
|
|
do i=1,len(line)
|
2012-06-02 19:53:28 +05:30
|
|
|
n = index(upper,line(i:i))
|
|
|
|
if (n/=0) then
|
|
|
|
IO_lc(i:i) = lower(n:n)
|
|
|
|
else
|
|
|
|
IO_lc(i:i) = line(i:i)
|
|
|
|
endif
|
2007-04-25 20:08:22 +05:30
|
|
|
enddo
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
end subroutine IO_lcInplace
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief read on in file to skip (at least) N chunks (may be over multiple lines)
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_skipChunks(myUnit,N)
|
2009-04-03 12:34:31 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit, &
|
|
|
|
N
|
2012-03-07 15:37:29 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), parameter :: maxNchunks = 64_pInt
|
|
|
|
|
|
|
|
integer(pInt) :: remainingChunks
|
2012-02-16 00:28:38 +05:30
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: myPos
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=300) :: line
|
2009-04-03 12:34:31 +05:30
|
|
|
|
|
|
|
remainingChunks = N
|
|
|
|
do while (remainingChunks > 0)
|
2012-02-21 21:12:47 +05:30
|
|
|
read(myUnit,'(A300)',end=100) line
|
2012-02-16 00:28:38 +05:30
|
|
|
myPos = IO_stringPos(line,maxNchunks)
|
|
|
|
remainingChunks = remainingChunks - myPos(1)
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2012-03-06 20:22:48 +05:30
|
|
|
100 end subroutine IO_skipChunks
|
2009-04-03 12:34:31 +05:30
|
|
|
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief extract value from key=value pair and check whether key matches
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=300) pure function IO_extractValue(line,key)
|
2009-04-03 12:34:31 +05:30
|
|
|
|
2009-10-12 21:31:49 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=*), intent(in) :: line, &
|
|
|
|
key
|
2012-03-07 15:37:29 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=*), parameter :: sep = achar(61) ! '='
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-11-07 15:01:46 +05:30
|
|
|
integer :: myPos ! no pInt (scan returns default integer)
|
2009-10-12 21:31:49 +05:30
|
|
|
|
|
|
|
IO_extractValue = ''
|
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
myPos = scan(line,sep)
|
2012-11-07 15:01:46 +05:30
|
|
|
if (myPos > 0 .and. line(:myPos-1) == key(:myPos-1)) & ! key matches expected key
|
|
|
|
IO_extractValue = line(myPos+1:) ! extract value
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_extractValue
|
2009-10-12 21:31:49 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief count lines containig data up to next *keyword
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) function IO_countDataLines(myUnit)
|
2007-10-15 19:25:52 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
|
|
|
|
integer(pInt), parameter :: maxNchunks = 1_pInt
|
2007-10-15 19:25:52 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: myPos
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=300) :: line, &
|
|
|
|
tmp
|
2007-10-15 19:25:52 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
IO_countDataLines = 0_pInt
|
2012-03-09 20:52:52 +05:30
|
|
|
|
2007-10-15 19:25:52 +05:30
|
|
|
do
|
2012-02-16 00:28:38 +05:30
|
|
|
read(myUnit,'(A300)',end=100) line
|
|
|
|
myPos = IO_stringPos(line,maxNchunks)
|
|
|
|
tmp = IO_lc(IO_stringValue(line,myPos,1_pInt))
|
2013-02-11 15:14:17 +05:30
|
|
|
if (tmp(1:1) == '*' .and. tmp(2:2) /= '*') then ! found keyword
|
2009-10-12 21:31:49 +05:30
|
|
|
exit
|
2007-10-15 19:25:52 +05:30
|
|
|
else
|
2010-07-13 15:56:07 +05:30
|
|
|
if (tmp(2:2) /= '*') IO_countDataLines = IO_countDataLines + 1_pInt
|
2007-10-15 19:25:52 +05:30
|
|
|
endif
|
|
|
|
enddo
|
2012-02-16 00:28:38 +05:30
|
|
|
100 backspace(myUnit)
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end function IO_countDataLines
|
2009-10-12 21:31:49 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief count items in consecutive lines depending on lines
|
|
|
|
!> @details Marc: ints concatenated by "c" as last char or range of values a "to" b
|
|
|
|
!> Abaqus: triplet of start,stop,inc
|
2012-10-18 15:47:16 +05:30
|
|
|
!> Spectral: ints concatenated range of a "to" b, multiple entries with a "of" b
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-04-11 22:54:50 +05:30
|
|
|
integer(pInt) function IO_countContinuousIntValues(myUnit)
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: myUnit
|
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
integer(pInt), parameter :: maxNchunks = 8192_pInt
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifdef Abaqus
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) :: l,c
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2012-02-16 00:28:38 +05:30
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: myPos
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=65536) :: line
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-04-11 22:54:50 +05:30
|
|
|
IO_countContinuousIntValues = 0_pInt
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifndef Abaqus
|
|
|
|
do
|
|
|
|
read(myUnit,'(A300)',end=100) line
|
|
|
|
myPos = IO_stringPos(line,maxNchunks)
|
2013-02-11 15:14:17 +05:30
|
|
|
if (myPos(1) < 1_pInt) then ! empty line
|
2012-11-07 15:01:46 +05:30
|
|
|
exit
|
|
|
|
elseif (IO_lc(IO_stringValue(line,myPos,2_pInt)) == 'to' ) then ! found range indicator
|
|
|
|
IO_countContinuousIntValues = 1_pInt + IO_intValue(line,myPos,3_pInt) &
|
|
|
|
- IO_intValue(line,myPos,1_pInt)
|
|
|
|
exit ! only one single range indicator allowed
|
|
|
|
else if (IO_lc(IO_stringValue(line,myPos,2_pInt)) == 'of' ) then ! found multiple entries indicator
|
2012-06-15 21:40:21 +05:30
|
|
|
IO_countContinuousIntValues = IO_intValue(line,myPos,1_pInt)
|
2012-11-07 15:01:46 +05:30
|
|
|
exit ! only one single multiplier allowed
|
2012-06-15 21:40:21 +05:30
|
|
|
else
|
2012-11-07 15:01:46 +05:30
|
|
|
IO_countContinuousIntValues = IO_countContinuousIntValues+myPos(1)-1_pInt ! add line's count when assuming 'c'
|
|
|
|
if ( IO_lc(IO_stringValue(line,myPos,myPos(1))) /= 'c' ) then ! line finished, read last value
|
2012-06-15 21:40:21 +05:30
|
|
|
IO_countContinuousIntValues = IO_countContinuousIntValues+1_pInt
|
2012-11-07 15:01:46 +05:30
|
|
|
exit ! data ended
|
2012-06-15 21:40:21 +05:30
|
|
|
endif
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
#else
|
|
|
|
c = IO_countDataLines(myUnit)
|
|
|
|
do l = 1_pInt,c
|
|
|
|
backspace(myUnit)
|
|
|
|
enddo
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
do l = 1_pInt,c
|
|
|
|
read(myUnit,'(A300)',end=100) line
|
|
|
|
myPos = IO_stringPos(line,maxNchunks)
|
2013-02-11 15:14:17 +05:30
|
|
|
IO_countContinuousIntValues = IO_countContinuousIntValues + 1_pInt + & ! assuming range generation
|
2012-06-15 21:40:21 +05:30
|
|
|
(IO_intValue(line,myPos,2_pInt)-IO_intValue(line,myPos,1_pInt))/&
|
|
|
|
max(1_pInt,IO_intValue(line,myPos,3_pInt))
|
|
|
|
enddo
|
|
|
|
#endif
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-04-11 22:54:50 +05:30
|
|
|
100 end function IO_countContinuousIntValues
|
2007-10-15 19:25:52 +05:30
|
|
|
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief return integer list corrsponding to items in consecutive lines.
|
2012-04-11 22:54:50 +05:30
|
|
|
! First integer in array is counter
|
2012-08-09 16:31:53 +05:30
|
|
|
!> @details Marc: ints concatenated by "c" as last char, range of a "to" b, or named set
|
2012-04-11 22:54:50 +05:30
|
|
|
! Abaqus: triplet of start,stop,inc or named set
|
2012-10-18 15:47:16 +05:30
|
|
|
! Spectral: ints concatenated range of a "to" b, multiple entries with a "of" b
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-04-11 22:54:50 +05:30
|
|
|
function IO_continuousIntValues(myUnit,maxN,lookupName,lookupMap,lookupMaxN)
|
2007-04-25 20:08:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: maxN
|
2012-04-11 22:54:50 +05:30
|
|
|
integer(pInt), dimension(1+maxN) :: IO_continuousIntValues
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
integer(pInt), intent(in) :: myUnit, &
|
|
|
|
lookupMaxN
|
|
|
|
integer(pInt), dimension(:,:), intent(in) :: lookupMap
|
|
|
|
character(len=64), dimension(:), intent(in) :: lookupName
|
2012-01-12 22:31:24 +05:30
|
|
|
integer(pInt), parameter :: maxNchunks = 8192_pInt
|
2012-06-15 21:40:21 +05:30
|
|
|
integer(pInt) :: i
|
|
|
|
#ifdef Abaqus
|
|
|
|
integer(pInt) :: j,l,c,first,last
|
|
|
|
#endif
|
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: myPos
|
2012-01-12 22:31:24 +05:30
|
|
|
character(len=65536) line
|
2010-07-13 15:56:07 +05:30
|
|
|
logical rangeGeneration
|
2007-04-25 20:08:22 +05:30
|
|
|
|
2012-04-11 22:54:50 +05:30
|
|
|
IO_continuousIntValues = 0_pInt
|
2010-07-13 15:56:07 +05:30
|
|
|
rangeGeneration = .false.
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifndef Abaqus
|
|
|
|
do
|
|
|
|
read(myUnit,'(A65536)',end=100) line
|
|
|
|
myPos = IO_stringPos(line,maxNchunks)
|
2012-11-07 15:01:46 +05:30
|
|
|
if (myPos(1) < 1_pInt) then ! empty line
|
|
|
|
exit
|
|
|
|
elseif (verify(IO_stringValue(line,myPos,1_pInt),'0123456789') > 0) then ! a non-int, i.e. set name
|
|
|
|
do i = 1_pInt, lookupMaxN ! loop over known set names
|
|
|
|
if (IO_stringValue(line,myPos,1_pInt) == lookupName(i)) then ! found matching name
|
|
|
|
IO_continuousIntValues = lookupMap(:,i) ! return resp. entity list
|
2012-04-11 22:54:50 +05:30
|
|
|
exit
|
2007-10-23 18:38:27 +05:30
|
|
|
endif
|
|
|
|
enddo
|
2012-06-15 21:40:21 +05:30
|
|
|
exit
|
|
|
|
else if (myPos(1) > 2_pInt .and. IO_lc(IO_stringValue(line,myPos,2_pInt)) == 'to' ) then ! found range indicator
|
|
|
|
do i = IO_intValue(line,myPos,1_pInt),IO_intValue(line,myPos,3_pInt)
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = i
|
2010-07-13 15:56:07 +05:30
|
|
|
enddo
|
2012-06-15 21:40:21 +05:30
|
|
|
exit
|
2012-10-18 15:47:16 +05:30
|
|
|
else if (myPos(1) > 2_pInt .and. IO_lc(IO_stringValue(line,myPos,2_pInt)) == 'of' ) then ! found multiple entries indicator
|
2012-06-15 21:40:21 +05:30
|
|
|
IO_continuousIntValues(1) = IO_intValue(line,myPos,1_pInt)
|
2012-10-18 15:47:16 +05:30
|
|
|
IO_continuousIntValues(2:IO_continuousIntValues(1)+1) = IO_intValue(line,myPos,3_pInt)
|
2012-06-15 21:40:21 +05:30
|
|
|
exit
|
|
|
|
else
|
2012-11-07 15:01:46 +05:30
|
|
|
do i = 1_pInt,myPos(1)-1_pInt ! interpret up to second to last value
|
2012-06-15 21:40:21 +05:30
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = IO_intValue(line,myPos,i)
|
2007-04-25 20:08:22 +05:30
|
|
|
enddo
|
2012-11-07 15:01:46 +05:30
|
|
|
if ( IO_lc(IO_stringValue(line,myPos,myPos(1))) /= 'c' ) then ! line finished, read last value
|
2012-06-15 21:40:21 +05:30
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = IO_intValue(line,myPos,myPos(1))
|
|
|
|
exit
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
#else
|
|
|
|
c = IO_countDataLines(myUnit)
|
|
|
|
do l = 1_pInt,c
|
|
|
|
backspace(myUnit)
|
|
|
|
enddo
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! check if the element values in the elset are auto generated
|
2012-06-15 21:40:21 +05:30
|
|
|
backspace(myUnit)
|
|
|
|
read(myUnit,'(A65536)',end=100) line
|
|
|
|
myPos = IO_stringPos(line,maxNchunks)
|
|
|
|
do i = 1_pInt,myPos(1)
|
|
|
|
if (IO_lc(IO_stringValue(line,myPos,i)) == 'generate') rangeGeneration = .true.
|
|
|
|
enddo
|
|
|
|
|
|
|
|
do l = 1_pInt,c
|
|
|
|
read(myUnit,'(A65536)',end=100) line
|
|
|
|
myPos = IO_stringPos(line,maxNchunks)
|
2012-11-07 15:01:46 +05:30
|
|
|
if (verify(IO_stringValue(line,myPos,1_pInt),'0123456789') > 0) then ! a non-int, i.e. set names follow on this line
|
|
|
|
do i = 1_pInt,myPos(1) ! loop over set names in line
|
|
|
|
do j = 1_pInt,lookupMaxN ! look thru known set names
|
|
|
|
if (IO_stringValue(line,myPos,i) == lookupName(j)) then ! found matching name
|
|
|
|
first = 2_pInt + IO_continuousIntValues(1) ! where to start appending data
|
|
|
|
last = first + lookupMap(1,j) - 1_pInt ! up to where to append data
|
|
|
|
IO_continuousIntValues(first:last) = lookupMap(2:1+lookupMap(1,j),j) ! add resp. entity list
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + lookupMap(1,j) ! count them
|
2012-06-15 21:40:21 +05:30
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
2012-11-07 15:01:46 +05:30
|
|
|
else if (rangeGeneration) then ! range generation
|
2012-06-15 21:40:21 +05:30
|
|
|
do i = IO_intValue(line,myPos,1_pInt),IO_intValue(line,myPos,2_pInt),max(1_pInt,IO_intValue(line,myPos,3_pInt))
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = i
|
|
|
|
enddo
|
2012-11-07 15:01:46 +05:30
|
|
|
else ! read individual elem nums
|
2012-06-15 21:40:21 +05:30
|
|
|
do i = 1_pInt,myPos(1)
|
|
|
|
IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt
|
|
|
|
IO_continuousIntValues(1+IO_continuousIntValues(1)) = IO_intValue(line,myPos,i)
|
|
|
|
enddo
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
#endif
|
2009-10-12 21:31:49 +05:30
|
|
|
|
2012-04-11 22:54:50 +05:30
|
|
|
100 end function IO_continuousIntValues
|
2007-04-25 20:08:22 +05:30
|
|
|
|
2012-11-07 15:01:46 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief returns format string for integer values without leading zeros
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-08-31 01:56:28 +05:30
|
|
|
pure function IO_intOut(intToPrint)
|
|
|
|
implicit none
|
2012-10-02 15:00:13 +05:30
|
|
|
character(len=16) :: N_Digits
|
|
|
|
character(len=34) :: IO_intOut
|
2012-08-31 01:56:28 +05:30
|
|
|
integer(pInt), intent(in) :: intToPrint
|
|
|
|
|
|
|
|
write(N_Digits, '(I16.16)') 1_pInt + int(log10(real(intToPrint)),pInt)
|
2012-10-02 15:00:13 +05:30
|
|
|
IO_intOut = 'I'//trim(N_Digits)//'.'//trim(N_Digits)
|
2012-08-31 01:56:28 +05:30
|
|
|
|
|
|
|
end function IO_intOut
|
|
|
|
|
2012-10-02 15:00:13 +05:30
|
|
|
|
2013-02-25 22:04:59 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief returns time stamp
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
function IO_timeStamp()
|
|
|
|
implicit none
|
|
|
|
character(len=10) :: IO_timeStamp
|
|
|
|
integer(pInt), dimension(8) :: values
|
|
|
|
|
|
|
|
call DATE_AND_TIME(VALUES=values)
|
|
|
|
write(IO_timeStamp,'(i2.2,a1,i2.2,a1,i2.2)') values(5),':',values(6),':',values(7)
|
|
|
|
|
|
|
|
end function IO_timeStamp
|
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief write error statements to standard out and terminate the Marc/spectral run with exit #9xxx
|
|
|
|
!> in ABAQUS either time step is reduced or execution terminated
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_error(error_ID,e,i,g,ext_msg)
|
2007-03-20 19:25:22 +05:30
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: error_ID
|
|
|
|
integer(pInt), optional, intent(in) :: e,i,g
|
2009-03-04 17:18:54 +05:30
|
|
|
character(len=*), optional, intent(in) :: ext_msg
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
character(len=1024) :: msg
|
2013-01-10 03:49:32 +05:30
|
|
|
character(len=1024) :: formatString
|
|
|
|
|
2011-11-02 20:08:42 +05:30
|
|
|
select case (error_ID)
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! internal errors
|
2012-10-12 23:25:23 +05:30
|
|
|
case (0_pInt)
|
|
|
|
msg = 'internal check failed:'
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! file handling errors
|
2012-02-02 18:49:02 +05:30
|
|
|
case (100_pInt)
|
2012-02-13 23:11:27 +05:30
|
|
|
msg = 'could not open file:'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (101_pInt)
|
2012-02-13 23:11:27 +05:30
|
|
|
msg = 'write error for file:'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (102_pInt)
|
2012-02-13 23:11:27 +05:30
|
|
|
msg = 'could not read file:'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (103_pInt)
|
2012-02-13 23:11:27 +05:30
|
|
|
msg = 'could not assemble input files'
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! material error messages and related messages in mesh
|
2012-02-02 18:49:02 +05:30
|
|
|
case (150_pInt)
|
2011-08-02 15:44:16 +05:30
|
|
|
msg = 'crystallite index out of bounds'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (151_pInt)
|
2011-08-02 15:44:16 +05:30
|
|
|
msg = 'phase index out of bounds'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (152_pInt)
|
2011-08-02 15:44:16 +05:30
|
|
|
msg = 'texture index out of bounds'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (153_pInt)
|
2011-08-02 15:44:16 +05:30
|
|
|
msg = 'sum of phase fractions differs from 1'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (154_pInt)
|
|
|
|
msg = 'homogenization index out of bounds'
|
|
|
|
case (155_pInt)
|
|
|
|
msg = 'microstructure index out of bounds'
|
|
|
|
case (156_pInt)
|
|
|
|
msg = 'reading from ODF file'
|
|
|
|
case (160_pInt)
|
|
|
|
msg = 'no entries in config part'
|
|
|
|
case (170_pInt)
|
|
|
|
msg = 'no homogenization specified via State Variable 2'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (180_pInt)
|
2012-02-13 23:11:27 +05:30
|
|
|
msg = 'no microstructure specified via State Variable 3'
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! plasticity error messages
|
2012-02-02 18:49:02 +05:30
|
|
|
case (200_pInt)
|
2012-06-02 19:53:28 +05:30
|
|
|
msg = 'unknown elasticity specified:'
|
|
|
|
case (201_pInt)
|
|
|
|
msg = 'unknown plasticity specified:'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (205_pInt)
|
2011-08-02 15:44:16 +05:30
|
|
|
msg = 'unknown lattice structure encountered'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2012-02-14 14:52:37 +05:30
|
|
|
case (210_pInt)
|
2012-07-17 23:06:24 +05:30
|
|
|
msg = 'unknown material parameter:'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (211_pInt)
|
2012-07-17 23:06:24 +05:30
|
|
|
msg = 'material parameter out of bounds:'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (212_pInt)
|
2012-07-17 23:06:24 +05:30
|
|
|
msg = 'unknown plasticity output:'
|
|
|
|
|
2013-02-04 20:04:01 +05:30
|
|
|
case (252_pInt)
|
|
|
|
msg = 'nonlocal plasticity works only for direct CPFEM, i.e. one grain per integration point'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (253_pInt)
|
2012-03-12 20:13:19 +05:30
|
|
|
msg = 'element type not supported for nonlocal plasticity'
|
2009-10-16 01:32:52 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! numerics error messages
|
2012-02-13 23:11:27 +05:30
|
|
|
case (300_pInt)
|
|
|
|
msg = 'unknown numerics parameter:'
|
|
|
|
case (301_pInt)
|
|
|
|
msg = 'numerics parameter out of bounds:'
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! math errors
|
2012-02-13 23:11:27 +05:30
|
|
|
case (400_pInt)
|
|
|
|
msg = 'matrix inversion error'
|
|
|
|
case (401_pInt)
|
2010-05-06 19:37:21 +05:30
|
|
|
msg = 'math_check: quat -> axisAngle -> quat failed'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (402_pInt)
|
2010-05-06 19:37:21 +05:30
|
|
|
msg = 'math_check: quat -> R -> quat failed'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (403_pInt)
|
2010-05-06 19:37:21 +05:30
|
|
|
msg = 'math_check: quat -> euler -> quat failed'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (404_pInt)
|
2010-05-06 19:37:21 +05:30
|
|
|
msg = 'math_check: R -> euler -> R failed'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (405_pInt)
|
|
|
|
msg = 'I_TO_HALTON-error: An input base BASE is <= 1'
|
|
|
|
case (406_pInt)
|
|
|
|
msg = 'Prime-error: N must be between 0 and PRIME_MAX'
|
2012-05-08 18:46:59 +05:30
|
|
|
case (407_pInt)
|
|
|
|
msg = 'Dimension in nearest neigbor search wrong'
|
2012-06-02 19:53:28 +05:30
|
|
|
case (408_pInt)
|
|
|
|
msg = 'Polar decomposition error'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (450_pInt)
|
|
|
|
msg = 'unknown symmetry type specified'
|
2012-03-06 20:22:48 +05:30
|
|
|
case (460_pInt)
|
|
|
|
msg = 'kdtree2 error'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! homogenization errors
|
2012-02-13 23:11:27 +05:30
|
|
|
case (500_pInt)
|
|
|
|
msg = 'unknown homogenization specified'
|
2013-02-28 02:11:14 +05:30
|
|
|
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! user errors
|
|
|
|
case (600_pInt)
|
|
|
|
msg = 'Non-local plasticity and non-CP elements in model'
|
|
|
|
case (601_pInt)
|
|
|
|
msg = 'OpenMP threads > 1 and using non-CP elements'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! DAMASK_marc errors
|
2012-02-02 18:49:02 +05:30
|
|
|
case (700_pInt)
|
2012-02-13 23:11:27 +05:30
|
|
|
msg = 'invalid materialpoint result requested'
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! errors related to spectral solver
|
2012-02-13 23:11:27 +05:30
|
|
|
case (809_pInt)
|
|
|
|
msg = 'initializing FFTW'
|
|
|
|
case (831_pInt)
|
|
|
|
msg = 'mask consistency violated in spectral loadcase'
|
|
|
|
case (832_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'ill-defined L (line party P) in spectral loadcase'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (834_pInt)
|
|
|
|
msg = 'negative time increment in spectral loadcase'
|
|
|
|
case (835_pInt)
|
|
|
|
msg = 'non-positive increments in spectral loadcase'
|
|
|
|
case (836_pInt)
|
|
|
|
msg = 'non-positive result frequency in spectral loadcase'
|
|
|
|
case (837_pInt)
|
|
|
|
msg = 'incomplete loadcase'
|
|
|
|
case (838_pInt)
|
|
|
|
msg = 'mixed boundary conditions allow rotation'
|
2012-05-21 14:36:02 +05:30
|
|
|
case (841_pInt)
|
|
|
|
msg = 'missing header length info in spectral mesh'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (842_pInt)
|
2012-05-21 14:36:02 +05:30
|
|
|
msg = 'homogenization in spectral mesh'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (843_pInt)
|
|
|
|
msg = 'resolution in spectral mesh'
|
|
|
|
case (844_pInt)
|
|
|
|
msg = 'dimension in spectral mesh'
|
|
|
|
case (845_pInt)
|
|
|
|
msg = 'incomplete information in spectral mesh header'
|
|
|
|
case (846_pInt)
|
|
|
|
msg = 'not a rotation defined for loadcase rotation'
|
|
|
|
case (847_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'update of gamma operator not possible when pre-calculated'
|
2012-10-02 15:00:13 +05:30
|
|
|
case (850_pInt)
|
|
|
|
msg = 'max number of cut back exceeded'
|
2012-02-13 23:11:27 +05:30
|
|
|
case (880_pInt)
|
|
|
|
msg = 'mismatch of microstructure count and a*b*c in geom file'
|
2012-06-19 19:01:15 +05:30
|
|
|
case (890_pInt)
|
2012-07-31 21:07:49 +05:30
|
|
|
msg = 'invalid input for regridding'
|
2012-08-29 00:49:47 +05:30
|
|
|
case (891_pInt)
|
|
|
|
msg = 'unknown solver type selected'
|
|
|
|
case (892_pInt)
|
|
|
|
msg = 'unknown filter type selected'
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! error messages related to parsing of Abaqus input file
|
2012-02-02 18:49:02 +05:30
|
|
|
case (900_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'improper definition of nodes in input file (Nnodes < 2)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (901_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no elements defined in input file (Nelems = 0)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (902_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no element sets defined in input file (No *Elset exists)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (903_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no materials defined in input file (Look into section assigments)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (904_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no elements could be assigned for Elset: '
|
2012-02-02 18:49:02 +05:30
|
|
|
case (905_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'error in mesh_abaqus_map_materials'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (906_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'error in mesh_abaqus_count_cpElements'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (907_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'size of mesh_mapFEtoCPelem in mesh_abaqus_map_elements'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (908_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'size of mesh_mapFEtoCPnode in mesh_abaqus_map_nodes'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (909_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'size of mesh_node in mesh_abaqus_build_nodes not equal to mesh_Nnodes'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (910_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'incorrect element type mapping in '
|
2010-07-13 15:56:07 +05:30
|
|
|
|
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!-------------------------------------------------------------------------------------------------
|
|
|
|
! general error messages
|
2012-02-13 23:11:27 +05:30
|
|
|
case (666_pInt)
|
|
|
|
msg = 'memory leak detected'
|
2007-03-20 19:25:22 +05:30
|
|
|
case default
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'unknown error number...'
|
2012-02-13 23:11:27 +05:30
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
end select
|
2009-01-20 00:40:58 +05:30
|
|
|
|
2008-05-26 18:41:25 +05:30
|
|
|
!$OMP CRITICAL (write2out)
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,'(/,a)') ' +--------------------------------------------------------+'
|
|
|
|
write(6,'(a)') ' + error +'
|
|
|
|
write(6,'(a,i3,a)') ' + ',error_ID,' +'
|
|
|
|
write(6,'(a)') ' + +'
|
2013-02-21 03:26:59 +05:30
|
|
|
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(msg))),',',&
|
|
|
|
max(1,60-len(trim(msg))-5),'x,a)'
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,formatString) '+ ', trim(msg),'+'
|
|
|
|
if (present(ext_msg)) then
|
2013-02-21 03:26:59 +05:30
|
|
|
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(ext_msg))),',',&
|
|
|
|
max(1,60-len(trim(ext_msg))-5),'x,a)'
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,formatString) '+ ', trim(ext_msg),'+'
|
|
|
|
endif
|
2009-03-04 17:18:54 +05:30
|
|
|
if (present(e)) then
|
2013-01-10 03:49:32 +05:30
|
|
|
if (present(i)) then
|
|
|
|
if (present(g)) then
|
|
|
|
write(6,'(a13,1x,i9,1x,a2,1x,i2,1x,a5,1x,i4,18x,a1)') ' + at element',e,'IP',i,'grain',g,'+'
|
|
|
|
else
|
|
|
|
write(6,'(a13,1x,i9,1x,a2,1x,i2,29x,a1)') ' + at element',e,'IP',i,'+'
|
|
|
|
endif
|
2009-03-04 17:18:54 +05:30
|
|
|
else
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,'(a13,1x,i9,35x,a1)') ' + at element',e,'+'
|
2009-03-04 17:18:54 +05:30
|
|
|
endif
|
|
|
|
endif
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,'(a)') ' +--------------------------------------------------------+'
|
2012-03-06 20:22:48 +05:30
|
|
|
flush(6)
|
2012-02-10 16:54:53 +05:30
|
|
|
call quit(9000_pInt+error_ID)
|
2010-02-18 15:42:45 +05:30
|
|
|
!$OMP END CRITICAL (write2out)
|
2009-01-20 00:40:58 +05:30
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
! ABAQUS returns in some cases
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_error
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief write warning statements to standard out
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_warning(warning_ID,e,i,g,ext_msg)
|
2009-03-31 14:51:57 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: warning_ID
|
|
|
|
integer(pInt), optional, intent(in) :: e,i,g
|
2009-03-31 14:51:57 +05:30
|
|
|
character(len=*), optional, intent(in) :: ext_msg
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
character(len=1024) :: msg
|
2013-01-10 03:49:32 +05:30
|
|
|
character(len=1024) :: formatString
|
2009-03-31 14:51:57 +05:30
|
|
|
|
2011-11-02 20:08:42 +05:30
|
|
|
select case (warning_ID)
|
2012-02-02 18:49:02 +05:30
|
|
|
case (34_pInt)
|
2011-12-06 22:28:17 +05:30
|
|
|
msg = 'invalid restart increment given'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (35_pInt)
|
2012-01-30 19:22:41 +05:30
|
|
|
msg = 'could not get $DAMASK_NUM_THREADS'
|
2012-06-15 21:40:21 +05:30
|
|
|
case (40_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'found spectral solver parameter'
|
2012-08-29 00:49:47 +05:30
|
|
|
case (41_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'found PETSc solver parameter'
|
2012-10-11 20:19:12 +05:30
|
|
|
case (42_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'parameter has no effect'
|
2011-11-15 23:24:18 +05:30
|
|
|
case (47_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'no valid parameter for FFTW, using FFTW_PATIENT'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (101_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'crystallite debugging off'
|
2013-02-06 22:11:09 +05:30
|
|
|
case (201_pInt)
|
|
|
|
msg = 'position not found when parsing line'
|
|
|
|
case (202_pInt)
|
|
|
|
msg = 'invalid character in string chunk'
|
|
|
|
case (203_pInt)
|
|
|
|
msg = 'interpretation of string chunk failed'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (600_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'crystallite responds elastically'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (601_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'stiffness close to zero'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (650_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'polar decomposition failed'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (700_pInt)
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'unknown crystal symmetry'
|
2009-03-31 14:51:57 +05:30
|
|
|
case default
|
2013-01-10 03:49:32 +05:30
|
|
|
msg = 'unknown warning number'
|
2009-03-31 14:51:57 +05:30
|
|
|
end select
|
|
|
|
|
|
|
|
!$OMP CRITICAL (write2out)
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,'(/,a)') ' +--------------------------------------------------------+'
|
|
|
|
write(6,'(a)') ' + warning +'
|
|
|
|
write(6,'(a,i3,a)') ' + ',warning_ID,' +'
|
|
|
|
write(6,'(a)') ' + +'
|
2013-02-21 03:26:59 +05:30
|
|
|
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(msg))),',',&
|
|
|
|
max(1,60-len(trim(msg))-5),'x,a)'
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,formatString) '+ ', trim(msg),'+'
|
|
|
|
if (present(ext_msg)) then
|
2013-02-21 03:26:59 +05:30
|
|
|
write(formatString,'(a,i6.6,a,i6.6,a)') '(1x,a2,a',max(1,len(trim(ext_msg))),',',&
|
|
|
|
max(1,60-len(trim(ext_msg))-5),'x,a)'
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,formatString) '+ ', trim(ext_msg),'+'
|
|
|
|
endif
|
2009-03-31 14:51:57 +05:30
|
|
|
if (present(e)) then
|
2010-11-04 23:48:01 +05:30
|
|
|
if (present(i)) then
|
|
|
|
if (present(g)) then
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,'(a13,1x,i9,1x,a2,1x,i2,1x,a5,1x,i4,18x,a1)') ' + at element',e,'IP',i,'grain',g,'+'
|
2010-11-04 23:48:01 +05:30
|
|
|
else
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,'(a13,1x,i9,1x,a2,1x,i2,29x,a1)') ' + at element',e,'IP',i,'+'
|
2010-11-04 23:48:01 +05:30
|
|
|
endif
|
2009-03-31 14:51:57 +05:30
|
|
|
else
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,'(a13,1x,i9,35x,a1)') ' + at element',e,'+'
|
2009-03-31 14:51:57 +05:30
|
|
|
endif
|
|
|
|
endif
|
2013-01-10 03:49:32 +05:30
|
|
|
write(6,'(a)') ' +--------------------------------------------------------+'
|
2012-03-06 20:22:48 +05:30
|
|
|
flush(6)
|
2010-04-06 12:17:15 +05:30
|
|
|
!$OMP END CRITICAL (write2out)
|
2009-03-31 14:51:57 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end subroutine IO_warning
|
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
! internal helper functions
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifdef Abaqus
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief create a new input file for abaqus simulations by removing all comment lines and
|
|
|
|
!> including "include"s
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
recursive function abaqus_assembleInputFile(unit1,unit2) result(createSuccess)
|
|
|
|
|
|
|
|
use DAMASK_interface, only: getSolverWorkingDirectoryName
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in) :: unit1, &
|
|
|
|
unit2
|
|
|
|
|
|
|
|
integer(pInt), parameter :: maxNchunks = 6_pInt
|
2012-03-07 15:37:29 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), dimension(1+2*maxNchunks) :: positions
|
|
|
|
character(len=300) :: line,fname
|
|
|
|
logical :: createSuccess,fexist
|
|
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
read(unit2,'(A300)',END=220) line
|
|
|
|
positions = IO_stringPos(line,maxNchunks)
|
|
|
|
|
|
|
|
if (IO_lc(IO_StringValue(line,positions,1_pInt))=='*include') then
|
|
|
|
fname = trim(getSolverWorkingDirectoryName())//trim(line(9+scan(line(9:),'='):))
|
|
|
|
inquire(file=fname, exist=fexist)
|
|
|
|
if (.not.(fexist)) then
|
|
|
|
!$OMP CRITICAL (write2out)
|
|
|
|
write(6,*)'ERROR: file does not exist error in abaqus_assembleInputFile'
|
|
|
|
write(6,*)'filename: ', trim(fname)
|
|
|
|
!$OMP END CRITICAL (write2out)
|
|
|
|
createSuccess = .false.
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
open(unit2+1,err=200,status='old',file=fname)
|
|
|
|
if (abaqus_assembleInputFile(unit1,unit2+1_pInt)) then
|
|
|
|
createSuccess=.true.
|
|
|
|
close(unit2+1)
|
|
|
|
else
|
|
|
|
createSuccess=.false.
|
|
|
|
return
|
|
|
|
endif
|
2012-05-15 20:29:26 +05:30
|
|
|
else if (line(1:2) /= '**' .OR. line(1:8)=='**damask') then
|
2012-03-06 20:22:48 +05:30
|
|
|
write(unit1,'(A)') trim(line)
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
|
|
|
220 createSuccess = .true.
|
|
|
|
return
|
|
|
|
|
|
|
|
200 createSuccess =.false.
|
|
|
|
|
|
|
|
end function abaqus_assembleInputFile
|
2012-06-15 21:40:21 +05:30
|
|
|
#endif
|
2012-03-06 20:22:48 +05:30
|
|
|
|
2013-02-11 15:14:17 +05:30
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief hybrid IA repetition counter
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2013-01-11 16:10:16 +05:30
|
|
|
integer(pInt) pure function hybridIA_reps(dV_V,steps,C)
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
implicit none
|
2013-01-11 16:10:16 +05:30
|
|
|
integer(pInt), intent(in), dimension(3) :: &
|
2012-03-06 20:22:48 +05:30
|
|
|
steps
|
|
|
|
real(pReal), intent(in), dimension(steps(3),steps(2),steps(1)) :: &
|
|
|
|
dV_V
|
|
|
|
real(pReal), intent(in) :: &
|
|
|
|
C
|
2013-01-11 16:10:16 +05:30
|
|
|
integer(pInt) :: phi1,Phi,phi2
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
hybridIA_reps = 0_pInt
|
|
|
|
do phi1=1_pInt,steps(1)
|
|
|
|
do Phi =1_pInt,steps(2)
|
|
|
|
do phi2=1_pInt,steps(3)
|
|
|
|
hybridIA_reps = hybridIA_reps+nint(C*dV_V(phi2,Phi,phi1), pInt)
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
|
|
|
|
end function hybridIA_reps
|
2009-03-31 14:51:57 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
end module IO
|