}
-
+#if deal_II_dimension == 1
template <>
inline
this->active_fe_index());
}
+#endif
template <>
template <> Triangulation<1>::raw_face_iterator Triangulation<1>::last_raw_face () const;
template <> Triangulation<1>::face_iterator Triangulation<1>::last_face () const;
template <> Triangulation<1>::active_face_iterator Triangulation<1>::last_active_face () const;
+template <> Triangulation<1>::raw_line_iterator Triangulation<1>::begin_raw_line (const unsigned int level) const;
+template <> Triangulation<1>::raw_line_iterator Triangulation<1>::last_raw_line (const unsigned int level) const;
template <> Triangulation<1>::raw_quad_iterator Triangulation<1>::begin_raw_quad (const unsigned int) const;
template <> Triangulation<1>::quad_iterator Triangulation<1>::begin_quad (const unsigned int) const;
template <> Triangulation<1>::active_quad_iterator Triangulation<1>::begin_active_quad (const unsigned int) const;
template <> unsigned int Triangulation<3>::n_raw_cells (const unsigned int level) const;
template <> unsigned int Triangulation<3>::n_cells (const unsigned int level) const;
template <> unsigned int Triangulation<3>::n_active_cells (const unsigned int level) const;
+template <> unsigned int Triangulation<1>::n_raw_lines (const unsigned int level) const;
template <> unsigned int Triangulation<1>::n_quads () const;
template <> unsigned int Triangulation<1>::n_quads (const unsigned int) const;
template <> unsigned int Triangulation<1>::n_raw_quads (const unsigned int) const;
+template <> unsigned int Triangulation<2>::n_raw_quads (const unsigned int) const;
+template <> unsigned int Triangulation<1>::n_raw_quads () const;
template <> unsigned int Triangulation<1>::n_raw_hexs (const unsigned int) const;
template <> unsigned int Triangulation<1>::n_active_quads (const unsigned int) const;
template <> unsigned int Triangulation<1>::n_active_quads () const;
{
namespace hp
{
+
unsigned int
DoFLevel<0>::memory_consumption () const
{
return MemoryConsumption::memory_consumption (active_fe_indices);
}
-
-#if deal_II_dimension == 1
-
- unsigned int
- DoFLevel<1>::memory_consumption () const
- {
- return (DoFLevel<0>::memory_consumption() +
- MemoryConsumption::memory_consumption (lines));
- }
-#endif
-
-
-#if deal_II_dimension == 2
-
- unsigned int
- DoFLevel<2>::memory_consumption () const
- {
- return (DoFLevel<0>::memory_consumption () +
- MemoryConsumption::memory_consumption (quads));
- }
-
-#endif
-
-
-#if deal_II_dimension == 3
-
- unsigned int
- DoFLevel<3>::memory_consumption () const
- {
- return (DoFLevel<0>::memory_consumption () +
- MemoryConsumption::memory_consumption (hexes));
- }
-
-#endif
}
}
#include <base/memory_consumption.h>
-#include <fe/fe_collection.h>
+#include <dofs/hp_dof_levels.h>
+
namespace internal
{
namespace hp
{
+#if deal_II_dimension == 1
+
+ unsigned int
+ DoFLevel<1>::memory_consumption () const
+ {
+ return (DoFLevel<0>::memory_consumption() +
+ MemoryConsumption::memory_consumption (lines));
+ }
+
+#endif
+
+
+#if deal_II_dimension == 2
+
+ unsigned int
+ DoFLevel<2>::memory_consumption () const
+ {
+ return (DoFLevel<0>::memory_consumption () +
+ MemoryConsumption::memory_consumption (quads));
+ }
+
+#endif
+
+
+#if deal_II_dimension == 3
+
+ unsigned int
+ DoFLevel<3>::memory_consumption () const
+ {
+ return (DoFLevel<0>::memory_consumption () +
+ MemoryConsumption::memory_consumption (hexes));
+ }
+
+#endif
+
}
}
--------- explicit specialization, which is not allowed. */
#if deal_II_dimension == 1
+
template <>
Triangulation<1>::cell_iterator
Triangulation<1>::begin (const unsigned int level) const
return end_line ();
}
-template <>
-Triangulation<1>::raw_line_iterator
-Triangulation<1>::begin_raw_line (const unsigned int level) const;
-
-template <>
-Triangulation<1>::raw_line_iterator
-Triangulation<1>::last_raw_line (const unsigned int level) const;
-
-template <>
-unsigned int
-Triangulation<1>::n_raw_lines (const unsigned int level) const;
#endif
Triangulation<2>::raw_quad_iterator
Triangulation<2>::last_raw_quad (const unsigned int level) const;
-template <>
-unsigned int
-Triangulation<2>::n_raw_quads (const unsigned int level) const;
#endif
0);
}
-
+#if deal_II_dimension == 1
template <>
Triangulation<1>::raw_line_iterator
0);
}
+#endif
+#if deal_II_dimension == 3
+// TODO: why does specialization not work?!
template <int dim>
typename Triangulation<dim>::raw_quad_iterator
Triangulation<dim>::begin_raw_quad (const unsigned int level) const
{
- Assert (dim>=2,ExcImpossibleInDim(dim));
- Assert (dim<3 || level == 0, ExcFacesHaveNoLevel())
+ Assert (level == 0, ExcFacesHaveNoLevel())
return raw_quad_iterator (const_cast<Triangulation<dim>*>(this),
0,
0);
}
+#endif
+#if deal_II_dimension == 2
template <>
Triangulation<2>::raw_quad_iterator
0);
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 1
+
template <>
Triangulation<1>::raw_line_iterator
Triangulation<1>::last_raw_line (const unsigned int level) const
levels[level]->lines.cells.size()-1);
}
+#endif
+
template <int dim>
typename Triangulation<dim>::raw_quad_iterator
}
+#if deal_II_dimension == 2
+
template <>
Triangulation<2>::raw_quad_iterator
Triangulation<2>::last_raw_quad (const unsigned int level) const
levels[level]->quads.cells.size()-1);
}
+#endif
+
template <int dim>
typename Triangulation<dim>::raw_hex_iterator
template <int dim>
unsigned int Triangulation<dim>::n_quads (const unsigned int level) const
{
- Assert (level < number_cache.n_quads_level.size(),
- ExcIndexRange (level, 0, number_cache.n_quads_level.size()));
Assert (dim == 2, ExcFacesHaveNoLevel());
-
+ Assert (level < number_cache.n_quads_level.size(),
+ ExcIndexRange (level, 0, number_cache.n_quads_level.size()));
return number_cache.n_quads_level[level];
}
+#if deal_II_dimension == 2
-template <int dim>
-unsigned int Triangulation<dim>::n_raw_quads (const unsigned int) const
-{
- Assert (dim <3, ExcFacesHaveNoLevel());
- Assert (dim >2, ExcImpossibleInDim(dim));
- if (dim>2)
- return n_raw_quads();
- else
- return 0;
-}
-#if deal_II_dimension == 2
template <>
unsigned int Triangulation<2>::n_raw_quads (const unsigned int level) const
{
Assert(level < n_levels(), ExcIndexRange(level,0,n_levels()));
return levels[level]->quads.cells.size();
}
+
#endif
+#if deal_II_dimension == 3
+
template <>
-unsigned int Triangulation<3>::n_raw_quads () const
+unsigned int Triangulation<3>::n_raw_quads (const unsigned int) const
{
- return faces->quads.cells.size();
+ Assert(false, ExcFacesHaveNoLevel());
+ return 0;
}
+#endif
+
+
+
template <int dim>
unsigned int Triangulation<dim>::n_raw_quads () const
}
+#if deal_II_dimension == 3
+
+template <>
+unsigned int Triangulation<3>::n_raw_quads () const
+{
+ return faces->quads.cells.size();
+}
+
+#endif
template <int dim>
unsigned int Triangulation<dim>::n_active_quads () const
}
-
+#if deal_II_dimension == 1
template <>
void Triangulation<1>::update_number_cache_lines ()
}
}
+#endif
+
template <int dim>
void Triangulation<dim>::update_number_cache_lines ()
}
+#if deal_II_dimension == 1
template <>
void
->lines.cells[this->present_index] = line;
}
+#endif
+#if deal_II_dimension == 1
-template <int dim>
-int TriaObjectAccessor<1, dim>::vertex_index (const unsigned int i) const
+template <>
+int TriaObjectAccessor<1, 1>::vertex_index (const unsigned int i) const
{
Assert (i<2, ExcIndexRange(i,0,2));
- return this->tria->faces->lines.cells[this->present_index].vertex (i);
+ return this->tria->levels[this->present_level]->lines.cells[this->present_index].vertex (i);
}
+#endif
-template <>
-int TriaObjectAccessor<1, 1>::vertex_index (const unsigned int i) const
+#if deal_II_dimension != 1
+
+template <int dim>
+int TriaObjectAccessor<1, dim>::vertex_index (const unsigned int i) const
{
Assert (i<2, ExcIndexRange(i,0,2));
- return this->tria->levels[this->present_level]->lines.cells[this->present_index].vertex (i);
+ return this->tria->faces->lines.cells[this->present_index].vertex (i);
}
-
+#endif
template <int dim>
Point<dim> &
}
+#if deal_II_dimension == 1
template <>
void TriaObjectAccessor<1, 1>::set_used_flag () const
this->tria->levels[this->present_level]->lines.used[this->present_index] = true;
}
-
+#endif
template <int dim>
void TriaObjectAccessor<1, dim>::clear_used_flag () const
}
+#if deal_II_dimension == 1
template <>
void TriaObjectAccessor<1, 1>::clear_used_flag () const
this->tria->levels[this->present_level]->lines.used[this->present_index] = false;
}
-
+#endif
template <int dim>
void TriaObjectAccessor<1, dim>::recursively_set_user_flag () const
}
+#if deal_II_dimension == 1
template <>
void TriaObjectAccessor<1, 1>::set_user_pointer (void *p) const
this->tria->levels[this->present_level]->lines.user_pointers[this->present_index] = p;
}
-
+#endif
template <int dim>
void TriaObjectAccessor<1, dim>::clear_user_pointer () const
}
+#if deal_II_dimension == 1
template <>
void TriaObjectAccessor<1, 1>::clear_user_pointer () const
this->tria->levels[this->present_level]->lines.user_pointers[this->present_index] = 0;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 1
template <>
void * TriaObjectAccessor<1, 1>::user_pointer () const
return this->tria->levels[this->present_level]->lines.user_pointers[this->present_index];
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 1
template <>
void TriaObjectAccessor<1, 1>::set_children (const int index) const
this->tria->levels[this->present_level]->lines.children[this->present_index] = index;
}
-
+#endif
template <int dim>
void TriaObjectAccessor<1, dim>::clear_children () const
}
+#if deal_II_dimension == 1
template <>
unsigned char TriaObjectAccessor<1, 1>::boundary_indicator () const
return 0;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 1
template <>
void TriaObjectAccessor<1, 1>::set_boundary_indicator (const unsigned char) const
Assert (false, ExcImpossibleInDim(1));
}
-
+#endif
template <int dim>
}
+#if deal_II_dimension == 2
template <>
void
->quads.cells[this->present_index] = quad;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 2
template <>
void
this->tria->levels[this->present_level]->quads.used[this->present_index] = true;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 2
template <>
void TriaObjectAccessor<2, 2>::clear_used_flag () const
this->tria->levels[this->present_level]->quads.used[this->present_index] = false;
}
-
+#endif
template <int dim>
void TriaObjectAccessor<2, dim>::recursively_set_user_flag () const
}
+#if deal_II_dimension == 2
template <>
void TriaObjectAccessor<2, 2>::set_user_pointer (void *p) const
this->tria->levels[this->present_level]->quads.user_pointers[this->present_index] = p;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 2
template <>
void TriaObjectAccessor<2, 2>::clear_user_pointer () const
this->tria->levels[this->present_level]->quads.user_pointers[this->present_index] = 0;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 2
template <>
void * TriaObjectAccessor<2, 2>::user_pointer () const
return this->tria->levels[this->present_level]->quads.user_pointers[this->present_index];
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 2
template <>
void TriaObjectAccessor<2, 2>::set_children (const int index) const
this->tria->levels[this->present_level]->quads.children[this->present_index] = index;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 3
template <>
unsigned char TriaObjectAccessor<2, 3>::boundary_indicator () const
return this->tria->faces->quads.material_id[this->present_index];
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 3
template <>
void TriaObjectAccessor<2, 3>::set_boundary_indicator (const unsigned char boundary_ind) const
this->tria->faces->quads.material_id[this->present_index] = boundary_ind;
}
+#endif
template <int dim>
/*------------------------ Functions: TriaObjectAccessor ---------------------------*/
+#if deal_II_dimension == 3
+
template <>
void
TriaObjectAccessor<3, 3>::
->hexes.cells[this->present_index] = hex;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 3
template <>
void TriaObjectAccessor<3, 3>::set_used_flag () const
}
-
template <>
void TriaObjectAccessor<3, 3>::clear_used_flag () const
{
this->tria->levels[this->present_level]->hexes.used[this->present_index] = false;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 3
template <>
void TriaObjectAccessor<3, 3>::set_user_pointer (void *p) const
}
-
template <>
void TriaObjectAccessor<3, 3>::clear_user_pointer () const
{
}
-
template <>
void * TriaObjectAccessor<3, 3>::user_pointer () const
{
return this->tria->levels[this->present_level]->hexes.user_pointers[this->present_index];
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 3
template <>
void TriaObjectAccessor<3, 3>::set_children (const int index) const
this->tria->levels[this->present_level]->hexes.children[this->present_index] = index;
}
+#endif
template <int dim>
}
+#if deal_II_dimension == 3
template <>
void
face] = orientation;
}
-
+#endif
// Remark: The following explicit instantiations needed to be moved to
// this place here to work around a problem with gcc3.3 on Apple MacOSX.
// The reason is that some of the functions instantiated here are used
--- /dev/null
+//---------------------------------------------------------------------------
+// $Id$
+// Version: $Name$
+//
+// Copyright (C) 2006 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//---------------------------------------------------------------------------
+
+
+#include <base/memory_consumption.h>
+#include <grid/tria_levels.h>
+
+namespace internal
+{
+ namespace Triangulation
+ {
+
+ void
+ TriaLevel<0>::reserve_space (const unsigned int total_cells,
+ const unsigned int dimension)
+ {
+ // we need space for total_cells
+ // cells. Maybe we have more already
+ // with those cells which are unused,
+ // so only allocate new space if needed.
+ //
+ // note that all arrays should have equal
+ // sizes (checked by @p{monitor_memory}
+ if (total_cells > refine_flags.size())
+ {
+ refine_flags.reserve (total_cells);
+ refine_flags.insert (refine_flags.end(),
+ total_cells - refine_flags.size(),
+ false);
+
+ coarsen_flags.reserve (total_cells);
+ coarsen_flags.insert (coarsen_flags.end(),
+ total_cells - coarsen_flags.size(),
+ false);
+
+ subdomain_ids.reserve (total_cells);
+ subdomain_ids.insert (subdomain_ids.end(),
+ total_cells - subdomain_ids.size(),
+ 0);
+
+ neighbors.reserve (total_cells*(2*dimension));
+ neighbors.insert (neighbors.end(),
+ total_cells*(2*dimension) - neighbors.size(),
+ std::make_pair(-1,-1));
+ };
+ }
+
+
+
+ void
+ TriaLevel<0>::monitor_memory (const unsigned int true_dimension) const
+ {
+ // check that we have not allocated
+ // too much memory. note that bool
+ // vectors allocate their memory in
+ // chunks of whole integers, so
+ // they may over-allocate by up to
+ // as many elements as an integer
+ // has bits
+ Assert (refine_flags.size() <= refine_flags.capacity() + sizeof(int)*8 ||
+ refine_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("refine_flags",
+ refine_flags.size(), refine_flags.capacity()));
+ Assert (coarsen_flags.size() <= coarsen_flags.capacity() + sizeof(int)*8 ||
+ coarsen_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
+ ExcMemoryWasted ("coarsen_flags",
+ coarsen_flags.size(), coarsen_flags.capacity()));
+ Assert (neighbors.size() == neighbors.capacity() ||
+ neighbors.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("neighbors",
+ neighbors.size(), neighbors.capacity()));
+ Assert (subdomain_ids.size() == subdomain_ids.capacity() ||
+ subdomain_ids.size()<DEAL_II_MIN_VECTOR_CAPACITY,
+ ExcMemoryWasted ("subdomain_ids",
+ subdomain_ids.size(), subdomain_ids.capacity()));
+ Assert (2*true_dimension*refine_flags.size() == neighbors.size(),
+ ExcMemoryInexact (refine_flags.size(), neighbors.size()));
+ Assert (2*true_dimension*coarsen_flags.size() == neighbors.size(),
+ ExcMemoryInexact (coarsen_flags.size(), neighbors.size()));
+ }
+
+
+
+ unsigned int
+ TriaLevel<0>::memory_consumption () const
+ {
+ return (MemoryConsumption::memory_consumption (refine_flags) +
+ MemoryConsumption::memory_consumption (coarsen_flags) +
+ MemoryConsumption::memory_consumption (neighbors));
+ }
+
+ }
+}
{
namespace Triangulation
{
-
- void
- TriaLevel<0>::reserve_space (const unsigned int total_cells,
- const unsigned int dimension)
- {
- // we need space for total_cells
- // cells. Maybe we have more already
- // with those cells which are unused,
- // so only allocate new space if needed.
- //
- // note that all arrays should have equal
- // sizes (checked by @p{monitor_memory}
- if (total_cells > refine_flags.size())
- {
- refine_flags.reserve (total_cells);
- refine_flags.insert (refine_flags.end(),
- total_cells - refine_flags.size(),
- false);
-
- coarsen_flags.reserve (total_cells);
- coarsen_flags.insert (coarsen_flags.end(),
- total_cells - coarsen_flags.size(),
- false);
-
- subdomain_ids.reserve (total_cells);
- subdomain_ids.insert (subdomain_ids.end(),
- total_cells - subdomain_ids.size(),
- 0);
-
- neighbors.reserve (total_cells*(2*dimension));
- neighbors.insert (neighbors.end(),
- total_cells*(2*dimension) - neighbors.size(),
- std::make_pair(-1,-1));
- };
- }
-
-
-
- void
- TriaLevel<0>::monitor_memory (const unsigned int true_dimension) const
- {
- // check that we have not allocated
- // too much memory. note that bool
- // vectors allocate their memory in
- // chunks of whole integers, so
- // they may over-allocate by up to
- // as many elements as an integer
- // has bits
- Assert (refine_flags.size() <= refine_flags.capacity() + sizeof(int)*8 ||
- refine_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("refine_flags",
- refine_flags.size(), refine_flags.capacity()));
- Assert (coarsen_flags.size() <= coarsen_flags.capacity() + sizeof(int)*8 ||
- coarsen_flags.size()<DEAL_II_MIN_BOOL_VECTOR_CAPACITY,
- ExcMemoryWasted ("coarsen_flags",
- coarsen_flags.size(), coarsen_flags.capacity()));
- Assert (neighbors.size() == neighbors.capacity() ||
- neighbors.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("neighbors",
- neighbors.size(), neighbors.capacity()));
- Assert (subdomain_ids.size() == subdomain_ids.capacity() ||
- subdomain_ids.size()<DEAL_II_MIN_VECTOR_CAPACITY,
- ExcMemoryWasted ("subdomain_ids",
- subdomain_ids.size(), subdomain_ids.capacity()));
- Assert (2*true_dimension*refine_flags.size() == neighbors.size(),
- ExcMemoryInexact (refine_flags.size(), neighbors.size()));
- Assert (2*true_dimension*coarsen_flags.size() == neighbors.size(),
- ExcMemoryInexact (coarsen_flags.size(), neighbors.size()));
- }
-
-
-
- unsigned int
- TriaLevel<0>::memory_consumption () const
- {
- return (MemoryConsumption::memory_consumption (refine_flags) +
- MemoryConsumption::memory_consumption (coarsen_flags) +
- MemoryConsumption::memory_consumption (neighbors));
- }
#if deal_II_dimension == 1