Commit 42bfd0a1 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

wrapper base

parent f554869e
......@@ -111,13 +111,13 @@ model_data read_sbml(const std::string& fn) {
}
void define_readsbml(jlcxx::Module& mod) {
mod.add_type<species_info>("Species");
mod.add_type<unit_part>("UnitPart");
mod.add_type<stoi>("Stoichiometry");
mod.add_type<reaction>("Reaction").constructor();
mod.add_type<model_data>("Model");
mod.add_type<species_info>("SpeciesCxx");
mod.add_type<unit_part>("UnitPartCxx");
mod.add_type<stoi>("StoichiometryCxx");
mod.add_type<reaction>("ReactionCxx").constructor();
mod.add_type<model_data>("ModelCxx");
mod.method("readSBML", &read_sbml);
mod.method("readSBML_internal", &read_sbml);
#define access(t, n) mod.method(#n, [](const t& x) { return x.n; })
......
module SBML
include("readsbml.jl")
using CxxWrap
using SBML_jll
@wrapmodule(libsbml)
# version tools
export getLibSBMLDependencyVersionOf,
getLibSBMLDottedVersion,
getLibSBMLVersion,
getLibSBMLVersionString,
isLibSBMLCompiledWith
export getLibSBMLDottedVersion,
readSBML
function __init__()
@initcxx
......
struct UnitPart
kind :: String
exponent :: Int
scale :: Int
multiplier :: Float64
UnitPart(k,e,s,m) = new(k,e,s,m)
end
struct Reaction
stoichiometry :: Dict{String, Float64}
lb :: Tuple{Float64, String}
ub :: Tuple{Float64, String}
oc :: Float64
Reaction() = new()
end
struct Species
name :: String
compartment :: String
Species(n,c) = new(n,c)
end
struct Model
units :: Dict{String,Vector{UnitPart}}
compartments :: Vector{String}
species :: Dict{String,Species}
reactions :: Dict{String, Reaction}
Model() = new()
end
function readSMBL(fn::String)::Model
mi = readSBML_internal(fn)
if length(errors(mi))
@error "Loading failed!" errors(mi)
end
m = Model()
m.compartments = compartments(mi)
return m
end
function getS(m::Model)::Matrix{Float64}
end
function getLBs(m::Model)::Vector{Tuple{Float64,String}}
end
function getUBs(m::Model)::Vector{Tuple{Float64,String}}
end
function getOCs(m::Model)::Vector{Float64}
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment