get_fe () const;
/**
- * Returns the index inside the FECollection
- * of the FiniteElement used for this cell.
+ * Returns the index inside the
+ * hp::FECollection of the FiniteElement
+ * used for this cell.
*/
unsigned int active_fe_index () const;
get_fe () const;
/**
- * Returns the index inside the FECollection
- * of the FiniteElement used for this cell.
+ * Returns the index inside the
+ * hp::FECollection of the FiniteElement
+ * used for this cell.
*/
unsigned int active_fe_index () const;
get_fe () const;
/**
- * Returns the index inside the FECollection
- * of the FiniteElement used for this cell.
+ * Returns the index inside the
+ * hp::FECollection of the FiniteElement
+ * used for this cell.
*/
unsigned int active_fe_index () const;
get_fe () const;
/**
- * Returns the index inside the FECollection
- * of the FiniteElement used for this cell.
+ * Returns the index inside the
+ * hp::FECollection of the FiniteElement
+ * used for this cell.
*/
unsigned int active_fe_index () const;
* releases the lock of this
* object to the finite element.
*/
- virtual void distribute_dofs (const FECollection<dim> &fe);
+ virtual void distribute_dofs (const hp::FECollection<dim> &fe);
/**
* Clear all data of this object and
* objects that are used by this
* @p DoFHandler.
*/
- const FECollection<dim> & get_fe () const;
+ const hp::FECollection<dim> & get_fe () const;
/**
* Return a constant reference to the
* (this clears all data of this
* object as well, though).
*/
- SmartPointer<const FECollection<dim> > finite_elements;
+ SmartPointer<const hp::FECollection<dim> > finite_elements;
private:
* Make accessor objects friends.
*/
template <int dim1, int dim2, template <int> class DH> friend class DoFObjectAccessor;
-
- /**
- * Make Triangulation friend.
- */
-// friend class Triangulation<dim>;
};
template <int dim>
inline
- const FECollection<dim> &
+ const hp::FECollection<dim> &
DoFHandler<dim>::get_fe () const
{
return *finite_elements;
* hierarchy.
*
* In @ref{DoFLevel<0>} all data is stored which is not dependent on the
- * dimension, e.g. a field to store the index referring to the FECollection
- * class. The data therefore corresponds to cells, rather than vertices,
- * lines, quads, etc.
+ * dimension, e.g. a field to store the index referring to the
+ * hp::FECollection class. The data therefore corresponds to cells, rather
+ * than vertices, lines, quads, etc.
*/
template <>
class DoFLevel<0>
{
public:
/**
- * Indices specifying the finite element
- * of FECollection to use for the
- * different cells. The meaning
- * what a cell is, is dimension specific,
- * therefore also the length of this
- * vector depends on the dimension: in
- * one dimension, the length of this
- * vector equals the length of the
- * @p lines vector, in two dimensions
- * that of the @p quads vector, etc.
+ * Indices specifying the finite
+ * element of hp::FECollection to use
+ * for the different cells. The
+ * meaning what a cell is, is
+ * dimension specific, therefore also
+ * the length of this vector depends
+ * on the dimension: in one dimension,
+ * the length of this vector equals
+ * the length of the @p lines vector,
+ * in two dimensions that of the @p
+ * quads vector, etc.
*/
std::vector<unsigned int> active_fe_indices;
// $Id$
// Version: $Name$
//
-// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
template <int dim> class FEFaceValues;
template <int dim> class FESubfaceValues;
template <int dim> class FESystem;
-template <int dim> class FECollection;
+namespace hp
+{
+ template <int dim> class FECollection;
+}
+
/*!@addtogroup febase */
/*@{*/
*
* This function is needed by the
* constructors of FESystem as well
- * as by the FECollection class.
+ * as by the hp::FECollection class.
*/
virtual FiniteElement<dim> *clone() const = 0;
friend class FEFaceValues<dim>;
friend class FESubfaceValues<dim>;
friend class FESystem<dim>;
- friend class FECollection<dim>;
+ friend class hp::FECollection<dim>;
};
/*@}*/
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003, 2004 by the deal.II authors
+// Copyright (C) 2003, 2004, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#define __deal2__fe_collection_h
#include <base/config.h>
-#include <base/subscriptor.h>
+#include <boost/shared_ptr.hpp>
#include <fe/fe.h>
+namespace hp
+{
+
/**
* This class acts as a collection of finite element objects used in the
- * hp::DoFHandler(). It is thus to a hp::DoFHandler() what a
- * FiniteElement is to a DoFHandler. This collection stores copies
+ * hp::DoFHandler. It is thus to a hp::DoFHandler what a
+ * FiniteElement is to a ::DoFHandler. This collection stores copies
* of the original elements added to it, and is therefore handling its memory
* manegement itself.
*
*
* @author Wolfgang Bangerth, 2003
*/
-template <int dim>
-class FECollection : public Subscriptor
-{
- public:
- /**
- * Destructor. Destroy the elements of
- * the collection.
- */
- ~FECollection ();
+ template <int dim>
+ class FECollection : public Subscriptor
+ {
+ public:
+ /**
+ * Add a finite element. This function
+ * generates a copy of the given
+ * element, i.e. you can do things like
+ * <tt>add_fe(FE_Q<dim>(1));</tt>. The
+ * internal copy is later destroyed by
+ * this object upon destruction of the
+ * entire collection.
+ *
+ * The returned value is the new number
+ * of finite elements in the collection.
+ *
+ * When a new element is added, it needs
+ * to have the same number of vector
+ * components as all other elements
+ * already in the collection.
+ */
+ unsigned int
+ add_fe (const FiniteElement<dim> &new_fe);
+
+ /**
+ * Get a reference to the given element
+ * in this collection.
+ */
+ const FiniteElement<dim> &
+ get_fe (const unsigned int index) const;
+
+ /**
+ * Return the number of finite element
+ * objects stored in this collection.
+ */
+ unsigned int n_finite_elements () const;
+
+ /**
+ * Return the number of vector
+ * components of the finite elements in
+ * this collection. This number must
+ * be the same for all elements in the
+ * collection.
+ */
+ unsigned int n_components () const;
+
+ /**
+ * Return the maximal number of degrees
+ * of freedom per vertex over all
+ * elements of this collection.
+ */
+ unsigned int max_dofs_per_vertex () const;
+
+ /**
+ * Return the maximal number of degrees
+ * of freedom per line over all elements
+ * of this collection.
+ */
+ unsigned int max_dofs_per_line () const;
+
+ /**
+ * Return the maximal number of degrees
+ * of freedom per quad over all elements
+ * of this collection.
+ */
+ unsigned int max_dofs_per_quad () const;
+
+ /**
+ * Return the maximal number of degrees
+ * of freedom per hex over all elements
+ * of this collection.
+ */
+ unsigned int max_dofs_per_hex () const;
+
+ /**
+ * Return the maximal number of degrees
+ * of freedom per face over all elements
+ * of this collection.
+ */
+ unsigned int max_dofs_per_face () const;
+
+ /**
+ * Return the maximal number of degrees
+ * of freedom per cell over all elements
+ * of this collection.
+ */
+ unsigned int max_dofs_per_cell () const;
+
+ /**
+ * Return an estimate for the memory
+ * allocated for this object.
+ */
+ unsigned int memory_consumption () const;
+
+ /**
+ * Exception
+ */
+ DeclException0 (ExcNoFiniteElements);
- /**
- * Add a finite element. This function
- * generates a copy of the given element,
- * i.e. you can do things like
- * <tt>add_fe(FE_Q<dim>(1));</tt>. The
- * internal copy is later destroyed by
- * this object upon destruction of the
- * entire collection.
- *
- * The returned value is the new number
- * of finite elements in the collection.
- *
- * When a new element is added, it needs
- * to have the same number of vector
- * components as all other elements
- * already in the collection.
- */
- unsigned int
- add_fe (const FiniteElement<dim> &new_fe);
-
- /**
- * Get a reference to the given element
- * in this collection.
- */
- const FiniteElement<dim> &
- get_fe (const unsigned int index) const;
-
- /**
- * Return the number of finite element
- * objects stored in this collection.
- */
- unsigned int n_finite_elements () const;
-
- /**
- * Return the number of vector components
- * of the finite elements in this
- * collection. This number must be the
- * same for all elements in the
- * collection.
- */
- unsigned int n_components () const;
-
- /**
- * Return the maximal number of degrees
- * of freedom per vertex over all
- * elements of this collection.
- */
- unsigned int max_dofs_per_vertex () const;
-
- /**
- * Return the maximal number of degrees
- * of freedom per line over all elements
- * of this collection.
- */
- unsigned int max_dofs_per_line () const;
-
- /**
- * Return the maximal number of degrees
- * of freedom per quad over all elements
- * of this collection.
- */
- unsigned int max_dofs_per_quad () const;
-
- /**
- * Return the maximal number of degrees
- * of freedom per hex over all elements
- * of this collection.
- */
- unsigned int max_dofs_per_hex () const;
-
- /**
- * Return the maximal number of degrees
- * of freedom per face over all elements
- * of this collection.
- */
- unsigned int max_dofs_per_face () const;
-
- /**
- * Return the maximal number of degrees
- * of freedom per cell over all elements
- * of this collection.
- */
- unsigned int max_dofs_per_cell () const;
-
- /**
- * Return an estimate for the memory
- * allocated for this object.
- */
- unsigned int memory_consumption () const;
-
- /**
- * Exception
- */
- DeclException0 (ExcNoFiniteElements);
-
- private:
- /**
- * Array of pointers to the finite
- * elements stored by this collection.
- */
- std::vector<SmartPointer<const FiniteElement<dim> > > finite_elements;
-};
+ private:
+ /**
+ * Array of pointers to the finite
+ * elements stored by this collection.
+ */
+ std::vector<boost::shared_ptr<const FiniteElement<dim> > > finite_elements;
+ };
/* --------------- inline functions ------------------- */
-template <int dim>
-inline
-unsigned int
-FECollection<dim>::n_finite_elements () const
-{
- return finite_elements.size();
-}
-
-
-template <int dim>
-inline
-unsigned int
-FECollection<dim>::n_components () const
-{
- Assert (finite_elements.size () > 0, ExcNoFiniteElements());
- return finite_elements[0]->n_components ();
-}
-
-
-template <int dim>
-inline
-const FiniteElement<dim> &
-FECollection<dim>::get_fe (const unsigned int index) const
-{
- Assert (index < finite_elements.size(),
- ExcIndexRange (index, 0, finite_elements.size()));
- return *finite_elements[index];
-}
-
-
-
-template <int dim>
-unsigned int
-FECollection<dim>::max_dofs_per_vertex () const
-{
- Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+ template <int dim>
+ inline
+ unsigned int
+ FECollection<dim>::n_finite_elements () const
+ {
+ return finite_elements.size();
+ }
+
+
+ template <int dim>
+ inline
+ unsigned int
+ FECollection<dim>::n_components () const
+ {
+ Assert (finite_elements.size () > 0, ExcNoFiniteElements());
+ return finite_elements[0]->n_components ();
+ }
+
+
+ template <int dim>
+ inline
+ const FiniteElement<dim> &
+ FECollection<dim>::get_fe (const unsigned int index) const
+ {
+ Assert (index < finite_elements.size(),
+ ExcIndexRange (index, 0, finite_elements.size()));
+ return *finite_elements[index];
+ }
+
+
+
+ template <int dim>
+ unsigned int
+ FECollection<dim>::max_dofs_per_vertex () const
+ {
+ Assert (finite_elements.size() > 0, ExcNoFiniteElements());
- unsigned int max = 0;
- for (unsigned int i=0; i<finite_elements.size(); ++i)
- if (finite_elements[i]->dofs_per_vertex > max)
- max = finite_elements[i]->dofs_per_vertex;
+ unsigned int max = 0;
+ for (unsigned int i=0; i<finite_elements.size(); ++i)
+ if (finite_elements[i]->dofs_per_vertex > max)
+ max = finite_elements[i]->dofs_per_vertex;
- return max;
-}
+ return max;
+ }
-template <int dim>
-unsigned int
-FECollection<dim>::max_dofs_per_line () const
-{
- Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+ template <int dim>
+ unsigned int
+ FECollection<dim>::max_dofs_per_line () const
+ {
+ Assert (finite_elements.size() > 0, ExcNoFiniteElements());
- unsigned int max = 0;
- for (unsigned int i=0; i<finite_elements.size(); ++i)
- if (finite_elements[i]->dofs_per_line > max)
- max = finite_elements[i]->dofs_per_line;
+ unsigned int max = 0;
+ for (unsigned int i=0; i<finite_elements.size(); ++i)
+ if (finite_elements[i]->dofs_per_line > max)
+ max = finite_elements[i]->dofs_per_line;
- return max;
-}
+ return max;
+ }
-template <int dim>
-unsigned int
-FECollection<dim>::max_dofs_per_quad () const
-{
- Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+ template <int dim>
+ unsigned int
+ FECollection<dim>::max_dofs_per_quad () const
+ {
+ Assert (finite_elements.size() > 0, ExcNoFiniteElements());
- unsigned int max = 0;
- for (unsigned int i=0; i<finite_elements.size(); ++i)
- if (finite_elements[i]->dofs_per_quad > max)
- max = finite_elements[i]->dofs_per_quad;
+ unsigned int max = 0;
+ for (unsigned int i=0; i<finite_elements.size(); ++i)
+ if (finite_elements[i]->dofs_per_quad > max)
+ max = finite_elements[i]->dofs_per_quad;
- return max;
-}
+ return max;
+ }
-template <int dim>
-unsigned int
-FECollection<dim>::max_dofs_per_hex () const
-{
- Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+ template <int dim>
+ unsigned int
+ FECollection<dim>::max_dofs_per_hex () const
+ {
+ Assert (finite_elements.size() > 0, ExcNoFiniteElements());
- unsigned int max = 0;
- for (unsigned int i=0; i<finite_elements.size(); ++i)
- if (finite_elements[i]->dofs_per_hex > max)
- max = finite_elements[i]->dofs_per_hex;
+ unsigned int max = 0;
+ for (unsigned int i=0; i<finite_elements.size(); ++i)
+ if (finite_elements[i]->dofs_per_hex > max)
+ max = finite_elements[i]->dofs_per_hex;
- return max;
-}
+ return max;
+ }
-template <int dim>
-unsigned int
-FECollection<dim>::max_dofs_per_face () const
-{
- Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+ template <int dim>
+ unsigned int
+ FECollection<dim>::max_dofs_per_face () const
+ {
+ Assert (finite_elements.size() > 0, ExcNoFiniteElements());
- unsigned int max = 0;
- for (unsigned int i=0; i<finite_elements.size(); ++i)
- if (finite_elements[i]->dofs_per_face > max)
- max = finite_elements[i]->dofs_per_face;
+ unsigned int max = 0;
+ for (unsigned int i=0; i<finite_elements.size(); ++i)
+ if (finite_elements[i]->dofs_per_face > max)
+ max = finite_elements[i]->dofs_per_face;
- return max;
-}
+ return max;
+ }
-template <int dim>
-unsigned int
-FECollection<dim>::max_dofs_per_cell () const
-{
- Assert (finite_elements.size() > 0, ExcNoFiniteElements());
+ template <int dim>
+ unsigned int
+ FECollection<dim>::max_dofs_per_cell () const
+ {
+ Assert (finite_elements.size() > 0, ExcNoFiniteElements());
- unsigned int max = 0;
- for (unsigned int i=0; i<finite_elements.size(); ++i)
- if (finite_elements[i]->dofs_per_cell > max)
- max = finite_elements[i]->dofs_per_cell;
-
- return max;
-}
+ unsigned int max = 0;
+ for (unsigned int i=0; i<finite_elements.size(); ++i)
+ if (finite_elements[i]->dofs_per_cell > max)
+ max = finite_elements[i]->dofs_per_cell;
+ return max;
+ }
+
+} // namespace hp
+
#endif
* indicated by the parameters
* to the constructor.
*/
- FEValuesBase (const MappingCollection<dim> &mapping_collection,
- const QCollection<q_dim> &qcollection,
+ FEValuesBase (const hp::MappingCollection<dim> &mapping_collection,
+ const hp::QCollection<q_dim> &q_collection,
const UpdateFlags update_flags);
* object for the mapping
* object.
*/
- FEValuesBase (const QCollection<q_dim> &qcollection,
+ FEValuesBase (const hp::QCollection<q_dim> &q_collection,
const UpdateFlags update_flags);
protected:
/**
- * A copy of the MappingCollection
+ * A copy of the hp::MappingCollection
* object, which was specified
* upon construction of the
* object.
*/
- const MappingCollection<dim> mapping_collection;
+ const hp::MappingCollection<dim> mapping_collection;
/**
* Copy of the quadrature
* provided to the
* constructor.
*/
- const QCollection<q_dim> qcollection;
+ const hp::QCollection<q_dim> q_collection;
/**
* Values of the update flags as
* DoFHandler<tt>::get_fe()</tt>
* function.
*/
- FEValues (const MappingCollection<dim> &mapping_collection,
- const FECollection<dim> &fe_collection,
- const QCollection<dim> &qcollection,
+ FEValues (const hp::MappingCollection<dim> &mapping_collection,
+ const hp::FECollection<dim> &fe_collection,
+ const hp::QCollection<dim> &q_collection,
const UpdateFlags update_flags);
* DoFHandler<tt>::get_fe()</tt>
* function.
*/
- FEValues (const FECollection<dim> &fe_collection,
- const QCollection<dim> &qcollection,
- const UpdateFlags update_flags);
+ FEValues (const hp::FECollection<dim> &fe_collection,
+ const hp::QCollection<dim> &q_collection,
+ const UpdateFlags update_flags);
/**
* DoFHandler<tt>::get_fe()</tt>
* function.
*/
- FEFaceValues (const MappingCollection<dim> &mapping_collection,
- const FECollection<dim> &fe_collection,
- const QCollection<dim-1> &qcollection,
+ FEFaceValues (const hp::MappingCollection<dim> &mapping_collection,
+ const hp::FECollection<dim> &fe_collection,
+ const hp::QCollection<dim-1> &q_collection,
const UpdateFlags update_flags);
* DoFHandler<tt>::get_fe()</tt>
* function.
*/
- FEFaceValues (const FECollection<dim> &fe_collection,
- const QCollection<dim-1> &qcollection,
- const UpdateFlags update_flags);
+ FEFaceValues (const hp::FECollection<dim> &fe_collection,
+ const hp::QCollection<dim-1> &q_collection,
+ const UpdateFlags update_flags);
/**
* DoFHandler<tt>::get_fe()</tt>
* function.
*/
- FESubfaceValues (const MappingCollection<dim> &mapping_collection,
- const FECollection<dim> &fe_collection,
- const QCollection<dim-1> &qcollection,
+ FESubfaceValues (const hp::MappingCollection<dim> &mapping_collection,
+ const hp::FECollection<dim> &fe_collection,
+ const hp::QCollection<dim-1> &q_collection,
const UpdateFlags update_flags);
* DoFHandler<tt>::get_fe()</tt>
* function.
*/
- FESubfaceValues (const FECollection<dim> &fe_collection,
- const QCollection<dim-1> &qcollection,
- const UpdateFlags update_flags);
+ FESubfaceValues (const hp::FECollection<dim> &fe_collection,
+ const hp::QCollection<dim-1> &q_collection,
+ const UpdateFlags update_flags);
/**
// $Id$
// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* each grid cell.
*/
virtual UpdateFlags update_each (const UpdateFlags) const = 0;
+
+ /**
+ * Return a pointer to a copy of the
+ * present object. The caller of this
+ * copy then assumes ownership of it.
+ *
+ * Since one can't create
+ * objects of class Mapping, this
+ * function of course has to be
+ * implemented by derived classes.
+ *
+ * This function is mainly used by the
+ * hp::MappingCollection class.
+ */
+ virtual
+ Mapping<dim> * clone () const = 0;
/**
* Exception
// $Id$
// Version: $Name$
//
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
MappingC1 ();
+ /**
+ * Return a pointer to a copy of the
+ * present object. The caller of this
+ * copy then assumes ownership of it.
+ */
+ virtual
+ Mapping<dim> * clone () const;
+
protected:
/**
* For <tt>dim=2,3</tt>. Append the
// $Id$
// Version: $Name$
//
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
virtual UpdateFlags update_once (const UpdateFlags) const;
virtual UpdateFlags update_each (const UpdateFlags) const;
- /**
+
+ /**
+ * Return a pointer to a copy of the
+ * present object. The caller of this
+ * copy then assumes ownership of it.
+ */
+ virtual
+ Mapping<dim> * clone () const;
+
+ /**
* Exception
*/
DeclException0 (ExcInvalidData);
// $Id$
// Version: $Name$
//
-// Copyright (C) 2005 by the deal.II authors
+// Copyright (C) 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <base/config.h>
#include <base/subscriptor.h>
-#include <base/smartpointer.h>
#include <fe/mapping.h>
#include <fe/fe.h>
#include <boost/shared_ptr.hpp>
+namespace hp
+{
/**
- * This class implements a collection of mapping objects used in the
- * hp::DoFHandler(). It is thus to a hp::DoFHandler() what a Mapping is to a
- * DoFHandler. This collection stores pointers to the original mapping
- * objects added to it. Hence the handling of the memory consumed by
- * the mapping objects must be done by the user of the class.
+ * This class implements a collection of mapping objects in the same way as
+ * the hp::FECollection implements a collection of finite element classes.
*
- * Although it is strongly recommended to supply an appropriate mapping
- * for each finite element type used in a hp-computation, the MappingCollection
- * class implements a conversion constructor from a single mapping.
- * Therefore it is possible to offer only a single mapping to the
- * hpFEValues class instead of a MappingCollection. This is for the
- * convenience of the user, as many simple geometries do not require
- * different mappings along the boundary to achieve optimal convergence rates.
- * Hence providing a single mapping object will usually suffice.
+ * Although it is recommended to supply an appropriate mapping for each finite
+ * element kind used in a hp-computation, the MappingCollection class
+ * implements a conversion constructor from a single mapping. Therefore it is
+ * possible to offer only a single mapping to the hpFEValues class instead of
+ * a MappingCollection. This is for the convenience of the user, as many
+ * simple geometries do not require different mappings along the boundary to
+ * achieve optimal convergence rates. Hence providing a single mapping object
+ * will usually suffice.
*
* @author Oliver Kayser-Herold, 2005
*/
-template <int dim>
-class MappingCollection : public Subscriptor
-{
- public:
- /**
- * Default constructor. Initialises
- * this QCollection.
- */
- MappingCollection ();
-
- /**
- * Conversion constructor. This
- * constructor creates a MappingCollection
- * from a single mapping. In
- * the newly created MappingCollection, this
- * mapping is used for all active_fe
- * indices.
- */
- MappingCollection (const Mapping<dim> &mapping);
-
- /**
- * Returns the number of mapping
- * objects stored in this container.
- */
- unsigned int n_mappings () const;
-
- /**
- * Returns the mapping object which
- * was specified by the user for the
- * active_fe_index which is provided
- * as a parameter to this method.
- */
- const Mapping<dim> &
- get_mapping (const unsigned int active_fe_index) const;
+ template <int dim>
+ class MappingCollection : public Subscriptor
+ {
+ public:
+ /**
+ * Default constructor. Initialises
+ * this MappingCollection.
+ */
+ MappingCollection ();
+
+ /**
+ * Conversion constructor. This
+ * constructor creates a MappingCollection
+ * from a single mapping. In
+ * the newly created MappingCollection, this
+ * mapping is used for all active_fe
+ * indices.
+ */
+ MappingCollection (const Mapping<dim> &mapping);
+
+ /**
+ * Returns the number of mapping
+ * objects stored in this container.
+ */
+ unsigned int n_mappings () const;
+
+ /**
+ * Returns the mapping object which
+ * was specified by the user for the
+ * active_fe_index which is provided
+ * as a parameter to this method.
+ */
+ const Mapping<dim> &
+ get_mapping (const unsigned int active_fe_index) const;
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-
- /**
- * Adds a new mapping to the MappingCollection.
- * The mappings have to be added in the order
- * of the active_fe_indices. Thus the reference
- * to the mapping object for active_fe_index 0
- * has to be added first, followed by the
- * mapping object for active_fe_index 1.
- */
- unsigned int add_mapping (const Mapping<dim> &new_mapping);
-
- private:
- /**
- * Upon construction of a <tt>MappingCollection</tt>
- * the later functionality of the class is specified.
- * Either it is a real collection, which provides
- * different mappings for each active_fe_index
- * or its a "unreal" collection, which returns
- * a the same mapping for all active_fe_indices.
- * This boolean remembers which type this object
- * is.
- */
- bool single_mapping;
-
- /**
- * The real container, which stores pointers
- * to the different Mapping objects.
- */
- std::vector<SmartPointer<const Mapping<dim> > > mappings;
-};
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
+ /**
+ * Adds a new mapping to the
+ * MappingCollection. The mappings
+ * have to be added in the order of the
+ * active_fe_indices. Thus the
+ * reference to the mapping object for
+ * active_fe_index 0 has to be added
+ * first, followed by the mapping
+ * object for active_fe_index 1.
+ */
+ unsigned int add_mapping (const Mapping<dim> &new_mapping);
+
+ private:
+ /**
+ * Upon construction of a
+ * <tt>MappingCollection</tt> the later
+ * functionality of the class is
+ * specified. Either it is a real
+ * collection, which provides different
+ * mappings for each active_fe_index or
+ * its a "unreal" collection, which
+ * returns a the same mapping for all
+ * active_fe_indices. This boolean
+ * remembers which type this object is.
+ */
+ const bool single_mapping;
+
+ /**
+ * The real container, which stores
+ * pointers to the different Mapping
+ * objects.
+ */
+ std::vector<boost::shared_ptr<const Mapping<dim> > > mappings;
+ };
/* --------------- inline functions ------------------- */
-template <int dim>
-inline
-unsigned int
-MappingCollection<dim>::n_mappings () const
-{
+ template <int dim>
+ inline
+ unsigned int
+ MappingCollection<dim>::n_mappings () const
+ {
return mappings.size();
-}
+ }
+
+} // namespace hp
#endif
// $Id$
// Version: $Name$
//
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* was passed to the constructor.
*/
unsigned int get_degree () const;
+
+ /**
+ * Return a pointer to a copy of the
+ * present object. The caller of this
+ * copy then assumes ownership of it.
+ */
+ virtual
+ Mapping<dim> * clone () const;
/**
* Storage for internal data of
// $Id$
// Version: $Name$
//
-// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
virtual UpdateFlags update_each (const UpdateFlags flags) const;
+ /**
+ * Return a pointer to a copy of the
+ * present object. The caller of this
+ * copy then assumes ownership of it.
+ */
+ virtual
+ Mapping<dim> * clone () const;
+
/**
* Storage for internal data of
* d-linear transformation.
// $Id$
// Version: $Name$
//
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
*/
MappingQ1Eulerian (const EulerVectorType &euler_transform_vectors,
const DoFHandler<dim> &shiftmap_dof_handler);
+
+ /**
+ * Return a pointer to a copy of the
+ * present object. The caller of this
+ * copy then assumes ownership of it.
+ */
+ virtual
+ Mapping<dim> * clone () const;
-
+
/**
* Exception
*/
// $Id$
// Version: $Name$
//
-// Copyright (C) 2005 by the deal.II authors
+// Copyright (C) 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <vector>
#include <boost/shared_ptr.hpp>
+
+namespace hp
+{
/**
- * This class implements a collection of quadrature objects used in the
- * hp::DoFHandler(). It is thus to a hp::DoFHandler() what a Quadrature is to a
- * DoFHandler. This collection stores pointers to the original quadrature
- * elements added to it. Hence the handling of the memory consumed by
- * the quadrature objects must be done by the user of the class.
+ * This class implements a collection of quadrature objects in the same way as
+ * the hp::FECollection implements a collection of finite element classes.
*
* Although it is strongly recommended to supply an appropriate quadrature
* for each finite element type used in a hp-computation, the QCollection
*
* @author Oliver Kayser-Herold, 2005
*/
-template <int dim>
-class QCollection : public Subscriptor
-{
- public:
- /**
- * Default constructor. Initialises
- * this QCollection.
- */
- 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.
- */
- QCollection (const Quadrature<dim> &quadrature);
-
- /**
- * Returns the number of quadrature
- * pointers stored in this object.
- */
- unsigned int n_quadratures () const;
-
- /**
- * Returns a reference to the quadrature rule which
- * was specified by the user for the
- * active_fe_index which is provided
- * as a parameter to this method.
- */
- const Quadrature<dim> &
- get_quadrature (const unsigned int active_fe_index) const;
+ template <int dim>
+ class QCollection : public Subscriptor
+ {
+ public:
+ /**
+ * Default constructor. Initialises
+ * this QCollection.
+ */
+ 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.
+ */
+ QCollection (const Quadrature<dim> &quadrature);
+
+ /**
+ * Returns the number of quadrature
+ * pointers stored in this object.
+ */
+ unsigned int n_quadratures () const;
+
+ /**
+ * Returns a reference to the
+ * quadrature rule which was specified
+ * by the user for the active_fe_index
+ * which is provided as a parameter to
+ * this method.
+ */
+ const Quadrature<dim> &
+ get_quadrature (const unsigned int active_fe_index) const;
+
+ /**
+ * Adds a new quadrature rule to the
+ * QCollection. The quadrature rules
+ * have to be added in the same order
+ * as for the FECollection for which
+ * this quadrature rule collection is
+ * meant. Thus the reference to the
+ * quadrature rule for active_fe_index
+ * 0 has to be added first, followed by
+ * the quadrature rule for
+ * active_fe_index 1.
+ *
+ * This class creates a copy of the
+ * given quadrature object, i.e. you
+ * can do things like
+ * <tt>add_quadrature(QGauss<dim>(3));</tt>. The
+ * internal copy is later destroyed by
+ * this object upon destruction of the
+ * entire collection.
+ */
+ unsigned int add_quadrature (const Quadrature<dim> &new_quadrature);
- /**
- * Determine an estimate for the
- * memory consumption (in bytes)
- * of this object.
- */
- unsigned int memory_consumption () const;
-
- /**
- * Adds a new quadrature rule to the QCollection.
- * The quadrature rules have to be added in the order
- * of the active_fe_indices. Thus the reference
- * to the quadrature rule for active_fe_index 0
- * has to be added first, followed by the
- * quadrature rule for active_fe_index 1.
- */
- unsigned int add_quadrature (const Quadrature<dim> &new_quadrature);
-
- DeclException0 (ExcNoQuadrature);
+ /**
+ * Determine an estimate for the
+ * memory consumption (in bytes)
+ * of this object.
+ */
+ unsigned int memory_consumption () const;
+
+ /**
+ * Exception
+ */
+ DeclException0 (ExcNoQuadrature);
- private:
- /**
- * Upon construction of a <tt>QCollection</tt>
- * 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.
- */
- bool single_quadrature;
-
- /**
- * The real container, which stores pointers
- * to the different quadrature objects.
- */
- std::vector<SmartPointer<const Quadrature<dim> > > quadratures;
-};
+ private:
+ /**
+ * Upon construction of a
+ * <tt>QCollection</tt> 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
+ * objects.
+ */
+ std::vector<boost::shared_ptr<const Quadrature<dim> > > quadratures;
+ };
/* --------------- inline functions ------------------- */
-template <int dim>
-inline
-unsigned int
-QCollection<dim>::n_quadratures () const
-{
+ template <int dim>
+ inline
+ unsigned int
+ QCollection<dim>::n_quadratures () const
+ {
return quadratures.size();
-}
+ }
+
+} // namespace hp
#endif
template <int dim>
- void DoFHandler<dim>::distribute_dofs (const FECollection<dim> &ff)
+ void DoFHandler<dim>::distribute_dofs (const hp::FECollection<dim> &ff)
{
Assert (tria->n_levels() > 0, ExcInvalidTriangulation());
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003, 2004 by the deal.II authors
+// Copyright (C) 2003, 2004, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <fe/fe_collection.h>
-template <int dim>
-FECollection<dim>::~FECollection ()
+namespace hp
{
- for (unsigned int i=0; i<finite_elements.size(); ++i)
- {
- const FiniteElement<dim> *p = finite_elements[i];
- finite_elements[i] = 0;
- delete p;
- }
+ template <int dim>
+ unsigned int FECollection<dim>::add_fe (const FiniteElement<dim> &new_fe)
+ {
+ // check that the new element has the right
+ // number of components. only check with
+ // the first element, since all the other
+ // elements have already passed the test
+ // against the first element
+ if (finite_elements.size() != 0)
+ Assert (new_fe.n_components() == finite_elements[0]->n_components(),
+ ExcMessage ("All elements inside a collection need to have the "
+ "same number of vector components!"));
- finite_elements.clear ();
-}
-
+ finite_elements
+ .push_back (boost::shared_ptr<const FiniteElement<dim> >(new_fe.clone()));
+
+ return finite_elements.size ();
+ }
-template <int dim>
-unsigned int FECollection<dim>::add_fe (const FiniteElement<dim> &new_fe)
-{
- // check that the new element has the right
- // number of components. only check with
- // the first element, since all the other
- // elements have already passed the test
- // against the first element
- if (finite_elements.size() != 0)
- Assert (new_fe.n_components() == finite_elements[0]->n_components(),
- ExcMessage ("All elements inside a collection need to have the "
- "same number of vector components!"));
-
- finite_elements.push_back (new_fe.clone());
- return (finite_elements.size ());
-}
+ template <int dim>
+ unsigned int
+ FECollection<dim>::memory_consumption () const
+ {
+ unsigned int mem
+ = (sizeof(*this) +
+ MemoryConsumption::memory_consumption (finite_elements));
+ for (unsigned int i=0; i<finite_elements.size(); ++i)
+ mem += finite_elements[i]->memory_consumption();
-
-template <int dim>
-unsigned int
-FECollection<dim>::memory_consumption () const
-{
- unsigned int mem
- = (sizeof(*this) +
- MemoryConsumption::memory_consumption (finite_elements));
- for (unsigned int i=0; i<finite_elements.size(); ++i)
- mem += finite_elements[i]->memory_consumption();
-
- return mem;
-}
+ return mem;
+ }
// explicit instantiations
-template class FECollection<deal_II_dimension>;
+ template class FECollection<deal_II_dimension>;
+
+}
template <int dim, int q_dim>
FEValuesBase<dim,q_dim>::FEValuesBase (
- const MappingCollection<dim> &mapping_collection,
- const QCollection<q_dim> &qcollection,
+ const hp::MappingCollection<dim> &mapping_collection,
+ const hp::QCollection<q_dim> &q_collection,
const UpdateFlags update_flags)
:
mapping_collection (mapping_collection),
- qcollection (qcollection),
+ q_collection (q_collection),
update_flags (update_flags)
{}
template <int dim, int q_dim>
- FEValuesBase<dim,q_dim>::FEValuesBase (const QCollection<q_dim> &qcollection,
+ FEValuesBase<dim,q_dim>::FEValuesBase (const hp::QCollection<q_dim> &q_collection,
const UpdateFlags update_flags)
:
mapping_collection (default_mapping),
- qcollection (qcollection),
+ q_collection (q_collection),
update_flags (update_flags)
{}
template <int dim>
- FEValues<dim>::FEValues (const MappingCollection<dim> &mapping,
- const FECollection<dim> &/*fe_collection*/,
- const QCollection<dim> &qcollection,
+ FEValues<dim>::FEValues (const hp::MappingCollection<dim> &mapping,
+ const hp::FECollection<dim> &/*fe_collection*/,
+ const hp::QCollection<dim> &q_collection,
const UpdateFlags update_flags)
:
internal::FEValuesBase<dim,dim> (mapping,
- qcollection,
+ q_collection,
update_flags)
{}
template <int dim>
- FEValues<dim>::FEValues (const FECollection<dim> &/*fe_collection*/,
- const QCollection<dim> &qcollection,
- const UpdateFlags update_flags)
+ FEValues<dim>::FEValues (const hp::FECollection<dim> &/*fe_collection*/,
+ const hp::QCollection<dim> &q_collection,
+ const UpdateFlags update_flags)
:
- internal::FEValuesBase<dim,dim> (qcollection,
+ internal::FEValuesBase<dim,dim> (q_collection,
update_flags)
{}
{
return new ::FEValues<dim> (
this->mapping_collection.get_mapping (active_fe_index), fe,
- this->qcollection.get_quadrature (active_fe_index),
+ this->q_collection.get_quadrature (active_fe_index),
this->update_flags);
}
template <int dim>
- FEFaceValues<dim>::FEFaceValues (const MappingCollection<dim> &mapping,
- const FECollection<dim> &/*fe_collection*/,
- const QCollection<dim-1> &qcollection,
+ FEFaceValues<dim>::FEFaceValues (const hp::MappingCollection<dim> &mapping,
+ const hp::FECollection<dim> &/*fe_collection*/,
+ const hp::QCollection<dim-1> &q_collection,
const UpdateFlags update_flags)
:
internal::FEValuesBase<dim,dim-1> (mapping,
- qcollection,
+ q_collection,
update_flags)
{}
template <int dim>
- FEFaceValues<dim>::FEFaceValues (const FECollection<dim> &/*fe_collection*/,
- const QCollection<dim-1> &qcollection,
+ FEFaceValues<dim>::FEFaceValues (const hp::FECollection<dim> &/*fe_collection*/,
+ const hp::QCollection<dim-1> &q_collection,
const UpdateFlags update_flags)
:
- internal::FEValuesBase<dim,dim-1> (qcollection,
+ internal::FEValuesBase<dim,dim-1> (q_collection,
update_flags)
{}
{
return new ::FEFaceValues<dim> (
this->mapping_collection.get_mapping (active_fe_index), fe,
- this->qcollection.get_quadrature (active_fe_index),
+ this->q_collection.get_quadrature (active_fe_index),
this->update_flags);
}
template <int dim>
- FESubfaceValues<dim>::FESubfaceValues (const MappingCollection<dim> &mapping,
- const FECollection<dim> &/*fe_collection*/,
- const QCollection<dim-1> &qcollection,
+ FESubfaceValues<dim>::FESubfaceValues (const hp::MappingCollection<dim> &mapping,
+ const hp::FECollection<dim> &/*fe_collection*/,
+ const hp::QCollection<dim-1> &q_collection,
const UpdateFlags update_flags)
:
internal::FEValuesBase<dim,dim-1> (mapping,
- qcollection,
+ q_collection,
update_flags)
{}
template <int dim>
- FESubfaceValues<dim>::FESubfaceValues (const FECollection<dim> &/*fe_collection*/,
- const QCollection<dim-1> &qcollection,
+ FESubfaceValues<dim>::FESubfaceValues (const hp::FECollection<dim> &/*fe_collection*/,
+ const hp::QCollection<dim-1> &q_collection,
const UpdateFlags update_flags)
:
- internal::FEValuesBase<dim,dim-1> (qcollection,
+ internal::FEValuesBase<dim,dim-1> (q_collection,
update_flags)
{}
{
return new ::FESubfaceValues<dim> (
this->mapping_collection.get_mapping (active_fe_index), fe,
- this->qcollection.get_quadrature (active_fe_index),
+ this->q_collection.get_quadrature (active_fe_index),
this->update_flags);
}
// $Id$
// Version: $Name$
//
-// Copyright (C) 2001, 2002, 2003, 2005 by the deal.II authors
+// Copyright (C) 2001, 2002, 2003, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
+template <int dim>
+Mapping<dim> *
+MappingC1<dim>::clone () const
+{
+ return new MappingC1<dim>(*this);
+}
+
+
+
// explicit instantiations
template class MappingC1<deal_II_dimension>;
}
+template <int dim>
+Mapping<dim> *
+MappingCartesian<dim>::clone () const
+{
+ return new MappingCartesian<dim>(*this);
+}
+
+
//---------------------------------------------------------------------------
// explicit instantiations
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003 by the deal.II authors
+// Copyright (C) 2003, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <fe/mapping_collection.h>
-template <int dim>
-MappingCollection<dim>::MappingCollection () :
- single_mapping (false)
+namespace hp
{
-}
+ template <int dim>
+ MappingCollection<dim>::MappingCollection () :
+ single_mapping (false)
+ {
+ }
-template <int dim>
-MappingCollection<dim>::MappingCollection (const Mapping<dim> &mapping) :
- single_mapping (true)
-{
- mappings.push_back (&mapping);
-}
+ template <int dim>
+ MappingCollection<dim>::MappingCollection (const Mapping<dim> &mapping) :
+ single_mapping (true)
+ {
+ mappings
+ .push_back (boost::shared_ptr<const Mapping<dim> >(mapping.clone()));
+ }
-template <int dim>
-inline
-const Mapping<dim> &
-MappingCollection<dim>::get_mapping (const unsigned int active_fe_index) const
-{
- SmartPointer<const Mapping<dim> > mapping;
+ template <int dim>
+ inline
+ const Mapping<dim> &
+ MappingCollection<dim>::get_mapping (const unsigned int active_fe_index) const
+ {
if (single_mapping)
- mapping = mappings[0];
+ return *mappings[0];
else
- {
+ {
Assert (active_fe_index < mappings.size (),
ExcIndexRange (active_fe_index, 0, mappings.size ()));
- mapping = mappings[active_fe_index];
- }
-
- return *mapping;
-}
+ return *mappings[active_fe_index];
+ }
+ }
-template <int dim>
-unsigned int
-MappingCollection<dim>::memory_consumption () const
-{
+ template <int dim>
+ unsigned int
+ MappingCollection<dim>::memory_consumption () const
+ {
return (sizeof(*this) +
MemoryConsumption::memory_consumption (mappings));
-}
+ }
-template <int dim>
-unsigned int MappingCollection<dim>::
-add_mapping (const Mapping<dim> &new_mapping)
-{
- // A MappingCollection, which was initialized as single
- // MappingCollection cannot administrate other Mappings.
- Assert (!single_mapping,
- ExcNotInitialized ());
- mappings.push_back (&new_mapping);
- return (mappings.size ());
-}
+ template <int dim>
+ unsigned int MappingCollection<dim>::
+ add_mapping (const Mapping<dim> &new_mapping)
+ {
+ // A MappingCollection, which was
+ // initialized as single
+ // MappingCollection cannot administrate
+ // other Mappings.
+ Assert (!single_mapping, ExcNotInitialized ());
+
+ mappings
+ .push_back (boost::shared_ptr<const Mapping<dim> >(new_mapping.clone()));
+
+ return mappings.size ();
+ }
// explicit instantiations
-template class MappingCollection<deal_II_dimension>;
+ template class MappingCollection<deal_II_dimension>;
+
+
+}
return degree;
}
+
+
+template <int dim>
+Mapping<dim> *
+MappingQ<dim>::clone () const
+{
+ return new MappingQ<dim>(*this);
+}
+
// explicit instantiation
template class MappingQ<deal_II_dimension>;
}
}
+
+
+template <int dim>
+Mapping<dim> *
+MappingQ1<dim>::clone () const
+{
+ return new MappingQ1<dim>(*this);
+}
+
//---------------------------------------------------------------------------
template class MappingQ1<deal_II_dimension>;
// $Id$
// Version: $Name$
//
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 by the deal.II authors
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
}
+
+template <int dim, class EulerVectorType>
+Mapping<dim> *
+MappingQ1Eulerian<dim, EulerVectorType>::clone () const
+{
+ return new MappingQ1Eulerian<dim,EulerVectorType>(*this);
+}
+
+
// explicit instantiation
template class MappingQ1Eulerian<deal_II_dimension, Vector<double> >;
#ifdef DEAL_II_USE_PETSC
// $Id$
// Version: $Name$
//
-// Copyright (C) 2003 by the deal.II authors
+// Copyright (C) 2003, 2006 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
#include <fe/q_collection.h>
-template <int dim>
-QCollection<dim>::QCollection () :
- single_quadrature (false)
-{
-}
-
-template <int dim>
-QCollection<dim>::QCollection (const Quadrature<dim> &quadrature) :
- single_quadrature (true)
+namespace hp
{
- quadratures.push_back (&quadrature);
-}
+
+ template <int dim>
+ QCollection<dim>::QCollection ()
+ :
+ single_quadrature (false)
+ {
+ }
-template <int dim>
-inline
-const Quadrature<dim> &
-QCollection<dim>::get_quadrature (const unsigned int active_fe_index) const
-{
- SmartPointer<const Quadrature<dim> > quad;
+ template <int dim>
+ QCollection<dim>::QCollection (const Quadrature<dim> &quadrature)
+ :
+ single_quadrature (true)
+ {
+ quadratures
+ .push_back (boost::shared_ptr<const Quadrature<dim> >(new Quadrature<dim>(quadrature)));
+ }
+
+
+ template <int dim>
+ inline
+ const Quadrature<dim> &
+ QCollection<dim>::get_quadrature (const unsigned int active_fe_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)
- quad = quadratures[0];
+ return *quadratures[0];
else
- {
+ {
Assert (active_fe_index < quadratures.size (),
ExcIndexRange (active_fe_index, 0, quadratures.size ()));
- quad = quadratures[active_fe_index];
- }
-
- return *quad;
-}
+ return *quadratures[active_fe_index];
+ }
+ }
-template <int dim>
-unsigned int
-QCollection<dim>::memory_consumption () const
-{
+ template <int dim>
+ unsigned int
+ QCollection<dim>::memory_consumption () const
+ {
return (sizeof(*this) +
MemoryConsumption::memory_consumption (quadratures));
-}
+ }
-template <int dim>
-unsigned int QCollection<dim>::
-add_quadrature (const Quadrature<dim> &new_quadrature)
-{
- // A QCollection, which was initialized as single QCollection cannot
- // administrate other Quadratures.
- Assert (!single_quadrature,
- ExcNotInitialized ());
- quadratures.push_back (&new_quadrature);
- return (quadratures.size ());
-}
+ template <int dim>
+ unsigned int QCollection<dim>::
+ add_quadrature (const Quadrature<dim> &new_quadrature)
+ {
+ // A QCollection, which was initialized
+ // as single QCollection cannot
+ // administrate other Quadratures.
+ Assert (!single_quadrature, ExcNotInitialized ());
+
+ quadratures
+ .push_back (boost::shared_ptr<const Quadrature<dim> >(new Quadrature<dim>(new_quadrature)));
+ return quadratures.size ();
+ }
// explicit instantiations
-template class QCollection<deal_II_dimension>;
+ template class QCollection<deal_II_dimension>;
#if deal_II_dimension >= 2
-template class QCollection<deal_II_dimension-1>;
+ template class QCollection<deal_II_dimension-1>;
#endif
+
+
+}
<h3>deal.II</h3>
<ol>
+ <li> <p>
+ New: The <code>Mapping</code> class and derived classes now have
+ functions <code>clone()</code> that return a new object of the same
+ (derived) type.
+ <br>
+ (WB 2006/1/8)
+ </p>
+
<li> <p>
Improved: The <code>KellyErrorEstimator</code> class now also allows to
select the cells on which it is supposed to work by giving a material
// objects for the different polynomial
// degrees will be stored in the
// fe_collection object.
- FECollection<dim> fe_collection;
+ hp::FECollection<dim> fe_collection;
// As already mentioned, the
// standard DoFHandler has to be
// rules for each polynomial
// degree which will be used in the
// computations.
- std::vector<Quadrature<dim> *> quad;
- QCollection<dim> *quadrature;
- std::vector<Quadrature<dim-1> *> face_quad;
- QCollection<dim-1> *face_quadrature;
+ hp::QCollection<dim> quadratures;
+ hp::QCollection<dim-1> face_quadratures;
// And there are two solution
// vectors, that store the
dof_handler (triangulation),
dg ()
{
- quadrature = new QCollection<dim> ();
- face_quadrature = new QCollection<dim-1> ();
-
- Quadrature<dim> *quad_temp;
- Quadrature<dim-1> *face_quad_temp;
// Change here for hp
// methods of
// different maximum degrees.
for (unsigned int i = 0; i < hp_degree; ++i)
{
elm_no = fe_collection.add_fe (FE_DGQ<dim> (i+1));
-
- quad_temp = new QGauss<dim> (i+2);
- quad.push_back (quad_temp);
- quadrature->add_quadrature (*quad_temp);
-
- // face_quad_temp = new QGauss<dim-1> (7);
- face_quad_temp = new QGauss<dim-1> (i+2);
- face_quad.push_back (face_quad_temp);
- face_quadrature->add_quadrature (*face_quad_temp);
+ quadratures.add_quadrature (QGauss<dim> (i+2));
+ face_quadratures.add_quadrature (QGauss<dim-1> (i+2));
}
}
DGMethod<dim>::~DGMethod ()
{
dof_handler.clear ();
-
- // Free the dynamically created quadrature rules
- delete quadrature;
- delete face_quadrature;
-
- typename std::vector<Quadrature<dim> *>::iterator quad_iter;
- for (quad_iter = quad.begin (); quad_iter != quad.end (); ++quad_iter)
- delete (*quad_iter);
-
- typename std::vector<Quadrature<dim-1> *>::iterator face_quad_iter;
- for (face_quad_iter = face_quad.begin ();
- face_quad_iter != face_quad.end (); ++face_quad_iter)
- delete (*face_quad_iter);
}
// assumes a ``MappingQ1'' mapping)
// and makes it easier to change
// the mapping object later.
- hp::FEValues<dim> fe_v_x (mapping, fe_collection, *quadrature, update_flags);
+ hp::FEValues<dim> fe_v_x (mapping, fe_collection, quadratures, update_flags);
// Similarly we create the
// ``FEFaceValues'' and
// current cell and the face (and
// subface) number.
hp::FEFaceValues<dim> fe_v_face_x (
- mapping, fe_collection, *face_quadrature, face_update_flags);
+ mapping, fe_collection, face_quadratures, face_update_flags);
hp::FESubfaceValues<dim> fe_v_subface_x (
- mapping, fe_collection, *face_quadrature, face_update_flags);
+ mapping, fe_collection, face_quadratures, face_update_flags);
hp::FEFaceValues<dim> fe_v_face_neighbor_x (
- mapping, fe_collection, *face_quadrature, neighbor_face_update_flags);
+ mapping, fe_collection, face_quadratures, neighbor_face_update_flags);
hp::FESubfaceValues<dim> fe_v_subface_neighbor_x (
- mapping, fe_collection, *face_quadrature, neighbor_face_update_flags);
+ mapping, fe_collection, face_quadratures, neighbor_face_update_flags);
// Now we create the cell matrices
// and vectors. Here we need two
// ``fe_v_face_neighbor'' as case 4
// does not occur.
hp::FEValues<dim> fe_v_x (
- mapping, fe_collection, *quadrature, update_flags);
+ mapping, fe_collection, quadratures, update_flags);
hp::FEFaceValues<dim> fe_v_face_x (
- mapping, fe_collection, *face_quadrature, face_update_flags);
+ mapping, fe_collection, face_quadratures, face_update_flags);
hp::FESubfaceValues<dim> fe_v_subface_x (
- mapping, fe_collection, *face_quadrature, face_update_flags);
+ mapping, fe_collection, face_quadratures, face_update_flags);
hp::FEFaceValues<dim> fe_v_face_neighbor_x (
- mapping, fe_collection, *face_quadrature, neighbor_face_update_flags);
+ mapping, fe_collection, face_quadratures, neighbor_face_update_flags);
const unsigned int max_dofs_per_cell = fe_collection.max_dofs_per_cell ();