Пример #1
0
        private Dictionary <int, double> CalculateLoadingCondition(LoadingCondition loading)
        {
            LoadProvider provider = new LoadProvider();

            if (ElementsDictionary.Count == 0)
            {
                CreateFaceElements();
            }
            Dictionary <int, double> load = new Dictionary <int, double>();

            if (loading is NeumannBoundaryCondition)
            {
                foreach (Element element in ElementsDictionary.Values)
                {
                    foreach (int dof in provider.LoadNeumann(element, this, loading as NeumannBoundaryCondition).Keys)
                    {
                        if (load.ContainsKey(dof))
                        {
                            load[dof] += provider.LoadNeumann(element, this, loading as NeumannBoundaryCondition)[dof];
                        }
                        else
                        {
                            load.Add(dof, provider.LoadNeumann(element, this, loading as NeumannBoundaryCondition)[dof]);
                        }
                    }
                }
            }
            else if (loading is PressureBoundaryCondition)
            {
                foreach (Element element in ElementsDictionary.Values)
                {
                    foreach (int dof in provider.LoadPressure(element, this, loading as PressureBoundaryCondition).Keys)
                    {
                        if (load.ContainsKey(dof))
                        {
                            load[dof] += provider.LoadPressure(element, this, loading as PressureBoundaryCondition)[dof];
                        }
                        else
                        {
                            load.Add(dof, provider.LoadPressure(element, this, loading as PressureBoundaryCondition)[dof]);
                        }
                    }
                }
            }
            return(load);
        }
Пример #2
0
 private void CalculateNeumann(LoadProvider provider, NeumannBoundaryCondition condition, Dictionary <int, double> load)
 {
     foreach (var element in ElementsDictionary.Values)
     {
         var loadNeumann = provider.LoadNeumann(element, this, condition);
         foreach (int dof in loadNeumann.Keys)
         {
             if (load.ContainsKey(dof))
             {
                 load[dof] += loadNeumann[dof];
             }
             else
             {
                 load.Add(dof, loadNeumann[dof]);
             }
         }
     }
 }