internal::Triangulation::TriaObjects< G > Class Template Reference
[Grid classes]

Inheritance diagram for internal::Triangulation::TriaObjects< G >:
Inheritance graph
[legend]

List of all members.

Classes

class  ExcMemoryInexact
class  ExcMemoryWasted
class  ExcPointerIndexClash
class  ExcWrongIterator
union  UserData

Public Member Functions

 TriaObjects ()
void reserve_space (const unsigned int new_objs_in_pairs, const unsigned int new_objs_single=0)
template<int dim, int spacedim>
typename::Triangulation< dim,
spacedim >::raw_line_iterator 
next_free_single_line (const ::Triangulation< dim, spacedim > &tria)
template<int dim, int spacedim>
typename::Triangulation< dim,
spacedim >::raw_line_iterator 
next_free_pair_line (const ::Triangulation< dim, spacedim > &tria)
template<int dim, int spacedim>
typename::Triangulation< dim,
spacedim >::raw_quad_iterator 
next_free_single_quad (const ::Triangulation< dim, spacedim > &tria)
template<int dim, int spacedim>
typename::Triangulation< dim,
spacedim >::raw_quad_iterator 
next_free_pair_quad (const ::Triangulation< dim, spacedim > &tria)
template<int dim, int spacedim>
typename::Triangulation< dim,
spacedim >::raw_hex_iterator 
next_free_hex (const ::Triangulation< dim, spacedim > &tria, const unsigned int level)
void clear ()
bool face_orientation (const unsigned int cell, const unsigned int face) const
void *& user_pointer (const unsigned int i)
const void * user_pointer (const unsigned int i) const
unsigned intuser_index (const unsigned int i)
unsigned int user_index (const unsigned int i) const
void clear_user_data (const unsigned int i)
void clear_user_data ()
void clear_user_flags ()
void monitor_memory (const unsigned int true_dimension) const
unsigned int memory_consumption () const
template<>
void reserve_space (const unsigned int new_lines_in_pairs, const unsigned int new_lines_single)
template<>
void reserve_space (const unsigned int new_quads_in_pairs, const unsigned int new_quads_single)
template<>
void monitor_memory (const unsigned int) const

Public Attributes

std::vector< G > cells
std::vector< intchildren
std::vector< RefinementCase
< G::dimension > > 
refinement_cases
std::vector< boolused
std::vector< booluser_flags
std::vector< unsigned char > material_id

Protected Types

enum  UserDataType { data_unknown, data_pointer, data_index }

Protected Attributes

unsigned int next_free_single
unsigned int next_free_pair
bool reverse_order_next_free_single
std::vector< UserDatauser_data
UserDataType user_data_type

Detailed Description

template<typename G>
class internal::Triangulation::TriaObjects< G >

General template for information belonging to the geometrical objects of a triangulation, i.e. lines, quads, hexahedra... Apart from the vector of objects additional information is included, namely vectors indicating the children, the used-status, user-flags, material-ids..

Objects of these classes are included in the TriaLevel and TriaFaces classes.

Author:
Tobias Leicht, Guido Kanschat, 2006, 2007

Member Enumeration Documentation

template<typename G>
enum internal::Triangulation::TriaObjects::UserDataType [protected]

Enum descibing the possible types of userdata.

Enumerator:
data_unknown 

No userdata used yet.

data_pointer 

UserData contains pointers.

data_index 

UserData contains indices.


Constructor & Destructor Documentation

template<typename G >
internal::Triangulation::TriaObjects< G >::TriaObjects (  )  [inline]

Constructor resetting some data.


Member Function Documentation

template<typename G>
void internal::Triangulation::TriaObjects< G >::reserve_space ( const unsigned int  new_objs_in_pairs,
const unsigned int  new_objs_single = 0 
)

Assert that enough space is allocated to accomodate new_objs_in_pairs new objects, stored in pairs, plus new_obj_single stored individually. This function does not only call vector::reserve(), but does really append the needed elements.

In 2D e.g. refined lines have to be stored in pairs, whereas new lines in the interior of refined cells can be stored as single lines.

Reimplemented in internal::Triangulation::TriaObjectsQuad3D.

template<typename G>
template<int dim, int spacedim>
typename ::Triangulation<dim,spacedim>::raw_line_iterator internal::Triangulation::TriaObjects< G >::next_free_single_line ( const ::Triangulation< dim, spacedim > &  tria  )  [inline]

Return an iterator to the next free slot for a single line. Only implemented for G=TriaObject<1> .

template<typename G>
template<int dim, int spacedim>
typename ::Triangulation<dim,spacedim>::raw_line_iterator internal::Triangulation::TriaObjects< G >::next_free_pair_line ( const ::Triangulation< dim, spacedim > &  tria  )  [inline]

Return an iterator to the next free slot for a pair of lines. Only implemented for G=TriaObject<1> .

template<typename G>
template<int dim, int spacedim>
typename ::Triangulation<dim,spacedim>::raw_quad_iterator internal::Triangulation::TriaObjects< G >::next_free_single_quad ( const ::Triangulation< dim, spacedim > &  tria  )  [inline]

Return an iterator to the next free slot for a single quad. Only implemented for G=TriaObject<2> .

template<typename G>
template<int dim, int spacedim>
typename ::Triangulation<dim,spacedim>::raw_quad_iterator internal::Triangulation::TriaObjects< G >::next_free_pair_quad ( const ::Triangulation< dim, spacedim > &  tria  )  [inline]

Return an iterator to the next free slot for a pair of quads. Only implemented for G=TriaObject<2> .

template<typename G>
template<int dim, int spacedim>
typename ::Triangulation<dim,spacedim>::raw_hex_iterator internal::Triangulation::TriaObjects< G >::next_free_hex ( const ::Triangulation< dim, spacedim > &  tria,
const unsigned int  level 
) [inline]

Return an iterator to the next free slot for a pair of hexes. Only implemented for G=Hexahedron.

template<typename G>
void internal::Triangulation::TriaObjects< G >::clear (  ) 

Clear all the data contained in this object.

Reimplemented in internal::Triangulation::TriaObjectsHex, and internal::Triangulation::TriaObjectsQuad3D.

template<typename G >
bool internal::Triangulation::TriaObjects< G >::face_orientation ( const unsigned int  cell,
const unsigned int  face 
) const [inline]

The orientation of the face number face of the cell with number cell. The return value is true, if the normal vector points the usual way (GeometryInfo::unit_normal_orientation) and false else.

The result is always true in this class, but derived classes will reimplement this.

Warning:
There is a bug in the class hierarchy right now. Avoid ever calling this function through a reference, since you might end up with the base class function instead of the derived class. Still, we do not want to make it virtual for efficiency reasons.

Reimplemented in internal::Triangulation::TriaObjectsHex, and internal::Triangulation::TriaObjectsQuad3D.

template<typename G >
void *& internal::Triangulation::TriaObjects< G >::user_pointer ( const unsigned int  i  )  [inline]
template<typename G >
const void * internal::Triangulation::TriaObjects< G >::user_pointer ( const unsigned int  i  )  const [inline]
template<typename G >
unsigned int & internal::Triangulation::TriaObjects< G >::user_index ( const unsigned int  i  )  [inline]
template<typename G >
unsigned int internal::Triangulation::TriaObjects< G >::user_index ( const unsigned int  i  )  const [inline]
template<typename G >
void internal::Triangulation::TriaObjects< G >::clear_user_data ( const unsigned int  i  )  [inline]

Reset user data to zero.

References Assert, and internal::Triangulation::TriaObjects< G >::user_data.

template<typename G >
void internal::Triangulation::TriaObjects< G >::clear_user_data (  )  [inline]

Clear all user pointers or indices and reset their type, such that the next access may be aither or.

References internal::Triangulation::TriaObjects< G >::data_unknown, internal::Triangulation::TriaObjects< G >::user_data, and internal::Triangulation::TriaObjects< G >::user_data_type.

template<typename G >
void internal::Triangulation::TriaObjects< G >::clear_user_flags (  )  [inline]

Clear all user flags.

References internal::Triangulation::TriaObjects< G >::user_flags.

template<typename G>
void internal::Triangulation::TriaObjects< G >::monitor_memory ( const unsigned int  true_dimension  )  const

Check the memory consistency of the different containers. Should only be called with the prepro flag DEBUG set. The function should be called from the functions of the higher TriaLevel classes.

Reimplemented in internal::Triangulation::TriaObjectsHex, and internal::Triangulation::TriaObjectsQuad3D.

template<typename G>
unsigned int internal::Triangulation::TriaObjects< G >::memory_consumption (  )  const

Determine an estimate for the memory consumption (in bytes) of this object.

Reimplemented in internal::Triangulation::TriaObjectsHex, and internal::Triangulation::TriaObjectsQuad3D.

template<>
void internal::Triangulation::TriaObjects< TriaObject< 1 > >::reserve_space ( const unsigned int  new_lines_in_pairs,
const unsigned int  new_lines_single 
) [inline]
template<>
void internal::Triangulation::TriaObjects< TriaObject< 2 > >::reserve_space ( const unsigned int  new_quads_in_pairs,
const unsigned int  new_quads_single 
) [inline]
template<>
void internal::Triangulation::TriaObjects< TriaObject< 2 > >::monitor_memory ( const unsigned  int  )  const [inline]

Member Data Documentation

template<typename G>
std::vector<G> internal::Triangulation::TriaObjects< G >::cells

Vector of the objects belonging to this level. The index of the object equals the index in this container.

template<typename G>
std::vector<int> internal::Triangulation::TriaObjects< G >::children

Index of the even children of an object. Since when objects are refined, all children are created at the same time, they are appended to the list at least in pairs after each other. We therefore only store the index of the even children, the uneven follow immediately afterwards.

If an object has no children, -1 is stored in this list. An object is called active if it has no children. The function TriaAccessorBase::has_children() tests for this.

template<typename G>
std::vector<RefinementCase<G::dimension> > internal::Triangulation::TriaObjects< G >::refinement_cases

Store the refinement case each of the cells is refined with. This vector might be replaced by vector<vector<bool> > (dim, vector<bool> (n_cells)) which is more memory efficient.

template<typename G>
std::vector<bool> internal::Triangulation::TriaObjects< G >::used

Vector storing whether an object is used in the cells vector.

Since it is difficult to delete elements in a vector, when an element is not needed any more (e.g. after derefinement), it is not deleted from the list, but rather the according used flag is set to false.

template<typename G>
std::vector<bool> internal::Triangulation::TriaObjects< G >::user_flags

Make available a field for user data, one bit per object. This field is usually used when an operation runs over all cells and needs information whether another cell (e.g. a neighbor) has already been processed.

You can clear all used flags using Triangulation::clear_user_flags().

Referenced by internal::Triangulation::TriaObjects< G >::clear_user_flags().

template<typename G>
std::vector<unsigned char> internal::Triangulation::TriaObjects< G >::material_id

Store boundary and material data. For example, in one dimension, this field stores the material id of a line, which is a number between 0 and 254. In more than one dimension, lines have no material id, but they may be at the boundary; then, we store the boundary indicator in this field, which denotes to which part of the boundary this line belongs and which boundary conditions hold on this part. The boundary indicator also is a number between zero and 254; the id 255 is reserved for lines in the interior and may be used to check whether a line is at the boundary or not, which otherwise is not possible if you don't know which cell it belongs to.

template<typename G>
unsigned int internal::Triangulation::TriaObjects< G >::next_free_single [protected]

Counter for next_free_single_* functions

template<typename G>
unsigned int internal::Triangulation::TriaObjects< G >::next_free_pair [protected]

Counter for next_free_pair_* functions

Bool flag for next_free_single_* functions

template<typename G>
std::vector<UserData> internal::Triangulation::TriaObjects< G >::user_data [protected]

Pointer which is not used by the library but may be accessed and set by the user to handle data local to a line/quad/etc.

Referenced by internal::Triangulation::TriaObjects< G >::clear_user_data(), internal::Triangulation::TriaObjects< G >::user_index(), and internal::Triangulation::TriaObjects< G >::user_pointer().

template<typename G>
UserDataType internal::Triangulation::TriaObjects< G >::user_data_type [mutable, protected]

In order to avoid confusion between user pointers and indices, this enum is set by the first function accessing either and subsequent access will not be allowed to change the type of data accessed.

Referenced by internal::Triangulation::TriaObjects< G >::clear_user_data(), internal::Triangulation::TriaObjects< G >::user_index(), and internal::Triangulation::TriaObjects< G >::user_pointer().


The documentation for this class was generated from the following file:

deal.II documentation generated on Mon Nov 23 22:58:25 2009 by doxygen 1.6.1