From f1f780cba486a6f3e4cd4ee4e632b915da5c30bd Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 31 Aug 1998 15:41:21 +0000 Subject: [PATCH] Move a structure from one file to another where it seemed more appropriate. git-svn-id: https://svn.dealii.org/trunk@538 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria.h | 75 +++++++++++++++++++ deal.II/deal.II/include/numerics/data_io.h | 74 ------------------ deal.II/deal.II/source/dofs/mg_dof_handler.cc | 25 ++++++- deal.II/deal.II/source/grid/tria.cc | 19 +++++ .../source/multigrid/mg_dof_handler.cc | 25 ++++++- deal.II/deal.II/source/numerics/data_io.cc | 15 ---- 6 files changed, 136 insertions(+), 97 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria.h b/deal.II/deal.II/include/grid/tria.h index 1f3b0a32e2..914ed035be 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -68,6 +68,81 @@ enum MeshSmoothing { +/*------------------------------------------------------------------------*/ + + +/** + * Structure which is passed to the #Triangulation::create_triangulation# + * function. It contains all data needed to construct a cell, namely the + * indices of the vertices and the material indicator. + */ +template +struct CellData { + int vertices[GeometryInfo::vertices_per_cell]; + unsigned char material_id; +}; + + + + + +/** + * Structure to be passed to the #Triangulation::create_triangulation# + * function to describe boundary information. + * + * This structure is the same for all dimensions, since we use an input + * function which is the same for all dimensions. The content of objects + * of this structure varies with the dimensions, however. + * + * Since in one space dimension, there is no boundary information apart + * from the two end points of the interval, this structure does not contain + * anything and exists only for consistency, to allow a common interface + * for all space dimensions. All fields should always be empty. + * + * Boundary data in 2D consists + * of a list of lines which belong to a given boundary component. A + * boundary component is a list of lines which are given a common + * number describing the boundary condition to hold on this part of the + * boundary. The triangulation creation function gives lines not in this + * list either the boundary indicator zero (if on the boundary) or 255 + * (if in the interior). Explicitely giving a line the indicator 255 + * will result in an error, as well as giving an interior line a boundary + * indicator. + */ +struct SubCellData { + /** + * Each record of this vector describes + * a line on the boundary and its boundary + * indicator. + */ + vector > boundary_lines; + + /** + * Each record of this vector describes + * a quad on the boundary and its boundary + * indicator. + */ + vector > boundary_quads; + + /** + * This function checks whether the vectors + * which may not be used in a given + * dimension are really empty. I.e., + * whether the #boundary_*# arrays are + * empty when in one space dimension + * and whether the #boundary_quads# + * array is empty when in two dimensions. + * + * Since this structure is the same for all + * dimensions, the actual dimension has + * to be given as a parameter. + */ + bool check_consistency (const unsigned int dim) const; +}; + + + + /*------------------------------------------------------------------------*/ diff --git a/deal.II/deal.II/include/numerics/data_io.h b/deal.II/deal.II/include/numerics/data_io.h index 8f67c26f7d..290eaf961b 100644 --- a/deal.II/deal.II/include/numerics/data_io.h +++ b/deal.II/deal.II/include/numerics/data_io.h @@ -19,80 +19,6 @@ class dVector; - -/** - * Structure which is passed to the #Triangulation::create_triangulation# - * function. It contains all data needed to construct a cell, namely the - * indices of the vertices and the material indicator. - */ -template -struct CellData { - int vertices[GeometryInfo::vertices_per_cell]; - unsigned char material_id; -}; - - - - - -/** - * Structure to be passed to the #Triangulation::create_triangulation# - * function to describe boundary information. - * - * This structure is the same for all dimensions, since we use an input - * function which is the same for all dimensions. The content of objects - * of this structure varies with the dimensions, however. - * - * Since in one space dimension, there is no boundary information apart - * from the two end points of the interval, this structure does not contain - * anything and exists only for consistency, to allow a common interface - * for all space dimensions. All fields should always be empty. - * - * Boundary data in 2D consists - * of a list of lines which belong to a given boundary component. A - * boundary component is a list of lines which are given a common - * number describing the boundary condition to hold on this part of the - * boundary. The triangulation creation function gives lines not in this - * list either the boundary indicator zero (if on the boundary) or 255 - * (if in the interior). Explicitely giving a line the indicator 255 - * will result in an error, as well as giving an interior line a boundary - * indicator. - */ -struct SubCellData { - /** - * Each record of this vector describes - * a line on the boundary and its boundary - * indicator. - */ - vector > boundary_lines; - - /** - * Each record of this vector describes - * a quad on the boundary and its boundary - * indicator. - */ - vector > boundary_quads; - - /** - * This function checks whether the vectors - * which may not be used in a given - * dimension are really empty. I.e., - * whether the #boundary_*# arrays are - * empty when in one space dimension - * and whether the #boundary_quads# - * array is empty when in two dimensions. - * - * Since this structure is the same for all - * dimensions, the actual dimension has - * to be given as a parameter. - */ - bool check_consistency (const unsigned int dim) const; -}; - - - - - /** * This class implements an input mechanism for grid data. It allows to * read a grid structure into a triangulation object. Future versions diff --git a/deal.II/deal.II/source/dofs/mg_dof_handler.cc b/deal.II/deal.II/source/dofs/mg_dof_handler.cc index 09b915a874..6466c1ed42 100644 --- a/deal.II/deal.II/source/dofs/mg_dof_handler.cc +++ b/deal.II/deal.II/source/dofs/mg_dof_handler.cc @@ -128,6 +128,7 @@ MGDoFHandler<1>::end () const { + template <> MGDoFHandler<1>::raw_cell_iterator MGDoFHandler<1>::last_raw () const { @@ -357,6 +358,7 @@ MGDoFHandler<1>::last_active_quad () const { #endif + #if deal_II_dimension == 2 template <> @@ -521,6 +523,7 @@ MGDoFHandler<2>::last_active_face (const unsigned int level) const { + template typename MGDoFHandler::raw_line_iterator MGDoFHandler::begin_raw_line (const unsigned int level) const { @@ -714,6 +717,7 @@ MGDoFHandler::end_quad (const unsigned int level) const { + template typename MGDoFDimensionInfo::active_quad_iterator MGDoFHandler::end_active_quad (const unsigned int level) const { @@ -852,6 +856,7 @@ MGDoFHandler::last_active_quad () const { + template void MGDoFHandler::distribute_dofs (const FiniteElementBase &fe) { // first distribute global dofs @@ -1205,6 +1210,7 @@ void MGDoFHandler::renumber_dofs (const unsigned int level, + #if deal_II_dimension == 1 template <> @@ -1240,6 +1246,8 @@ void MGDoFHandler<1>::do_renumbering (const unsigned int level, #endif + + #if deal_II_dimension == 2 template <> @@ -1361,6 +1369,7 @@ void MGDoFHandler<1>::reserve_space () { #endif + #if deal_II_dimension == 2 template <> @@ -1385,8 +1394,8 @@ void MGDoFHandler<2>::reserve_space () { // this calls the destructor which // must free the space mg_vertex_dofs.resize (0); - - + + //////////////////////////// // CONSTRUCTION @@ -1404,6 +1413,7 @@ void MGDoFHandler<2>::reserve_space () { -1); }; + // now allocate space for the // vertices. To this end, we need // to construct as many objects as @@ -1418,8 +1428,14 @@ void MGDoFHandler<2>::reserve_space () { // vertex we pass by belongs to mg_vertex_dofs.resize (tria->vertices.size()); - vector min_level (tria->vertices.size(), tria->n_levels()); - vector max_level (tria->vertices.size(), 0); + // here again, gcc2.8 fails to + // construct the vector properly + // using parameters to the constructor +// vector min_level (tria->vertices.size(), tria->n_levels()); +// vector max_level (tria->vertices.size(), 0); + vector min_level, max_level; + min_level.resize (tria->vertices.size(), tria->n_levels()); + max_level.resize (tria->vertices.size(), 0); Triangulation::cell_iterator cell = tria->begin(), endc = tria->end(); @@ -1434,6 +1450,7 @@ void MGDoFHandler<2>::reserve_space () { max_level[vertex_index] = cell->level(); }; + // now allocate the needed space for (unsigned int vertex=0; vertexvertices.size(); ++vertex) { diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index e79388680d..2f927842eb 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -17,6 +17,25 @@ #include + +bool SubCellData::check_consistency (const unsigned int dim) const { + switch (dim) + { + case 1: + return ((boundary_lines.size() == 0) && + (boundary_quads.size() == 0)); + case 2: + return (boundary_quads.size() == 0); + }; + return true; +}; + + + + + + + template Triangulation::Triangulation (const MeshSmoothing smooth_grid) : smooth_grid(smooth_grid) diff --git a/deal.II/deal.II/source/multigrid/mg_dof_handler.cc b/deal.II/deal.II/source/multigrid/mg_dof_handler.cc index 09b915a874..6466c1ed42 100644 --- a/deal.II/deal.II/source/multigrid/mg_dof_handler.cc +++ b/deal.II/deal.II/source/multigrid/mg_dof_handler.cc @@ -128,6 +128,7 @@ MGDoFHandler<1>::end () const { + template <> MGDoFHandler<1>::raw_cell_iterator MGDoFHandler<1>::last_raw () const { @@ -357,6 +358,7 @@ MGDoFHandler<1>::last_active_quad () const { #endif + #if deal_II_dimension == 2 template <> @@ -521,6 +523,7 @@ MGDoFHandler<2>::last_active_face (const unsigned int level) const { + template typename MGDoFHandler::raw_line_iterator MGDoFHandler::begin_raw_line (const unsigned int level) const { @@ -714,6 +717,7 @@ MGDoFHandler::end_quad (const unsigned int level) const { + template typename MGDoFDimensionInfo::active_quad_iterator MGDoFHandler::end_active_quad (const unsigned int level) const { @@ -852,6 +856,7 @@ MGDoFHandler::last_active_quad () const { + template void MGDoFHandler::distribute_dofs (const FiniteElementBase &fe) { // first distribute global dofs @@ -1205,6 +1210,7 @@ void MGDoFHandler::renumber_dofs (const unsigned int level, + #if deal_II_dimension == 1 template <> @@ -1240,6 +1246,8 @@ void MGDoFHandler<1>::do_renumbering (const unsigned int level, #endif + + #if deal_II_dimension == 2 template <> @@ -1361,6 +1369,7 @@ void MGDoFHandler<1>::reserve_space () { #endif + #if deal_II_dimension == 2 template <> @@ -1385,8 +1394,8 @@ void MGDoFHandler<2>::reserve_space () { // this calls the destructor which // must free the space mg_vertex_dofs.resize (0); - - + + //////////////////////////// // CONSTRUCTION @@ -1404,6 +1413,7 @@ void MGDoFHandler<2>::reserve_space () { -1); }; + // now allocate space for the // vertices. To this end, we need // to construct as many objects as @@ -1418,8 +1428,14 @@ void MGDoFHandler<2>::reserve_space () { // vertex we pass by belongs to mg_vertex_dofs.resize (tria->vertices.size()); - vector min_level (tria->vertices.size(), tria->n_levels()); - vector max_level (tria->vertices.size(), 0); + // here again, gcc2.8 fails to + // construct the vector properly + // using parameters to the constructor +// vector min_level (tria->vertices.size(), tria->n_levels()); +// vector max_level (tria->vertices.size(), 0); + vector min_level, max_level; + min_level.resize (tria->vertices.size(), tria->n_levels()); + max_level.resize (tria->vertices.size(), 0); Triangulation::cell_iterator cell = tria->begin(), endc = tria->end(); @@ -1434,6 +1450,7 @@ void MGDoFHandler<2>::reserve_space () { max_level[vertex_index] = cell->level(); }; + // now allocate the needed space for (unsigned int vertex=0; vertexvertices.size(); ++vertex) { diff --git a/deal.II/deal.II/source/numerics/data_io.cc b/deal.II/deal.II/source/numerics/data_io.cc index cc82893c6f..d81cb74813 100644 --- a/deal.II/deal.II/source/numerics/data_io.cc +++ b/deal.II/deal.II/source/numerics/data_io.cc @@ -20,21 +20,6 @@ -bool SubCellData::check_consistency (const unsigned int dim) const { - switch (dim) - { - case 1: - return ((boundary_lines.size() == 0) && - (boundary_quads.size() == 0)); - case 2: - return (boundary_quads.size() == 0); - }; - return true; -}; - - - - template DataIn::DataIn () : -- 2.39.5