Skip to content

Commit

Permalink
bug fix for having empty input/output mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
drbergman committed Feb 16, 2025
1 parent 3f65f41 commit 7475c27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions addons/libRoadrunner/src/librr_intracellular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,17 +569,18 @@ void RoadRunnerIntracellular::initialize_intracellular_from_pugixml(pugi::xml_no

node_map = node_map.next_sibling("map");
}
validate_mappings(new_input_mappings);
validate_mappings(new_output_mappings);
validate_mappings(new_input_mappings, true);
validate_mappings(new_output_mappings, false);

input_mappings = std::move(new_input_mappings);
output_mappings = std::move(new_output_mappings);
}

void validate_mappings(std::vector<RoadRunnerMapping*> mappings)
validate_mappings(std::vector<RoadRunnerMapping *> mappings, bool is_inputs)
{
if (mappings.empty())
{ return; }
std::vector<std::string> values_already_set;
bool is_inputs = mappings[0]->io_type=="input";
std::string name_to_add;
for (auto mapping : mappings)
{
Expand Down
2 changes: 1 addition & 1 deletion addons/libRoadrunner/src/librr_intracellular.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bool is_physicell_phenotype_token(const std::string& name);
MappingFunction select_phenotype_by_token_inputter(const std::string& name, const std::string& sbml_species);
MappingFunction select_phenotype_by_token_outputter(const std::string& name, const std::string& sbml_species);

void validate_mappings(std::vector<RoadRunnerMapping*> mappings);
validate_mappings(std::vector<RoadRunnerMapping *> mappings, bool is_inputs);

std::vector<int> parse_ctr_token(const std::string &name);
void throw_invalid_ctr_token(const std::string& name);
Expand Down

0 comments on commit 7475c27

Please sign in to comment.