<commit_before>#include "MixtureParameters.h"
#include "CPstrings.h"
#include "mixture_departure_functions_JSON.h" // Creates the variable mixture_departure_functions_JSON
#include "mixture_binary_pairs_JSON.h" // Creates the variable mixture_binary_pairs_JSON
#include "predefined_mixtures_JSON.h" // Makes a std::string variable called predefined_mixtures_JSON

namespace CoolProp{

/** \brief A library of predefined mixtures
 *
 * Each entry in the predefined mixture library contains the names and mole fractions for the binary pairs
 */
class PredefinedMixturesLibrary{
    public:
    std::map<std::string, Dictionary> predefined_mixture_map;

    PredefinedMixturesLibrary(){
        rapidjson::Document doc;

        doc.Parse<0>(predefined_mixtures_JSON.c_str());
        if (doc.HasParseError()){throw ValueError();}

        // Iterate over the papers in the listing
        for (rapidjson::Value::ValueIterator itr = doc.Begin(); itr != doc.End(); ++itr)
        {
            // Instantiate the empty dictionary to be filled
            Dictionary dict;
            // Get the name
            std::string name = cpjson::get_string(*itr, "name")+".mix";
            // Get the fluid names
            dict.add_string_vector("fluids", cpjson::get_string_array(*itr, "fluids"));
            // Get the mole fractions
            dict.add_double_vector("mole_fractions", cpjson::get_double_array(*itr,"mole_fractions"));

            predefined_mixture_map.insert(std::pair<std::string, Dictionary >(name, dict));
        }
    }
};
static PredefinedMixturesLibrary predefined_mixtures_library;<commit_msg>Predefined mixture can now have uppercase .MIX; closes #1630<commit_after>#include "MixtureParameters.h"
#include "CPstrings.h"
#include "mixture_departure_functions_JSON.h" // Creates the variable mixture_departure_functions_JSON
#include "mixture_binary_pairs_JSON.h" // Creates the variable mixture_binary_pairs_JSON
#include "predefined_mixtures_JSON.h" // Makes a std::string variable called predefined_mixtures_JSON

namespace CoolProp{

/** \brief A library of predefined mixtures
 *
 * Each entry in the predefined mixture library contains the names and mole fractions for the binary pairs
 */
class PredefinedMixturesLibrary{
    public:
    std::map<std::string, Dictionary> predefined_mixture_map;

    PredefinedMixturesLibrary(){
        rapidjson::Document doc;

        doc.Parse<0>(predefined_mixtures_JSON.c_str());
        if (doc.HasParseError()){throw ValueError();}

        // Iterate over the papers in the listing
        for (rapidjson::Value::ValueIterator itr = doc.Begin(); itr != doc.End(); ++itr)
        {
            // Instantiate the empty dictionary to be filled
            Dictionary dict;
            // Get the name
            std::string name = cpjson::get_string(*itr, "name")+".mix";
            // Get the fluid names
            dict.add_string_vector("fluids", cpjson::get_string_array(*itr, "fluids"));
            // Get the mole fractions
            dict.add_double_vector("mole_fractions", cpjson::get_double_array(*itr,"mole_fractions"));
            // Add to the map
            predefined_mixture_map.insert(std::pair<std::string, Dictionary >(name, dict));
            // Also add the uppercase version to the map
            predefined_mixture_map.insert(std::pair<std::string, Dictionary >(upper(name), dict));
        }
    }
};
static PredefinedMixturesLibrary predefined_mixtures_library;
{'fraction_non_alphanumeric': 0.10530871321407963, 'fraction_numerical': 0.0017311021350259665, 'mean_word_length': 3.4909326424870466, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3097141', 'n_tokens_mistral': 996, 'n_tokens_neox': 963, 'n_words': 247}