コード例 #1
0
        private void SetBoundaryConditions(TypeOfFixation type, IBoundaryCondition conditions)
        {
            foreach (var node in conditions.FixedNodes)
            {
                switch (type)
                {
                case TypeOfFixation.RIGID:
                    globalMatrix.ClearRow(node.Key * DEGREES_OF_FREEDOM);
                    //globalMatrix.ClearColumn(node.Key * DEGREES_OF_FREEDOM);
                    globalMatrix[node.Key * DEGREES_OF_FREEDOM, node.Key *DEGREES_OF_FREEDOM] = 1.0;

                    globalMatrix.ClearRow(node.Key * DEGREES_OF_FREEDOM + 1);
                    //globalMatrix.ClearColumn(node.Key * DEGREES_OF_FREEDOM + 1);
                    globalMatrix[node.Key * DEGREES_OF_FREEDOM + 1, node.Key *DEGREES_OF_FREEDOM + 1] = 1.0;

                    globalMatrix.ClearRow(node.Key * DEGREES_OF_FREEDOM + 2);
                    //globalMatrix.ClearColumn(node.Key * DEGREES_OF_FREEDOM + 2);
                    globalMatrix[node.Key * DEGREES_OF_FREEDOM + 2, node.Key *DEGREES_OF_FREEDOM + 2] = 1.0;

                    loads[node.Key * DEGREES_OF_FREEDOM]     = 0.0;
                    loads[node.Key * DEGREES_OF_FREEDOM + 1] = 0.0;
                    loads[node.Key * DEGREES_OF_FREEDOM + 2] = 0.0;
                    break;

                case TypeOfFixation.ARTICULATION_YZ: throw new NotImplementedException();

                case TypeOfFixation.ARTICULATION_XZ: throw new NotImplementedException();

                case TypeOfFixation.ARTICULATION_XY: throw new NotImplementedException();

                default: throw new ArgumentException("Wrong type of the fixation");
                }
            }
        }
コード例 #2
0
ファイル: FunctionHarmonic.cs プロジェクト: meshdgp/MeshDGP
 private void AddConstraints(SparseMatrix sparse, double[] rightB, TriMesh mesh)
 {
     List<int> min = new List<int>();
     List<int> max = new List<int>();  
     foreach (TriMesh.Vertex vertex in mesh.Vertices)
     {
         if (vertex.Traits.SelectedFlag == MinFlag)
         {
             min.Add(vertex.Index);
         } 
         if (vertex.Traits.SelectedFlag == MaxFlag)
         {
             max.Add(vertex.Index);
         }
     } 
     if (min.Count == 0)
     {
         min.Add(0);
     }
     if (max.Count == 0)
     {
         max.Add(mesh.Vertices.Count - 10);
     } 
     for (int i = 0; i < min.Count; i++)
     { 
         sparse.ClearRow(min[i]); 
         sparse[min[i], min[i]] = 1; 
         rightB[min[i]] = Minimum;
     } 
     for (int i = 0; i < max.Count; i++)
     { 
         sparse.ClearRow(max[i]); 
         sparse[max[i], max[i]] = 1; 
         rightB[max[i]] = Maximum;
     } 
 }