Re: converting a region name into a region number

From: Alberto Fasso' <fasso@SLAC.Stanford.EDU>
Date: Wed May 21 2008 - 17:10:26 CEST

Dear Sharmalee,

I have just realized that one piece of information was missing in the
answer I gave yesterday to your question. I copied a piece of
an existing mgdraw subroutine, but I forgot to add a line which had
been put at the beginning:

       CHARACTER*20 FILNAM
       CHARACTER*8 MRGNAM, NRGNAM <===

Without that, the program would consider MRGNAM and NRGNAM as integers,
and the comparison with the region names (8-character strings) would not
work.

Sorry for the omission

Alberto

> the routine you are looking for is indeed GEOR2N. To use it is simpler than
> you think. I will give you an example below.
> Its arguments are NREG, REGNAM, IERR, i.e. respectively the region number,
> the region name and an error flag (equal to 0 if the conversion succeeded,
> 1 otherwise).
>
> Here is my example, writing to a collision file the x and y coordinates,
> the energy and the weight of photons crossing the boundary between region
> VpNEHaVa and region DummyC4d.
>
> ENTRY BXDRAW ( ICODE, MREG, NEWREG, XSCO, YSCO, ZSCO )
> IF ( .NOT. LFCOPE ) THEN
> LFCOPE = .TRUE.
> OPEN ( UNIT = 88, FILE = "collfile", STATUS = 'unknown')
> END IF
> CALL GEOR2N ( MREG, MRGNAM, IERR1 )
> CALL GEOR2N ( NEWREG, NRGNAM, IERR2 )
> IF(IERR1 .NE. 0 .OR. IERR2 .NE. 0) STOP "Error in name conversion"
> IF(MRGNAM .EQ. "VpNEHaVa" .AND. NRGNAM .EQ. "DummyC4d") THEN
> IF(JTRACK .EQ. 7) WRITE(88,'(1P,4G25.15)')
> & XSCO, YSCO, ETRACK, WTRACK
> END IF
> RETURN
>
> Alberto
>
>
> On Sat, 10 May 2008, Sharmalee Randeniya wrote:
>
> >
> >
> > Dear FLUKA experts,
> >
> > I am trying to use BXDRAW in mgdraw.f to write a boundary crossing particle
> > dump
> > for a proton therapy simulation. My FLUKA input file is written using region
> > names instead of region numbers to describe the geometry.
> >
> > Is there a routine to convert region names into region numbers?
> >
> > I read the description on GEOR2N routine in chapter 13 in the manual. If I am
> > correct it converts a region number into a name and region number
> > (MREG/NEWREG)
> > is the input variable and the region name is the returned variable. So if I
> > were to used this, I first have to search for the required region names in a
> > loop. Am I right or wrong?
> >
> > Any help is deeply appreciated !!!
> >
> > Thank you
> >
> > Sharmalee
Received on Wed May 21 18:00:19 2008

This archive was generated by hypermail 2.1.8 : Wed May 21 2008 - 18:00:21 CEST