예제 #1
0
        public LayerElementListItem(DatabaseDataContext database, LayerElement layerElement)
        {
            Isotope initialIsotope = layerElement.Isotope;
            LayerElement = layerElement;

            Elements = new ObservableCollection<Element>(database.Elements.ToList());
            Isotopes = new ObservableCollection<Isotope>();

            if (layerElement.Isotope!=null)
                SelectedElement = layerElement.Isotope.Element;

            SelectedIsotope = initialIsotope;
        }
예제 #2
0
		private void detach_LayerElements(LayerElement entity)
		{
			this.SendPropertyChanging();
			entity.Isotope = null;
		}
예제 #3
0
 partial void DeleteLayerElement(LayerElement instance);
예제 #4
0
 partial void UpdateLayerElement(LayerElement instance);
예제 #5
0
 partial void InsertLayerElement(LayerElement instance);
예제 #6
0
		private void attach_LayerElements(LayerElement entity)
		{
			this.SendPropertyChanging();
			entity.Material = this;
		}
        /// <summary>
        /// Function that calculates the atomic density of an <see cref="LayerElement"/> inside a <see cref="Layer"/>.
        /// </summary>
        /// <param name="layer">The <see cref="Layer"/> containing the <see cref="LayerElement"/>.</param>
        /// <param name="layerElement">The <see cref="LayerElement"/> which atomic density is calulated.</param>
        /// <returns></returns>
        private double CalculateAtomicDensity(Layer layer, LayerElement layerElement)
        {
            double MassOfMolecule = 0;
            foreach (LayerElement l in layer.LayerElements)
                MassOfMolecule += l.Isotope.Mass * l.StoichiometricFactor;

            double NumberOfMolecules = layer.Density / MassOfMolecule / 1.66053904E-24;

            double NumberOfAtomsInMolecule = layer.LayerElements.Select(x => x.StoichiometricFactor).ToList().Sum();

            double AtomicDensityOfElement = NumberOfMolecules * layerElement.StoichiometricFactor;
            Console.WriteLine("Atomic density of " + layerElement.Isotope.Element.LongName+ ": " + AtomicDensityOfElement);
            return AtomicDensityOfElement;
        }
예제 #8
0
        /// <summary>
        /// Function that adds a new <see cref="LayerElement"/> to the selected <see cref="Layer"/>.
        /// </summary>
        public void _AddLayerElementCommand()
        {
            if (SelectedLayer == null) return;

            LayerElement newLayerElement = new LayerElement { MaterialID = SelectedMaterial.MaterialID, LayerID = SelectedLayer.LayerID, StoichiometricFactor = 1 };

            LayerElements.Add(new LayerElementListItem(Database, newLayerElement));

            SelectedLayer.LayerElements.Add(newLayerElement);
            SelectedMaterial.LayerElements.Add(newLayerElement);
        }