diff --git a/LFPSO/unit_LFPSO_Base.pas b/LFPSO/unit_LFPSO_Base.pas index 01fbd41..e5765cd 100644 --- a/LFPSO/unit_LFPSO_Base.pas +++ b/LFPSO/unit_LFPSO_Base.pas @@ -537,13 +537,14 @@ procedure TLFPSO_BASE.SendUpdateMessage(const Step: integer); msg_prm: PUpdateFitProgressMsg; begin New(msg_prm); - msg_prm.Full := True; + msg_prm.Full := True; msg_prm.LastChi := FGlobalBestChiSqr; msg_prm.BestChi := FAbsoluteBestChiSqr; msg_prm.Step := Step; msg_prm.Curve := FResultingCurve; msg_prm.Structure := FStructure; msg_prm.Poly := GetPolynomes; + msg_prm.Res := GetResult; PostMessage( Application.MainFormHandle, diff --git a/LFPSO/unit_LFPSO_Irregular.pas b/LFPSO/unit_LFPSO_Irregular.pas index b4c9215..9f8c969 100644 --- a/LFPSO/unit_LFPSO_Irregular.pas +++ b/LFPSO/unit_LFPSO_Irregular.pas @@ -90,10 +90,11 @@ procedure TLFPSO_Irregular.UpdateLFPSO(const t: integer); V[i][j][k][0] := Omega(t, FTMax) * LevyWalk(X[i][j][k][0], gbest[j][k][0]) + c1 * Random * (pbest[j][k][0] - X[i][j][k][0]) + c2 * Random * (gbest[j][k][0] - X[i][j][k][0]); - CheckLimits(i, j, k); end else X[i][j][k][0] := X[i][FLinks[j][k]][k][0]; + + CheckLimits(i, j, k); end; if FFitParams.Smooth then Smooth(i); @@ -117,10 +118,11 @@ procedure TLFPSO_Irregular.UpdatePSO(const t: integer); V[i][j][k][0] := Omega(t, FTMax) * V[i][j][k][0] + c1 * Random * (pbest[j][k][0] - X[i][j][k][0]) + c2 * Random * (gbest[j][k][0] - X[i][j][k][0]); - CheckLimits(i, j, k); end else X[i][j][k][0] := X[i][FLinks[j][k]][k][0]; + + CheckLimits(i, j, k); end; if FFitParams.Smooth then Smooth(i); @@ -157,8 +159,11 @@ procedure TLFPSO_Irregular.XSeed; for i := 1 to High(X) do // for every member of the population begin for j := 0 to High(X[i]) do //for every layer - for k := 1 to 3 do // for H, s, rho + for k := 1 to 3 do + begin // for H, s, rho X[i][j][k][0] := X[0][j][k][0] + Rand(XRange[0][j][k][0] * FFitParams.Ksxr); + CheckLimits(i, j, k); + end; if FFitParams.Smooth then Smooth(i); end; @@ -179,6 +184,8 @@ procedure TLFPSO_Irregular.RangeSeed; X[i][j][k][0] := X[i][FLinks[j][k]][k][0] else X[i][j][k][0] := Xmin[0][j][k][0] + Random * (Xmax[0][j][k][0] - Xmin[0][j][k][0]); // min + Random * (min-max) + + CheckLimits(i, j, k); end; if FFitParams.Smooth then Smooth(i); diff --git a/XRayCalc3.dproj b/XRayCalc3.dproj index 456f303..f6c1a61 100644 --- a/XRayCalc3.dproj +++ b/XRayCalc3.dproj @@ -1,7 +1,7 @@  {D89E79FA-2135-48C6-94C6-60FBC791086C} - 19.5 + 20.1 VCL True Release @@ -114,7 +114,7 @@ true CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=3.0.0.200;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.0.0;Comments= Resources\XRayCalc3_Icon.ico - -f "d:\DelphiProjects\X-Ray Calc\X-Ray Calc 3\test_data\W-BN(221101A).xrcx" -a + -f "d:\DelphiProjects\X-Ray Calc\X-Ray Calc 3\test_data\ML(20x4)_Poly1_#1.xrcx" -a PerMonitorV2 @@ -134,18 +134,24 @@ false Resources\XRayCalc3_Icon.ico 3 - 420 - CompanyName=Zhejiang University;FileDescription=$(MSBuildProjectName);FileVersion=3.0.8.420;InternalName=;LegalCopyright=Oleksiy Penkov;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.4;Comments= - 8 + 445 + CompanyName=Zhejiang University;FileDescription=$(MSBuildProjectName);FileVersion=3.1.2.445;InternalName=;LegalCopyright=Oleksiy Penkov;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=3.0.4;Comments= + 1 + 2 PerMonitorV2 - .\OUT\BIN64 .\OUT\DCP64 .\OUT\DCU64 true 1033 Resources\XRayCalc3_x64_Icon.ico + 3 + 1 + 445 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=3.1.2.445;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + x64.exe + 2 @@ -233,6 +239,9 @@
frmFitSettings
dfm + + + Base @@ -254,8 +263,8 @@ XRayCalc3.dpr - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components @@ -361,6 +370,16 @@ 1 + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + res\values @@ -381,6 +400,66 @@ 1 + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + res\values @@ -391,6 +470,16 @@ 1 + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + res\drawable @@ -561,6 +650,56 @@ 1 + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + 1 diff --git a/components/XRayCalcVisualControls.dproj b/components/XRayCalcVisualControls.dproj index 9fb6656..afce684 100644 --- a/components/XRayCalcVisualControls.dproj +++ b/components/XRayCalcVisualControls.dproj @@ -2,12 +2,12 @@ {76B6C4F1-C8DB-4E1F-8F08-2286C45F4B84} XRayCalcVisualControls.dpk - 19.5 + 20.1 VCL True - Debug - Win32 - 1 + Release + Win64 + 3 Package @@ -63,6 +63,11 @@ vcl;rtl;RaizeComponentsVcl;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 DEBUG;$(DCC_Define) @@ -220,6 +225,16 @@ 1 + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + res\values @@ -240,6 +255,66 @@ 1 + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + res\values @@ -250,6 +325,16 @@ 1 + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + res\drawable @@ -420,6 +505,56 @@ 1 + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + 1 @@ -860,7 +995,7 @@ True - False + True 12 diff --git a/components/unit_XRCLayerControl.pas b/components/unit_XRCLayerControl.pas index ccb4a30..e224d54 100644 --- a/components/unit_XRCLayerControl.pas +++ b/components/unit_XRCLayerControl.pas @@ -18,6 +18,8 @@ interface type TXRCLayerControl = class (TRzPanel) + protected + procedure MyKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private Name: TRzLabel; Thickness: TRzSpinEdit; @@ -42,7 +44,6 @@ TXRCLayerControl = class (TRzPanel) procedure CheckBoxClick(Sender: TObject); procedure ValueChange(Sender: TObject); procedure SpinButtonClick(Sender: TObject; Button: TSpinButtonType); - procedure KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure SetIncrement(const Value: Double); procedure SetEnabled(const Value: Boolean); reintroduce; overload; function GetEnabled: Boolean; reintroduce; overload; @@ -55,7 +56,7 @@ TXRCLayerControl = class (TRzPanel) procedure InternalOnDblClick(Sender: TObject); procedure InternalOnClick(Sender: TObject); procedure LinkedOnClick(Sender: TObject); - function AddSpinEdit(const index, Left, Max: integer): TRzSpinEdit; + function AddSpinEdit(const index, Left, Max: integer; Width:Integer = 50): TRzSpinEdit; procedure SetLayerData(const Value: TLayerData); procedure SetSlected(const Value: boolean); function AddCheckBox(const index, Left: integer): TRzCheckBox; @@ -106,14 +107,14 @@ implementation { TXRCLayerControl } -function TXRCLayerControl.AddSpinEdit(const index, Left, Max: integer):TRzSpinEdit; +function TXRCLayerControl.AddSpinEdit; begin Result := TRzSpinEdit.Create(Self); Result.Parent := Self; Result.Left := Left; Result.Top := 11; - Result.Width := 58; + Result.Width := Width; Result.Height := 21; Result.Decimals := 2; Result.Increment := 0.1; @@ -125,7 +126,7 @@ function TXRCLayerControl.AddSpinEdit(const index, Left, Max: integer):TRzSpinEd Result.Tag := Index; Result.OnChange := ValueChange; - Result.OnKeyDown := KeyDown; + Result.OnKeyDown := MyKeyDown; Result.OnButtonClick := SpinButtonClick; end; @@ -167,15 +168,15 @@ constructor TXRCLayerControl.Create(AOwner: TComponent; const Handler: HWND; con Name := TRzLabel.Create(Self); //Thickness - Thickness := AddSpinEdit(1, 90, 9999); - PairedH := AddCheckBox(1, 150); + Thickness := AddSpinEdit(1, 85, 9999, 80); + PairedH := AddCheckBox(1, 167); //Sigma - Sigma := AddSpinEdit(2, 170, 50); - PairedS := AddCheckBox(2, 230); + Sigma := AddSpinEdit(2, 186, 50); + PairedS := AddCheckBox(2, 240); //Rho - Rho := AddSpinEdit(3, 250, 30); + Rho := AddSpinEdit(3, 258, 30); PairedR := AddCheckBox(3, 310); //RzCheckBox1 @@ -346,7 +347,7 @@ procedure TXRCLayerControl.InternalOnDblClick(Sender: TObject); LayerDoubleClick(FData.StackID, FData.LayerID); end; -procedure TXRCLayerControl.KeyDown; +procedure TXRCLayerControl.MyKeyDown; begin FKeyPressed := True; end; diff --git a/forms/frm_Main.dfm b/forms/frm_Main.dfm index 4cf8880..10c6b9d 100644 --- a/forms/frm_Main.dfm +++ b/forms/frm_Main.dfm @@ -314,6 +314,10 @@ object frmMain: TfrmMain object tsThickness: TRzTabSheet Color = 15987699 Caption = 'Thickness' + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 object chThickness: TChart AlignWithMargins = True Left = 3 @@ -350,6 +354,10 @@ object frmMain: TfrmMain object tsRoughness: TRzTabSheet Color = 15987699 Caption = 'Roughness' + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 object chRoughness: TChart AlignWithMargins = True Left = 3 @@ -383,6 +391,10 @@ object frmMain: TfrmMain object tsDensity: TRzTabSheet Color = 15987699 Caption = 'Density' + ExplicitLeft = 0 + ExplicitTop = 0 + ExplicitWidth = 0 + ExplicitHeight = 0 object chDensity: TChart AlignWithMargins = True Left = 3 diff --git a/math/unit_materials.pas b/math/unit_materials.pas index 8267616..b71f0d5 100644 --- a/math/unit_materials.pas +++ b/math/unit_materials.pas @@ -244,9 +244,9 @@ procedure TLayeredModel.LoadFromFile(const FileName: string); sdata, srow: TStrings; i:integer; begin + sdata:=TStringList.Create; + srow:=TStringList.Create; try - sdata:=TStringList.Create; - srow:=TStringList.Create; srow.Delimiter := ';'; srow.StrictDelimiter:= true; sdata.LoadFromFile(FileName, TEncoding.UTF8);