Skip to content

Commit

Permalink
Fix radial coordinate output to adhere to CADET file format
Browse files Browse the repository at this point in the history
  • Loading branch information
jbreue16 committed Nov 25, 2024
1 parent 51987b2 commit 060dc7e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/casema-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ void writeMetaAndResultToH5(const ProgramOptions& opts, const casema::model::Mod
for (int j = 0; j < numUnits; ++j)
{
oss << std::setw(3) << std::setfill('0') << j;
writer->pushGroup("unit_" + oss.str());
std::string unitName = "unit_" + oss.str();
oss.str("");
writer->pushGroup(unitName);

const int nPorts = std::max(1, sys->unitOperation(j)->numOutletPorts());

Expand All @@ -231,12 +232,14 @@ void writeMetaAndResultToH5(const ProgramOptions& opts, const casema::model::Mod
{
writer->popGroup(); // pop solution
writer->pushGroup("coordinates");
writer->pushGroup(unitName);

for (int i = 0; i < nPorts; i++)
solutionBuffer[i] = static_cast<double>(sys->unitOperation(j)->secondaryCoordinates()[i]);

writer->writeVectorDouble("RADIAL_COORDINATES", nPorts, solutionBuffer.data(), 1, nPorts);

writer->popGroup(); // pop unit_xxx
writer->popGroup(); // pop coordinates
writer->pushGroup("solution");

Expand Down

0 comments on commit 060dc7e

Please sign in to comment.