From 4e034aa471033886b8b14d1dbf6c415c18a9d519 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Thu, 15 Sep 2022 10:48:46 -0600 Subject: [PATCH 1/4] NWTC Lib: add `OutStrLenM1` and `FindValidChannelIndx` This requires removing the definition of OutStrLenM1 from all the Matlab-generated writeOutput code. But, it also allows that matlab-generated code to be simplified also removed some unused variables --- modules/aerodyn/src/AeroAcoustics_IO.f90 | 8 +-- .../aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 | 24 ++++---- modules/aerodyn/src/AeroDyn_IO.f90 | 55 +++---------------- modules/beamdyn/src/BeamDyn_BldNdOuts_IO.f90 | 2 +- modules/beamdyn/src/BeamDyn_IO.f90 | 5 -- .../src/ElastoDyn_AllBldNdOuts_IO.f90 | 2 +- modules/elastodyn/src/ElastoDyn_IO.f90 | 5 -- modules/extptfm/src/ExtPtfm_MCKF_IO.f90 | 1 - modules/feamooring/src/FEAM.f90 | 5 -- modules/hydrodyn/src/HydroDyn_Input.f90 | 3 +- modules/hydrodyn/src/HydroDyn_Output.f90 | 20 +++---- modules/hydrodyn/src/Morison_Output.f90 | 39 +------------ modules/hydrodyn/src/WAMIT2.f90 | 16 +++--- modules/inflowwind/src/InflowWind_Subs.f90 | 10 +--- modules/nwtc-library/src/NWTC_Base.f90 | 2 + modules/nwtc-library/src/NWTC_IO.f90 | 5 +- modules/nwtc-library/src/NWTC_Num.f90 | 45 +++++++++++++++ .../src/OrcaFlexInterface.f90 | 5 -- modules/servodyn/src/ServoDyn_IO.f90 | 8 +-- vs-build/RunRegistry.bat | 1 - 20 files changed, 93 insertions(+), 168 deletions(-) diff --git a/modules/aerodyn/src/AeroAcoustics_IO.f90 b/modules/aerodyn/src/AeroAcoustics_IO.f90 index cbb1666d55..4e08ddf176 100644 --- a/modules/aerodyn/src/AeroAcoustics_IO.f90 +++ b/modules/aerodyn/src/AeroAcoustics_IO.f90 @@ -15,10 +15,6 @@ MODULE AeroAcoustics_IO INTEGER(IntKi), PARAMETER :: Time = 0 - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - INTEGER(IntKi), PARAMETER :: MaxBl = 3 ! Maximum number of blades allowed in simulation ! model identifiers @@ -337,7 +333,7 @@ SUBROUTINE ReadBLTables( InputFile, BL_Files, InputFileData, ErrStat, ErrMsg ) character(ErrMsgLen) :: ErrMsg2 ! Temporary Error message character(1024) :: PriPath ! Path name of the primary file character(1024) :: FTitle ! "File Title": the 2nd line of the input file, which contains a description of its contents - character(200) :: Line ! Temporary storage of a line from the input file (to compare with "default") +! character(200) :: Line ! Temporary storage of a line from the input file (to compare with "default") character(*), parameter :: RoutineName = 'readbltable' integer(IntKi) :: nRe, nAoA, nAirfoils ! Number of Reynolds number, angle of attack, and number of airfoils listed integer(IntKi) :: iAF , iRe, iAoA, iDummy, iBuffer ! loop counters @@ -449,7 +445,7 @@ SUBROUTINE ReadTICalcTables(InputFile, InputFileData, ErrStat, ErrMsg) character(ErrMsgLen) :: ErrMsg2 ! Temporary Error message character(1024) :: PriPath ! Path name of the primary file character(1024) :: FTitle ! "File Title": the 2nd line of the input file, which contains a description of its contents - character(200) :: Line ! Temporary storage of a line from the input file (to compare with "default") +! character(200) :: Line ! Temporary storage of a line from the input file (to compare with "default") character(*), parameter :: RoutineName = 'REadTICalcTables' integer(IntKi) :: GridY ! integer(IntKi) :: GridZ ! diff --git a/modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 b/modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 index 7918e878f4..ed67c373bd 100644 --- a/modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 +++ b/modules/aerodyn/src/AeroDyn_AllBldNdOuts_IO.f90 @@ -19,7 +19,7 @@ MODULE AeroDyn_AllBldNdOuts_IO ! Parameters related to output length (number of characters allowed in the output data headers): - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 6 ! The NREL allowed channel name length is usually 20. We are making these of the form B#N##namesuffix +! INTEGER(IntKi), PARAMETER :: OutStrLenM1_Msuffix = ChanLen - 6 ! The NREL allowed channel name length is usually 20. We are making these of the form B#N##namesuffix ! =================================================================================================== @@ -27,9 +27,9 @@ MODULE AeroDyn_AllBldNdOuts_IO ! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these ! lines should be modified in the Matlab script and/or Excel worksheet as necessary. ! =================================================================================================== -! This code was generated by Write_ChckOutLst.m at 02-Mar-2022 11:12:19. - +! This code was generated by "Write_ChckOutLst.m" at 07-Sep-2022 16:16:13. + ! Indices for computing output channels: ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" @@ -103,7 +103,7 @@ MODULE AeroDyn_AllBldNdOuts_IO ! The maximum number of output channels which can be output by the code. INTEGER(IntKi), PARAMETER, PUBLIC :: BldNd_MaxOutPts = 62 -!End of code generated by Matlab script +!End of code generated by Matlab script Write_ChckOutLst ! =================================================================================================== CONTAINS @@ -1320,7 +1320,7 @@ END SUBROUTINE AllBldNdOuts_SetParameters !! the sign is set to 0 if the channel is invalid. !! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here. !! -!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 02-Mar-2022 11:12:19. +!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 07-Sep-2022 16:16:13. SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg ) !.................................................................................................................................. @@ -1342,7 +1342,6 @@ SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg ) INTEGER :: INDX ! Index for valid arrays LOGICAL :: InvalidOutput(1:BldNd_MaxOutPts) ! This array determines if the output channel is valid for this configuration - CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I) CHARACTER(*), PARAMETER :: RoutineName = "BldNdOuts_SetOutParam" CHARACTER(OutStrLenM1), PARAMETER :: ValidParamAry(62) = (/ & ! This lists the names of the allowed parameters, which must be sorted alphabetically @@ -1363,7 +1362,7 @@ SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg ) BldNd_UA_x1 , BldNd_UA_x2 , BldNd_UA_x3 , BldNd_UA_x4 , BldNd_UA_x5 , BldNd_Uin , BldNd_Uir , BldNd_Uit , & BldNd_VDisx , BldNd_VDisy , BldNd_VDisz , BldNd_Vindx , BldNd_Vindy , BldNd_VRel , BldNd_VUndx , BldNd_Vundxi , & BldNd_VUndy , BldNd_Vundyi , BldNd_VUndz , BldNd_Vundzi , BldNd_Vx , BldNd_Vy /) - CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(62) = (/ & ! This lists the units corresponding to the allowed parameters + CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(62) = (/ character(ChanLen) :: & ! This lists the units corresponding to the allowed parameters "(deg) ","(-) ","(-) ","(-) ","(deg) ","(-) ","(m) ","(-) ", & "(-) ","(-) ","(-) ","(-) ","(-) ","(deg) ","(-) ","(-) ", & "(-) ","(-) ","(-) ","(Pa) ","(N/m) ","(N/m) ","(N/m) ","(N/m) ", & @@ -1425,13 +1424,14 @@ SUBROUTINE BldNdOuts_SetOutParam(BldNd_OutList, p, p_AD, ErrStat, ErrMsg ) DO I = 1,p%BldNd_NumOuts p%BldNd_OutParam(I)%Name = BldNd_OutList(I) - OutListTmp = BldNd_OutList(I) - p%BldNd_OutParam(I)%SignM = 1 ! this won't be used - - CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case + Indx = FindValidChannelIndx(BldNd_OutList(I), ValidParamAry, p%BldNd_OutParam(I)%SignM) - Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) + if (p%BldNd_OutParam(I)%SignM /= 1) then ! this won't be used + CALL SetErrStat(ErrID_Severe, "Negative channels not allowed for nodal outputs. Resetting channel name.", ErrStat, ErrMsg, RoutineName) + p%BldNd_OutParam(I)%SignM = 1 + p%BldNd_OutParam(I)%Name = p%BldNd_OutParam(I)%Name(2:) ! remove the first character that makes this a negative value + end if IF ( Indx > 0 ) THEN ! we found the channel name IF ( InvalidOutput( ParamIndxAry(Indx) ) ) THEN ! but, it isn't valid for these settings diff --git a/modules/aerodyn/src/AeroDyn_IO.f90 b/modules/aerodyn/src/AeroDyn_IO.f90 index 6f266d5c25..3010e0588c 100644 --- a/modules/aerodyn/src/AeroDyn_IO.f90 +++ b/modules/aerodyn/src/AeroDyn_IO.f90 @@ -38,13 +38,7 @@ MODULE AeroDyn_IO ! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these ! lines should be modified in the Matlab script and/or Excel worksheet as necessary. ! =================================================================================================== -! This code was generated by Write_ChckOutLst.m at 01-Mar-2022 11:16:33. - - - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - +! This code was generated by "Write_ChckOutLst.m" at 07-Sep-2022 16:15:54. ! Indices for computing output channels: ! NOTES: @@ -1345,7 +1339,7 @@ MODULE AeroDyn_IO ! The maximum number of output channels which can be output by the code. INTEGER(IntKi), PARAMETER :: MaxOutPts = 1270 -!End of code generated by Matlab script +!End of code generated by Matlab script Write_ChckOutLst ! =================================================================================================== INTEGER, PARAMETER :: TwNVUnd(3, 9) = RESHAPE( (/ & ! Undisturbed wind velocity @@ -2408,8 +2402,7 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InitInp, InputFile, RootName, NumBlade if ( InputFileData%Echo ) WRITE(UnEc, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo CurLine = CurLine + 1 - call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%OutList, & - InputFileData%NumOuts, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEc ) + call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%OutList, InputFileData%NumOuts, ErrStat2, ErrMsg2, UnEc ) if (Failed()) return; !====== Nodal Outputs ============================================================================== @@ -2437,8 +2430,7 @@ SUBROUTINE ParsePrimaryFileInfo( PriPath, InitInp, InputFile, RootName, NumBlade if ( InputFileData%Echo ) WRITE(UnEc, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo CurLine = CurLine + 1 - call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%BldNd_OutList, & - InputFileData%BldNd_NumOuts, 'BldNd_OutList', "List of user-requested output nodal channel groups", ErrStat2, ErrMsg2, UnEc ) + call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%BldNd_OutList, InputFileData%BldNd_NumOuts, ErrStat2, ErrMsg2, UnEc ) if (FailedNodal()) return; RETURN @@ -2881,7 +2873,7 @@ END SUBROUTINE AD_PrintSum !! the sign is set to 0 if the channel is invalid. !! It sets assumes the value p%NumOuts has been set before this routine has been called, and it sets the values of p%OutParam here. !! -!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 01-Mar-2022 11:16:33. +!! This routine was generated by Write_ChckOutLst.m using the parameters listed in OutListParameters.xlsx at 07-Sep-2022 16:15:55. SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg ) !.................................................................................................................................. @@ -2902,9 +2894,7 @@ SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg ) INTEGER :: J ! Generic loop-counting index INTEGER :: INDX ! Index for valid arrays - LOGICAL :: CheckOutListAgain ! Flag used to determine if output parameter starting with "M" is valid (or the negative of another parameter) LOGICAL :: InvalidOutput(0:MaxOutPts) ! This array determines if the output channel is valid for this configuration - CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I) CHARACTER(*), PARAMETER :: RoutineName = "SetOutParam" CHARACTER(OutStrLenM1), PARAMETER :: ValidParamAry(1270) = (/ & ! This lists the names of the allowed parameters, which must be sorted alphabetically @@ -3227,7 +3217,7 @@ SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg ) TwN8Fdy , TwN8M , TwN8Re , TwN8STVx , TwN8STVy , TwN8STVz , TwN8Vrel , TwN8VUndx , & TwN8VUndy , TwN8VUndz , TwN9DynP , TwN9Fdx , TwN9Fdy , TwN9M , TwN9Re , TwN9STVx , & TwN9STVy , TwN9STVz , TwN9Vrel , TwN9VUndx , TwN9VUndy , TwN9VUndz /) - CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(1270) = (/ & ! This lists the units corresponding to the allowed parameters + CHARACTER(ChanLen), PARAMETER :: ParamUnitsAry(1270) = (/ character(ChanLen) :: & ! This lists the units corresponding to the allowed parameters "(N) ","(N) ","(N) ","(N) ","(N) ","(N) ","(N-m) ","(N-m) ", & "(N-m) ","(N-m) ","(N-m) ","(N-m) ","(W) ","(deg) ","(deg) ","(-) ", & "(-) ","(-) ","(m) ","(-) ","(-) ","(-) ","(-) ","(deg) ", & @@ -3551,39 +3541,8 @@ SUBROUTINE SetOutParam(OutList, p, p_AD, ErrStat, ErrMsg ) DO I = 1,p%NumOuts p%OutParam(I)%Name = OutList(I) - OutListTmp = OutList(I) - - ! Reverse the sign (+/-) of the output channel if the user prefixed the - ! channel name with a "-", "_", "m", or "M" character indicating "minus". - - - CheckOutListAgain = .FALSE. - - IF ( INDEX( "-_", OutListTmp(1:1) ) > 0 ) THEN - p%OutParam(I)%SignM = -1 ! ex, "-TipDxc1" causes the sign of TipDxc1 to be switched. - OutListTmp = OutListTmp(2:) - ELSE IF ( INDEX( "mM", OutListTmp(1:1) ) > 0 ) THEN ! We'll assume this is a variable name for now, (if not, we will check later if OutListTmp(2:) is also a variable name) - CheckOutListAgain = .TRUE. - p%OutParam(I)%SignM = 1 - ELSE - p%OutParam(I)%SignM = 1 - END IF - - CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case - - - Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) - - - ! If it started with an "M" (CheckOutListAgain) we didn't find the value in our list (Indx < 1) - - IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again - p%OutParam(I)%SignM = -1 ! ex, "MTipDxc1" causes the sign of TipDxc1 to be switched. - OutListTmp = OutListTmp(2:) - - Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) - END IF + Indx = FindValidChannelIndx(OutList(I), ValidParamAry, p%OutParam(I)%SignM) IF ( Indx > 0 ) THEN ! we found the channel name IF ( InvalidOutput( ParamIndxAry(Indx) ) ) THEN ! but, it isn't valid for these settings diff --git a/modules/beamdyn/src/BeamDyn_BldNdOuts_IO.f90 b/modules/beamdyn/src/BeamDyn_BldNdOuts_IO.f90 index 9cc98cb5d4..7cc98b7a03 100644 --- a/modules/beamdyn/src/BeamDyn_BldNdOuts_IO.f90 +++ b/modules/beamdyn/src/BeamDyn_BldNdOuts_IO.f90 @@ -27,7 +27,7 @@ MODULE BeamDyn_BldNdOuts_IO ! Parameters related to output length (number of characters allowed in the output data headers): - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen-6 ! We are making these of the form B1Z###quantity, but note that the glue code adds the "B1" (turbine component) part +! INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen-6 ! We are making these of the form B1Z###quantity, but note that the glue code adds the "B1" (turbine component) part ! =================================================================================================== ! NOTE: The following lines of code were generated by a Matlab script called "Write_ChckOutLst.m" diff --git a/modules/beamdyn/src/BeamDyn_IO.f90 b/modules/beamdyn/src/BeamDyn_IO.f90 index c497b3f198..1558f29290 100644 --- a/modules/beamdyn/src/BeamDyn_IO.f90 +++ b/modules/beamdyn/src/BeamDyn_IO.f90 @@ -44,11 +44,6 @@ MODULE BeamDyn_IO ! This code was generated by Write_ChckOutLst.m at 29-Sep-2015 10:23:41. - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - - ! Indices for computing output channels: ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" diff --git a/modules/elastodyn/src/ElastoDyn_AllBldNdOuts_IO.f90 b/modules/elastodyn/src/ElastoDyn_AllBldNdOuts_IO.f90 index 91c2ed0669..adbbd13201 100644 --- a/modules/elastodyn/src/ElastoDyn_AllBldNdOuts_IO.f90 +++ b/modules/elastodyn/src/ElastoDyn_AllBldNdOuts_IO.f90 @@ -20,7 +20,7 @@ MODULE ElastoDyn_AllBldNdOuts_IO ! Parameters related to output length (number of characters allowed in the output data headers): - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen-6 ! The NREL allowed channel name length is usually 20. We are making these of the form B#N###namesuffix +! INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen-6 ! The NREL allowed channel name length is usually 20. We are making these of the form B#N###namesuffix ! =================================================================================================== diff --git a/modules/elastodyn/src/ElastoDyn_IO.f90 b/modules/elastodyn/src/ElastoDyn_IO.f90 index 376792d54b..67687cf546 100644 --- a/modules/elastodyn/src/ElastoDyn_IO.f90 +++ b/modules/elastodyn/src/ElastoDyn_IO.f90 @@ -104,11 +104,6 @@ MODULE ElastoDyn_Parameters ! This code was generated by Write_ChckOutLst.m at 25-Jan-2021 13:23:51. - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - - ! Indices for computing output channels: ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" diff --git a/modules/extptfm/src/ExtPtfm_MCKF_IO.f90 b/modules/extptfm/src/ExtPtfm_MCKF_IO.f90 index d0e2868d13..ea954a9ae8 100644 --- a/modules/extptfm/src/ExtPtfm_MCKF_IO.f90 +++ b/modules/extptfm/src/ExtPtfm_MCKF_IO.f90 @@ -40,7 +40,6 @@ MODULE ExtPtfm_MCKF_Parameters ! Variables for output channels INTEGER(IntKi), PARAMETER :: MaxOutChs = 9 + 3*200 ! Maximum number of output channels ! Harcoded to outputs of 200 CB modes - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 INTEGER(IntKi), PARAMETER :: ID_Time = 0 INTEGER(IntKi), PARAMETER :: ID_PtfFx = 1 INTEGER(IntKi), PARAMETER :: ID_PtfFy = 2 diff --git a/modules/feamooring/src/FEAM.f90 b/modules/feamooring/src/FEAM.f90 index f1e541e6e7..a97aeee76b 100644 --- a/modules/feamooring/src/FEAM.f90 +++ b/modules/feamooring/src/FEAM.f90 @@ -35,11 +35,6 @@ MODULE FEAMooring ! This code was generated by Write_ChckOutLst.m at 09-Dec-2014 14:03:37. - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - - ! Indices for computing output channels: ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" diff --git a/modules/hydrodyn/src/HydroDyn_Input.f90 b/modules/hydrodyn/src/HydroDyn_Input.f90 index a780bb03a9..fcbac6fa6c 100644 --- a/modules/hydrodyn/src/HydroDyn_Input.f90 +++ b/modules/hydrodyn/src/HydroDyn_Input.f90 @@ -1262,8 +1262,7 @@ SUBROUTINE HydroDyn_ParseInput( InputFileName, OutRootName, defWtrDens, defWtrDp call AllocAry( InputFileData%UserOutputs, MaxUserOutputs, 'InputFileData%UserOutputs', ErrStat2, ErrMsg2 ) ! MaxUserOutputs is set in registry if (Failed()) return; - call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%UserOutputs, & - InputFileData%NUserOutputs, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEc ) + call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%UserOutputs, InputFileData%NUserOutputs, ErrStat2, ErrMsg2, UnEc ) if (Failed()) return; diff --git a/modules/hydrodyn/src/HydroDyn_Output.f90 b/modules/hydrodyn/src/HydroDyn_Output.f90 index fc1c73e6bc..44668a17c7 100644 --- a/modules/hydrodyn/src/HydroDyn_Output.f90 +++ b/modules/hydrodyn/src/HydroDyn_Output.f90 @@ -34,13 +34,7 @@ MODULE HydroDyn_Output ! using the parameters listed in the "OutListParameters.xlsx" Excel file. Any changes to these ! lines should be modified in the Matlab script and/or Excel worksheet as necessary. ! =================================================================================================== -! This code was generated by Write_ChckOutLst.m at 05-Jan-2021 06:02:16. - - - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - +! This code was generated by "Write_ChckOutLst.m" at 07-Sep-2022 15:24:58. ! Indices for computing output channels: ! NOTES: @@ -612,8 +606,8 @@ MODULE HydroDyn_Output ! The maximum number of output channels which can be output by the code. INTEGER(IntKi), PARAMETER :: MaxOutPts = 537 -!End of code generated by Matlab script -! =================================================================================================== +!End of code generated by Matlab script Write_ChckOutLst +! =================================================================================================== REAL(ReKi) :: AllOuts(MaxHDOutputs) ! Array of all possible outputs @@ -1232,7 +1226,7 @@ SUBROUTINE HDOut_WriteOutputs( Time, y, p, Decimate, ErrStat, ErrMsg ) INTEGER :: I ! Generic loop counter CHARACTER(200) :: Frmt ! a string to hold a format statement integer(IntKi) :: ErrStat2 - character(ErrMsgLen) :: ErrMsg2 +! character(ErrMsgLen) :: ErrMsg2 IF (p%UnOutFile < 0 ) RETURN @@ -1343,7 +1337,7 @@ SUBROUTINE HDOUT_Init( HydroDyn_ProgDesc, OutRootName, InputFileData, y, p, m, CALL HDOUT_ChkOutLst( InputFileData%OutList(1:p%NumOuts), y, p, ErrStat, ErrMsg ) - IF ( ErrStat /= 0 ) RETURN + IF ( ErrStat >= AbortErrLev ) RETURN ! Aggregate the sub-module initialization outputs for the glue code @@ -1597,13 +1591,13 @@ FUNCTION HDOut_GetChannels ( NUserOutputs, UserOutputs, OutList, foundMask, CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case - Indx = IndexCharAry( OutListTmp(1:9), ValidParamAry ) + Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again ! ex, 'MTipDxc1' causes the sign of TipDxc1 to be switched. OutListTmp = OutListTmp(2:) - Indx = IndexCharAry( OutListTmp(1:9), ValidParamAry ) + Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) END IF IF ( Indx > 0 ) THEN diff --git a/modules/hydrodyn/src/Morison_Output.f90 b/modules/hydrodyn/src/Morison_Output.f90 index 8c8a2b2caf..4ec1db451a 100644 --- a/modules/hydrodyn/src/Morison_Output.f90 +++ b/modules/hydrodyn/src/Morison_Output.f90 @@ -36,12 +36,6 @@ MODULE Morison_Output ! (2) Array AllOuts() must be dimensioned to the value of the largest output parameter ! This code was generated by Write_ChckOutLst.m at 04-Jan-2014 12:13:30. - - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - - ! Indices for computing output channels: ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" @@ -9016,36 +9010,9 @@ FUNCTION GetMorisonChannels ( NUserOutputs, UserOutputs, OutList, foundMask DO I = 1,NUserOutputs IF (.NOT. foundMask(I) ) THEN - OutListTmp = UserOutputs(I) - - CheckOutListAgain = .FALSE. - - ! Reverse the sign (+/-) of the output channel if the user prefixed the - ! channel name with a '-', '_', 'm', or 'M' character indicating "minus". - - - - IF ( INDEX( '-_', OutListTmp(1:1) ) > 0 ) THEN - - OutListTmp = OutListTmp(2:) - ELSE IF ( INDEX( 'mM', OutListTmp(1:1) ) > 0 ) THEN ! We'll assume this is a variable name for now, (if not, we will check later if OutListTmp(2:) is also a variable name) - CheckOutListAgain = .TRUE. - - END IF - - CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case - - - Indx = IndexCharAry( OutListTmp(1:9), ValidParamAry ) - - IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again - ! ex, 'MTipDxc1' causes the sign of TipDxc1 to be switched. - OutListTmp = OutListTmp(2:) - - Indx = IndexCharAry( OutListTmp(1:9), ValidParamAry ) - END IF - - IF ( Indx > 0 ) THEN + Indx = FindValidChannelIndx(UserOutputs(I), ValidParamAry) + + IF ( Indx > 0 ) THEN newFoundMask(I) = .TRUE. foundMask(I) = .TRUE. GetMorisonChannels = GetMorisonChannels + 1 diff --git a/modules/hydrodyn/src/WAMIT2.f90 b/modules/hydrodyn/src/WAMIT2.f90 index fad0873cea..61fd2a3880 100644 --- a/modules/hydrodyn/src/WAMIT2.f90 +++ b/modules/hydrodyn/src/WAMIT2.f90 @@ -816,14 +816,14 @@ SUBROUTINE MnDrift_InitCalc( InitInp, p, MnDriftData, MnDriftForce, ErrMsg, ErrS ! Local Variables CHARACTER(2048) :: ErrMsgTmp !< Temporary error message for calls INTEGER(IntKi) :: ErrStatTmp !< Temporary error status for calls - REAL(SiKi) :: TmpReal1 !< Temporary real - REAL(SiKi) :: TmpReal2 !< Temporary real +! REAL(SiKi) :: TmpReal1 !< Temporary real +! REAL(SiKi) :: TmpReal2 !< Temporary real LOGICAL :: TmpFlag !< Temporary logical flag INTEGER(IntKi) :: ThisDim !< Generic counter for dimension INTEGER(IntKi) :: IBody !< Index to which body we are on INTEGER(IntKi) :: Idx !< Index to the full set of 6*NBody INTEGER(IntKi) :: J !< Generic counter - INTEGER(IntKi) :: K !< Generic counter +! INTEGER(IntKi) :: K !< Generic counter CHARACTER(*), PARAMETER :: RoutineName = 'MnDrift_InitCalc' @@ -1337,13 +1337,13 @@ SUBROUTINE NewmanApp_InitCalc( InitInp, p, NewmanAppData, NewmanAppForce, ErrMsg CHARACTER(2048) :: ErrMsgTmp !< Temporary error message for calls INTEGER(IntKi) :: ErrStatTmp !< Temporary error status for calls REAL(SiKi) :: TmpReal1 !< Temporary real - REAL(SiKi) :: TmpReal2 !< Temporary real +! REAL(SiKi) :: TmpReal2 !< Temporary real LOGICAL :: TmpFlag !< Temporary logical flag INTEGER(IntKi) :: ThisDim !< Generic counter for dimension INTEGER(IntKi) :: IBody !< Index to which body we are on INTEGER(IntKi) :: Idx !< Index to the full set of 6*NBody INTEGER(IntKi) :: J !< Generic counter - INTEGER(IntKi) :: K !< Generic counter +! INTEGER(IntKi) :: K !< Generic counter TYPE(FFT_DataType) :: FFT_Data !< Temporary array for the FFT module we're using CHARACTER(*), PARAMETER :: RoutineName = 'NewmanApp_InitCalc' @@ -3091,7 +3091,7 @@ SUBROUTINE CheckInitInput( InitInp, Interval, InitOut, p, MnDriftData, NewmanApp ! Temporary Error Variables INTEGER(IntKi) :: ErrStatTmp !< Temporary variable for the local error status - CHARACTER(2048) :: ErrMsgTmp !< Temporary error message variable +! CHARACTER(2048) :: ErrMsgTmp !< Temporary error message variable CHARACTER(*), PARAMETER :: RoutineName = 'CheckInitInput' !> ## Subroutine contents @@ -5266,7 +5266,7 @@ SUBROUTINE UniqueRealValues( DataArrayIn, DataArrayOut, NumUnique, ErrStat, ErrM CHARACTER(*), INTENT( OUT) :: ErrMsg !< Message about the error ! Local variables - REAL(SiKi) :: TmpReal !< Temporary real value +! REAL(SiKi) :: TmpReal !< Temporary real value INTEGER(IntKi) :: I !< Generic counter INTEGER(IntKi) :: J !< Generic counter REAL(SiKi), ALLOCATABLE :: TmpRealArray(:) !< Temporary real array @@ -5406,7 +5406,7 @@ SUBROUTINE GetFileLength(UnitDataFile, Filename, NumDataColumns, NumDataLines, N CHARACTER(1024) :: StrRead !< String containing the first word read in REAL(SiKi) :: RealRead !< Returns value of the number (if there was one), or NaN (as set by NWTC_Num) if there wasn't CHARACTER(1024) :: VarName !< Name of the variable we are trying to read from the file - CHARACTER(24) :: Words(20) !< Array of words we extract from a line. We shouldn't have more than 20. + CHARACTER(NWTC_SizeOfNumWord) :: Words(20) !< Array of words we extract from a line. We shouldn't have more than 20. INTEGER(IntKi) :: i,j,k !< simple integer counters INTEGER(IntKi) :: LineNumber !< the line I am on LOGICAL :: LineHasText !< Flag indicating if the line I just read has text. If so, it is a header line. diff --git a/modules/inflowwind/src/InflowWind_Subs.f90 b/modules/inflowwind/src/InflowWind_Subs.f90 index 2499deb117..42f83292f1 100644 --- a/modules/inflowwind/src/InflowWind_Subs.f90 +++ b/modules/inflowwind/src/InflowWind_Subs.f90 @@ -48,11 +48,6 @@ MODULE InflowWind_Subs ! This code was generated by Write_ChckOutLst.m at 26-Oct-2020 15:42:27. - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - - ! Indices for computing output channels: ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" @@ -449,8 +444,7 @@ SUBROUTINE InflowWind_ParseInputFileInfo( InputFileData, InFileInfo, PriPath, In !---------------------- OUTLIST -------------------------------------------- CurLine = CurLine + 1 ! Skip comment line - CALL ReadOutputListFromFileInfo( InFileInfo, CurLine, InputFileData%OutList, & - InputFileData%NumOuts, "OutList", "List of user-requested output channels", TmpErrStat, TmpErrMsg, UnEc ) + CALL ReadOutputListFromFileInfo( InFileInfo, CurLine, InputFileData%OutList, InputFileData%NumOuts, TmpErrStat, TmpErrMsg, UnEc ) if (Failed()) return !------------------------------------------------------------------------------------------------- @@ -1016,7 +1010,7 @@ SUBROUTINE SetOutParam(OutList, p, ErrStat, ErrMsg ) INTEGER :: ErrStat2 ! temporary (local) error status INTEGER :: I ! Generic loop-counting index - INTEGER :: J ! Generic loop-counting index +! INTEGER :: J ! Generic loop-counting index INTEGER :: INDX ! Index for valid arrays LOGICAL :: CheckOutListAgain ! Flag used to determine if output parameter starting with "M" is valid (or the negative of another parameter) diff --git a/modules/nwtc-library/src/NWTC_Base.f90 b/modules/nwtc-library/src/NWTC_Base.f90 index 6690f0842c..acfa1ac357 100644 --- a/modules/nwtc-library/src/NWTC_Base.f90 +++ b/modules/nwtc-library/src/NWTC_Base.f90 @@ -36,6 +36,8 @@ MODULE NWTC_Base INTEGER, PARAMETER :: ErrMsgLen = 1024 !< The maximum number of characters in an error message in the FAST framework INTEGER(IntKi), PARAMETER :: ChanLen = 20 !< The maximum allowable length of channel names (i.e., width of output columns) in the FAST framework + INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 !< The maximum allowable length of channel names without optional "-" or "M" at the beginning to indicate the negative of the channel + INTEGER(IntKi), PARAMETER :: MinChanLen = 10 !< The min allowable length of channel names (i.e., width of output columns), used because some modules (like Bladed DLL outputs) have excessively long names INTEGER(IntKi), PARAMETER :: LinChanLen = 200 !< The allowable length of row/column names in linearization files INTEGER(IntKi), PARAMETER :: MaxFileInfoLineLen = 1024 !< The allowable length of an input line stored in FileInfoType%Lines diff --git a/modules/nwtc-library/src/NWTC_IO.f90 b/modules/nwtc-library/src/NWTC_IO.f90 index 7be142eecb..42e26bb98d 100644 --- a/modules/nwtc-library/src/NWTC_IO.f90 +++ b/modules/nwtc-library/src/NWTC_IO.f90 @@ -6243,7 +6243,7 @@ END SUBROUTINE ReadOutputList !! These values represent the names of output channels, and they are specified in the format !! required for OutList(:) in FAST input files. !! The end of this list is specified with the line beginning with the 3 characters "END". - SUBROUTINE ReadOutputListFromFileInfo ( FileInfo, LineNum, CharAry, AryLenRead, AryName, AryDescr, ErrStat, ErrMsg, UnEc ) + SUBROUTINE ReadOutputListFromFileInfo ( FileInfo, LineNum, CharAry, AryLenRead, ErrStat, ErrMsg, UnEc ) ! Argument declarations: @@ -6256,9 +6256,6 @@ SUBROUTINE ReadOutputListFromFileInfo ( FileInfo, LineNum, CharAry, AryLenRead, CHARACTER(*), INTENT(OUT) :: CharAry(:) !< Character array being read (calling routine dimensions it to max allowable size). - CHARACTER(*), INTENT(IN) :: AryDescr !< Text string describing the variable. - CHARACTER(*), INTENT(IN) :: AryName !< Text string containing the variable name. - ! Local declarations: diff --git a/modules/nwtc-library/src/NWTC_Num.f90 b/modules/nwtc-library/src/NWTC_Num.f90 index 8154109871..f4cbe1324c 100644 --- a/modules/nwtc-library/src/NWTC_Num.f90 +++ b/modules/nwtc-library/src/NWTC_Num.f90 @@ -2406,6 +2406,51 @@ SUBROUTINE Eye3D( A, ErrStat, ErrMsg ) END DO END SUBROUTINE Eye3D +!==================================================================================================== +INTEGER FUNCTION FindValidChannelIndx(OutListVal, ValidParamAry, SignM_out) RESULT( Indx ) + + CHARACTER(*), INTENT(IN) :: OutListVal + CHARACTER(OutStrLenM1), INTENT(IN) :: ValidParamAry(:) + INTEGER, OPTIONAL, INTENT(OUT) :: SignM_out + + CHARACTER(ChanLen) :: OutListTmp ! A string to temporarily hold OutList(I) + INTEGER :: SignM + LOGICAL :: CheckOutListAgain ! Flag used to determine if output parameter starting with "M" is valid (or the negative of another parameter) + + OutListTmp = OutListVal + + ! Reverse the sign (+/-) of the output channel if the user prefixed the + ! channel name with a "-", "_", "m", or "M" character indicating "minus". + CheckOutListAgain = .FALSE. + + IF ( INDEX( "-_", OutListTmp(1:1) ) > 0 ) THEN + SignM = -1 ! ex, "-TipDxc1" causes the sign of TipDxc1 to be switched. + OutListTmp = OutListTmp(2:) + ELSE IF ( INDEX( "mM", OutListTmp(1:1) ) > 0 ) THEN ! We'll assume this is a variable name for now, (if not, we will check later if OutListTmp(2:) is also a variable name) + CheckOutListAgain = .TRUE. + SignM = 1 + ELSE + SignM = 1 + END IF + + CALL Conv2UC( OutListTmp ) ! Convert OutListTmp to upper case + + + Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) + + + ! If it started with an "M" (CheckOutListAgain) we didn't find the value in our list (Indx < 1) + + IF ( CheckOutListAgain .AND. Indx < 1 ) THEN ! Let's assume that "M" really meant "minus" and then test again + SignM = -1 ! ex, "MTipDxc1" causes the sign of TipDxc1 to be switched. + OutListTmp = OutListTmp(2:) + + Indx = IndexCharAry( OutListTmp(1:OutStrLenM1), ValidParamAry ) + END IF + + IF (PRESENT(SignM_out)) SignM_out = SignM + +END FUNCTION FindValidChannelIndx !======================================================================= !> This routine uses the Gauss-Jordan elimination method for the !! solution of a given set of simultaneous linear equations. diff --git a/modules/orcaflex-interface/src/OrcaFlexInterface.f90 b/modules/orcaflex-interface/src/OrcaFlexInterface.f90 index 9dcbcbaf90..04c49d6d76 100644 --- a/modules/orcaflex-interface/src/OrcaFlexInterface.f90 +++ b/modules/orcaflex-interface/src/OrcaFlexInterface.f90 @@ -40,11 +40,6 @@ MODULE OrcaFlexInterface_Parameters ! This code was generated by Write_ChckOutLst.m at 01-Sep-2015 14:29:18. - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - - ! Indices for computing output channels: ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" diff --git a/modules/servodyn/src/ServoDyn_IO.f90 b/modules/servodyn/src/ServoDyn_IO.f90 index 805b2be99e..cb900579ec 100644 --- a/modules/servodyn/src/ServoDyn_IO.f90 +++ b/modules/servodyn/src/ServoDyn_IO.f90 @@ -39,11 +39,6 @@ MODULE ServoDyn_IO ! This code was generated by Write_ChckOutLst.m at 04-Feb-2021 08:42:27. - ! Parameters related to output length (number of characters allowed in the output data headers): - - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen - 1 - - ! Indices for computing output channels: ! NOTES: ! (1) These parameters are in the order stored in "OutListParameters.xlsx" @@ -1461,8 +1456,7 @@ subroutine ParseInputFileInfo( PriPath, InputFile, OutFileRoot, FileInfo_In, Inp !---------------------- OUTLIST -------------------------------------------- if ( InputFileData%Echo ) WRITE(UnEcho, '(A)') FileInfo_In%Lines(CurLine) ! Write section break to echo CurLine = CurLine + 1 - call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%OutList, & - InputFileData%NumOuts, 'OutList', "List of user-requested output channels", ErrStat2, ErrMsg2, UnEcho ) + call ReadOutputListFromFileInfo( FileInfo_In, CurLine, InputFileData%OutList, InputFileData%NumOuts, ErrStat2, ErrMsg2, UnEcho ) if (Failed()) return; diff --git a/vs-build/RunRegistry.bat b/vs-build/RunRegistry.bat index faf06756d7..d7e2e556c7 100644 --- a/vs-build/RunRegistry.bat +++ b/vs-build/RunRegistry.bat @@ -196,7 +196,6 @@ GOTO checkError :WAMIT :WAMIT2 :Morison - SET CURR_LOC=%HD_Loc% SET Output_Loc=%CURR_LOC% %REGISTRY% "%CURR_LOC%\%ModuleName%.txt" -I "%NWTC_Lib_Loc%" -I "%CURR_LOC%" -O "%Output_Loc%" From 9162ee89e6a8e54643c22077454cc73e29c24e90 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Thu, 15 Sep 2022 13:17:21 -0600 Subject: [PATCH 2/4] NWTC_IO: update GetWords to return the number actually read --- modules/hydrodyn/src/WAMIT2.f90 | 8 +-- modules/nwtc-library/src/NWTC_IO.f90 | 79 +++++++++++++++------------- 2 files changed, 42 insertions(+), 45 deletions(-) diff --git a/modules/hydrodyn/src/WAMIT2.f90 b/modules/hydrodyn/src/WAMIT2.f90 index 61fd2a3880..080f7eb5a3 100644 --- a/modules/hydrodyn/src/WAMIT2.f90 +++ b/modules/hydrodyn/src/WAMIT2.f90 @@ -5462,13 +5462,7 @@ SUBROUTINE GetFileLength(UnitDataFile, Filename, NumDataColumns, NumDataLines, N !> Read all the words on the line into the array called 'Words'. Only the first words will be encountered !! will be stored. The others are empty (i.e. only three words on the line, so the remaining 17 are empty). - CALL GetWords( TextLine, Words, 20 ) - - !> Cycle through and count how many are not empty. Once an empty value is encountered, all the rest should - !! be empty if GetWords worked correctly. The index of the last non-empty value is stored. - DO i=1,20 - IF (TRIM(Words(i)) .ne. '') NumWords=i - ENDDO + CALL GetWords( TextLine, Words, size(Words), NumWords ) !> Now cycle through the first 'NumWords' of non-empty values stored in 'Words'. Words should contain diff --git a/modules/nwtc-library/src/NWTC_IO.f90 b/modules/nwtc-library/src/NWTC_IO.f90 index 42e26bb98d..06d681b54f 100644 --- a/modules/nwtc-library/src/NWTC_IO.f90 +++ b/modules/nwtc-library/src/NWTC_IO.f90 @@ -2440,21 +2440,21 @@ END SUBROUTINE GetTokens !! It uses spaces, tabs, commas, semicolons, single quotes, and double quotes ("whitespace") !! as word separators. If there aren't NumWords in the line, the remaining array elements will remain empty. !! Use CountWords (nwtc_io::countwords) to count the number of words in a line. - SUBROUTINE GetWords ( Line, Words, NumWords ) + SUBROUTINE GetWords ( Line, Words, NumWords, NumFound ) ! Argument declarations. - INTEGER, INTENT(IN) :: NumWords !< The number of words to look for. - - CHARACTER(*), INTENT(IN) :: Line !< The string to search. - CHARACTER(*), INTENT(OUT) :: Words(NumWords) !< The array of found words. + INTEGER, INTENT(IN) :: NumWords !< The maximum number of words to look for (and size of Words) + CHARACTER(*), INTENT(IN) :: Line !< The string to search. + CHARACTER(*), INTENT(OUT) :: Words(NumWords) !< The array of found words. + INTEGER, OPTIONAL, INTENT(OUT) :: NumFound !< The number of words found ! Local declarations. - INTEGER :: Ch ! Character position within the string. - INTEGER :: IW ! Word index. - INTEGER :: NextWhite ! The location of the next whitespace in the string. + INTEGER :: Ch ! Character position within the string. + INTEGER :: IW ! Word index. + INTEGER :: NextWhite ! The location of the next whitespace in the string. @@ -2464,48 +2464,51 @@ SUBROUTINE GetWords ( Line, Words, NumWords ) Words(IW) = ' ' END DO ! IW + IW = 0 + ! Let's make sure we have text on this line. - IF ( LEN_TRIM( Line ) == 0 ) RETURN + IF ( LEN_TRIM( Line ) > 0 ) THEN + ! Parse words separated by any combination of spaces, tabs, commas, + ! semicolons, single quotes, and double quotes ("whitespace"). - ! Parse words separated by any combination of spaces, tabs, commas, - ! semicolons, single quotes, and double quotes ("whitespace"). + Ch = 0 - Ch = 0 - IW = 0 - - DO - - NextWhite = SCAN( Line(Ch+1:) , ' ,;''"'//Tab ) + DO - IF ( NextWhite > 1 ) THEN + NextWhite = SCAN( Line(Ch+1:) , ' ,;''"'//Tab ) - IW = IW + 1 - Words(IW) = Line(Ch+1:Ch+NextWhite-1) - if (NextWhite > len(words(iw)) ) then - call ProgWarn('Error reading field from file. There are too many characters in the input file to store in the field. Value may be truncated.') - end if + IF ( NextWhite > 1 ) THEN - IF ( IW == NumWords ) EXIT + IW = IW + 1 + Words(IW) = Line(Ch+1:Ch+NextWhite-1) + if (NextWhite > len(words(iw)) ) then + call ProgWarn('Error reading field from file. There are too many characters in the input file to store in the field. Value may be truncated.') + end if - Ch = Ch + NextWhite + IF ( IW == NumWords ) EXIT - ELSE IF ( NextWhite == 1 ) THEN + Ch = Ch + NextWhite - Ch = Ch + 1 + ELSE IF ( NextWhite == 1 ) THEN - CYCLE + Ch = Ch + 1 - ELSE + CYCLE - EXIT + ELSE - END IF + EXIT - END DO + END IF + END DO + + END IF + + IF (PRESENT(NumFound)) NumFound = IW RETURN END SUBROUTINE GetWords @@ -3178,7 +3181,6 @@ SUBROUTINE ParseChAry ( FileInfo, LineNum, AryName, Ary, AryLen, ErrStat, ErrMsg ! Local declarations. INTEGER(IntKi) :: ErrStatLcl ! Error status local to this routine. - INTEGER(IntKi) :: i ! Error status local to this routine. CHARACTER(*), PARAMETER :: RoutineName = 'ParseChAry' @@ -3279,7 +3281,7 @@ SUBROUTINE ParseChVar ( FileInfo, LineNum, ExpVarName, Var, ErrStat, ErrMsg, UnE INTEGER(IntKi) :: ErrStatLcl ! Error status local to this routine. INTEGER(IntKi) :: NameIndx ! The index into the Words array that points to the variable name. - CHARACTER(200) :: Words (2) ! The two "words" parsed from the line. + CHARACTER(NWTC_SizeOfNumWord) :: Words (2) ! The two "words" parsed from the line. CHARACTER(ErrMsgLen) :: ErrMsg2 CHARACTER(*), PARAMETER :: RoutineName = 'ParseChVar' @@ -3677,6 +3679,7 @@ SUBROUTINE ParseQuVar ( FileInfo, LineNum, ExpVarName, Var, ErrStat, ErrMsg, UnE ENDIF CALL CheckRealVar( Var, ExpVarName, ErrStatLcl, ErrMsg2) CALL SetErrStat(ErrStatLcl, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + if (ErrStat>= AbortErrLev) return IF ( PRESENT(UnEc) ) THEN IF ( UnEc > 0 ) WRITE (UnEc,'(1X,A15," = ",A20)') Words @@ -4143,10 +4146,8 @@ SUBROUTINE ParseLoVar ( FileInfo, LineNum, ExpVarName, Var, ErrStat, ErrMsg, UnE CALL ChkParseData ( Words, ExpVarName, FileInfo%FileList(FileInfo%FileIndx(LineNum)) & , FileInfo%FileLine(LineNum), NameIndx, ErrStatLcl, ErrMsg2 ) - IF ( ErrStatLcl /= 0 ) THEN CALL SetErrStat ( ErrStatLcl, ErrMsg2, ErrStat, ErrMsg, RoutineName ) - RETURN - ENDIF + IF (ErrStat >= AbortErrLev) RETURN READ (Words(3-NameIndx),*,IOSTAT=ErrStatLcl) Var @@ -4332,7 +4333,9 @@ SUBROUTINE ParseSiVar ( FileInfo, LineNum, ExpVarName, Var, ErrStat, ErrMsg, UnE RETURN ENDIF - CALL CheckRealVar( Var, ExpVarName, ErrStat, ErrMsg) + CALL CheckRealVar( Var, ExpVarName, ErrStatLcl, ErrMsg2 ) + CALL SetErrStat( ErrStatLcl, ErrMsg2, ErrStat, ErrMsg, RoutineName ) + IF ( ErrStat >= AbortErrLev ) RETURN IF ( PRESENT(UnEc) ) THEN IF ( UnEc > 0 ) WRITE (UnEc,'(1X,A15," = ",A20)') Words !bjj: not sure this is the best way to echo the number being read (in case of truncation, etc) From 23ce9743cb7fe51690ecadd6e427978acc1a670f Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Thu, 15 Sep 2022 13:18:25 -0600 Subject: [PATCH 3/4] MAP: fix compiler warning about parameter being different than declaration warning C4028: formal parameter 7 different from declaration --- modules/map/src/lineroutines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/map/src/lineroutines.h b/modules/map/src/lineroutines.h index d34e9ae4c8..26b28835cd 100644 --- a/modules/map/src/lineroutines.h +++ b/modules/map/src/lineroutines.h @@ -96,7 +96,7 @@ MAP_ERROR_CODE increment_the_dof_by_delta(MAP_InputType_t* u_type, const Vessel* MAP_ERROR_CODE increment_psi_dof_by_delta(MAP_InputType_t* u_type, const Vessel* vessel, const double delta, const int size); -MAP_ERROR_CODE f_op_sequence(MAP_OtherStateType_t* other_type, MAP_ParameterType_t* p_type, MAP_InputType_t* u_type, MAP_OutputType_t* y_type, MAP_ConstraintStateType_t* z_type, Fd* force, int size, char* map_msg, MAP_ERROR_CODE* ierr); +MAP_ERROR_CODE f_op_sequence(MAP_OtherStateType_t* other_type, MAP_ParameterType_t* p_type, MAP_InputType_t* u_type, MAP_OutputType_t* y_type, MAP_ConstraintStateType_t* z_type, Fd* force, const int size, char* map_msg, MAP_ERROR_CODE* ierr); MAP_ERROR_CODE fd_x_sequence(MAP_OtherStateType_t* other_type, MAP_ParameterType_t* p_type, MAP_InputType_t* u_type, MAP_OutputType_t* y_type, MAP_ConstraintStateType_t* z_type, Fd* force, const double epsilon, const int size, const double* original_pos, char* map_msg, MAP_ERROR_CODE* ierr); MAP_ERROR_CODE fd_y_sequence(MAP_OtherStateType_t* other_type, MAP_ParameterType_t* p_type, MAP_InputType_t* u_type, MAP_OutputType_t* y_type, MAP_ConstraintStateType_t* z_type, Fd* force, const double epsilon, const int size, const double* original_pos, char* map_msg, MAP_ERROR_CODE* ierr); MAP_ERROR_CODE fd_z_sequence(MAP_OtherStateType_t* other_type, MAP_ParameterType_t* p_type, MAP_InputType_t* u_type, MAP_OutputType_t* y_type, MAP_ConstraintStateType_t* z_type, Fd* force, const double epsilon, const int size, const double* original_pos, char* map_msg, MAP_ERROR_CODE* ierr); From 49ca7ad914e9ee0f7996a85c9038f5f718c45cc5 Mon Sep 17 00:00:00 2001 From: Bonnie Jonkman Date: Thu, 15 Sep 2022 15:09:35 -0600 Subject: [PATCH 4/4] Remove redundant parameter from Waves This will cause conflict with SeaState branch, but can be ignored there. --- modules/hydrodyn/src/Waves2_Output.f90 | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/hydrodyn/src/Waves2_Output.f90 b/modules/hydrodyn/src/Waves2_Output.f90 index 817ebc7272..0faee486ee 100644 --- a/modules/hydrodyn/src/Waves2_Output.f90 +++ b/modules/hydrodyn/src/Waves2_Output.f90 @@ -34,7 +34,6 @@ MODULE Waves2_Output ! (1) These parameters are in the order stored in "OutListParameters.xlsx" ! (2) Array AllOuts() must be dimensioned to the value of the largest output parameter - INTEGER(IntKi), PARAMETER :: OutStrLenM1 = ChanLen ! Waves2 Body Forces: