| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | Name | |||
| integer, | intent(in) | :: | NodeFluidType | |||
| 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.
INTEGER FUNCTION AssignNodeNumber(Name,NodeFluidType,ErrorsFound)
          ! FUNCTION INFORMATION:
          !       AUTHOR         Linda K. Lawrie
          !       DATE WRITTEN   September 1999
          !       MODIFIED       na
          !       RE-ENGINEERED  na
          ! PURPOSE OF THIS FUNCTION:
          ! This function assigns a node number to this name.
          ! METHODOLOGY EMPLOYED:
          ! Look to see if a name has already been entered.  Use the index of
          ! the array as the node number, if there.
          ! REFERENCES:
          ! na
          ! USE STATEMENTS:
          ! na
  IMPLICIT NONE    ! Enforce explicit typing of all variables in this routine
          ! SUBROUTINE ARGUMENT DEFINITIONS:
  CHARACTER(len=*), INTENT(IN) :: Name  ! Name for assignment
  INTEGER, INTENT(IN)          :: NodeFluidType ! must be valid
  LOGICAL, INTENT(INOUT)       :: ErrorsFound
          ! SUBROUTINE PARAMETER DEFINITIONS:
          ! na
          ! INTERFACE BLOCK SPECIFICATIONS
          ! na
          ! DERIVED TYPE DEFINITIONS
          ! na
          ! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
  INTEGER :: NumNode=0             ! Loop Variable
  CHARACTER(len=25) :: cNodeFluidType =' '
  IF (NodeFluidType /= NodeType_Air .and. NodeFluidType /= NodeType_Water .and. &
      NodeFluidType /= NodeType_Electric .and.NodeFluidType /= NodeType_Steam .and. &
      NodeFluidType /= NodeType_Unknown) THEN
    WRITE(cNodeFluidType,*) NodeFluidType
    cNodeFluidType=ADJUSTL(cNodeFluidType)
    CALL ShowSevereError('AssignNodeNumber: Invalid FluidType='//TRIM(cNodeFluidType))
    ErrorsFound=.true.
    CALL ShowFatalError('AssignNodeNumber: Preceding issue causes termination.')
  ENDIF
  NumNode=0
  IF (NumOfUniqueNodeNames > 0) THEN
    NumNode=FindItemInList(Name,NodeID(1:NumOfUniqueNodeNames),NumOfUniqueNodeNames)
    IF (NumNode > 0) THEN
      AssignNodeNumber=NumNode
      NodeRef(NumNode)=NodeRef(NumNode)+1
      IF (NodeFluidType /= NodeType_Unknown) THEN
        IF (Node(NumNode)%FluidType /= NodeFluidType .and. Node(NumNode)%FluidType /= NodeType_Unknown) THEN
          CALL ShowSevereError('Existing Fluid type for node, incorrect for request. Node='//TRIM(NodeID(NumNode)))
          CALL ShowContinueError('Existing Fluid type='//TRIM(ValidNodeFluidTypes(Node(NumNode)%FluidType))//  &
                                 ', Requested Fluid Type='//TRIM(ValidNodeFluidTypes(NodeFluidType)))
          ErrorsFound=.true.
        ENDIF
      ENDIF
      IF (Node(NumNode)%FluidType == NodeType_Unknown) THEN
        Node(NumNode)%FluidType=NodeFluidType
      ENDIF
    ELSE
      NumOfUniqueNodeNames=NumOfUniqueNodeNames+1
      NumOfNodes=NumOfUniqueNodeNames
      ALLOCATE(TmpNode(NumOfNodes))
      ALLOCATE(TmpNodeID(0:NumOfNodes))
      ALLOCATE(TmpNodeRef(NumOfNodes))
      ALLOCATE(TmpMarkedNode(NumOfNodes))
      TmpNode(1:NumOfNodes-1)=Node(1:NumOfNodes-1)
      TmpNodeID(0:NumOfNodes-1)=NodeID(0:NumOfNodes-1)
      TmpNodeRef(1:NumOfNodes-1)=NodeRef(1:NumOfNodes-1)
      TmpMarkedNode(1:NumOfNodes-1)=MarkedNode(1:NumOfNodes-1)
      DEALLOCATE(Node)
      DEALLOCATE(NodeID)
      DEALLOCATE(NodeRef)
      DEALLOCATE(MarkedNode)
      ALLOCATE(Node(NumOfNodes))
      ALLOCATE(NodeID(0:NumOfNodes))
      ALLOCATE(NodeRef(NumOfNodes))
      ALLOCATE(MarkedNode(NumOfNodes))
      Node(1:NumOfNodes-1)=TmpNode(1:NumOfNodes-1)
      NodeID(0:NumOfNodes-1)=TmpNodeID(0:NumOfNodes-1)
      NodeRef(1:NumOfNodes-1)=TmpNodeRef(1:NumOfNodes-1)
      MarkedNode(1:NumOfNodes-1)=TmpMarkedNode(1:NumOfNodes-1)
      DEALLOCATE(TmpNode)
      DEALLOCATE(TmpNodeID)
      DEALLOCATE(TmpNodeRef)
      DEALLOCATE(TmpMarkedNode)
      ! Set new item in derived type Node to zero.
      Node(NumOfNodes)%FluidType            =NodeFluidType
      ! Allocate takes care of defining
      NodeID(NumOfNodes)=' '
      NodeRef(NumOfNodes)=0
      NodeID(NumOfUniqueNodeNames)=Name
      AssignNodeNumber=NumOfUniqueNodeNames
    ENDIF
  ELSE
    ALLOCATE(Node(1))
    Node(1)%FluidType            =NodeFluidType
      ! Allocate takes care of defining
    NumOfNodes=1
    ALLOCATE(NodeID(0:1))
    ALLOCATE(NodeRef(1))
    ALLOCATE(MarkedNode(1))
    NumOfUniqueNodeNames=1
    NodeID(0)='Undefined'
    NodeID(NumOfUniqueNodeNames)=Name
    AssignNodeNumber=1
    NodeRef(1)=0
  ENDIF
  RETURN
END FUNCTION AssignNodeNumber