Skip to content

Commit 46032a2

Browse files
committed
GREPOS: Add selection of input change set
1 parent 2a8a427 commit 46032a2

File tree

2 files changed

+50
-30
lines changed

2 files changed

+50
-30
lines changed

Diff for: packages/seacas/applications/grepos/gp_qainfo.blk

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
C Copyright(C) 1999-2024 National Technology & Engineering Solutions
1+
C Copyright(C) 1999-2025 National Technology & Engineering Solutions
22
C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
C NTESS, the U.S. Government retains certain rights in this software.
44
C
55
C See packages/seacas/LICENSE for details
66

77
C -*- Mode: fortran -*-
88
QAINFO(1) = 'Grepos '
9-
QAINFO(2) = '2024/04/09 '
10-
QAINFO(3) = ' 1.95 '
9+
QAINFO(2) = '2025/01/31 '
10+
QAINFO(3) = ' 2.00 '

Diff for: packages/seacas/applications/grepos/grepos.f

+47-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
C Copyright(C) 1999-2022 National Technology & Engineering Solutions
1+
C Copyright(C) 1999-2022, 2025 National Technology & Engineering Solutions
22
C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
C NTESS, the U.S. Government retains certain rights in this software.
44
C
@@ -57,7 +57,7 @@ PROGRAM GREPOS
5757
include 'gp_attrot.blk'
5858
INCLUDE 'argparse.inc'
5959

60-
CHARACTER*2048 FILIN, FILOUT, SCRATCH, SYNTAX, HELP
60+
CHARACTER*2048 FILIN, FILOUT, SCRATCH, SYNTAX, HELP, VALUE
6161
CHARACTER*80 SCRSTR
6262

6363
C... String containing name of common element topology in model
@@ -99,7 +99,8 @@ PROGRAM GREPOS
9999

100100
C .. Get filename from command line. If not specified, emit error message
101101
SYNTAX =
102-
* 'Syntax is: "grepos [-name_length len] [-64] file_in file_out"'
102+
* 'Syntax is: "grepos [-name_length len] [-64] ' //
103+
$ '[-change_set #] file_in file_out"'
103104
HELP = 'Documentation: https://sandialabs.github.io' //
104105
$ '/seacas-docs/sphinx/html/index.html#grepos'
105106
NARG = argument_count()
@@ -110,30 +111,6 @@ PROGRAM GREPOS
110111
GOTO 60
111112
end if
112113

113-
C ... Parse options...
114-
name_len = 0
115-
l64bit = .false.
116-
if (narg .gt. 2) then
117-
iarg = 1
118-
do
119-
CALL get_argument(iarg,FILIN, LNAM)
120-
if (filin(:lnam) .eq. '-name_length') then
121-
CALL get_argument(iarg+1,FILIN, LNAM)
122-
read (filin(:lnam), '(i10)') name_len
123-
iarg = iarg + 2
124-
else if (filin(:lnam) .eq. '-64') then
125-
l64bit = .true.
126-
iarg = iarg + 1
127-
else
128-
SCRATCH = 'Unrecognized command option "'//FILIN(:LNAM)//'"'
129-
CALL PRTERR ('FATAL', SCRATCH(:LENSTR(SCRATCH)))
130-
CALL PRTERR ('CMDSPEC', SYNTAX(:LENSTR(SYNTAX)))
131-
CALL PRTERR ('CMDSPEC', HELP(:LENSTR(HELP)))
132-
end if
133-
if (iarg .gt. narg-2) exit
134-
end do
135-
end if
136-
137114
C --Open the input database and read the initial variables
138115
NDBIN = 9
139116
NDBOUT = 10
@@ -160,6 +137,49 @@ PROGRAM GREPOS
160137
GOTO 60
161138
END IF
162139

140+
C ... Parse options...
141+
name_len = 0
142+
l64bit = .false.
143+
if (narg .gt. 2) then
144+
iarg = 1
145+
do
146+
CALL get_argument(iarg,FILIN, LNAM)
147+
if (filin(:lnam) .eq. '-name_length') then
148+
CALL get_argument(iarg+1,FILIN, LNAM)
149+
read (filin(:lnam), '(i10)') name_len
150+
iarg = iarg + 2
151+
else if (filin(:lnam) .eq. '-64') then
152+
l64bit = .true.
153+
iarg = iarg + 1
154+
else if (filin(:lnam) .eq. '-change_set' .or.
155+
* filin(:lnam) .eq. '--change_set') then
156+
C ... Convert `value` to an integer.
157+
CALL get_argument(iarg+1,value, lv)
158+
iarg = iarg + 2
159+
read (value(:lv), '(i10)') nchange
160+
write (*,99) nchange
161+
99 format(1x,'NOTE: Selecting change set ', i3)
162+
C ... Check that file contains at least that many change sets...
163+
ndbr = iand(ndbin, EX_FILE_ID_MASK)
164+
call exinq(ndbr, EX_INQ_NUM_CHILD_GROUPS,
165+
$ idum, rdum, cdum, ierr)
166+
if (nchange .gt. idum) then
167+
write (*,*) 'ERROR: Selected change set', nchange,
168+
$ 'but there are only ', idum, ' change sets in file.'
169+
goto 60
170+
else
171+
ndbin = ndbr + nchange
172+
end if
173+
else
174+
SCRATCH = 'Unrecognized command option "'//FILIN(:LNAM)//'"'
175+
CALL PRTERR ('FATAL', SCRATCH(:LENSTR(SCRATCH)))
176+
CALL PRTERR ('CMDSPEC', SYNTAX(:LENSTR(SYNTAX)))
177+
CALL PRTERR ('CMDSPEC', HELP(:LENSTR(HELP)))
178+
end if
179+
if (iarg .gt. narg-2) exit
180+
end do
181+
end if
182+
163183
call exgini(ndbin, title, ndim, numnp, numel, nelblk,
164184
* numnps, numess, ierr)
165185
if (numnps .gt. 0) then

0 commit comments

Comments
 (0)