- From: david.nickerson at gmail.com (David Nickerson)
- Subject: [cellml-dev] creating MapVariables
- Date: Thu, 8 Jul 2010 11:48:50 +1200
Hi Lucian,
you need to use the base addElement() method to add the map variables
to the connection object. i.e.,
RETURN_INTO_OBJREF(model,iface::cellml_api::Model,
connection->modelElement());
RETURN_INTO_OBJREF(mv,iface::cellml_api::MapVariables,
model->createMapVariables());
connection->addElement(mv);
mv->firstVariableName(firstVariable);
mv->secondVariableName(secondVariable);
I think you probably want to set the variables and components using
the objects, but I suspect you can use the API to create invalid
models by setting the name strings directly...
Hope that helps.
Andre.
On Thu, Jul 8, 2010 at 11:33 AM, Lucian Smith <lpsmith at spod-central.org>
wrote:
>
So, I am now embarking on attempting to *create* CellML using the API. ?I
>
know, I know, heady stuff. ?But I think it can be done.
>
>
My first foray into this is to try to create connections. ?I can create a
>
connection with 'createConnection' on the Model object, which claims it
>
also creates a MapComponents, which I presume I can access by getting the
>
MapComponents from the newly-created Connection. ?I can create a single
>
MapVariables with createMapVariables from the Model object, but here I am
>
stuck. ?How do I get that MapVariables into a Connection? ?The Connection
>
has a MapVariablesSet, but that seems to be an iterator, and there's no
>
'createMapVariablesSet' anywhere.
>
>
Also, I am unsure what is going to happen if I set the names of these
>
MapComponents and MapVariables elements vs. setting the objects in
>
question vs. setting them both. ?Will all three options work? ?Will only
>
one option work? ?Right now I am doing it with names
>
(SetFirstComponentName) and am hoping that this will at least create the
>
CellML XML that I need, even if I can't correctly call 'GetFirstComponent'
>
afterwards. ?The documentation for MapVariables talks about setting
>
things, but the documentation for MapComponents only talks about getting.
>
>
-Lucian
>
_______________________________________________
>
cellml-tools-developers mailing list
>
cellml-tools-developers at cellml.org
>
http://www.cellml.org/mailman/listinfo/cellml-tools-developers
>
Archive powered by MHonArc 2.6.18.