internal static string Format(ParameterLog log) { ReadBlobParameterLog readBlobLog = log as ReadBlobParameterLog; if (readBlobLog != null) { return(Format(readBlobLog)); } WriteBlobParameterLog writeBlobLog = log as WriteBlobParameterLog; if (writeBlobLog != null) { return(Format(writeBlobLog)); } TableParameterLog tableLog = log as TableParameterLog; if (tableLog != null) { return(Format(tableLog)); } TextParameterLog textLog = log as TextParameterLog; if (textLog != null) { return(textLog.Value); } return(null); }
private float[] GetNextFeatures(ParameterLog parameterLog) { float thresholdVal = threshold.value * 0.5f; float paramGeoIdx = parameterLog.GeoIdx / geomIdxMax; float paramRecursion = parameterLog.Recursion / recursionMax; float paramOffset1 = (parameterLog.Offset1 + 1f) / 2f; float paramOffset2 = (parameterLog.Offset2 + 1f) / 2f; /* * features[0] = parameterLog.GeoIdx + Random.Range(threshold.value * -1f, threshold.value) * 4f; * features[1] = parameterLog.Recursion + Random.Range(threshold.value * -1f, threshold.value) * 7; * features[2] = parameterLog.Offset1 +( Random.Range(threshold.value * -1f, threshold.value) * 2f - 1f); * features[3] = parameterLog.Offset2 + (Random.Range(threshold.value * -1f, threshold.value) * 2f - 1f); */ features[0] = GetMaxMin(paramGeoIdx, thresholdVal) * 4f; features[1] = GetMaxMin(paramRecursion, thresholdVal) * 5; features[2] = GetMaxMin(paramOffset1, thresholdVal) * 2f - 1f; features[3] = GetMaxMin(paramOffset2, thresholdVal) * 2f - 1f; Debug.Log(features); return(features); }
public static void AddLogs(IReadOnlyDictionary <string, IWatcher> watches, IDictionary <string, ParameterLog> collector) { foreach (KeyValuePair <string, IWatcher> item in watches) { IWatcher watch = item.Value; if (watch == null) { continue; } ParameterLog status = watch.GetStatus(); if (status == null) { continue; } collector.Add(item.Key, status); } }
// Update is called once per frame void Update() { if (!(Input.GetMouseButtonDown(0))) { return; } var hitName = ""; GetGUI(Input.mousePosition, ref hitName); if (hitName == "") { return; } ParameterLog parameterLog = parameterLogs[int.Parse(hitName)]; float[] nextFeatures = new float[4]; for (int i = 0; i < meshObjcts.Length; i++) { nextFeatures = GetNextFeatures(parameterLog); meshObjcts[i].GetComponent <ParameterLog>().SetPrameter(nextFeatures);//形状ごとにパラメータを保存する parametricSubdivide.SetPrams(nextFeatures); parametricSubdivide.SubdivideMesh(meshs[i]); } #region text write /* * if (hitName != "") * { * File.AppendAllText(selectedLogText, hitName); * } */ #endregion }
public ImmutableWatcher(ParameterLog status) { _status = status; }
public static void AddParameterModels(string parameterName, FunctionInstanceArgument argument, ParameterLog log, FunctionInstanceSnapshot snapshot, ICollection<ParameterModel> parameterModels) { if (argument == null) { throw new ArgumentNullException("argument"); } if (parameterModels == null) { throw new ArgumentNullException("parameterModels"); } ParameterModel model = new ParameterModel { Name = parameterName, ArgInvokeString = argument.Value }; if (log != null) { model.Status = Format(log); } if (argument.IsBlob) { model.ExtendedBlobModel = LogAnalysis.CreateExtendedBlobModel(snapshot, argument); } parameterModels.Add(model); // Special-case IBinder, which adds sub-parameters. BinderParameterLog binderLog = log as BinderParameterLog; if (binderLog != null) { IEnumerable<BinderParameterLogItem> items = binderLog.Items; if (items != null) { int count = items.Count(); model.Status = String.Format(CultureInfo.CurrentCulture, "Bound {0} object{1}.", count, count != 1 ? "s" : String.Empty); foreach (BinderParameterLogItem item in items) { if (item == null) { continue; } ParameterSnapshot itemSnapshot = HostIndexer.CreateParameterSnapshot(item.Descriptor); string itemName = parameterName; if (!string.IsNullOrEmpty(itemSnapshot.AttributeText)) { itemName += ": " + itemSnapshot.AttributeText; } FunctionInstanceArgument itemArgument = FunctionIndexer.CreateFunctionInstanceArgument(item.Value, item.Descriptor); AddParameterModels(itemName, itemArgument, item.Log, snapshot, parameterModels); } } } }
internal static string Format(ParameterLog log) { ReadBlobParameterLog readBlobLog = log as ReadBlobParameterLog; if (readBlobLog != null) { return Format(readBlobLog); } WriteBlobParameterLog writeBlobLog = log as WriteBlobParameterLog; if (writeBlobLog != null) { return Format(writeBlobLog); } TableParameterLog tableLog = log as TableParameterLog; if (tableLog != null) { return Format(tableLog); } SingletonParameterLog singletonLog = log as SingletonParameterLog; if (singletonLog != null) { return Format(singletonLog); } TextParameterLog textLog = log as TextParameterLog; if (textLog != null) { return textLog.Value; } return null; }
public static void AddParameterModels(string parameterName, FunctionInstanceArgument argument, ParameterLog log, FunctionInstanceSnapshot snapshot, ICollection <ParameterModel> parameterModels) { if (argument == null) { throw new ArgumentNullException("argument"); } if (parameterModels == null) { throw new ArgumentNullException("parameterModels"); } ParameterModel model = new ParameterModel { Name = parameterName, ArgInvokeString = argument.Value }; if (log != null) { model.Status = Format(log); } if (argument.IsBlob) { model.ExtendedBlobModel = LogAnalysis.CreateExtendedBlobModel(snapshot, argument); } parameterModels.Add(model); // Special-case IBinder, which adds sub-parameters. BinderParameterLog binderLog = log as BinderParameterLog; if (binderLog != null) { IEnumerable <BinderParameterLogItem> items = binderLog.Items; if (items != null) { int count = items.Count(); model.Status = String.Format(CultureInfo.CurrentCulture, "Bound {0} object{1}.", count, count != 1 ? "s" : String.Empty); foreach (BinderParameterLogItem item in items) { if (item == null) { continue; } ParameterSnapshot itemSnapshot = HostIndexer.CreateParameterSnapshot(item.Descriptor); string itemName = parameterName; if (!string.IsNullOrEmpty(itemSnapshot.AttributeText)) { itemName += ": " + itemSnapshot.AttributeText; } FunctionInstanceArgument itemArgument = FunctionIndexer.CreateFunctionInstanceArgument(item.Value, item.Descriptor); AddParameterModels(itemName, itemArgument, item.Log, snapshot, parameterModels); } } } }
private static void AssertNotWritten(ParameterLog actual) { Assert.IsType<WriteBlobParameterLog>(actual); WriteBlobParameterLog actualBlobLog = (WriteBlobParameterLog)actual; Assert.False(actualBlobLog.WasWritten); Assert.Equal(0, actualBlobLog.BytesWritten); }
private static void AssertEqualStatus(int expectedBytesWritted, ParameterLog actual) { Assert.IsType<WriteBlobParameterLog>(actual); WriteBlobParameterLog actualBlobLog = (WriteBlobParameterLog)actual; Assert.Equal(expectedBytesWritted, actualBlobLog.BytesWritten); Assert.True(actualBlobLog.WasWritten); }
private static void AssertEqualBytesRead(int expected, ParameterLog actual) { Assert.IsType<ReadBlobParameterLog>(actual); ReadBlobParameterLog actualBlobLog = (ReadBlobParameterLog)actual; Assert.Equal(expected, actualBlobLog.BytesRead); }