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 | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes
ObjectSet Class Referenceabstract

## Detailed Description

Encapsulates the different functions used to manage Objects. Pointers to the Objects are stored in two lists:

- a doubly linked list: nodes
- an array: inventory

The NodeList nodes is mixed at every time step, and thus it can be used to access the objects in a random order, as necessary for Monte-Carlo.

The Inventory can be used to access objects directly.

Functions are used to manage:

- object creation: newProperty(), newObject().
- object lists: size(), add(), remove(), relink(), erase().
- object access: first(), find().
- simulation: step(), mix().
- I/O: readObject(), read(), write(), freeze(), thaw().

Inheritance diagram for ObjectSet:

## Public Member Functions
virtual void | freeze ()
| transfer all nodes to list ice
virtual void | thaw (bool erase)
| erase objects, or put them back in normal list
| ObjectSet (Simul &s)
| creator
virtual | ~ObjectSet ()
| destructor
virtual std::string | kind () const
| identifies the sort of objects stored in the set
virtual Property * | newProperty (const std::string &kind, const std::string &name, Glossary &) const =0
| create a new property for class kind with given name
virtual Object * | newObject (const std::string &kind, const std::string &name, Glossary &opt)=0
| create a single new object with given Property More...
virtual ObjectList | newObjects (const std::string &kind, const std::string &name, Glossary &opt)
| create new objects, given Property and options in opt More...
virtual ObjectList | newPlacedObjects (const std::string &kind, const std::string &name, Glossary &opt)
| create new objects, translate and rotate them according to specifications in opt More...
virtual Object * | newObjectT (const Tag, int prop_index)=0
| create a new object from the corresponding tag (used for IO)
virtual void | add (Object *)
| register Object, and add it at the end of the list
void | add (ObjectList &)
| remove Object in ObjectList
virtual void | remove (Object *)
| remove Object
void | remove (ObjectList &)
| remove Object in ObjectList
virtual void | relink (Object *)
| unlink and relink object. This places it last in the list More...
void | erase (Object *)
| remove Object, and delete it
virtual void | erase ()
| delete all Objects in list and forget all serial numbers
virtual unsigned | size () const
| number of elements
virtual void | mix ()
| mix the order of elements in the doubly linked list nodes
Object * | first () const
| first Object in the list
Object * | first (const Property *) const
| return an Object which has this property More...
Object * | last () const
| last Object
Object * | find (const Number n) const
| find Object of given serial-number (see Inventoried)
Object * | findObject (long n) const
| return Object with serial-number if ( n > 0 ) or object from the end of the list if ( n <= 0 ) More...
virtual ObjectList | collect (bool(*func)(Object const *, void *), void *) const
| collect Object for which func(obj, val) == true
void | readObject (InputWrapper &, Tag, char pretag)
| read one Object from file More...
virtual void | write (OutputWrapper &out) const
| write all Objects to file

## Static Public Member Functions
static void | translateObjects (ObjectList const &, Vector const &)
| apply translation to all Objects in ObjectList More...
static void | rotateObjects (ObjectList const &, Rotation const &)
| apply rotation to all Objects in ObjectList More...

## Public Attributes
Inventory | inventory
| holds pointers to the Objects in a array of Numbers
NodeList | nodes
| holds pointers to the Objects in a doubly linked list
Simul & | simul
| the Simul containing this ObjectSet

## Protected Member Functions
void | forget (NodeList &)
| remove all nodes in the list from the inventory
virtual void | link (Object *)
| link the object last in the list More...

## Static Protected Member Functions
static ObjectList | collect (const NodeList &, bool(*func)(Object const *, void *), void *)
| collect Object from NodeList for which func(obj, val) == true
static void | write (const NodeList &, OutputWrapper &)
| write Object in NodeList to file More...
static Vector | placeObjects (ObjectList const &, Glossary &opt, const Space *)
| place all Objects in ObjectList using the same combinations of translation/rotation More...

## Protected Attributes
NodeList | ice
| a list used to store the objects temporarily while a state is imported

## Member Function Documentation

Object * findObject | ( | long | num | ) | const

if ( num > 0 ) this will call Inventory::find() if ( num < 0 ) objects from the end of the list will be returned: num = 0 is the last object num = -1 is the previous one, etc.

Object * first | ( | const Property * | prop | ) | const

return the first object encountered with the given property, but it can be any one of them, since the lists are regularly shuffled to randomize the order in the list.

void link | ( | Object * | obj | ) |
| protected virtual

The object is added at the end of the list

Reimplemented in CoupleSet.

virtual Object* newObject | ( | const std::string & | kind,
|  | const std::string & | name,
|  | Glossary & | opt
| ) |  |
| pure virtual

The Object should be placed at the origin and aligned with the X-axis

Implemented in CoupleSet, SingleSet, FiberSet, FieldSet, SpaceSet, OrganizerSet, BeadSet, SolidSet, and SphereSet.

ObjectList newObjects | ( | const std::string & | kind,
|  | const std::string & | prop,
|  | Glossary & | opt
| ) |  |
| virtual

This returns a list of Objects, that are not necessarily all of the same class. For example, the list may contain a Solid, and a bunch of attached Singles. The Objects are placed at the origin, and aligned with the X-axis. The Objects should be added to the Simul.

The default behavior is to call newObject()

Reimplemented in CoupleSet, SingleSet, FiberSet, OrganizerSet, BeadSet, SolidSet, and SphereSet.

ObjectList newPlacedObjects | ( | const std::string & | kd,
|  | const std::string & | nm,
|  | Glossary & | opt
| ) |  |
| virtual

- This returns a list of Objects, that are not necessarily all of the same class. For example, the list may contain a Solid, and any number of attached Singles.
- These Objects are not yet linked in the Simul.
- They are placed and oriented in Space according to the options provided in 'opt'.

This calls newObjects()

new INTEGER CLASS NAME
{
position = POSITION
placement = PLACEMENT, SPACE_NAME
nb_trials = INTEGER
}

PLACEMENT can be:

- if placement = inside (default), it tries to find a place inside the Space
- if placement = anywhere, the position is returned
- if placement = outside, the object is created only if it is outside the Space
- if placement = surface, the position is projected on the edge of current Space

By default, the specifications are relative to the last Space that was defined, but a different space can be specified as second argument of PLACEMENT.

You can set the density of objects by setting nb_trials=1:

new 100 single grafted
{
position = ( rectangle 10 10 )
nb_trials = 1
}

This way an object will be created only if the position falls inside, and the density will be exactly 100/10*10 = 1.

Vector placeObjects | ( | ObjectList const & | objs,
|  | Glossary & | opt,
|  | const Space * | spc
| ) |  |
| static protected

Returns
  the position where the objects were placed

Todo:
  implement keyword 'transformation'

void readObject | ( | InputWrapper & | in,
|  | Tag | tag,
|  | char | pretag
| ) |  |

We do not allow property()->index() of an Object to change during a file import. However, there is no structural reason for that in cytosim. If necessary, it should be possible to remove this constraint.

void relink | ( | Object * | obj | ) |
| virtual

relink() should only be called for object already linked()

void rotateObjects | ( | ObjectList const & | objs,
|  | Rotation const & | rot
| ) |  |
| static

Rotate all objects in objs around the origin.

If ( Object::rotatable()==false ) but ( Object::translatable()==true ), the Object is translated by [ rot * Object::position() - Object::position() ]

void translateObjects | ( | ObjectList const & | objs,
|  | Vector const & | vec
| ) |  |
| static

Translate all objects for which ( Object::translatable()==true ) by vec

void write | ( | const NodeList & | list,
|  | OutputWrapper & | out
| ) |  |
| static protected

This writes a new line, the reference and the Object data, for each Object in list