Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | ProposedObject | |||
integer, | intent(inout) | :: | CurPos | |||
logical, | intent(inout) | :: | EndofFile | |||
logical, | intent(inout) | :: | ErrorsFound |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE AddObjectDefandParse(ProposedObject,CurPos,EndofFile,ErrorsFound)
! SUBROUTINE INFORMATION:
! AUTHOR Linda K. Lawrie
! DATE WRITTEN August 1997
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine processes data dictionary file for EnergyPlus.
! The structure of the sections and objects are stored in derived
! types (SectionDefs and ObjectDefs)
! METHODOLOGY EMPLOYED:
! na
! REFERENCES:
! na
! USE STATEMENTS:
! na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS
CHARACTER(len=*), INTENT(IN) :: ProposedObject ! Proposed Object to Add
INTEGER, INTENT(INOUT) :: CurPos ! Current position (initially at first ',') of InputLine
LOGICAL, INTENT(INOUT) :: EndofFile ! End of File marker
LOGICAL, INTENT(INOUT) :: ErrorsFound ! set to true if errors found here
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS
! na
! DERIVED TYPE DEFINITIONS
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
CHARACTER(len=MaxObjectNameLength) SqueezedObject ! Input Object, Left Justified, UpperCase
INTEGER Count ! Count on arguments, loop
INTEGER Pos ! Position scanning variable
LOGICAL EndofObjectDef ! Set to true when ; has been found
LOGICAL ErrFlag ! Local Error condition flag, when true, object not added to Global list
CHARACTER(len=1) TargetChar ! Single character scanned to test for current field type (A or N)
LOGICAL BlankLine ! True when this line is "blank" (may have comment characters as first character on line)
LOGICAL(1), ALLOCATABLE, SAVE, DIMENSION(:) :: AlphaorNumeric ! Array of argument designations, True is Alpha,
! False is numeric, saved in ObjectDef when done
LOGICAL(1), ALLOCATABLE, SAVE, DIMENSION(:) :: TempAN ! Array (ref: AlphaOrNumeric) for re-allocation procedure
LOGICAL(1), ALLOCATABLE, SAVE, DIMENSION(:) :: RequiredFields ! Array of argument required fields
LOGICAL(1), ALLOCATABLE, SAVE, DIMENSION(:) :: TempRqF ! Array (ref: RequiredFields) for re-allocation procedure
LOGICAL(1), ALLOCATABLE, SAVE, DIMENSION(:) :: AlphRetainCase ! Array of argument for retain case
LOGICAL(1), ALLOCATABLE, SAVE, DIMENSION(:) :: TempRtC ! Array (ref: AlphRetainCase) for re-allocation procedure
CHARACTER(len=MaxFieldNameLength), &
ALLOCATABLE, SAVE, DIMENSION(:) :: AlphFieldChecks ! Array with alpha field names
CHARACTER(len=MaxFieldNameLength), &
ALLOCATABLE, SAVE, DIMENSION(:) :: TempAFC ! Array (ref: AlphFieldChecks) for re-allocation procedure
CHARACTER(len=MaxObjectNameLength), &
ALLOCATABLE, SAVE, DIMENSION(:) :: AlphFieldDefaults ! Array with alpha field defaults
CHARACTER(len=MaxObjectNameLength), &
ALLOCATABLE, SAVE, DIMENSION(:) :: TempAFD ! Array (ref: AlphFieldDefaults) for re-allocation procedure
TYPE(RangeCheckDef), ALLOCATABLE, SAVE, DIMENSION(:) :: NumRangeChecks ! Structure for Range Check, Defaults of numeric fields
TYPE(RangeCheckDef), ALLOCATABLE, SAVE, DIMENSION(:) :: TempChecks ! Structure (ref: NumRangeChecks) for re-allocation procedure
LOGICAL MinMax ! Set to true when MinMax field has been found by ReadInputLine
LOGICAL Default ! Set to true when Default field has been found by ReadInputLine
LOGICAL AutoSize ! Set to true when Autosizable field has been found by ReadInputLine
LOGICAL AutoCalculate ! Set to true when Autocalculatable field has been found by ReadInputLine
CHARACTER(len=32) MinMaxString ! Set from ReadInputLine
CHARACTER(len=MaxObjectNameLength) AlphDefaultString
INTEGER WhichMinMax !=0 (none/invalid), =1 \min, =2 \min>, =3 \max, =4 \max<
REAL(r64) Value ! Value returned by ReadInputLine (either min, max, default, autosize or autocalculate)
LOGICAL MinMaxError ! Used to see if min, max, defaults have been set appropriately (True if error)
INTEGER,SAVE :: MaxANArgs=7700 ! Current count of Max args to object (9/2010)
LOGICAL ErrorsFoundFlag
INTEGER,SAVE :: PrevSizeNumNumeric = -1
INTEGER,SAVE :: PrevCount = -1
INTEGER,SAVE :: PrevSizeNumAlpha = -1
IF (.not. ALLOCATED(AlphaorNumeric)) THEN
ALLOCATE (AlphaorNumeric(0:MaxANArgs))
ALLOCATE (RequiredFields(0:MaxANArgs))
ALLOCATE (AlphRetainCase(0:MaxANArgs))
ALLOCATE (NumRangeChecks(MaxANArgs))
ALLOCATE (AlphFieldChecks(MaxANArgs))
ALLOCATE (AlphFieldDefaults(MaxANArgs))
ALLOCATE (ObsoleteObjectsRepNames(0))
ENDIF
SqueezedObject=MakeUPPERCase(ADJUSTL(ProposedObject))
IF (LEN_TRIM(ADJUSTL(ProposedObject)) > MaxObjectNameLength) THEN
CALL ShowWarningError('IP: Object length exceeds maximum, will be truncated='//TRIM(ProposedObject),EchoInputFile)
CALL ShowContinueError('Will be processed as Object='//TRIM(SqueezedObject),EchoInputFile)
ErrorsFound=.true.
ENDIF
! Start of Object parse, set object level items
ErrFlag=.false.
ErrorsFoundFlag=.false.
MinimumNumberOfFields=0
ObsoleteObject=.false.
UniqueObject=.false.
RequiredObject=.false.
ExtensibleObject=.false.
ExtensibleNumFields=0
MinMax=.false.
Default=.false.
AutoSize=.false.
AutoCalculate=.false.
WhichMinMax=0
IF (SqueezedObject /= Blank) THEN
IF (FindItemInList(SqueezedObject,ObjectDef%Name,NumObjectDefs) > 0) THEN
CALL ShowSevereError('IP: Already an Object called '//TRIM(SqueezedObject)//'. This definition ignored.',EchoInputFile)
! Error Condition
ErrFlag=.true.
! Rest of Object has to be processed. Error condition will be caught
! at end
ErrorsFound=.true.
ENDIF
ELSE
ErrFlag=.true.
ErrorsFound=.true.
ENDIF
NumObjectDefs=NumObjectDefs+1
ObjectDef(NumObjectDefs)%Name=SqueezedObject
ObjectDef(NumObjectDefs)%NumParams=0
ObjectDef(NumObjectDefs)%NumAlpha=0
ObjectDef(NumObjectDefs)%NumNumeric=0
ObjectDef(NumObjectDefs)%NumFound=0
ObjectDef(NumObjectDefs)%MinNumFields=0
ObjectDef(NumObjectDefs)%NameAlpha1=.false.
ObjectDef(NumObjectDefs)%ObsPtr=0
ObjectDef(NumObjectDefs)%UniqueObject=.false.
ObjectDef(NumObjectDefs)%RequiredObject=.false.
ObjectDef(NumObjectDefs)%ExtensibleObject=.false.
ObjectDef(NumObjectDefs)%ExtensibleNum=0
IF (PrevCount .EQ. -1) THEN
PrevCount = MaxANArgs
END IF
AlphaorNumeric(0:PrevCount)=.true.
RequiredFields(0:PrevCount)=.false.
AlphRetainCase(0:PrevCount)=.false.
IF (PrevSizeNumAlpha .EQ. -1) THEN
PrevSizeNumAlpha = MaxANArgs
END IF
AlphFieldChecks(1:PrevSizeNumAlpha)=Blank
AlphFieldDefaults(1:PrevSizeNumAlpha)=Blank
IF (PrevSizeNumNumeric .EQ. -1) THEN
PrevSizeNumNumeric = MaxANArgs
END IF
!clear only portion of NumRangeChecks array used in the previous
!call to reduce computation time to clear this large array.
NumRangeChecks(1:PrevSizeNumNumeric)%MinMaxChk=.false.
NumRangeChecks(1:PrevSizeNumNumeric)%WhichMinMax(1)=0
NumRangeChecks(1:PrevSizeNumNumeric)%WhichMinMax(2)=0
NumRangeChecks(1:PrevSizeNumNumeric)%MinMaxString(1)=Blank
NumRangeChecks(1:PrevSizeNumNumeric)%MinMaxString(2)=Blank
NumRangeChecks(1:PrevSizeNumNumeric)%MinMaxValue(1)=0.0d0
NumRangeChecks(1:PrevSizeNumNumeric)%MinMaxValue(2)=0.0d0
NumRangeChecks(1:PrevSizeNumNumeric)%Default=0.0d0
NumRangeChecks(1:PrevSizeNumNumeric)%DefaultChk=.false.
NumRangeChecks(1:PrevSizeNumNumeric)%DefAutoSize=.false.
NumRangeChecks(1:PrevSizeNumNumeric)%DefAutoCalculate=.false.
NumRangeChecks(1:PrevSizeNumNumeric)%FieldNumber=0
NumRangeChecks(1:PrevSizeNumNumeric)%FieldName=Blank
NumRangeChecks(1:PrevSizeNumNumeric)%AutoSizable=.false.
NumRangeChecks(1:PrevSizeNumNumeric)%AutoSizeValue=DefAutoSizeValue
NumRangeChecks(1:PrevSizeNumNumeric)%AutoCalculatable=.false.
NumRangeChecks(1:PrevSizeNumNumeric)%AutoCalculateValue=DefAutoCalculateValue
Count=0
EndofObjectDef=.false.
! Parse rest of Object Definition
DO WHILE (.not. EndofFile .and. .not. EndofObjectDef)
IF (CurPos <= InputLineLength) THEN
Pos=SCAN(InputLine(CurPos:InputLineLength),AlphaNum)
IF (Pos > 0) then
Count=Count+1
RequiredField=.false.
RetainCaseFlag=.false.
IF (Count > MaxANArgs) THEN ! Reallocation
ALLOCATE(TempAN(0:MaxANArgs+ANArgsDefAllocInc))
TempAN=.false.
TempAN(0:MaxANArgs)=AlphaorNumeric
DEALLOCATE(AlphaorNumeric)
ALLOCATE(TempRqF(0:MaxANArgs+ANArgsDefAllocInc))
TempRqF=.false.
TempRqF(0:MaxANArgs)=RequiredFields
DEALLOCATE(RequiredFields)
ALLOCATE(TempRtC(0:MaxANArgs+ANArgsDefAllocInc))
TempRtC=.false.
TempRtC(0:MaxANArgs)=AlphRetainCase
DEALLOCATE(AlphRetainCase)
ALLOCATE(TempChecks(MaxANArgs+ANArgsDefAllocInc))
TempChecks(1:MaxANArgs)=NumRangeChecks(1:MaxANArgs)
DEALLOCATE(NumRangeChecks)
ALLOCATE(TempAFC(MaxANArgs+ANArgsDefAllocInc))
TempAFC=Blank
TempAFC(1:MaxANArgs)=AlphFieldChecks
DEALLOCATE(AlphFieldChecks)
ALLOCATE(TempAFD(MaxANArgs+ANArgsDefAllocInc))
TempAFD=Blank
TempAFD(1:MaxANArgs)=AlphFieldDefaults
DEALLOCATE(AlphFieldDefaults)
ALLOCATE(AlphaorNumeric(0:MaxANArgs+ANArgsDefAllocInc))
AlphaorNumeric=TempAN
DEALLOCATE(TempAN)
ALLOCATE(RequiredFields(0:MaxANArgs+ANArgsDefAllocInc))
RequiredFields=TempRqF
DEALLOCATE(TempRqF)
ALLOCATE(AlphRetainCase(0:MaxANArgs+ANArgsDefAllocInc))
AlphRetainCase=TempRtC
DEALLOCATE(TempRtC)
ALLOCATE(NumRangeChecks(MaxANArgs+ANArgsDefAllocInc))
NumRangeChecks=TempChecks
DEALLOCATE(TempChecks)
ALLOCATE(AlphFieldChecks(MaxANArgs+ANArgsDefAllocInc))
AlphFieldChecks=TempAFC
DEALLOCATE(TempAFC)
ALLOCATE(AlphFieldDefaults(MaxANArgs+ANArgsDefAllocInc))
AlphFieldDefaults=TempAFD
DEALLOCATE(TempAFD)
MaxANArgs=MaxANArgs+ANArgsDefAllocInc
ENDIF
TargetChar=InputLine(CurPos+Pos-1:CurPos+Pos-1)
IF (TargetChar == 'A' .or. TargetChar == 'a') THEN
AlphaorNumeric(Count)=.true.
ObjectDef(NumObjectDefs)%NumAlpha=ObjectDef(NumObjectDefs)%NumAlpha+1
IF (FieldSet) AlphFieldChecks(ObjectDef(NumObjectDefs)%NumAlpha)=CurrentFieldName
IF (ObjectDef(NumObjectDefs)%NumAlpha == 1) THEN
IF (INDEX(MakeUpperCase(CurrentFieldName),'NAME') /= 0) ObjectDef(NumObjectDefs)%NameAlpha1=.true.
ENDIF
ELSE
AlphaorNumeric(Count)=.false.
ObjectDef(NumObjectDefs)%NumNumeric=ObjectDef(NumObjectDefs)%NumNumeric+1
IF (FieldSet) NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%FieldName=CurrentFieldName
ENDIF
ELSE
CALL ReadInputLine(IDDFile,CurPos,BlankLine,InputLineLength,EndofFile, &
MinMax=MinMax,WhichMinMax=WhichMinMax,MinMaxString=MinMaxString, &
Value=Value,Default=Default,DefString=AlphDefaultString,AutoSizable=AutoSize, &
AutoCalculatable=AutoCalculate,RetainCase=RetainCaseFlag,ErrorsFound=ErrorsFoundFlag)
IF (.not. AlphaorNumeric(Count)) THEN
! only record for numeric fields
IF (MinMax) THEN
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxChk=.true.
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%FieldNumber=Count
IF (WhichMinMax <= 2) THEN !=0 (none/invalid), =1 \min, =2 \min>, =3 \max, =4 \max<
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%WhichMinMax(1)=WhichMinMax
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxString(1)=MinMaxString
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxValue(1)=Value
ELSE
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%WhichMinMax(2)=WhichMinMax
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxString(2)=MinMaxString
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxValue(2)=Value
ENDIF
ENDIF ! End Min/Max
IF (Default) THEN
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%DefaultChk=.true.
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%Default=Value
IF (AlphDefaultString == 'AUTOSIZE') NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%DefAutoSize=.true.
IF (AlphDefaultString == 'AUTOCALCULATE') NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%DefAutoCalculate=.true.
ENDIF
IF (AutoSize) THEN
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%AutoSizable=.true.
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%AutoSizeValue=Value
ENDIF
IF (AutoCalculate) THEN
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%AutoCalculatable=.true.
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%AutoCalculateValue=Value
ENDIF
ELSE ! Alpha Field
IF (Default) THEN
AlphFieldDefaults(ObjectDef(NumObjectDefs)%NumAlpha)=AlphDefaultString
ENDIF
ENDIF
IF (ErrorsFoundFlag) THEN
ErrFlag=.true.
ErrorsFoundFlag=.false.
ENDIF
IF (RequiredField) THEN
RequiredFields(Count)=.true.
MinimumNumberOfFields=MAX(Count,MinimumNumberOfFields)
ENDIF
IF (RetainCaseFlag) THEN
AlphRetainCase(Count)=.true.
ENDIF
CYCLE
ENDIF
! For the moment dont care about descriptions on each object
IF (CurPos <= InputLineLength) THEN
CurPos=CurPos+Pos
Pos=SCAN(InputLine(CurPos:InputLineLength),',;')
IF (Pos == 0) THEN
CALL ShowSevereError('IP: IDD line~'//TRIM(IPTrimSigDigits(NumLines))//' , or ; expected on this line'// &
',position="'//InputLine(CurPos:InputLineLength)//'"',EchoInputFile)
ErrFlag=.true.
ErrorsFound=.true.
ENDIF
IF (InputLine(InputLineLength:InputLineLength) /= '\') THEN
CALL ShowWarningError('IP: IDD line~'//TRIM(IPTrimSigDigits(NumLines))//' \ expected on this line',EchoInputFile)
ENDIF
ELSE
CALL ReadInputLine(IDDFile,CurPos,BlankLine,InputLineLength,EndofFile)
IF (BlankLine .or. EndofFile) CYCLE
Pos=SCAN(InputLine(CurPos:InputLineLength),',;')
ENDIF
ELSE
CALL ReadInputLine(IDDFile,CurPos,BlankLine,InputLineLength,EndofFile)
CYCLE
ENDIF
IF (Pos <= 0) THEN
! must be time to read another line
CALL ReadInputLine(IDDFile,CurPos,BlankLine,InputLineLength,EndofFile)
IF (BlankLine .or. EndofFile) CYCLE
ELSE
IF (InputLine(CurPos+Pos-1:CurPos+Pos-1) == ';') THEN
EndofObjectDef=.true.
ENDIF
CurPos=CurPos+Pos
ENDIF
END DO
! Reached end of object def but there may still be more \ lines to parse....
! Goes until next object is encountered ("not blankline") or end of IDDFile
! If last object is not numeric, then exit immediately....
BlankLine=.true.
DO WHILE (BlankLine .and. .not.EndofFile)
! It's a numeric object as last one...
CALL ReadInputLine(IDDFile,CurPos,BlankLine,InputLineLength,EndofFile, &
MinMax=MinMax,WhichMinMax=WhichMinMax,MinMaxString=MinMaxString, &
Value=Value,Default=Default,DefString=AlphDefaultString,AutoSizable=AutoSize, &
AutoCalculatable=AutoCalculate,RetainCase=RetainCaseFlag,ErrorsFound=ErrorsFoundFlag)
IF (MinMax) THEN
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxChk=.true.
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%FieldNumber=Count
IF (WhichMinMax <= 2) THEN !=0 (none/invalid), =1 \min, =2 \min>, =3 \max, =4 \max<
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%WhichMinMax(1)=WhichMinMax
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxString(1)=MinMaxString
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxValue(1)=Value
ELSE
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%WhichMinMax(2)=WhichMinMax
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxString(2)=MinMaxString
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%MinMaxValue(2)=Value
ENDIF
ENDIF
IF (Default .and. .not. AlphaorNumeric(Count)) THEN
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%DefaultChk=.true.
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%Default=Value
IF (AlphDefaultString == 'AUTOSIZE') NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%DefAutoSize=.true.
IF (AlphDefaultString == 'AUTOCALCULATE') NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%DefAutoCalculate=.true.
ELSEIF (Default .and. AlphaorNumeric(Count)) THEN
AlphFieldDefaults(ObjectDef(NumObjectDefs)%NumAlpha)=AlphDefaultString
ENDIF
IF (AutoSize) THEN
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%AutoSizable=.true.
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%AutoSizeValue=Value
ENDIF
IF (AutoCalculate) THEN
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%AutoCalculatable=.true.
NumRangeChecks(ObjectDef(NumObjectDefs)%NumNumeric)%AutoCalculateValue=Value
ENDIF
IF (ErrorsFoundFlag) THEN
ErrFlag=.true.
ErrorsFoundFlag=.false.
ENDIF
ENDDO
IF (.not. BlankLine) THEN
BACKSPACE(Unit=IDDFile)
EchoInputLine=.false.
ENDIF
IF (RequiredField) THEN
RequiredFields(Count)=.true.
MinimumNumberOfFields=MAX(Count,MinimumNumberOfFields)
ENDIF
IF (RetainCaseFlag) THEN
AlphRetainCase(Count)=.true.
ENDIF
ObjectDef(NumObjectDefs)%NumParams=Count ! Also the total of ObjectDef(..)%NumAlpha+ObjectDef(..)%NumNumeric
ObjectDef(NumObjectDefs)%MinNumFields=MinimumNumberOfFields
IF (ObsoleteObject) THEN
ALLOCATE(TempAFD(NumObsoleteObjects+1))
IF (NumObsoleteObjects > 0) THEN
TempAFD(1:NumObsoleteObjects)=ObsoleteObjectsRepNames
ENDIF
TempAFD(NumObsoleteObjects+1)=ReplacementName
DEALLOCATE(ObsoleteObjectsRepNames)
NumObsoleteObjects=NumObsoleteObjects+1
ALLOCATE(ObsoleteObjectsRepNames(NumObsoleteObjects))
ObsoleteObjectsRepNames=TempAFD
ObjectDef(NumObjectDefs)%ObsPtr=NumObsoleteObjects
DEALLOCATE(TempAFD)
ENDIF
IF (RequiredObject) THEN
ObjectDef(NumObjectDefs)%RequiredObject=.true.
ENDIF
IF (UniqueObject) THEN
ObjectDef(NumObjectDefs)%UniqueObject=.true.
ENDIF
IF (ExtensibleObject) THEN
ObjectDef(NumObjectDefs)%ExtensibleObject=.true.
ObjectDef(NumObjectDefs)%ExtensibleNum=ExtensibleNumFields
ENDIF
NumAlphaArgsFound=NumAlphaArgsFound+ObjectDef(NumObjectDefs)%NumAlpha
MaxAlphaArgsFound=MAX(MaxAlphaArgsFound,ObjectDef(NumObjectDefs)%NumAlpha)
NumNumericArgsFound=NumNumericArgsFound+ObjectDef(NumObjectDefs)%NumNumeric
MaxNumericArgsFound=MAX(MaxNumericArgsFound,ObjectDef(NumObjectDefs)%NumNumeric)
ALLOCATE(ObjectDef(NumObjectDefs)%AlphaorNumeric(Count))
ObjectDef(NumObjectDefs)%AlphaorNumeric=AlphaorNumeric(1:Count)
ALLOCATE(ObjectDef(NumObjectDefs)%AlphRetainCase(Count))
ObjectDef(NumObjectDefs)%AlphRetainCase=AlphRetainCase(1:Count)
PrevCount = Count
ALLOCATE(ObjectDef(NumObjectDefs)%NumRangeChks(ObjectDef(NumObjectDefs)%NumNumeric))
IF (ObjectDef(NumObjectDefs)%NumNumeric > 0) THEN
ObjectDef(NumObjectDefs)%NumRangeChks=NumRangeChecks(1:ObjectDef(NumObjectDefs)%NumNumeric)
ENDIF
PrevSizeNumNumeric = ObjectDef(NumObjectDefs)%NumNumeric !used to clear only portion of NumRangeChecks array
ALLOCATE(ObjectDef(NumObjectDefs)%AlphFieldChks(ObjectDef(NumObjectDefs)%NumAlpha))
IF (ObjectDef(NumObjectDefs)%NumAlpha > 0) THEN
ObjectDef(NumObjectDefs)%AlphFieldChks=AlphFieldChecks(1:ObjectDef(NumObjectDefs)%NumAlpha)
ENDIF
ALLOCATE(ObjectDef(NumObjectDefs)%AlphFieldDefs(ObjectDef(NumObjectDefs)%NumAlpha))
IF (ObjectDef(NumObjectDefs)%NumAlpha > 0) THEN
ObjectDef(NumObjectDefs)%AlphFieldDefs=AlphFieldDefaults(1:ObjectDef(NumObjectDefs)%NumAlpha)
ENDIF
PrevSizeNumAlpha = ObjectDef(NumObjectDefs)%NumAlpha
ALLOCATE(ObjectDef(NumObjectDefs)%ReqField(Count))
ObjectDef(NumObjectDefs)%ReqField=RequiredFields(1:Count)
DO Count=1,ObjectDef(NumObjectDefs)%NumNumeric
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxChk) THEN
! Checking MinMax Range (min vs. max and vice versa)
MinMaxError=.false.
! check min against max
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(1) == 1) THEN
! min
Value=ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(1)
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(2) == 3) THEN
IF (Value > ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(2)) MinMaxError=.true.
ELSEIF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(2) == 4) THEN
IF (Value == ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(2)) MinMaxError=.true.
ENDIF
ELSEIF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(1) == 2) THEN
! min>
Value=ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(1) + rTinyValue ! infintesimally bigger than min
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(2) == 3) THEN
IF (Value > ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(2)) MinMaxError=.true.
ELSEIF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(2) == 4) THEN
IF (Value == ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(2)) MinMaxError=.true.
ENDIF
ENDIF
! check max against min
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(2) == 3) THEN
! max
Value=ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(2)
! Check max value against min
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(1) == 1) THEN
IF (Value < ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(1)) MinMaxError=.true.
ELSEIF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(1) == 2) THEN
IF (Value == ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(1)) MinMaxError=.true.
ENDIF
ELSEIF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(2) == 4) THEN
! max<
Value=ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(2) - rTinyValue ! infintesimally bigger than min
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(1) == 1) THEN
IF (Value < ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(1)) MinMaxError=.true.
ELSEIF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(1) == 2) THEN
IF (Value == ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(1)) MinMaxError=.true.
ENDIF
ENDIF
! check if error condition
IF (MinMaxError) THEN
! Error stated min is not in range with stated max
MinMaxString=IPTrimSigDigits(ObjectDef(NumObjectDefs)%NumRangeChks(Count)%FieldNumber)
CALL ShowSevereError('IP: IDD: Field #'//TRIM(MinMaxString)//' conflict in Min/Max specifications/values, in class='// &
TRIM(ObjectDef(NumObjectDefs)%Name),EchoInputFile)
ErrFlag=.true.
ENDIF
ENDIF
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%DefaultChk) THEN
! Check Default against MinMaxRange
! Don't check when default is autosize...
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%Autosizable .and. &
ObjectDef(NumObjectDefs)%NumRangeChks(Count)%DefAutoSize) CYCLE
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%Autocalculatable .and. &
ObjectDef(NumObjectDefs)%NumRangeChks(Count)%DefAutoCalculate) CYCLE
MinMaxError=.false.
Value=ObjectDef(NumObjectDefs)%NumRangeChks(Count)%Default
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(1) == 1) THEN
IF (Value < ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(1)) MinMaxError=.true.
ELSEIF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(1) == 2) THEN
IF (Value <= ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(1)) MinMaxError=.true.
ENDIF
IF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(2) == 3) THEN
IF (Value > ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(2)) MinMaxError=.true.
ELSEIF (ObjectDef(NumObjectDefs)%NumRangeChks(Count)%WhichMinMax(2) == 4) THEN
IF (Value >= ObjectDef(NumObjectDefs)%NumRangeChks(Count)%MinMaxValue(2)) MinMaxError=.true.
ENDIF
IF (MinMaxError) THEN
! Error stated default is not in min/max range
MinMaxString=IPTrimSigDigits(ObjectDef(NumObjectDefs)%NumRangeChks(Count)%FieldNumber)
CALL ShowSevereError('IP: IDD: Field #'//TRIM(MinMaxString)//' default is invalid for Min/Max values, in class='// &
TRIM(ObjectDef(NumObjectDefs)%Name),EchoInputFile)
ErrFlag=.true.
ENDIF
ENDIF
ENDDO
IF (ErrFlag) THEN
CALL ShowContinueError('IP: Errors occured in ObjectDefinition for Class='//TRIM(ObjectDef(NumObjectDefs)%Name)// &
', Object not available for IDF processing.',EchoInputFile)
DEALLOCATE(ObjectDef(NumObjectDefs)%AlphaorNumeric)
DEALLOCATE(ObjectDef(NumObjectDefs)%NumRangeChks)
DEALLOCATE(ObjectDef(NumObjectDefs)%AlphFieldChks)
DEALLOCATE(ObjectDef(NumObjectDefs)%AlphFieldDefs)
DEALLOCATE(ObjectDef(NumObjectDefs)%ReqField)
DEALLOCATE(ObjectDef(NumObjectDefs)%AlphRetainCase)
NumObjectDefs=NumObjectDefs-1
ErrorsFound=.true.
ENDIF
RETURN
END SUBROUTINE AddObjectDefandParse