예제 #1
0
        private int GetNextNode(int node, EEdge edge)
        {
            var x = SolutionParams.x;
            var y = SolutionParams.y;

            switch (edge)
            {
            case EEdge.Bottom:
            case EEdge.Top:
                return(++node);

            case EEdge.Left:
            case EEdge.Right:
                return(node + x.Length);

            case EEdge.Front:
            case EEdge.Back:
                if (++node % x.Length == 0)
                {
                    return(node + x.Length * y.Length - x.Length);
                }

                return(node);

            default:
                throw new ArgumentOutOfRangeException(nameof(edge), edge, null);
            }
        }
예제 #2
0
        private int GetStartNode(EEdge edge)
        {
            var x = SolutionParams.x;
            var y = SolutionParams.y;
            var z = SolutionParams.z;

            switch (edge)
            {
            case EEdge.Bottom:
                return(0);

            case EEdge.Top:
                return(x.Length * y.Length * z.Length - x.Length * y.Length);

            case EEdge.Left:
                return(0);

            case EEdge.Right:
                return(x.Length - 1);

            case EEdge.Front:
                return(0);

            case EEdge.Back:
                return(x.Length * y.Length - x.Length);

            default:
                throw new ArgumentException();
            }
        }
예제 #3
0
        private int GetEndNode(EEdge edge)
        {
            var x = SolutionParams.x;
            var y = SolutionParams.y;
            var z = SolutionParams.z;

            switch (edge)
            {
            case EEdge.Bottom:
                return(x.Length * y.Length - 1);

            case EEdge.Top:
                return(x.Length * y.Length * z.Length - 1);

            case EEdge.Left:
                return(x.Length * y.Length * z.Length - x.Length);

            case EEdge.Right:
                return(x.Length * y.Length * z.Length - 1);

            case EEdge.Front:
                return(x.Length * y.Length * z.Length - x.Length * y.Length + x.Length - 1);

            case EEdge.Back:
                return(x.Length * y.Length * z.Length - 1);

            default:
                throw new ArgumentOutOfRangeException(nameof(edge), edge, null);
            }
        }
예제 #4
0
        private void kuslau2(ISlaeService slae, int node1, int node2, EEdge edge)
        {
            var r = SolutionParams.r;
            var z = SolutionParams.z;

            var r1 = r[node1 % r.Length];
            var z1 = z[node1 / r.Length];
            var r2 = r[node2 % r.Length];
            var z2 = z[node2 / r.Length];

            var teta1 = teta(r1, z1, edge);
            var teta2 = teta(r2, z2, edge);

            if (edge == EEdge.Right || edge == EEdge.Left)
            {
                var Mz = GetMz(z1, z2);
                slae.b[node1] += Mz[0, 0] * r1 * teta1 + Mz[0, 1] * r1 * teta2;
                slae.b[node2] += Mz[1, 0] * r1 * teta1 + Mz[1, 1] * r1 * teta2;
            }
            else
            {
                var Mr = GetMr(r1, r2);
                slae.b[node1] += Mr[0, 0] * teta1 + Mr[0, 1] * teta2;
                slae.b[node2] += Mr[1, 0] * teta1 + Mr[1, 1] * teta2;
            }
        }
예제 #5
0
파일: EEdges.cs 프로젝트: mkecman/GameOne
    private void AddConnection(EEdge connection)
    {
        GameObject     connectionInstance  = Instantiate(ConnectionPrefab, gameObject.transform);
        EEdgeComponent connectionComponent = connectionInstance.GetComponent <EEdgeComponent>();

        connectionComponent.Connection = connection;
    }
예제 #6
0
 private void OnDestroy()
 {
     if (disposables != null)
     {
         disposables.Dispose();
         disposables    = null;
         Connection     = null;
         _source        = null;
         _target        = null;
         _rectTransform = null;
     }
 }
예제 #7
0
        private double teta(double r, double z, EEdge edge)
        {
            var lambda = SolutionParams.Lambda;

            switch (edge)
            {
            case EEdge.Right:
                //1-st case
                //return lambda * (1 + z);

                //2-nd case
                return(0);

            //3-rd case
            //return lambda * 1;

            case EEdge.Top:
                //1-st case
                //return lambda * (1 + r);

                //2-nd case
                return(lambda * 1);

            //3-rd case
            //return 0;

            case EEdge.Left:
                //1-st case
                //return -lambda * (1 + z);

                //2-nd case
                return(0);

            //3-rd case
            //return -lambda * 1;

            case EEdge.Bottom:
                //1-st case
                //return -lambda * (1 + r);

                //2-nd case
                return(-lambda * 1);

            //3-rd case
            //return 0;

            default:
                throw new ArgumentException();
            }
        }
예제 #8
0
        private void CalculateKU(EEdge edge, ISlaeService slae)
        {
            var startNode = GetStartNode(edge);
            var endNode   = GetEndNode(edge);

            bool isFirst;

            switch (edge)
            {
            case EEdge.Bottom:
                isFirst = SolutionParams.BottomFirst;
                break;

            case EEdge.Top:
                isFirst = SolutionParams.TopFirst;
                break;

            case EEdge.Left:
                isFirst = SolutionParams.LeftFirst;
                break;

            case EEdge.Right:
                isFirst = SolutionParams.RightFirst;
                break;

            case EEdge.Front:
                isFirst = SolutionParams.FrontFirst;
                break;

            case EEdge.Back:
                isFirst = SolutionParams.BackFirst;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(edge), edge, null);
            }

            if (!isFirst)
            {
                return;
            }

            for (var i = startNode; i <= endNode; i = GetNextNode(i, edge))
            {
                kuslau1(slae, i);
            }
        }
예제 #9
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        //ENode oc = property.serializedObject.targetObject as ENode;
        EEdge connection = EEditorUtility.GetParent(property) as EEdge;

        label = EditorGUI.BeginProperty(position, GUIContent.none, property);

        float original = position.width;

        position.width  *= 0.3f;
        position.height /= 2;

        EditorGUIUtility.labelWidth = 80.0f;
        EditorGUI.BeginChangeCheck();
        EditorGUI.PropertyField(position, property.FindPropertyRelative("Source"), new GUIContent("Source"));
        if (EditorGUI.EndChangeCheck())
        {
            property.serializedObject.ApplyModifiedProperties();
            connection.SetSource(connection.Source);
            GameMessage.Send <EEdgesRedrawAll>(message);
        }

        position.y += position.height;
        EditorGUI.BeginChangeCheck();
        EditorGUI.PropertyField(position, property.FindPropertyRelative("Target"), new GUIContent("Target"));
        if (EditorGUI.EndChangeCheck())
        {
            property.serializedObject.ApplyModifiedProperties();
            connection.SetTarget(connection.Target);
            GameMessage.Send <EEdgesRedrawAll>(message);
        }
        position.y -= position.height;

        position.x     = position.width;
        position.width = original - position.width;
        EditorGUI.PropertyField(position, property.FindPropertyRelative("SourceFormula"), new GUIContent("Formula"));

        position.y += position.height;
        EditorGUI.PropertyField(position, property.FindPropertyRelative("TargetFormula"), new GUIContent("Formula"));

        Handles.BeginGUI();
        Handles.color = Color.red;
        Handles.DrawLine(new Vector3(0, position.y + 19f), new Vector3(original, position.y + 19f));
        Handles.EndGUI();

        EditorGUI.EndProperty();
    }
예제 #10
0
    public static void AddElement(SerializedProperty list, int index)
    {
        ENode        objectComponent = list.serializedObject.targetObject as ENode;
        List <EEdge> _connections    = GetParent(list) as List <EEdge>;
        EEdge        connection      = _connections[index];

        connection.Index = index + 1;
        if (list.propertyPath == "_TargetConnections")
        {
            connection.SetSource(objectComponent);
        }
        else
        {
            connection.SetTarget(objectComponent);
        }

        GameMessage.Send <EEdgesRedrawAll>(message);
    }
예제 #11
0
        private void kuslau3(ISlaeService slae, int node1, int node2, EEdge edge)
        {
            var r = SolutionParams.r;
            var z = SolutionParams.z;

            var r1 = r[node1 % r.Length];
            var z1 = z[node1 / r.Length];
            var r2 = r[node2 % r.Length];
            var z2 = z[node2 / r.Length];

            var ubeta1 = Ubeta(r1, z1, edge);
            var ubeta2 = Ubeta(r2, z2, edge);

            if (edge == EEdge.Right || edge == EEdge.Left)
            {
                var Mz = GetMz(z1, z2);
                slae.GetElementOfA(node1, node1) += SolutionParams.Beta * r1 * Mz[0, 0];
                slae.GetElementOfA(node1, node2) += SolutionParams.Beta * r1 * Mz[0, 1];
                slae.GetElementOfA(node2, node1) += SolutionParams.Beta * r1 * Mz[1, 0];
                slae.GetElementOfA(node2, node2) += SolutionParams.Beta * r1 * Mz[1, 1];

                slae.b[node1] += SolutionParams.Beta * (Mz[0, 0] * r1 * ubeta1 + Mz[0, 1] * r1 * ubeta2);
                slae.b[node2] += SolutionParams.Beta * (Mz[1, 0] * r1 * ubeta1 + Mz[1, 1] * r1 * ubeta2);
            }
            else
            {
                var Mr = GetMr(r1, r2);
                slae.GetElementOfA(node1, node1) += SolutionParams.Beta * Mr[0, 0];
                slae.GetElementOfA(node1, node2) += SolutionParams.Beta * Mr[0, 1];
                slae.GetElementOfA(node2, node1) += SolutionParams.Beta * Mr[1, 0];
                slae.GetElementOfA(node2, node2) += SolutionParams.Beta * Mr[1, 1];

                slae.b[node1] += SolutionParams.Beta * (Mr[0, 0] * ubeta1 + Mr[0, 1] * ubeta2);
                slae.b[node2] += SolutionParams.Beta * (Mr[1, 0] * ubeta1 + Mr[1, 1] * ubeta2);
            }
        }
 public EdgeData(EEdge edge)
 {
     m_Edge = edge;
 }
예제 #13
0
파일: Solution.cs 프로젝트: ast-ivanov/Mke
 private double Ubeta(double x, double y, double z, EEdge edge) => U(x, y, z) + teta(x, y, z, edge) / SolutionParams.Beta;
예제 #14
0
파일: Solution.cs 프로젝트: ast-ivanov/Mke
        private double teta(double x, double y, double z, EEdge edge)
        {
            var lambda  = SolutionParams.Lambda;
            var funcNum = SolutionParams.FunctionNumber;

            switch (edge)
            {
            case EEdge.Bottom:
                switch (funcNum)
                {
                case 1:
                    return(-lambda);

                case 2:
                    return(-lambda * x * y);

                case 3:
                    return(-lambda);

                case 4:
                    return(0);

                default:
                    throw new ArgumentException("Неверно задан номер выражения");
                }

            case EEdge.Top:
                switch (funcNum)
                {
                case 1:
                    return(lambda);

                case 2:
                    return(lambda * x * y);

                case 3:
                    return(lambda);

                case 4:
                    return(0);

                default:
                    throw new ArgumentException("Неверно задан номер выражения");
                }

            case EEdge.Left:
                switch (funcNum)
                {
                case 1:
                    return(0);

                case 2:
                    return(-lambda * y * z);

                case 3:
                    return(-lambda);

                case 4:
                    return(-2 * x * lambda);

                default:
                    throw new ArgumentException("Неверно задан номер выражения");
                }

            case EEdge.Right:
                switch (funcNum)
                {
                case 1:
                    return(0);

                case 2:
                    return(lambda * y * z);

                case 3:
                    return(lambda);

                case 4:
                    return(2 * x * lambda);

                default:
                    throw new ArgumentException("Неверно задан номер выражения");
                }

            case EEdge.Front:
                switch (funcNum)
                {
                case 1:
                    return(0);

                case 2:
                    return(-lambda * x * z);

                case 3:
                    return(-lambda);

                case 4:
                    return(-2 * y * lambda);

                default:
                    throw new ArgumentException("Неверно задан номер выражения");
                }

            case EEdge.Back:
                switch (funcNum)
                {
                case 1:
                    return(0);

                case 2:
                    return(lambda * x * z);

                case 3:
                    return(lambda);

                case 4:
                    return(2 * y * lambda);

                default:
                    throw new ArgumentException("Неверно задан номер выражения");
                }

            default:
                throw new ArgumentException();
            }
        }
예제 #15
0
 private double Ubeta(double r, double z, EEdge edge) => U(r, z) + teta(r, z, edge) / SolutionParams.Beta;
예제 #16
0
파일: ESpliter.cs 프로젝트: mkecman/GameOne
 public ESpliterSlider(EEdge edge)
 {
     Edge = edge;
 }