Hi, im currently working on a new element, ALUM (in C++), and i would like some assistance: how can i detect the CTYPE of a nearby element?
Depends on *which* nearby particle you want to detect the [.ctype] of. If you want to detect the [.ctype] of *all* nearby elements, just do it like DTEC does. DTEC looks for [.type]s though, so look out for that. It's a bit intermingled with FILT spectra changing code, but it's easy to decipher.
struct particlehas a property "ctype" - so if you iterate, say, over pmap entries, you can do this:
int partid, parttype;
for (int i=-1; i<=1; i++) {
for (int j=-1; j<=1; j++) {
if (i != 0 && j != 0 && BOUNDS_CHECK) {
// pmap[y][x] = topmost particle ID shifted 1 byte right, bit-AND-ed together with the particle type
partid = pmap[y+i][x+i] >> 8;
parttype = pmap[y+i][x+i] & 0xFF;
if (sim->parts[partid].ctype == PT_COAL) {
// do stuff!
}
}
}
}