@@ -33,7 +33,7 @@ _model(model)
3333 std::cout << " Intialize OMC, use gcc" << std::endl;
3434
3535
36- status = InitOMC (&_omcPtr," gcc" ,omhome, 1 );
36+ status = InitOMC (&_omcPtr," gcc" ,omhome);
3737 if (status > 0 )
3838 {
3939 std::cout << " ..ok" << std::endl;
@@ -43,7 +43,7 @@ _model(model)
4343 {
4444 std::cout << " ..failed" << std::endl;
4545 char * errorMsg = 0 ;
46- status = GetError (& _omcPtr, &errorMsg);
46+ status = GetError (_omcPtr, &errorMsg);
4747 string errorMsgStr (errorMsg);
4848 throw std::runtime_error (" error to intialize OMC: " + errorMsgStr);
4949 }
@@ -52,7 +52,7 @@ _model(model)
5252
5353ModelicaCompiler::~ModelicaCompiler (void )
5454{
55-
55+ FreeOMC (_omcPtr);
5656}
5757
5858void ModelicaCompiler::loadFile (bool load_file)
@@ -65,7 +65,7 @@ void ModelicaCompiler::loadFile(bool load_file)
6565 {
6666 //command="loadModel(Modelica)";
6767 command="loadModel(Modelica,{\"3.2.2\"})";
68- status=SendCommand(& _omcPtr,command.c_str(),&result);
68+ status=SendCommand(_omcPtr,command.c_str(),&result);
6969 if(status>0)
7070 cout<<"load Modelica Library : "<< result<<std::endl;
7171 else
@@ -82,7 +82,7 @@ void ModelicaCompiler::loadFile(bool load_file)
8282 {
8383 // command="loadModel(Modelica)";
8484 command=" loadModel(Modelica,{\" 3.2.2\" })" ;
85- status=SendCommand (& _omcPtr,command.c_str (),&result);
85+ status=SendCommand (_omcPtr,command.c_str (),&result);
8686
8787 if (status>0 )
8888 cout<<" load Modelica Library : " << result<<std::endl;
@@ -101,7 +101,7 @@ void ModelicaCompiler::loadFile()
101101 char * result =0 ;
102102
103103 command=" loadModel(Modelica,{\" 3.2.2\" })" ;
104- status = SendCommand (& _omcPtr, command.c_str (), &result);
104+ status = SendCommand (_omcPtr, command.c_str (), &result);
105105
106106 if (status>0 )
107107 cout<<" load Modelica Library : " << result<<std::endl;
@@ -131,7 +131,7 @@ void ModelicaCompiler::loadFile()
131131
132132 cout << " PackageName : " << str << std::endl;
133133
134- status=LoadFile (& _omcPtr,fileToLoad);
134+ status=LoadFile (_omcPtr,fileToLoad);
135135 // status=LoadFile(_omcPtr,"package.mo");
136136
137137 if (status>0 )
@@ -141,7 +141,7 @@ void ModelicaCompiler::loadFile()
141141
142142 std::cout << " failed to load " <<str << std::endl;
143143 char * errorMsg=0 ;
144- status = GetError (& _omcPtr,&errorMsg);
144+ status = GetError (_omcPtr,&errorMsg);
145145 string errorMsgStr (errorMsg);
146146 throw std::runtime_error (" error while loading file: " + str+" " + errorMsgStr);
147147 }
@@ -169,15 +169,15 @@ void ModelicaCompiler::generateLabeledSimCode(string reduction_method)
169169 // command.append(s);
170170 command.append (" )" );
171171 cout << command << std::endl;
172- int status = SendCommand (& _omcPtr, command.c_str (), &result);
172+ int status = SendCommand (_omcPtr, command.c_str (), &result);
173173 if (status>0 )
174174 cout<<" generated labeled simcode for: " <<_model<<" " << result<<std::endl;
175175 else
176176 {
177177
178178 std::cout << " ..failed" << std::endl;
179179 char * errorMsg=0 ;
180- status = GetError (& _omcPtr, &errorMsg);
180+ status = GetError (_omcPtr, &errorMsg);
181181
182182 throw std::runtime_error (" error while executing " + command+ " with error " + errorMsg);
183183 }
@@ -192,7 +192,7 @@ void ModelicaCompiler::generateReferenceSolution()
192192 command.append (_model);
193193 command.append (_model);
194194 command.append (" )" );
195- int status = SendCommand (& _omcPtr, command.c_str (), &result);
195+ int status = SendCommand (_omcPtr, command.c_str (), &result);
196196
197197 if (status>0 )
198198 cout<<" generated reference solution for: " <<_model<<" " << result<<std::endl;
@@ -201,7 +201,7 @@ void ModelicaCompiler::generateReferenceSolution()
201201
202202 std::cout << " ..failed" << std::endl;
203203 char * errorMsg = 0 ;
204- status = GetError (& _omcPtr, &errorMsg);
204+ status = GetError (_omcPtr, &errorMsg);
205205
206206 throw std::runtime_error (" error while executing " + command+ " with error " + errorMsg);
207207 }
@@ -243,15 +243,15 @@ void ModelicaCompiler::reduceTerms(std::vector<unsigned int>& labels, double sta
243243 // command.append(")");
244244
245245 cout<<command<<std::endl;
246- status = SendCommand (& _omcPtr, command.c_str (), &result);
246+ status = SendCommand (_omcPtr, command.c_str (), &result);
247247 if (status>0 )
248248 cout<<" reduceTerms for: " <<_model<<" " << result<<std::endl;
249249 else
250250 {
251251
252252 std::cout << " ..failed" << std::endl;
253253 char * errorMsg = 0 ;
254- status = GetError (& _omcPtr, &errorMsg);
254+ status = GetError (_omcPtr, &errorMsg);
255255
256256 throw std::runtime_error (" error while executing " + command+ " with error " + errorMsg);
257257 }
@@ -271,15 +271,15 @@ void ModelicaCompiler::reduceTerms(std::vector<unsigned int>& labels, double sta
271271 command.append(",startTime=0.0,stopTime = 20.0)");
272272
273273 cout<<command<<std::endl;
274- status=SendCommand(& _omcPtr,command.c_str(),&result);
274+ status=SendCommand(_omcPtr,command.c_str(),&result);
275275 if(status>0)
276276 cout<<"simulation for reduced model: "<<_model<<" "<< result<<std::endl;
277277 else
278278 {
279279
280280 std::cout << "simulation for reduced model failed" << std::endl;
281281 char* errorMsg=0;
282- status = GetError(& _omcPtr, &errorMsg);
282+ status = GetError(_omcPtr, &errorMsg);
283283
284284 throw std::runtime_error("error while executing " + command+ " with error " + errorMsg);
285285 }
0 commit comments