[ET Trac] [Einstein Toolkit] #1003: Add optional support for CarpetEvolutionMask to GRHydro

Einstein Toolkit trac-noreply at einsteintoolkit.org
Thu Aug 2 15:25:57 CDT 2012


#1003: Add optional support for CarpetEvolutionMask to GRHydro
------------------------------------+---------------------------------------
  Reporter:  rhaas                  |       Owner:         
      Type:  enhancement            |      Status:  review 
  Priority:  minor                  |   Milestone:         
 Component:  EinsteinToolkit thorn  |     Version:         
Resolution:                         |    Keywords:  GRHydro
------------------------------------+---------------------------------------

Comment (by eschnett):

 Most Fortran compilers (and Cactus expects this, and Simfactory sets the
 respective compiler options) support "Cray pointers". These are pointer-
 sized integers that can be used in very much the same way as pointers in
 C.

 The syntax is slightly unintuitive if one comes from C; instead of an
 operator that allows dereferencing a pointer, there is a second variable
 declared for this operation, similar in spirit to Fortran's "equivalence"
 statement.

 The syntax goes approximately like this:
 {{{
 CCTK_REAL var(ni,nj,nk)
 pointer (pvar, var)
 pvar = ... call flesh function to set pointer
 var(i,j,k) = ...
 }}}
 The "pointer" statement declares a pointer, and the pointer type is taken
 from the second variable. In C, this would be something like
 {{{
 typeof(var) *pvar;
 }}}
 In addition, the "pointer" statement means that the variable "var" has no
 memory allocated; instead, accessing var implicitly dereferences the
 pointer "pvar". In C, "var" becomes "*pvar".

 Technically, pvar is declared as an integer variable with sufficient size
 to hold a pointer, probably an integer*8 on most systems. As such, pvar
 can e.g. also be output, passed to subroutines, etc. However, this is
 rarely necessary -- for almost all purposes, "var" can be used like a
 regular variable; the only difference is that its memory isn't allocated
 by the compiler, but by setting "pvar".

 There is also an intrinsic function "loc" to obtain the address of a
 variable, similar to C's "&" operator.

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


More information about the Trac mailing list