1 |
!======================================================================= |
2 |
integer function mitcplr_match_comp( carg ) |
3 |
implicit none |
4 |
! Predefined constants/arrays |
5 |
#include "CPLR_SIG.h" |
6 |
! Arguments |
7 |
character*(*) carg |
8 |
! Local |
9 |
integer j,jmatch |
10 |
! ------------------------------------------------------------------ |
11 |
|
12 |
if ( carg .EQ. coupler_Name ) then |
13 |
mitcplr_match_comp=-1 |
14 |
stop 'mitcplr_match_comp: I should not reach this point' |
15 |
else |
16 |
|
17 |
! Search through list of components |
18 |
jmatch=0 |
19 |
do j=1,num_components |
20 |
if ( carg .EQ. component_List(j) ) then |
21 |
if ( jmatch .NE. 0 ) then |
22 |
if (DEBUG) write(0,*) 'mitcplr_match_comp: String arg = ',carg |
23 |
stop 'mitcplr_match_comp: More than one match to string' |
24 |
else |
25 |
jmatch=j |
26 |
endif |
27 |
endif |
28 |
enddo |
29 |
|
30 |
! If no matches, create entry in list |
31 |
if ( jmatch .EQ. 0) then |
32 |
if ( num_components .EQ. MAX_COMPONENTS ) then |
33 |
stop 'mitcplr_match_comp: Too many components types entered' |
34 |
endif |
35 |
num_components=num_components+1 |
36 |
jmatch=num_components |
37 |
call mitcplr_initcomp( jmatch, carg ) |
38 |
endif |
39 |
|
40 |
! Return index within list |
41 |
mitcplr_match_comp=jmatch |
42 |
|
43 |
endif |
44 |
|
45 |
! ------------------------------------------------------------------ |
46 |
return |
47 |
end |
48 |
!======================================================================= |