Skip to content

Commit 3bc1d73

Browse files
committed
Now using setFloatingSpeciesByIndex and getFloatingSpeciesByIndex in libroadrunner
1 parent ba83fa3 commit 3bc1d73

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

addons/libRoadrunner/src/librr_intracellular.cpp

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -710,26 +710,17 @@ RoadRunnerMapping* RoadRunnerIntracellular::find_output_mapping(std::string phys
710710

711711
double RoadRunnerIntracellular::get_parameter_value(std::string param_name)
712712
{
713-
rrc::RRVectorPtr vptr;
714-
715-
vptr = rrc::getFloatingSpeciesConcentrations(this->rrHandle);
716-
717-
int offset = species_result_column_index[param_name];
718-
double res = vptr->Data[offset];
719-
rrc::freeVector(vptr);
720-
return res;
713+
double return_value = 0.0;
714+
rrc::getFloatingSpeciesByIndex(this->rrHandle, species_result_column_index[param_name], &return_value);
715+
return return_value;
721716
}
722717

723718
// rwh: might consider doing a multi-[species_name, value] "set" method
719+
// vn: Actually its better that way. In case there is a species which is linked to an assignment rule,
720+
// we can't use the setFloatingSpecies method without getting an error message, which breaks the thread-safety.
724721
void RoadRunnerIntracellular::set_parameter_value(std::string species_name, double value)
725722
{
726-
rrc::RRVectorPtr vptr;
727-
728-
vptr = rrc::getFloatingSpeciesConcentrations(this->rrHandle);
729-
int idx = species_result_column_index[species_name];
730-
vptr->Data[idx] = value;
731-
rrc::setFloatingSpeciesConcentrations(this->rrHandle, vptr);
732-
rrc::freeVector(vptr);
723+
rrc::setFloatingSpeciesByIndex(this->rrHandle, species_result_column_index[species_name], value);
733724
}
734725

735726
RoadRunnerIntracellular* getRoadRunnerModel(PhysiCell::Phenotype& phenotype) {

0 commit comments

Comments
 (0)