Classes | Namespaces | Defines | Typedefs | Functions

pointset.h File Reference

This file contains the definition of a set of n-dimensional points with integer coordinates and several operations on such a set. More...

#include "chomp/system/config.h"
#include "chomp/system/textfile.h"
#include <iostream>
#include <fstream>
#include <ctime>
#include <cstdlib>
#include <cctype>

Go to the source code of this file.

Classes

class  chomp::homology::psethashstat
 This is a small class used only to collect and display statistics on how successful the hashing procedures were. More...
class  chomp::homology::tPointset< coordtype >
 This class represents a set of points in R^n with integer coordinates. More...
class  chomp::homology::tNeighbors< coordtype >
 This class can be used for iterating point's neighbors. More...
class  chomp::homology::tRectangle< coordtype >
 This class can be used for iterating a rectangular set of points, given its left and right bound. More...

Namespaces

namespace  chomp
 

This namespace contains the entire CHomP library interface.


namespace  chomp::homology
 

This namespace contains the core of the homology computation procedures and related classes and templates contained in the CHomP C++ library.


Defines

#define INSIDE   1
#define OUTSIDE   0
#define CELL   0
#define CUBE   1

Typedefs

typedef short int chomp::homology::coordinate
 The default type of coordinates.
typedef tPointset< coordinate > chomp::homology::pointset
 The pointset class with the default type of coordinates.
typedef tNeighbors< coordinate > chomp::homology::neighbors
 The neighbors class with the default type of coordinates.
typedef tRectangle< coordinate > chomp::homology::rectangle
 The rectangle class with the default type of coordinates.

Functions

template<class coordtype >
int chomp::homology::thesame (const coordtype *c1, const coordtype *c2, int dim)
 Compare two points. Returns true iff they have the same coordinates.
template<class coordtype >
void chomp::homology::copycoord (coordtype *destination, const coordtype *source, int dim)
 Copies the coordinates of one point to another.
template<class coordtype >
void chomp::homology::wrapcoord (coordtype *destination, const coordtype *source, const coordtype *wrap, int dim)
 Wraps coordinates stored in 'c' accordint to the wrap table 'wrap' and store the result in the table called 'result'.
bool chomp::homology::numberisprime (unsigned n)
 Verifies if the given number is a prime number.
unsigned chomp::homology::ceilprimenumber (unsigned n)
 Computes the smallest prime number greater than or equal to the given number.
template<class coordtype >
int_t chomp::homology::pointhashkey (const coordtype *c, int dim, int_t hashsize)
 Generates the main hashing key for points.
template<class coordtype >
int_t chomp::homology::pointhashadd (const coordtype *c, int dim, int_t hashsize)
 Generates the second hashing key for points.
template<class coordtype >
coordtype chomp::homology::rounddown (double x)
 Rounds down the given real number to an integral type.
template<class coordtype >
void chomp::homology::roundpoint (const double *p, coordtype *c, const double *grid, int dim)
 Rounds down the double coordinates of a point to integer ones.
template<class coordtype >
void chomp::homology::cubemiddle (coordtype *c, double *p, double *grid, int dim)
 Computes the middle of a cube with its left lower etc.
template<class coordtype >
coordtype * chomp::homology::allocatepoint (int dim, char *errormessage=NULL)
 Allocate a point with 'new'. In case of failure throw an error message.
template<class coordtype >
int chomp::homology::countneighbors (const tPointset< coordtype > &p, const coordtype *c, int which=1, int maxcount=0)
 Counts how many neighbors of the point there are in the set, depending on 'which': 1 = in the set, 0 = out of the set.
template<class coordtype >
int chomp::homology::countneighbors (const tPointset< coordtype > &p, const tPointset< coordtype > &q, const coordtype *c, int which=1, int maxcount=0)
 Counts neighbors with respect to the union of the sets 'p' and 'q'.
template<class coordtype >
int chomp::homology::attheborder (const tPointset< coordtype > &p, const coordtype *c)
 Verifies if the point is at the border of a given set.
template<class coordtype >
int_t chomp::homology::findboundarypoint (tPointset< coordtype > &p, int_t n, int direction=1)
 Finds a boundary point starting at the given one.
template<class coordtype >
int_t chomp::homology::findboundarypoint (tPointset< coordtype > &p, tPointset< coordtype > &q, int_t n, int direction=1)
 Finds a point in 'p' at the boundary of the union of 'p' and 'q'.
template<class coordtype >
tPointset< coordtype > * chomp::homology::computeboundary (tPointset< coordtype > &p)
 Creates the set of all the boundary points with the 'new' operator.
template<class coordtype >
void chomp::homology::computeboundary (tPointset< coordtype > &p, tPointset< coordtype > &b)
 Computes the boundary points of the given set and adds them to the other set of points.
template<class coordtype >
void chomp::homology::enhancepoint (tPointset< coordtype > &p, coordtype *c)
 Enhances the set by adding the neighborhood of the point with given coordinates.
template<class coordtype >
void chomp::homology::enhancepoint (tPointset< coordtype > &p, int_t n)
 Enhances the set by adding the neighborhood of the point with given number.
template<class coordtype >
void chomp::homology::enhance (tPointset< coordtype > &p)
 Enhances the set of points by adding to it all the neighbors of all the points in the set.
template<class coordtype >
int chomp::homology::read (textfile &f, coordtype *c, int maxdim)
 Reads a point from a text file and removes a pair of parentheses, braces or brackets if present.
template<class coordtype >
int chomp::homology::read (std::istream &in, coordtype *c, int maxdim)
 Reads a point from a text file and removes a pair of parentheses, braces or brackets if present.
template<class coordtype >
int chomp::homology::write (std::ostream &out, const coordtype *c, int dim, char parenthesis=40, char closing=0)
template<class coordtype >
int chomp::homology::readcubeorcell (std::istream &in, coordtype *left, coordtype *right, int maxdim, int *type=NULL)
 Reads a cube or a cell from a text file.
template<class coordtype >
int_t chomp::homology::read (textfile &f, tPointset< coordtype > &p, int_t first=0, int_t howmany=-1, coordtype *wrap=NULL, int maxdim=0, int quiet=0, tPointset< coordtype > *notthese=NULL)
 Reads a set of points from an input stream (starting at the point given).
template<class coordtype >
int_t chomp::homology::read (std::istream &in, tPointset< coordtype > &p, int_t first=0, int_t howmany=-1, coordtype *wrap=NULL, int maxdim=0, int quiet=0, tPointset< coordtype > *notthese=NULL)
 Reads a set of points from an input stream (starting at the point given).
template<class coordtype >
int_t chomp::homology::read (textfile &f, tPointset< coordtype > &p, coordtype *wrap, int maxdim, int quiet=0, tPointset< coordtype > *notthese=NULL)
 Reads a set of points from an input stream (starting at the point given).
template<class coordtype >
int_t chomp::homology::read (std::istream &in, tPointset< coordtype > &p, coordtype *wrap, int maxdim, int quiet=0, tPointset< coordtype > *notthese=NULL)
 Reads a set of points from an input stream (starting at the point given).
template<class coordtype >
textfile & chomp::homology::operator>> (textfile &f, tPointset< coordtype > &p)
 Reads a set of points from an input stream (starting at the point given).
template<class coordtype >
std::istream & chomp::homology::operator>> (std::istream &in, tPointset< coordtype > &p)
 Reads a set of points from an input stream (starting at the point given).
template<class coordtype >
int_t chomp::homology::write (std::ostream &out, tPointset< coordtype > &p, int_t first=0, int_t howmany=-1, int quiet=0)
 Writes a set of points to a file (starting at the point given).
template<class coordtype >
std::ostream & chomp::homology::operator<< (std::ostream &out, tPointset< coordtype > &p)
 Writes a set of points to a file (starting at the point given).
std::ostream & chomp::homology::operator<< (std::ostream &out, const psethashstat &s)
 Writes the information gathered in a hashing statistics collector object to an output stream.
template<class coordtype >
int chomp::homology::countneighbors (const tPointset< coordtype > &p, const tPointset< coordtype > &q, coordtype *c, int which, int maxcount)
template<class coordtype >
void chomp::homology::computeboundary (const tPointset< coordtype > &p, tPointset< coordtype > &b)
template<class coordtype >
int chomp::homology::readcoordinates (std::istream &in, coordtype *coord, int maxdim, int closing)
 Reads the coordinates of a point.
template<class coordtype >
int chomp::homology::readcoordinates (std::istream &in, coordtype *coord, int maxdim)

Detailed Description

This file contains the definition of a set of n-dimensional points with integer coordinates and several operations on such a set.

The access to individual points is the same as to an array, with the operator []. However, the hashing tables are used for fast searching for specific points.

The type of coordinates is a template of the classes and functions defined in this file. It must be some integer-like type, e.g., short int or long int.

Additional data structures and functions related to the sets of points are also defined in this file, including classes for iterating neighborhoods of points and points in a specific rectangular range.

Author:
Pawel Pilarczyk

Definition in file pointset.h.


Define Documentation

#define CELL   0

Definition at line 342 of file pointset.h.

#define CUBE   1

Definition at line 343 of file pointset.h.

#define INSIDE   1

Definition at line 259 of file pointset.h.

Referenced by chomp::homology::countneighbors().

#define OUTSIDE   0