From 4a0baa8b9f3ad51ffd8e92000362ce3ec225feff Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 23 Feb 2006 21:18:34 +0000 Subject: [PATCH] Further simplify the interface, by removing the single_quadrature hack in QCollection, and letting all the *Collection::operator[] functions be inline in the header file. git-svn-id: https://svn.dealii.org/trunk@12483 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/fe/mapping_collection.h | 12 +++++++ deal.II/deal.II/include/fe/q_collection.h | 27 +++++++-------- .../deal.II/source/fe/mapping_collection.cc | 12 +------ deal.II/deal.II/source/fe/q_collection.cc | 34 ++----------------- 4 files changed, 27 insertions(+), 58 deletions(-) diff --git a/deal.II/deal.II/include/fe/mapping_collection.h b/deal.II/deal.II/include/fe/mapping_collection.h index 6b3ea115c5..7f53a4c7de 100644 --- a/deal.II/deal.II/include/fe/mapping_collection.h +++ b/deal.II/deal.II/include/fe/mapping_collection.h @@ -155,6 +155,18 @@ namespace hp { return mappings.size(); } + + + + template + inline + const Mapping & + MappingCollection::operator[] (const unsigned int index) const + { + Assert (index < mappings.size (), + ExcIndexRange (index, 0, mappings.size ())); + return *mappings[index]; + } } // namespace hp diff --git a/deal.II/deal.II/include/fe/q_collection.h b/deal.II/deal.II/include/fe/q_collection.h index c16a7479f1..b438427ccd 100644 --- a/deal.II/deal.II/include/fe/q_collection.h +++ b/deal.II/deal.II/include/fe/q_collection.h @@ -129,21 +129,6 @@ namespace hp DeclException0 (ExcNoQuadrature); private: - /** - * Upon construction of a - * QCollection the later - * functionality of the class is - * specified. Either it is a real - * collection, which provides different - * quadrature rules for each - * active_fe_index or its a "unreal" - * collection, which returns a the same - * quadrature rule for all - * active_fe_indices. This boolean - * remembers which type this object is. - */ - const bool single_quadrature; - /** * The real container, which stores * pointers to the different quadrature @@ -163,6 +148,18 @@ namespace hp { return quadratures.size(); } + + + + template + inline + const Quadrature & + QCollection::operator[] (const unsigned int index) const + { + Assert (index < quadratures.size (), + ExcIndexRange (index, 0, quadratures.size ())); + return *quadratures[index]; + } } // namespace hp diff --git a/deal.II/deal.II/source/fe/mapping_collection.cc b/deal.II/deal.II/source/fe/mapping_collection.cc index a19695dc8c..93f54861d0 100644 --- a/deal.II/deal.II/source/fe/mapping_collection.cc +++ b/deal.II/deal.II/source/fe/mapping_collection.cc @@ -55,17 +55,6 @@ namespace hp - template - inline - const Mapping & - MappingCollection::operator[] (const unsigned int index) const - { - Assert (index < mappings.size (), - ExcIndexRange (index, 0, mappings.size ())); - return *mappings[index]; - } - - template unsigned int MappingCollection::memory_consumption () const @@ -74,6 +63,7 @@ namespace hp MemoryConsumption::memory_consumption (mappings)); } + template void diff --git a/deal.II/deal.II/source/fe/q_collection.cc b/deal.II/deal.II/source/fe/q_collection.cc index 29332fbd66..a8066cc9e5 100644 --- a/deal.II/deal.II/source/fe/q_collection.cc +++ b/deal.II/deal.II/source/fe/q_collection.cc @@ -21,16 +21,11 @@ namespace hp template QCollection::QCollection () - : - single_quadrature (false) - { - } + {} template QCollection::QCollection (const Quadrature &quadrature) - : - single_quadrature (true) { quadratures .push_back (boost::shared_ptr >(new Quadrature(quadrature))); @@ -54,31 +49,11 @@ namespace hp // last one to die // will delete the // mappings - quadratures (q_collection.quadratures), - single_quadrature (true) + quadratures (q_collection.quadratures) {} - template - const Quadrature & - QCollection::operator[] (const unsigned int index) const - { - // if we have only a single quadrature - // that was given during construction, - // return this one. otherwise pick out - // the correct one - if (single_quadrature) - return *quadratures[0]; - else - { - Assert (index < quadratures.size (), - ExcIndexRange (index, 0, quadratures.size ())); - return *quadratures[index]; - } - } - - template unsigned int QCollection::memory_consumption () const @@ -92,11 +67,6 @@ namespace hp void QCollection::push_back (const Quadrature &new_quadrature) { - // A QCollection, which was initialized - // as single QCollection cannot - // administrate other Quadratures. - Assert (!single_quadrature, ExcNotInitialized ()); - quadratures .push_back (boost::shared_ptr >(new Quadrature(new_quadrature))); } -- 2.39.5