Skip to content

Commit

Permalink
- simulation_input_xml.cpp / doOverride() function uses omc_ModelInpu…
Browse files Browse the repository at this point in the history
…t in a mutable way

  which saves one copy constructor/destructor call (a lot of reallocations, all of the loaded params/vars, so a lot of time for HumMod model)
- a small correction of SimulationRuntime/c/CMakeLists.txt (paths in macros now works also for an out-of-trunk cmake call)
  
  

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15202 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
pavolpr committed Feb 17, 2013
1 parent 886aa22 commit fce8c42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions SimulationRuntime/c/CMakeLists.txt
Expand Up @@ -132,7 +132,7 @@ MACRO(BUILDMODEL model mo dir Flags CSRC)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/libf2c)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/results)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/solver)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/simulation/solver/initialization)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/solver/initialization)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/util)

# OMDEV PATH
Expand Down Expand Up @@ -210,7 +210,7 @@ ENDIF(SUNDIALS_INCLUDE_DIR AND
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/libf2c)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/results)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/solver)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/simulation/solver/initialization)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/solver/initialization)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/util)

INCLUDE_DIRECTORIES(${dir})
Expand Down Expand Up @@ -343,7 +343,7 @@ ENDIF(SUNDIALS_INCLUDE_DIR AND
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/libf2c)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/results)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/solver)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/simulation/solver/initialization)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/simulation/solver/initialization)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/c/util)
INCLUDE_DIRECTORIES(${OMCTRUNCHOME}/SimulationRuntime/fmi/export)

Expand Down
7 changes: 3 additions & 4 deletions SimulationRuntime/c/simulation/simulation_input_xml.cpp
Expand Up @@ -97,7 +97,7 @@ typedef struct omc_ModelInput
// a map for overrides
typedef std::map<std::string, std::string> omc_CommandLineOverrides;
// function to handle command line settings override
omc_ModelInput doOverride(omc_ModelInput mi, MODEL_DATA* modelData, std::string* override, std::string* overrideFile);
void doOverride(omc_ModelInput& mi, MODEL_DATA* modelData, std::string* override, std::string* overrideFile);

/* reads double value from a string */
void read_value(std::string s, modelica_real* res);
Expand Down Expand Up @@ -287,7 +287,7 @@ void read_input_xml(int argc, char **argv,
// deal with override
std::string* override = (string*)getFlagValue("override", argc, argv);
std::string* overrideFile = (string*)getFlagValue("overrideFile", argc, argv);
mi = doOverride(mi, modelData, override, overrideFile);
doOverride(mi, modelData, override, overrideFile);

/* read all the DefaultExperiment values */
INFO(LOG_SOLVER, "read all the DefaultExperiment values:");
Expand Down Expand Up @@ -1107,7 +1107,7 @@ inline void read_value(std::string s, int* res)
}


omc_ModelInput doOverride(omc_ModelInput mi, MODEL_DATA* modelData, std::string* override, std::string* overrideFile)
void doOverride(omc_ModelInput& mi, MODEL_DATA* modelData, std::string* override, std::string* overrideFile)
{
omc_CommandLineOverrides mOverrides;
char* overrideStr = NULL;
Expand Down Expand Up @@ -1252,5 +1252,4 @@ omc_ModelInput doOverride(omc_ModelInput mi, MODEL_DATA* modelData, std::string*
{
INFO(LOG_SOLVER, "NO override given on the command line.");
}
return mi;
}

0 comments on commit fce8c42

Please sign in to comment.