Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <param name="solution"></param>
        /// <returns>A nodesCount x 2 array, where each row stores the x and y displacements of that node</returns>
        public double[,] GatherNodalDisplacements(Model2D_old model, Vector solution)
        {
            double[,] result = new double[model.Nodes.Count, 2];
            for (int i = 0; i < model.Nodes.Count; ++i)
            {
                XNode node = model.Nodes[i];

                bool isXStandard = standardDofs.TryGetValue(node, StructuralDof.TranslationX, out int globalStandardDofX);
                if (isXStandard)
                {
                    result[i, 0] = solution[globalStandardDofX];
                }
                else
                {
                    result[i, 0] = model.Constraints[node, StructuralDof.TranslationX];
                }

                bool isYStandard = standardDofs.TryGetValue(node, StructuralDof.TranslationY, out int globalStandardDofY);
                if (isYStandard)
                {
                    result[i, 1] = solution[globalStandardDofY];
                }
                else
                {
                    result[i, 1] = model.Constraints[node, StructuralDof.TranslationY];
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public List <int> GetConstrainedDofsOf(XContinuumElement2D element)
        {
            var globalDofs = new List <int>();

            foreach (var nodeDofLocal in element.GetStandardDofs())
            {
                bool isConstrained = constrainedDofs.TryGetValue(nodeDofLocal.row, nodeDofLocal.col, out int globalDof);
                if (isConstrained)
                {
                    globalDofs.Add(globalDof);
                }
            }
            return(globalDofs);
        }