-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnitDM_OOB.pas
More file actions
1750 lines (1691 loc) · 53.4 KB
/
UnitDM_OOB.pas
File metadata and controls
1750 lines (1691 loc) · 53.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit UnitDM_OOB;
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
{$H+}
interface
uses
{$IFnDEF FPC}
Windows,
{$ELSE}
LCLIntf, LCLType, LMessages,
{$ENDIF}
Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
extctrls, comctrls,
NuclideClassesMin, ChainClassesMin, EuLibMin, DM_OOD, ObjectsMin;
type
T_DataModuleOOB = class(TObject)
procedure CreateDataCollections(Sender: TObject); // was DataModuleCreate(Sender: TObject);
procedure DataModuleDestroy(Sender: TObject);
private
{ Private declarations }
fVStorage: TVStorage;
fVStream: TVStream;
fLoadInProgress: Boolean;
fDataBaseFileName: string;
fVStates: TVStateColl;
fVElements: TVElementColl;
fVDecays: TVDecayColl;
fVAbundances: TVAbundanceColl;
fVSigmaFs: TVSigmaFColl;
fVSigmaThresholds: TVSigmaThresholdColl;
fVRIFs: TVRIFColl;
fVSigmaCs: TVSigmaCColl;
fVRIs: TVRIColl;
fVYieldTs: TVYieldTColl;
fVYieldFs: TVYieldFColl;
fVAlphas: TVAlphaColl;
fVGammas: TVGammaColl;
fVElectrons: TVElectronColl;
fVBetas: TVBetaColl;
fVPositrons: TVPositronColl;
fVSubBranchings: TVSubBranchingColl;
fVFastFissions: TVFastFissionColl;
fVSpecialCaptureCases: TVSpecialCaptureCaseColl;
fOpenDialog: TOpenDialog;
function GetDataBaseName: string;
procedure SetDatabaseName(aDatabaseName: string);
public
PanelDatabaseName: TPanel;
procedure SetDatabaseNameNotLoadDetails(aDatabaseName: string);
property VFastFissions: TVFastFissionColl read fVFastFissions;
property VSubBranchings: TVSubBranchingColl read fVSubBranchings;
property VSpecialCaptureCases: TVSpecialCaptureCaseColl read fVSpecialCaptureCases;
function LoadAll: Boolean;
function LoadStates: integer;
function LoadAbundances: integer;
function LoadSigmaCs: integer;
function LoadRIs: integer;
function LoadSigmaFs: integer;
function LoadSigmaThreshold: integer;
function LoadRIfs: integer;
function LoadElements: integer;
function LoadDecays: integer;
function LoadYieldTs: integer;
function LoadYieldFs: integer;
function LoadAlphas: integer;
function LoadBetas: integer;
function LoadGammas: integer;
function LoadElectrons: integer;
function LoadPositrons: integer;
function LoadSubBranchings: integer;
function LoadFastFissions: integer;
function LoadSpecialCaptureCases: integer;
constructor Create;
function ReadSubBranchingList(const ThZpA_s: integer; var aSubBranchingList: TSubBranchingList): Boolean;
function ReadSpecialCaptureDetail(const aParentThZpA_s, aChildThZpA_s: integer; var aVarSigma, aVarG_factor, aVarRI: double): Boolean;
function ReadSpecialCaptureTotal(const aThZpA_s: integer; var aVarSigma, aVarRI: double): Boolean;
function AfterCreate(const aDataFileName: string): integer;
function ReadChain(var Chain: TChain; const Options: DWORD = 1): Boolean; //1-Basic
function DeleteNuclide(const ThZpAdel: integer): Boolean;
function ReadNuclide(var Nuclide: TNuclide; const Options: DWORD = $0041): Boolean; //1-nloBasic $0040- nloSigmaThreshold
function WriteNuclide(const Nuclide: TNuclide; const Options: DWORD = 3; //3=(nloBasic or nloRI);
const ProgressBar: TProgressBar = nil; const IsDebug: Boolean = False): Boolean;
function ReadNuclideList(var NuclideList: TNuclideList;
ProgressBar: TProgressBar = nil; const WhereStr: String = ''): Boolean;
function ReadElementList(var ElementList: TElementList; ProgressBar: TProgressBar = nil): Boolean;
function ReadCaptureProductStateInfo(const Nuclide: TNuclide; var CountFounded, Max, Min: integer): Boolean;
function ReadDecayModeList(var DecayModes: TStringList): Boolean;
function ReadHasFissionProductList(var HasFissionProductList: TStringList): Boolean;
function ReadFissionProductAmassMin(var FissionProductZnumList, FissionProductAmassMinList: TLongIntList): Boolean;
function GetSymbol(var aStr: string; InitZnum: integer): Boolean;
function LoadFissionProducts(const aThZpA_s: integer; TheFissionProducts: TLongIntList): Boolean;
function LoadSpecialCaptureProducts(const aThZpA_s: integer; TheCaptureProducts: TLongIntList): Boolean;
function GetSigmaFastFissionForThZpA_s(const aThZpA_s: integer): double;
property DatabaseName: string read GetDataBaseName write SetDataBaseName;
property LoadInProgress: Boolean read fLoadInProgress;
// add for SubBranching from Magnolia
function ReadSubBranchingRecordList(var aSubBranchingRecordList: TSubBranchingRecordList): Boolean;
property aOpenDialog: TOpenDialog read fOpenDialog write fOpenDialog;
end;
var
_DataModuleOOB: T_DataModuleOOB;
implementation
{ T_DataModuleOOB }
function T_DataModuleOOB.AfterCreate(const aDataFileName: string): integer;
begin
try
if FileExists(aDataFileName) then begin
DatabaseName:= aDataFileName;
Result:= fVStates.Count;
end;
except
Result:= -1;
end;
PanelDatabaseName:= nil;
end;
function T_DataModuleOOB.GetDataBaseName: string;
begin
Result:= fDataBaseFileName;
end;
procedure T_DataModuleOOB.SetDatabaseNameNotLoadDetails(aDatabaseName: string);
begin
if (fDataBaseFileName <> aDatabaseName) then
if FileExists(aDatabaseName) then
begin
if fVStorage <> nil then
if fVStorage.Count > 0 then // or problems in Free
fVStorage.Free; // Frees Stream itself
fVStream:= TVStream.Create;
fVStream.OpenFile(aDatabaseName, fmOpenExclusive);
fVStorage:= TVStorage.Create(fVStream);
fDataBaseFileName:= aDatabaseName;
fVStream.CloseFile;
if fVStates = nil then
fVStates:= TVStateColl.Create;
if fVElements = nil then
fVElements:= TVElementColl.Create;
LoadStates;
LoadElements;
Application.ProcessMessages;
end
else if fOpenDialog.Execute then
begin
SetDataBaseName(fOpenDialog.FileName);
LoadStates;
end;
if (PanelDatabaseName <> nil) then
with PanelDatabaseName do
begin
Caption:= fDataBaseFileName;
end;
end;
procedure T_DataModuleOOB.SetDatabaseName(aDatabaseName: string);
begin
if (fDataBaseFileName <> aDatabaseName) then
if FileExists(aDatabaseName) then
begin
if fVStorage <> nil then
if fVStorage.Count > 0 then // or problems in Free
fVStorage.Free; // Frees Stream itself
fVStream:= TVStream.Create;
fVStream.OpenFile(aDatabaseName, fmOpenExclusive);
fVStorage:= TVStorage.Create(fVStream);
fDataBaseFileName:= aDatabaseName;
fVStream.CloseFile;
// qqqq
// Problem: Bad file loading nills Collections
if fVStates = nil then
fVStates:= TVStateColl.Create;
if fVAbundances = nil then
fVAbundances:= TVAbundanceColl.Create;
if fVElements = nil then
fVElements:= TVElementColl.Create;
if fVDecays = nil then
begin
fVDecays:= TVDecayColl.Create;
fVDecays.Owner:= fVStates;
end;
if fVSigmaFs = nil then
fVSigmaFs:= TVSigmaFColl.Create;
if fVRIFs = nil then
fVRIFs:= TVRIfColl.Create;
if fVSigmaCs = nil then
fVSigmaCs:= TVSigmaCColl.Create;
if fVSigmaThresholds = nil then
fVSigmaThresholds:= TVSigmaThresholdColl.Create;
if fVRIs = nil then
fVRIs:= TVRIColl.Create;
if fVYieldTs = nil then
fVYieldTs:= TVYieldTColl.Create;
if fVYieldFs = nil then
fVYieldFs:= TVYieldFColl.Create;
if fVAlphas = nil then
fVAlphas:= TVAlphaColl.Create;
if fVGammas = nil then
fVGammas:= TVGammaColl.Create;
if fVElectrons = nil then
fVElectrons:= TVElectronColl.Create;
if fVBetas = nil then
fVBetas:= TVBetaColl.Create;
if fVPositrons = nil then
fVPositrons:= TVPositronColl.Create;
if fVSubBranchings = nil then
fVSubBranchings:= TVSubBranchingColl.Create;
if fVFastFissions = nil then
fVFastFissions:= TVFastFissionColl.Create;
if fVSpecialCaptureCases = nil then
fVSpecialCaptureCases:= TVSpecialCaptureCaseColl.Create;
// qqqq end
LoadAll;
Application.ProcessMessages;
end
else if fOpenDialog.Execute then
begin
SetDataBaseName(fOpenDialog.FileName);
LoadAll;
end;
if (PanelDatabaseName <> nil) then
with PanelDatabaseName do
begin
Caption:= fDataBaseFileName;
end;
end;
procedure T_DataModuleOOB.CreateDataCollections(Sender: TObject); // was DataModuleCreate(Sender: TObject);
begin
fDataBaseFileName:= '';
fVStates:= TVStateColl.Create;
fVAbundances:= TVAbundanceColl.Create;
fVElements:= TVElementColl.Create;
fVDecays:= TVDecayColl.Create;
fVDecays.Owner:= fVStates;
fVSigmaFs:= TVSigmaFColl.Create;
fVRIFs:= TVRIfColl.Create;
fVSigmaCs:= TVSigmaCColl.Create;
fVSigmaThresholds:= TVSigmaThresholdColl.Create;
fVRIs:= TVRIColl.Create;
fVYieldTs:= TVYieldTColl.Create;
fVYieldFs:= TVYieldFColl.Create;
fVAlphas:= TVAlphaColl.Create;
fVGammas:= TVGammaColl.Create;
fVElectrons:= TVElectronColl.Create;
fVBetas:= TVBetaColl.Create;
fVPositrons:= TVPositronColl.Create;
fVSubBranchings:= TVSubBranchingColl.Create;
fVFastFissions:= TVFastFissionColl.Create;
fVSpecialCaptureCases:= TVSpecialCaptureCaseColl.Create;
fVStream:= nil;
fVStorage:= nil;
(*
VStream:= nil;
VStorage:= nil;
*)
end;
function T_DataModuleOOB.LoadStates: integer;
begin
Result:= -1;
try
if fVStates <> nil then
with fVStates do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVStateColl, fVStates);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('Number'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadAbundances: integer;
begin
Result:= -1;
try
if fVAbundances <> nil then
with fVAbundances do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVAbundanceColl, fVAbundances);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('Number'); //==IndexBy_ThZpA
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadAlphas: integer;
begin
Result:= -1;
try
if fVAlphas <> nil then
with fVAlphas do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVAlphaColl, fVAlphas);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadBetas: integer;
begin
Result:= -1;
try
if fVBetas <> nil then
with fVBetas do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVBetaColl, fVBetas);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadDecays: integer;
begin
Result:= -1;
try
if fVDecays <> nil then
with fVDecays do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVDecayColl, fVDecays);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadElectrons: integer;
begin
Result:= -1;
try
if fVElectrons <> nil then
with fVElectrons do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVElectronColl, fVElectrons);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadElements: integer;
begin
Result:= -1;
try
if fVElements <> nil then
with fVElements do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVElementColl, fVElements);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('Number'); //==Znum
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadGammas: integer;
begin
Result:= -1;
try
if fVGammas <> nil then
with fVGammas do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVGammaColl, fVGammas);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadPositrons: integer;
begin
Result:= -1;
try
if fVPositrons <> nil then
with fVPositrons do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVPositronColl, fVPositrons);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadRIfs: integer;
begin
Result:= -1;
try
if fVRIFs <> nil then
with fVRIFs do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVRIfColl, fVRIFs);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('Number'); //==IndexBy_ThZpA
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadRIs: integer;
begin
Result:= -1;
try
if fVRIs <> nil then
with fVRIs do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVRIColl, fVRIs);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadSigmaCs: integer;
begin
Result:= -1;
try
if fVSigmaCs <> nil then
with fVSigmaCs do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVSigmaCColl, fVSigmaCs);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadSigmaFs: integer;
begin
Result:= -1;
try
if fVSigmaFs <> nil then
with fVSigmaFs do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVSigmaFColl, fVSigmaFs);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('Number'); //==IndexBy_ThZpA
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadSigmaThreshold: integer;
begin
Result:= -1;
try
if fVSigmaThresholds <> nil then
with fVSigmaThresholds do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVSigmaThresholdColl, fVSigmaThresholds);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('Number'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadSubBranchings: integer;
begin
fLoadInProgress:= True;
Result:= -1;
try
if fVSubBranchings <> nil then
with fVSubBranchings do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVSubBranchingColl, fVSubBranchings);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //==IndexBy_ThZpA_s
end;
except
Result:= -1;
end;
fLoadInProgress:= False;
end;
function T_DataModuleOOB.LoadFastFissions: integer;
begin
Result:= -1;
try
if fVFastFissions <> nil then
with fVFastFissions do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVFastFissionColl, fVFastFissions);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('Number'); //==IndexBy_ThZpA
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadSpecialCaptureCases: integer;
begin
Result:= -1;
try
if fVSpecialCaptureCases <> nil then
with fVSpecialCaptureCases do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVSpecialCaptureCaseColl, fVSpecialCaptureCases);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ParentThZpA_s'); //==IndexBy_ParentThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadYieldFs: integer;
begin
Result:= -1;
try
if fVYieldFs <> nil then
with fVYieldFs do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVYieldFColl, fVYieldFs);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ProductThZpA_s'); //==IndexBy_ProductThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.LoadYieldTs: integer;
begin
Result:= -1;
try
if fVYieldTs <> nil then
with fVYieldTs do
begin
DeactivateAllIndexes;
ClearAndFreeItems;
LoadStorageObject(fDataBaseFileName, rg_TVYieldTColl, fVYieldTs);
Result:= Count;
UpdateIndexes;
ActivateAllIndexes;
CurrIndex:= GetIndexRec('IndexBy_ProductThZpA_s'); //==Index_ByProductThZpA_s
end;
except
Result:= -1;
end;
end;
function T_DataModuleOOB.ReadChain(var Chain: TChain;
const Options: DWORD): Boolean;
begin
MessageDlg('ReadChain TODO_IT', mtInformation, [mbOK], 0);
Result:= True;
end;
function T_DataModuleOOB.DeleteNuclide(const ThZpAdel: integer): Boolean;
begin
MessageDlg('DeleteNuclide wil NOT be implemented in OOB', mtInformation, [mbOK], 0);
Result:= True;
end;
function T_DataModuleOOB.ReadNuclide(var Nuclide: TNuclide;
const Options: DWORD): Boolean;
// NEVER TRYED
var
aThZpA, aThZpA_s, aYieldParentThZpA, InListNo, I, J, K, L: integer;
aNuclide: TNuclide;
aNuclideState: TNuclideState;
aCapture: TCapture;
aRI: TRI;
aDecay: TDecay;
aAlpha: TAlpha;
aBeta: TBeta;
aGamma: TGamma;
aElectron: TElectron;
aPositron: TPositron;
aYield: TYield;
CaptureFound, DiffrentCaptureValuesFound,
DecayFound, DiffrentDecayValuesFound, InSateList: Boolean;
CountFounded, FirstFounded, CountDetail, FirstDetail: integer;
begin
// NEVER TRYED
// MessageDlg('ReadNuclide TODO_IT #3', mtInformation, [mbOK], 0);
if Nuclide <> nil then
begin
try
aThZpA:= 1000 * Nuclide.Znum + Nuclide.Amass;
with fVElements do
CurrIndex:= GetIndexRec('Number');
with fVStates do
CurrIndex:= GetIndexRec('Number');
with fVAbundances do
CurrIndex:= GetIndexRec('Number'); // ThZpA
with fVDecays do
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s'); //IndexBy_ThZpA_s
with fVSigmaFs do
CurrIndex:= GetIndexRec('Number'); //IndexBy_ThZpA_s
with fVRIFs do
CurrIndex:= GetIndexRec('Number'); //IndexBy_ThZpA_s
with fVSigmaThresholds do
CurrIndex:= GetIndexRec('Number'); //IndexBy_ThZpA_s
with fVSigmaCs do
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s');
with fVRIs do
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s');
with fVAlphas do
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s');
with fVBetas do
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s');
with fVGammas do
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s');
with fVElectrons do
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s');
with fVPositrons do
CurrIndex:= GetIndexRec('IndexBy_ThZpA_s');
with fVYieldTs do
CurrIndex:= GetIndexRec('IndexBy_ProductThZpA_s');
with fVYieldFs do
CurrIndex:= GetIndexRec('IndexBy_ProductThZpA_s');
for I:= 0 to fVStates.Count - 1 do
if (TVState(fVStates[I]).ThZpA_s div 10) = (aThZpA) then
begin // Read Nuclide
aNuclide:= TNuclide.Create(aThZpA);
with aNuclide do
begin
if fVElements.SearchNumberObj(aThZpA div 1000) <> nil then
Symbol:= TVElement(fVElements.SearchNumberObj(aThZpA div 1000)).Symbol
else
Symbol:= NuclideClassesMin.Symbols[aThZpA div 1000];
if fVAbundances.SearchNumberObj(aThZpA) <> nil then
Abundance:= TVAbundance(fVAbundances.SearchNumberObj(aThZpA)).Abundance
else
Abundance:= 0;
NuclideTag:= 0; // No details
Application.ProcessMessages;
with fVStates do
begin
CountFounded:= SelectRange_Integer(CurrIndex, aThZpA * 10, aThZpA * 10 + 2, FirstFounded);
for J:= FirstFounded to FirstFounded + CountFounded - 1 do
begin
aNuclideState:= TNuclideState.Create(aNuclide);
with aNuclideState, TVState(fVStates[J]) do
begin
aThZpA_s:= TVState(fVStates[J]).ThZpA_s;
aNuclideState.State:= aThZpA_s mod 10;
aNuclideState.T1_2:= TVState(fVStates[J]).T1_2;
aNuclideState.SigmaF:= 0;
aNuclideState.RIF:= 0;
// aNuclideState.g_factor:= 1; // CapturesAdded
aNuclideState.SigmaNP:= 0;
aNuclideState.SigmaNA:= 0;
aNuclideState.SigmaN2N:= 0;
aNuclideState.SigmaNN:= 0;
aNuclideState.SigmaNG:= 0;
with fVSigmaFs do
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
if CountDetail > 0 then
aNuclideState.SigmaF:= TVSigmaF(fVSigmaFs[FirstDetail]).Sigma;
with fVRIFs do
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
if CountDetail > 0 then
aNuclideState.RIF:= TVRIF(fVRIFs[FirstDetail]).RI;
with fVSigmaThresholds do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
if CountDetail > 0 then
begin
if TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaNP > 0 then
aNuclideState.SigmaNP:= TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaNP;
if TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaNA > 0 then
aNuclideState.SigmaNA:= TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaNA;
if TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaN2N > 0 then
aNuclideState.SigmaN2N:= TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaN2N;
if TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaNG > 0 then
aNuclideState.SigmaNG:= TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaNG;
if TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaNN > 0 then
aNuclideState.SigmaNN:= TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).SigmaNN;
if TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).g_factor > 0 then // CapturesAdded
aNuclideState.Captures.g_factor:= TVSigmaThreshold(fVSigmaThresholds[FirstDetail]).g_factor;
end
end;
// Captures
with fVSigmaCs do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
if CountDetail > 0 then // CapturesAdded
aNuclideState.Captures.G_factor:= TVSigmaC(fVSigmaCs[FirstDetail]).g_factor
else
aNuclideState.Captures.G_factor:= -1;
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
if ((TVSigmaC(fVSigmaCs[K]).ProductState >= 0) and
(TVSigmaC(fVSigmaCs[K]).ProductState <= 2)) then
begin
aCapture.ToState:= TVSigmaC(fVSigmaCs[K]).ProductState;
if ((TVSigmaC(fVSigmaCs[K]).Sigma > 0)) then
aCapture.Sigma:= TVSigmaC(fVSigmaCs[K]).Sigma
else
aCapture.Sigma:= 0;
aNuclideState.Captures.Add(aCapture);
end;
end;
// RIs
with fVRIs do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
if ((TVRI(fVRIs[K]).ProductState >= 0) and
(TVRI(fVRIs[K]).ProductState <= 2)) then
begin
aRI.ToState:= TVRI(fVRIs[K]).ProductState;
if ((TVRI(fVRIs[K]).RI > 0)) then
aRI.Value:= TVRI(fVRIs[K]).RI
else
aRI.Value:= 0;
aNuclideState.RIs.Add(aRI);
end;
end;
end;
// Decays
with fVDecays do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
if (TVDecay(fVDecays[K]).DecayType <> dtNone) then
begin
aDecay.DecayType:= TVDecay(fVDecays[K]).DecayType;
if (TVDecay(fVDecays[K]).Branching > 0) then
aDecay.Branching:= TVDecay(fVDecays[K]).Branching
else
aDecay.Branching:= 0;
aNuclideState.Decays.Add(aDecay);
end;
end;
end;
// Alpas
with fVAlphas do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
aAlpha.MeV:= TVAlpha(fVAlphas[K]).MeV;
aAlpha.Probability:= TVAlpha(fVAlphas[K]).Probability;
aNuclideState.Alphas.Add(aAlpha);
end;
end;
// Betas
with fVBetas do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
aBeta.MeV:= TVBeta(fVBetas[K]).MeV;
aBeta.MaxMeV:= TVBeta(fVBetas[K]).MaxMeV;
aBeta.Probability:= TVBeta(fVBetas[K]).Probability;
aNuclideState.Betas.Add(aBeta);
end;
end;
// Gammas
with fVGammas do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
aGamma.MeV:= TVGamma(fVGammas[K]).MeV;
aGamma.Probability:= TVGamma(fVGammas[K]).Probability;
aNuclideState.Gammas.Add(aGamma);
end;
end;
// Electrons
with fVElectrons do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
aElectron.MeV:= TVElectron(fVElectrons[K]).MeV;
aElectron.Probability:= TVElectron(fVElectrons[K]).Probability;
aNuclideState.Electrons.Add(aElectron);
end;
end;
// Positrons
with fVPositrons do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
aPositron.MeV:= TVPositron(fVPositrons[K]).MeV;
aPositron.MaxMeV:= TVPositron(fVPositrons[K]).MaxMeV;
aPositron.Probability:= TVPositron(fVPositrons[K]).Probability;
aNuclideState.Positrons.Add(aPositron);
end;
end;
// YieldT
with fVYieldTs do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
aYield.ParentThZpA:= TVYield(fVYieldTs[K]).ThZpA_s div 10;
aYield.CumYieldT:= TVYield(fVYieldTs[K]).CumYield;
aYield.IndYieldT:= TVYield(fVYieldTs[K]).IndYield;
aYield.CumYieldF:= 0;
aYield.IndYieldF:= 0;
aNuclideState.Yields.Add(aYield);
end;
end;
// YieldF
with fVYieldFs do
begin
CountDetail:= SelectRange_Integer(CurrIndex, aThZpA_s, aThZpA_s, FirstDetail);
for K:= FirstDetail to FirstDetail + CountDetail - 1 do
begin
aYieldParentThZpA:= TVYield(fVYieldFs[K]).ThZpA_s div 10;
InListNo:= -1;
for L:= 0 to aNuclideState.Yields.Count - 1 do
if aNuclideState.Yields[L].ParentThZpA = aYieldParentThZpA then
begin
InListNo:= L;
break;
end;
if InListNo >= 0 then
with Yields[InListNo] do
begin
aYield:= aNuclideState.Yields[InListNo];
aYield.CumYieldF:= TVYield(fVYieldFs[K]).CumYield;
aYield.IndYieldF:= TVYield(fVYieldFs[K]).IndYield;
aNuclideState.Yields[InListNo]:= aYield;
end
else
begin
aYield.ParentThZpA:= aYieldParentThZpA;
aYield.CumYieldT:= 0;
aYield.IndYieldT:= 0;
aYield.CumYieldF:= TVYield(fVYieldFs[K]).CumYield;
aYield.IndYieldF:= TVYield(fVYieldFs[K]).IndYield;
aNuclideState.Yields.Add(aYield);
end;
end;
end;
end;
aNuclide.NuclideTag:= nloBasic or nloRI or
nloGamma or nloBeta or nloAlpha or nloElectron or nloPositron or nloYield;
aNuclide.StateList.Add(aNuclideState);
end;
end;
end;
end;
Nuclide.Assign(aNuclide);
end;
Result:= True;
except
Result:= False;
end;
end;
end;
function T_DataModuleOOB.WriteNuclide(const Nuclide: TNuclide;
const Options: DWORD; const ProgressBar: TProgressBar;
const IsDebug: Boolean): Boolean;
begin
MessageDlg('WriteNuclide wil NOT be implemented in OOB', mtInformation, [mbOK], 0);
Result:= True;
end;
function T_DataModuleOOB.ReadNuclideList(var NuclideList: TNuclideList;
ProgressBar: TProgressBar; const WhereStr: String): Boolean;
var
aThZpA, aThZpA_s, aYieldParentThZpA, InListNo, I, J, K, L: integer;
aNuclide: TNuclide;
aNuclideState: TNuclideState;
aCapture: TCapture;
aRI: TRI;
aDecay: TDecay;
aAlpha: TAlpha;
aBeta: TBeta;
aGamma: TGamma;
aElectron: TElectron;
aPositron: TPositron;
aYield: TYield;
CaptureFound, DiffrentCaptureValuesFound,
DecayFound, DiffrentDecayValuesFound, InSateList: Boolean;
CountFounded, FirstFounded, CountDetail, FirstDetail: integer;
begin
if (PanelDatabaseName <> nil) then
PanelDatabaseName.Caption:= DatabaseName;
if ProgressBar <> nil then
ProgressBar.Position:= ProgressBar.Min;
for I:= 0 to NuclideList.Count - 1 do
NuclideList[I].Free;
NuclideList.Clear;
try
with fVElements do
begin
CurrIndex:= GetIndexRec('Number');