From: wolf Date: Tue, 16 Feb 1999 17:51:54 +0000 (+0000) Subject: Some more support for 3d. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d625d52230fb20b9ef484741134a2f6be50973de;p=dealii-svn.git Some more support for 3d. git-svn-id: https://svn.dealii.org/trunk@822 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/numerics/data_io.cc b/deal.II/deal.II/source/numerics/data_io.cc index e3670b0471..8e3b0de24e 100644 --- a/deal.II/deal.II/source/numerics/data_io.cc +++ b/deal.II/deal.II/source/numerics/data_io.cc @@ -339,6 +339,20 @@ void DataOut::write_ucd (ostream &out) const { default: Assert (false, ExcNotImplemented()); }; + + // it follows a list of the + // vertices of each cell. in 1d + // this is simply a list of the + // two vertices, in 2d its counter + // clockwise, as usual in this + // library. in 3d, the same applies + // (special thanks to AVS for + // numbering their vertices in a + // way compatible to deal.II!) + // + // technical reference: + // AVS Developer's Guide, Release 4, + // May, 1992, p. E6 for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) out << cell->vertex_dof_index(vertex,0) << ' '; @@ -671,6 +685,9 @@ void DataOut::write_gnuplot_draft (ostream &out) const case 2: out << " "; break; + case 3: + out << " "; + break; default: Assert (false, ExcNotImplemented()); }; @@ -731,6 +748,73 @@ void DataOut::write_gnuplot_draft (ostream &out) const break; + case 3: + // three dimension: output + // grid and data as a sequence + // of lines in 4d + + // first we plot the front face + for (unsigned int vertex=0; vertex<4; ++vertex) + { + out << cell->vertex(vertex) << " "; + for (unsigned int i=0; i!=data.size(); ++i) + out << (*data[i].data)(cell->vertex_dof_index(vertex,0)) + << ' '; + out << endl; + }; + // first vertex again + out << cell->vertex(0) << " "; + for (unsigned int i=0; i!=data.size(); ++i) + out << (*data[i].data)(cell->vertex_dof_index(0,0)) + << ' '; + out << endl + << endl + << endl; // end of front face; two newlines, since this + // stops continuous drawing + // of lines + + // first we back the front face + for (unsigned int vertex=4; vertex<8; ++vertex) + { + out << cell->vertex(vertex) << " "; + for (unsigned int i=0; i!=data.size(); ++i) + out << (*data[i].data)(cell->vertex_dof_index(vertex,0)) + << ' '; + out << endl; + }; + // first vertex again + out << cell->vertex(4) << " "; + for (unsigned int i=0; i!=data.size(); ++i) + out << (*data[i].data)(cell->vertex_dof_index(4,0)) + << ' '; + out << endl + << endl + << endl; // end of back face; two newlines, since this + // stops continuous drawing + // of lines + + // finally, we plot a + // continuous line along + // the vertices 0, 4, 7, 3, 2, + // 6, 5, 1 to show the other + // four lines + for (unsigned int vertex=0; vertex<8; ++vertex) + { + static const unsigned int vertex_list[8] + = { 0, 4, 7, 3, 2, 6, 5, 1 }; + + out << cell->vertex(vertex_list[vertex]) << " "; + for (unsigned int i=0; i!=data.size(); ++i) + out << (*data[i].data)(cell->vertex_dof_index(vertex_list[vertex],0)) + << ' '; + out << endl; + }; + // again: stop drawing + out << endl << endl; + + + break; + default: Assert (false, ExcNotImplemented()); };