-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathchmocmod.f90
11523 lines (11462 loc) · 380 KB
/
chmocmod.f90
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
! Copyright 2021, Christian Hafner
!
! This file is part of OpenMaXwell.
!
! OpenMaXwell is free software: you can redistribute it and/or modify
! it under the terms of the GNU General Public License as published by
! the Free Software Foundation, either version 3 of the License, or
! (at your option) any later version.
! OpenMaXwell is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
! You should have received a copy of the GNU General Public License
! along with OpenMaXwell. If not, see <http://www.gnu.org/licenses/>.
MODULE CHMOC
! movie commands
USE CHPRT
SAVE
Character(20), Parameter :: CHDirIdent=' CHDIR Version 2.0 '
Real(8) spa(3,0:3),rMovCPU0,rMovCPU1,rMovELA0,rMovELA1
Integer(4), Parameter :: mMovCommand=10000,lsMovCommand=128,lsMovCommands=32000
Integer(4) nMovPic,nMovCommand,kMovCommand,kMovCommand1,nMovSeq,lArgument,lsMovComm,lsMovComms,kFunRow,kFunCol,iMoveTim(8)
Integer(4) iMovLab(-1000:1000)
Logical(1) loopStart(1000)
Logical(4) lRestart
Character*10 charMoveTim(3)
Character(256) DirFileName
Character(32000) Mov_Command,Mov_Command1,Mov_Command2(5),Argument
Character(32000) Mov_Commands
CONTAINS
! I/O
Subroutine SaveDirectives(lCheck)
! save movie directives in a file
Implicit none
Include 'RESOURCE.FD'
Integer(4) iOk,ios,idum,k
Logical lEx
Logical, intent(in) :: lCheck
if(.not.lCheck) then
call Open2write(-1,'Select directive file to be written!','Directive file ',DirFileName,'DIR',ios)
if(ios.gt.0) return
end if
open(1,file=DirFileName,iostat=ios)
if(ios.ne.0) then
idum=MessageBoxQQ('Error opening file!\rCannot save data!'C,'Save directives'C, &
MB$OK.or.MB$IconExclamation)
close(1)
return
end if
call WriteStr(1,CHDirIdent,iOK)
ios=GetDlgItemText(outputdlg%hwnd,IDC_OUT_TEXT4,Mov_Commands,lsMovCommands)
k=kMovCommand
do kMovCommand=1,nMovCommand
call GetStrInStr(Mov_Commands,lsMovCommands-1,kMovCommand,Mov_Command,lsMovComm)
if(lsMovComm.lt.1) cycle
call WriteStr(1,Mov_Command,iOK)
call ToLower(Mov_Command,lsMovComm)
lEx=.false.
if(lsMovComm.gt.2) then
if(Mov_Command(1:3).eq.'exi') then
lEx=.true.
end if
end if
end do
kMovCommand=k
if(.not.lEx) then
sch(1:4)='exit' ! append exit statement
call chwrit2(1,ich,0,rch,0,sch,4,iOK)
end if
sch(1:3)=' ' ! append a blank line, maybe reduces risk of closing before everything is written
call chwrit2(1,ich,0,rch,0,sch,3,iOK)
EndFile(1)
close(1)
end Subroutine SaveDirectives
Subroutine OpenDirectives(lCheck)
! read movie directives from a file
Implicit none
Include 'RESOURCE.FD'
Integer(4) iOk,ios,idum,iVers,lText,lsMovComm
Logical, intent(in) :: lCheck
Logical lFileExist,ldum
Character(20) text
if(.not.lCheck) then
call Open2read(-1,'Select directive file to be read!','Directive file ',DirFileName,'DIR',ios)
if(ios.gt.0) return
end if
inquire(file=DirFileName,Exist=lFileExist)
if(.not.lFileExist) return
open(1,file=DirFileName,status='old',iostat=ios)
if(ios.ne.0) then
if(.not.lCheck) idum=MessageBoxQQ('Error opening file!\rCannot read data!'C,'Open directives'C, &
MB$OK.or.MB$IconExclamation)
close(1)
return
end if
call ReadStr(1,text,iOK)
call StrToInt(text(16:16)//text(18:18),iVers,iOK)
if(CHDirIdent(1:15).ne.text(1:15)) then
idum=MessageBoxQQ('Wrong file Type!\rContinue reading?'C,'Open directives'C, &
MB$YesNo.or.MB$IconQuestion)
if(idum.eq.MB$IDNO) then
close(1)
return
end if
end if
if(iVers.lt.20) then ! old version with 2 nested loops
call chread2(1,ich,2,rch,0,iOK)
if(iOK.ne.0) then
idum=MessageBoxQQ('Error reading input file!\r(first line)'C,'Open directives'C, &
MB$OK.or.MB$ICONSTOP)
close(1)
return
end if
nMovSeq=ich(1)
nMovPic=ich(2)
else
nMovSeq=0
nMovPic=0
end if
lsMovComm=0
lsMovComms=0
ios=0
do kMovCommand=1,mMovCommand
call ReadStr(1,Mov_Command,iOK)
if(iOK.ne.0) then
if(iVers.lt.20) then
write(text,'(I3)') kMovCommand
idum=MessageBoxQQ('Error reading input file!\rDirective string '//text(1:3)//' corrupt!'C,'Open directives'C, &
MB$OK.or.MB$ICONSTOP)
else
write(*,*) 'Number of directive lines=',kMovCommand-1
end if
Exit
end if
call DelLeadingBlanks(Mov_Command,lsMovCommand)
if(lsMovCommand.lt.1) Cycle ! ignore blank command
call ToLower(Mov_Command,lsMovCommand)
lsMovComm=lsMovCommand
if(Mov_Command(1:3).eq.'end') then ! replace end statements of older version by loop statements
ios=ios+1
lsMovComm=5
Mov_Command(1:5)='! end' ! no end statements anymore!
if(iVers.lt.20) then ! older version
Mov_Command(1:5)='! end'
Select Case(ios)
Case(1) ! first end -> outer loop start: label / variable / start value
if(nMovSeq.gt.1) then
Mov_Command(1:15)='loop 999 999 1 '
write(text,*) nMovSeq
lText=0
call DelLeadingBlanks(text,lText)
lsMovComm=15+lText
Mov_Command(16:lsMovComm)=text(1:lText)
end if
Case(2) ! second end -> inner loop start
if(nMovPic.gt.1) then
Mov_Command(1:15)='loop 998 998 1 '
write(text,*) nMovPic
lText=0
call DelLeadingBlanks(text,lText)
lsMovComm=15+lText
Mov_Command(16:lsMovComm)=text(1:lText)
end if
Case(3) ! third end -> inner loop end
if(nMovPic.gt.1) then
Mov_Command(1:9)='loop -998'
lsMovComm=9
end if
Case(4) ! fourth end -> outer loop end
if(nMovSeq.gt.1) then
Mov_Command(1:9)='loop -999'
lsMovComm=9
end if
end Select
end if
Mov_Command(lsMovComm+1:lsMovComm+1)=Char(0)
end if
call AppendStr(Mov_Commands,lsMovCommands-1,lsMovComms,Mov_Command(1:lsMovComm)//Char(0))
if(ios.gt.4) exit
end do
close(1)
idum=nStrInStr(Mov_Commands,lsMovCommands-1)
nMovCommand=min(mMovCommand,idum)
kMovCommand=min(kMovCommand,nMovCommand)
ldum=EnableDlgItem(outputdlg%hwnd,IDC_OUT_TEXT4,.false.)
! idum=SetDlgItemText(outputdlg%hwnd,IDC_OUT_TEXT4,Mov_Commands//Char(0)) ! caused problems!
ldum=DlgSet(outputdlg,IDC_OUT_TEXT4,Mov_Commands//Char(0))
ldum=EnableDlgItem(outputdlg%hwnd,IDC_OUT_TEXT4,.true.)
lRestart=.true.
end Subroutine OpenDirectives
Subroutine SaveProAll(lCheck)
Implicit none
Include 'RESOURCE.FD'
Logical(4), intent(in) :: lCheck
Logical lOpened
Integer(4) idum
call SaveProject(lCheck,lOpened)
if(.not.lOpened) return
if(.not.lCheck) then
idum=MessageBoxQQ('Save associated files?'C,'Save project'C, &
MB$YesNo.or.MB$IconQuestion)
if(idum.eq.MB$IDNO) return
end if
call Cursor(.true.,IDC_WAIT)
call setNameExt(ProFileName,'WIN',WinFileName)
call SaveWindow(.true.)
call setNameExt(ProFileName,'OGL',OGLFileName)
call SaveCHGLWindow(.true.)
call setNameExt(ProFileName,'FUN',FunFileName)
lAskFun=.false.
lSkipFun=.false.
lSkipFunHead=.false.
iSaveFunction=0
call SaveFunction(.true.,.false.)
call setNameExt(ProFileName,'INT',IntFileName)
call SaveIntegral(.true.)
call setNameExt(ProFileName,'FLD',FldFileName)
lDiffField=.false.
lDiffRel=.false.
lAskFld=.false.
lSkipFld=.true.
lSkipDerFld=.true.
lSkipFldHead=.false.
if(.not.lCheck) then
idum=MessageBoxQQ('Save complex field values?'C,'Save project'C, &
MB$YesNo.or.MB$IconQuestion)
if(idum.eq.MB$IDYES) then
lSkipFld=.false.
end if
end if
call SaveField(.true.)
call setNameExt(ProFileName,'FLF',FlfFileName)
call SaveFField(.true.)
call setNameExt(ProFileName,'PFD',PFDFileName)
call SavePFD(.true.)
call setNameExt(ProFileName,'GRF',GrfFileName)
call SaveFGrid(.true.)
call setNameExt(ProFileName,'GRT',GrtFileName)
call SaveTGrid(.true.)
call setNameExt(ProFileName,'DOM',DomFileName)
call SaveDomain(.true.)
lAskBnd=.false.
lInsertBnd=.false.
call setNameExt(ProFileName,'BND',BndFileName)
call SaveBoundary(.true.)
lAskExp=.false.
lInsertExp=.false.
call setNameExt(ProFileName,'EXP',ExpFileName)
call SaveExpansion(.true.)
lAskObj=.false.
lInsertObj=.false.
call setNameExt(ProFileName,'3DO',ObjFileName)
call SaveObject(.true.)
lMMPrMtr=.false.
lMMPtMtr=.false.
call setNameExt(ProFileName,'MMP',MmpFileName)
call SaveMmp(.true.)
call setNameExt(ProFileName,'BAS',PETFileName)
call SaveBasis(.true.)
call setNameExt(ProFileName,'DIR',DirFileName)
idum=GetDlgItemText(outputdlg%hwnd,IDC_OUT_TEXT4,Mov_Commands,lsMovCommands)
call SaveDirectives(.true.)
call SaveProject(.true.,lOpened)
call Cursor(.false.,IDC_WAIT)
end Subroutine SaveProAll
Subroutine OpenProAll(lCheck)
Implicit none
Logical(4), intent(in) :: lCheck
Logical(4) lOpened
Integer(4) iWarn
call Cursor(.true.,IDC_WAIT)
lFLDset0=.true.
write(*,*) 'OpenProAll, lCheck=',lCheck
call openProject(lCheck,lOpened)
if(lOpened) then
call setNameExt(ProFileName,'WIN',WinFileName)
call openWindow(.true.)
call setNameExt(ProFileName,'PAL',PalFileName)
call openPalette(.true.)
call setNameExt(ProFileName,'OGL',OGLFileName)
call openCHGLWindow(.true.)
call setNameExt(ProFileName,'FUN',FunFileName)
lAskFun=.false.
lSkipFun=.false.
lSkipFunHead=.false.
iFunRow=0
iFunKol=0
nFunRow=0
nFunKol=0
iWarn=0
call openFunction(.true.,iWarn)
if(iWarn.ne.0) call openFunction(.true.,iWarn)
call setNameExt(ProFileName,'INT',IntFileName)
call openIntegral(.true.)
call setNameExt(ProFileName,'FLF',FlfFileName)
call openFField(.true.)
call setNameExt(ProFileName,'FLT',FltFileName)
call setNameExt(ProFileName,'PFD',PFDFileName)
call openPFD(.true.)
call setNameExt(ProFileName,'GRF',GrfFileName)
call openFGrid(.true.)
call setNameExt(ProFileName,'GRT',GrtFileName)
call openTGrid(.true.)
call setNameExt(ProFileName,'DOM',DomFileName)
call openDomain(.true.)
lAskBnd=.false.
lInsertBnd=.false.
call setNameExt(ProFileName,'BND',BndFileName)
call openBoundary(.true.)
lAskExp=.false.
lInsertExp=.false.
call setNameExt(ProFileName,'EXP',ExpFileName)
call openExpansion(.true.)
lAskObj=.false.
lInsertObj=.false.
call setNameExt(ProFileName,'3DO',ObjFileName)
call openObject(.true.)
call setNameExt(ProFileName,'MMP',MmpFileName)
lMMPrMtr=.true.
lMMPtMtr=.true.
call openMmp(.true.)
call setNameExt(ProFileName,'FLD',FldFileName)
lDiffField=.false.
lDiffRel=.false.
lAskFld=.false.
lSkipFld=.false.
lSkipDerFld=.false.
lSkipVecFld=.false.
lSkipScaFld=.false.
lSkipFldHead=.false.
call openField(.true.)
call setNameExt(ProFileName,'BAS',PETFileName)
call openBasis(.true.)
call setNameExt(ProFileName,'DIR',DirFileName)
call openDirectives(.true.)
call openProject(.true.,lOpened)
if(.not.lFLDset0) call GetrField(.false.)
lFLDset0=.false.
kPET=0
end if
call Cursor(.false.,IDC_WAIT)
end Subroutine OpenProAll
! movie commands / directives
Subroutine MovieCommand(lPerform,kComL,iErr,kMoCo)
Implicit none
Real(8) rCond1,rCond2
Integer(4), Optional:: kMoCo
Integer(4) kMoCo1,kComL,lCommand,lCommObj,iErr,i,i1,idum,lCond1,lCond,lCond2,iErr2
Logical ldum
Logical, intent(in) :: lPerform
Character(32) Command,CommObj,Cond1,Cond,Cond2
if(Present(kMoCo)) then
kMoCo1=kMovCommand
kMovCommand=kMoCo
kMoCo=kMoCo1
end if
lDrawOGL=.false.
lSaveOGLavi=.false.
lSaveOGLbmp=.false.
iWinAction=0_2
ldum=ModifyMenuFlagsQQ(3,1,$MenuUnChecked) !boundary
ldum=ModifyMenuFlagsQQ(3,2,$MenuUnChecked) !expansion
ldum=ModifyMenuFlagsQQ(3,3,$MenuUnChecked) !field
ldum=ModifyMenuFlagsQQ(3,4,$MenuUnChecked) !function
ldum=ModifyMenuFlagsQQ(3,5,$MenuUnChecked) !object
ldum=ModifyMenuFlagsQQ(3,6,$MenuChecked) !nothing
iErr=9
if((kMovCommand.ge.1).and.(kMovCommand.le.nMovCommand)) then
call GetStrInStr(Mov_Commands,lsMovCommands-1,kMovCommand,Mov_Command,lsMovComm)
if(l4.and.l7) write(*,*) ' Command:',Mov_Command(1:lsMovComm)
end if
iErr=0
if((Mov_Command(1:1).eq.'!').or.(lsMovComm.lt.1)) return
if(Present(kMoCo)) then
if(Mov_Command(1:1).eq.'%') then
idum=lsMovComm+1
do i=2,lsMovComm
if(Mov_Command(i:i).ne.' ') then
idum=i
Exit
end if
end do
if(idum.gt.lsMovComm) return
i1=0
do i=idum,lsMovComm
i1=i1+1
Mov_Command(i1:i1)=Mov_Command(i:i)
end do
lsMovComm=lsMovComm-idum+1
i1=lsMovComm+1
Mov_Command(i1:i1)=Char(0)
else
iErr=1952
return
end if
else
if(Mov_Command(1:1).eq.'%') return
end if
Command=' 'C
CommObj=' 'C
Argument=' 'C
if(Mov_Command(1:1).eq.'?') then ! conditioned execution
call ExtractStr(Mov_Command,-1,Cond1,lCond1)
if(lCond1.lt.1) return
call ExtractStr(Mov_Command,-2,Cond,lCond)
if((lCond.gt.2).or.(lCond.lt.1)) return
if((Cond(1:1).ne.'>').and.(Cond(1:1).ne.'<').and.(Cond(1:1).ne.'=')) return
if(lCond.gt.1) then
if(Cond(2:2).ne.'=') return
end if
call ExtractStr(Mov_Command,-3,Cond2,lCond2)
if(lCond2.lt.1) then
lCond2=1
Cond2='0'
end if
call StrToRV(Cond1(1:lCond1),rCond1,iErr2)
if(iErr2.ne.0) then
call GetRch(Cond1,-1_4,idum,iErr2)
if((iErr2.ne.0).or.(idum.lt.1)) return
rCond1=rch(1)
end if
call StrToRV(Cond2(1:lCond2),rCond2,iErr2)
if(iErr2.ne.0) then
call GetRch(Cond2,-1_4,idum,iErr2)
if((iErr2.ne.0).or.(idum.lt.1)) return
rCond2=rch(1)
end if
select case(Cond(1:1))
case('<')
if(lCond.gt.1) then
if(rCond1.gt.rCond2) return
else
if(rCond1.ge.rCond2) return
end if
case('>')
if(lCond.gt.1) then
if(rCond1.lt.rCond2) return
else
if(rCond1.le.rCond2) return
end if
case('=')
if(rCond1.ne.rCond2) return
case default
return
end select
end if
call ExtractStr(Mov_Command,1,Command,lCommand)
iErr=1
if(lCommand.lt.3) return
iErr=0
if(Command(1:3).eq.'end') return
call ExtractStr(Mov_Command,2,CommObj,lCommObj)
if(Command(1:3).eq.'exi') then
if(lPerform) then
if(lCommObj.gt.0) then
if(CommObj(1:1).eq.'?') then
call ExtractTxt(Mov_Command,1,Argument,lArgument)
if(lArgument.lt.1) call ExtractStr(Mov_Command,3,Argument,lArgument)
if(lArgument.lt.1) then
idum=MessageBoxQQ('Exit movie processing?'C,'Movie command EXIt'C, &
MB$YesNo.or.MB$IconQuestion)
else
idum=MessageBoxQQ('Exit '//Argument(1:lArgument)//char(0),'Movie command EXIt'C, &
MB$YesNo.or.MB$IconQuestion)
end if
if(idum.eq.MB$IDYES) then
idum=SetExitQQ(QWin$ExitNoPersist)
iErr=99
end if
else
idum=SetExitQQ(QWin$ExitNoPersist)
iErr=99
end if
else
idum=SetExitQQ(QWin$ExitNoPersist)
iErr=99
end if
end if
return
end if
iErr=2
if(lCommObj.lt.1) return
if(lCommObj.lt.3) then ! labels instead of objects might have shorter lengths: insert leading zeros
if(lCommObj.eq.2) then
CommObj(3:3)=CommObj(2:2)
CommObj(2:2)=CommObj(1:1)
CommObj(1:1)='0'
else
CommObj(3:3)=CommObj(1:1)
CommObj(1:2)='00'
end if
end if
call ExtractStr(Mov_Command,3,Argument,lArgument)
iErr=0
if(l4.and.l7) write(*,*) ' Execute:',Command(1:3),' ',CommObj(1:3)
Select Case(Command(1:3))
Case('ada')
call MovAda(CommObj,lPerform,iErr)
Case('add')
call MovAdd(CommObj,lPerform,iErr)
Case('blo')
call MovBlo(CommObj,lPerform,iErr)
Case('cle')
call MovCle(CommObj,lPerform,iErr)
Case('con')
call MovCon(CommObj,lPerform,iErr)
Case('cop')
call MovCop(CommObj,lPerform,iErr)
Case('del')
call MovDel(CommObj,lPerform,iErr)
Case('dra')
call MovDra(CommObj,lPerform,iErr)
Case('exc')
call MovExc(CommObj,lPerform,iErr)
Case('gen')
call MovGen(CommObj,lPerform,iErr)
Case('get')
call MovGet(CommObj,lPerform,iErr)
Case('got')
call MovGot(lPerform,kComL,iErr)
Case('if=')
call MovIfE(lPerform,kComL,iErr)
Case('if>')
call MovIfG(lPerform,kComL,iErr)
Case('if<')
call MovIfS(lPerform,kComL,iErr)
Case('inc')
call MovInc(CommObj,lPerform,iErr)
Case('ite')
call MovIte(CommObj,lPerform,iErr)
Case('loo')
call MovLoo(lPerform,kComL,iErr)
Case('lab')
call MovLab(iErr)
Case('mmp')
call MovMmp(CommObj,lPerform,iErr)
Case('mov')
call MovMov(CommObj,lPerform,iErr)
Case('mul')
call MovMul(CommObj,lPerform,iErr)
Case('pro')
call MovPro(CommObj,lPerform,iErr)
Case('rea')
call MovRea(CommObj,lPerform,iErr)
Case('ref')
call MovRef(CommObj,lPerform,iErr)
Case('ren')
call MovRen(CommObj,lPerform,iErr)
Case('rot')
call MovRot(CommObj,lPerform,iErr)
Case('run')
call MovRun(CommObj,lPerform,iErr)
Case('set')
call MovSet(CommObj,lPerform,iErr)
Case('sor')
call MovSor(CommObj,lPerform,iErr)
Case('sub')
call MovSub(CommObj,lPerform,iErr)
Case('wri')
call MovWri(CommObj,lPerform,iErr)
Case Default
iErr=-9
if(l4.and.l7) write(*,*) ' Command execution error: Unknown command: ',Command(1:3)
return
end Select
if(l4.and.l5.and.(iErr.ne.0)) then
if(iErr.eq.-9) then
write(*,*) ' Command execution error: Unknown command object: ',CommObj(1:3)
else
write(*,*) ' Command execution error flag:',iErr
end if
end if
! iErr=0
end Subroutine MovieCommand
Subroutine MovAda(CommObj,lPerform,iErr)
Implicit none
Integer(4) iErr,iErr2,ir
Real(8) r
Logical lPerform
Character(32) CommObj
Select Case(CommObj(1:3))
Case('exp')
if(lArgument.lt.1) return
call ExtractStr(Mov_Command,3,Argument,lArgument)
if((lArgument.lt.3).or.(.not.lPerform)) return
call ExtractIV(Mov_Command,4,ir,iErr2)
if(iErr2.eq.0) iModExpMin=ir
call ExtractIV(Mov_Command,5,ir,iErr2)
if(iErr2.eq.0) iModExpMax=ir
call ExtractIV(Mov_Command,6,ir,iErr2)
if(iErr2.eq.0) iModExpWFA=ir
call ExtractIV(Mov_Command,7,ir,iErr2)
if(iErr2.eq.0) iModExpWFE=ir
call ExtractRV(Mov_Command,8,r,iErr2)
if(iErr2.eq.0) fModExpFac=r
call ExtractIV(Mov_Command,9,ir,iErr2)
if(iErr2.eq.0) iModExpLoop=ir
call ExtractIV(Mov_Command,10,ir,iErr2)
if(iErr2.eq.0) iModExpBnd=ir
call ExtractIV(Mov_Command,11,ir,iErr2)
if(iErr2.eq.0) iModExpDom=ir
call ExtractIV(Mov_Command,12,ir,iErr2)
if(iErr2.eq.0) iModExpObj=ir
call ExtractIV(Mov_Command,13,ir,iErr2)
if(iErr2.eq.0) iModExpCon=ir
call ExtractIV(Mov_Command,14,ir,iErr2)
if(iErr2.eq.0) iModExpCol=ir
Select Case(Argument(1:3))
Case('bal')
if(lPerform) call adaptExp2D2(.false.)
Case('dep')
if(lPerform) call adaptExp2D6(.false.)
Case('fac')
if(lPerform) call adaptExp2D4(.false.)
Case('fic') ! delete expansions near fictitious boundaries (same domain on both sides)
if(lPerform) call adaptExp2D0f(.false.)
Case('ins')
if(lPerform) call adaptExp2D0(.false.)
Case('loc')
if(lPerform) call adaptExp2D1(.false.)
Case('ord')
if(lPerform) call adaptExp2D7(.false.)
Case('out')
if(lPerform) call adaptExp2D3(.false.)
Case('ran')
if(lPerform) call adaptExp2D5(.false.)
Case Default
iErr=-9
return
end Select
if(lPerform) then
call CorrExpPar(1000_4)
kExp=nExp
end if
Case Default
iErr=-9
return
end Select
end Subroutine MovAda
Subroutine MovAdd(CommObj,lPerform,iErr)
Implicit none
Integer(4) iErr,iErr2,idum,n,nx,ny,nz,i,j,k,i1,j1,k1,i2,j2,k2,l
Integer(2) idu
Real(8) r,x,y,z,t,d,x1,x2,y1,y2,z1,z2,rl(3),dmin,rmin(3),val(2)
Complex(8) cf(10)
Logical lPerform,ldum
Character(256) sch
Character(32) CommObj
Select Case(CommObj(1:3))
Case('3do')
call ExtractStr(Mov_Command,3,Argument,lArgument)
if((lArgument.lt.3).or.(.not.lPerform)) return
Select Case(Argument(1:3))
Case('con')
call ExtractRV(Mov_Command,4,z,iErr2) ! start z
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,5,d,iErr2) ! length
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,6,i,iErr2,nBnd,i2) ! boundary number
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,7,dmin,iErr2) ! multipole distance
if(iErr2.ne.0) dmin=1.0d0
call ExtractRV(Mov_Command,8,rl(1),iErr2) ! origin x
if(iErr2.ne.0) rl(1)=0.0d0
call ExtractRV(Mov_Command,9,rl(2),iErr2) ! origin y
if(iErr2.ne.0) rl(2)=0.0d0
call ExtractRV(Mov_Command,10,rl(3),iErr2) ! origin z
if(iErr2.ne.0) rl(3)=1.0d0
call ExtractRV(Mov_Command,11,r,iErr2) ! matching point aspect ratio
if(iErr2.ne.0) r=0.3d0
if(lPerform) call genObjCone(z,d,dmin,r,rl(1:3),i,i2)
Case('cyl')
call ExtractRV(Mov_Command,4,z,iErr2) ! start z
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,5,d,iErr2) ! length
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,6,i,iErr2,nBnd,i2) ! boundary number
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,7,r,iErr2) ! matching point aspect ratio
if(iErr2.ne.0) r=1.0d0
if(lPerform) call genObjCylinder(z,d,r,i,i2)
Case('rec')
call ExtractRV(Mov_Command,4,x,iErr2) ! x side length
if(iErr2.ne.0) x=1.0d0
call ExtractRV(Mov_Command,5,y,iErr2) ! y side length
if(iErr2.ne.0) y=1.0d0
call ExtractRV(Mov_Command,6,d,iErr2) ! matching point side
if(iErr2.ne.0) d=1.0d0
call ExtractRV(Mov_Command,7,z,iErr2) ! multipole density
if(iErr2.ne.0) z=1.0d0
call ExtractRV(Mov_Command,8,dmin,iErr2) ! multipole distance
if(iErr2.ne.0) dmin=1.0d0
call ExtractIV(Mov_Command,9,i,iErr2,nBnd) ! boundary number
if(iErr2.ne.0) i=1
call ExtractIV(Mov_Command,10,j,iErr2,nBnd) ! max. multipoles per side
if(iErr2.ne.0) j=0
call ExtractIV(Mov_Command,11,k,iErr2,nBnd) ! max. multipole order and degree
if(iErr2.ne.0) k=1
if(lPerform) call genObjRectangle(x,y,d,z,dmin,i,j,k)
Case('spi')
call ExtractRV(Mov_Command,4,x,iErr2) ! dr
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,5,y,iErr2) ! dphi
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,6,z,iErr2) ! dz
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,7,i,iErr2,nBnd,i2) ! boundary number
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,8,r,iErr2) ! matching point aspect ratio
if(iErr2.ne.0) r=1.0d0
if(lPerform) call genObjSpiral(x,y,z,r,i,i2)
Case('tor')
call ExtractRV(Mov_Command,4,y,iErr2) ! phi0
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,5,d,iErr2) ! dphi
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,6,i,iErr2,nBnd,i2) ! boundary number
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,7,r,iErr2) ! matching point aspect ratio
if(iErr2.ne.0) r=1.0d0
if(lPerform) call genObjTorus(y,d,r,i,i2,0)
Case('tri')
call ExtractRV(Mov_Command,4,x,iErr2) ! ax
if(iErr2.ne.0) x=0.0d0
call ExtractRV(Mov_Command,5,y,iErr2) ! ay
if(iErr2.ne.0) y=0.0d0
call ExtractRV(Mov_Command,6,z,iErr2) ! az
if(iErr2.ne.0) z=0.0d0
call ExtractRV(Mov_Command,7,x1,iErr2) ! bx
if(iErr2.ne.0) x1=1.0d0
call ExtractRV(Mov_Command,8,y1,iErr2) ! by
if(iErr2.ne.0) y1=0.0d0
call ExtractRV(Mov_Command,9,z1,iErr2) ! bz
if(iErr2.ne.0) z1=0.0d0
call ExtractRV(Mov_Command,10,x2,iErr2) ! cx
if(iErr2.ne.0) x2=0.0d0
call ExtractRV(Mov_Command,11,y2,iErr2) ! cy
if(iErr2.ne.0) y2=1.0d0
call ExtractRV(Mov_Command,12,z2,iErr2) ! cz
if(iErr2.ne.0) z2=1.0d0
call ExtractRV(Mov_Command,13,d,iErr2) ! matching point side
if(iErr2.ne.0) d=1.0d0
call ExtractRV(Mov_Command,14,t,iErr2) ! multipole density
if(iErr2.ne.0) t=1.0d0
call ExtractRV(Mov_Command,15,dmin,iErr2) ! multipole distance
if(iErr2.ne.0) dmin=1.0d0
call ExtractIV(Mov_Command,16,i,iErr2,nBnd) ! boundary number
if(iErr2.ne.0) i=1
call ExtractIV(Mov_Command,17,j,iErr2,nBnd) ! max. multipoles per side
if(iErr2.ne.0) j=0
call ExtractIV(Mov_Command,18,k,iErr2,nBnd) ! max. multipole order and degree
if(iErr2.ne.0) k=1
if(lPerform) call genObjTriangle(x,y,z,x1,y1,z1,x2,y2,z2,d,t,dmin,i,j,k)
end Select
Case('arc')
if(lPerform) then
call ExtractRV(Mov_Command,3,x,iErr2) ! origin
if(iErr2.ne.0) x=0.0d0
call ExtractRV(Mov_Command,4,y,iErr2) ! origin
if(iErr2.ne.0) y=0.0d0
call ExtractRV(Mov_Command,5,x1,iErr2) ! start point
if(iErr2.ne.0) x1=1.0d0
call ExtractRV(Mov_Command,6,y1,iErr2)
if(iErr2.ne.0) y1=0.0d0
call ExtractRV(Mov_Command,7,d,iErr2) ! angle
if(iErr2.ne.0) d=90.0d0
call ExtractIV(Mov_Command,8,i1,iErr2) ! left domain
if(iErr2.ne.0) i1=0
call ExtractIV(Mov_Command,9,i2,iErr2) ! right domain
if(iErr2.ne.0) i2=1
call ExtractIV(Mov_Command,10,i,iErr2) ! color
if(iErr2.ne.0) i=1
call ExtractIV(Mov_Command,11,k,iErr2) ! connection
if(iErr2.ne.0) k=0
call ExtractIV(Mov_Command,12,n,iErr2) ! number of matching points
if(iErr2.ne.0) n=0
call ExtractRV(Mov_Command,13,z1,iErr2) ! weight 1
if(iErr2.ne.0) z1=1.0d0
call ExtractRV(Mov_Command,14,z2,iErr2) ! weight 2
if(iErr2.ne.0) z2=1.0d0
call genBndArc(x,y,x1,y1,d,i1,i2,i,k,n,z1,z2)
end if
Case('bou')
if(lArgument.lt.1) return
if(lPerform) then
call setNameS(Argument,lArgument,ProFileName,BndFileName,'MAX','BND')
lAskBnd=.false.
lInsertBnd=.true.
call ExtractIV(Mov_Command,4,kInsObj,iErr2)
if(iErr2.ne.0) kInsObj=nBnd
kInsObj=max(0,min(nBnd,kInsObj))
call OpenBoundary(.true.)
end if
Case('cir')
if(lPerform) then
call ExtractRV(Mov_Command,3,x,iErr2) ! origin
if(iErr2.ne.0) x=0.0d0
call ExtractRV(Mov_Command,4,y,iErr2) ! origin
if(iErr2.ne.0) y=0.0d0
x1=x
y1=y
call ExtractRV(Mov_Command,5,d,iErr2) ! radius
if(iErr2.ne.0) d=1.0d0
call ExtractIV(Mov_Command,6,i1,iErr2) ! left domain
if(iErr2.ne.0) i1=0
call ExtractIV(Mov_Command,7,i2,iErr2) ! right domain
if(iErr2.ne.0) i2=1
call ExtractIV(Mov_Command,8,i,iErr2) ! color
if(iErr2.ne.0) i=1
call ExtractIV(Mov_Command,9,k,iErr2) ! connection
if(iErr2.ne.0) k=0
call ExtractIV(Mov_Command,10,n,iErr2) ! number of matching points
if(iErr2.ne.0) n=0
call ExtractRV(Mov_Command,11,z1,iErr2) ! weight 1
if(iErr2.ne.0) z1=1.0d0
call ExtractRV(Mov_Command,12,z2,iErr2) ! weight 2
if(iErr2.ne.0) z2=1.0d0
call genBndArc(x,y,x1,y1,d,i1,i2,i,k,n,z1,z2)
end if
Case('exp')
if(lArgument.lt.1) return
if(lPerform) then
call setNameS(Argument,lArgument,ProFileName,ExpFileName,'MAX','EXP')
lAskExp=.false.
lInsertExp=.true.
call ExtractIV(Mov_Command,4,kInsObj,iErr2)
if(iErr2.ne.0) kInsObj=nExp
kInsObj=max(0,min(nExp,kInsObj))
call OpenExpansion(.true.)
end if
Case('fie')
call StrToRV(Argument(1:lArgument),x,iErr2)
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,4,y,iErr2)
if(iErr2.ne.0) y=0.0d0
if(lPerform) then
cFld=dcmplx(x,y)+cFld
end if
Case('fun')
call ExtractIV(Mov_Command,3,i1,iErr2,nFunA,i2)
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,4,x,iErr2)
if(iErr2.ne.0) return
if(lPerform) then
Fun(i1:i2,1:nFun)=x+Fun(i1:i2,1:nFun)
end if
Case('inh')
if(lArgument.lt.1) return
if(lPerform) then
call AddInhibit(nInhibit+1,Argument(1:min(32,lArgument)),ldum)
end if
Case('lin')
if(lPerform) then
call ExtractRV(Mov_Command,3,x,iErr2) ! start point
if(iErr2.ne.0) x=0.0d0
call ExtractRV(Mov_Command,4,y,iErr2)
if(iErr2.ne.0) y=0.0d0
call ExtractRV(Mov_Command,5,x1,iErr2) ! end point
if(iErr2.ne.0) x1=1.0d0
call ExtractRV(Mov_Command,6,y1,iErr2)
if(iErr2.ne.0) y1=0.0d0
d=-1.0d0
call ExtractIV(Mov_Command,7,i1,iErr2) ! left domain
if(iErr2.ne.0) i1=0
call ExtractIV(Mov_Command,8,i2,iErr2) ! right domain
if(iErr2.ne.0) i2=1
call ExtractIV(Mov_Command,9,i,iErr2) ! color
if(iErr2.ne.0) i=1
call ExtractIV(Mov_Command,10,k,iErr2) ! connection
if(iErr2.ne.0) k=0
call ExtractIV(Mov_Command,11,n,iErr2) ! number of matching points
if(iErr2.ne.0) n=0
call ExtractRV(Mov_Command,12,z1,iErr2) ! weight 1
if(iErr2.ne.0) z1=1.0d0
call ExtractRV(Mov_Command,13,z2,iErr2) ! weight 2
if(iErr2.ne.0) z2=1.0d0
call genBndArc(x,y,x1,y1,d,i1,i2,i,k,n,z1,z2)
end if
Case('obj')
if(lArgument.lt.1) return
if(lPerform) then
call setNameS(Argument,lArgument,ProFileName,ObjFileName,'MAX','3DO')
lAskObj=.false.
lInsertObj=.true.
call ExtractIV(Mov_Command,4,kInsObj,iErr2)
if(iErr2.ne.0) kInsObj=nObj
kInsObj=max(0,min(nObj,kInsObj))
call OpenObject(.true.)
end if
Case('pfd')
if(lArgument.lt.3) return
if(Argument(1:3).eq.'sen') then
call ExtractIV(Mov_Command,4,nx,iErr2)
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,5,ny,iErr2)
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,6,nz,iErr2)
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,7,x1,iErr2)
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,8,x2,iErr2)
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,9,y1,iErr2)
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,10,y2,iErr2)
if(iErr2.ne.0) return
call ExtractRV(Mov_Command,11,z1,iErr2)
if(iErr2.ne.0) z=0.0d0
call ExtractRV(Mov_Command,12,z2,iErr2)
if(iErr2.ne.0) z1=0.0d0
call ExtractRV(Mov_Command,13,t,iErr2)
if(iErr2.ne.0) t=0.0d0
call ExtractRV(Mov_Command,14,d,iErr2)
if(iErr2.ne.0) d=pBig
if(lPerform) then
n=nPFDsens
call InsertPFDsens(nPFDsens,nx*ny*nz,ldum)
if(ldum) then
do i=1,nx
x=x1+Dble(i-1)*(x2-x1)/Dble(max(1,nx-1))
do j=1,ny
y=y1+Dble(j-1)*(y2-y1)/Dble(max(1,ny-1))
do k=1,nz
z=z1+Dble(k-1)*(z2-z1)/Dble(max(1,nz-1))
n=n+1
PFDsensX(n)=x
PFDsensY(n)=y
PFDsensZ(n)=z
PFDsensT(n)=t
PFDsensD(n)=d
end do
end do
end do
end if
end if
else if(Argument(1:3).eq.'sou') then
call ExtractIV(Mov_Command,4,i1,iErr2)
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,5,i2,iErr2)
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,6,j1,iErr2)
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,7,j2,iErr2)
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,8,k1,iErr2)
if(iErr2.ne.0) return
call ExtractIV(Mov_Command,9,k2,iErr2)
if(iErr2.ne.0) return
call ExtractStr(Mov_Command,10,sch,idum)
if(lPerform) then
n=nPFDsource
nx=i2-i1+1
ny=j2-j1+1
nz=k2-k1+1
call InsertPFDsource(nPFDsource,nx*ny*nz,ldum)
if(ldum) then
do i=i1,i2
do j=j1,j2
do k=k1,k2
n=n+1
iPFDs(n)=i
jPFDs(n)=j
kPFDs(n)=k
if(idum.gt.0) then
l=GetSLength(sch)
rl(1)=PFDxmin+Dble(iPFDs(n)-1)*PFDdx
rl(2)=PFDymin+Dble(jPFDs(n)-1)*PFDdy
rl(3)=PFDzmin+Dble(kPFDs(n)-1)*PFDdz
cCForm(0)=(0.0d0,1.0d0)
cCForm(1)=DCmplx(Pi,0.0d0)
cCForm(2)=DCmplx(Eps0,0.0d0)
cCForm(3)=DCmplx(Mue0,0.0d0)
cCForm(4)=DCmplx(Kw0,0.0d0)
cCForm(5)=DCmplx(Zw0,0.0d0)
pCForm(0)=(1.0d0,0.0d0)
vCForm(0)=DCmplx(Dble(n),0.0d0)
vCForm(1)=DCmplx(rl(1),0.0d0)
vCForm(2)=DCmplx(rl(2),0.0d0)
vCForm(3)=DCmplx(rl(3),0.0d0)
if(sch(1:3).eq.'mmp') then
call DistPtObj(0_2,0_2,rl(1:3),.true.,dmin,rmin,idu,val,.true.)
call GetLoccField(rl,idu,0,cf)
if(lgcFld) then
if(iHEGlobal.eq.1_2) then ! Hz
PFDsourceA(n)=cf(6)