From: wolf Date: Tue, 25 Feb 2003 17:10:27 +0000 (+0000) Subject: Fix problem in DataOutFaces where we used the face index instead of the cell index... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22e251c47077c4c65e4569bce578eee5a7643b28;p=dealii-svn.git Fix problem in DataOutFaces where we used the face index instead of the cell index. Was bogus, but usually not discovered since face_index<2**dim, which in most cases is less than the number of cells in the grid. git-svn-id: https://svn.dealii.org/trunk@7244 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/data_out_faces.h b/deal.II/deal.II/include/numerics/data_out_faces.h index 07e575906a..e2a063ad9c 100644 --- a/deal.II/deal.II/include/numerics/data_out_faces.h +++ b/deal.II/deal.II/include/numerics/data_out_faces.h @@ -164,6 +164,11 @@ class DataOutFaces : public DataOut_DoFData int, << "The number of subdivisions per patch, " << arg1 << ", is not valid."); + + /** + * Exception + */ + DeclException0 (ExcCellNotActiveForCellData); private: /** diff --git a/deal.II/deal.II/source/numerics/data_out_faces.cc b/deal.II/deal.II/source/numerics/data_out_faces.cc index b56dea8934..a5225216b8 100644 --- a/deal.II/deal.II/source/numerics/data_out_faces.cc +++ b/deal.II/deal.II/source/numerics/data_out_faces.cc @@ -44,7 +44,6 @@ void DataOutFaces::build_some_patches (Data data) const unsigned int n_q_points = patch_points.n_quadrature_points; - unsigned int face_number = 0; typename std::vector< ::DataOutBase::Patch >::iterator patch = this->patches.begin(); FaceDescriptor face=first_face(); @@ -52,7 +51,6 @@ void DataOutFaces::build_some_patches (Data data) for (unsigned int i=0; (idofs->end()); ++i) { ++patch; - ++face_number; face=next_face(face); } @@ -105,14 +103,29 @@ void DataOutFaces::build_some_patches (Data data) // then do the cell data for (unsigned int dataset=0; datasetcell_data.size(); ++dataset) { + // we need to get at + // the number of the + // cell to which this + // face belongs in + // order to access the + // cell data. this is + // not readily + // available, so choose + // the following rather + // inefficient way: + Assert (face.first->active(), ExcCellNotActiveForCellData()); + const unsigned int cell_number + = std::distance (this->dofs->begin_active(), + typename DoFHandler::active_cell_iterator(face.first)); + if (this->cell_data[dataset].has_block) { - const double value = (*this->cell_data[dataset].block_data)(face_number); + const double value = (*this->cell_data[dataset].block_data)(cell_number); for (unsigned int q=0; qdata(dataset+this->dof_data.size()*data.n_components,q) = value; } else { - const double value = (*this->cell_data[dataset].single_data)(face_number); + const double value = (*this->cell_data[dataset].single_data)(cell_number); for (unsigned int q=0; qdata(dataset+this->dof_data.size()*data.n_components,q) = value; @@ -124,7 +137,6 @@ void DataOutFaces::build_some_patches (Data data) (idofs->end()); ++i) { ++patch; - ++face_number; face=next_face(face); } }; diff --git a/deal.II/doc/news/2002/c-3-4.html b/deal.II/doc/news/2002/c-3-4.html index 66e8c2531a..5ae27eb27f 100644 --- a/deal.II/doc/news/2002/c-3-4.html +++ b/deal.II/doc/news/2002/c-3-4.html @@ -739,6 +739,15 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK

deal.II

    +
  1. + Fixed: The DataOutFaces class was + broken for cell data. It should now be correct, although the + algorithm used is not optimal, being approximately quadratic in + runtime. +
    + (WB 2003/02/25) +

    +
  2. New: The ConstraintMatrix::shift function shifts and translates the elements of the constraint