The Conley-Morse Graphs Software
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
MatchArray< CoordType, IntType > Class Template Reference

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

#include <matcharr.h>

Classes

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

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. More...
 
 ~MatchArray ()
 The destructor. More...
 
void join (const CoordType *x, const CoordType *y)
 Joins the chains corresponding to the two parameter n-tuples. More...
 
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. More...
 
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). More...
 
void saveSets (const char *prefix) const
 Saves the sets to separate files. Sorts the sets by their size. More...
 

Private Member Functions

 MatchArray (const MatchArray< CoordType, IntType > &a)
 The copy constructor is not allowed. More...
 
MatchArrayoperator= (const MatchArray< CoordType, IntType > &a)
 The assignment operator is not allowed. More...
 
void link2coords (IntType link, CoordType *x) const
 Translates a flat offset array into a multidimensional one. More...
 
IntType coords2link (const CoordType *x) const
 Computes the memory offset that corresponds to the given multidimensional position in the array. More...
 
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. More...
 
void saveSet (const char *prefix, int counter, int pos, CoordType *workspace, int ndigits) const
 Saves one set to a file. More...
 
void join (IntType xpos, IntType ypos)
 Joins two sets, given the offsets in the flat arrays. More...
 

Private Attributes

IntType * link1
 Backward links for chains. More...
 
IntType * link2
 Forward links for chains. More...
 
IntType * num
 The unique number for each chain. More...
 
CoordType * sizes
 The size of the multi-dimensional array in each direction. More...
 
CoordType * corner
 The coordinates of the minimal corner of the array if any. More...
 
int dim
 The dimension of the array. More...
 
int length
 The length of the allocated memory arrays. 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 59 of file matcharr.h.

Constructor & Destructor Documentation

◆ MatchArray() [1/2]

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 157 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.

◆ ~MatchArray()

template<class CoordType , class IntType >
MatchArray< CoordType, IntType >::~MatchArray
inline

The destructor.

Definition at line 226 of file matcharr.h.

◆ MatchArray() [2/2]

template<class CoordType , class IntType >
MatchArray< CoordType, IntType >::MatchArray ( const MatchArray< CoordType, IntType > &  a)
inlineprivate

The copy constructor is not allowed.

Definition at line 246 of file matcharr.h.

Member Function Documentation

◆ coords2link()

template<class CoordType , class IntType >
IntType MatchArray< CoordType, IntType >::coords2link ( const CoordType *  x) const
inlineprivate

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

Definition at line 270 of file matcharr.h.

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

◆ getChains()

template<class CoordType , class IntType >
void MatchArray< CoordType, IntType >::getChains ( std::vector< MatchArray< CoordType, IntType >::pair2 > &  chains) const
inlineprivate

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 376 of file matcharr.h.

◆ join() [1/2]

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 355 of file matcharr.h.

◆ join() [2/2]

template<class CoordType , class IntType >
void MatchArray< CoordType, IntType >::join ( IntType  xpos,
IntType  ypos 
)
inlineprivate

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

Definition at line 283 of file matcharr.h.

◆ joined()

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 363 of file matcharr.h.

◆ link2coords()

template<class CoordType , class IntType >
void MatchArray< CoordType, IntType >::link2coords ( IntType  link,
CoordType *  x 
) const
inlineprivate

Translates a flat offset array into a multidimensional one.

Definition at line 256 of file matcharr.h.

◆ operator=()

template<class CoordType , class IntType >
MatchArray< CoordType, IntType > & MatchArray< CoordType, IntType >::operator= ( const MatchArray< CoordType, IntType > &  a)
inlineprivate

The assignment operator is not allowed.

Definition at line 238 of file matcharr.h.

◆ saveClasses()

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 438 of file matcharr.h.

◆ saveSet()

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

Saves one set to a file.

Definition at line 307 of file matcharr.h.

◆ saveSets()

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 404 of file matcharr.h.

Member Data Documentation

◆ corner

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 110 of file matcharr.h.

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

◆ dim

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

The dimension of the array.

Definition at line 113 of file matcharr.h.

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

◆ length

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

The length of the allocated memory arrays.

Definition at line 116 of file matcharr.h.

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

◆ link1

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

Backward links for chains.

Definition at line 97 of file matcharr.h.

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

◆ link2

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

Forward links for chains.

Definition at line 100 of file matcharr.h.

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

◆ num

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 104 of file matcharr.h.

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

◆ sizes

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

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

Definition at line 107 of file matcharr.h.

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


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