Skip to content

Commit

Permalink
Fix issue with duplicate indicator values
Browse files Browse the repository at this point in the history
  • Loading branch information
ckendrick committed Apr 25, 2024
1 parent 133faa1 commit 1f5aba8
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions examples/dmd/local_tw_csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,48 +211,6 @@ int main(int argc, char *argv[])
db = new CAROM::HDFDatabase();
}

// Load window RDIM/EF file if given
vector<string> window_str_list;
vector<double> window_list;
bool use_rdim_windows = false;
csv_db.getStringVector(string(list_dir) + "/" + string(window_file) + ".csv",
window_str_list, false);
if (window_str_list.size() > 0)
{
if (numWindows > 0)
{
CAROM_VERIFY(numWindows == window_str_list.size() - 1);
}

if (window_str_list[0] == "RDIM")
{
use_rdim_windows = true;
}

CAROM_VERIFY(window_str_list[0] == "RDIM" || window_str_list[0] == "EF");

for (int i = 1; i < window_str_list.size(); i++)
{
std::string tmp;
std::stringstream window_ss(window_str_list[i]);
getline(window_ss, tmp, ',');
getline(window_ss, tmp, ',');
window_list.push_back(stod(tmp));
}

numWindows = window_list.size();

if (myid == 0)
{
std::cout << "Read window file with " << window_list.size() << " windows:\n";
for (int i = 0; i < window_list.size(); i++)
{
std::cout << " Window " << i << ": " << (use_rdim_windows ? "RDIM = " :
"EF = ") << window_list[i] << "\n";
}
}
}

string variable = string(var_name);
int nelements = 0;

Expand Down Expand Up @@ -314,6 +272,48 @@ int main(int argc, char *argv[])
}
}

// Load window RDIM/EF file if given
vector<string> window_str_list;
vector<double> window_list;
bool use_rdim_windows = false;
csv_db.getStringVector(string(list_dir) + "/" + string(window_file) + ".csv",
window_str_list, false);
if (window_str_list.size() > 0)
{
if (numWindows > 0)
{
CAROM_VERIFY(numWindows == window_str_list.size() - 1);
}

if (window_str_list[0] == "RDIM")
{
use_rdim_windows = true;
}

CAROM_VERIFY(window_str_list[0] == "RDIM" || window_str_list[0] == "EF");

for (int i = 1; i < window_str_list.size(); i++)
{
std::string tmp;
std::stringstream window_ss(window_str_list[i]);
getline(window_ss, tmp, ',');
getline(window_ss, tmp, ',');
window_list.push_back(stod(tmp));
}

numWindows = window_list.size();

if (myid == 0)
{
std::cout << "Read window file with " << window_list.size() << " windows:\n";
for (int i = 0; i < window_list.size(); i++)
{
std::cout << " Window " << i << ": " << (use_rdim_windows ? "RDIM = " :
"EF = ") << window_list[i] << "\n";
}
}
}

int npar = 0;
int num_train_snap_orig, num_train_snap;
string training_par_dir;
Expand Down

0 comments on commit 1f5aba8

Please sign in to comment.