Start implementing RectilinearMesh

This commit is contained in:
Sterling Harper 2019-05-24 10:50:57 -04:00
parent 7b6ec80acf
commit ce2bf83254
7 changed files with 588 additions and 82 deletions

View file

@ -707,12 +707,12 @@ void draw_mesh_lines(Plot pl, ImageData& data)
Position width = ur_plot - ll_plot;
auto& m = model::meshes[pl.index_meshlines_mesh_];
auto& m = *dynamic_cast<RegularMesh*>(model::meshes[pl.index_meshlines_mesh_].get());
int ijk_ll[3], ijk_ur[3];
bool in_mesh;
m->get_indices(ll_plot, &(ijk_ll[0]), &in_mesh);
m->get_indices(ur_plot, &(ijk_ur[0]), &in_mesh);
m.get_indices(ll_plot, &(ijk_ll[0]), &in_mesh);
m.get_indices(ur_plot, &(ijk_ur[0]), &in_mesh);
// Fortran/C++ index correction
ijk_ur[0]++; ijk_ur[1]++; ijk_ur[2]++;
@ -722,13 +722,13 @@ void draw_mesh_lines(Plot pl, ImageData& data)
for (int i = ijk_ll[outer]; i <= ijk_ur[outer]; i++) {
for (int j = ijk_ll[inner]; j <= ijk_ur[inner]; j++) {
// check if we're in the mesh for this ijk
if (i > 0 && i <= m->shape_[outer] && j >0 && j <= m->shape_[inner] ) {
if (i > 0 && i <= m.shape_[outer] && j >0 && j <= m.shape_[inner] ) {
int outrange[3], inrange[3];
// get xyz's of lower left and upper right of this mesh cell
r_ll[outer] = m->lower_left_[outer] + m->width_[outer] * (i - 1);
r_ll[inner] = m->lower_left_[inner] + m->width_[inner] * (j - 1);
r_ur[outer] = m->lower_left_[outer] + m->width_[outer] * i;
r_ur[inner] = m->lower_left_[inner] + m->width_[inner] * j;
r_ll[outer] = m.lower_left_[outer] + m.width_[outer] * (i - 1);
r_ll[inner] = m.lower_left_[inner] + m.width_[inner] * (j - 1);
r_ur[outer] = m.lower_left_[outer] + m.width_[outer] * i;
r_ur[inner] = m.lower_left_[inner] + m.width_[inner] * j;
// map the xyz ranges to pixel ranges
double frac = (r_ll[outer] - ll_plot[outer]) / width[outer];