change particle to using accessor methods

This commit is contained in:
Gavin Ridley 2021-04-14 17:13:59 -04:00
parent 711c60ea15
commit d5d2072266
38 changed files with 1234 additions and 1031 deletions

View file

@ -42,19 +42,19 @@ IdData::IdData(size_t h_res, size_t v_res)
void
IdData::set_value(size_t y, size_t x, const Particle& p, int level) {
// set cell data
if (p.n_coord_ <= level) {
if (p.n_coord() <= level) {
data_(y, x, 0) = NOT_FOUND;
} else {
data_(y, x, 0) = model::cells.at(p.coord_.at(level).cell)->id_;
data_(y, x, 0) = model::cells.at(p.coord(level).cell)->id_;
}
// set material data
Cell* c = model::cells.at(p.coord_.at(p.n_coord_ - 1).cell).get();
if (p.material_ == MATERIAL_VOID) {
Cell* c = model::cells.at(p.coord(p.n_coord() - 1).cell).get();
if (p.material() == MATERIAL_VOID) {
data_(y, x, 1) = MATERIAL_VOID;
return;
} else if (c->type_ == Fill::MATERIAL) {
Material* m = model::materials.at(p.material_).get();
Material* m = model::materials.at(p.material()).get();
data_(y, x, 1) = m->id_;
}
}
@ -69,10 +69,10 @@ PropertyData::PropertyData(size_t h_res, size_t v_res)
void
PropertyData::set_value(size_t y, size_t x, const Particle& p, int level) {
Cell* c = model::cells.at(p.coord_.at(p.n_coord_ - 1).cell).get();
data_(y,x,0) = (p.sqrtkT_ * p.sqrtkT_) / K_BOLTZMANN;
if (c->type_ != Fill::UNIVERSE && p.material_ != MATERIAL_VOID) {
Material* m = model::materials.at(p.material_).get();
Cell* c = model::cells.at(p.coord(p.n_coord() - 1).cell).get();
data_(y, x, 0) = (p.sqrtkT() * p.sqrtkT()) / K_BOLTZMANN;
if (c->type_ != Fill::UNIVERSE && p.material() != MATERIAL_VOID) {
Material* m = model::materials.at(p.material()).get();
data_(y,x,1) = m->density_gpcc_;
}
}