Skip to content

Commit

Permalink
Merge pull request #139 from GillesPy2/pretty_compile_errors
Browse files Browse the repository at this point in the history
SSA C Solver fix
  • Loading branch information
seanebum authored Jun 25, 2019
2 parents a761a15 + ff6e047 commit e36090f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions gillespy2/solvers/cpp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
def check_cpp_support():
from gillespy2.example_models import Example
try:
model = Example()
solver = SSACSolver(model)
results = model.run(solver=solver)
model = Example()
results = model.run(solver=SSACSolver)
return True
Expand Down
6 changes: 3 additions & 3 deletions gillespy2/solvers/cpp/ssa_c_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def write_constants(outfile, model, reactions, species, parameter_mappings):
outfile.write("};\nunsigned int populations[] = {")
#Write initial populations.
for i in range(len(species)-1):
outfile.write('{}, '.format(model.listOfSpecies[species[i]].initial_value))
outfile.write('{}'.format(model.listOfSpecies[species[-1]].initial_value))
outfile.write('{}, '.format(int(model.listOfSpecies[species[i]].initial_value)))
outfile.write('{}'.format(int(model.listOfSpecies[species[-1]].initial_value)))
outfile.write("};\n")
if len(reactions) > 0:
#Write reaction names
Expand Down Expand Up @@ -157,7 +157,7 @@ def compile(self):
if built.returncode == 0:
self.compiled = True
else:
raise gillespyError.BuildError("Error encountered while compiling file:\nReturn code: {0}.\nError:\n{1}\n".format(built.returncode, built.stderr))
raise gillespyError.BuildError("Error encountered while compiling file:\nReturn code: {0}.\nError:\n{1}\n{2}\n".format(built.returncode, built.stdout.decode('utf-8'),built.stderr.decode('utf-8')))

def run(self=None, model=None, t=20, number_of_trajectories=1,
increment=0.05, seed=None, debug=False, profile=False, show_labels=True, **kwargs):
Expand Down

0 comments on commit e36090f

Please sign in to comment.