From aeda28e23f835200ed05ba4d4d15e7d1b6a4f2cd Mon Sep 17 00:00:00 2001 From: guido Date: Tue, 18 May 2004 14:00:59 +0000 Subject: [PATCH] new function n_faces git-svn-id: https://svn.dealii.org/trunk@9253 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/tria.h | 31 ++++++++++ .../source/grid/tria.all_dimensions.cc | 3 +- deal.II/deal.II/source/grid/tria.cc | 56 +++++++++++++++++-- 3 files changed, 83 insertions(+), 7 deletions(-) diff --git a/deal.II/deal.II/include/grid/tria.h b/deal.II/deal.II/include/grid/tria.h index 0ded2fd825..1f39010195 100644 --- a/deal.II/deal.II/include/grid/tria.h +++ b/deal.II/deal.II/include/grid/tria.h @@ -3064,6 +3064,37 @@ class Triangulation : public TriaDimensionInfo, */ unsigned int n_active_cells (const unsigned int level) const; + /** + * Return total number of used faces, + * active or not. + * Maps to n_lines() in two space + * dimensions and so on. + */ + unsigned int n_faces () const; + + /** + * Return total number of used faces, + * active or not, on level @p level. + * Maps to n_lines(level) in two space + * dimensions and so on. + */ + unsigned int n_faces (const unsigned int level) const; + + /** + * Return total number of active faces. + * Maps to n_active_lines() in two space + * dimensions and so on. + */ + unsigned int n_active_faces () const; + + /** + * Return total number of active faces + * on level @p level. + * Maps to n_active_lines(level) in two + * space dimensions and so on. + */ + unsigned int n_active_faces (const unsigned int level) const; + /** * Return number of levels in use. This * may be less than the number of levels diff --git a/deal.II/deal.II/source/grid/tria.all_dimensions.cc b/deal.II/deal.II/source/grid/tria.all_dimensions.cc index b3f53e477c..31d71d0360 100644 --- a/deal.II/deal.II/source/grid/tria.all_dimensions.cc +++ b/deal.II/deal.II/source/grid/tria.all_dimensions.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -114,7 +114,6 @@ CellData<3>::rotate (const unsigned int times) } - bool SubCellData::check_consistency (const unsigned int dim) const { diff --git a/deal.II/deal.II/source/grid/tria.cc b/deal.II/deal.II/source/grid/tria.cc index 9afb26c52e..76d6ab59d3 100644 --- a/deal.II/deal.II/source/grid/tria.cc +++ b/deal.II/deal.II/source/grid/tria.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -4031,7 +4031,8 @@ Triangulation::end_raw_hex (const unsigned int level) const { template typename TriaDimensionInfo::hex_iterator -Triangulation::end_hex (const unsigned int level) const { +Triangulation::end_hex (const unsigned int level) const +{ return (level == levels.size()-1 ? hex_iterator(end_hex()) : begin_hex (level+1)); @@ -4040,7 +4041,8 @@ Triangulation::end_hex (const unsigned int level) const { template typename TriaDimensionInfo::active_hex_iterator -Triangulation::end_active_hex (const unsigned int level) const { +Triangulation::end_active_hex (const unsigned int level) const +{ return (level == levels.size()-1 ? active_hex_iterator(end_hex()) : begin_active_hex (level+1)); @@ -4048,7 +4050,8 @@ Triangulation::end_active_hex (const unsigned int level) const { template -unsigned int Triangulation::n_cells () const { +unsigned int Triangulation::n_cells () const +{ unsigned int n=0; for (unsigned int l=0; l::n_cells () const { template -unsigned int Triangulation::n_active_cells () const { +unsigned int Triangulation::n_active_cells () const +{ unsigned int n=0; for (unsigned int l=0; l::n_active_cells () const { } +template +unsigned int Triangulation::n_faces () const +{ + unsigned int n=0; + for (unsigned int l=0; l +unsigned int Triangulation::n_active_faces () const +{ + unsigned int n=0; + for (unsigned int l=0; l +unsigned int +Triangulation::n_faces(unsigned int l) const +{ + if (dim==2) return n_lines(l); + if (dim==3) return n_quads(l); + return 0; +} + + + +template +unsigned int +Triangulation::n_active_faces(unsigned int l) const +{ + if (dim==2) return n_active_lines(l); + if (dim==3) return n_active_quads(l); + return 0; +} + + + #if deal_II_dimension == 1 template <> -- 2.39.5