Site set

Site sets are used:

  1. To define an image definition domain.
  2. As Site container.

They do not actually store any image value. They only store site information.

Here is a list of all the site set concepts which can be found in core/site_set:

Site setDescription
p_arraysite array.
p_box compact domain defined on a regular grid (in 2D, a rectangle).
p_if site set verifying a predicate.
p_queuesite queue.
p_run site range.
p_runs site range set.
p_set mathematical site set.
p_vaccesssite set ordered by value.
p_edgesset of graph edges associated to sites.
p_verticesset of graph vertices associated to sites.

All site sets are iterable. More detailed explanations are available in section Iterators .




Basic interface

Common basic interface:

Return TypeNameArgumentsConstComments
boolis_valid-XReturns true if it has been initialized. The default constructor does not initialize it.
boolhasconst P& pX 





Optional interface

Site sets may have other methods depending on their type:

Return TypeNameArgumentsConstComments
size_tnsites--Return the number of sites.
const Box&bbox-XBounding box. Available only on grid site sets.


The previous methods are available depending on the site set. A box will have the bbox() method since it can be retrived in constant time: a box is it’s own bounding box.

  box2d b(2,3);

  // The bbox can be retrived in constant time.
  std::cout << b.bbox() << std::endl;

  // nsites can be retrieved in constant time.
  std::cout << "nsites = " << b.nsites() << std::endl;
Output:
[(0,0)..(1,2)]
nsites = 6

A p_array does not have the bbox method since its sites do not have to be adjacent. Maintaining such information, in order to keep getting the bbox in constant time, would be time and memory consuming. Instead of providing a method directly in p_array, an algorithm is available if this information is needed. p_array and box both have a nsites method since the internal structure allows a constant time retrieval.

  p_array<point2d> arr;
  arr.insert(point2d(1,0));
  arr.insert(point2d(1,1));

  // The bbox is computed thanks to bbox() algorithm.
  box2d box = geom::bbox(arr);
  std::cout << box << std::endl;

  // p_array provides nsites(),
  // it can be retrieved in constant time.
  std::cout << "nsites = " << arr.nsites() << std::endl;
Output:
[(1,0)..(1,1)]
nsites = 2