[cellml-discussion] Fwd: Evo connection

2010-02-23 Thread Catherine Lloyd

Dear Andrew

I am forwarding Lucian's questions onto you in case you feel you have  
to file tracker items for any of them or need to get in touch with  
Lucian again.


I am also opening it up to the discussion list in case anyone else  
would like to comment.


Best wishes
Catherine


Begin forwarded message:


From: Lucian Smith lpsm...@spod-central.org
Date: 24 February 2010 9:38:13 AM
To: Catherine Lloyd c.ll...@auckland.ac.nz
Subject: Re: [cellml-discussion] Evo connection

-Currently, I must run my program from the directory with the  
'components/'
subdirectory.  Is there a way I can set things up so I can run my  
program

from anywhere?

-In the model bertram_satin_pedersen_luciani_sherman_2007.cellml,  
'lambda'
gets translated into infix with a '$' before it.  Is this because  
'lambda'

is also a function name?  Does this happen with any other variables?

-Is there documentation about how you define your infix?

-If I get a 'failed to load external entity' exception, it SIGABRTs  
me,
despite being supposedly wrapped in one of those 'nsresult'  
thingummies, and

try/catch doesn't seem to work.  What do I need to do to catch this?

code:
bool Registry::LoadCellML(nsCOMPtrcellml_apiIModel model)
{
 if (model == NULL) return true;
 nsresult rv;
 nsCOMPtrcellml_servicesICeVASBootstrap  
cevasboot(do_GetService(CEVAS_BOOTSTRAP_CONTRACTID, rv));

 NS_ENSURE_SUCCESS(rv, true);

 nsCOMPtrcellml_servicesICeVAS cevas;
 try {
   rv = cevasboot-CreateCeVASForModel(model, getter_AddRefs(cevas));
 }
 catch (...){
   return true;
 }


result:
I/O warning : failed to load external entity /home/lpsmith/CellML/ 
models/.\ImportExample2.cellml
terminate called after throwing an instance of  
'iface::cellml_api::CellMLException'

 what():  std::exception

Program received signal SIGABRT, Aborted.
0xb7f5b430 in __kernel_vsyscall ()

-Speaking of, the above problem was due to the imported file name  
being
called .\ImportedExample2.cellml instead of ./ 
ImportedExample2.cellml
(and me running on a unix platform).  Is there a good cross-platform  
method

for fixing this problem?

-Can I get a zip file of all the cellml models on cellml.org from  
anywhere?


-hypertrophy_or_deterioration_parent.cellml
-faville_model_2008:  This model is recursive.  When I loop over its
components, some components come up multiple times, every time under  
the
original name.  My code then sees the same thing again, and fails.   
How
would I get the *new* name for the component?  Here's the current  
code:


 while (component != NULL) {
   numcomps++;
   //Each CellML 'component' becomes its own Antimony 'module'
   nsString cellmltext;
   rv = component-GetName(cellmltext);
   string cellmlname = cellmlmod_ + ToThinString(cellmltext.get());
   NewCurrentModule(cellmlname);
   CurrentModule()-LoadCellMLComponent(component);
   RevertToPreviousModule();
   rv = cmpi-NextComponent(getter_AddRefs(component));
 }


___
cellml-discussion mailing list
cellml-discussion@cellml.org
http://www.cellml.org/mailman/listinfo/cellml-discussion


Re: [cellml-discussion] Lucian's questions

2010-02-23 Thread Lucian Smith
* Catherine Lloyd c.ll...@auckland.ac.nz [2010-02-23 22:50] writes:
 Dear Andrew
 
 I am forwarding Lucian's questions onto you in case you feel you have  
 to file tracker items for any of them or need to get in touch with  
 Lucian again.
 
 I am also opening it up to the discussion list in case anyone else  
 would like to comment.

I can at least put the answers I got; here they are:

 Begin forwarded message:
 
 From: Lucian Smith lpsm...@spod-central.org
 
 -Currently, I must run my program from the directory with the  
 'components/'
 subdirectory.  Is there a way I can set things up so I can run my  
 program
 from anywhere?

The short answer is 'yes'; the longer answer is 'look at the OpenCell 
Installer'.  I may need some help here, but it's at least a start.

 -In the model bertram_satin_pedersen_luciani_sherman_2007.cellml,  
 'lambda'
 gets translated into infix with a '$' before it.  Is this because  
 'lambda'
 is also a function name?  Does this happen with any other variables?

Yes.  Any variable may be prepended with the '$'; it's *required* for any 
variable that is also a reserved word.  There may be a list of reserved 
words somewhere; someone said they'd look into forwarding me a copy.

 -Is there documentation about how you define your infix?

Not externally, but it's inside the help in OpenCell.

 -If I get a 'failed to load external entity' exception, it SIGABRTs  
 me,
 despite being supposedly wrapped in one of those 'nsresult'  
 thingummies, and
 try/catch doesn't seem to work.  What do I need to do to catch this?
 
 code:
 bool Registry::LoadCellML(nsCOMPtrcellml_apiIModel model)
 {
  if (model == NULL) return true;
  nsresult rv;
  nsCOMPtrcellml_servicesICeVASBootstrap  
 cevasboot(do_GetService(CEVAS_BOOTSTRAP_CONTRACTID, rv));
  NS_ENSURE_SUCCESS(rv, true);
 
  nsCOMPtrcellml_servicesICeVAS cevas;
  try {
rv = cevasboot-CreateCeVASForModel(model, getter_AddRefs(cevas));
  }
  catch (...){
return true;
  }
 
 
 result:
 I/O warning : failed to load external entity /home/lpsmith/CellML/ 
 models/.\ImportExample2.cellml
 terminate called after throwing an instance of  
 'iface::cellml_api::CellMLException'
  what():  std::exception
 
 Program received signal SIGABRT, Aborted.
 0xb7f5b430 in __kernel_vsyscall ()
 

Basically, this is a bug, so I submitted a tracker item for it.  Andrew 
had a workaround (I believe), but I don't remember what it was; it's a 
low enough priority item for me I think I'll just wait for the fix.

 -Speaking of, the above problem was due to the imported file name  
 being
 called .\ImportedExample2.cellml instead of ./ 
 ImportedExample2.cellml
 (and me running on a unix platform).  Is there a good cross-platform  
 method
 for fixing this problem?

This turned out to also be a bug in the example CellML file (the file in 
question was named 'CompletedImportExample.cellml').  I submitted a 
different tracker item for that.  Basically, the answer was 'use / and not 
\'.

 -Can I get a zip file of all the cellml models on cellml.org from  
 anywhere?

The short answer was What? and the long answer was Um, maybe?  There 
may be a script that uses mercurial that could work for this. I still 
think such a zip file would be very useful for anyone who wants to 
translate models or just test their own systems.  Biomodels does this 
(albeit with a lower number of models), and that's what I always grab when 
I'm testing things.  If in the future I wanted to provide Antimony 
versions of CellML models, it would be great if I could update those 
translations with the current versions at the repository.

One possibility would be to download the cellml files grouped by their 
curation status: cellml_threestar_models.tar.gz, etc.

 -hypertrophy_or_deterioration_parent.cellml
 -faville_model_2008:  This model is recursive.  When I loop over its
 components, some components come up multiple times, every time under  
 the
 original name.  My code then sees the same thing again, and fails.   
 How
 would I get the *new* name for the component?  Here's the current  
 code:
 
  while (component != NULL) {
numcomps++;
//Each CellML 'component' becomes its own Antimony 'module'
nsString cellmltext;
rv = component-GetName(cellmltext);
string cellmlname = cellmlmod_ + ToThinString(cellmltext.get());
NewCurrentModule(cellmlname);
CurrentModule()-LoadCellMLComponent(component);
RevertToPreviousModule();
rv = cmpi-NextComponent(getter_AddRefs(component));
  }

There are API calls you can use to get the number of times the current 
component has been imported--I think I can use this so I don't try to 
re-create the basic model again.  The trick then will be to make sure I 
implement the multiple instantiations needed for the full model.

This does bring up a different point that wasn't quite appropriate for the 
hackathon, but might be worth discussing here:  if a model like 
faville_model_2008 has shown that it is helpful to 'clone'