GeneralMath.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 class SESubstance;
9 
10 class CDM_DECL GeneralMath
11 {
12 public:
13  static void CalculateConcentration(const SEScalarMass& mass, const SEScalarVolume& volume, SEScalarMassPerVolume& concentration, Logger* logger = nullptr);
14  static void CalculateMass(const SEScalarVolume& volume, const SEScalarMassPerVolume& concentration, SEScalarMass& mass, Logger* logger = nullptr);
15  static void CalculateHenrysLawConcentration(const SESubstance& substance, const SEScalarPressure& partialPressure, SEScalarMassPerVolume& concentration, Logger* logger = nullptr);
16  static void CalculatePartialPressureInGas(const SEScalar0To1& volumeFraction, const SEScalarPressure& pressure, SEScalarPressure& partialPressure, Logger* logger = nullptr);
17  static void CalculatePartialPressureInLiquid(const SESubstance& substance, const SEScalarMassPerVolume& concentration, SEScalarPressure& partialPressure, Logger* logger = nullptr);
18  static void CalculateOsmolarity(const SEScalarAmountPerVolume& sodiumMolarity, const SEScalarAmountPerVolume& potassiumMolarity, const SEScalarAmountPerVolume& glucoseMolarity, const SEScalarAmountPerVolume& ureaMolarity, SEScalarOsmolarity& fluidOsmolarity);
19  static void CalculateOsmolality(const SEScalarAmountPerVolume& sodiumMolarity, const SEScalarAmountPerVolume& potassiumMolarity, const SEScalarAmountPerVolume& glucoseMolarity, const SEScalarAmountPerVolume& ureaMolarity, const SEScalar& specificGravity, SEScalarOsmolality& fluidOsmolality);
20  static void CalculateSpecificGravity(const SEScalarMass& mass, const SEScalarVolume& volume, SEScalar& specificGravity, Logger* logger = nullptr);
21 
22  static void Combinations(std::vector<int> maxValues, std::vector<std::vector<int>>& permutations);
23  static double LinearInterpolator(double x1, double x2, double y1, double y2, double xPrime);
24  static double PercentDifference(double expected, double calculated);
25  static double PercentTolerance(double expected, double calculated, double epsilon = 1e-20);
26  static double ResistanceFunction(double dbase, double dmin, double dmax, double dx);
27  static double LogisticFunction(double a, double x50, double k, double x);
28 };
29 
30 
Definition: SESubstanceManager.h:8
Definition: SEScalarMass.h:23
Definition: SEScalar.h:19
Definition: SEScalarVolume.h:23
Definition: Logger.h:61
Definition: SEScalarMassPerVolume.h:32
Definition: SEScalarPressure.h:23
Definition: SELiquidSubstanceQuantity.h:11
Definition: SELiquidCompartment.h:10
Definition: GeneralMath.h:10
Definition: SEScalarOsmolality.h:20
Definition: SEScalarOsmolarity.h:20
Definition: SEScalarAmountPerVolume.h:24
Definition: SESubstance.h:14
Definition: SEScalar0To1.h:7