Skip to content

Commit 564bc37

Browse files
author
Dilawar Singh
committed
Merge branch 'master' of github.com:BhallaLab/moose-core
2 parents 552d836 + 13a5b47 commit 564bc37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+363650
-0
lines changed

documentation/cpp/Doxyfile

Lines changed: 2411 additions & 0 deletions
Large diffs are not rendered by default.

documentation/cpp/customdoxygen.css

Lines changed: 1449 additions & 0 deletions
Large diffs are not rendered by default.

documentation/cpp/doxygen-logfile

Lines changed: 273394 additions & 0 deletions
Large diffs are not rendered by default.
2.36 MB
Binary file not shown.

documentation/cpp/footer.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!-- HTML footer for doxygen 1.8.9.1-->
2+
<!-- start footer part -->
3+
<!--BEGIN GENERATE_TREEVIEW-->
4+
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
5+
<ul>
6+
$navpath
7+
<li class="footer">$generatedby
8+
<a href="http://www.doxygen.org/index.html">
9+
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>
10+
</ul>
11+
</div>
12+
<!--END GENERATE_TREEVIEW-->
13+
<!--BEGIN !GENERATE_TREEVIEW-->
14+
<hr class="footer"/><address class="footer"><small>
15+
$generatedby &#160;<a href="http://www.doxygen.org/index.html">
16+
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
17+
</a> $doxygenversion
18+
</small></address>
19+
<!--END !GENERATE_TREEVIEW-->
20+
</body>
21+
</html>

documentation/cpp/header.html

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!-- HTML header for doxygen 1.8.9.1-->
2+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3+
<html xmlns="http://www.w3.org/1999/xhtml">
4+
<head>
5+
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6+
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
7+
<meta name="generator" content="Doxygen $doxygenversion"/>
8+
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
9+
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
10+
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
11+
<script type="text/javascript" src="$relpath^jquery.js"></script>
12+
<script type="text/javascript" src="$relpath^dynsections.js"></script>
13+
$treeview
14+
$search
15+
$mathjax
16+
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
17+
$extrastylesheet
18+
</head>
19+
<body>
20+
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
21+
22+
<!--BEGIN TITLEAREA-->
23+
<div id="titlearea">
24+
<table cellspacing="0" cellpadding="0">
25+
<tbody>
26+
<tr style="height: 56px;">
27+
<!--BEGIN PROJECT_LOGO-->
28+
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
29+
<!--END PROJECT_LOGO-->
30+
<!--BEGIN PROJECT_NAME-->
31+
<td style="padding-left: 0.5em;">
32+
<div id="projectname">$projectname
33+
<!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
34+
</div>
35+
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
36+
</td>
37+
<!--END PROJECT_NAME-->
38+
<!--BEGIN !PROJECT_NAME-->
39+
<!--BEGIN PROJECT_BRIEF-->
40+
<td style="padding-left: 0.5em;">
41+
<div id="projectbrief">$projectbrief</div>
42+
</td>
43+
<!--END PROJECT_BRIEF-->
44+
<!--END !PROJECT_NAME-->
45+
<!--BEGIN DISABLE_INDEX-->
46+
<!--BEGIN SEARCHENGINE-->
47+
<td>$searchbox</td>
48+
<!--END SEARCHENGINE-->
49+
<!--END DISABLE_INDEX-->
50+
</tr>
51+
</tbody>
52+
</table>
53+
</div>
54+
<!--END TITLEAREA-->
55+
<!-- end header part -->

documentation/developer/API.txt

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
API for Python interface.
2+
3+
1. Key data structures, not accessed directly, but important for concepts:
4+
- Element: Managers for objects. This includes data, messaging,
5+
field info and class info. All Elements can be arrays.
6+
- Finfo: Field information specifiers, used to build up the MOOSE
7+
interface to the underlying C++ class. Similar to the old MOOSE.
8+
Major Subclasses:
9+
- DestFinfo: used for functions of the Object. Can be called
10+
either using SetGet::set or by messages.
11+
- SrcFinfo: Used to call messages.
12+
- ValueFinfo: Used to define fields. The ReadOnly kind has
13+
just the 'get' function, whereas the normal kind
14+
also has a 'set' function. Both 'get' and 'set' are
15+
implemented as DestFinfos.
16+
- Cinfo: Class information specifier, used to specify class name,
17+
inheritance, and manage the array of Finfos.
18+
- Msg: Messages. Many subclasses. Handle communication between Elements.
19+
All Msgs are between precisely two Elements. So the Elements are nodes
20+
and the Msgs are edges. Msg have a lot of variety in how they control
21+
data transfer between individual array entries within the source and
22+
destination Element. Data transfer can be bidirectional.
23+
All Msgs provide a handle to an Element called a MsgManager, which
24+
allows you to inspect the Msg fields and in some cases modify them.
25+
But you cannot modify the source and destination Elements.
26+
27+
2. Key data structures that you will access.
28+
29+
Id: Handle to Elements.
30+
DataId: Handle to objects on Elements. Has a data part and a field part.
31+
The data part is the parent object, and is used for any array Element.
32+
The field part is for array fields within individual data entries,
33+
in cases where the array fields themselves are accessed like Elements.
34+
For example, in an IntFire neuron, you could have an
35+
array of a million IntFire neurons on Element A, and each IntFire
36+
neuron might have a random individual number, say, 10000, 15000, 8000,
37+
etc Synapses. To index Synapse 234 on IntFire 999999 you would use a
38+
DataId( 999999, 234).
39+
40+
ObjId: Composite of Id and DataId. Allows you to uniquely identify any entity
41+
in the simulation.
42+
43+
44+
3. Field assignments and function calls:
45+
File: SetGet.h
46+
This has a series of templates for different argument cases.
47+
1. If you want to call a function foo( int A, double B ) on
48+
ObjId oid, you would do:
49+
50+
SetGet2< int, double >::set( oid, "foo", A, B );
51+
52+
2. To call a function bar( int A, double B, string C ) on oid:
53+
SetGet3< int, double, string >::set( oid, "bar", A, B, C );
54+
55+
3. To assign a field value "short abc" on object oid:
56+
Field< short >::set( oid, "abc", 123 );
57+
58+
4. To get a field value "double pqr" on object obj:
59+
double x = Field< short >::get( oid, "pqr" );
60+
61+
5. To assign the double 'xcoord' field on all the objects on
62+
element Id id, which has an array of the objects:
63+
vector< double > newXcoord;
64+
// Fill up the vector here.
65+
Field< double >::setVec( id, "xcoord", newXcoord );
66+
Note that the dimensions of newXcoord should match those of
67+
the target element.
68+
69+
You can also use a similar call if it is just a function on id:
70+
SetGet1< double >::setVec( id, "xcoord_func", newXcoord );
71+
72+
6. To extract the double vector 'ycoord' field from all the
73+
objects on id:
74+
vector< double > oldYcoord; // Do not need to allocate.
75+
Field< double >::getVec( id, "ycoord", oldYcoord );
76+
77+
7. To set/get LookupFields, that is fields which have an index
78+
to lookup:
79+
double x = LookupField< unsigned int, double >::get( objId, field, index );
80+
LookupField< unsigned int, double >::set( objId, field, index, value );
81+
82+
There are lots of other variants here.
83+
84+
4. Shell commands to use: the ones that start with 'do'.
85+
86+
Id doCreate( string type, Id parent, string name,
87+
vector< unsigned int > dimensions );
88+
89+
bool doDelete( Id id )
90+
91+
MsgId doAddMsg( const string& msgType,
92+
ObjId src, const string& srcField,
93+
ObjId dest, const string& destField);
94+
95+
void doQuit();
96+
97+
void doStart( double runtime );
98+
99+
void doNonBlockingStart( double runtime );
100+
101+
void doReinit();
102+
103+
void doStop();
104+
105+
void doTerminate();
106+
107+
void doMove( Id orig, Id newParent );
108+
109+
Id doCopyId orig, Id newParent, string newName,
110+
unsigned int n, bool copyExtMsgs);
111+
112+
Id doFind( const string& path ) const
113+
114+
void doSetClock( unsigned int tickNum, double dt )
115+
116+
void doUseClock( string path, string field, unsigned int tick );
117+
118+
Id doLoadModel( const string& fname, const string& modelpath );
119+
120+
void doSyncDataHandler( Id elm, const string& sizeField, Id tgt );
121+
122+
123+
5. Important fields of important objects.
124+
125+
5.1. Shell object. This is the root object, '/' or '/root'.
126+
This has the following fields of note:
127+
- bool isRunning: ReadOnlyValue
128+
- Id cwe: Regular value.
129+
130+
5.2 Neutral. These fields are shared by all objects.
131+
string name
132+
ObjId parent // Parent ObjId. Note this is fully
133+
// specified, including index.
134+
vector< Id > children // All child elements.
135+
string path // Full path
136+
string className
137+
unsigned int linearSize // Product of all dimensions
138+
// Currently not working.
139+
vector< unsigned int> Dimensions
140+
unsigned int fieldDimension // Size of field dimension.
141+
vector< ObjId > msgOut // MsgManagers of all outgoing msgs
142+
vector< ObjId > msgIn // MsgManagers of all incoming msgs
143+
vector< Id > msgSrc( string field ) // Ids of source msgs into field
144+
vector< Id > msgDest( string field ) // Ids of dest msgs into field
145+
146+
5.3 Class Info objects. These are located in /classes/<classname>
147+
string docs // currently not implemented
148+
string baseClass // Name of base class
149+
150+
5.4 Field Info objects. These are children of the respective ClassInfo and
151+
are located in /classes/<classname>/<Field category>
152+
There are 5 field categories:
153+
srcFinfo
154+
destFinfo
155+
valueFinfo
156+
lookupFinfo
157+
sharedFinfo
158+
Each of these is an array, indexed as DataId( 0, <index> )
159+
since they are FieldElements.
160+
You can query the # of entries in each category using
161+
Id classId( "/classes/<classname>" );
162+
numValueFinfos =
163+
Field< unsigned int >::get( classId, "num_valueFinfo" );
164+
165+
Finally each of the field categories has the following fields:
166+
string name
167+
string docs // This is implemented
168+
string type // String with argument types separated by
169+
// commas. Can handle basic types, Ids,
170+
// ObjIds, DataIds, strings, and vectors of
171+
// any of the above.
172+
vector< string > src // vector of subsidiary srcFinfos, which
173+
// happens in SharedFinfos.
174+
vector< string > dest // vector of subsidiary destFinfos, which
175+
// happens in SharedFinfos and ValueFinfos.
176+
177+
178+
179+
6. Message traversal, C++ level:
180+
General approach:
181+
- If you just want src/dest Id, use the Neutral or Element functions
182+
to find list of source or target Ids as per spec.
183+
- Netural::msgSrc( string field );
184+
- Netural::msgDest( string field );
185+
- Element::getOutputs( vector< Id >& ret, const SrcFinfo* finfo)
186+
- Element::getInputs( vector< Id >& ret, const DestFinfo* finfo)
187+
188+
- If you want to iterate through specific array and/or field
189+
entries in src/dest Id, then you will have to look up the
190+
MsgIds themselves.
191+
- vector< ObjId > Neutral::msgOut():
192+
Not very specific, just the ObjIds of the MsgManagers
193+
of all outgoing Msgs.
194+
- vector< ObjId > Neutral::msgIn():
195+
All ObjIds of MsgManagers of incoming Msgs.
196+
- MsgId Element::findCaller( FuncId fid ) const:
197+
Looks up the first Msg that calls the specified Fid
198+
- Element::getInputMsgs( vector< MsgId >& caller, FuncId fid)
199+
Fills up vector of MsgIds that call the specified fid
200+
201+
- To convert between MsgIds, Msgs, and the manager ObjId:
202+
- MsgId Msg::mid(): returns the MsgId of the Msg.
203+
- Msg::manager(): returns the manager Eref of a Msg.
204+
- Msg::manager().objId(): returns the manager ObjId of a Msg.
205+
- static const Msg* Msg::getMsg( MsgId mid )
206+
Returns the Msg ptr given a MsgId.
207+
208+
- To iterate through Msg targets:
209+
unsigned int Msg::srcToDestPairs(
210+
vector< DataId >& src, vector< DataId >& dest) const
211+
This function gives matching vectors of src and dest
212+
pairs for the Msg. This should be node-independent,
213+
but the SparseMsg currently doesn't handle it right,
214+
and works only on 1 node.
215+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Building new MOOSE classes.
2+
3+
- Take your existing class.
4+
- Set it up to use access functions of this form:
5+
6+
For things that should look like Read/Write variables to the user:
7+
void setField( FieldType value );
8+
FieldType getField() const;
9+
10+
For things that should look like ReadOnly variables to the user:
11+
FieldType getField() const;
12+
13+
For things that should look like functions to the user:
14+
( MOOSE can handle up to 6 arguments )
15+
void func( Type1 arg1, Type2 arg2 );
16+
17+
- Put in the following function in the header:
18+
static const Cinfo* initCinfo();
19+
20+
21+
- Figure out your MOOSE interface. There are three main kinds of fields,
22+
which are going to be set up using Finfo objects (short for Field
23+
Information).
24+
The three are:
25+
- DestFinfos: These handle function requests.
26+
- SrcFinfos: These call functions on other objects. In other
27+
words, they send messages.
28+
- ValueFinfos: These support field assignment and readout.
29+
30+
31+
- Define initCinfo() in your .cpp, as follows:
32+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Naming conventions:
2+
General: Use CamelCase
3+
Don't use underscores as word separators.
4+
Classes start with caps
5+
Fields and functions start with lower case, except for scientific
6+
conventions (e.g., Vm_) in which case the scientific convention is used.
7+
Private fields end with an underscore (e.g., Vm_ );
8+
Use spaces liberally, and always after a comma.
9+
Field assignment functions (set/get) start with set/get<fieldName>
10+
11+
Naming of MOOSE fields and functions:
12+
Fields (ValueFinfos): Just use the name of the field, e.g., Vm, x, y, z.
13+
Message sources (SrcFinfos): Use the name of the field, e.g., output,
14+
unless there is a name-clash with a Fields. Then use name<Suffix>
15+
e.g., nOut, xOut, VmOut.
16+
If the message source is to request a return value, generally use the
17+
form request<fieldName>
18+
Message destination (DestFinfos): Use the name of the function, typically a
19+
verb. e.g., increment, process.
20+
Special case comes up with the internal set/get functions of fields,
21+
which are implemented as DestFinfos. Here the DestFinfos are
22+
automatically named set_<fieldname> and get_<fieldname>
23+
If the message dest handles a request or other operation as part of
24+
a shared message, generally use the form
25+
handle<name>
26+
If there is an overlap with a SharedMessage or field after applying
27+
all these rules, then use the form handle<name>.
28+
Shared messages (SharedFinfos): Use the name of the message.
29+
If there is an overlap with any other message, the SharedMessage takes
30+
precedence. This is because Shared Messages are the interface users
31+
will normally use. Try to avoid overlaps with field names.
32+

0 commit comments

Comments
 (0)