MOOSE - Multiscale Object Oriented Simulation Environment
|
#include <Python.h>
#include <structmember.h>
#include <iostream>
#include <typeinfo>
#include <cstring>
#include <map>
#include <ctime>
#include "../basecode/header.h"
#include "../basecode/Id.h"
#include "../basecode/ObjId.h"
#include "../utility/utility.h"
#include "../utility/print_function.hpp"
#include "../shell/Shell.h"
#include "moosemodule.h"
Go to the source code of this file.
Functions | |
PyObject * | get_ObjId_attr (_ObjId *oid, string attribute) |
PyObject * | getLookupField (ObjId target, char *fieldName, PyObject *key) |
PyObject * | moose_ObjId_connect (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_getattro (_ObjId *self, PyObject *attr) |
PyObject * | moose_ObjId_getDataIndex (_ObjId *self) |
PyObject * | moose_ObjId_getField (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_getFieldIndex (_ObjId *self) |
PyObject * | moose_ObjId_getFieldNames (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_getFieldType (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_getId (_ObjId *self) |
PyObject * | moose_ObjId_getItem (_ObjId *self, Py_ssize_t index) |
Py_ssize_t | moose_ObjId_getLength (_ObjId *self) |
PyObject * | moose_ObjId_getLookupField (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_getNeighbors (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_getSlice (_ObjId *self, Py_ssize_t start, Py_ssize_t end) |
long | moose_ObjId_hash (_ObjId *self) |
int | moose_ObjId_init (_ObjId *self, PyObject *args, PyObject *kwargs) |
int | moose_ObjId_init_from_id (_ObjId *self, PyObject *args, PyObject *kwargs) |
int | moose_ObjId_init_from_path (_ObjId *self, PyObject *args, PyObject *kwargs) |
PyObject * | moose_ObjId_repr (_ObjId *self) |
PyObject * | moose_ObjId_richcompare (_ObjId *self, PyObject *other, int op) |
int | moose_ObjId_setattro (_ObjId *self, PyObject *attr, PyObject *value) |
PyObject * | moose_ObjId_setDestField (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_setField (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_setLookupField (_ObjId *self, PyObject *args) |
PyObject * | moose_ObjId_str (_ObjId *self) |
PyDoc_STRVAR (moose_ObjId_getId_documentation,"getId() -> vec\n""\n""Returns the information of the object's classtype, Id, and path \n""in form of a vector.\n""\nExample\n""-------\n"" >>> com = moose.Compartment('/com')\n"" >>> com.getId()\n"" moose.vec: class=Compartment, id=481, path=/com>""\n") | |
PyDoc_STRVAR (moose_ObjId_getFieldType_documentation,"getFieldType(fieldname)\n""\n""Returns the type of the field `fieldname` (as a string).\n""\n""Parameters\n""----------\n""fieldname : string\n"" Name of the field to be queried.\n""\n"" >>> comp.getFieldType('neighbors')\n"" >>> 'string,vector<Id>' \n""\n") | |
PyDoc_STRVAR (moose_ObjId_getField_documentation,"getField(fieldname)\n""\n""Returns the value of the field `fieldname`.\n""\n""Parameters\n""----------\n""fieldname : string\n"" Name of the field.\n""\n"" >>> comp.getField('x0')\n"" >>> 0.0 \n") | |
PyDoc_STRVAR (moose_ObjId_setField_documentation,"setField(fieldname, value)\n""\n""Set the value of specified field.\n""\n""Parameters\n""----------\n""fieldname : string\n"" Field to be assigned value to.\n""\n""value : python datatype compatible with the type of the field\n"" The value to be assigned to the field.""\n""\n"" >>> comp.setField('x0', 45.25) \n"" >>> print comp.x0\n"" 45.25\n") | |
PyDoc_STRVAR (moose_ObjId_getLookupField_documentation,"getLookupField(fieldname, key) -> value type\n""\n""Lookup entry for `key` in `fieldName`\n""\n""Parameters\n""----------\n""fieldname : string\n"" Name of the lookupfield.\n""\n""key : appropriate type for key of the lookupfield (as in the dict "" getFieldDict).\n"" Key for the look-up.") | |
PyDoc_STRVAR (moose_ObjId_setLookupField_documentation,"setLookupField(fieldname, key, value)\n""\n""Set a lookup field entry.\n""\n""Parameters\n""----------\n""fieldname : str\n"" name of the field to be set\n""key : key type\n"" key in the lookup field for which the value is to be set.\n""value : value type\n"" value to be set for `key` in the lookup field.\n") | |
PyDoc_STRVAR (moose_ObjId_setDestField_documentation,"setDestField(arg0, arg1, ...)\n""\n""Set a destination field. This is for advanced uses. destFields can\n""(and should) be directly called like functions as\n""`element.fieldname(arg0, ...)`\n""\n""Parameters\n""----------\n""The number and type of paramateres depend on the destFinfo to be\n""set. Use moose.doc('{classname}.{fieldname}') to get builtin\n""documentation on the destFinfo `fieldname`\n") | |
PyDoc_STRVAR (moose_ObjId_getFieldNames_documenation,"getFieldNames(fieldType='') -> tuple of str\n""\n""Returns the names of fields of this element of fieldType kind.\n""\n""Parameters\n""----------\n""fieldType : str\n"" Type of the fields you wish to retrieve. Can be\n"" - `valueFinfo` - attributes of the object\n"" - `srcFinfo` - fields of the object which can be used as source of information for connect\n"" - `destFinfo` - fields of the object which can be used as destination of information for connect\n"" - `lookupFinfo`- fields which can be looked at through this object"", etc. If an empty string is specified, names of all avaialable fields are returned.\n""\n""Returns\n""-------\n""names : tuple of strings.\n"" names of the fields of the specified type.\n""\n""Examples\n""--------\n""List names of all the source fields in PulseGen class:\n""\n"" >>> comp.getFieldNames('lookupFinfo') \n"" ('neighbors', 'msgDests', 'msgDestFunctions', 'isA')\n"" >>> moose.getFieldNames('PulseGen', 'srcFinfo')\n"" ('childMsg', 'output')\n""\n") | |
PyDoc_STRVAR (moose_ObjId_getNeighbors_documentation,"getNeighbors(fieldName) -> tuple of vecs\n""\n""Get the objects connected to this element on specified field.\n""\n""Parameters\n""----------\n""fieldName : str\n"" name of the connection field (a destFinfo/srcFinfo/sharedFinfo)\n""\n""Returns\n""-------\n""neighbors: tuple of vecs.\n"" tuple containing the ids of the neighbour vecs.\n""\n") | |
PyDoc_STRVAR (moose_ObjId_connect_documentation,"connect(src, srcfield, destobj, destfield[,msgtype]) -> bool\n""\n""Create a message between `src_field` on `src` object to `dest_field` on `dest` object.\n""This function is used mainly, to say, connect two entities, and to denote what kind of give-and-take relationship they share.""It enables the 'destfield' (of the 'destobj') to acquire the data, from 'srcfield'(of the 'src').""\n""Parameters\n""----------\n""src : element/vec/string\n"" the source object (or its path) \n"" (the one that provides information)\n""srcfield : str\n"" source field on self.(type of the information)\n""destobj : element\n"" Destination object to connect to.\n"" (The one that need to get information)\n""destfield : str\n"" field to connect to on `destobj`.\n""msgtype : str\n"" type of the message. Can be \n"" `Single` - \n"" `OneToAll` - \n"" `AllToOne` - \n"" `OneToOne` - \n"" `Reduce` - \n"" `Sparse` - \n"" Default: `Single`.\n""\n""Returns\n""-------\n""msgmanager: melement\n"" message-manager for the newly created message.\n""\n""Examples\n""--------\n""Connect the output of a pulse generator to the input of a spike\n""generator::\n""\n"" >>> pulsegen = moose.PulseGen('pulsegen')\n"" >>> spikegen = moose.SpikeGen('spikegen')\n"" >>> pulsegen.connect('output', spikegen, 'Vm')\n""\n""See also\n""--------\n""moose.connect\n""\n") | |
PyDoc_STRVAR (moose_ObjId_richcompare_documentation,"Compare two element instances. This just does a string comparison of\n""the paths of the element instances. This function exists only to\n""facilitate certain operations requiring sorting/comparison, like\n""using elements for dict keys. Conceptually only equality comparison is\n""meaningful for elements.\n") | |
PyDoc_STRVAR (moose_ObjId_getDataIndex_documentation,"getDataIndex() -> int\n""\n""Returns the dataIndex (position of the object in vector) ""of this object, if it belongs to a vector, otherwise returns 0.\n""\n"" >>> comp = moose.Compartment('/comp')\n"" >>> comp.getDataIndex()\n"" >>> 0\n""") | |
PyDoc_STRVAR (moose_ObjId_documentation,"Individual moose element contained in an array-type object"" (vec).\n""\n""Each element has a unique path, possibly with its index in"" the vec. These are identified by three components: vec, dndex and"" findex. vec is the containing vec, which is identified by a unique"" number (field `value`). `dindex` is the index of the current"" item in the containing vec. `dindex` is 0 for single elements."" findex is field index, specifying the index of elements which exist"" as fields of another moose element.\n""\n""Notes\n""-----\n""Users need not create melement directly. Instead use the named moose"" class for creating new elements. To get a reference to an existing"" element, use the :ref:`moose.element` function.\n""\n""Parameters\n""----------\n""path : str\n"" path of the element to be created.\n""\n""n : positive int, optional\n"" defaults to 1. If greater, then a vec of that size is created and\n"" this element is a reference to the first entry of the vec.\n""\n""g : int, optional\n"" if 1, this is a global element, else if 0 (default), the element\n"" is local to the current node.\n""\n""dtype : str\n"" name of the class of the element. If creating any concrete\n"" subclass, this is automatically taken from the class name and\n"" should not be specified explicitly.\n""\n""Attributes\n""----------\n""vec : moose.vec\n"" The vec containing this element. `vec` wraps the Id of the object in MOOSE C++ API.\n""\n""dindex : int\n"" index of this element in the container vec\n""\n""findex: int\n"" if this is a tertiary object, i.e. acts as a field in another\n"" element (like synapse[0] in IntFire[1]), then the index of\n"" this field in the containing element.\n""\n""Examples\n""--------\n""\n"">>> a = Neutral('alpha') # Creates element named `alpha` under current working element\n"">>> b = Neutral('alpha/beta') # Creates the element named `beta` under `alpha`\n"">>> c = moose.melement(b)") | |
int | PyType_IsSubtype (PyTypeObject *, PyTypeObject *) |
PyObject * | setDestFinfo (ObjId obj, string fieldName, PyObject *arg, string argType) |
PyObject * | setDestFinfo2 (ObjId obj, string fieldName, PyObject *arg1, char type1, PyObject *arg2, char type2) |
int | setLookupField (ObjId target, char *fieldName, PyObject *key, PyObject *value) |
Variables | |
PyTypeObject | IdType |
static PyMethodDef | ObjIdMethods [] |
PyTypeObject | ObjIdType |
PyObject* get_ObjId_attr | ( | _ObjId * | oid, |
string | attribute | ||
) |
Definition at line 83 of file melement.cpp.
References moose_ObjId_getDataIndex(), moose_ObjId_getFieldIndex(), and moose_ObjId_getId().
Referenced by moose_ObjId_getattro().
PyObject* getLookupField | ( | ObjId | target, |
char * | fieldName, | ||
PyObject * | key | ||
) |
Inner function for looking up value from LookupField on object with ObjId target.
args should be a tuple (lookupFieldName, key)
Definition at line 1295 of file melement.cpp.
References moose::error, Field< A >::get(), parseFinfoType(), and shortType().
Referenced by moose_LookupField_getItem(), and moose_ObjId_getLookupField().
PyObject* moose_ObjId_connect | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 2195 of file melement.cpp.
References ObjId::bad(), Id::isValid(), ObjIdType, _ObjId::oid_, RAISE_INVALID_ID, and SHELLPTR.
PyObject* moose_ObjId_getattro | ( | _ObjId * | self, |
PyObject * | attr | ||
) |
2011-03-28 13:59:41 (+0530)
Get a specified field. Re-done on: 2011-03-23 14:42:03 (+0530)
I wonder how to cleanly do this. The Id - ObjId dichotomy is really ugly. When you don't pass an index, it is just treated as 0. Then what is the point of having Id separately? ObjId would been just fine!
Definition at line 484 of file melement.cpp.
References Field< A >::get(), get_field_alias(), get_ObjId_attr(), getFieldNames(), getFieldType(), RAISE_INVALID_ID, shortType(), to_py(), and value.
Referenced by moose_ObjId_getField().
PyObject* moose_ObjId_getDataIndex | ( | _ObjId * | self | ) |
Definition at line 2317 of file melement.cpp.
References Id::isValid(), and RAISE_INVALID_ID.
Referenced by get_ObjId_attr().
PyObject* moose_ObjId_getField | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 460 of file melement.cpp.
References Id::isValid(), moose_ObjId_getattro(), and RAISE_INVALID_ID.
PyObject* moose_ObjId_getFieldIndex | ( | _ObjId * | self | ) |
Definition at line 2330 of file melement.cpp.
References Id::isValid(), and RAISE_INVALID_ID.
Referenced by get_ObjId_attr().
PyObject* moose_ObjId_getFieldNames | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 2047 of file melement.cpp.
References Field< A >::get(), getFieldNames(), getFinfoTypes(), Id::isValid(), and RAISE_INVALID_ID.
PyObject* moose_ObjId_getFieldType | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 420 of file melement.cpp.
References getFieldType(), Id::isValid(), and RAISE_INVALID_ID.
PyObject* moose_ObjId_getId | ( | _ObjId * | self | ) |
Definition at line 394 of file melement.cpp.
References _Id::id_, IdType, Id::isValid(), and RAISE_INVALID_ID.
Referenced by get_ObjId_attr().
PyObject* moose_ObjId_getItem | ( | _ObjId * | self, |
Py_ssize_t | index | ||
) |
Definition at line 1210 of file melement.cpp.
References moose_ObjId_getLength(), ObjIdType, and _ObjId::oid_.
Py_ssize_t moose_ObjId_getLength | ( | _ObjId * | self | ) |
Definition at line 1276 of file melement.cpp.
References Element::hasFields(), and FieldElement::numData().
Referenced by moose_ObjId_getItem(), and moose_ObjId_getSlice().
PyObject* moose_ObjId_getLookupField | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 1465 of file melement.cpp.
References getLookupField(), Id::isValid(), and RAISE_INVALID_ID.
PyObject* moose_ObjId_getNeighbors | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 2112 of file melement.cpp.
References _Id::id_, IdType, Id::isValid(), and RAISE_INVALID_ID.
PyObject* moose_ObjId_getSlice | ( | _ObjId * | self, |
Py_ssize_t | start, | ||
Py_ssize_t | end | ||
) |
Definition at line 1240 of file melement.cpp.
References moose_ObjId_getLength(), ObjIdType, _ObjId::oid_, and value.
long moose_ObjId_hash | ( | _ObjId * | self | ) |
This function combines Id, DataId and fieldIndex to construct the hash of this object. Here we assume 16 most significant bits for Id, next 32 bits for dataIndex and the least significant 16 bits for fieldIndex. If these criteria are not met, the hash function will cause collissions. Note that the bitshift opeartions are byte order independent - so they should give the same result on both little- and big-endian systems.
Definition at line 333 of file melement.cpp.
References dataIndex, Id::isValid(), and RAISE_INVALID_ID.
int moose_ObjId_init | ( | _ObjId * | self, |
PyObject * | args, | ||
PyObject * | kwargs | ||
) |
Definition at line 296 of file melement.cpp.
References moose::error, moose_ObjId_init_from_id(), and moose_ObjId_init_from_path().
int moose_ObjId_init_from_id | ( | _ObjId * | self, |
PyObject * | args, | ||
PyObject * | kwargs | ||
) |
Definition at line 100 of file melement.cpp.
References Id_Check, Id::isValid(), ObjIdType, and RAISE_INVALID_ID.
Referenced by moose_ObjId_init().
int moose_ObjId_init_from_path | ( | _ObjId * | self, |
PyObject * | args, | ||
PyObject * | kwargs | ||
) |
Definition at line 164 of file melement.cpp.
References BADINDEX, create_Id_from_path(), moose::fix(), Field< A >::get(), get_moose_classes(), getBaseClass(), path, and PyType_IsSubtype().
Referenced by moose_ObjId_init().
PyObject* moose_ObjId_repr | ( | _ObjId * | self | ) |
Definition at line 355 of file melement.cpp.
References Field< A >::get(), Id::isValid(), and RAISE_INVALID_ID.
PyObject* moose_ObjId_richcompare | ( | _ObjId * | self, |
PyObject * | other, | ||
int | op | ||
) |
Definition at line 2241 of file melement.cpp.
References moose::error, Id::isValid(), ObjIdType, and RAISE_INVALID_ID.
int moose_ObjId_setattro | ( | _ObjId * | self, |
PyObject * | attr, | ||
PyObject * | value | ||
) |
Set a specified field. Redone on 2011-03-23 14:41:45 (+0530)
Definition at line 809 of file melement.cpp.
References get_moose_classes(), getFieldType(), Id::id_, Id::isValid(), RAISE_INVALID_ID, Field< A >::set(), shortType(), to_cpp(), and value.
Referenced by moose_ObjId_setField().
PyObject* moose_ObjId_setDestField | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 1634 of file melement.cpp.
References moose::error, Id::isValid(), maxArgs, minArgs, parseFinfoType(), RAISE_INVALID_ID, SetGet0::set(), setDestFinfo(), setDestFinfo2(), and shortType().
Referenced by moose_DestField_call().
PyObject* moose_ObjId_setField | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 791 of file melement.cpp.
References moose_ObjId_setattro(), and value.
PyObject* moose_ObjId_setLookupField | ( | _ObjId * | self, |
PyObject * | args | ||
) |
Definition at line 1600 of file melement.cpp.
References Id::isValid(), setLookupField(), and value.
PyObject* moose_ObjId_str | ( | _ObjId * | self | ) |
Definition at line 369 of file melement.cpp.
References Field< A >::get(), Id::isValid(), and RAISE_INVALID_ID.
PyDoc_STRVAR | ( | moose_ObjId_getId_documentation | , |
"getId() -> vec\n""\n""Returns the information of the object's | classtype, | ||
Id | , | ||
and path\n""in form of a vector.\n""\nExample\n""-------\n"" >> | , | ||
com | = moose.Compartment('/com')\n"" >> , |
||
com.getId()\n""moose.vec:class | = Compartment , |
||
id | = 481 , |
||
path | = /com , |
||
""\n" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_getFieldType_documentation | , |
"getFieldType(fieldname)\n""\n""Returns the type of the field `fieldname` (as a string).\n""\n""Parameters\n""----------\n""fieldname : string\n"" Name of the field to be queried.\n""\n"" >> | , | ||
comp.getFieldType('neighbors')\n"" >> | , | ||
' | string, | ||
vector< Id >'\n""\n" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_getField_documentation | , |
"getField(fieldname)\n""\n""Returns the value of the field `fieldname`.\n""\n""Parameters\n""----------\n""fieldname : string\n"" Name of the field.\n""\n"" >> | , | ||
comp.getField('x0')\n"" >> | , | ||
0.0\n" | |||
) |
Wrapper over getattro to allow direct access as a function with variable argument list
PyDoc_STRVAR | ( | moose_ObjId_setField_documentation | , |
"setField(fieldname, value)\n""\n""Set the value of specified field.\n""\n""Parameters\n""----------\n""fieldname : string\n"" Field to be assigned value to.\n""\n""value : python datatype compatible with the type of the field\n"" The value to be assigned to the field.""\n""\n"" >> | , | ||
comp.setField('x0', 45.25)\n"" >> | , | ||
print comp.x0\n""45.25\n" | |||
) |
Wrapper over setattro to make METHOD_VARARG
PyDoc_STRVAR | ( | moose_ObjId_getLookupField_documentation | , |
"getLookupField(fieldname, key) -> value type\n""\n""Lookup entry for `key` in `fieldName`\n""\n""Parameters\n""----------\n""fieldname : string\n"" Name of the lookupfield.\n""\n""key : appropriate type for key of the lookupfield (as in the dict "" getFieldDict).\n"" Key for the look-up." | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_setLookupField_documentation | , |
"setLookupField(fieldname, key, value)\n""\n""Set a lookup field entry.\n""\n""Parameters\n""----------\n""fieldname : str\n"" name of the field to be set\n""key : key type\n"" key in the lookup field for which the value is to be set.\n""value : value type\n"" value to be set for `key` in the lookup field.\n" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_setDestField_documentation | , |
"setDestField(arg0, arg1, ...)\n""\n""Set a destination field. This is for advanced uses. destFields can\n""(and should) be directly called like functions as\n""`element.fieldname(arg0, ...)`\n""\n""Parameters\n""----------\n""The number and type of paramateres depend on the destFinfo to be\n""set. Use moose.doc('{classname}.{fieldname}') to get builtin\n""documentation on the destFinfo `fieldname`\n" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_getFieldNames_documenation | , |
"getFieldNames(fieldType='') -> tuple of str\n""\n""Returns the names of fields of this element of fieldType kind.\n""\n""Parameters\n""----------\n""fieldType : str\n"" Type of the fields you wish to retrieve. Can be\n"" - `valueFinfo` - attributes of the object\n"" - `srcFinfo` - fields of the object which can be used as source of information for connect\n"" - `destFinfo` - fields of the object which can be used as destination of information for connect\n"" - `lookupFinfo`- fields which can be looked at through this object"" | , | ||
etc.If an empty string is | specified, | ||
names of all avaialable fields are returned.\n""\n""Returns\n""-------\n""names:tuple of strings.\n""names of the fields of the specified type.\n""\n""Examples\n""--------\n""List names of all the source fields in PulseGen class:\n""\n"" >> | , | ||
comp.getFieldNames('lookupFinfo')\n""('neighbors', 'msgDests', 'msgDestFunctions', 'isA')\n"" >> | , | ||
moose.getFieldNames('PulseGen', 'srcFinfo')\n""('childMsg', 'output')\n""\n" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_getNeighbors_documentation | , |
"getNeighbors(fieldName) -> tuple of vecs\n""\n""Get the objects connected to this element on specified field.\n""\n""Parameters\n""----------\n""fieldName : str\n"" name of the connection field (a destFinfo/srcFinfo/sharedFinfo)\n""\n""Returns\n""-------\n""neighbors: tuple of vecs.\n"" tuple containing the ids of the neighbour vecs.\n""\n" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_connect_documentation | , |
"connect(src, srcfield, destobj, destfield[,msgtype]) -> bool\n""\n""Create a message between `src_field` on `src` object to `dest_field` on `dest` object.\n""This function is used | mainly, | ||
to | say, | ||
connect two | entities, | ||
and to denote what kind of give-and-take relationship they share.""It enables the 'destfield'(of the 'destobj') to acquire the | data, | ||
from 'srcfield'(of the 'src').""\n""Parameters\n""----------\n""src:element/vec/string\n""the source object(or its path)\n""(the one that provides information)\n""srcfield:str\n""source field on self.(type of the information)\n""destobj:element\n""Destination object to connect to.\n""(The one that need to get information)\n""destfield:str\n""field to connect to on`destobj`.\n""msgtype:str\n""type of the message.Can be\n""`Single`-\n""`OneToAll`-\n""`AllToOne`-\n""`OneToOne`-\n""`Reduce`-\n""`Sparse`-\n""Default:`Single`.\n""\n""Returns\n""-------\n""msgmanager:melement\n""message-manager for the newly created message.\n""\n""Examples\n""--------\n""Connect the output of a pulse generator to the input of a spike\n""generator::\n""\n"" >> | , | ||
pulsegen | = moose.PulseGen('pulsegen')\n"" >> , |
||
spikegen | = moose.SpikeGen('spikegen')\n"" >> , |
||
pulsegen.connect('output', spikegen, 'Vm')\n""\n""See also\n""--------\n""moose.connect\n""\n" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_richcompare_documentation | , |
"Compare two element instances. This just does a string comparison of\n""the paths of the element instances. This function exists only to\n""facilitate certain operations requiring sorting/ | comparison, | ||
like\n""using elements for dict keys.Conceptually only equality comparison is\n""meaningful for elements.\n" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_getDataIndex_documentation | , |
"getDataIndex() -> int\n""\n""Returns the dataIndex (position of the object in vector) ""of this | object, | ||
if it belongs to a | vector, | ||
otherwise returns 0.\n""\n"" >> | , | ||
comp | = moose.Compartment('/comp')\n"" >> , |
||
comp.getDataIndex()\n"" >> | , | ||
0\n""" | |||
) |
PyDoc_STRVAR | ( | moose_ObjId_documentation | , |
"Individual moose element contained in an array-type object"" (vec).\n""\n""Each element has a unique | path, | ||
possibly with its index in""the vec.These are identified by three components:vec | , | ||
dndex and""findex.vec is the containing | vec, | ||
which is identified by a unique""number(field`value`).`dindex`is the index of the current""item in the containing vec.`dindex`is 0 for single elements.""findex is field | index, | ||
specifying the index of elements which exist""as fields of another moose element.\n""\n""Notes\n""-----\n""Users need not create melement directly.Instead use the named moose""class for creating new elements.To get a reference to an existing"" | element, | ||
use the:ref:`moose.element`function.\n""\n""Parameters\n""----------\n""path:str\n""path of the element to be created.\n""\n""n:positive | int, | ||
optional\n""defaults to 1.If | greater, | ||
then a vec of that size is created and\n""this element is a reference to the first entry of the vec.\n""\n""g:int | , | ||
optional\n""if | 1, | ||
this is a global | element, | ||
else if | 0default, | ||
the element\n""is local to the current node.\n""\n""dtype:str\n""name of the class of the element.If creating any concrete\n"" | subclass, | ||
this is automatically taken from the class name and\n""should not be specified explicitly.\n""\n""Attributes\n""----------\n""vec:moose.vec\n""The vec containing this element.`vec`wraps the Id of the object in MOOSE C++API.\n""\n""dindex:int\n""index of this element in the container vec\n""\n""findex:int\n""if this is a tertiary | object, | ||
i.e.acts as a field in another\n"" | elementlike synapse[0] in IntFire[1], | ||
then the index of\n""this field in the containing element.\n""\n""Examples\n""--------\n""\n"">> | , | ||
a | = Neutral('alpha') # Creates element named `alpha` under current working element\n"">> , |
||
b | = Neutral('alpha/beta') # Creates the element named `beta` under `alpha`\n"">> |
||
) |
int PyType_IsSubtype | ( | PyTypeObject * | , |
PyTypeObject * | |||
) |
PyObject* setDestFinfo | ( | ObjId | obj, |
string | fieldName, | ||
PyObject * | arg, | ||
string | argType | ||
) |
Definition at line 1709 of file melement.cpp.
References moose::error, Id::id_, _ObjId::oid_, SetGet1< A >::set(), and shortType().
Referenced by moose_ObjId_setDestField().
PyObject* setDestFinfo2 | ( | ObjId | obj, |
string | fieldName, | ||
PyObject * | arg1, | ||
char | type1, | ||
PyObject * | arg2, | ||
char | type2 | ||
) |
Set destFinfo for 2 argument destination field functions.
Definition at line 1886 of file melement.cpp.
References moose::error, Id::id_, and _ObjId::oid_.
Referenced by moose_ObjId_setDestField().
int setLookupField | ( | ObjId | target, |
char * | fieldName, | ||
PyObject * | key, | ||
PyObject * | value | ||
) |
Definition at line 1480 of file melement.cpp.
References moose::error, Field< A >::get(), parseFinfoType(), shortType(), and value.
Referenced by moose_LookupField_setItem(), and moose_ObjId_setLookupField().
PyTypeObject IdType |
Definition at line 262 of file vec.cpp.
Referenced by moose_ObjId_getId(), and moose_ObjId_getNeighbors().
|
static |
Definition at line 2344 of file melement.cpp.
PyTypeObject ObjIdType |
Definition at line 2463 of file melement.cpp.
Referenced by moose_ObjId_connect(), moose_ObjId_getItem(), moose_ObjId_getSlice(), moose_ObjId_init_from_id(), and moose_ObjId_richcompare().