From 42a98ca518377949e8cfc902343a4b2d97a25564 Mon Sep 17 00:00:00 2001 From: schnetter Date: Mon, 15 Jul 2002 17:15:29 +0000 Subject: Added thorn TGRtensor. This is a utility thorn from the TGR code. It contains generic tensor operations, some useful constants, code for numeric derivatives, interfaces to Lapack and BLAS, and interfaces for Cactus routines. git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinUtils/TGRtensor/trunk@2 b716e942-a2de-43ad-8f52-f3dfe468e4e7 --- src/derivs2.F90 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/derivs2.F90 (limited to 'src/derivs2.F90') diff --git a/src/derivs2.F90 b/src/derivs2.F90 new file mode 100644 index 0000000..4ca51bf --- /dev/null +++ b/src/derivs2.F90 @@ -0,0 +1,40 @@ +! $Header$ + +#ifndef TGR_INCLUDED + +#include "cctk.h" +#include "cctk_Parameters.h" + +module derivs2 + implicit none + private + public get_2derivs + public get_2derivs2 +contains +#endif + subroutine get_2derivs (a, f, pos, off, dx) + CCTK_REAL, intent(in) :: a(*) + CCTK_REAL, intent(out) :: f(2) + integer, intent(in) :: pos, off(2) + CCTK_REAL, intent(in) :: dx(2) + integer :: i + do i=1,2 + f(i) = (a(pos+off(i)) - a(pos-off(i))) / (2*dx(i)) + end do + end subroutine get_2derivs + subroutine get_2derivs2 (a, f, pos, off, dx) + CCTK_REAL, intent(in) :: a(*) + CCTK_REAL, intent(out) :: f(2,2) + integer, intent(in) :: pos, off(2) + CCTK_REAL, intent(in) :: dx(2) + integer :: i + do i=1,2 + f(i,i) = (a(pos+off(i)) - 2*a(pos) + a(pos-off(i))) / dx(i)**2 + end do + f(1,2) = ( a(pos-off(1)-off(2)) - a(pos+off(1)-off(2)) & + & - a(pos-off(1)+off(2)) + a(pos+off(1)+off(2))) / (4*dx(1)*dx(2)) + f(2,1) = f(1,2) + end subroutine get_2derivs2 +#ifndef TGR_INCLUDED +end module derivs2 +#endif -- cgit v1.2.3