<commit_before>/*
Copyright libCellML Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#pragma once

#include <algorithm>
#include <cctype>
#include <map>
#include <string>
#include <vector>

#include "libcellml/types.h"
#include "libcellml/variable.h"

#include "commonutils.h"
#include "internaltypes.h"

namespace libcellml {

/**
 * Base URLs of specification and example sites from which the Issue::url() will be constructed.
 */
static const std::string baseSpecificationUrl = "https://cellml-specification.readthedocs.io/en/latest/reference/formal_and_informative/";

/**
 * Vector of base units.
 */
static const std::vector<std::string> baseUnitsList = {
    "ampere",
    "candela",
    "dimensionless",
    "kelvin",
    "kilogram",
    "metre",
    "mole",
    "second"};

/**
 *  Map connecting standard built-in units to their base unit components and their exponents.
 */
static const std::map<std::string, std::map<std::string, double>> standardUnitsList = {
    {"ampere", {{"ampere", 1.0}}},
    {"becquerel", {{"second", -1.0}}},
    {"candela", {{"candela", 1.0}}},
    {"coulomb", {{"ampere", -1.0}, {"second", 1.0}}},
    {"dimensionless", {{"dimensionless", 1.0}}},
    {"farad", {{"ampere", 2.0}, {"kilogram", -1.0}, {"metre", -2.0}, {"second", -4.0}}},
    {"gram", {{"kilogram", 1.0}}},
    {"gray", {{"metre", 2.0}, {"second", -2.0}}},
    {"henry", {{"ampere", -2.0}, {"kilogram", 1.0}, {"metre", 2.0}, {"second", -2.0}}},
    {"hertz", {{"second", -1.0}}},
    {"joule", {{"kilogram", 1.0}, {"metre", 2.0}, {"second", -2.0}}},
    {"katal", {{"mole", 1.0}, {"second", -1.0}}},
    {"kelvin", {{"kelvin", 1.0}}},
    {"kilogram", {{"kilogram", 1.0}}},
    {"litre", {{"metre", 3.0}}},
    {"lumen", {{"candela", 1.0}}},
    {"lux", {{"candela", 1.0}, {"metre", -2.0}}},
    {"metre", {{"metre", 1.0}}},
    {"mole", {{"mole", 1.0}}},
    {"newton", {{"kilogram", 1.0}, {"metre", 1.0}, {"second", -2.0}}},
    {"ohm", {{"ampere", -2.0}, {"kilogram", 1.0}, {"metre", 2.0}, {"second", -3.0}}},
    {"pascal", {{"kilogram", 1.0}, {"metre", -1.0}, {"second", -2.0}}},
    {"radian", {{"dimensionless", 1.0}}},
    {"second", {{"second", 1.0}}},
    {"siemens", {{"ampere", 2.0}, {"kilogram", -1.0}, {"metre", -2.0}, {"second", 3.0}}},<commit_msg>Units: fixed the breaking down of a couple of standard units.<commit_after>/*
Copyright libCellML Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#pragma once

#include <algorithm>
#include <cctype>
#include <map>
#include <string>
#include <vector>

#include "libcellml/types.h"
#include "libcellml/variable.h"

#include "commonutils.h"
#include "internaltypes.h"

namespace libcellml {

/**
 * Base URLs of specification and example sites from which the Issue::url() will be constructed.
 */
static const std::string baseSpecificationUrl = "https://cellml-specification.readthedocs.io/en/latest/reference/formal_and_informative/";

/**
 * Vector of base units.
 */
static const std::vector<std::string> baseUnitsList = {
    "ampere",
    "candela",
    "dimensionless",
    "kelvin",
    "kilogram",
    "metre",
    "mole",
    "second"};

/**
 *  Map connecting standard built-in units to their base unit components and their exponents.
 */
static const std::map<std::string, std::map<std::string, double>> standardUnitsList = {
    {"ampere", {{"ampere", 1.0}}},
    {"becquerel", {{"second", -1.0}}},
    {"candela", {{"candela", 1.0}}},
    {"coulomb", {{"ampere", 1.0}, {"second", 1.0}}},
    {"dimensionless", {{"dimensionless", 1.0}}},
    {"farad", {{"ampere", 2.0}, {"kilogram", -1.0}, {"metre", -2.0}, {"second", 4.0}}},
    {"gram", {{"kilogram", 1.0}}},
    {"gray", {{"metre", 2.0}, {"second", -2.0}}},
    {"henry", {{"ampere", -2.0}, {"kilogram", 1.0}, {"metre", 2.0}, {"second", -2.0}}},
    {"hertz", {{"second", -1.0}}},
    {"joule", {{"kilogram", 1.0}, {"metre", 2.0}, {"second", -2.0}}},
    {"katal", {{"mole", 1.0}, {"second", -1.0}}},
    {"kelvin", {{"kelvin", 1.0}}},
    {"kilogram", {{"kilogram", 1.0}}},
    {"litre", {{"metre", 3.0}}},
    {"lumen", {{"candela", 1.0}}},
    {"lux", {{"candela", 1.0}, {"metre", -2.0}}},
    {"metre", {{"metre", 1.0}}},
    {"mole", {{"mole", 1.0}}},
    {"newton", {{"kilogram", 1.0}, {"metre", 1.0}, {"second", -2.0}}},
    {"ohm", {{"ampere", -2.0}, {"kilogram", 1.0}, {"metre", 2.0}, {"second", -3.0}}},
    {"pascal", {{"kilogram", 1.0}, {"metre", -1.0}, {"second", -2.0}}},
    {"radian", {{"dimensionless", 1.0}}},
    {"second", {{"second", 1.0}}},
    {"siemens", {{"ampere", 2.0}, {"kilogram", -1.0}, {"metre", -2.0}, {"second", 3.0}}},
{'fraction_non_alphanumeric': 0.244524236983842, 'fraction_numerical': 0.03518850987432675, 'mean_word_length': 4.000897666068223, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6462265', 'n_tokens_mistral': 2116, 'n_tokens_neox': 1974, 'n_words': 563}