Skip to content

Commit

Permalink
#130: render: improve output and fix parsing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander authored and pierrepebay committed Jan 20, 2025
1 parent fc8f0a4 commit 5783ffb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
23 changes: 17 additions & 6 deletions src/vt-tv/render/render.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ Render::Render(Info in_info)
: info_(in_info) // std:move ?
,
n_ranks_(in_info.getNumRanks()),
n_phases_(in_info.getNumPhases()) {
n_phases_(in_info.getNumPhases())
{
// If selected_phase is not provided, use all phases
selected_phase_ = std::numeric_limits<PhaseType>::max();

Expand Down Expand Up @@ -110,7 +111,15 @@ Render::Render(Info in_info)
rank_qoi_range_ = computeRankQOIRange_();
object_volume_max_ = computeMaxObjectVolume_();
object_load_max_ = info_.getMaxLoad();
};
}

std::string printLBIter(LBIterationType lb_iter) {
if (lb_iter == no_lb_iter) {
return "<none>";
} else {
return std::to_string(lb_iter);
}
}

Render::Render(
std::array<std::string, 3> in_qoi_request,
Expand Down Expand Up @@ -441,7 +450,7 @@ vtkNew<vtkPolyData> Render::createObjectMesh_(
fmt::print("\n\n");
fmt::print(
"----- Creating object mesh for (phase,lb_iter) ({},{}) -----\n",
phase, lb_iter
phase, printLBIter(lb_iter)
);
// Retrieve number of mesh points and bail out early if empty set
uint64_t n_o = info_.getPhaseObjects(phase, lb_iter).size();
Expand Down Expand Up @@ -1207,7 +1216,8 @@ void Render::generate(uint64_t font_size, uint64_t win_size) {

if (save_meshes_) {
fmt::print(
"== Writing object mesh for (phase,lb_iter)= ({},{})\n", phase, lb_iter
"== Writing object mesh for (phase,lb_iter)= ({},{})\n",
phase, printLBIter(lb_iter)
);
vtkNew<vtkXMLPolyDataWriter> writer;
std::string object_mesh_filename = output_dir_ + output_file_stem_ +
Expand All @@ -1217,7 +1227,8 @@ void Render::generate(uint64_t font_size, uint64_t win_size) {
writer->Write();

fmt::print(
"== Writing rank mesh for (phase,lb_iter)= ({},{})\n", phase, lb_iter
"== Writing rank mesh for (phase,lb_iter)= ({},{})\n", phase,
printLBIter(lb_iter)
);
vtkNew<vtkXMLPolyDataWriter> writer2;
std::string rank_mesh_filneame = output_dir_ + output_file_stem_ +
Expand All @@ -1230,7 +1241,7 @@ void Render::generate(uint64_t font_size, uint64_t win_size) {
if (save_pngs_) {
fmt::print(
"== Rendering visualization PNG for (phase,lb_iter)= ({},{})\n",
phase, lb_iter
phase, printLBIter(lb_iter)
);

std::pair<double, double> obj_qoi_range;
Expand Down
4 changes: 2 additions & 2 deletions src/vt-tv/utility/json_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ std::unique_ptr<Info> JSONReader::parse() {
*static_cast<PhaseWork*>(pw.release())
);
if (phase.find("lb_iterations") != phase.end()) {
auto lb_iters = j["lb_iterations"];
auto lb_iters = phase["lb_iterations"];
if (lb_iters.is_array()) {
for (auto const& iter : lb_iters) {
auto lb_iter = parsePhaseIter(phase_id, iter, object_info);
auto lb_iter = parsePhaseIter(phase_id, iter, object_info, true);
auto lb_id = static_cast<LBIteration*>(lb_iter.get())->getLBIterationID();
phase_info[phase_id].addLBIteration(
lb_id,
Expand Down

0 comments on commit 5783ffb

Please sign in to comment.