anchor.diff:  
   
   CONTAINS
  +!------------------------------------------------------------------------------------------------------
  +! --- Helper functions
   !------------------------------------------------------------------------------------------------------
   !> Maps nodes to elements 
   !! allocate NodesConnE and NodesConnN                                                                               
  
positive.code:    END FUNCTION nDOF_ConstraintReduced
  END SUBROUTINE DirectElimination
  
  
  !------------------------------------------------------------------------------------------------------
  !> Returns list of rigid link elements (Er) 
  TYPE(IList) FUNCTION RigidLinkElements(Init, p, ErrStat, ErrMsg)
     use IntegerList, only: init_list, append
     use IntegerList, only: print_list
     TYPE(SD_InitType),            INTENT(INOUT) :: Init
     TYPE(SD_ParameterType),       INTENT(INOUT) :: p
     INTEGER(IntKi),               INTENT(  OUT) :: ErrStat     ! Error status of the operation
     CHARACTER(*),                 INTENT(  OUT) :: ErrMsg      ! Error message if ErrStat /= ErrID_None
     ! Local variables
     integer(IntKi)  :: ie       !< Index on elements
     ErrStat = ErrID_None
     ErrMsg  = ""
     ! --- Establish a list of rigid link elements
     call init_list(RigidLinkElements, 0, 0, ErrStat, ErrMsg);
  
     do ie = 1, Init%NElem
        if (p%ElemProps(ie)%eType == idMemberRigid) then
           call append(RigidLinkElements, ie, ErrStat, ErrMsg);
        endif
     end do
     call print_list(RigidLinkElements,'Rigid element list')
  END FUNCTION RigidLinkElements
  
  !------------------------------------------------------------------------------------------------------
  !> Returns true if one of the element connected to the node is a rigid link
  LOGICAL FUNCTION NodeHasRigidElem(iJoint, Init, p)
     INTEGER(IntKi),               INTENT(IN   ) :: iJoint  
     TYPE(SD_InitType),            INTENT(INOUT) :: Init
     TYPE(SD_ParameterType),       INTENT(INOUT) :: p
     ! Local variables
     integer(IntKi) :: ie       !< Loop index on elements
     integer(IntKi) :: ei       !< Element index
     integer(IntKi) :: m  ! Number of elements connected to a joint
  
     NodeHasRigidElem = .False. ! default return value
  
     ! Loop through elements connected to node J 
     do ie = 1, Init%NodesConnE(iJoint, 1)
        ei = Init%NodesConnE(iJoint, ie+1)
        if (p%ElemProps(ei)%eType == idMemberRigid) then
           NodeHasRigidElem = .True.
           return  ! we exit as soon as one rigid member is found
        endif
     enddo
  END FUNCTION NodeHasRigidElem
  !------------------------------------------------------------------------------------------------------
  !> Returns constrains matrix for a rigid assembly (RA) formed by a set of elements. 
  !! 
  
negative.code:    enddo
     call print_list(NodesList, 'Joint list')
  END FUNCTION NodesList
  !------------------------------------------------------------------------------------------------------
  !> Returns list of rigid link elements (Er) 
  TYPE(IList) FUNCTION RigidLinkElements(Init, p, ErrStat, ErrMsg)
     use IntegerList, only: init_list, append
     use IntegerList, only: print_list
     TYPE(SD_InitType),            INTENT(INOUT) :: Init
     TYPE(SD_ParameterType),       INTENT(INOUT) :: p
     INTEGER(IntKi),               INTENT(  OUT) :: ErrStat     ! Error status of the operation
     CHARACTER(*),                 INTENT(  OUT) :: ErrMsg      ! Error message if ErrStat /= ErrID_None
     ! Local variables
     integer(IntKi)  :: ie       !< Index on elements
     ErrStat = ErrID_None
     ErrMsg  = ""
     ! --- Establish a list of rigid link elements
     call init_list(RigidLinkElements, 0, 0, ErrStat, ErrMsg);
  
     do ie = 1, Init%NElem
        if (p%ElemProps(ie)%eType == idMemberRigid) then
           call append(RigidLinkElements, ie, ErrStat, ErrMsg);
        endif
     end do
     call print_list(RigidLinkElements,'Rigid element list')
  END FUNCTION RigidLinkElements
  
  !------------------------------------------------------------------------------------------------------
  !> Returns true if one of the element connected to the node is a rigid link
  LOGICAL FUNCTION NodeHasRigidElem(iJoint, Init, p)
     INTEGER(IntKi),               INTENT(IN   ) :: iJoint  
     TYPE(SD_InitType),            INTENT(INOUT) :: Init
     TYPE(SD_ParameterType),       INTENT(INOUT) :: p
     ! Local variables
     integer(IntKi) :: ie       !< Loop index on elements
     integer(IntKi) :: ei       !< Element index
     integer(IntKi) :: m  ! Number of elements connected to a joint
  
     NodeHasRigidElem = .False. ! default return value
  
     ! Loop through elements connected to node J 
     do ie = 1, Init%NodesConnE(iJoint, 1)
        ei = Init%NodesConnE(iJoint, ie+1)
        if (p%ElemProps(ei)%eType == idMemberRigid) then
           NodeHasRigidElem = .True.
           return  ! we exit as soon as one rigid member is found
        endif
     enddo
  END FUNCTION NodeHasRigidElem
  
  !------------------------------------------------------------------------------------------------------
  ! --- Main routines, more or less listed in order in which they are called
  !------------------------------------------------------------------------------------------------------
  !>
  ! - Removes the notion of "ID" and use Index instead
  ! - Creates Nodes (use indices instead of ID), similar to Joints array
  