Skip to content

Commit 326a9ea

Browse files
authored
Merge pull request #2792 from marchdf/fix-restart-name
Fix openfastcpp restart parsing of file name
2 parents a0a85e7 + 82103e2 commit 326a9ea

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

glue-codes/openfast-cpp/src/OpenFAST.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,15 @@ void fast::OpenFAST::findRestartFile(int iTurbLoc) {
9090
check_nc_error(ierr, "nc_get_vara_double - getting latest time");
9191
tStart = latest_time;
9292

93-
char tmpOutFileRoot[INTERFACE_STRING_LENGTH];
93+
char *tmpOutFileRoot;
94+
size_t len;
95+
ierr = nc_inq_attlen(ncid, NC_GLOBAL, "out_file_root", &len);
96+
check_nc_error(ierr, "nc_inq_attlen - getting out_file_root length");
97+
98+
tmpOutFileRoot = (char*) malloc(len + 1);
9499
ierr = nc_get_att_text(ncid, NC_GLOBAL, "out_file_root", tmpOutFileRoot);
100+
check_nc_error(ierr, "nc_get_att_text - getting out_file_root");
101+
tmpOutFileRoot[len] = '\0';
95102
turbineData[iTurbLoc].outFileRoot.assign(tmpOutFileRoot);
96103

97104
ierr = nc_get_att_double(ncid, NC_GLOBAL, "dt_fast", &dtFAST);

0 commit comments

Comments
 (0)