Пример #1
0
 public static extern int algorithm_Algorithm_run(UpdaterTypes updater_type,
                                                  IntPtr ising,
                                                  IsingTypes ising_type,
                                                  GraphTypes graph_type,
                                                  FloatTypes float_type,
                                                  IntPtr random_number_engine,
                                                  IntPtr schedule_list);
                public override INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression> GetTopValue()
                {
                    INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression> result;

                    result = TopNumericalDomain <BoxedVariable <Variable>, BoxedExpression> .Singleton;

                    if (this.myOptions.AnalyzeFloats)
                    {
                        var fp      = new IntervalEnvironment_IEEE754 <BoxedVariable <Variable>, BoxedExpression>(this.ExpressionManager);
                        var fpTypes = new FloatTypes <BoxedVariable <Variable>, BoxedExpression>(this.ExpressionManager);

                        var refined = new RefinedWithIntervalsIEEE <INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression>, BoxedVariable <Variable>, BoxedExpression>(fp, result, this.ExpressionManager);

                        result = new RefinedWithFloatTypes <RefinedWithIntervalsIEEE <INumericalAbstractDomain <BoxedVariable <Variable>, BoxedExpression>, BoxedVariable <Variable>, BoxedExpression>, BoxedVariable <Variable>, BoxedExpression>(fpTypes, refined, this.ExpressionManager);
                    }

                    return(result);
                }
Пример #3
0
 public static extern int result_get_solution(IntPtr ising,
                                              IsingTypes ising_type,
                                              GraphTypes graph_type,
                                              FloatTypes float_type,
                                              out IntPtr spins);
        public static void InspectProperty(PropertyInfo info, object value)
        {
            var type = info.PropertyType;

            if (IntegerTypes.Contains(type))
            {
                var v = Convert.ToInt32(info.GetValue(value));

                var n = EditorGUILayout.IntField(v);

                if (type == typeof(uint))
                {
                    info.SetValue(value, (uint)n);
                }

                if (type == typeof(ushort))
                {
                    info.SetValue(value, (ushort)n);
                }

                if (type == typeof(short))
                {
                    info.SetValue(value, (short)n);
                }

                if (type == typeof(byte))
                {
                    info.SetValue(value, (byte)n);
                }

                if (type == typeof(int))
                {
                    info.SetValue(value, n);
                }

                return;
            }

            if (LongTypes.Contains(type))
            {
                info.SetValue(value, EditorGUILayout.LongField((long)info.GetValue(value)));

                return;
            }

            if (FloatTypes.Contains(type))
            {
                info.SetValue(value, EditorGUILayout.FloatField((float)info.GetValue(value)));

                return;
            }

            if (DoubleTypes.Contains(type))
            {
                info.SetValue(value, EditorGUILayout.DoubleField((double)info.GetValue(value)));

                return;
            }

            if (type == typeof(bool))
            {
                info.SetValue(value, EditorGUILayout.Toggle((bool)info.GetValue(value)));

                return;
            }

            if (type == typeof(NiString))
            {
                var niString = (NiString)info.GetValue(value);

                var index = niString.Index;

                EditorGUILayout.LabelField($"Index: {(index == uint.MaxValue ? "Null" : index.ToString())}");

                return;
            }

            if (type.Name.StartsWith("Ptr"))
            {
                var ptr = info.GetValue(value);

                var indexInfo = ptr.GetType().GetField("Index");

                if (indexInfo == null)
                {
                    EditorGUILayout.LabelField($"Failed to load ptr");

                    return;
                }

                var index = (int)indexInfo.GetValue(ptr);

                EditorGUILayout.LabelField($"Index: {(index == -1 ? "Null" : index.ToString())}");

                return;
            }

            if (type == typeof(Vector3))
            {
                var v = (Vector3)info.GetValue(value);
                v.x = EditorGUILayout.FloatField(v.x);
                v.y = EditorGUILayout.FloatField(v.y);
                v.z = EditorGUILayout.FloatField(v.z);
                info.SetValue(value, v);

                return;
            }

            if (type == typeof(Color3))
            {
                var v = (Color3)info.GetValue(value);
                v.r = EditorGUILayout.FloatField(v.r);
                v.g = EditorGUILayout.FloatField(v.g);
                v.b = EditorGUILayout.FloatField(v.b);
                info.SetValue(value, v);

                return;
            }

            if (type == typeof(Vector4))
            {
                var v = (Vector4)info.GetValue(value);
                v.x = EditorGUILayout.FloatField(v.x);
                v.y = EditorGUILayout.FloatField(v.y);
                v.z = EditorGUILayout.FloatField(v.z);
                v.w = EditorGUILayout.FloatField(v.w);
                info.SetValue(value, v);

                return;
            }

            EditorGUILayout.LabelField("Unsupported type!");
        }