[ET Trac] [Einstein Toolkit] #1378: provide equivalent of fprintf(stderr, "%s\n", msg) in Fortran

Einstein Toolkit trac-noreply at einsteintoolkit.org
Thu Jun 6 19:31:00 CDT 2013


#1378: provide equivalent of fprintf(stderr, "%s\n", msg) in Fortran
--------------------------+-------------------------------------------------
  Reporter:  rhaas        |       Owner:                     
      Type:  enhancement  |      Status:  new                
  Priority:  minor        |   Milestone:                     
 Component:  Cactus       |     Version:  development version
Resolution:               |    Keywords:                     
--------------------------+-------------------------------------------------

Comment (by rhaas):

 I do not know how to use "\n" in Fotran. Is this possible? Also in Fotran
 I would have to allocate a buffer to hold all text at once. So possibly
 several hundred characters which is not ideal. In C: yes, the most
 convenient method is to have long format string and \n in it. Currently
 the Fortan code typically looks like this:

 {{{
 character*256 :: warnline
 if (dens(i,j,k).ne.dens(i,j,k)) then
    !$OMP CRITICAL
    call CCTK_WARN(1,"dens NAN at entry of Con2Prim")
    write(warnline,"(A10,i5)") "reflevel: ",GRHydro_reflevel
    call CCTK_WARN(1,warnline)
    write(warnline,"(3i5,1P10E15.6)") i,j,k,x(i,j,k),y(i,j,k),z(i,j,k)
    call CCTK_WARN(1,warnline)
    write(warnline,"(1P10E15.6)") rho(i,j,k),dens(i,j,k),eps(i,j,k)
    call CCTK_WARN(1,warnline)
    write(warnline,'(a32,2i3)') 'hydro_excision_mask, atmosphere_mask: ',
 hydro_excision_mask(i,j,k), atmosphere_mask(i,j,k)
    call CCTK_WARN(1,warnline)
    call CCTK_WARN(0,"Aborting!!!")
    !$OMP END CRITICAL
 endif
 }}}

 constructs like this are very common in GRHydro.

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1378#comment:2>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list