From: Wolfgang Bangerth Date: Thu, 23 Feb 2006 21:14:28 +0000 (+0000) Subject: Adjust the interfaces of all the collection classes to be similar, including the... X-Git-Tag: v8.0.0~12200 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=951ce4df241bbace4dad5951f56558fc398d239e;p=dealii.git Adjust the interfaces of all the collection classes to be similar, including the availability of a conversion and a copy constructor. With these two constructors, we can now use an hp::FEValues object everywhere, irrespective of whether we use ::DoFHandler or hp::DoFHandler. git-svn-id: https://svn.dealii.org/trunk@12482 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/fe/fe_collection.h b/deal.II/deal.II/include/fe/fe_collection.h index 10e18bdc79..7c9b5cffa6 100644 --- a/deal.II/deal.II/include/fe/fe_collection.h +++ b/deal.II/deal.II/include/fe/fe_collection.h @@ -43,6 +43,32 @@ namespace hp class FECollection : public Subscriptor { public: + /** + * Default constructor. Leads + * to an empty collection that + * can later be filled using + * push_back(). + */ + FECollection (); + + /** + * Conversion constructor. This + * constructor creates a + * FECollection from a single + * finite element. More finite + * element objects can be added + * with push_back(), if + * desired, though it would + * probably be clearer to add + * all mappings the same way. + */ + FECollection (const FiniteElement &fe); + + /** + * Copy constructor. + */ + FECollection (const FECollection &fe_collection); + /** * Add a finite element. This * function generates a copy of diff --git a/deal.II/deal.II/include/fe/mapping_collection.h b/deal.II/deal.II/include/fe/mapping_collection.h index 94c2198ce4..6b3ea115c5 100644 --- a/deal.II/deal.II/include/fe/mapping_collection.h +++ b/deal.II/deal.II/include/fe/mapping_collection.h @@ -54,8 +54,10 @@ namespace hp { public: /** - * Default constructor. Initialises - * this MappingCollection. + * Default constructor. Leads + * to an empty collection that + * can later be filled using + * push_back(). */ MappingCollection (); diff --git a/deal.II/deal.II/include/fe/q_collection.h b/deal.II/deal.II/include/fe/q_collection.h index ede19a556b..c16a7479f1 100644 --- a/deal.II/deal.II/include/fe/q_collection.h +++ b/deal.II/deal.II/include/fe/q_collection.h @@ -46,21 +46,31 @@ namespace hp { public: /** - * Default constructor. Initialises - * this QCollection. + * Default constructor. Leads + * to an empty collection that + * can later be filled using + * push_back(). */ QCollection (); /** * Conversion constructor. This - * constructor creates a QCollection - * from a single quadrature rule. In - * the newly created QCollection, this - * quadrature is used for all active_fe - * indices. + * constructor creates a + * QCollection from a single + * quadrature rule. More + * quadrature formulas can be + * added with push_back(), if + * desired, though it would + * probably be clearer to add + * all mappings the same way. */ QCollection (const Quadrature &quadrature); + /** + * Copy constructor. + */ + QCollection (const QCollection &q_collection); + /** * Adds a new quadrature rule * to the QCollection. The diff --git a/deal.II/deal.II/source/fe/fe_collection.cc b/deal.II/deal.II/source/fe/fe_collection.cc index 17f6dc310b..ef885c58d3 100644 --- a/deal.II/deal.II/source/fe/fe_collection.cc +++ b/deal.II/deal.II/source/fe/fe_collection.cc @@ -17,6 +17,41 @@ namespace hp { + template + FECollection::FECollection () + {} + + + + template + FECollection::FECollection (const FiniteElement &fe) + { + push_back (fe); + } + + + + template + FECollection:: + FECollection (const FECollection &fe_collection) + : + Subscriptor (), + // copy the array + // of shared + // pointers. nothing + // bad should + // happen -- they + // simply all point + // to the same + // objects, and the + // last one to die + // will delete the + // mappings + finite_elements (fe_collection.finite_elements) + {} + + + template void FECollection::push_back (const FiniteElement &new_fe) { diff --git a/deal.II/deal.II/source/fe/q_collection.cc b/deal.II/deal.II/source/fe/q_collection.cc index 384fed1e12..29332fbd66 100644 --- a/deal.II/deal.II/source/fe/q_collection.cc +++ b/deal.II/deal.II/source/fe/q_collection.cc @@ -39,7 +39,28 @@ namespace hp template - inline + QCollection:: + QCollection (const QCollection &q_collection) + : + Subscriptor (), + // copy the array + // of shared + // pointers. nothing + // bad should + // happen -- they + // simply all point + // to the same + // objects, and the + // last one to die + // will delete the + // mappings + quadratures (q_collection.quadratures), + single_quadrature (true) + {} + + + + template const Quadrature & QCollection::operator[] (const unsigned int index) const {