Commit 75f45272 authored by Gregor Michalicek's avatar Gregor Michalicek

First bug fixes for out.xml functionality

parent d35f39ad
......@@ -12,11 +12,15 @@ MODULE m_xmlOutput
IMPLICIT NONE
PRIVATE
INTEGER, SAVE :: currentElementIndex
INTEGER, SAVE :: maxNumElements
INTEGER, SAVE :: xmlOutputUnit
CHARACTER(LEN= 40), ALLOCATABLE :: elementList(:)
PUBLIC startXMLOutput, endXMLOutput, writeXMLElementPoly, writeXMLElement
PUBLIC openXMLElementPoly, openXMLElementNoAttributes, openXMLElement, closeXMLElement
CONTAINS
SUBROUTINE startXMLOutput()
......@@ -46,7 +50,7 @@ MODULE m_xmlOutput
IMPLICIT NONE
CHARACTER(LEN= 40) :: elementName
CHARACTER(LEN=*) :: elementName
CHARACTER(LEN= 40), INTENT(IN) :: attributeNames(:)
CLASS(*), INTENT(IN) :: attributeValues(:)
CLASS(*), INTENT(IN) :: contentList(:)
......@@ -97,7 +101,7 @@ MODULE m_xmlOutput
IMPLICIT NONE
!! Overloading for different types of attributes, data elements?
CHARACTER(LEN= 40) :: elementName
CHARACTER(LEN=*) :: elementName
CHARACTER(LEN= 40), INTENT(IN) :: attributeNames(:)
CHARACTER(LEN= 30), INTENT(IN) :: attributeValues(:)
CHARACTER(LEN= 30), INTENT(IN) :: contentList(:)
......@@ -130,14 +134,14 @@ MODULE m_xmlOutput
ELSE
outputString = TRIM(ADJUSTL(outputString))//'>'
END IF
WRITE(format,*) "'(a",3*(currentElementIndex+1),",a)'"
WRITE(format,'(a,i0,a)') "(a",3*(currentElementIndex+1),",a)"
WRITE(xmlOutputUnit,format) ' ', TRIM(ADJUSTL(outputString))
IF(SIZE(contentLineList).GT.1) THEN
WRITE(format,*) "'(a",3*(currentElementIndex+2),",a)'"
WRITE(format,'(a,i0,a)') "(a",3*(currentElementIndex+2),",a)"
DO i = 1, SIZE(contentLineList)
WRITE(xmlOutputUnit,format) ' ', TRIM(ADJUSTL(contentLineList(i)))
END DO
WRITE(format,*) "'(a",3*(currentElementIndex+1),",a)'"
WRITE(format,'(a,i0,a)') "(a",3*(currentElementIndex+1),",a)"
outputString = '</'//TRIM(ADJUSTL(elementName))//'>'
WRITE(xmlOutputUnit,format) ' ', TRIM(ADJUSTL(outputString))
END IF
......@@ -167,9 +171,9 @@ MODULE m_xmlOutput
IMPLICIT NONE
CHARACTER(LEN= 40) :: elementName
CHARACTER(LEN= 40), INTENT(IN) :: attributeNames(:)
CLASS(*), INTENT(IN) :: attributeValues(:)
CHARACTER(LEN=*) :: elementName
CHARACTER(LEN=*), INTENT(IN) :: attributeNames(:)
CLASS(*), INTENT(IN) :: attributeValues(:)
CHARACTER(LEN= 30), ALLOCATABLE :: charAttributeValues(:)
INTEGER :: i
......@@ -197,13 +201,34 @@ MODULE m_xmlOutput
END SUBROUTINE openXMLElementPoly
SUBROUTINE openXMLElementNoAttributes(elementName)
IMPLICIT NONE
CHARACTER(LEN=*) :: elementName
INTEGER :: i
CHARACTER(LEN=70) :: format
CHARACTER(LEN=200) :: openingString
IF(currentElementIndex.EQ.maxNumElements) THEN
WRITE(*,*) 'elementName', TRIM(ADJUSTL(elementName))
STOP 'ERROR: xml hierarchy too deep!'
END IF
currentElementIndex = currentElementIndex + 1
elementList(currentElementIndex) = TRIM(ADJUSTL(elementName))
openingString = '<'//TRIM(ADJUSTL(elementName))//'>'
WRITE(format,'(a,i0,a)') "(a",3*currentElementIndex,",a)"
WRITE(xmlOutputUnit,format) ' ', TRIM(ADJUSTL(openingString))
END SUBROUTINE openXMLElementNoAttributes
SUBROUTINE openXMLElement(elementName,attributeNames,attributeValues)
IMPLICIT NONE
CHARACTER(LEN= 40) :: elementName
CHARACTER(LEN= 40), INTENT(IN) :: attributeNames(:)
CHARACTER(LEN= 30), INTENT(IN) :: attributeValues(:)
CHARACTER(LEN=*) :: elementName
CHARACTER(LEN=*), INTENT(IN) :: attributeNames(:)
CHARACTER(LEN=*), INTENT(IN) :: attributeValues(:)
INTEGER :: i
CHARACTER(LEN=70) :: format
......@@ -222,12 +247,13 @@ MODULE m_xmlOutput
STOP 'ERROR: xml hierarchy too deep!'
END IF
currentElementIndex = currentElementIndex + 1
elementList(currentElementIndex) = TRIM(ADJUSTL(elementName))
openingString = '<'//TRIM(ADJUSTL(elementName))
DO i = 1, SIZE(attributeNames)
openingString = TRIM(ADJUSTL(openingString))//' '//TRIM(ADJUSTL(attributeNames(i)))//'="'//TRIM(ADJUSTL(attributeValues(i)))//'"'
END DO
openingString = TRIM(ADJUSTL(openingString))//'>'
WRITE(format,*) "'(a",3*currentElementIndex,",a)'"
WRITE(format,'(a,i0,a)') "(a",3*currentElementIndex,",a)"
WRITE(xmlOutputUnit,format) ' ', TRIM(ADJUSTL(openingString))
END SUBROUTINE openXMLElement
......@@ -245,8 +271,8 @@ MODULE m_xmlOutput
WRITE(*,*) 'elementName', TRIM(ADJUSTL(elementName))
STOP 'ERROR: Closing xml element inconsistency!'
END IF
closingString = '</'//elementName//'>'
WRITE(format,*) "'(a",3*currentElementIndex,",a)'"
closingString = '</'//TRIM(ADJUSTL(elementName))//'>'
WRITE(format,'(a,i0,a)') "(a",3*currentElementIndex,",a)"
WRITE(xmlOutputUnit,format) ' ', TRIM(ADJUSTL(closingString))
currentElementIndex = currentElementIndex - 1
END SUBROUTINE closeXMLElement
......
......@@ -118,6 +118,7 @@
USE m_totale
USE m_potdis
USE m_mix
USE m_xmlOutput
! USE m_jcoff
! USE m_jcoff2
! USE m_ssomat
......@@ -242,8 +243,10 @@
it = 0
ithf = 0
l_cont = ( it < input%itmax )
IF (mpi%irank.EQ.0) CALL openXMLElementNoAttributes('scfLoop')
DO 80 WHILE ( l_cont )
it = it + 1
IF (mpi%irank.EQ.0) CALL openXMLElementPoly('iteration',(/'number'/),(/it/))
!+t3e
IF (input%alpha.LT.10.0) THEN
!
......@@ -665,6 +668,7 @@
ENDIF
ENDDO !qcount
IF (stop80) THEN
IF (mpi%irank.EQ.0) CALL closeXMLElement('iteration')
EXIT ! it
ENDIF
......@@ -857,8 +861,9 @@
ELSE
l_cont = ( it < input%itmax )
END IF
IF (mpi%irank.EQ.0) CALL closeXMLElement('iteration')
80 CONTINUE
IF (mpi%irank.EQ.0) CALL closeXMLElement('scfLoop')
CALL juDFT_end("all done",mpi%irank)
END SUBROUTINE
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment