Cytosim PI Cytoskeleton Simulator

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Static Protected Attributes
Space Class Referenceabstract

## Detailed Description

Confined Space needs to define two important functions:

- inside(x), which tells if a position is inside the space or outside,
- project(x,p), which projects x perpendicularly on the edge of the space.

The edges are considered to be inside.

Inheritance diagram for Space:

## Public Member Functions
| Space (const SpaceProp *p)
| constructor
virtual | ~Space ()
| destructor
unsigned int | nbLengths () const
| number of dimensions defined by the user
real | length (unsigned int d) const
| return dimension d
real | length2 (unsigned int d) const
| return double dimension d
real | lengthSqr (unsigned int d) const
| return squared dimension d
void | readLengths (const std::string &)
| read dimensions from a stream
void | checkLengths (unsigned int required, bool positive) const
| check that required lengths have been specified More...
void | resize (unsigned int d, real v)
| change dimension d to v, and update derived variables (this calls resize())
virtual void | resize ()
| this is called if any length has been changed
virtual real | volume () const =0
| the volume inside in 3D, or the surface area in 2D
virtual Vector | extension () const =0
| Maximum absolute value of X, Y and Z taken over all points inside. More...
virtual bool | inside (const real point[]) const =0
| true if point is inside or on the edge of this Space
virtual void | project (const real point[], real proj[]) const =0
| set proj to be the projection (ie. nearest point) of point on the edge of this Space.
virtual void | setInteraction (Vector const &pos, PointExact const &, Meca &, real stiff) const
| apply a force directed towards the edge of this Space, for a point located at `pos` More...
virtual void | setInteraction (Vector const &pos, PointExact const &, real rad, Meca &, real stiff) const
| apply a force directed towards the edge of this Space deflated by radius More...
virtual bool | allInside (const real center[], real rad) const
| true if a sphere (center, radius) is entirely inside this Space More...
virtual bool | allOutside (const real center[], real rad) const
| true if a sphere (center, radius) is entirely outside this Space More...
bool | outside (const real point[]) const
| true if point is outside this Space ( defined as !inside(point) )
void | project (const real point[], real proj[], real rad) const
| project point on this Space deflated by radius More...
void | project (real point[]) const
| project point on edge of this Space, and return the result in point
real | distanceToEdgeSqr (const real point[]) const
| the square of the distance to the edge of this Space
real | distanceToEdge (const real point[]) const
| the distance to the edge, always positive
real | signedDistanceToEdge (const real point[]) const
| the distance to the edge, positive if point is outside, and negative if inside
void | bounceInside (real w[]) const
| bounce the object off the wall to put it back inside More...
virtual Vector | normalToEdge (const real point[]) const
| a Vector perpendicular to the space edge at point, directed towards the outside More...
Vector | randomPlace () const
| a random position in the volume More...
virtual Vector | randomPlaceNearEdge (real rad) const
| a random position located at most at distance radius from the edge More...
Vector | randomPlaceOnEdge (real rad) const
| a random position located on the edge More...
virtual real | estimateVolume (unsigned long cnt) const
| estimate Volume using a poor Monte-Carlo method with cnt trials More...
virtual void | step ()
| one Monte-Carlo simulation step
virtual void | setInteractions (Meca &) const
| add interactions to a Meca
Tag | tag () const
| return unique character identifying the class
const Property * | property () const
| return Object Property
virtual void | read (InputWrapper &, Simul &)
| read from file
virtual void | write (OutputWrapper &) const
| write to file
Space * | next () const
| a static_cast<> of Node::next()
Space * | prev () const
| a static_cast<> of Node::prev()
virtual bool | display () const
| a shape-specific openGL display function, return true is display was done More...
void | displaySection (int dim, real pos, real step) const
| display the outline of a section of the box
Public Member Functions inherited from Object
| Object ()
| constructor
std::string | reference () const
| concatenation of [ tag(), property()->index(), number() ] in plain ascii More...
void | writeReference (OutputWrapper &) const
| write a reference that identifies the Object uniquely More...
void | writeReference (OutputWrapper &, Tag tag) const
| write a reference, but using the provided Tag More...
int | mark () const
| birth mark value
void | mark (int m)
| set birth mark
int | fleck () const
| fleck value (not stored in trajectory files)
void | fleck (int f) const
| set fleck (the value is not stored in trajectory files)
Object * | next () const
| extends Node::next(), with a cast to preserve type
Object * | prev () const
| extends Node::prev(), with a cast to preserve type
Public Member Functions inherited from Node
| Node ()
| constructor set as unlinked
virtual | ~Node ()
| destructor More...
bool | linked () const
| true if Node is linked
Node * | next () const
| the next Node in the list, or zero if this is last
Node * | prev () const
| the previous Node in the list, or zero if this is first
NodeList * | list () const
| the list where the object is linked, or zero
ObjectSet * | objset () const
| return associated ObjectSet
Public Member Functions inherited from Inventoried
| Inventoried ()
| initialize (name=0)
| ~Inventoried ()
| destructor
void | number (Number n)
| change the serial number
Number | number () const
| serial number : a integer identifier, unique within each class
Public Member Functions inherited from Movable
| Movable ()
| constructor
virtual | ~Movable ()
| destructor
virtual Vector | position () const
| return the position in space of the object
virtual void | setPosition (Vector const &)
| move object to specified position More...
virtual bool | translatable () const
| true if object accepts translations (default=false)
virtual void | translate (Vector const &)
| move the object ( position += given vector ) More...
virtual bool | rotatable () const
| true if object accepts rotations (default=false)
virtual void | rotate (Rotation const &)
| rotate the object around the origin of coordinates More...
virtual void | rotateP (Rotation const &)
| rotate the object around its current position More...
virtual void | foldPosition (Modulo const *)
| perform modulo for periodic boundary conditions More...

## Public Attributes
const SpaceProp * | prop
| parameters

## Static Public Attributes
static const Tag | TAG = 'e'
| a unique character identifying the class
Static Public Attributes inherited from Object
static const Tag | TAG = 'v'
| Object::TAG = 'v' represents the 'void' pointer.

## Protected Attributes
unsigned int | nLength
| number of dimensions defined in mLength[]
real | mLength [DMAX]
| dimensions that define the geometry
real | mLength2 [DMAX]
| double of each dimension
real | mLengthSqr [DMAX]
| square of each dimension
Protected Attributes inherited from Node
Node * | nNext
| the next Node in the list
Node * | nPrev
| the previous Node in the list
Protected Attributes inherited from Inventoried
Number | nNumber
| object identifier, unique within the class defined by tag()

## Static Protected Attributes
static const unsigned int | DMAX = 8
| max number of dimensions

## Additional Inherited Members
Static Public Member Functions inherited from Object
static std::string | strReference (char, int, Number, int)
| build a string reference by concatenating (tag, property_index, number, mark) More...
static void | readReference (InputWrapper &, int &, Number &, int &, char pretag)
| read a reference (property_index, number, mark) from input More...
static void | writeNullReference (OutputWrapper &)
| write a reference that does not refer to any Object
Static Public Member Functions inherited from Movable
static Vector | readPrimitive (std::istream &, const Space *)
| read a position specified with primitives, such as 'circle 5', etc. More...
static Vector | readPosition (std::istream &, const Space *)
| read a position in space More...
static Vector | readDirection (std::istream &, const Vector &, const Space *)
| read an orientation, and return a normalized vector More...
static Rotation | readRotation (std::istream &, const Vector &, const Space *)
| read a rotation specified in is, at position pos More...

## Member Function Documentation

bool allInside | ( | const real | center[],
|  | real | rad
| ) |  | const
| virtual

A bead is entirely inside if:

- its center is inside,
- the minimal distance (center-to-edge) is greater than the radius

Reimplemented in SpaceCylinderP, SpaceCylinder, SpaceCylinderZ, SpaceCapsule, and SpaceSquare.

bool allOutside | ( | const real | center[],
|  | real | rad
| ) |  | const
| virtual

A bead is entirely outside if:

- its center is outside,
- the minimal distance (center-to-edge) is greater than the radius

Attention: this is not equivalent to !allInside(center, radius)

Reimplemented in SpaceSquare.

void bounceInside | ( | real | w[] | ) | const

This uses Space::project to reflect w on the edge of the Space, until the result eventually falls inside.

In most geometries, this works well, but if the distance that the point is outside is very large compared to the width of the space, the number of iterations can be large.

void checkLengths | ( | unsigned int | required,
|  | bool | positive
| ) |  | const

Checks that the number of specified dimensions is >= required, and if positive == true, also check that they are positive values.

virtual bool display | ( |  | ) | const
| inline virtual

In 2D, this should cover the inside area using polygons primities. in 3D, this should draw the surface of the space, using polygon primities.

Reimplemented in SpaceCylinderP, SpaceEllipse, SpaceCylinder, SpacePolygon, SpaceCylinderZ, SpaceCapsule, SpaceSquare, SpaceStrip, SpacePeriodic, SpaceTorus, SpaceDice, and SpaceSphere.

real estimateVolume | ( | unsigned long | cnt | ) | const
| virtual

The volume is estimated ONCE with a simple monte-carlo approach:

- throw points in the rectangular volume provided by extension()
- count how many are inside the volume with inside()

Then

volume ~ ( number-of-points-inside / number-of-point ) * volume-of-rectangle

virtual Vector extension | ( |  | ) | const
| pure virtual

Returns
  [ max(|X|), max(|Y|), max(|Z|) ]

This is a weaker form of 'minimum bounding rectangle'. It defines a rectangle that is centered around the origin, containing the entire volume. The bounds are not required to be minimal, but most algorithms are more efficient when that is the case.

Implemented in SpaceCylinderP, SpaceTorus, SpacePolygon, SpaceCylinder, SpaceDice, SpaceCylinderZ, SpaceCapsule, SpaceSphere, SpaceSquare, SpaceEllipse, SpaceStrip, and SpacePeriodic.

Vector normalToEdge | ( | const real | point[] | ) | const
| virtual

normalToEdge(const real point[]) uses an iterative method to find the normal to the edge, using the project() method.

If you know for certain that point[] is far from the edge, the normal can be more directly obtained from the projection:

project(point, proj);
normal = ( proj - point ).normalized()

Reimplemented in SpaceEllipse.

void project | ( | const real | point[],
|  | real | proj[],
|  | real | rad
| ) |  | const

this code is equivalent to SpaceInflate::project(), with a negative radius

Todo:
  problem in project() with radius if point is exactly on the box (n==0)

Vector randomPlace | ( |  | ) | const

Provide a uniform random distribution in the volume by Monte-Carlo.

Algorithm: throw a point in the rectangular volume provided by extension() until inside() returns true.

Vector randomPlaceNearEdge | ( | real | rad | ) | const
| virtual

Return a point for which:

- inside(point) = true
- inside(point, radius) = false

Vector randomPlaceOnEdge | ( | real | rad | ) | const

obtained by projection of randomPlaceNearEdge()

Returns the projection of a point obtained by randomPlaceNearEdge()

void setInteraction | ( | Vector const & | pos,
|  | PointExact const & | pe,
|  | Meca & | meca,
|  | real | stiff
| ) |  | const
| virtual

Call the appropriate interaction from meca, to confine pe.

This implementation uses pos to find the local normal to the edge of the Space. and then calls Meca::interPlane, with the approprimate aguments. This generates a friction-less potential centered on the edge.

Reimplemented in SpaceCylinderP, SpaceCylinder, SpaceCylinderZ, SpacePolygon, SpaceCapsule, SpaceSquare, and SpaceSphere.

void setInteraction | ( | Vector const & | pos,
|  | PointExact const & | pe,
|  | real | rad,
|  | Meca & | meca,
|  | real | stiff
| ) |  | const
| virtual

Call the appropriate interaction from meca, to confine pe, which is at position pos.

The default implementation projects pos, to calculate the direction of the normal to the edge of the Space, and then calls Meca::interPlane, with the approprimate aguments. This generates a friction-less potential centered on the edge.

Reimplemented in SpaceCylinderP, SpaceCylinder, SpaceCylinderZ, SpacePolygon, SpaceCapsule, SpaceSquare, and SpaceSphere.