Skip to content

Commit

Permalink
Merge pull request #824 from wildmeshing/jiacheng/fix_scheduler
Browse files Browse the repository at this point in the history
fix scheduler
  • Loading branch information
JcDai authored Oct 23, 2024
2 parents 31aca16 + 9321b19 commit 475792a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions applications/triwild/triwild_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ using wmtk::components::utils::resolve_paths;

int main(int argc, char* argv[])
{
opt_logger().set_level(spdlog::level::off);
CLI::App app{argv[0]};

app.ignore_case();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,42 @@ std::vector<std::pair<std::shared_ptr<Mesh>, std::string>> wildmeshing2d(
if (max_energy <= target_max_amips && is_double) break;
}

logger().info("----------------------- Postprocess Collapse -----------------------");

logger().info("Executing collapse ...");

auto post_stats = scheduler.run_operation_on_all(*collapse_then_round, visited_edge_flag_t);
logger().info(
"Executed {}, {} ops (S/F) {}/{}. Time: collecting: {}, sorting: {}, "
"executing: {}",
"preprocessing collapse",
post_stats.number_of_performed_operations(),
post_stats.number_of_successful_operations(),
post_stats.number_of_failed_operations(),
post_stats.collecting_time,
post_stats.sorting_time,
post_stats.executing_time);

// compute max energy
max_energy = std::numeric_limits<double>::lowest();
min_energy = std::numeric_limits<double>::max();
avg_energy = 0;
for (const auto& t : mesh->get_all(mesh->top_simplex_type())) {
// double e = amips->get_value(simplex::Simplex(mesh->top_simplex_type(), t));
double e = amips_accessor.scalar_attribute(t);
max_energy = std::max(max_energy, e);
min_energy = std::min(min_energy, e);
avg_energy += e;
}

avg_energy = avg_energy / mesh->get_all(mesh->top_simplex_type()).size();

logger().info(
"Max AMIPS Energy: {}, Min AMIPS Energy: {}, Avg AMIPS Energy: {}",
max_energy,
min_energy,
avg_energy);

std::vector<std::pair<std::shared_ptr<Mesh>, std::string>> all_meshes;
all_meshes.push_back(std::make_pair(mesh, "main"));

Expand Down
4 changes: 4 additions & 0 deletions src/wmtk/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ SchedulerStats Scheduler::run_operation_on_all(
int64_t success = -1;
std::vector<std::pair<int64_t, double>> order;

for (const auto& t : tups) {
flag_accessor.scalar_attribute(t) = char(1);
}

do {
SchedulerStats internal_stats;
// op.reserve_enough_simplices();
Expand Down

0 comments on commit 475792a

Please sign in to comment.