CoolProp  4.2.5
An open-source fluid property and humid air property database
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CriticalSplineConstants.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <vector>
3 #include <string>
5 #include "FluidClass.h"
6 #include "CPExceptions.h"
7 
9 {
10 
11  // This is a map of fluid name to CriticalSplineStruct_T instance
12  // Admittedly this is a bit hacky, but it is easier to update the
13  // file separately and at compile times the constants will be pulled into
14  // this block.
15  // The list of spline parameters is generated by the function rebuild_CriticalSplineConstants_T in FluidClass.cpp
16  std::pair<std::string, CriticalSplineStruct_T> name_map_datad[] = {
17 
19 
20  };
21  //Now actually construct the map
22  std::map<std::string, CriticalSplineStruct_T> name_map(name_map_datad, name_map_datad + sizeof name_map_datad / sizeof name_map_datad[0]);
23 
24  std::map<std::string,CriticalSplineStruct_T>::iterator it;
25  // Try to find using the map using the official name of the fluid
26  it = name_map.find(pFluid->get_name());
27 
28  // If it is found the iterator will not be equal to end
29  if (it != name_map.end() )
30  {
31  pFluid->CriticalSpline_T = (*it).second;
32  }
33  else
34  {
35  // Didn't work, just filling with infinity
36  pFluid->CriticalSpline_T = CriticalSplineStruct_T(_HUGE,_HUGE,_HUGE,_HUGE,_HUGE);
37  }
38 
39 }
void set_critical_spline_constants(Fluid *pFluid)
std::string get_name()
Returns a std::string with the name of the fluid.
Definition: FluidClass.h:235
Fluid is the abstract base class that is employed by all the other fluids.
Definition: FluidClass.h:147
CriticalSplineStruct_T CriticalSpline_T
Definition: FluidClass.h:231