Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/gipsy/sub/initptr.dc2
Дата изменения: Thu Jan 23 17:11:37 1992
Дата индексирования: Tue Apr 7 22:17:45 2009
Кодировка:

Поисковые слова: http astrokuban.info astrokuban

Subroutine: INITPTR

Purpose: Pointer handling within parts of subset.

File: initptr.c

Author: K.G. Begeman

Use: CALL INITPTR( RFLO, Input INTEGER ARRAY
RFHI, Input INTEGER ARRAY
SFLO, Input INTEGER ARRAY
SFHI, Input INTEGER ARRAY
NDIM, Input INTEGER
NR, Input INTEGER
NT ) In/Output INTEGER

RFLO Array with the lower coordinates of readframe.
RFHI Array with the upper coordinates of readframe.
SFLO Array with the lower coordinates of subframe.
SFHI Array with the upper coordinates of subframe.
NDIM Dimension of subset (length of RFLO,RFHI, etc.).
NR Number of data values currently in readbuffer.
NT On input, number of points done sofar, on output
number of points done. Initial value must be 0!

Description: The subroutine INITPTR is used in combination with
GDSI_READ. GDSI_READ returns the number of data values
actually read, which is input to INITPTR in order to
initialize the logical functions INSIDEPTR and
OUTSIDEPTR. Further input to INITPTR are the dimension
of the subset, the readframe (part of the subset which
is to be read by GDSI_READ) and a subframe (which is
contained in the readframe). After each call to GDSI_READ
and INITPTR the functions INSIDEPTR and OUTSIDEPTR
return pointers to datavalues (in the buffer filled by
GDSI_READ) which are inside or outside the subframe.
INSIDEPTR and OUTSIDEPTR return .FALSE. if all
positions in the readbuffer have been scanned. These
routines provide the applications programmer with a
simple tool to handle data in subframes (i.e. frames
returned from BOXINP) in a different way than the data
outside the subframe. See the example below.

Example: INTEGER SIZE
PARAMETER (SIZE=4096)
INTEGER MAXAX
PARAMETER (MAXAX=5)
CHARACTER*80 SET
INTEGER C1,C2,F1(MAXAX),F2(MAXAX),B1(MAXAX),B2(MAXAX)
INTEGER IP,NP,NR,NT,NW,IERR,IERW
REAL RBUF(SIZE)
LOGICAL INSIDEPTR, OUTSIDEPTR
NT=0
REPEAT
CALL GDSI_READ(SET,C1,C2,RBUF,SIZE,NR,IERR)
CALL INITPTR(F1,F2,B1,B2,NDIM,NR,NT)
WHILE (INSIDEPTR(IP,NP))
CALL SCALE1(RBUF(IP+1),NP,2.0,0.0)
CWHILE
WHILE (OUTSIDEPTR(IP,NP))
CALL SCALE1(RBUF(IP+1),NP,0.5,0.0)
CWHILE
CALL GDSI_WRITE(SET,C1,C2,RBUF,NR,NW,IERW)
UNTIL (IERR .EQ. 0)

COPY and SCALE are example programs which
demonstrate the use of INITPTR.

Related Docs: insideptr.dc2, outsideptr.dc2

Updates: Nov 15, 1988: KGB, Creation date.
Jan 3, 1992: KGB, Bug removed.