Skip to content

Commit

Permalink
Add checks for optional input files
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhar-abbas committed Jul 21, 2020
1 parent 8f0cdb7 commit 9424afb
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions Matlab_Toolbox/ReadWrite_FAST.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,30 @@
%% Read
FP = FAST2Matlab(fullfile(fast.FAST_directory,fast.FAST_InputFile),2); %FP are Fast Parameters, specify 2 lines of header (FAST 8)

% Get filenames for optional files
HydroFile = FP.Val{contains(FP.Label,'HydroFile')};
SubFile = FP.Val{contains(FP.Label,'SubFile')};
MoorFile = FP.Val{contains(FP.Label,'MooringFile')};
IceFile = FP.Val{contains(FP.Label,'IceFile')};

% Read input files
[EDP, EDFile] = GetFASTPar_Subfile(FP, 'EDFile', fast.FAST_directory, fast.FAST_directory);
[IWP, IWFile] = GetFASTPar_Subfile(FP, 'InflowFile', fast.FAST_directory, fast.FAST_directory);
[ADP, ADFile] = GetFASTPar_Subfile(FP, 'AeroFile', fast.FAST_directory, fast.FAST_directory);
[SvDP, SvDFile] = GetFASTPar_Subfile(FP, 'ServoFile', fast.FAST_directory, fast.FAST_directory);
[HDP, HDFile] = GetFASTPar_Subfile(FP, 'HydroFile', fast.FAST_directory, fast.FAST_directory,true);
% [SbDP, SbDFile] = GetFASTPar_Subfile(FP, 'SubFile', fast.FAST_directory, fast.FAST_directory);
% [MDP, MDFile] = GetFASTPar_Subfile(FP, 'MooringFile', fast.FAST_directory, fast.FAST_directory);
% [IDP, IDFile] = GetFASTPar_Subfile(FP, 'IceFile', fast.FAST_directory, fast.FAST_directory);

if contains(HydroFile,'.') % File will have '.' if it is not 'unused' or empty
[HDP, HDFile] = GetFASTPar_Subfile(FP, 'HydroFile', fast.FAST_directory, fast.FAST_directory,true);
end
if contains(SubFile,'.')
[SbDP, SbDFile] = GetFASTPar_Subfile(FP, 'SubFile', fast.FAST_directory, fast.FAST_directory);
end
if contains(MoorFile,'.')
[MDP, MDFile] = GetFASTPar_Subfile(FP, 'MooringFile', fast.FAST_directory, fast.FAST_directory);
end
if contains(IceFile,'.')
[IDP, IDFile] = GetFASTPar_Subfile(FP, 'IceFile', fast.FAST_directory, fast.FAST_directory);
end

% Control Parameters
[~,SD_dllFile] = GetFASTPar_Subfile(SvDP,'DLL_InFile',fast.FAST_directory, fast.FAST_directory);
Expand All @@ -38,8 +54,11 @@
P.EDP = EDP;
P.IWP = IWP;
P.ADP = ADP;
P.HDP = HDP;
P.SvDP = SvDP;
P.SD_dllP = SD_dllP;
if exist('HDP')
P.HDP = HDP;
end



0 comments on commit 9424afb

Please sign in to comment.