MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / GetFluidNames

Method GetFluidNames

wrappers/Modelica/src/FluidProp_IF.cpp:188–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void TFluidProp::GetFluidNames(string LongShort, string ModelName, int* nFluids, string* FluidNames, string* ErrorMsg) {
189 long long_nFluids;
190
191 // Get available fluids
192 BSTR BSTR_Model = _com_util::ConvertStringToBSTR(ModelName.c_str());
193 BSTR BSTR_LongShort = _com_util::ConvertStringToBSTR(LongShort.c_str());
194 BSTR BSTR_Error;
195
196 // Convert character array FluidNames via binary strings (BSTR) into an OLE SafeArray
197 // This needs to be done because in the COM interface FluidNames is an inout argument,
198 // because Visual Basic is not able to deal out arrays....
199 //
200 SAFEARRAYBOUND sa_bounds_FluidNames[1];
201 sa_bounds_FluidNames[0].lLbound = 0;
202 sa_bounds_FluidNames[0].cElements = 250;
203 SAFEARRAY* sa_FluidNames;
204 sa_FluidNames = SafeArrayCreate(VT_BSTR, 1, sa_bounds_FluidNames);
205
206 FluidProp_COM->GetFluidNames(BSTR_LongShort, BSTR_Model, &long_nFluids, &sa_FluidNames, &BSTR_Error);
207
208 // Retrieve array with components from SafeArray
209 BSTR BSTR_Fluid;
210 for (long i = 0; i < long_nFluids; i++) {
211 SafeArrayGetElement(sa_FluidNames, &i, &BSTR_Fluid);
212 FluidNames[i] = _com_util::ConvertBSTRToString(BSTR_Fluid);
213 }
214 *nFluids = long_nFluids;
215
216 // Error handling
217 char* lpszErrorMsg = _com_util::ConvertBSTRToString(BSTR_Error);
218 *ErrorMsg = lpszErrorMsg;
219 delete[] lpszErrorMsg;
220
221 SysFreeString(BSTR_Fluid);
222 SysFreeString(BSTR_Error);
223 SysFreeString(BSTR_LongShort);
224 SysFreeString(BSTR_Model);
225}
226
227double TFluidProp::Pressure(string InputSpec, double Input1, double Input2, string* ErrorMsg) {
228 double Output;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected