@@ -2132,87 +2132,95 @@ moordyn::MoorDyn::readOptionsLine(vector<string>& in_txt, int i)
21322132
21332133 // DT is old way, should phase out
21342134 if ((name == " dtM" ) || (name == " DT" ))
2135- dtM0 = atof (entries[ 0 ] .c_str ());
2135+ dtM0 = atof (value .c_str ());
21362136 else if ((name == " CFL" ) || (name == " cfl" ))
2137- cfl = atof (entries[ 0 ] .c_str ());
2137+ cfl = atof (value .c_str ());
21382138 else if (name == " writeLog" ) {
21392139 // This was actually already did, so we do not need to do that again
21402140 // But we really want to have this if to avoid showing a warning for
21412141 // Unrecognized option writeLog
2142- // env->writeLog = atoi(entries[0] .c_str());
2142+ // env->writeLog = atoi(value .c_str());
21432143 } else if (name == " tScheme" ) {
21442144 moordyn::error_id err = MOORDYN_SUCCESS;
21452145 string err_msg;
21462146 try {
2147- _t_integrator = create_time_scheme (entries[ 0 ] , _log, waves);
2147+ _t_integrator = create_time_scheme (value , _log, waves);
21482148 }
21492149 MOORDYN_CATCHER (err, err_msg);
21502150 if (err != MOORDYN_SUCCESS) {
21512151 LOGWRN << " Defaulting to RK2 time integration" ;
21522152 LOGERR << err_msg << endl;
21532153 }
21542154 } else if ((name == " g" ) || (name == " gravity" ))
2155- env->g = atof (entries[ 0 ] .c_str ());
2155+ env->g = atof (value .c_str ());
21562156 else if ((name == " Rho" ) || (name == " rho" ) || (name == " WtrDnsty" ))
2157- env->rho_w = atof (entries[ 0 ] .c_str ());
2157+ env->rho_w = atof (value .c_str ());
21582158 else if (name == " WtrDpth" )
2159- env->WtrDpth = atof (entries[ 0 ] .c_str ());
2159+ env->WtrDpth = atof (value .c_str ());
21602160 else if ((name == " kBot" ) || (name == " kbot" ) || (name == " kb" ))
2161- env->kb = atof (entries[ 0 ] .c_str ());
2161+ env->kb = atof (value .c_str ());
21622162 else if ((name == " cBot" ) || (name == " cbot" ) || (name == " cb" ))
2163- env->cb = atof (entries[ 0 ] .c_str ());
2163+ env->cb = atof (value .c_str ());
21642164 else if ((name == " dtIC" ) || (name == " ICdt" ))
2165- ICdt = atof (entries[ 0 ] .c_str ());
2165+ ICdt = atof (value .c_str ());
21662166 else if ((name == " TmaxIC" ) || (name == " ICTmax" ))
2167- ICTmax = atof (entries[ 0 ] .c_str ());
2167+ ICTmax = atof (value .c_str ());
21682168 else if ((name == " CdScaleIC" ) || (name == " ICDfac" ))
2169- ICDfac = atof (entries[ 0 ] .c_str ());
2169+ ICDfac = atof (value .c_str ());
21702170 else if ((name == " threshIC" ) || (name == " ICthresh" ))
2171- ICthresh = atof (entries[ 0 ] .c_str ());
2171+ ICthresh = atof (value .c_str ());
21722172 else if ((name == " genDynamicIC" ) || (name == " ICgenDynamic" ))
2173- ICgenDynamic = bool (atof (entries[ 0 ] .c_str ()));
2173+ ICgenDynamic = bool (atof (value .c_str ()));
21742174 else if ((name == " fileIC" ) || (name == " ICfile" ))
2175- ICfile = entries[ 0 ] ;
2175+ ICfile = value ;
21762176 else if (name == " WaveKin" ) {
2177- WaveKinTemp = (waves::waves_settings)stoi (entries[ 0 ] );
2177+ WaveKinTemp = (waves::waves_settings)stoi (value );
21782178 if ((WaveKinTemp < waves::WAVES_NONE) ||
21792179 (WaveKinTemp > waves::WAVES_SUM_COMPONENTS_NODE))
21802180 LOGWRN << " Unknown WaveKin option value " << WaveKinTemp << endl;
21812181 } else if (name == " dtWave" )
2182- env->waterKinOptions .dtWave = stof (entries[ 0 ] );
2182+ env->waterKinOptions .dtWave = stof (value );
21832183 else if (name == " Currents" ) {
2184- auto current_mode = (waves::currents_settings)stoi (entries[ 0 ] );
2184+ auto current_mode = (waves::currents_settings)stoi (value );
21852185 env->waterKinOptions .currentMode = current_mode;
21862186 if ((current_mode < waves::CURRENTS_NONE) ||
21872187 (current_mode > waves::CURRENTS_4D))
21882188 LOGWRN << " Unknown Currents option value " << current_mode << endl;
21892189 } else if (name == " UnifyCurrentGrid" ) {
2190- if (entries[ 0 ] == " 1" ) {
2190+ if (value == " 1" ) {
21912191 env->waterKinOptions .unifyCurrentGrid = true ;
2192- } else if (entries[ 0 ] == " 0" ) {
2192+ } else if (value == " 0" ) {
21932193 env->waterKinOptions .unifyCurrentGrid = false ;
21942194 } else {
21952195 LOGWRN << " Unrecognized UnifyCurrentGrid value "
2196- << std::quoted (entries[ 1 ] ) << " . Should be 0 or 1" << endl;
2196+ << std::quoted (value ) << " . Should be 0 or 1" << endl;
21972197 }
21982198 } else if (name == " WriteUnits" )
2199- env->WriteUnits = atoi (entries[ 0 ] .c_str ());
2199+ env->WriteUnits = atoi (value .c_str ());
22002200 else if (name == " FrictionCoefficient" )
2201- env->FrictionCoefficient = atof (entries[ 0 ] .c_str ());
2201+ env->FrictionCoefficient = atof (value .c_str ());
22022202 else if (name == " FricDamp" )
2203- env->FricDamp = atof (entries[ 0 ] .c_str ());
2203+ env->FricDamp = atof (value .c_str ());
22042204 else if (name == " StatDynFricScale" )
2205- env->StatDynFricScale = atof (entries[ 0 ] .c_str ());
2205+ env->StatDynFricScale = atof (value .c_str ());
22062206 // output writing period (0 for at every call)
22072207 else if (name == " dtOut" )
2208- dtOut = atof (entries[ 0 ] .c_str ());
2208+ dtOut = atof (value .c_str ());
22092209 else if (name == " SeafloorFile" ) {
22102210 env->SeafloorMode = seafloor_settings::SEAFLOOR_3D;
22112211 this ->seafloor = make_shared<moordyn::Seafloor>(_log);
2212- std::string filepath = entries[ 0 ] ;
2212+ std::string filepath = value ;
22132213 this ->seafloor ->setup (env, filepath);
2214- }
2215- else
2214+ } else if (name == " disableOutput" ){
2215+ if (value == " 1" ) {
2216+ disableOutput = true ;
2217+ } else if (value == " 0" ) {
2218+ disableOutput = false ;
2219+ } else {
2220+ LOGWRN << " Unrecognized disableOutput value "
2221+ << std::quoted (value) << " . Should be 0 or 1" << endl;
2222+ }
2223+ } else
22162224 LOGWRN << " Warning: Unrecognized option '" << name << " '" << endl;
22172225}
22182226
0 commit comments