21 Values
const& values, Excluded
const& excluded,
24 char const* directory = std::getenv(
"KASKADE_RESTRICTION_CAPTURE");
25 if (!directory || !*directory)
return;
27 if (invocation > 32 && invocation != 50 && invocation != 100 &&
28 invocation != 200 && invocation != 300)
return;
29 namespace fs = std::filesystem;
30 fs::path root(directory);
31 fs::create_directories(root);
32 auto openNew = [&](std::string
const& suffix) {
33 fs::path path = root / (
"sub" + std::to_string(subdomain) + suffix +
".csv");
35 throw std::runtime_error(
"Restriction capture refuses to overwrite " + path.string());
36 std::ofstream out(path);
37 out.exceptions(std::ios::failbit | std::ios::badbit);
38 out << std::setprecision(17);
43 auto topology = openNew(
"-topology");
44 topology <<
"neighbor,index,excluded\n";
45 for (
auto const& [neighbor, indices] : interfaces)
46 for (
auto i : indices)
47 topology << neighbor <<
',' << i <<
','
48 << (!excluded.empty() && excluded[i] ? 1 : 0) <<
'\n';
50 auto out = openNew(
"-call" + std::to_string(invocation));
51 out <<
"index,component,excluded,value\n";
52 for (std::size_t i=0; i<values.size(); ++i)
53 for (
int j=0; j<components; ++j)
54 out << i <<
',' << j <<
',' << (!excluded.empty() && excluded[i] ? 1 : 0)
55 <<
',' << values[i][j] <<
'\n';