Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

TET::Mesh::List< DimensionT, StorageT > Class Template Reference

An abstract base class for a list of primitives that make up a mesh. More...

#include <tetmeshlist.h>

Inheritance diagram for TET::Mesh::List< DimensionT, StorageT >:

Inheritance graph
[legend]
Collaboration diagram for TET::Mesh::List< DimensionT, StorageT >:

Collaboration graph
[legend]
List of all members.

Public Types

Public Member Functions

Protected Member Functions

Protected Attributes


Detailed Description

template<class DimensionT, class StorageT>
class TET::Mesh::List< DimensionT, StorageT >

An abstract base class for a list of primitives that make up a mesh.

This list is used to store mesh primitives like points, edges, or tetrahedra in a list for later reference via an index. It can also be used to store other objects besides primitives, as long as they are sortable. It is ensured that every entry in the list is unique, therefore the elements must provide an operator==().

The list can be adjusted for fast insert, which is essential during mesh setup to quickly decide whether an entry that is to be added is already contained in the list. If the list is in fast insert mode, every element is stored twice: first in a vector to ensure fast random access and additionally in a map with the element itself as the key and the index into the vector as value. This map is used to quickly (i.e. with logarithmic instead of linear search time) determine whether an element is already contained in the list.

If fast insert mode is switched off, the map is discarded and the list only has fast random access with linear search time. Note that this is a tradeoff between speed and storage requirements. Also note that in order to use fast insert, the elements must be sortable and therefore provide a sorting function less(). For polymorphic behavior, this function should be virtual and provide value semantics when applied to pointers. One way to achieve this is the use of a Value_Cmp function object.

Note that this is an abstract base class that implements the common features for unoriented as well as oriented lists.

See also:
Value_Cmp Shape Oriented_Shape Primitve Oriented_Primitive
Author:
Jens Hannemann
Id
tetmeshlist.h,v 1.14.2.1 2001/09/17 14:58:26 jh Exp

Definition at line 75 of file tetmeshlist.h.


Member Typedef Documentation

template<class DimensionT, class StorageT>
typedef std::vector<DimensionT>::const_iterator TET::Mesh::List< DimensionT, StorageT >::const_iterator
 

constant Iterator

Definition at line 83 of file tetmeshlist.h.


Constructor & Destructor Documentation

template<class DimensionT, class StorageT>
TET::Mesh::List< DimensionT, StorageT >::List  )  [protected]
 

Default constructor.

By default, the list is created in fast_insertion() mode, as it is most desirable during mesh setup. After setup completion, you can reduce memory requirements by disabling fast_insertion().

Definition at line 241 of file tetmeshlist.h.

References TET::Mesh::List< DimensionT, StorageT >::fastsrch, TET::Mesh::List< DimensionT, StorageT >::mp, TET::Mesh::List< DimensionT, StorageT >::nelem, and TET::Mesh::List< DimensionT, StorageT >::set_fast_insertion().

template<class DimensionT, class StorageT>
TET::Mesh::List< DimensionT, StorageT >::List const bool  fast_insert  )  [protected]
 

Constructor to set list into given insertion mode.

Using this constructor, you can determine whether the list will be created in fast or slow insertion mode

Parameters:
fast_insert determine insertion mode of the list

Definition at line 250 of file tetmeshlist.h.

References TET::Mesh::List< DimensionT, StorageT >::fastsrch, TET::Mesh::List< DimensionT, StorageT >::mp, TET::Mesh::List< DimensionT, StorageT >::nelem, and TET::Mesh::List< DimensionT, StorageT >::set_fast_insertion().

template<class DimensionT, class StorageT>
TET::Mesh::List< DimensionT, StorageT >::~List  )  [virtual]
 

Destructor.

Destructor to delete internal map if list was in fastInsertion() mode

Definition at line 259 of file tetmeshlist.h.

References TET::Mesh::List< DimensionT, StorageT >::fastsrch, and TET::Mesh::List< DimensionT, StorageT >::mp.


Member Function Documentation

template<class DimensionT, class StorageT>
const_iterator TET::Mesh::List< DimensionT, StorageT >::begin  )  const [inline]
 

Begin of the list.

This function returns a const_iterator pointing to the first element in the list.

Returns:
const_iterator pointing to the first list element

Definition at line 93 of file tetmeshlist.h.

template<class DimensionT, class StorageT>
bool TET::Mesh::List< DimensionT, StorageT >::empty  )  const [inline]
 

true, if list is empty

Returns:
true, if list is empty

Definition at line 210 of file tetmeshlist.h.

template<class DimensionT, class StorageT>
const_iterator TET::Mesh::List< DimensionT, StorageT >::end  )  const [inline]
 

End of the list.

This function returns a const_iterator pointing behind the last element of the list.

Returns:
const_iterator pointing behind the last list element

Definition at line 106 of file tetmeshlist.h.

template<class DimensionT, class StorageT>
bool TET::Mesh::List< DimensionT, StorageT >::fast_insertion  )  const [inline]
 

Insertion behavior.

This indicates whether the internal map is available to ensure fast search and therefore fast insertion of elements.

Returns:
true if fast insertion is enabled

Definition at line 187 of file tetmeshlist.h.

template<class DimensionT, class StorageT>
unsigned long TET::Mesh::List< DimensionT, StorageT >::insertions  )  const [inline]
 

Number of insertions.

This returns the number of insertions into the list, which is always greater or equal to the number of elements, depending on how many elements have been inserted more than once.

Returns:
Number of insertions

Definition at line 160 of file tetmeshlist.h.

template<class DimensionT, class StorageT>
double TET::Mesh::List< DimensionT, StorageT >::redundancy  )  const
 

mesh redundancy

Mesh redundancy is a measure of how many elements of a given mesh are unique. This means, redundancy is zero if all the elements have been inserted only once. It approaches one as the number of insertions heavily exceeds the number of stored elements. Mathematically, this means:

\[ r = 1-\frac{n_i}{n_e} \]

with $r$ being the redundancy, $n_e$ the number of stored elements and $n_i$ the number of inserted elements.

Returns:
redundancy (0 <= r < 1)

Definition at line 293 of file tetmeshlist.h.

References TET::Mesh::List< DimensionT, StorageT >::lst, and TET::Mesh::List< DimensionT, StorageT >::nelem.

template<class DimensionT, class StorageT>
void TET::Mesh::List< DimensionT, StorageT >::set_fast_insertion const bool  flag  ) 
 

Determine insertion behavior.

This lets you determine insertion behavior. With fast_insertion() set to true, insertion of elements will take place in logarithmic time at the disadvantage of increased storage requirements. If set to false, the internal map for fast lookup will be deleted to free up memory. In this state, only fast random access is available which is, however, sufficient after mesh setup.

Parameters:
flag true sets list into fast_insertion() mode

Definition at line 267 of file tetmeshlist.h.

References TET::Mesh::List< DimensionT, StorageT >::fastsrch, TET::Mesh::List< DimensionT, StorageT >::lst, and TET::Mesh::List< DimensionT, StorageT >::mp.

Referenced by TET::Mesh::List< DimensionT, StorageT >::List().

template<class DimensionT, class StorageT>
unsigned long TET::Mesh::List< DimensionT, StorageT >::size  )  const [inline]
 

Number of elements.

This returns the number of unique elements, which reflects the actual storage used by the list.

Returns:
Number of unique elements

Definition at line 149 of file tetmeshlist.h.


Member Data Documentation

template<class DimensionT, class StorageT>
bool TET::Mesh::List< DimensionT, StorageT >::fastsrch [protected]
 

flag to determine fast search

Definition at line 226 of file tetmeshlist.h.

Referenced by TET::Mesh::List< DimensionT, StorageT >::List(), TET::Mesh::List< DimensionT, StorageT >::set_fast_insertion(), and TET::Mesh::List< DimensionT, StorageT >::~List().

template<class DimensionT, class StorageT>
std::vector<DimensionT> TET::Mesh::List< DimensionT, StorageT >::lst [protected]
 

vector that holds the elements

Definition at line 216 of file tetmeshlist.h.

Referenced by TET::Mesh::List< DimensionT, StorageT >::redundancy(), and TET::Mesh::List< DimensionT, StorageT >::set_fast_insertion().

template<class DimensionT, class StorageT>
std::map<DimensionT, StorageT, TET::Value_Cmp<DimensionT> >* TET::Mesh::List< DimensionT, StorageT >::mp [protected]
 

pointer to map that is used for fast insertion if fastsrch is true

Definition at line 221 of file tetmeshlist.h.

Referenced by TET::Mesh::List< DimensionT, StorageT >::List(), TET::Mesh::List< DimensionT, StorageT >::set_fast_insertion(), and TET::Mesh::List< DimensionT, StorageT >::~List().

template<class DimensionT, class StorageT>
StorageT TET::Mesh::List< DimensionT, StorageT >::nelem [protected]
 

number of total elements

Definition at line 231 of file tetmeshlist.h.

Referenced by TET::Mesh::List< DimensionT, StorageT >::List(), and TET::Mesh::List< DimensionT, StorageT >::redundancy().


The documentation for this class was generated from the following file:
Generated on Sun Apr 25 11:59:24 2004 for TETlib by doxygen 1.3.6