From a79b0ebae8b1a7811e6d11b6964b9d20b5d13457 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 23 Oct 2003 23:26:59 +0000 Subject: [PATCH] Closer to out coding standards. git-svn-id: https://svn.dealii.org/trunk@8152 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/grid/grid_reordering_internal.h | 78 +++--- .../deal.II/source/grid/grid_reordering.cc | 261 +++++++++--------- 2 files changed, 159 insertions(+), 180 deletions(-) diff --git a/deal.II/deal.II/include/grid/grid_reordering_internal.h b/deal.II/deal.II/include/grid/grid_reordering_internal.h index abbbdf30fa..7701dab3b2 100644 --- a/deal.II/deal.II/include/grid/grid_reordering_internal.h +++ b/deal.II/deal.II/include/grid/grid_reordering_internal.h @@ -410,16 +410,20 @@ namespace internal /** * The first node */ - int node0; - /** + unsigned int node0; + + /** * The second node */ - int node1; + unsigned int node1; + /** * A simple constructor */ - CheapEdge(int n0, int n1); - /** + CheapEdge (const unsigned int n0, + const unsigned int n1); + + /** * Need a partial ordering * for the STL */ @@ -437,19 +441,15 @@ namespace internal /** * Simple constructor */ - Edge (int n0, - int n1, - int orient=0); - - /** - * Simple Destructor - */ - ~Edge(); + Edge (const unsigned int n0, + const unsigned int n1, + const int orient = 0); /** * The IDs for the end nodes */ - int nodes[2]; + unsigned int nodes[2]; + /** * Whether the edge has been * oriented (0), points from @@ -467,8 +467,10 @@ namespace internal */ int group; - unsigned int num_neighbouring_cubes; - unsigned int * neighbouring_cubes; + /** + * Indices of neighboring cubes. + */ + std::vector neighboring_cubes; }; /** @@ -547,6 +549,11 @@ namespace internal class Mesh { public: + /** + * Default Constructor + */ + Mesh (); + /** * The list of nodes */ @@ -562,33 +569,9 @@ namespace internal /** * Checks whether every cell - * in the mesh is sensible. By - * calling - * sanity_check(cell_num) on - * every cell. + * in the mesh is sensible. */ - bool sanity_check() const; - - /** - * Checks that every node - * matches with its edges. By - * calling - * sanity_check(cell_num,node_num) - * for each node. - */ - bool sanity_check(int cell_num) const; - - /** - * Checks that each edge - * going into a node is - * correctly setup. - */ - bool sanity_check_node(int cell_num, int i) const; - - /** - * Default Constructor - */ - Mesh (); + void sanity_check() const; private: /** @@ -596,12 +579,21 @@ namespace internal * constructor to disable it. */ Mesh(const Mesh&); + /** * Unimplemented private * assignemnet operator to * disable it. */ Mesh& operator=(const Mesh&); + + /** + * Checks that each edge + * going into a node is + * correctly set up. + */ + void sanity_check_node (const Cell &cell, + const unsigned int local_node_num) const; }; @@ -640,7 +632,7 @@ namespace internal bool orient_edges_in_current_cube (Mesh &m); bool orient_edge_set_in_current_cube (Mesh &m, - int edge_set); + const unsigned int edge_set); bool orient_next_unoriented_edge (Mesh &m); bool consistent (Mesh &m, int cell_num); diff --git a/deal.II/deal.II/source/grid/grid_reordering.cc b/deal.II/deal.II/source/grid/grid_reordering.cc index 8c8771ff18..ed632fd2bd 100644 --- a/deal.II/deal.II/source/grid/grid_reordering.cc +++ b/deal.II/deal.II/source/grid/grid_reordering.cc @@ -584,7 +584,8 @@ namespace internal // sort two integers - static inline void sort2 (int &v1, int &v2) + static inline void sort2 (unsigned int &v1, + unsigned int &v2) { if (v1>v2) std::swap (v1, v2); @@ -600,7 +601,7 @@ namespace internal * edge_to_node[i][k] where * k=0,1,2. */ - static const int edge_to_node[8][3] = + static const unsigned int edge_to_node[8][3] = { {0,4,8}, {0,5,9}, @@ -641,7 +642,7 @@ namespace internal * nodesonedge[i][1] is the * end node for edge i. */ - static const int nodes_on_edge[12][2] = + static const unsigned int nodes_on_edge[12][2] = { {0,1}, {4,5}, @@ -662,7 +663,7 @@ namespace internal // (for edges) and chosing // clockwise order // TODO: HERE - static const int nodes_on_face[6][4] = + static const unsigned int nodes_on_face[6][4] = { {0,1,2,3}, {0,4,5,1}, @@ -674,15 +675,19 @@ namespace internal } - CheapEdge::CheapEdge(int n0, int n1) : node0(n0), node1(n1) + CheapEdge::CheapEdge (const unsigned int n0, + const unsigned int n1) + : + node0(n0), node1(n1) { // sort the entries so that // node0 e2.node0) return false; @@ -700,14 +705,14 @@ namespace internal const unsigned int cell_list_length = cell_list.size(); - unsigned int NumEdges = 0; + unsigned int n_edges = 0; // Correctly build the edge // list { // edge_map stores the // edge_number associated // with a given CheapEdge - std::map edge_map; + std::map edge_map; unsigned int ctr = 0; for (unsigned int cur_cell_id = 0; cur_cell_id edge_count(NumEdges,0); + std::vector edge_count(n_edges,0); // Count every time an edge @@ -788,21 +796,15 @@ namespace internal // edge // Allocate the space for the - // neighbour list - for (unsigned int cur_edge_id = 0; - cur_edge_id cur_cell_edge_list_posn(NumEdges,0); + // current neighbor in the + // edge's neighbor list + std::vector cur_cell_edge_list_posn(n_edges,0); for (unsigned int cur_cell_id = 0; cur_cell_id::lines_per_cell; ++i) + for (unsigned int i=0; i::lines_per_cell; ++i) { edges[i] = c.edges[i]; local_orientation_flags[i] = c.local_orientation_flags[i]; } - for (unsigned int i = 0; i::vertices_per_cell; ++i) + for (unsigned int i=0; i::vertices_per_cell; ++i) nodes[i] = c.nodes[i]; waiting_to_be_processed = c.waiting_to_be_processed; @@ -883,62 +876,51 @@ namespace internal - bool Mesh::sanity_check() const + void + Mesh::sanity_check() const { - bool retval = true; - for (unsigned int i = 0; i