Skip to content

Commit

Permalink
#3: add rank finding from phase objects for Render
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrepebay committed May 30, 2023
1 parent f34758c commit a9d1a37
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/example2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ int main() {
}

// Instantiate render
auto r = Render(phases);
auto r = Render(phases, *info);
r.generate();
return 0;
}
16 changes: 15 additions & 1 deletion src/vt-tv/render/render.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@

namespace vt { namespace tv {

Render::Render(std::unordered_map<PhaseType, PhaseWork> in_phase_info)
Render::Render(std::unordered_map<PhaseType, PhaseWork> in_phase_info, Info in_info)
: phase_info_(std::move(in_phase_info))
, info_(in_info)
{ };

void Render::compute_object_load_range() {
Expand All @@ -76,6 +77,16 @@ void Render::compute_object_load_range() {
this->object_load_max_ = oq_max;
}

std::unordered_set<NodeType> Render::getRanks(PhaseType phase_in) const {
fmt::print("Getting Ranks in phase: {}\n", phase_in);
std::unordered_set<NodeType> rankSet;
for (auto const& [_, objInfo] : this->info_.getObjectInfo()) {
fmt::print(" rank: {}\n", objInfo.getHome());
rankSet.insert(objInfo.getHome());
}
return rankSet;
}

vtkPolyData* Render::create_rank_mesh_(PhaseType iteration) const {
}

Expand Down Expand Up @@ -106,6 +117,7 @@ vtkPolyData* Render::create_object_mesh_(PhaseWork phase) const {

// Retrieve elements constant across all ranks
PhaseType p_id = phase.getPhase();
std::unordered_set<NodeType> ranks = this->getRanks(p_id);
std::string object_qoi = this->object_qoi_;

// @todo
Expand Down Expand Up @@ -362,7 +374,9 @@ vtkPolyData* Render::create_object_mesh_(PhaseWork phase) const {
void Render::generate() {
// Create vector of number of objects per phase
std::vector<uint64_t> n_objects_list;
vtkPolyData* testPolyData;
for (auto const& [phase, phase_work] : this->phase_info_) {
testPolyData = this->create_object_mesh_(phase_work);
n_objects_list.push_back(phase_work.getObjectWork().size());
}

Expand Down
14 changes: 13 additions & 1 deletion src/vt-tv/render/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
#include <vtkBitArray.h>

#include "vt-tv/api/rank.h"
#include "vt-tv/api/info.h"

#include <fmt-vt/format.h>
#include <ostream>
#include <cmath>
Expand All @@ -81,6 +83,7 @@
#include <tuple>
#include <limits>
#include <map>
#include <unordered_set>

namespace vt { namespace tv {

Expand All @@ -100,6 +103,7 @@ struct Render {
};

std::unordered_map<PhaseType, PhaseWork> phase_info_;
Info info_;
TimeType object_load_max_;
std::string object_qoi_ = "load";

Expand All @@ -110,6 +114,13 @@ struct Render {
*/
void compute_object_load_range();

/**
* \brief get ranks belonging to phase
*
* \return set of ranks
*/
std::unordered_set<NodeType> getRanks(PhaseType phase_in) const;

/**
* \brief Map ranks to polygonal mesh.
*
Expand Down Expand Up @@ -153,8 +164,9 @@ struct Render {
* \brief Construct render
*
* \param[in] in_phase_info the phases
* \param[in] in_info info about the ranks and phases
*/
Render(std::unordered_map<PhaseType, PhaseWork> in_phase_info);
Render(std::unordered_map<PhaseType, PhaseWork> in_phase_info, Info in_info);

static void createPipeline(
vtkPoints* rank_points,
Expand Down

0 comments on commit a9d1a37

Please sign in to comment.