Skip to content

Commit

Permalink
DPS printformat()
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelyr committed Aug 23, 2023
1 parent 2bc665d commit 5d8d984
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions particle_structs/src/dps/dps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,35 +320,25 @@ namespace pumipic {
num_chars = sprintf(ptr, "%s\n", prefix);
num_chars += sprintf(ptr+num_chars,"Particle Structures DPS\n");
num_chars += sprintf(ptr+num_chars,"Number of Elements: %d.\nNumber of SoA: %d.\nNumber of Particles: %d.", num_elems, num_soa_, num_ptcls);
buffer[num_chars] = '\0';
ss << buffer;

num_chars += sprintf(ptr+num_chars, "\n Elements");
for (int e = 0; e < num_elems; e++){
num_chars += sprintf(ptr+num_chars, " %2d(%2d)", e, element_to_gid_host(e));
}

lid_t last_soa = -1;
lid_t last_elm = -1;
for (int i = 0; i < capacity_; i++) {
lid_t soa = i / soa_len;
lid_t elm = parents_host(soa);
if (last_soa == soa) {
num_chars = sprintf(ptr," %d", mask_host(i));
buffer[num_chars] = '\0';
ss << buffer;
num_chars += sprintf(ptr+num_chars," %d", mask_host(i));
}
else {
if (element_to_gid_host.size() > 0) {
num_chars = sprintf(ptr,"\n Element %2d(%2d) | %d", elm, element_to_gid_host(elm), mask_host(i));
buffer[num_chars] = '\0';
ss << buffer;
}
else {
num_chars = sprintf(ptr,"\n Element %2d | %d", elm, mask_host(i));
buffer[num_chars] = '\0';
ss << buffer;
}
num_chars += sprintf(ptr+num_chars,"\n SOA %d | %d", soa, mask_host(i));
}

last_soa = soa;
last_elm = elm;
}
buffer[num_chars] = '\0';
ss << buffer;
ss << "\n";
std::cout << ss.str();
}
Expand Down

0 comments on commit 5d8d984

Please sign in to comment.