// $Id$
// Version: $Name$
//
-// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors
+// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
* @ingroup grid
* @author Wolfgang Bangerth, 1999
*/
-template <int dim>
-class PersistentTriangulation : public Triangulation<dim>
+template <int dim, int spacedim=dim>
+class PersistentTriangulation : public Triangulation<dim, spacedim>
{
public:
/**
* in function templates.
*/
static const unsigned int dimension = dim;
+ static const unsigned int spacedimension = spacedim;
/**
* Build up the triangulation from the
* be used upon reconstruction of the
* grid.
*/
- PersistentTriangulation (const Triangulation<dim> &coarse_grid);
+ PersistentTriangulation (const Triangulation<dim, spacedim> &coarse_grid);
/**
* Copy constructor. This operation
* as well as the pointer to the
* coarse grid are copied, however.
*/
- PersistentTriangulation (const PersistentTriangulation<dim> &old_tria);
+ PersistentTriangulation (const PersistentTriangulation<dim, spacedim> &old_tria);
/**
* Destructor.
* be used upon reconstruction of the
* grid.
*/
- virtual void copy_triangulation (const Triangulation<dim> &tria);
+ virtual void copy_triangulation (const Triangulation<dim, spacedim> &tria);
/**
* Throw an error, since this function
* is not useful in the context of this
* class.
*/
- virtual void create_triangulation (const std::vector<Point<dim> > &vertices,
+ virtual void create_triangulation (const std::vector<Point<spacedim> > &vertices,
const std::vector<CellData<dim> > &cells,
const SubCellData &subcelldata);
* class.
*/
virtual void create_triangulation_compatibility (
- const std::vector<Point<dim> > &vertices,
+ const std::vector<Point<spacedim> > &vertices,
const std::vector<CellData<dim> > &cells,
const SubCellData &subcelldata);
* This grid shall be used as coarse
* grid.
*/
- SmartPointer<const Triangulation<dim>,PersistentTriangulation<dim> > coarse_grid;
+ SmartPointer<const Triangulation<dim,spacedim>,PersistentTriangulation<dim,spacedim> > coarse_grid;
/**
* Vectors holding the refinement and
DEAL_II_NAMESPACE_OPEN
-template <int dim>
+template <int dim, int spacedim>
const unsigned int
-PersistentTriangulation<dim>::dimension;
+PersistentTriangulation<dim,spacedim>::dimension;
+
+template <int dim, int spacedim>
+const unsigned int
+PersistentTriangulation<dim,spacedim>::spacedimension;
-template <int dim>
-PersistentTriangulation<dim>::
-PersistentTriangulation (const Triangulation<dim> &coarse_grid)
+template <int dim, int spacedim>
+PersistentTriangulation<dim,spacedim>::
+PersistentTriangulation (const Triangulation<dim,spacedim> &coarse_grid)
:
coarse_grid (&coarse_grid, typeid(*this).name())
{}
-template <int dim>
-PersistentTriangulation<dim>::
-PersistentTriangulation (const PersistentTriangulation<dim> &old_tria)
+template <int dim, int spacedim>
+PersistentTriangulation<dim,spacedim>::
+PersistentTriangulation (const PersistentTriangulation<dim,spacedim> &old_tria)
:
// default initialize
// tria, i.e. it will be
// empty on first use
- Triangulation<dim> (),
+ Triangulation<dim,spacedim> (),
coarse_grid (old_tria.coarse_grid),
refine_flags (old_tria.refine_flags),
coarsen_flags (old_tria.coarsen_flags)
-template <int dim>
-PersistentTriangulation<dim>::~PersistentTriangulation ()
+template <int dim, int spacedim>
+PersistentTriangulation<dim,spacedim>::~PersistentTriangulation ()
{}
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::execute_coarsening_and_refinement ()
+PersistentTriangulation<dim,spacedim>::execute_coarsening_and_refinement ()
{
// first save flags
refine_flags.push_back (std::vector<bool>());
// this function throws an
// exception, that's fine since it
// is the last call here
- Triangulation<dim>::execute_coarsening_and_refinement ();
+ Triangulation<dim,spacedim>::execute_coarsening_and_refinement ();
}
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::restore ()
+PersistentTriangulation<dim,spacedim>::restore ()
{
// for each of the previous
// refinement sweeps
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::restore (const unsigned int step)
+PersistentTriangulation<dim,spacedim>::restore (const unsigned int step)
{
if (step==0)
// this will yield an error if
// the underlying triangulation
// was not empty
- Triangulation<dim>::copy_triangulation (*coarse_grid);
+ Triangulation<dim,spacedim>::copy_triangulation (*coarse_grid);
else
// for each of the previous
// refinement sweeps
this->load_refine_flags (refine_flags[step-1]);
this->load_coarsen_flags (coarsen_flags[step-1]);
- Triangulation<dim>::execute_coarsening_and_refinement ();
+ Triangulation<dim,spacedim>::execute_coarsening_and_refinement ();
}
}
-template <int dim>
+template <int dim, int spacedim>
unsigned int
-PersistentTriangulation<dim>::n_refinement_steps() const
+PersistentTriangulation<dim,spacedim>::n_refinement_steps() const
{
return refine_flags.size();
}
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::copy_triangulation (const Triangulation<dim> &old_grid)
+PersistentTriangulation<dim,spacedim>::copy_triangulation (const Triangulation<dim,spacedim> &old_grid)
{
this->clear ();
coarse_grid = &old_grid;
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::create_triangulation (const std::vector<Point<dim> > &,
+PersistentTriangulation<dim,spacedim>::create_triangulation (const std::vector<Point<spacedim> > &,
const std::vector<CellData<dim> > &,
const SubCellData &)
{
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::create_triangulation_compatibility (
- const std::vector<Point<dim> > &,
+PersistentTriangulation<dim,spacedim>::create_triangulation_compatibility (
+ const std::vector<Point<spacedim> > &,
const std::vector<CellData<dim> > &,
const SubCellData &)
{
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::write_flags(std::ostream &out) const
+PersistentTriangulation<dim,spacedim>::write_flags(std::ostream &out) const
{
const unsigned int n_flag_levels=refine_flags.size();
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::read_flags(std::istream &in)
+PersistentTriangulation<dim,spacedim>::read_flags(std::istream &in)
{
Assert(refine_flags.size()==0 && coarsen_flags.size()==0,
ExcFlagsNotCleared());
-template <int dim>
+template <int dim, int spacedim>
void
-PersistentTriangulation<dim>::clear_flags()
+PersistentTriangulation<dim,spacedim>::clear_flags()
{
refine_flags.clear();
coarsen_flags.clear();
-template <int dim>
+template <int dim, int spacedim>
std::size_t
-PersistentTriangulation<dim>::memory_consumption () const
+PersistentTriangulation<dim,spacedim>::memory_consumption () const
{
- return (Triangulation<dim>::memory_consumption () +
+ return (Triangulation<dim,spacedim>::memory_consumption () +
MemoryConsumption::memory_consumption (coarse_grid) +
MemoryConsumption::memory_consumption (refine_flags) +
MemoryConsumption::memory_consumption (coarsen_flags));
template class PersistentTriangulation<1>;
template class PersistentTriangulation<2>;
template class PersistentTriangulation<3>;
+template class PersistentTriangulation<1,2>;
+template class PersistentTriangulation<2,3>;
DEAL_II_NAMESPACE_CLOSE