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
|
|
|
|
use prec, only: pInt, pReal
|
2012-02-10 16:54:53 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
implicit none
|
|
|
|
private
|
|
|
|
public :: IO_init, &
|
2012-04-20 17:28:41 +05:30
|
|
|
IO_checkAndRewind, &
|
2012-03-06 20:22:48 +05:30
|
|
|
IO_open_file_stat, &
|
|
|
|
IO_open_jobFile_stat, &
|
|
|
|
IO_open_file, &
|
|
|
|
IO_open_jobFile, &
|
|
|
|
IO_write_jobFile, &
|
|
|
|
IO_write_jobBinaryFile, &
|
|
|
|
IO_read_jobBinaryFile, &
|
|
|
|
IO_hybridIA, &
|
|
|
|
IO_isBlank, &
|
|
|
|
IO_getTag, &
|
|
|
|
IO_countSections, &
|
|
|
|
IO_countTagInPart, &
|
|
|
|
IO_spotTagInPart, &
|
2012-06-26 15:54:54 +05:30
|
|
|
IO_globalTagInPart, &
|
2012-03-06 20:22:48 +05:30
|
|
|
IO_stringPos, &
|
|
|
|
IO_stringValue, &
|
|
|
|
IO_fixedStringValue ,&
|
|
|
|
IO_floatValue, &
|
|
|
|
IO_fixedNoEFloatValue, &
|
|
|
|
IO_intValue, &
|
|
|
|
IO_fixedIntValue, &
|
|
|
|
IO_lc, &
|
|
|
|
IO_skipChunks, &
|
|
|
|
IO_extractValue, &
|
|
|
|
IO_countDataLines, &
|
2012-04-11 22:54:50 +05:30
|
|
|
IO_countContinuousIntValues, &
|
|
|
|
IO_continuousIntValues, &
|
2012-03-06 20:22:48 +05:30
|
|
|
IO_error, &
|
|
|
|
IO_warning
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifndef Spectral
|
|
|
|
public :: IO_open_inputFile, &
|
|
|
|
IO_open_logFile
|
|
|
|
#endif
|
2012-08-09 16:31:53 +05:30
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifdef Abaqus
|
|
|
|
public :: IO_abaqus_hasNoPart
|
|
|
|
#endif
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
private :: IO_fixedFloatValue, &
|
|
|
|
IO_lcInplace ,&
|
|
|
|
hybridIA_reps
|
2012-08-09 16:31:53 +05:30
|
|
|
|
2012-06-15 21:40:21 +05:30
|
|
|
#ifdef Abaqus
|
|
|
|
private :: abaqus_assembleInputFile
|
|
|
|
#endif
|
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
|
|
|
|
|
|
|
write(6,*)
|
|
|
|
write(6,*) '<<<+- IO init -+>>>'
|
|
|
|
write(6,*) '$Id$'
|
2012-02-01 00:48:55 +05:30
|
|
|
#include "compilation_info.f90"
|
2012-03-06 20:22:48 +05:30
|
|
|
flush(6)
|
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)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +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)
|
|
|
|
|
|
|
|
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)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
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
|
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(model)//InputFileExtension
|
|
|
|
open(myUnit+1,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-06-15 21:40:21 +05:30
|
|
|
path = trim(getSolverWorkingDirectoryName())//trim(model)//InputFileExtension//'_assembly'
|
|
|
|
open(myUnit,iostat=myStat,file=path)
|
|
|
|
if (myStat /= 0_pInt) call IO_error(100_pInt,ext_msg=path)
|
|
|
|
if (.not.abaqus_assembleInputFile(myUnit,myUnit+1_pInt)) call IO_error(103_pInt) ! strip comments and concatenate any "include"s
|
|
|
|
close(myUnit+1_pInt)
|
|
|
|
#endif
|
|
|
|
#ifdef Marc
|
2012-02-13 23:11:27 +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)
|
2010-11-03 20:09:18 +05:30
|
|
|
|
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
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief open (write) binary file related to current job with given extension to given unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
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
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief open (read) binary file related to restored job with given extension to given unit
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
subroutine IO_read_jobBinaryFile(myUnit,newExt,jobName,recMultiplier)
|
2010-11-03 20:09:18 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
use DAMASK_interface, only: getSolverWorkingDirectoryName
|
|
|
|
|
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-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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
call IO_open_file(999_pInt,ODFfileName)
|
2007-03-21 18:02:15 +05:30
|
|
|
|
|
|
|
!--- parse header of ODF file ---
|
|
|
|
!--- limits in phi1, Phi, phi2 ---
|
|
|
|
read(999,fmt=fileFormat,end=100) line
|
2012-02-16 00:28:38 +05:30
|
|
|
myPos = IO_stringPos(line,3_pInt)
|
|
|
|
if (myPos(1).ne.3) goto 100
|
|
|
|
do i=1_pInt,3_pInt
|
2012-03-06 20:22:48 +05:30
|
|
|
limits(i) = IO_floatValue(line,myPos,i)*INRAD
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2007-03-21 18:02:15 +05:30
|
|
|
|
|
|
|
!--- deltas in phi1, Phi, phi2 ---
|
|
|
|
read(999,fmt=fileFormat,end=100) line
|
2012-02-16 00:28:38 +05:30
|
|
|
myPos = IO_stringPos(line,3_pInt)
|
|
|
|
if (myPos(1).ne.3) goto 100
|
|
|
|
do i=1_pInt,3_pInt
|
2012-03-06 20:22:48 +05:30
|
|
|
deltas(i) = IO_floatValue(line,myPos,i)*INRAD
|
2009-06-15 18:41:21 +05:30
|
|
|
enddo
|
2007-03-21 18:02:15 +05:30
|
|
|
steps = nint(limits/deltas,pInt)
|
|
|
|
allocate(dV_V(steps(3),steps(2),steps(1)))
|
|
|
|
|
|
|
|
!--- box boundary/center at origin? ---
|
|
|
|
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
|
|
|
|
|
|
|
!--- skip blank line ---
|
|
|
|
read(999,fmt=fileFormat,end=100) line
|
|
|
|
|
|
|
|
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
|
|
|
|
2007-03-21 18:02:15 +05:30
|
|
|
dV_V = dV_V/sum_dV_V ! normalize to 1
|
|
|
|
|
|
|
|
!--- now fix bounds ---
|
2009-10-14 18:51:03 +05:30
|
|
|
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
|
2007-03-21 18:02:15 +05:30
|
|
|
!--- binary search for best C ---
|
|
|
|
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))
|
2012-02-10 16:54:53 +05:30
|
|
|
bin = 0_pInt ! bin counter
|
2012-02-16 00:28:38 +05:30
|
|
|
i = 1_pInt ! set counter
|
|
|
|
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
|
2012-02-16 00:28:38 +05:30
|
|
|
bin = bin+1_pInt ! advance bin
|
2007-03-21 18:02:15 +05:30
|
|
|
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
|
|
|
close(999)
|
|
|
|
return
|
|
|
|
|
|
|
|
! on error
|
2012-02-10 16:54:53 +05:30
|
|
|
100 IO_hybridIA = -1.0_pReal
|
2007-03-21 18:02:15 +05:30
|
|
|
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
|
|
|
|
|
|
|
character(len=*), parameter :: blankChar = achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
|
|
|
|
character(len=*), parameter :: comment = achar(35) ! comment id '#'
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
character(len=*), parameter :: sep=achar(32)//achar(9)//achar(10)//achar(13) ! whitespaces
|
2009-03-04 17:18:54 +05:30
|
|
|
|
2012-03-06 20:22:48 +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)
|
|
|
|
|
|
|
|
if (left == verify(line,sep) .and. right > left) & ! openChar is first and closeChar occurs
|
|
|
|
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
|
|
|
|
2012-08-09 16:31:53 +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
|
2009-03-04 17:18:54 +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)
|
2009-03-04 17:18:54 +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
|
2009-03-04 17:18:54 +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)
|
2012-08-09 16:31:53 +05:30
|
|
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
2009-03-04 17:18:54 +05:30
|
|
|
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
|
|
|
|
|
|
|
IO_spotTagInPart = .false. ! assume to nowhere spot tag
|
|
|
|
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)
|
2009-04-03 16:00:18 +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
|
2009-04-03 16:00:18 +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)
|
2012-06-26 15:54:54 +05:30
|
|
|
tag = IO_lc(IO_stringValue(line,positions,1_pInt)) ! extract key
|
2009-04-03 16:00:18 +05:30
|
|
|
if (tag == myTag) & ! match
|
|
|
|
IO_spotTagInPart(section) = .true.
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
100 end function IO_spotTagInPart
|
|
|
|
|
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
|
|
|
|
|
|
|
|
IO_globalTagInPart = .false. ! assume to nowhere spot tag
|
|
|
|
section = 0_pInt
|
|
|
|
line =''
|
|
|
|
|
|
|
|
rewind(myFile)
|
|
|
|
do while (IO_getTag(line,'<','>') /= part) ! search for part
|
|
|
|
read(myFile,'(a1024)',END=100) line
|
|
|
|
enddo
|
|
|
|
|
|
|
|
do
|
|
|
|
read(myFile,'(a1024)',END=100) line
|
|
|
|
if (IO_isBlank(line)) cycle ! skip empty lines
|
|
|
|
if (IO_getTag(line,'<','>') /= '') exit ! stop at next part
|
|
|
|
if (IO_getTag(line,'[',']') /= '') & ! found [section] identifier
|
|
|
|
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
|
|
|
|
|
|
|
|
|
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
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
pure function IO_stringPos(line,N)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: N
|
|
|
|
integer(pInt) :: IO_stringPos(1_pInt+N*2_pInt)
|
|
|
|
|
2009-01-16 20:55:37 +05:30
|
|
|
character(len=*), intent(in) :: line
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
character(len=*), parameter :: sep=achar(44)//achar(32)//achar(9)//achar(10)//achar(13) ! comma and whitespaces
|
|
|
|
|
|
|
|
integer :: left, right !no pInt (verify and scan return default integer)
|
|
|
|
|
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
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
pure function IO_stringValue(line,positions,myPos)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
integer(pInt), intent(in) :: positions(*), &
|
|
|
|
myPos
|
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
character(len=1+positions(myPos*2+1)-positions(myPos*2)) :: IO_stringValue
|
2007-04-25 20:08:22 +05:30
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
character(len=*), intent(in) :: line
|
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
if (positions(1) < myPos) then
|
2007-04-25 20:08:22 +05:30
|
|
|
IO_stringValue = ''
|
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
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
integer(pInt), intent(in) :: ends(*), &
|
|
|
|
myPos
|
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
character(len=ends(myPos+1)-ends(myPos)) :: IO_fixedStringValue
|
2012-03-06 20:22:48 +05:30
|
|
|
|
|
|
|
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
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
real(pReal) pure function IO_floatValue (line,positions,myPos)
|
2007-03-20 19:25:22 +05:30
|
|
|
|
|
|
|
implicit none
|
2009-01-16 20:55:37 +05:30
|
|
|
character(len=*), intent(in) :: line
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: positions(*), &
|
|
|
|
myPos
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2011-10-18 14:52:33 +05:30
|
|
|
if (positions(1) < myPos) then
|
2009-06-19 12:39:39 +05:30
|
|
|
IO_floatValue = 0.0_pReal
|
|
|
|
else
|
2011-10-18 14:52:33 +05:30
|
|
|
read(UNIT=line(positions(myPos*2):positions(myPos*2+1)),ERR=100,FMT=*) IO_floatValue
|
2007-03-28 15:30:49 +05:30
|
|
|
endif
|
2009-06-19 12:39:39 +05:30
|
|
|
return
|
2007-04-26 18:10:06 +05:30
|
|
|
100 IO_floatValue = huge(1.0_pReal)
|
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
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
real(pReal) pure function IO_fixedFloatValue (line,ends,myPos)
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
implicit none
|
2009-01-16 20:55:37 +05:30
|
|
|
character(len=*), intent(in) :: line
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: ends(*), &
|
|
|
|
myPos
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
read(UNIT=line(ends(myPos-1)+1:ends(myPos)),ERR=100,FMT=*) IO_fixedFloatValue
|
2007-03-21 20:15:03 +05:30
|
|
|
return
|
2007-04-26 18:10:06 +05:30
|
|
|
100 IO_fixedFloatValue = huge(1.0_pReal)
|
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
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief read float x.y+z value at myPos from format line line
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
real(pReal) pure function IO_fixedNoEFloatValue (line,ends,myPos)
|
|
|
|
|
2007-03-21 20:15:03 +05:30
|
|
|
implicit none
|
2009-01-16 20:55:37 +05:30
|
|
|
character(len=*), intent(in) :: line
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: ends(*), &
|
|
|
|
myPos
|
|
|
|
|
|
|
|
integer(pInt) :: expon
|
|
|
|
integer :: pos_exp
|
|
|
|
real(pReal) :: base
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
pos_exp = scan(line(ends(myPos)+1:ends(myPos+1)),'+-',back=.true.)
|
2007-03-21 20:15:03 +05:30
|
|
|
if (pos_exp > 1) then
|
2012-02-16 00:28:38 +05:30
|
|
|
read(UNIT=line(ends(myPos)+1:ends(myPos)+pos_exp-1),ERR=100,FMT=*) base
|
|
|
|
read(UNIT=line(ends(myPos)+pos_exp:ends(myPos+1)),ERR=100,FMT=*) expon
|
2007-03-21 20:15:03 +05:30
|
|
|
else
|
2012-02-16 00:28:38 +05:30
|
|
|
read(UNIT=line(ends(myPos)+1:ends(myPos+1)),ERR=100,FMT=*) base
|
2007-03-21 22:34:10 +05:30
|
|
|
expon = 0_pInt
|
2007-03-21 20:15:03 +05:30
|
|
|
endif
|
|
|
|
IO_fixedNoEFloatValue = base*10.0_pReal**expon
|
|
|
|
return
|
2007-04-26 18:10:06 +05:30
|
|
|
100 IO_fixedNoEFloatValue = huge(1.0_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
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) pure function IO_intValue(line,positions,myPos)
|
|
|
|
|
2007-03-20 19:25:22 +05:30
|
|
|
implicit none
|
2009-01-16 20:55:37 +05:30
|
|
|
character(len=*), intent(in) :: line
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: positions(*), &
|
|
|
|
myPos
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
if (positions(1) < myPos) then
|
2009-06-19 12:39:39 +05:30
|
|
|
IO_intValue = 0_pInt
|
|
|
|
else
|
2012-02-16 00:28:38 +05:30
|
|
|
read(UNIT=line(positions(myPos*2):positions(myPos*2+1)),ERR=100,FMT=*) IO_intValue
|
2007-04-25 20:08:22 +05:30
|
|
|
endif
|
2009-06-19 12:39:39 +05:30
|
|
|
return
|
2007-04-26 18:10:06 +05:30
|
|
|
100 IO_intValue = huge(1_pInt)
|
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
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) pure function IO_fixedIntValue(line,ends,myPos)
|
2007-03-21 20:15:03 +05:30
|
|
|
|
|
|
|
implicit none
|
2009-01-16 20:55:37 +05:30
|
|
|
character(len=*), intent(in) :: line
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt), intent(in) :: ends(*), &
|
|
|
|
myPos
|
2007-03-21 20:15:03 +05:30
|
|
|
|
2012-02-16 00:28:38 +05:30
|
|
|
read(UNIT=line(ends(myPos)+1:ends(myPos+1)),ERR=100,FMT=*) IO_fixedIntValue
|
2007-03-21 20:15:03 +05:30
|
|
|
return
|
2007-04-26 18:10:06 +05:30
|
|
|
100 IO_fixedIntValue = huge(1_pInt)
|
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
|
|
|
|
|
2012-06-02 19:53:28 +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
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
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
|
|
|
|
2012-06-02 19:53:28 +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
|
|
|
|
2012-03-06 20:22:48 +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-03-06 20:22:48 +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)
|
|
|
|
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))
|
2010-07-13 15:56:07 +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
|
|
|
|
!> Spectral: ints concatenated range of a "to" b, multiple entries with a "copies of" b
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
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)
|
|
|
|
if (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)) == 'copies' .and. &
|
|
|
|
IO_lc(IO_stringValue(line,myPos,3_pInt)) == 'of' ) then ! found multiple entries indicator
|
|
|
|
IO_countContinuousIntValues = IO_intValue(line,myPos,1_pInt)
|
|
|
|
exit ! only one single multiplier allowed
|
|
|
|
else
|
|
|
|
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
|
|
|
|
IO_countContinuousIntValues = IO_countContinuousIntValues+1_pInt
|
|
|
|
exit ! data ended
|
|
|
|
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)
|
|
|
|
IO_countContinuousIntValues = IO_countContinuousIntValues + 1_pInt + & ! assuming range generation
|
|
|
|
(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-04-17 15:35:49 +05:30
|
|
|
! Spectral: ints concatenated range of a "to" b, multiple entries with a "copies 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)
|
|
|
|
if (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
|
|
|
|
else if (myPos(1) > 3_pInt .and. IO_lc(IO_stringValue(line,myPos,2_pInt)) == 'copies' &
|
|
|
|
.and. IO_lc(IO_stringValue(line,myPos,3_pInt)) == 'of' ) then ! found multiple entries indicator
|
|
|
|
IO_continuousIntValues(1) = IO_intValue(line,myPos,1_pInt)
|
|
|
|
IO_continuousIntValues(2:IO_continuousIntValues(1)+1) = IO_intValue(line,myPos,4_pInt)
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
do i = 1_pInt,myPos(1)-1_pInt ! interpret up to second to last value
|
|
|
|
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-06-15 21:40:21 +05:30
|
|
|
if ( IO_lc(IO_stringValue(line,myPos,myPos(1))) /= 'c' ) then ! line finished, read last value
|
|
|
|
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
|
|
|
|
2012-08-09 16:31:53 +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)
|
|
|
|
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
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
else if (rangeGeneration) then ! range generation
|
|
|
|
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
|
|
|
|
else ! read individual elem nums
|
|
|
|
do i = 1_pInt,myPos(1)
|
|
|
|
! write(*,*)'IO_CIV-int',IO_intValue(line,myPos,i)
|
|
|
|
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
|
|
|
|
2009-10-12 21:31:49 +05:30
|
|
|
|
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
|
2007-03-20 19:25:22 +05:30
|
|
|
|
2011-11-02 20:08:42 +05:30
|
|
|
select case (error_ID)
|
2012-02-13 23:11:27 +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'
|
|
|
|
|
|
|
|
|
|
|
|
!* 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'
|
|
|
|
|
|
|
|
|
2012-03-12 20:13:19 +05:30
|
|
|
!* plasticity error messages
|
2012-02-13 23:11:27 +05:30
|
|
|
|
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:'
|
|
|
|
|
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
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
|
|
|
|
!* numerics error messages
|
2009-10-16 01:32:52 +05:30
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
case (300_pInt)
|
|
|
|
msg = 'unknown numerics parameter:'
|
|
|
|
case (301_pInt)
|
|
|
|
msg = 'numerics parameter out of bounds:'
|
|
|
|
|
|
|
|
|
|
|
|
!* math errors
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
!* homogenization errors
|
|
|
|
|
|
|
|
case (500_pInt)
|
|
|
|
msg = 'unknown homogenization specified'
|
|
|
|
|
2010-05-06 19:37:21 +05:30
|
|
|
|
2012-02-13 23:11:27 +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'
|
|
|
|
|
|
|
|
|
|
|
|
!* errors related to spectral solver
|
2010-07-13 15:56:07 +05:30
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
case (808_pInt)
|
|
|
|
msg = 'precision not suitable for FFTW'
|
|
|
|
case (809_pInt)
|
|
|
|
msg = 'initializing FFTW'
|
|
|
|
case (831_pInt)
|
|
|
|
msg = 'mask consistency violated in spectral loadcase'
|
|
|
|
case (832_pInt)
|
|
|
|
msg = 'ill-defined L (each line should be either fully or not at all defined) in spectral loadcase'
|
|
|
|
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)
|
|
|
|
msg = 'updating of gamma operator not possible if it is pre calculated'
|
|
|
|
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-02-13 23:11:27 +05:30
|
|
|
|
|
|
|
|
|
|
|
!* Error messages related to parsing of Abaqus input file
|
2011-02-21 20:07:38 +05:30
|
|
|
|
2012-02-02 18:49:02 +05:30
|
|
|
case (900_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: Improper definition of nodes in input file (Nnodes < 2)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (901_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: No Elements defined in input file (Nelems = 0)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (902_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: No Element sets defined in input file (Atleast one *Elset must exist)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (903_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: No Materials defined in input file (Look into section assigments)'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (904_pInt)
|
2011-08-02 15:44:16 +05:30
|
|
|
msg = 'PARSE ERROR: No elements could be assigned for Elset: '
|
2012-02-02 18:49:02 +05:30
|
|
|
case (905_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: Error in mesh_abaqus_map_materials'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (906_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: Error in mesh_abaqus_count_cpElements'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (907_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: Incorrect size of mesh_mapFEtoCPelem in mesh_abaqus_map_elements; Size cannot be zero'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (908_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: Incorrect size of mesh_mapFEtoCPnode in mesh_abaqus_map_nodes; Size cannot be zero'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (909_pInt)
|
2010-07-13 15:56:07 +05:30
|
|
|
msg = 'PARSE ERROR: Incorrect size of mesh_node in mesh_abaqus_build_nodes; must be equal to mesh_Nnodes'
|
2012-02-02 18:49:02 +05:30
|
|
|
case (910_pInt)
|
2011-08-02 15:44:16 +05:30
|
|
|
msg = 'PARSE ERROR: Incorrect element type mapping in '
|
2010-07-13 15:56:07 +05:30
|
|
|
|
|
|
|
|
2012-02-13 23:11:27 +05:30
|
|
|
!* general error messages
|
|
|
|
|
|
|
|
case (666_pInt)
|
|
|
|
msg = 'memory leak detected'
|
2007-03-20 19:25:22 +05:30
|
|
|
case default
|
2009-03-31 14:51:57 +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)
|
2009-03-31 14:51:57 +05:30
|
|
|
write(6,*)
|
2011-11-02 20:08:42 +05:30
|
|
|
write(6,'(a38)') '+------------------------------------+'
|
|
|
|
write(6,'(a38)') '+ error +'
|
|
|
|
write(6,'(a17,i3,a18)') '+ ',error_ID,' +'
|
|
|
|
write(6,'(a38)') '+ +'
|
|
|
|
write(6,'(a2,a)') '+ ', trim(msg)
|
|
|
|
if (present(ext_msg)) write(6,'(a2,a)') '+ ', trim(ext_msg)
|
2009-03-04 17:18:54 +05:30
|
|
|
if (present(e)) then
|
|
|
|
if (present(i) .and. present(g)) then
|
2011-05-13 22:25:13 +05:30
|
|
|
write(6,'(a13,i6,a4,i2,a7,i4,a2)') '+ at element ',e,' IP ',i,' grain ',g,' +'
|
2009-03-04 17:18:54 +05:30
|
|
|
else
|
2011-05-13 22:25:13 +05:30
|
|
|
write(6,'(a18,i6,a14)') '+ at ',e,' +'
|
2009-03-04 17:18:54 +05:30
|
|
|
endif
|
|
|
|
endif
|
2009-05-28 22:08:40 +05:30
|
|
|
write(6,'(a38)') '+------------------------------------+'
|
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
|
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)
|
|
|
|
msg = 'Found Spectral solver parameter '
|
2011-11-15 23:24:18 +05:30
|
|
|
case (47_pInt)
|
|
|
|
msg = 'No valid parameter for FFTW given, using FFTW_PATIENT'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (101_pInt)
|
2010-11-03 20:28:11 +05:30
|
|
|
msg = '+ crystallite debugging off... +'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (600_pInt)
|
2010-11-03 20:28:11 +05:30
|
|
|
msg = '+ crystallite responds elastically +'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (601_pInt)
|
2010-11-04 23:48:01 +05:30
|
|
|
msg = '+ stiffness close to zero +'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (650_pInt)
|
2010-11-03 20:28:11 +05:30
|
|
|
msg = '+ polar decomposition failed +'
|
2011-11-02 20:08:42 +05:30
|
|
|
case (700_pInt)
|
2009-12-15 13:50:31 +05:30
|
|
|
msg = '+ unknown crystal symmetry +'
|
2009-03-31 14:51:57 +05:30
|
|
|
case default
|
2010-11-03 20:28:11 +05:30
|
|
|
msg = '+ unknown warning number... +'
|
2009-03-31 14:51:57 +05:30
|
|
|
end select
|
|
|
|
|
|
|
|
!$OMP CRITICAL (write2out)
|
|
|
|
write(6,*)
|
2011-11-02 20:08:42 +05:30
|
|
|
write(6,'(a38)') '+------------------------------------+'
|
|
|
|
write(6,'(a38)') '+ warning +'
|
|
|
|
write(6,'(a38)') '+ +'
|
|
|
|
write(6,'(a17,i3,a18)') '+ ',warning_ID,' +'
|
|
|
|
write(6,'(a2,a)') '+ ', trim(msg)
|
|
|
|
if (present(ext_msg)) write(6,'(a2,a)') '+ ', trim(ext_msg)
|
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
|
2012-02-01 00:48:55 +05:30
|
|
|
write(6,'(a12,1x,i6,1x,a2,1x,i2,1x,a5,1x,i4,a2)') '+ at element',e,'IP',i,'grain',g,' +'
|
2010-11-04 23:48:01 +05:30
|
|
|
else
|
2012-02-01 00:48:55 +05:30
|
|
|
write(6,'(a12,1x,i6,1x,a2,1x,i2,a13)') '+ at element',e,'IP',i,' +'
|
2010-11-04 23:48:01 +05:30
|
|
|
endif
|
2009-03-31 14:51:57 +05:30
|
|
|
else
|
2012-02-01 00:48:55 +05:30
|
|
|
write(6,'(a12,1x,i6,a19)') '+ at element',e,' +'
|
2009-03-31 14:51:57 +05:30
|
|
|
endif
|
|
|
|
endif
|
2009-05-28 22:08:40 +05:30
|
|
|
write(6,'(a38)') '+------------------------------------+'
|
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
|
|
|
|
2012-03-06 20:22:48 +05:30
|
|
|
! INTERNAL (HELPER) FUNCTIONS:
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
! call IO_lcInPlace(line)
|
|
|
|
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
|
|
|
|
2012-08-09 16:31:53 +05:30
|
|
|
!--------------------------------------------------------------------------------------------------
|
|
|
|
!> @brief hybrid IA repetition counter
|
|
|
|
!--------------------------------------------------------------------------------------------------
|
2012-03-06 20:22:48 +05:30
|
|
|
integer(pInt) function hybridIA_reps(dV_V,steps,C)
|
|
|
|
|
|
|
|
implicit none
|
|
|
|
integer(pInt), intent(in), dimension(3) :: &
|
|
|
|
steps
|
|
|
|
real(pReal), intent(in), dimension(steps(3),steps(2),steps(1)) :: &
|
|
|
|
dV_V
|
|
|
|
real(pReal), intent(in) :: &
|
|
|
|
C
|
|
|
|
|
|
|
|
integer(pInt) :: phi1,Phi,phi2
|
|
|
|
|
|
|
|
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
|