From 99b4b6246ebc78865a1f6c6831622a460525e343 Mon Sep 17 00:00:00 2001 From: guido Date: Fri, 14 Dec 2001 15:54:00 +0000 Subject: [PATCH] 3D DX output with neighbors git-svn-id: https://svn.dealii.org/trunk@5336 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/data_out_base.cc | 129 ++++++++++++++++----------- 1 file changed, 77 insertions(+), 52 deletions(-) diff --git a/deal.II/base/source/data_out_base.cc b/deal.II/base/source/data_out_base.cc index 6fc1719f30..0c4ac3bada 100644 --- a/deal.II/base/source/data_out_base.cc +++ b/deal.II/base/source/data_out_base.cc @@ -638,47 +638,59 @@ void DataOutBase::write_dx (const typename std::vector > &pa switch (dim) { case 1: - { - for (unsigned int i=0; i > &pa patch!=patches.end(); ++patch) { const unsigned int n = patch->n_subdivisions; - const unsigned int cells_per_patch - = n - * ((dim>1) ? n : 1) - * ((dim>2) ? n : 1); + unsigned int cells_per_patch = 1; + unsigned int dx = 1; + unsigned int dy = 1; + unsigned int dz = 1; + switch(dim) + { + case 3: + dx *= n; + dy *= n; + cells_per_patch *= n; + case 2: + dx *= n; + cells_per_patch *= n; + case 1: + cells_per_patch *= n; + } + const unsigned int patch_start = patch->me * cells_per_patch; for (unsigned int ix=0;ix1) ? n : 1);++iy) for (unsigned int iz=0;iz<((dim>2) ? n : 1);++iz) { - const unsigned int nx = ix*n; - const unsigned int ny = iy; - const unsigned int nz = iz*n*n; + const unsigned int nx = ix*dx; + const unsigned int ny = iy*dy; + const unsigned int nz = iz*dz; out << std::endl; // Direction -x @@ -752,12 +777,12 @@ void DataOutBase::write_dx (const typename std::vector > &pa const unsigned int nn = patch->neighbors[0]; out << '\t'; if (nn != patch->no_neighbor) - out << (nn*cells_per_patch+ny+nz+n*(n-1)); + out << (nn*cells_per_patch+ny+nz+dx*(n-1)); else out << "-1"; } else { out << '\t' - << patch_start+nx-n+ny+nz; + << patch_start+nx-dx+ny+nz; } // Direction +x // First cell in row @@ -772,7 +797,7 @@ void DataOutBase::write_dx (const typename std::vector > &pa out << "-1"; } else { out << '\t' - << patch_start+nx+n+ny+nz; + << patch_start+nx+dx+ny+nz; } if (dim<2) continue; @@ -782,12 +807,12 @@ void DataOutBase::write_dx (const typename std::vector > &pa const unsigned int nn = patch->neighbors[2]; out << '\t'; if (nn != patch->no_neighbor) - out << (nn*cells_per_patch+nx+nz+1*(n-1)); + out << (nn*cells_per_patch+nx+nz+dy*(n-1)); else out << "-1"; } else { out << '\t' - << patch_start+nx+ny-1+nz; + << patch_start+nx+ny-dy+nz; } // Direction +y if (iy == n-1) @@ -800,7 +825,7 @@ void DataOutBase::write_dx (const typename std::vector > &pa out << "-1"; } else { out << '\t' - << patch_start+nx+ny+1+nz; + << patch_start+nx+ny+dy+nz; } if (dim<3) continue; @@ -811,17 +836,17 @@ void DataOutBase::write_dx (const typename std::vector > &pa const unsigned int nn = patch->neighbors[4]; out << '\t'; if (nn != patch->no_neighbor) - out << (nn*cells_per_patch+nx+ny+n*n*(n-1)); + out << (nn*cells_per_patch+nx+ny+dz*(n-1)); else out << "-1"; } else { out << '\t' - << patch_start+nx+ny+nz-n*n; + << patch_start+nx+ny+nz-dz; } // Direction +z if (iz == n-1) { - const unsigned int nn = patch->neighbors[4]; + const unsigned int nn = patch->neighbors[5]; out << '\t'; if (nn != patch->no_neighbor) out << (nn*cells_per_patch+nx+ny); @@ -829,7 +854,7 @@ void DataOutBase::write_dx (const typename std::vector > &pa out << "-1"; } else { out << '\t' - << patch_start+nx+ny+nz+n*n; + << patch_start+nx+ny+nz+dz; } } out << std::endl; -- 2.39.5