Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in OpenFAST Registry Unpacking Structures with C_obj data #2249

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions modules/externalinflow/src/ExternalInflow_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,15 @@ subroutine ExtInfw_UnPackInitInput(RF, OutData)
call RegUnpack(RF, OutData%NumActForcePtsTower); if (RegCheckErr(RF, RoutineName)) return
OutData%C_obj%NumActForcePtsTower = OutData%NumActForcePtsTower
call RegUnpackPtr(RF, OutData%StructBldRNodes); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%StructBldRNodes)) then
OutData%C_obj%StructBldRNodes_Len = size(OutData%StructBldRNodes)
if (OutData%C_obj%StructBldRNodes_Len > 0) OutData%C_obj%StructBldRNodes = c_loc(OutData%StructBldRNodes(LB(1)))
end if
call RegUnpackPtr(RF, OutData%StructTwrHNodes); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%StructTwrHNodes)) then
OutData%C_obj%StructTwrHNodes_Len = size(OutData%StructTwrHNodes)
if (OutData%C_obj%StructTwrHNodes_Len > 0) OutData%C_obj%StructTwrHNodes = c_loc(OutData%StructTwrHNodes(LB(1)))
end if
call RegUnpack(RF, OutData%BladeLength); if (RegCheckErr(RF, RoutineName)) return
OutData%C_obj%BladeLength = OutData%BladeLength
call RegUnpack(RF, OutData%TowerHeight); if (RegCheckErr(RF, RoutineName)) return
Expand Down Expand Up @@ -1027,7 +1035,15 @@ subroutine ExtInfw_UnPackParam(RF, OutData)
call RegUnpack(RF, OutData%NnodesForceTower); if (RegCheckErr(RF, RoutineName)) return
OutData%C_obj%NnodesForceTower = OutData%NnodesForceTower
call RegUnpackPtr(RF, OutData%forceBldRnodes); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%forceBldRnodes)) then
OutData%C_obj%forceBldRnodes_Len = size(OutData%forceBldRnodes)
if (OutData%C_obj%forceBldRnodes_Len > 0) OutData%C_obj%forceBldRnodes = c_loc(OutData%forceBldRnodes(LB(1)))
end if
call RegUnpackPtr(RF, OutData%forceTwrHnodes); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%forceTwrHnodes)) then
OutData%C_obj%forceTwrHnodes_Len = size(OutData%forceTwrHnodes)
if (OutData%C_obj%forceTwrHnodes_Len > 0) OutData%C_obj%forceTwrHnodes = c_loc(OutData%forceTwrHnodes(LB(1)))
end if
call RegUnpack(RF, OutData%BladeLength); if (RegCheckErr(RF, RoutineName)) return
OutData%C_obj%BladeLength = OutData%BladeLength
call RegUnpack(RF, OutData%TowerHeight); if (RegCheckErr(RF, RoutineName)) return
Expand Down Expand Up @@ -1556,22 +1572,90 @@ subroutine ExtInfw_UnPackInput(RF, OutData)
type(c_ptr) :: Ptr
if (RF%ErrStat /= ErrID_None) return
call RegUnpackPtr(RF, OutData%pxVel); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%pxVel)) then
OutData%C_obj%pxVel_Len = size(OutData%pxVel)
if (OutData%C_obj%pxVel_Len > 0) OutData%C_obj%pxVel = c_loc(OutData%pxVel(LB(1)))
end if
call RegUnpackPtr(RF, OutData%pyVel); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%pyVel)) then
OutData%C_obj%pyVel_Len = size(OutData%pyVel)
if (OutData%C_obj%pyVel_Len > 0) OutData%C_obj%pyVel = c_loc(OutData%pyVel(LB(1)))
end if
call RegUnpackPtr(RF, OutData%pzVel); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%pzVel)) then
OutData%C_obj%pzVel_Len = size(OutData%pzVel)
if (OutData%C_obj%pzVel_Len > 0) OutData%C_obj%pzVel = c_loc(OutData%pzVel(LB(1)))
end if
call RegUnpackPtr(RF, OutData%pxForce); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%pxForce)) then
OutData%C_obj%pxForce_Len = size(OutData%pxForce)
if (OutData%C_obj%pxForce_Len > 0) OutData%C_obj%pxForce = c_loc(OutData%pxForce(LB(1)))
end if
call RegUnpackPtr(RF, OutData%pyForce); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%pyForce)) then
OutData%C_obj%pyForce_Len = size(OutData%pyForce)
if (OutData%C_obj%pyForce_Len > 0) OutData%C_obj%pyForce = c_loc(OutData%pyForce(LB(1)))
end if
call RegUnpackPtr(RF, OutData%pzForce); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%pzForce)) then
OutData%C_obj%pzForce_Len = size(OutData%pzForce)
if (OutData%C_obj%pzForce_Len > 0) OutData%C_obj%pzForce = c_loc(OutData%pzForce(LB(1)))
end if
call RegUnpackPtr(RF, OutData%xdotForce); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%xdotForce)) then
OutData%C_obj%xdotForce_Len = size(OutData%xdotForce)
if (OutData%C_obj%xdotForce_Len > 0) OutData%C_obj%xdotForce = c_loc(OutData%xdotForce(LB(1)))
end if
call RegUnpackPtr(RF, OutData%ydotForce); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%ydotForce)) then
OutData%C_obj%ydotForce_Len = size(OutData%ydotForce)
if (OutData%C_obj%ydotForce_Len > 0) OutData%C_obj%ydotForce = c_loc(OutData%ydotForce(LB(1)))
end if
call RegUnpackPtr(RF, OutData%zdotForce); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%zdotForce)) then
OutData%C_obj%zdotForce_Len = size(OutData%zdotForce)
if (OutData%C_obj%zdotForce_Len > 0) OutData%C_obj%zdotForce = c_loc(OutData%zdotForce(LB(1)))
end if
call RegUnpackPtr(RF, OutData%pOrientation); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%pOrientation)) then
OutData%C_obj%pOrientation_Len = size(OutData%pOrientation)
if (OutData%C_obj%pOrientation_Len > 0) OutData%C_obj%pOrientation = c_loc(OutData%pOrientation(LB(1)))
end if
call RegUnpackPtr(RF, OutData%fx); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%fx)) then
OutData%C_obj%fx_Len = size(OutData%fx)
if (OutData%C_obj%fx_Len > 0) OutData%C_obj%fx = c_loc(OutData%fx(LB(1)))
end if
call RegUnpackPtr(RF, OutData%fy); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%fy)) then
OutData%C_obj%fy_Len = size(OutData%fy)
if (OutData%C_obj%fy_Len > 0) OutData%C_obj%fy = c_loc(OutData%fy(LB(1)))
end if
call RegUnpackPtr(RF, OutData%fz); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%fz)) then
OutData%C_obj%fz_Len = size(OutData%fz)
if (OutData%C_obj%fz_Len > 0) OutData%C_obj%fz = c_loc(OutData%fz(LB(1)))
end if
call RegUnpackPtr(RF, OutData%momentx); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%momentx)) then
OutData%C_obj%momentx_Len = size(OutData%momentx)
if (OutData%C_obj%momentx_Len > 0) OutData%C_obj%momentx = c_loc(OutData%momentx(LB(1)))
end if
call RegUnpackPtr(RF, OutData%momenty); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%momenty)) then
OutData%C_obj%momenty_Len = size(OutData%momenty)
if (OutData%C_obj%momenty_Len > 0) OutData%C_obj%momenty = c_loc(OutData%momenty(LB(1)))
end if
call RegUnpackPtr(RF, OutData%momentz); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%momentz)) then
OutData%C_obj%momentz_Len = size(OutData%momentz)
if (OutData%C_obj%momentz_Len > 0) OutData%C_obj%momentz = c_loc(OutData%momentz(LB(1)))
end if
call RegUnpackPtr(RF, OutData%forceNodesChord); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%forceNodesChord)) then
OutData%C_obj%forceNodesChord_Len = size(OutData%forceNodesChord)
if (OutData%C_obj%forceNodesChord_Len > 0) OutData%C_obj%forceNodesChord = c_loc(OutData%forceNodesChord(LB(1)))
end if
end subroutine

SUBROUTINE ExtInfw_C2Fary_CopyInput(InputData, ErrStat, ErrMsg, SkipPointers)
Expand Down Expand Up @@ -2093,8 +2177,20 @@ subroutine ExtInfw_UnPackOutput(RF, OutData)
type(c_ptr) :: Ptr
if (RF%ErrStat /= ErrID_None) return
call RegUnpackPtr(RF, OutData%u); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%u)) then
OutData%C_obj%u_Len = size(OutData%u)
if (OutData%C_obj%u_Len > 0) OutData%C_obj%u = c_loc(OutData%u(LB(1)))
end if
call RegUnpackPtr(RF, OutData%v); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%v)) then
OutData%C_obj%v_Len = size(OutData%v)
if (OutData%C_obj%v_Len > 0) OutData%C_obj%v = c_loc(OutData%v(LB(1)))
end if
call RegUnpackPtr(RF, OutData%w); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%w)) then
OutData%C_obj%w_Len = size(OutData%w)
if (OutData%C_obj%w_Len > 0) OutData%C_obj%w = c_loc(OutData%w(LB(1)))
end if
call RegUnpackAlloc(RF, OutData%WriteOutput); if (RegCheckErr(RF, RoutineName)) return
end subroutine

Expand Down
80 changes: 80 additions & 0 deletions modules/extloads/src/ExtLoadsDX_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,35 @@ subroutine ExtLdDX_UnPackInput(RF, OutData)
type(c_ptr) :: Ptr
if (RF%ErrStat /= ErrID_None) return
call RegUnpackPtr(RF, OutData%twrDef); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%twrDef)) then
OutData%C_obj%twrDef_Len = size(OutData%twrDef)
if (OutData%C_obj%twrDef_Len > 0) OutData%C_obj%twrDef = c_loc(OutData%twrDef(LB(1)))
end if
call RegUnpackPtr(RF, OutData%bldDef); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%bldDef)) then
OutData%C_obj%bldDef_Len = size(OutData%bldDef)
if (OutData%C_obj%bldDef_Len > 0) OutData%C_obj%bldDef = c_loc(OutData%bldDef(LB(1)))
end if
call RegUnpackPtr(RF, OutData%hubDef); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%hubDef)) then
OutData%C_obj%hubDef_Len = size(OutData%hubDef)
if (OutData%C_obj%hubDef_Len > 0) OutData%C_obj%hubDef = c_loc(OutData%hubDef(LB(1)))
end if
call RegUnpackPtr(RF, OutData%nacDef); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%nacDef)) then
OutData%C_obj%nacDef_Len = size(OutData%nacDef)
if (OutData%C_obj%nacDef_Len > 0) OutData%C_obj%nacDef = c_loc(OutData%nacDef(LB(1)))
end if
call RegUnpackPtr(RF, OutData%bldRootDef); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%bldRootDef)) then
OutData%C_obj%bldRootDef_Len = size(OutData%bldRootDef)
if (OutData%C_obj%bldRootDef_Len > 0) OutData%C_obj%bldRootDef = c_loc(OutData%bldRootDef(LB(1)))
end if
call RegUnpackPtr(RF, OutData%bldPitch); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%bldPitch)) then
OutData%C_obj%bldPitch_Len = size(OutData%bldPitch)
if (OutData%C_obj%bldPitch_Len > 0) OutData%C_obj%bldPitch = c_loc(OutData%bldPitch(LB(1)))
end if
end subroutine

SUBROUTINE ExtLdDX_C2Fary_CopyInput(InputData, ErrStat, ErrMsg, SkipPointers)
Expand Down Expand Up @@ -774,17 +798,65 @@ subroutine ExtLdDX_UnPackParam(RF, OutData)
type(c_ptr) :: Ptr
if (RF%ErrStat /= ErrID_None) return
call RegUnpackPtr(RF, OutData%nBlades); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%nBlades)) then
OutData%C_obj%nBlades_Len = size(OutData%nBlades)
if (OutData%C_obj%nBlades_Len > 0) OutData%C_obj%nBlades = c_loc(OutData%nBlades(LB(1)))
end if
call RegUnpackPtr(RF, OutData%nBladeNodes); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%nBladeNodes)) then
OutData%C_obj%nBladeNodes_Len = size(OutData%nBladeNodes)
if (OutData%C_obj%nBladeNodes_Len > 0) OutData%C_obj%nBladeNodes = c_loc(OutData%nBladeNodes(LB(1)))
end if
call RegUnpackPtr(RF, OutData%nTowerNodes); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%nTowerNodes)) then
OutData%C_obj%nTowerNodes_Len = size(OutData%nTowerNodes)
if (OutData%C_obj%nTowerNodes_Len > 0) OutData%C_obj%nTowerNodes = c_loc(OutData%nTowerNodes(LB(1)))
end if
call RegUnpackPtr(RF, OutData%twrRefPos); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%twrRefPos)) then
OutData%C_obj%twrRefPos_Len = size(OutData%twrRefPos)
if (OutData%C_obj%twrRefPos_Len > 0) OutData%C_obj%twrRefPos = c_loc(OutData%twrRefPos(LB(1)))
end if
call RegUnpackPtr(RF, OutData%bldRefPos); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%bldRefPos)) then
OutData%C_obj%bldRefPos_Len = size(OutData%bldRefPos)
if (OutData%C_obj%bldRefPos_Len > 0) OutData%C_obj%bldRefPos = c_loc(OutData%bldRefPos(LB(1)))
end if
call RegUnpackPtr(RF, OutData%hubRefPos); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%hubRefPos)) then
OutData%C_obj%hubRefPos_Len = size(OutData%hubRefPos)
if (OutData%C_obj%hubRefPos_Len > 0) OutData%C_obj%hubRefPos = c_loc(OutData%hubRefPos(LB(1)))
end if
call RegUnpackPtr(RF, OutData%nacRefPos); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%nacRefPos)) then
OutData%C_obj%nacRefPos_Len = size(OutData%nacRefPos)
if (OutData%C_obj%nacRefPos_Len > 0) OutData%C_obj%nacRefPos = c_loc(OutData%nacRefPos(LB(1)))
end if
call RegUnpackPtr(RF, OutData%bldRootRefPos); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%bldRootRefPos)) then
OutData%C_obj%bldRootRefPos_Len = size(OutData%bldRootRefPos)
if (OutData%C_obj%bldRootRefPos_Len > 0) OutData%C_obj%bldRootRefPos = c_loc(OutData%bldRootRefPos(LB(1)))
end if
call RegUnpackPtr(RF, OutData%bldChord); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%bldChord)) then
OutData%C_obj%bldChord_Len = size(OutData%bldChord)
if (OutData%C_obj%bldChord_Len > 0) OutData%C_obj%bldChord = c_loc(OutData%bldChord(LB(1)))
end if
call RegUnpackPtr(RF, OutData%bldRloc); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%bldRloc)) then
OutData%C_obj%bldRloc_Len = size(OutData%bldRloc)
if (OutData%C_obj%bldRloc_Len > 0) OutData%C_obj%bldRloc = c_loc(OutData%bldRloc(LB(1)))
end if
call RegUnpackPtr(RF, OutData%twrDia); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%twrDia)) then
OutData%C_obj%twrDia_Len = size(OutData%twrDia)
if (OutData%C_obj%twrDia_Len > 0) OutData%C_obj%twrDia = c_loc(OutData%twrDia(LB(1)))
end if
call RegUnpackPtr(RF, OutData%twrHloc); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%twrHloc)) then
OutData%C_obj%twrHloc_Len = size(OutData%twrHloc)
if (OutData%C_obj%twrHloc_Len > 0) OutData%C_obj%twrHloc = c_loc(OutData%twrHloc(LB(1)))
end if
end subroutine

SUBROUTINE ExtLdDX_C2Fary_CopyParam(ParamData, ErrStat, ErrMsg, SkipPointers)
Expand Down Expand Up @@ -1163,7 +1235,15 @@ subroutine ExtLdDX_UnPackOutput(RF, OutData)
type(c_ptr) :: Ptr
if (RF%ErrStat /= ErrID_None) return
call RegUnpackPtr(RF, OutData%twrLd); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%twrLd)) then
OutData%C_obj%twrLd_Len = size(OutData%twrLd)
if (OutData%C_obj%twrLd_Len > 0) OutData%C_obj%twrLd = c_loc(OutData%twrLd(LB(1)))
end if
call RegUnpackPtr(RF, OutData%bldLd); if (RegCheckErr(RF, RoutineName)) return
if (associated(OutData%bldLd)) then
OutData%C_obj%bldLd_Len = size(OutData%bldLd)
if (OutData%C_obj%bldLd_Len > 0) OutData%C_obj%bldLd = c_loc(OutData%bldLd(LB(1)))
end if
end subroutine

SUBROUTINE ExtLdDX_C2Fary_CopyOutput(OutputData, ErrStat, ErrMsg, SkipPointers)
Expand Down
Loading
Loading