Example #1
0
        public void OnMaterialChanged(IMaterial material, MaterialChangeType mct)
        {
            if (m_diagnostics)
            {
                _Debug.WriteLine("ReactionProcessor notified of change type " + mct + " to material " + material);
            }
            if (mct == MaterialChangeType.Contents)
            {
                Mixture tmpMixture = material as Mixture;
                if (tmpMixture != null)
                {
                    Mixture          mixture = tmpMixture;
                    ReactionInstance ri      = null;
                    if (m_diagnostics)
                    {
                        _Debug.WriteLine("Processing change type " + mct + " to mixture " + mixture.Name);
                    }

                    // If multiple reactions could occur? Only the first happens, but then the next change allows the next reaction, etc.
                    foreach (Reaction reaction in m_reactions)
                    {
                        if (ri != null)
                        {
                            continue;
                        }
                        if (m_diagnostics)
                        {
                            _Debug.WriteLine("Examining mixture for presence of reaction " + reaction.Name);
                        }
                        ri = reaction.React(mixture);
                    }
                }
            }
        }
Example #2
0
 private void m_material_MaterialChanged(IMaterial material, MaterialChangeType type)
 {
     // ReSharper disable once RedundantJumpStatement (Used in diagnostics)
     if (type == MaterialChangeType.Temperature)
     {
         return;
     }
     //_Debug.WriteLine(m_model.Executive.Now + " : mixture in " + this.Name + " is now " + m_material + ", after a change of " + type);
 }
Example #3
0
 private void m_mixture_MaterialChanged(IMaterial material, MaterialChangeType type)
 {
     m_mixtureMass.Register(m_mixture.Mass);
     m_mixtureVolume.Register(m_mixture.Volume);
 }