From 60e7c6f5644aeb50c709160b1efcf5326c99b971 Mon Sep 17 00:00:00 2001 From: nathanmtom Date: Tue, 22 Aug 2023 10:02:41 -0600 Subject: [PATCH] Update readNEMOH.m for compatibility with NEMOH v3.0 (#1105) * Update readNEMOH.m for compatibility with NEMOH v3.0 * Removing line 374 This capability is within Dev, but not currently pulled over to Master. A separate PR was submitted to Dev for this fix. --- source/functions/BEMIO/readNEMOH.m | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/source/functions/BEMIO/readNEMOH.m b/source/functions/BEMIO/readNEMOH.m index 119d3bc07..fc1095204 100644 --- a/source/functions/BEMIO/readNEMOH.m +++ b/source/functions/BEMIO/readNEMOH.m @@ -90,10 +90,24 @@ hydro(F).body{b} = tmp{length(tmp)-1}; % Body names end if isempty(strfind(raw{n},'Number of wave frequencies'))==0 - tmp = textscan(raw{n},'%f %f %f'); - hydro(F).Nf = tmp{1}; % Number of wave frequencies - hydro(F).w = linspace(tmp{2},tmp{3},tmp{1}); % Wave frequencies - hydro(F).T = 2*pi./hydro(F).w; % Wave periods + tmp = textscan(raw{n},'%f %f %f %f'); + if isempty(tmp{end}) + hydro(F).Nf = tmp{1}; % Number of wave frequencies + hydro(F).w = linspace(tmp{2},tmp{3},tmp{1}); % Wave frequencies + hydro(F).T = 2*pi./hydro(F).w; % Wave periods + else + hydro(F).Nf = tmp{2}; % Number of wave frequencies + if tmp{1} == 1 + hydro(F).w = linspace(tmp{3},tmp{4},tmp{2}); % Wave frequencies + hydro(F).T = 2*pi./hydro(F).w; % Wave periods + elseif tmp{1} == 2 + hydro(F).w = 2*pi*linspace(tmp{3},tmp{4},tmp{2}); % Wave frequencies + hydro(F).T = 2*pi./hydro(F).w; % Wave periods + else + hydro(F).T = linspace(tmp{3},tmp{4},tmp{2}); % Wave periods + hydro(F).w = 2*pi./hydro(F).T; % Wave frequencies + end + end end if isempty(strfind(raw{n},'Number of wave directions'))==0 tmp = textscan(raw{n},'%f %f %f'); @@ -170,7 +184,7 @@ N = length(raw); i = 0; for n = 1:N - if isempty(strfind(raw{n},'Diffraction force'))==0 + if isempty(strfind(raw{n},'Excitation force'))==0 || isempty(strfind(raw{n},'Diffraction force'))==0 i = i+1; for k = 1:hydro(F).Nf tmp = textscan(raw{n+k},'%f');