Пример #1
0
        public static XbimDimensionalExponents DeriveDimensionalExponents(IEnumerable <IfcDerivedUnitElement> unitElements)
        {
            var elements = unitElements as IList <IfcDerivedUnitElement> ?? unitElements.ToList();

            if (!elements.Any())
            {
                throw new ArgumentNullException();
            }

            #region Strict Implementation
            var result = new XbimDimensionalExponents(0, 0, 0, 0, 0, 0, 0);
            foreach (var unitElement in elements)
            {
                result.LengthExponent = result.LengthExponent +
                                        (unitElement.Exponent * unitElement.Unit.Dimensions.LengthExponent);
                result.MassExponent = +result.MassExponent +
                                      (unitElement.Exponent * unitElement.Unit.Dimensions.MassExponent);
                result.TimeExponent = result.TimeExponent +
                                      (unitElement.Exponent * unitElement.Unit.Dimensions.TimeExponent);
                result.ElectricCurrentExponent = result.ElectricCurrentExponent +
                                                 (unitElement.Exponent * unitElement.Unit.Dimensions.ElectricCurrentExponent);
                result.ThermodynamicTemperatureExponent = result.ThermodynamicTemperatureExponent +
                                                          (unitElement.Exponent * unitElement.Unit.Dimensions.ThermodynamicTemperatureExponent);
                result.AmountOfSubstanceExponent = result.AmountOfSubstanceExponent +
                                                   (unitElement.Exponent * unitElement.Unit.Dimensions.AmountOfSubstanceExponent);
                result.LuminousIntensityExponent = result.LuminousIntensityExponent +
                                                   (unitElement.Exponent * unitElement.Unit.Dimensions.LuminousIntensityExponent);
            }
            return(result);

            #endregion Strict Implementation
        }
 //## Custom code
 public void Initialise(XbimDimensionalExponents exponent)
 {
     AmountOfSubstanceExponent = exponent.AmountOfSubstanceExponent;
     ElectricCurrentExponent   = exponent.ElectricCurrentExponent;
     LengthExponent            = exponent.LengthExponent;
     LuminousIntensityExponent = exponent.LuminousIntensityExponent;
     MassExponent = exponent.MassExponent;
     ThermodynamicTemperatureExponent = exponent.ThermodynamicTemperatureExponent;
     TimeExponent = exponent.TimeExponent;
 }
Пример #3
0
        public static bool CorrectDimensions(IfcUnitEnum unit, XbimDimensionalExponents dim)
        {
            switch (unit)
            {
            case IfcUnitEnum.LENGTHUNIT:
                return(dim == new XbimDimensionalExponents(1, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.MASSUNIT:
                return(dim == new XbimDimensionalExponents(0, 1, 0, 0, 0, 0, 0));

            case IfcUnitEnum.TIMEUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 1, 0, 0, 0, 0));

            case IfcUnitEnum.ELECTRICCURRENTUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 0, 1, 0, 0, 0));

            case IfcUnitEnum.THERMODYNAMICTEMPERATUREUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 0, 0, 1, 0, 0));

            case IfcUnitEnum.AMOUNTOFSUBSTANCEUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 0, 0, 0, 1, 0));

            case IfcUnitEnum.LUMINOUSINTENSITYUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 0, 0, 0, 0, 1));

            case IfcUnitEnum.PLANEANGLEUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.SOLIDANGLEUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.AREAUNIT:
                return(dim == new XbimDimensionalExponents(2, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.VOLUMEUNIT:
                return(dim == new XbimDimensionalExponents(3, 0, 0, 0, 0, 0, 0));

            case IfcUnitEnum.ABSORBEDDOSEUNIT:
                return(dim == new XbimDimensionalExponents(2, 0, -2, 0, 0, 0, 0));

            case IfcUnitEnum.RADIOACTIVITYUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, -1, 0, 0, 0, 0));

            case IfcUnitEnum.ELECTRICCAPACITANCEUNIT:
                return(dim == new XbimDimensionalExponents(-2, 1, 4, 1, 0, 0, 0));

            case IfcUnitEnum.DOSEEQUIVALENTUNIT:
                return(dim == new XbimDimensionalExponents(2, 0, -2, 0, 0, 0, 0));

            case IfcUnitEnum.ELECTRICCHARGEUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 1, 1, 0, 0, 0));

            case IfcUnitEnum.ELECTRICCONDUCTANCEUNIT:
                return(dim == new XbimDimensionalExponents(-2, -1, 3, 2, 0, 0, 0));

            case IfcUnitEnum.ELECTRICVOLTAGEUNIT:
                return(dim == new XbimDimensionalExponents(2, 1, -3, -1, 0, 0, 0));

            case IfcUnitEnum.ELECTRICRESISTANCEUNIT:
                return(dim == new XbimDimensionalExponents(2, 1, -3, -2, 0, 0, 0));

            case IfcUnitEnum.ENERGYUNIT:
                return(dim == new XbimDimensionalExponents(2, 1, -2, 0, 0, 0, 0));

            case IfcUnitEnum.FORCEUNIT:
                return(dim == new XbimDimensionalExponents(1, 1, -2, 0, 0, 0, 0));

            case IfcUnitEnum.FREQUENCYUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, -1, 0, 0, 0, 0));

            case IfcUnitEnum.INDUCTANCEUNIT:
                return(dim == new XbimDimensionalExponents(2, 1, -2, -2, 0, 0, 0));

            case IfcUnitEnum.ILLUMINANCEUNIT:
                return(dim == new XbimDimensionalExponents(-2, 0, 0, 0, 0, 0, 1));

            case IfcUnitEnum.LUMINOUSFLUXUNIT:
                return(dim == new XbimDimensionalExponents(0, 0, 0, 0, 0, 0, 1));

            case IfcUnitEnum.MAGNETICFLUXUNIT:
                return(dim == new XbimDimensionalExponents(2, 1, -2, -1, 0, 0, 0));

            case IfcUnitEnum.MAGNETICFLUXDENSITYUNIT:
                return(dim == new XbimDimensionalExponents(0, 1, -2, -1, 0, 0, 0));

            case IfcUnitEnum.POWERUNIT:
                return(dim == new XbimDimensionalExponents(2, 1, -3, 0, 0, 0, 0));

            case IfcUnitEnum.PRESSUREUNIT:
                return(dim == new XbimDimensionalExponents(-1, 1, -2, 0, 0, 0, 0));

            default:
                return(false);
            }
        }