//Validation rules public override void Validate(MyValidator validator) { validator.AssertError((InputHeight - FilterHeight + 2 * ZeroPadding) % VerticalStride == 0, this, "Filter doesn't fit vertically when striding."); validator.AssertError((InputWidth - FilterWidth + 2 * ZeroPadding) % HorizontalStride == 0, this, "Filter doesn't fit horizontally when striding."); validator.AssertInfo(ZeroPadding == (FilterWidth - 1) / 2 && ZeroPadding == (FilterHeight - 1) / 2, this, "Input and output might not have the same dimension. Set stride to 1 and zero padding to ((FilterSize - 1) / 2) to fix this."); }
public override void Validate(MyValidator validator) { //base.Validate(validator); validator.AssertError(ObjectDesc != null, this, "ObjectDesc not given."); validator.AssertError(ObjectXY != null, this, "ObjectXY not given."); validator.AssertInfo(WorldEvent != null, this, "WorldEvent input not given. no problem :)"); /*if (MyMovement != null) * validator.AssertError(MyMovement.Count >= 2, this, "Postion of myself has to be at least XY!");*/ }
internal override void ValidateMandatory(MyValidator validator) { base.ValidateMandatory(validator); if (LoadOnStart || validator.Simulation.LoadAllNodesData) { if (MyMemoryBlockSerializer.TempDataExists(this)) { validator.AddInfo(this, "Node will load data from temporal storage."); } else if (DataFolder != null && DataFolder != String.Empty) { validator.AddInfo(this, "Node will load data from user defined folder: " + DataFolder); } else if (validator.Simulation.LoadAllNodesData && !(String.IsNullOrEmpty(validator.Simulation.GlobalDataFolder))) { validator.AddInfo(this, "Node will load data from user defined folder: " + validator.Simulation.GlobalDataFolder + "\\" + MyMemoryBlockSerializer.GetNodeFolder(this)); } else if (validator.Simulation.LoadAllNodesData && (String.IsNullOrEmpty(validator.Simulation.GlobalDataFolder))) { validator.AddInfo(this, "Node will load data from temporal storage."); } else { validator.AddWarning(this, "LoadOnStart is active but no temporal data and no local or global data folder is set. Data will NOT be loaded."); } } validator.AssertInfo(!(SaveOnStop || validator.Simulation.SaveAllNodesData), this, "Node will save data to temporal storage before stop."); foreach (PropertyInfo pInfo in GetInfo().OwnedMemoryBlocks) { MyAbstractMemoryBlock mb = (pInfo.GetValue(this) as MyAbstractMemoryBlock); validator.AssertError(mb.Count >= 0, this, "Size of " + mb.Name + " memory block cannot be negative."); } List <PropertyInfo> inputBlocks = GetInfo().InputBlocks; for (int i = 0; i < inputBlocks.Count; i++) { PropertyInfo pInfo = inputBlocks[i]; if (GetAbstractInput(i) != pInfo.GetValue(this)) { validator.AddError(this, "Incompatible memory block for \"" + pInfo.Name + "\" (" + GetAbstractInput(i).GetType().GenericTypeArguments[0].Name + " != " + pInfo.PropertyType.GenericTypeArguments[0].Name + ")"); } } }