next up previous contents
Next: C Up: Examples Previous: Examples   Contents

Fortran

This example comes from thorn CactusEinstein/Maximal and uses the $trK$ macro to calculate the trace of the extrinsic curvature.

c     Declarations for macros.
#include "CactusEinstein/ADMMacros/src/macro/TRK_declare.h"

c we're not taking any derivatives here, but if we were,
c we would also need the following line:
#include "CactusEinstein/ADMMacros/src/macro/ADM_Spacing_declare.h"

c we're not taking any derivatives here, but if we were,
c we would also need the following line:
#include "CactusEinstein/ADMMacros/src/macro/ADM_Spacing.h"

<CUT>

c     Add the shift term: N = B^i D_i(trK).
      if ((maxshift).and.(shift_state.eq.1)) then
         do k=1,nz
            do j=1,ny
               do i=1,nx
#include "CactusEinstein/ADMMacros/src/macro/TRK_guts.h"
                  K_temp(i,j,k) = TRK_TRK
                end do
             end do
         end do
#include "CactusEinstein/ADMMacros/src/macro/TRK_undefine.h"