Skip to content

Commit

Permalink
IO_MODIFY: Add geometry mirror; update geometry help output
Browse files Browse the repository at this point in the history
  • Loading branch information
gsjaardema committed Dec 18, 2023
1 parent 39d2e30 commit 4d28f6b
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions packages/seacas/libraries/ioss/src/main/io_modify.C
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ using real = double;

namespace {
std::string codename;
std::string version = "2.03 (2022-05-26)";
std::string version = "2.04 (2023-12-18)";

std::vector<Ioss::GroupingEntity *> attributes_modified;

Expand Down Expand Up @@ -653,17 +653,21 @@ namespace {
}
if (all || Ioss::Utils::substr_equal(topic, "geometry")) {
fmt::print(fmt::emphasis::bold, "\n\tGEOMETRY ROTATE ");
fmt::print("{{X|Y|Z}} {{angle}}\n");
fmt::print("{{X|Y|Z}} {{angle}} ...\n");
fmt::print(fmt::emphasis::bold, "\tGEOMETRY MIRROR ");
fmt::print("{{X|Y|Z}} ...\n");
fmt::print(fmt::emphasis::bold, "\tGEOMETRY SCALE ");
fmt::print("{{x}} {{y}} {{z}}\n");
fmt::print("{{X|Y|Z}} {{scale_factor}} ...\n");
fmt::print(fmt::emphasis::bold, "\tGEOMETRY OFFSET ");
fmt::print("{{x}} {{y}} {{z}}\n");
fmt::print("{{X|Y|Z}} {{offset}} ...\n");
fmt::print(fmt::emphasis::bold, "\tGEOMETRY ROTATE ");
fmt::print("{{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} {{angle}}\n");
fmt::print("{{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} {{angle}} ...\n");
fmt::print(fmt::emphasis::bold, "\tGEOMETRY MIRROR ");
fmt::print("{{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} ...\n");
fmt::print(fmt::emphasis::bold, "\tGEOMETRY SCALE ");
fmt::print("{{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{x}} {{y}} {{z}}\n");
fmt::print("{{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} {{scale_factor}} ...\n");
fmt::print(fmt::emphasis::bold, "\tGEOMETRY OFFSET ");
fmt::print("{{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{x}} {{y}} {{z}}\n");
fmt::print("{{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} {{offset}} ...\n");
}
if (all || Ioss::Utils::substr_equal(topic, "time")) {
fmt::print(fmt::emphasis::bold, "\n\tTIME SCALE ");
Expand Down Expand Up @@ -1236,13 +1240,14 @@ namespace {
{
// 0 1 2 3 4 5...
// GEOMETRY ROTATE {{X|Y|Z}} {{angle}} ...
// GEOMETRY MIRROR {{X|Y|Z}} ...
// GEOMETRY SCALE {{X|Y|Z}} {{scale}} ...
// GEOMETRY OFFSET {{X|Y|Z}} {{offset}} ...
// GEOMETRY ROTATE {{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} {{angle}} ...
// GEOMETRY SCALE {{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} {{scale}} ...
// GEOMETRY OFFSET {{ELEMENTBLOCKS|BLOCKS|ASSEMBLY}} {{names}} {{X|Y|Z}} {{offset}} ...

if (tokens.size() < 4) {
if (tokens.size() < 3) {
fmt::print(stderr,
#if !defined __NVCC__
fg(fmt::color::red),
Expand Down Expand Up @@ -1348,7 +1353,30 @@ namespace {

// Do the transformation...
scale_filtered_coordinates(region, scale, node_filter);
fmt::print(fg(fmt::color::cyan), "\t*** Database coordinates scaled.\n");
fmt::print(fg(fmt::color::cyan), "\t*** Database coordinate(s) scaled.\n");
return false;
}

if (Ioss::Utils::substr_equal(tokens[1], "mirror")) {
real scale[3] = {1.0, 1.0, 1.0};

// Get mirror axis ...
do {
const std::string &axis = tokens[idx++];
if (Ioss::Utils::substr_equal(axis, "x")) {
scale[0] = -1.0;
}
else if (Ioss::Utils::substr_equal(axis, "y")) {
scale[1] = -1.0;
}
else if (Ioss::Utils::substr_equal(axis, "z")) {
scale[2] = -1.0;
}
} while (idx < tokens.size());

// Do the transformation...
scale_filtered_coordinates(region, scale, node_filter);
fmt::print(fg(fmt::color::cyan), "\t*** Database coordinate(s) mirrored.\n");
return false;
}

Expand All @@ -1372,7 +1400,7 @@ namespace {

// Do the transformation...
offset_filtered_coordinates(region, offset, node_filter);
fmt::print(fg(fmt::color::cyan), "\t*** Database coordinates offset.\n");
fmt::print(fg(fmt::color::cyan), "\t*** Database coordinate(s) offset.\n");
return false;
}

Expand Down

0 comments on commit 4d28f6b

Please sign in to comment.