nfsim_c.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #ifndef NFSIM_CONNECTOR_H
  2. #define NFSIM_CONNECTOR_H
  3. //generic map
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. //helper structures from querying information from the c++ map containing the results
  8. //helper structures for the querying methods
  9. struct resultEntry{
  10. char* label;
  11. char* compartment;
  12. char* originalCompartment;
  13. };
  14. struct queryResults{
  15. int numOfResults;
  16. //struct resultEntry* results;
  17. void** results;
  18. };
  19. struct reactionResult{
  20. char** reactionNames;
  21. double* rates;
  22. };
  23. struct observableResults{
  24. char** observableNames;
  25. double* observableValues;
  26. int numResults;
  27. };
  28. typedef struct queryResults queryResults;
  29. typedef struct reactionResult reactionResult;
  30. typedef struct observableResults observableResults;
  31. struct observableSetResults{
  32. observableResults* dataPoints;
  33. double* timePoints;
  34. int numTimepoints;
  35. };
  36. struct reactantQueryResults{
  37. int numOfResults;
  38. char** keys;
  39. int* numOfAssociatedReactions;
  40. reactionResult* associatedReactions;
  41. };
  42. struct queryOptions{
  43. const char** initKeys;
  44. const int* initValues;
  45. const char** optionKeys;
  46. char** optionValues;
  47. int numOfInitElements;
  48. int numOfOptions;
  49. };
  50. struct compartmentStruct{
  51. char* name;
  52. int spatialDimensions;
  53. double size;
  54. char* outside;
  55. };
  56. typedef struct compartmentStruct compartmentStruct;
  57. typedef struct queryOptions queryOptions;
  58. typedef struct reactantQueryResults reactantQueryResults;
  59. //loads up an xml file and keeps it in memory
  60. int setupNFSim_c(const char*,int);
  61. //restores the nfsim system before molecule seeding
  62. int resetSystem_c();
  63. //calls destructors
  64. int deleteNFSimSystem_c();
  65. //seeds the nfsim system with an xml string
  66. int initSystemXML_c(const char*);
  67. //seeds the nfsim system with an array of hnauty labels- int pairs
  68. int initSystemNauty_c(const char**, const int*, int);
  69. //TODO: These functions are specific to the nfsim-mcell implementation. In a future implementation
  70. // it might be better to implement them directly into the mcell framework.
  71. //update a seeding table that keeps track of molecules we will use to initialize the system
  72. int constructNauty_c(const char*, const int);
  73. //init a system from the incremental list mantained through constructNauty
  74. int initFromConstruct_c();
  75. //store the current observable set in a list
  76. int logNFSimObservables_c(double time);
  77. int logNFSimReactions_c(const char*);
  78. //stream observableSet to file
  79. int outputNFSimObservables_c();
  80. int outputNFSimObservablesF_c(const char*);
  81. int outputNFSimReactionsF_c(const char* outputfilename);
  82. //END NFSim-mcell specific functions
  83. //returns those molecules in the system that are participants in a reaction with <param> reactants that can be fired
  84. void queryByNumReactant_c(const int, void*);
  85. //convenience function that calls reset, initNauty and queryByNumReactant
  86. void initAndQueryByNumReactant_c(const queryOptions, void*);
  87. //convenience function that calls reset, init, step and query
  88. void initAndQuerySystemStatus_c(const queryOptions, void*);
  89. //given a nauty species string return the compartment information
  90. const char* extractSpeciesCompartmentFromNauty_c(const char* nauty);
  91. //returns all possible complexes in the current system
  92. void querySystemStatus_c(const char* option, void*);
  93. observableResults queryObservables_c();
  94. //perform one simulation step
  95. int stepSimulation_c();
  96. //performs exactly one simulation step by firying reaction rxn
  97. int stepSimulationRxn_c(const char* rxn);
  98. //frees up the reactantQueryResults object
  99. int delete_reactantQueryResults(reactantQueryResults);
  100. int delete_compartmentStructs(compartmentStruct);
  101. //gets information about a bionetgen compartment
  102. compartmentStruct getCompartmentInformation_c(const char* name);
  103. void freeCompartmentInformation_c(compartmentStruct*);
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif