MatchArray< CoordType, IntType > Class Template Reference

A multi-dimensional array with links forward/backward between the entries. More...

#include <matcharr.h>

List of all members.

Public Member Functions

 MatchArray (int _dim, const CoordType *_sizes, const CoordType *_corner=0)
 The only allowed constructor in which the size of the array and its dimension must be given.
 ~MatchArray ()
 The destructor.
void join (const CoordType *x, const CoordType *y)
 Joins the chains corresponding to the two parameter n-tuples.
bool joined (const CoordType *x, const CoordType *y) const
 Checks if the two parameters have already been joined, that is, if they belong to the same chain.
template<class CubeType>
void saveClasses (std::vector< std::vector< CubeType > > &matchClasses) const
 Saves the equivalence classes larger than 1 element to the provided vector of vectors (the classes are appended).
void saveSets (const char *prefix) const
 Saves the sets to separate files. Sorts the sets by their size.

Private Member Functions

 MatchArray (const MatchArray< CoordType, IntType > &a)
 The copy constructor is not allowed.
MatchArrayoperator= (const MatchArray< CoordType, IntType > &a)
 The assignment operator is not allowed.
void link2coords (IntType link, CoordType *x) const
 Translates a flat offset array into a multidimensional one.
IntType coords2link (const CoordType *x) const
 Computes the memory offset that corresponds to the given multidimensional position in the array.
void getChains (std::vector< MatchArray< CoordType, IntType >::pair2 > &chains) const
 Retrieves a set of first elements of all the chains which have at least two elements.
void saveSet (const char *prefix, int counter, int pos, CoordType *workspace, int ndigits) const
 Saves one set to a file.
void join (IntType xpos, IntType ypos)
 Joins two sets, given the offsets in the flat arrays.

Private Attributes

IntType * link1
 Backward links for chains.
IntType * link2
 Forward links for chains.
IntType * num
 The unique number for each chain.
CoordType * sizes
 The size of the multi-dimensional array in each direction.
CoordType * corner
 The coordinates of the minimal corner of the array if any.
int dim
 The dimension of the array.
int length
 The length of the allocated memory arrays.

Classes

struct  pair2
 A small class whose objects store an IntType object and an int value. More...


Detailed Description

template<class CoordType, class IntType>
class MatchArray< CoordType, IntType >

A multi-dimensional array with links forward/backward between the entries.

Note that the type of integers provided as template's argument must be large enough to allow indexing of all the entries in a linear array.

Definition at line 60 of file matcharr.h.


Constructor & Destructor Documentation

template<class CoordType, class IntType>
MatchArray< CoordType, IntType >::MatchArray ( int  _dim,
const CoordType *  _sizes,
const CoordType *  _corner = 0 
) [inline]

The only allowed constructor in which the size of the array and its dimension must be given.

Optionally the coordinates of the minimal corner may be provided.

Definition at line 158 of file matcharr.h.

References MatchArray< CoordType, IntType >::coords2link(), MatchArray< CoordType, IntType >::corner, MatchArray< CoordType, IntType >::dim, MatchArray< CoordType, IntType >::length, MatchArray< CoordType, IntType >::link1, MatchArray< CoordType, IntType >::link2, MatchArray< CoordType, IntType >::num, and MatchArray< CoordType, IntType >::sizes.

template<class CoordType, class IntType>
MatchArray< CoordType, IntType >::~MatchArray (  )  [inline]

The destructor.

Definition at line 227 of file matcharr.h.

References MatchArray< CoordType, IntType >::corner, MatchArray< CoordType, IntType >::link1, MatchArray< CoordType, IntType >::link2, MatchArray< CoordType, IntType >::num, and MatchArray< CoordType, IntType >::sizes.

template<class CoordType, class IntType>
MatchArray< CoordType, IntType >::MatchArray ( const MatchArray< CoordType, IntType > &  a  )  [inline, private]

The copy constructor is not allowed.

Definition at line 248 of file matcharr.h.


Member Function Documentation

template<class CoordType, class IntType>
void MatchArray< CoordType, IntType >::join ( const CoordType *  x,
const CoordType *  y 
) [inline]

Joins the chains corresponding to the two parameter n-tuples.

Definition at line 356 of file matcharr.h.

References MatchArray< CoordType, IntType >::coords2link().

template<class CoordType, class IntType>
bool MatchArray< CoordType, IntType >::joined ( const CoordType *  x,
const CoordType *  y 
) const [inline]

Checks if the two parameters have already been joined, that is, if they belong to the same chain.

Returns "true" if yes, "false" if not.

Definition at line 364 of file matcharr.h.

References MatchArray< CoordType, IntType >::coords2link(), and MatchArray< CoordType, IntType >::num.

template<class CoordType, class IntType>
template<class CubeType>
void MatchArray< CoordType, IntType >::saveClasses ( std::vector< std::vector< CubeType > > &  matchClasses  )  const [inline]

Saves the equivalence classes larger than 1 element to the provided vector of vectors (the classes are appended).

The type of coordinates of the cube type must match "CoordType".

Definition at line 440 of file matcharr.h.

References MatchArray< CoordType, IntType >::dim, MatchArray< CoordType, IntType >::getChains(), MatchArray< CoordType, IntType >::link1, MatchArray< CoordType, IntType >::link2, and MatchArray< CoordType, IntType >::link2coords().

template<class CoordType, class IntType>
void MatchArray< CoordType, IntType >::saveSets ( const char *  prefix  )  const [inline]

Saves the sets to separate files. Sorts the sets by their size.

Definition at line 405 of file matcharr.h.

References MatchArray< CoordType, IntType >::dim, MatchArray< CoordType, IntType >::getChains(), and MatchArray< CoordType, IntType >::saveSet().

template<class CoordType, class IntType>
MatchArray< CoordType, IntType > & MatchArray< CoordType, IntType >::operator= ( const MatchArray< CoordType, IntType > &  a  )  [inline, private]

The assignment operator is not allowed.

Definition at line 240 of file matcharr.h.

template<class CoordType, class IntType>
void MatchArray< CoordType, IntType >::link2coords ( IntType  link,
CoordType *  x 
) const [inline, private]

Translates a flat offset array into a multidimensional one.

Definition at line 257 of file matcharr.h.

References MatchArray< CoordType, IntType >::corner, MatchArray< CoordType, IntType >::dim, and MatchArray< CoordType, IntType >::sizes.

Referenced by MatchArray< CoordType, IntType >::saveClasses(), and MatchArray< CoordType, IntType >::saveSet().

template<class CoordType, class IntType>
IntType MatchArray< CoordType, IntType >::coords2link ( const CoordType *  x  )  const [inline, private]

Computes the memory offset that corresponds to the given multidimensional position in the array.

Definition at line 272 of file matcharr.h.

References MatchArray< CoordType, IntType >::corner, MatchArray< CoordType, IntType >::dim, and MatchArray< CoordType, IntType >::sizes.

Referenced by MatchArray< CoordType, IntType >::join(), MatchArray< CoordType, IntType >::joined(), and MatchArray< CoordType, IntType >::MatchArray().

template<class CoordType, class IntType>
void MatchArray< CoordType, IntType >::getChains ( std::vector< MatchArray< CoordType, IntType >::pair2 > &  chains  )  const [inline, private]

Retrieves a set of first elements of all the chains which have at least two elements.

The list is sorted according to the lengths of the chains in the descending order.

Definition at line 378 of file matcharr.h.

References MatchArray< CoordType, IntType >::length, MatchArray< CoordType, IntType >::link1, and MatchArray< CoordType, IntType >::link2.

Referenced by MatchArray< CoordType, IntType >::saveClasses(), and MatchArray< CoordType, IntType >::saveSets().

template<class CoordType, class IntType>
void MatchArray< CoordType, IntType >::saveSet ( const char *  prefix,
int  counter,
int  pos,
CoordType *  workspace,
int  ndigits 
) const [inline, private]

Saves one set to a file.

Definition at line 308 of file matcharr.h.

References MatchArray< CoordType, IntType >::dim, MatchArray< CoordType, IntType >::link1, MatchArray< CoordType, IntType >::link2, and MatchArray< CoordType, IntType >::link2coords().

Referenced by MatchArray< CoordType, IntType >::saveSets().

template<class CoordType, class IntType>
void MatchArray< CoordType, IntType >::join ( IntType  xpos,
IntType  ypos 
) [inline, private]

Joins two sets, given the offsets in the flat arrays.

Definition at line 284 of file matcharr.h.

References MatchArray< CoordType, IntType >::link1, MatchArray< CoordType, IntType >::link2, and MatchArray< CoordType, IntType >::num.


Member Data Documentation

template<class CoordType, class IntType>
IntType* MatchArray< CoordType, IntType >::link1 [private]

Backward links for chains.

Definition at line 98 of file matcharr.h.

Referenced by MatchArray< CoordType, IntType >::getChains(), MatchArray< CoordType, IntType >::join(), MatchArray< CoordType, IntType >::MatchArray(), MatchArray< CoordType, IntType >::saveClasses(), MatchArray< CoordType, IntType >::saveSet(), and MatchArray< CoordType, IntType >::~MatchArray().

template<class CoordType, class IntType>
IntType* MatchArray< CoordType, IntType >::link2 [private]

Forward links for chains.

Definition at line 101 of file matcharr.h.

Referenced by MatchArray< CoordType, IntType >::getChains(), MatchArray< CoordType, IntType >::join(), MatchArray< CoordType, IntType >::MatchArray(), MatchArray< CoordType, IntType >::saveClasses(), MatchArray< CoordType, IntType >::saveSet(), and MatchArray< CoordType, IntType >::~MatchArray().

template<class CoordType, class IntType>
IntType* MatchArray< CoordType, IntType >::num [private]

The unique number for each chain.

This is stored here to speed up the verification if two boxes are in the same chain.

Definition at line 105 of file matcharr.h.

Referenced by MatchArray< CoordType, IntType >::join(), MatchArray< CoordType, IntType >::joined(), MatchArray< CoordType, IntType >::MatchArray(), and MatchArray< CoordType, IntType >::~MatchArray().

template<class CoordType, class IntType>
CoordType* MatchArray< CoordType, IntType >::sizes [private]

The size of the multi-dimensional array in each direction.

Definition at line 108 of file matcharr.h.

Referenced by MatchArray< CoordType, IntType >::coords2link(), MatchArray< CoordType, IntType >::link2coords(), MatchArray< CoordType, IntType >::MatchArray(), and MatchArray< CoordType, IntType >::~MatchArray().

template<class CoordType, class IntType>
CoordType* MatchArray< CoordType, IntType >::corner [private]

The coordinates of the minimal corner of the array if any.

Definition at line 111 of file matcharr.h.

Referenced by MatchArray< CoordType, IntType >::coords2link(), MatchArray< CoordType, IntType >::link2coords(), MatchArray< CoordType, IntType >::MatchArray(), and MatchArray< CoordType, IntType >::~MatchArray().

template<class CoordType, class IntType>
int MatchArray< CoordType, IntType >::dim [private]

The dimension of the array.

Definition at line 114 of file matcharr.h.

Referenced by MatchArray< CoordType, IntType >::coords2link(), MatchArray< CoordType, IntType >::link2coords(), MatchArray< CoordType, IntType >::MatchArray(), MatchArray< CoordType, IntType >::saveClasses(), MatchArray< CoordType, IntType >::saveSet(), and MatchArray< CoordType, IntType >::saveSets().

template<class CoordType, class IntType>
int MatchArray< CoordType, IntType >::length [private]

The length of the allocated memory arrays.

Definition at line 117 of file matcharr.h.

Referenced by MatchArray< CoordType, IntType >::getChains(), and MatchArray< CoordType, IntType >::MatchArray().


The documentation for this class was generated from the following file:
Generated on Sun Mar 28 17:47:59 2010 for The Conley-Morse Graphs Software by  doxygen 1.5.3