[TEST]UPSTREAM: Pick some source changes from 48080d0a97
* Sync new folder structure
This commit is contained in:
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -126,12 +126,7 @@ setup.generate_AMSSNCKU_input()
|
|||||||
#inputvalue = input() ## Wait for user input (press Enter) to proceed
|
#inputvalue = input() ## Wait for user input (press Enter) to proceed
|
||||||
#print()
|
#print()
|
||||||
|
|
||||||
setup.print_puncture_information()
|
## Generate AMSS-NCKU program input files based on the configured parameters
|
||||||
|
|
||||||
|
|
||||||
##################################################################
|
|
||||||
|
|
||||||
## Generate AMSS-NCKU program input files based on the configured parameters
|
|
||||||
|
|
||||||
print( )
|
print( )
|
||||||
print( " Generating the AMSS-NCKU input parfile for the ABE executable. " )
|
print( " Generating the AMSS-NCKU input parfile for the ABE executable. " )
|
||||||
@@ -312,7 +307,7 @@ if (input_data.Initial_Data_Method == "Ansorg-TwoPuncture" ):
|
|||||||
|
|
||||||
import generate_TwoPuncture_input
|
import generate_TwoPuncture_input
|
||||||
|
|
||||||
generate_TwoPuncture_input.generate_AMSSNCKU_TwoPuncture_input()
|
generate_TwoPuncture_input.generate_AMSSNCKU_TwoPuncture_input(numerical_grid.puncture_data)
|
||||||
|
|
||||||
print( )
|
print( )
|
||||||
print( " The input parfile for the TwoPunctureABE executable has been generated. " )
|
print( " The input parfile for the TwoPunctureABE executable has been generated. " )
|
||||||
@@ -354,7 +349,7 @@ if (input_data.Initial_Data_Method == "Ansorg-TwoPuncture" ):
|
|||||||
|
|
||||||
import renew_puncture_parameter
|
import renew_puncture_parameter
|
||||||
|
|
||||||
renew_puncture_parameter.append_AMSSNCKU_BSSN_input(File_directory, output_directory)
|
renew_puncture_parameter.append_AMSSNCKU_BSSN_input(File_directory, output_directory, numerical_grid.puncture_data)
|
||||||
|
|
||||||
|
|
||||||
## Generated AMSS-NCKU input filename
|
## Generated AMSS-NCKU input filename
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,101 +1,101 @@
|
|||||||
#ifndef BH_DIAGNOSTICS_H
|
#ifndef BH_DIAGNOSTICS_H
|
||||||
#define BH_DIAGNOSTICS_H
|
#define BH_DIAGNOSTICS_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
struct BH_diagnostics
|
struct BH_diagnostics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// mean x,y,z
|
// mean x,y,z
|
||||||
fp centroid_x, centroid_y, centroid_z;
|
fp centroid_x, centroid_y, centroid_z;
|
||||||
|
|
||||||
// these are quadrupole moments about the centroid, i.e.
|
// these are quadrupole moments about the centroid, i.e.
|
||||||
// mean(xi*xj) - centroid_i*centroid_j
|
// mean(xi*xj) - centroid_i*centroid_j
|
||||||
fp quadrupole_xx, quadrupole_xy, quadrupole_xz,
|
fp quadrupole_xx, quadrupole_xy, quadrupole_xz,
|
||||||
quadrupole_yy, quadrupole_yz,
|
quadrupole_yy, quadrupole_yz,
|
||||||
quadrupole_zz;
|
quadrupole_zz;
|
||||||
|
|
||||||
// min,max,mean surface radius about local coordinate origin
|
// min,max,mean surface radius about local coordinate origin
|
||||||
fp min_radius, max_radius, mean_radius;
|
fp min_radius, max_radius, mean_radius;
|
||||||
|
|
||||||
// xyz bounding box
|
// xyz bounding box
|
||||||
fp min_x, max_x,
|
fp min_x, max_x,
|
||||||
min_y, max_y,
|
min_y, max_y,
|
||||||
min_z, max_z;
|
min_z, max_z;
|
||||||
|
|
||||||
// proper circumference
|
// proper circumference
|
||||||
// (computed using induced metric along these local-coordinate planes)
|
// (computed using induced metric along these local-coordinate planes)
|
||||||
fp circumference_xy,
|
fp circumference_xy,
|
||||||
circumference_xz,
|
circumference_xz,
|
||||||
circumference_yz;
|
circumference_yz;
|
||||||
|
|
||||||
// surface area (computed using induced metric)
|
// surface area (computed using induced metric)
|
||||||
// and quantities derived from it
|
// and quantities derived from it
|
||||||
fp area, irreducible_mass, areal_radius;
|
fp area, irreducible_mass, areal_radius;
|
||||||
|
|
||||||
double Px, Py, Pz, Sx, Sy, Sz;
|
double Px, Py, Pz, Sx, Sy, Sz;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// position of diagnostics in buffer and number of diagnostics
|
// position of diagnostics in buffer and number of diagnostics
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
posn__centroid_x = 0,
|
posn__centroid_x = 0,
|
||||||
posn__centroid_y,
|
posn__centroid_y,
|
||||||
posn__centroid_z,
|
posn__centroid_z,
|
||||||
posn__quadrupole_xx,
|
posn__quadrupole_xx,
|
||||||
posn__quadrupole_xy,
|
posn__quadrupole_xy,
|
||||||
posn__quadrupole_xz,
|
posn__quadrupole_xz,
|
||||||
posn__quadrupole_yy,
|
posn__quadrupole_yy,
|
||||||
posn__quadrupole_yz,
|
posn__quadrupole_yz,
|
||||||
posn__quadrupole_zz,
|
posn__quadrupole_zz,
|
||||||
posn__min_radius,
|
posn__min_radius,
|
||||||
posn__max_radius,
|
posn__max_radius,
|
||||||
posn__mean_radius,
|
posn__mean_radius,
|
||||||
|
|
||||||
posn__min_x,
|
posn__min_x,
|
||||||
posn__max_x,
|
posn__max_x,
|
||||||
posn__min_y,
|
posn__min_y,
|
||||||
posn__max_y,
|
posn__max_y,
|
||||||
posn__min_z,
|
posn__min_z,
|
||||||
posn__max_z,
|
posn__max_z,
|
||||||
|
|
||||||
posn__circumference_xy,
|
posn__circumference_xy,
|
||||||
posn__circumference_xz,
|
posn__circumference_xz,
|
||||||
posn__circumference_yz,
|
posn__circumference_yz,
|
||||||
|
|
||||||
posn__area,
|
posn__area,
|
||||||
posn__irreducible_mass,
|
posn__irreducible_mass,
|
||||||
posn__areal_radius,
|
posn__areal_radius,
|
||||||
|
|
||||||
N_buffer // no comma // size of buffer
|
N_buffer // no comma // size of buffer
|
||||||
};
|
};
|
||||||
|
|
||||||
// copy diagnostics to/from buffer
|
// copy diagnostics to/from buffer
|
||||||
void copy_to_buffer(double buffer[N_buffer]) const;
|
void copy_to_buffer(double buffer[N_buffer]) const;
|
||||||
void copy_from_buffer(const double buffer[N_buffer]);
|
void copy_from_buffer(const double buffer[N_buffer]);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void compute(patch_system &ps);
|
void compute(patch_system &ps);
|
||||||
|
|
||||||
void compute_signature(patch_system &ps, const double dT);
|
void compute_signature(patch_system &ps, const double dT);
|
||||||
|
|
||||||
FILE *setup_output_file(int N_horizons, int hn)
|
FILE *setup_output_file(int N_horizons, int hn)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
void output(FILE *fileptr, double time)
|
void output(FILE *fileptr, double time)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
BH_diagnostics();
|
BH_diagnostics();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static double surface_integral(const patch_system &ps,
|
static double surface_integral(const patch_system &ps,
|
||||||
int src_gfn, bool src_gfn_is_even_across_xy_plane,
|
int src_gfn, bool src_gfn_is_even_across_xy_plane,
|
||||||
bool src_gfn_is_even_across_xz_plane,
|
bool src_gfn_is_even_across_xz_plane,
|
||||||
bool src_gfn_is_even_across_yz_plane,
|
bool src_gfn_is_even_across_yz_plane,
|
||||||
enum patch::integration_method method);
|
enum patch::integration_method method);
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* BH_DIAGNOSTICS_H */
|
#endif /* BH_DIAGNOSTICS_H */
|
||||||
@@ -1,87 +1,87 @@
|
|||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
program checkFFT
|
program checkFFT
|
||||||
use dfport
|
use dfport
|
||||||
implicit none
|
implicit none
|
||||||
double precision::x
|
double precision::x
|
||||||
integer,parameter::N=256
|
integer,parameter::N=256
|
||||||
double precision,dimension(N*2)::p
|
double precision,dimension(N*2)::p
|
||||||
double precision,dimension(N/2)::s
|
double precision,dimension(N/2)::s
|
||||||
integer::ncount,j,idum
|
integer::ncount,j,idum
|
||||||
character(len=8)::tt
|
character(len=8)::tt
|
||||||
tt=clock()
|
tt=clock()
|
||||||
idum=iachar(tt(8:8))-48
|
idum=iachar(tt(8:8))-48
|
||||||
p=0.0
|
p=0.0
|
||||||
open(77,file='prime.dat',status='unknown')
|
open(77,file='prime.dat',status='unknown')
|
||||||
loop1:do ncount=1,N
|
loop1:do ncount=1,N
|
||||||
x=ran(idum)
|
x=ran(idum)
|
||||||
p(2*ncount-1)=x
|
p(2*ncount-1)=x
|
||||||
write(77,'(f15.3)')x
|
write(77,'(f15.3)')x
|
||||||
enddo loop1
|
enddo loop1
|
||||||
close(77)
|
close(77)
|
||||||
call four1(p,N,1)
|
call four1(p,N,1)
|
||||||
do j=1,N/2
|
do j=1,N/2
|
||||||
s(j)=p(2*j)*p(2*j)+p(2*j-1)*p(2*j-1)
|
s(j)=p(2*j)*p(2*j)+p(2*j-1)*p(2*j-1)
|
||||||
enddo
|
enddo
|
||||||
x=0.0
|
x=0.0
|
||||||
do j=1,N/2
|
do j=1,N/2
|
||||||
x=x+s(j)
|
x=x+s(j)
|
||||||
enddo
|
enddo
|
||||||
s=s/x
|
s=s/x
|
||||||
open(77,file='power.dat',status='unknown')
|
open(77,file='power.dat',status='unknown')
|
||||||
do j=1,N/2
|
do j=1,N/2
|
||||||
write(77,'(2(1x,f15.3))')dble(j-1)/dble(N),s(j)
|
write(77,'(2(1x,f15.3))')dble(j-1)/dble(N),s(j)
|
||||||
enddo
|
enddo
|
||||||
close(77)
|
close(77)
|
||||||
end program checkFFT
|
end program checkFFT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
!-------------
|
!-------------
|
||||||
! Optimized FFT using Intel oneMKL DFTI
|
! Optimized FFT using Intel oneMKL DFTI
|
||||||
! Mathematical equivalence: Standard DFT definition
|
! Mathematical equivalence: Standard DFT definition
|
||||||
! Forward (isign=1): X[k] = sum_{n=0}^{N-1} x[n] * exp(-2*pi*i*k*n/N)
|
! Forward (isign=1): X[k] = sum_{n=0}^{N-1} x[n] * exp(-2*pi*i*k*n/N)
|
||||||
! Backward (isign=-1): X[k] = sum_{n=0}^{N-1} x[n] * exp(+2*pi*i*k*n/N)
|
! Backward (isign=-1): X[k] = sum_{n=0}^{N-1} x[n] * exp(+2*pi*i*k*n/N)
|
||||||
! Input/Output: dataa is interleaved complex array [Re(0),Im(0),Re(1),Im(1),...]
|
! Input/Output: dataa is interleaved complex array [Re(0),Im(0),Re(1),Im(1),...]
|
||||||
!-------------
|
!-------------
|
||||||
SUBROUTINE four1(dataa,nn,isign)
|
SUBROUTINE four1(dataa,nn,isign)
|
||||||
use MKL_DFTI
|
use MKL_DFTI
|
||||||
implicit none
|
implicit none
|
||||||
INTEGER, intent(in) :: isign, nn
|
INTEGER, intent(in) :: isign, nn
|
||||||
DOUBLE PRECISION, dimension(2*nn), intent(inout) :: dataa
|
DOUBLE PRECISION, dimension(2*nn), intent(inout) :: dataa
|
||||||
|
|
||||||
type(DFTI_DESCRIPTOR), pointer :: desc
|
type(DFTI_DESCRIPTOR), pointer :: desc
|
||||||
integer :: status
|
integer :: status
|
||||||
|
|
||||||
! Create DFTI descriptor for 1D complex-to-complex transform
|
! Create DFTI descriptor for 1D complex-to-complex transform
|
||||||
status = DftiCreateDescriptor(desc, DFTI_DOUBLE, DFTI_COMPLEX, 1, nn)
|
status = DftiCreateDescriptor(desc, DFTI_DOUBLE, DFTI_COMPLEX, 1, nn)
|
||||||
if (status /= 0) return
|
if (status /= 0) return
|
||||||
|
|
||||||
! Set input/output storage as interleaved complex (default)
|
! Set input/output storage as interleaved complex (default)
|
||||||
status = DftiSetValue(desc, DFTI_PLACEMENT, DFTI_INPLACE)
|
status = DftiSetValue(desc, DFTI_PLACEMENT, DFTI_INPLACE)
|
||||||
if (status /= 0) then
|
if (status /= 0) then
|
||||||
status = DftiFreeDescriptor(desc)
|
status = DftiFreeDescriptor(desc)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! Commit the descriptor
|
! Commit the descriptor
|
||||||
status = DftiCommitDescriptor(desc)
|
status = DftiCommitDescriptor(desc)
|
||||||
if (status /= 0) then
|
if (status /= 0) then
|
||||||
status = DftiFreeDescriptor(desc)
|
status = DftiFreeDescriptor(desc)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! Execute FFT based on direction
|
! Execute FFT based on direction
|
||||||
if (isign == 1) then
|
if (isign == 1) then
|
||||||
! Forward FFT: exp(-2*pi*i*k*n/N)
|
! Forward FFT: exp(-2*pi*i*k*n/N)
|
||||||
status = DftiComputeForward(desc, dataa)
|
status = DftiComputeForward(desc, dataa)
|
||||||
else
|
else
|
||||||
! Backward FFT: exp(+2*pi*i*k*n/N)
|
! Backward FFT: exp(+2*pi*i*k*n/N)
|
||||||
status = DftiComputeBackward(desc, dataa)
|
status = DftiComputeBackward(desc, dataa)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! Free descriptor
|
! Free descriptor
|
||||||
status = DftiFreeDescriptor(desc)
|
status = DftiFreeDescriptor(desc)
|
||||||
|
|
||||||
return
|
return
|
||||||
END SUBROUTINE four1
|
END SUBROUTINE four1
|
||||||
@@ -1,97 +1,97 @@
|
|||||||
//$Id: IntPnts.C,v 1.1 2012/04/03 10:49:42 zjcao Exp $
|
//$Id: IntPnts.C,v 1.1 2012/04/03 10:49:42 zjcao Exp $
|
||||||
|
|
||||||
#include "macrodef.h"
|
#include "macrodef.h"
|
||||||
#ifdef With_AHF
|
#ifdef With_AHF
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "myglobal.h"
|
#include "myglobal.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
extern struct state state;
|
extern struct state state;
|
||||||
int globalInterpGFL(double *X, double *Y, double *Z, int Ns,
|
int globalInterpGFL(double *X, double *Y, double *Z, int Ns,
|
||||||
double *Data)
|
double *Data)
|
||||||
{
|
{
|
||||||
if (Ns == 0)
|
if (Ns == 0)
|
||||||
return 0;
|
return 0;
|
||||||
int n;
|
int n;
|
||||||
double *pox[3];
|
double *pox[3];
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
pox[i] = new double[Ns];
|
pox[i] = new double[Ns];
|
||||||
for (n = 0; n < Ns; n++)
|
for (n = 0; n < Ns; n++)
|
||||||
{
|
{
|
||||||
pox[0][n] = X[n];
|
pox[0][n] = X[n];
|
||||||
pox[1][n] = Y[n];
|
pox[1][n] = Y[n];
|
||||||
pox[2][n] = Z[n];
|
pox[2][n] = Z[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
const int InList = 35;
|
const int InList = 35;
|
||||||
|
|
||||||
double *datap;
|
double *datap;
|
||||||
datap = new double[Ns * InList];
|
datap = new double[Ns * InList];
|
||||||
if (!(state.ADM->AH_Interp_Points(state.AHList, Ns, pox, datap, state.Symmetry)))
|
if (!(state.ADM->AH_Interp_Points(state.AHList, Ns, pox, datap, state.Symmetry)))
|
||||||
return 0;
|
return 0;
|
||||||
// reform data
|
// reform data
|
||||||
for (int pnt = 0; pnt < Ns; pnt++)
|
for (int pnt = 0; pnt < Ns; pnt++)
|
||||||
for (int ii = 0; ii < InList; ii++)
|
for (int ii = 0; ii < InList; ii++)
|
||||||
{
|
{
|
||||||
if (ii == 0 || ii == 12 || ii == 20)
|
if (ii == 0 || ii == 12 || ii == 20)
|
||||||
Data[pnt + ii * Ns] = datap[ii + pnt * InList] + 1;
|
Data[pnt + ii * Ns] = datap[ii + pnt * InList] + 1;
|
||||||
else if (ii == 24) // from chi-1 to psi
|
else if (ii == 24) // from chi-1 to psi
|
||||||
Data[pnt + ii * Ns] = pow(datap[ii + pnt * InList] + 1, -0.25);
|
Data[pnt + ii * Ns] = pow(datap[ii + pnt * InList] + 1, -0.25);
|
||||||
else if (ii == 25 || ii == 26 || ii == 27) // from chi,i to psi,i
|
else if (ii == 25 || ii == 26 || ii == 27) // from chi,i to psi,i
|
||||||
Data[pnt + ii * Ns] = -pow(datap[24 + pnt * InList] + 1, -1.25) / 4 * datap[ii + pnt * InList];
|
Data[pnt + ii * Ns] = -pow(datap[24 + pnt * InList] + 1, -1.25) / 4 * datap[ii + pnt * InList];
|
||||||
else
|
else
|
||||||
Data[pnt + ii * Ns] = datap[ii + pnt * InList];
|
Data[pnt + ii * Ns] = datap[ii + pnt * InList];
|
||||||
}
|
}
|
||||||
delete[] datap;
|
delete[] datap;
|
||||||
|
|
||||||
delete[] pox[0];
|
delete[] pox[0];
|
||||||
delete[] pox[1];
|
delete[] pox[1];
|
||||||
delete[] pox[2];
|
delete[] pox[2];
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
// inerpolate lapse and shift
|
// inerpolate lapse and shift
|
||||||
int globalInterpGFLlash(double *X, double *Y, double *Z, int Ns,
|
int globalInterpGFLlash(double *X, double *Y, double *Z, int Ns,
|
||||||
double *Data)
|
double *Data)
|
||||||
{
|
{
|
||||||
if (Ns == 0)
|
if (Ns == 0)
|
||||||
return 0;
|
return 0;
|
||||||
int n;
|
int n;
|
||||||
double *pox[3];
|
double *pox[3];
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
pox[i] = new double[Ns];
|
pox[i] = new double[Ns];
|
||||||
for (n = 0; n < Ns; n++)
|
for (n = 0; n < Ns; n++)
|
||||||
{
|
{
|
||||||
pox[0][n] = X[n];
|
pox[0][n] = X[n];
|
||||||
pox[1][n] = Y[n];
|
pox[1][n] = Y[n];
|
||||||
pox[2][n] = Z[n];
|
pox[2][n] = Z[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
double SYM = 1.0, ANT = -1.0;
|
double SYM = 1.0, ANT = -1.0;
|
||||||
const int InList = 4;
|
const int InList = 4;
|
||||||
|
|
||||||
double *datap;
|
double *datap;
|
||||||
datap = new double[Ns * InList];
|
datap = new double[Ns * InList];
|
||||||
state.ADM->AH_Interp_Points(state.GaugeList, Ns, pox, datap, state.Symmetry);
|
state.ADM->AH_Interp_Points(state.GaugeList, Ns, pox, datap, state.Symmetry);
|
||||||
// reform data
|
// reform data
|
||||||
for (int pnt = 0; pnt < Ns; pnt++)
|
for (int pnt = 0; pnt < Ns; pnt++)
|
||||||
for (int ii = 0; ii < InList; ii++)
|
for (int ii = 0; ii < InList; ii++)
|
||||||
Data[pnt + ii * Ns] = datap[ii + pnt * InList];
|
Data[pnt + ii * Ns] = datap[ii + pnt * InList];
|
||||||
|
|
||||||
delete[] datap;
|
delete[] datap;
|
||||||
delete[] pox[0];
|
delete[] pox[0];
|
||||||
delete[] pox[1];
|
delete[] pox[1];
|
||||||
delete[] pox[2];
|
delete[] pox[2];
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif
|
#endif
|
||||||
@@ -1,43 +1,43 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
#include "myglobal.h"
|
#include "myglobal.h"
|
||||||
|
|
||||||
int CCTK_VInfo(const char *thorn, const char *format, ...)
|
int CCTK_VInfo(const char *thorn, const char *format, ...)
|
||||||
{
|
{
|
||||||
int myrank;
|
int myrank;
|
||||||
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
|
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
|
||||||
if (myrank !=0) return 0;
|
if (myrank !=0) return 0;
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start (ap, format);
|
va_start (ap, format);
|
||||||
fprintf (stdout, "INFO (%s): ", thorn);
|
fprintf (stdout, "INFO (%s): ", thorn);
|
||||||
vfprintf (stdout, format, ap);
|
vfprintf (stdout, format, ap);
|
||||||
fprintf (stdout, "\n");
|
fprintf (stdout, "\n");
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int CCTK_VWarn (int level,
|
int CCTK_VWarn (int level,
|
||||||
int line,
|
int line,
|
||||||
const char *file,
|
const char *file,
|
||||||
const char *thorn,
|
const char *thorn,
|
||||||
const char *format,
|
const char *format,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
int myrank;
|
int myrank;
|
||||||
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
|
MPI_Comm_rank(MPI_COMM_WORLD,&myrank);
|
||||||
if (myrank !=0) return 0;
|
if (myrank !=0) return 0;
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start (ap, format);
|
va_start (ap, format);
|
||||||
fprintf (stdout, "WARN (%s): ", thorn);
|
fprintf (stdout, "WARN (%s): ", thorn);
|
||||||
vfprintf (stdout, format, ap);
|
vfprintf (stdout, format, ap);
|
||||||
fprintf (stdout, "\n");
|
fprintf (stdout, "\n");
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1,270 +1,270 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "util_Table.h"
|
#include "util_Table.h"
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "fd_grid.h"
|
#include "fd_grid.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
#include "patch_edge.h"
|
#include "patch_edge.h"
|
||||||
#include "patch_interp.h"
|
#include "patch_interp.h"
|
||||||
#include "ghost_zone.h"
|
#include "ghost_zone.h"
|
||||||
#include "patch_system.h"
|
#include "patch_system.h"
|
||||||
|
|
||||||
#include "Jacobian.h"
|
#include "Jacobian.h"
|
||||||
#include "ilucg.h"
|
#include "ilucg.h"
|
||||||
// all the code in this file is inside this namespace
|
// all the code in this file is inside this namespace
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
// this represents a single element stored in the matrix for
|
// this represents a single element stored in the matrix for
|
||||||
// sort_row_into_column_order() and sort_row_into_column_order__cmp()
|
// sort_row_into_column_order() and sort_row_into_column_order__cmp()
|
||||||
struct matrix_element
|
struct matrix_element
|
||||||
{
|
{
|
||||||
int JA;
|
int JA;
|
||||||
fp A;
|
fp A;
|
||||||
};
|
};
|
||||||
|
|
||||||
Jacobian::Jacobian(patch_system &ps)
|
Jacobian::Jacobian(patch_system &ps)
|
||||||
: ps_(ps),
|
: ps_(ps),
|
||||||
N_rows_(ps.N_grid_points()),
|
N_rows_(ps.N_grid_points()),
|
||||||
N_nonzeros_(0), current_N_rows_(0), N_nonzeros_allocated_(0),
|
N_nonzeros_(0), current_N_rows_(0), N_nonzeros_allocated_(0),
|
||||||
IA_(new integer[N_rows_ + 1]), JA_(NULL), A_(NULL),
|
IA_(new integer[N_rows_ + 1]), JA_(NULL), A_(NULL),
|
||||||
itemp_(NULL), rtemp_(NULL)
|
itemp_(NULL), rtemp_(NULL)
|
||||||
{
|
{
|
||||||
IO_ = 1;
|
IO_ = 1;
|
||||||
zero_matrix();
|
zero_matrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
Jacobian::~Jacobian()
|
Jacobian::~Jacobian()
|
||||||
{
|
{
|
||||||
if (A_)
|
if (A_)
|
||||||
delete[] A_;
|
delete[] A_;
|
||||||
if (JA_)
|
if (JA_)
|
||||||
delete[] JA_;
|
delete[] JA_;
|
||||||
if (IA_)
|
if (IA_)
|
||||||
delete[] IA_;
|
delete[] IA_;
|
||||||
if (rtemp_)
|
if (rtemp_)
|
||||||
delete[] rtemp_;
|
delete[] rtemp_;
|
||||||
if (itemp_)
|
if (itemp_)
|
||||||
delete[] itemp_;
|
delete[] itemp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Jacobian::element(int II, int JJ)
|
double Jacobian::element(int II, int JJ)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
const int posn = find_element(II, JJ);
|
const int posn = find_element(II, JJ);
|
||||||
return (posn >= 0) ? A_[posn] : 0.0;
|
return (posn >= 0) ? A_[posn] : 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jacobian::zero_matrix()
|
void Jacobian::zero_matrix()
|
||||||
{
|
{
|
||||||
|
|
||||||
N_nonzeros_ = 0;
|
N_nonzeros_ = 0;
|
||||||
current_N_rows_ = 0;
|
current_N_rows_ = 0;
|
||||||
IA_[0] = IO_;
|
IA_[0] = IO_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jacobian::set_element(int II, int JJ, fp value)
|
void Jacobian::set_element(int II, int JJ, fp value)
|
||||||
{
|
{
|
||||||
const int posn = find_element(II, JJ);
|
const int posn = find_element(II, JJ);
|
||||||
if (posn >= 0)
|
if (posn >= 0)
|
||||||
then A_[posn] = value;
|
then A_[posn] = value;
|
||||||
else
|
else
|
||||||
insert_element(II, JJ, value);
|
insert_element(II, JJ, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jacobian::sum_into_element(int II, int JJ, fp value)
|
void Jacobian::sum_into_element(int II, int JJ, fp value)
|
||||||
{
|
{
|
||||||
const int posn = find_element(II, JJ);
|
const int posn = find_element(II, JJ);
|
||||||
if (posn >= 0)
|
if (posn >= 0)
|
||||||
then A_[posn] += value;
|
then A_[posn] += value;
|
||||||
else
|
else
|
||||||
insert_element(II, JJ, value);
|
insert_element(II, JJ, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Jacobian::find_element(int II, int JJ)
|
int Jacobian::find_element(int II, int JJ)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
if (II >= current_N_rows_)
|
if (II >= current_N_rows_)
|
||||||
then return -1; // this row not defined yet
|
then return -1; // this row not defined yet
|
||||||
|
|
||||||
const int start = IA_[II] - IO_;
|
const int start = IA_[II] - IO_;
|
||||||
const int stop = IA_[II + 1] - IO_;
|
const int stop = IA_[II + 1] - IO_;
|
||||||
for (int posn = start; posn < stop; ++posn)
|
for (int posn = start; posn < stop; ++posn)
|
||||||
{
|
{
|
||||||
if (JA_[posn] - IO_ == JJ)
|
if (JA_[posn] - IO_ == JJ)
|
||||||
then return posn; // found
|
then return posn; // found
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1; // not found
|
return -1; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
int Jacobian::insert_element(int II, int JJ, double value)
|
int Jacobian::insert_element(int II, int JJ, double value)
|
||||||
{
|
{
|
||||||
if (!((II == current_N_rows_ - 1) || (II == current_N_rows_)))
|
if (!((II == current_N_rows_ - 1) || (II == current_N_rows_)))
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"***** row_sparse_Jacobian::insert_element(II=%d, JJ=%d, value=%g):\n"
|
"***** row_sparse_Jacobian::insert_element(II=%d, JJ=%d, value=%g):\n"
|
||||||
" attempt to insert element elsewhere than {last row, last row+1}!\n"
|
" attempt to insert element elsewhere than {last row, last row+1}!\n"
|
||||||
" N_rows_=%d current_N_rows_=%d IO_=%d\n"
|
" N_rows_=%d current_N_rows_=%d IO_=%d\n"
|
||||||
" N_nonzeros_=%d N_nonzeros_allocated_=%d\n",
|
" N_nonzeros_=%d N_nonzeros_allocated_=%d\n",
|
||||||
II, JJ, double(value),
|
II, JJ, double(value),
|
||||||
N_rows_, current_N_rows_, IO_,
|
N_rows_, current_N_rows_, IO_,
|
||||||
N_nonzeros_, N_nonzeros_allocated_);
|
N_nonzeros_, N_nonzeros_allocated_);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
// start a new row if necessary
|
// start a new row if necessary
|
||||||
if (II == current_N_rows_)
|
if (II == current_N_rows_)
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
assert(current_N_rows_ < N_rows_);
|
assert(current_N_rows_ < N_rows_);
|
||||||
IA_[current_N_rows_ + 1] = IA_[current_N_rows_];
|
IA_[current_N_rows_ + 1] = IA_[current_N_rows_];
|
||||||
++current_N_rows_;
|
++current_N_rows_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert into current row
|
// insert into current row
|
||||||
assert(II == current_N_rows_ - 1);
|
assert(II == current_N_rows_ - 1);
|
||||||
if (IA_[II + 1] - IO_ >= N_nonzeros_allocated_)
|
if (IA_[II + 1] - IO_ >= N_nonzeros_allocated_)
|
||||||
then grow_arrays();
|
then grow_arrays();
|
||||||
const int posn = IA_[II + 1] - IO_;
|
const int posn = IA_[II + 1] - IO_;
|
||||||
assert(posn < N_nonzeros_allocated_);
|
assert(posn < N_nonzeros_allocated_);
|
||||||
JA_[posn] = JJ + IO_;
|
JA_[posn] = JJ + IO_;
|
||||||
A_[posn] = value;
|
A_[posn] = value;
|
||||||
++IA_[II + 1];
|
++IA_[II + 1];
|
||||||
++N_nonzeros_;
|
++N_nonzeros_;
|
||||||
|
|
||||||
return posn;
|
return posn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jacobian::grow_arrays()
|
void Jacobian::grow_arrays()
|
||||||
{
|
{
|
||||||
N_nonzeros_allocated_ += base_growth_amount + (N_nonzeros_allocated_ >> 1);
|
N_nonzeros_allocated_ += base_growth_amount + (N_nonzeros_allocated_ >> 1);
|
||||||
|
|
||||||
int *const new_JA = new int[N_nonzeros_allocated_];
|
int *const new_JA = new int[N_nonzeros_allocated_];
|
||||||
double *const new_A = new double[N_nonzeros_allocated_];
|
double *const new_A = new double[N_nonzeros_allocated_];
|
||||||
for (int posn = 0; posn < N_nonzeros_; ++posn)
|
for (int posn = 0; posn < N_nonzeros_; ++posn)
|
||||||
{
|
{
|
||||||
new_JA[posn] = JA_[posn];
|
new_JA[posn] = JA_[posn];
|
||||||
new_A[posn] = A_[posn];
|
new_A[posn] = A_[posn];
|
||||||
}
|
}
|
||||||
delete[] A_;
|
delete[] A_;
|
||||||
delete[] JA_;
|
delete[] JA_;
|
||||||
JA_ = new_JA;
|
JA_ = new_JA;
|
||||||
A_ = new_A;
|
A_ = new_A;
|
||||||
}
|
}
|
||||||
|
|
||||||
int compare_matrix_elements(const void *x, const void *y)
|
int compare_matrix_elements(const void *x, const void *y)
|
||||||
{
|
{
|
||||||
const struct matrix_element *const px = static_cast<const struct matrix_element *>(x);
|
const struct matrix_element *const px = static_cast<const struct matrix_element *>(x);
|
||||||
const struct matrix_element *const py = static_cast<const struct matrix_element *>(y);
|
const struct matrix_element *const py = static_cast<const struct matrix_element *>(y);
|
||||||
|
|
||||||
return px->JA - py->JA;
|
return px->JA - py->JA;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jacobian::sort_each_row_into_column_order()
|
void Jacobian::sort_each_row_into_column_order()
|
||||||
{
|
{
|
||||||
// buffer must be big enough to hold the largest row
|
// buffer must be big enough to hold the largest row
|
||||||
int max_N_in_row = 0;
|
int max_N_in_row = 0;
|
||||||
{
|
{
|
||||||
for (int II = 0; II < N_rows_; ++II)
|
for (int II = 0; II < N_rows_; ++II)
|
||||||
{
|
{
|
||||||
max_N_in_row = max(max_N_in_row, IA_[II + 1] - IA_[II]);
|
max_N_in_row = max(max_N_in_row, IA_[II + 1] - IA_[II]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// contiguous buffer for sorting
|
// contiguous buffer for sorting
|
||||||
struct matrix_element *const buffer = new struct matrix_element[max_N_in_row];
|
struct matrix_element *const buffer = new struct matrix_element[max_N_in_row];
|
||||||
|
|
||||||
{
|
{
|
||||||
for (int II = 0; II < N_rows_; ++II)
|
for (int II = 0; II < N_rows_; ++II)
|
||||||
{
|
{
|
||||||
const int N_in_row = IA_[II + 1] - IA_[II];
|
const int N_in_row = IA_[II + 1] - IA_[II];
|
||||||
|
|
||||||
// copy this row's JA_[] and A_[] values to the buffer
|
// copy this row's JA_[] and A_[] values to the buffer
|
||||||
const int start = IA_[II] - IO_;
|
const int start = IA_[II] - IO_;
|
||||||
for (int p = 0; p < N_in_row; ++p)
|
for (int p = 0; p < N_in_row; ++p)
|
||||||
{
|
{
|
||||||
const int posn = start + p;
|
const int posn = start + p;
|
||||||
buffer[p].JA = JA_[posn];
|
buffer[p].JA = JA_[posn];
|
||||||
buffer[p].A = A_[posn];
|
buffer[p].A = A_[posn];
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort the buffer
|
// sort the buffer
|
||||||
qsort(static_cast<void *>(buffer), N_in_row, sizeof(buffer[0]),
|
qsort(static_cast<void *>(buffer), N_in_row, sizeof(buffer[0]),
|
||||||
&compare_matrix_elements);
|
&compare_matrix_elements);
|
||||||
|
|
||||||
// copy the buffer values back to this row's JA_[] and A_[]
|
// copy the buffer values back to this row's JA_[] and A_[]
|
||||||
for (int p = 0; p < N_in_row; ++p)
|
for (int p = 0; p < N_in_row; ++p)
|
||||||
{
|
{
|
||||||
const int posn = start + p;
|
const int posn = start + p;
|
||||||
JA_[posn] = buffer[p].JA;
|
JA_[posn] = buffer[p].JA;
|
||||||
A_[posn] = buffer[p].A;
|
A_[posn] = buffer[p].A;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Jacobian::solve_linear_system(int rhs_gfn, int x_gfn, bool print_msg_flag)
|
double Jacobian::solve_linear_system(int rhs_gfn, int x_gfn, bool print_msg_flag)
|
||||||
{
|
{
|
||||||
assert(IO_ == Fortran_index_origin);
|
assert(IO_ == Fortran_index_origin);
|
||||||
assert(current_N_rows_ == N_rows_);
|
assert(current_N_rows_ == N_rows_);
|
||||||
|
|
||||||
if (itemp_ == NULL)
|
if (itemp_ == NULL)
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
itemp_ = new int[3 * N_rows_ + 3 * N_nonzeros_ + 2];
|
itemp_ = new int[3 * N_rows_ + 3 * N_nonzeros_ + 2];
|
||||||
rtemp_ = new double[4 * N_rows_ + N_nonzeros_];
|
rtemp_ = new double[4 * N_rows_ + N_nonzeros_];
|
||||||
}
|
}
|
||||||
|
|
||||||
// initial guess = all zeros
|
// initial guess = all zeros
|
||||||
double *x = ps_.gridfn_data(x_gfn);
|
double *x = ps_.gridfn_data(x_gfn);
|
||||||
for (int II = 0; II < N_rows_; ++II)
|
for (int II = 0; II < N_rows_; ++II)
|
||||||
{
|
{
|
||||||
x[II] = 0.0;
|
x[II] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int N = N_rows_;
|
const int N = N_rows_;
|
||||||
const double *rhs = ps_.gridfn_data(rhs_gfn);
|
const double *rhs = ps_.gridfn_data(rhs_gfn);
|
||||||
const double eps = 1e-10;
|
const double eps = 1e-10;
|
||||||
const int max_iterations = N_rows_;
|
const int max_iterations = N_rows_;
|
||||||
int istatus;
|
int istatus;
|
||||||
|
|
||||||
// the actual linear solution
|
// the actual linear solution
|
||||||
f_ilucg(N,
|
f_ilucg(N,
|
||||||
IA_, JA_, A_,
|
IA_, JA_, A_,
|
||||||
rhs, x,
|
rhs, x,
|
||||||
itemp_, rtemp_,
|
itemp_, rtemp_,
|
||||||
eps, max_iterations,
|
eps, max_iterations,
|
||||||
istatus);
|
istatus);
|
||||||
|
|
||||||
if (istatus < 0)
|
if (istatus < 0)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"***** row_sparse_Jacobian__ILUCG::solve_linear_system(rhs_gfn=%d, x_gfn=%d):\n"
|
"***** row_sparse_Jacobian__ILUCG::solve_linear_system(rhs_gfn=%d, x_gfn=%d):\n"
|
||||||
" error return from [sd]ilucg() routine!\n"
|
" error return from [sd]ilucg() routine!\n"
|
||||||
" istatus=%d < 0 ==> bad matrix structure, eg. zero diagonal element!\n",
|
" istatus=%d < 0 ==> bad matrix structure, eg. zero diagonal element!\n",
|
||||||
rhs_gfn, x_gfn,
|
rhs_gfn, x_gfn,
|
||||||
int(istatus));
|
int(istatus));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1.0;
|
return -1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,90 +1,90 @@
|
|||||||
#ifndef AHFINDERDIRECT__JACOBIAN_HH
|
#ifndef AHFINDERDIRECT__JACOBIAN_HH
|
||||||
#define AHFINDERDIRECT__JACOBIAN_HH
|
#define AHFINDERDIRECT__JACOBIAN_HH
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
class Jacobian
|
class Jacobian
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// basic meta-info
|
// basic meta-info
|
||||||
patch_system &my_patch_system() const { return ps_; }
|
patch_system &my_patch_system() const { return ps_; }
|
||||||
int N_rows() const { return N_rows_; }
|
int N_rows() const { return N_rows_; }
|
||||||
|
|
||||||
// convert (patch,irho,isigma) <--> row/column index
|
// convert (patch,irho,isigma) <--> row/column index
|
||||||
int II_of_patch_irho_isigma(const patch &p, int irho, int isigma)
|
int II_of_patch_irho_isigma(const patch &p, int irho, int isigma)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return ps_.gpn_of_patch_irho_isigma(p, irho, isigma);
|
return ps_.gpn_of_patch_irho_isigma(p, irho, isigma);
|
||||||
}
|
}
|
||||||
const patch &patch_irho_isigma_of_II(int II, int &irho, int &isigma)
|
const patch &patch_irho_isigma_of_II(int II, int &irho, int &isigma)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return ps_.patch_irho_isigma_of_gpn(II, irho, isigma);
|
return ps_.patch_irho_isigma_of_gpn(II, irho, isigma);
|
||||||
}
|
}
|
||||||
|
|
||||||
double element(int II, int JJ) const;
|
double element(int II, int JJ) const;
|
||||||
|
|
||||||
// is the matrix element (II,JJ) stored explicitly?
|
// is the matrix element (II,JJ) stored explicitly?
|
||||||
bool is_explicitly_stored(int II, int JJ) const
|
bool is_explicitly_stored(int II, int JJ) const
|
||||||
{
|
{
|
||||||
return find_element(II, JJ) > 0;
|
return find_element(II, JJ) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IO() const { return IO_; }
|
int IO() const { return IO_; }
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
C_index_origin = 0,
|
C_index_origin = 0,
|
||||||
Fortran_index_origin = 1
|
Fortran_index_origin = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
void zero_matrix();
|
void zero_matrix();
|
||||||
|
|
||||||
void set_element(int II, int JJ, fp value);
|
void set_element(int II, int JJ, fp value);
|
||||||
|
|
||||||
void sum_into_element(int II, int JJ, fp value);
|
void sum_into_element(int II, int JJ, fp value);
|
||||||
|
|
||||||
int find_element(int II, int JJ) const;
|
int find_element(int II, int JJ) const;
|
||||||
|
|
||||||
int insert_element(int II, int JJ, fp value);
|
int insert_element(int II, int JJ, fp value);
|
||||||
|
|
||||||
void grow_arrays();
|
void grow_arrays();
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
base_growth_amount = 1000
|
base_growth_amount = 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
void sort_each_row_into_column_order();
|
void sort_each_row_into_column_order();
|
||||||
|
|
||||||
double solve_linear_system(int rhs_gfn, int x_gfn,
|
double solve_linear_system(int rhs_gfn, int x_gfn,
|
||||||
bool print_msg_flag);
|
bool print_msg_flag);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Jacobian(patch_system &ps);
|
Jacobian(patch_system &ps);
|
||||||
~Jacobian();
|
~Jacobian();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
patch_system &ps_;
|
patch_system &ps_;
|
||||||
int N_rows_;
|
int N_rows_;
|
||||||
|
|
||||||
int IO_;
|
int IO_;
|
||||||
|
|
||||||
int N_nonzeros_;
|
int N_nonzeros_;
|
||||||
int current_N_rows_;
|
int current_N_rows_;
|
||||||
|
|
||||||
int N_nonzeros_allocated_;
|
int N_nonzeros_allocated_;
|
||||||
|
|
||||||
int *IA_;
|
int *IA_;
|
||||||
|
|
||||||
int *JA_;
|
int *JA_;
|
||||||
|
|
||||||
double *A_;
|
double *A_;
|
||||||
|
|
||||||
int *itemp_;
|
int *itemp_;
|
||||||
double *rtemp_;
|
double *rtemp_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* AHFINDERDIRECT__JACOBIAN_HH */
|
#endif /* AHFINDERDIRECT__JACOBIAN_HH */
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,186 +1,186 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h> // NULL
|
#include <stddef.h> // NULL
|
||||||
#include <stdlib.h> // size_t
|
#include <stdlib.h> // size_t
|
||||||
|
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
array1d<T>::array1d(int min_i_in, int max_i_in,
|
array1d<T>::array1d(int min_i_in, int max_i_in,
|
||||||
T *array_in /* = NULL */,
|
T *array_in /* = NULL */,
|
||||||
int stride_i_in /* = 0 */)
|
int stride_i_in /* = 0 */)
|
||||||
: array_(array_in),
|
: array_(array_in),
|
||||||
offset_(0), // temp value, changed below
|
offset_(0), // temp value, changed below
|
||||||
stride_i_(stride_i_in),
|
stride_i_(stride_i_in),
|
||||||
min_i_(min_i_in), max_i_(max_i_in),
|
min_i_(min_i_in), max_i_(max_i_in),
|
||||||
we_own_array_(array_in == NULL)
|
we_own_array_(array_in == NULL)
|
||||||
{
|
{
|
||||||
if (stride_i_ == 0)
|
if (stride_i_ == 0)
|
||||||
then stride_i_ = 1;
|
then stride_i_ = 1;
|
||||||
|
|
||||||
// must use unchecked subscripting here since setup isn't done yet
|
// must use unchecked subscripting here since setup isn't done yet
|
||||||
offset_ = -subscript_unchecked(min_i_); // RHS uses offset_ = 0
|
offset_ = -subscript_unchecked(min_i_); // RHS uses offset_ = 0
|
||||||
assert(subscript_unchecked(min_i_) == 0);
|
assert(subscript_unchecked(min_i_) == 0);
|
||||||
max_subscript_ = subscript_unchecked(max_i_);
|
max_subscript_ = subscript_unchecked(max_i_);
|
||||||
|
|
||||||
if (we_own_array_)
|
if (we_own_array_)
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
// allocate it
|
// allocate it
|
||||||
const int N_allocate = N_i();
|
const int N_allocate = N_i();
|
||||||
array_ = new T[N_allocate];
|
array_ = new T[N_allocate];
|
||||||
}
|
}
|
||||||
|
|
||||||
// explicitly initialize array (new[] *doesn't* do this automagically)
|
// explicitly initialize array (new[] *doesn't* do this automagically)
|
||||||
for (int i = min_i(); i <= max_i(); ++i)
|
for (int i = min_i(); i <= max_i(); ++i)
|
||||||
{
|
{
|
||||||
operator()(i) = T(0);
|
operator()(i) = T(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function destroys an array1d object.
|
// This function destroys an array1d object.
|
||||||
//
|
//
|
||||||
template <typename T>
|
template <typename T>
|
||||||
array1d<T>::~array1d()
|
array1d<T>::~array1d()
|
||||||
{
|
{
|
||||||
if (we_own_array_)
|
if (we_own_array_)
|
||||||
then delete[] array_;
|
then delete[] array_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function constructs an array2d object.
|
// This function constructs an array2d object.
|
||||||
//
|
//
|
||||||
template <typename T>
|
template <typename T>
|
||||||
array2d<T>::array2d(int min_i_in, int max_i_in,
|
array2d<T>::array2d(int min_i_in, int max_i_in,
|
||||||
int min_j_in, int max_j_in,
|
int min_j_in, int max_j_in,
|
||||||
T *array_in /* = NULL */,
|
T *array_in /* = NULL */,
|
||||||
int stride_i_in /* = 0 */, int stride_j_in /* = 0 */)
|
int stride_i_in /* = 0 */, int stride_j_in /* = 0 */)
|
||||||
: array_(array_in),
|
: array_(array_in),
|
||||||
offset_(0), // temp value, changed below
|
offset_(0), // temp value, changed below
|
||||||
stride_i_(stride_i_in), stride_j_(stride_j_in),
|
stride_i_(stride_i_in), stride_j_(stride_j_in),
|
||||||
min_i_(min_i_in), max_i_(max_i_in),
|
min_i_(min_i_in), max_i_(max_i_in),
|
||||||
min_j_(min_j_in), max_j_(max_j_in),
|
min_j_(min_j_in), max_j_(max_j_in),
|
||||||
we_own_array_(array_in == NULL)
|
we_own_array_(array_in == NULL)
|
||||||
{
|
{
|
||||||
if (stride_j_ == 0)
|
if (stride_j_ == 0)
|
||||||
then stride_j_ = 1;
|
then stride_j_ = 1;
|
||||||
if (stride_i_ == 0)
|
if (stride_i_ == 0)
|
||||||
then stride_i_ = N_j();
|
then stride_i_ = N_j();
|
||||||
|
|
||||||
// must use unchecked subscripting here since setup isn't done yet
|
// must use unchecked subscripting here since setup isn't done yet
|
||||||
offset_ = -subscript_unchecked(min_i_, min_j_); // RHS uses offset_ = 0
|
offset_ = -subscript_unchecked(min_i_, min_j_); // RHS uses offset_ = 0
|
||||||
assert(subscript_unchecked(min_i_, min_j_) == 0);
|
assert(subscript_unchecked(min_i_, min_j_) == 0);
|
||||||
max_subscript_ = subscript_unchecked(max_i_, max_j_);
|
max_subscript_ = subscript_unchecked(max_i_, max_j_);
|
||||||
|
|
||||||
if (we_own_array_)
|
if (we_own_array_)
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
// allocate it
|
// allocate it
|
||||||
const int N_allocate = N_i() * N_j();
|
const int N_allocate = N_i() * N_j();
|
||||||
array_ = new T[N_allocate];
|
array_ = new T[N_allocate];
|
||||||
}
|
}
|
||||||
|
|
||||||
// explicitly initialize array (new[] *doesn't* do this automagically)
|
// explicitly initialize array (new[] *doesn't* do this automagically)
|
||||||
for (int i = min_i(); i <= max_i(); ++i)
|
for (int i = min_i(); i <= max_i(); ++i)
|
||||||
{
|
{
|
||||||
for (int j = min_j(); j <= max_j(); ++j)
|
for (int j = min_j(); j <= max_j(); ++j)
|
||||||
{
|
{
|
||||||
operator()(i, j) = T(0);
|
operator()(i, j) = T(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function destroys an array2d object.
|
// This function destroys an array2d object.
|
||||||
//
|
//
|
||||||
template <typename T>
|
template <typename T>
|
||||||
array2d<T>::~array2d()
|
array2d<T>::~array2d()
|
||||||
{
|
{
|
||||||
if (we_own_array_)
|
if (we_own_array_)
|
||||||
then delete[] array_;
|
then delete[] array_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function constructs an array3d object.
|
// This function constructs an array3d object.
|
||||||
//
|
//
|
||||||
template <typename T>
|
template <typename T>
|
||||||
array3d<T>::array3d(int min_i_in, int max_i_in,
|
array3d<T>::array3d(int min_i_in, int max_i_in,
|
||||||
int min_j_in, int max_j_in,
|
int min_j_in, int max_j_in,
|
||||||
int min_k_in, int max_k_in,
|
int min_k_in, int max_k_in,
|
||||||
T *array_in /* = NULL */,
|
T *array_in /* = NULL */,
|
||||||
int stride_i_in /* = 0 */, int stride_j_in /* = 0 */,
|
int stride_i_in /* = 0 */, int stride_j_in /* = 0 */,
|
||||||
int stride_k_in /* = 0 */)
|
int stride_k_in /* = 0 */)
|
||||||
: array_(array_in),
|
: array_(array_in),
|
||||||
offset_(0), // temp value, changed below
|
offset_(0), // temp value, changed below
|
||||||
stride_i_(stride_i_in), stride_j_(stride_j_in),
|
stride_i_(stride_i_in), stride_j_(stride_j_in),
|
||||||
stride_k_(stride_k_in),
|
stride_k_(stride_k_in),
|
||||||
min_i_(min_i_in), max_i_(max_i_in),
|
min_i_(min_i_in), max_i_(max_i_in),
|
||||||
min_j_(min_j_in), max_j_(max_j_in),
|
min_j_(min_j_in), max_j_(max_j_in),
|
||||||
min_k_(min_k_in), max_k_(max_k_in),
|
min_k_(min_k_in), max_k_(max_k_in),
|
||||||
we_own_array_(array_in == NULL)
|
we_own_array_(array_in == NULL)
|
||||||
{
|
{
|
||||||
if (stride_k_ == 0)
|
if (stride_k_ == 0)
|
||||||
then stride_k_ = 1;
|
then stride_k_ = 1;
|
||||||
if (stride_j_ == 0)
|
if (stride_j_ == 0)
|
||||||
then stride_j_ = N_k();
|
then stride_j_ = N_k();
|
||||||
if (stride_i_ == 0)
|
if (stride_i_ == 0)
|
||||||
then stride_i_ = N_j() * N_k();
|
then stride_i_ = N_j() * N_k();
|
||||||
|
|
||||||
// must use unchecked subscripting here since setup isn't done yet
|
// must use unchecked subscripting here since setup isn't done yet
|
||||||
offset_ = -subscript_unchecked(min_i_, min_j_, min_k_); // RHS uses offset_ = 0
|
offset_ = -subscript_unchecked(min_i_, min_j_, min_k_); // RHS uses offset_ = 0
|
||||||
assert(subscript_unchecked(min_i_, min_j_, min_k_) == 0);
|
assert(subscript_unchecked(min_i_, min_j_, min_k_) == 0);
|
||||||
max_subscript_ = subscript_unchecked(max_i_, max_j_, max_k_);
|
max_subscript_ = subscript_unchecked(max_i_, max_j_, max_k_);
|
||||||
|
|
||||||
if (we_own_array_)
|
if (we_own_array_)
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
// allocate it
|
// allocate it
|
||||||
const int N_allocate = N_i() * N_j() * N_k();
|
const int N_allocate = N_i() * N_j() * N_k();
|
||||||
array_ = new T[N_allocate];
|
array_ = new T[N_allocate];
|
||||||
}
|
}
|
||||||
|
|
||||||
// explicitly initialize array (new[] *doesn't* do this automagically)
|
// explicitly initialize array (new[] *doesn't* do this automagically)
|
||||||
for (int i = min_i(); i <= max_i(); ++i)
|
for (int i = min_i(); i <= max_i(); ++i)
|
||||||
{
|
{
|
||||||
for (int j = min_j(); j <= max_j(); ++j)
|
for (int j = min_j(); j <= max_j(); ++j)
|
||||||
{
|
{
|
||||||
for (int k = min_k(); k <= max_k(); ++k)
|
for (int k = min_k(); k <= max_k(); ++k)
|
||||||
{
|
{
|
||||||
operator()(i, j, k) = T(0);
|
operator()(i, j, k) = T(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// This function destroys an array3d object.
|
// This function destroys an array3d object.
|
||||||
//
|
//
|
||||||
template <typename T>
|
template <typename T>
|
||||||
array3d<T>::~array3d()
|
array3d<T>::~array3d()
|
||||||
{
|
{
|
||||||
if (we_own_array_)
|
if (we_own_array_)
|
||||||
then delete[] array_;
|
then delete[] array_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template class array1d<int>;
|
template class array1d<int>;
|
||||||
|
|
||||||
// FIXME: we shouldn't have to instantiate these both, the const one
|
// FIXME: we shouldn't have to instantiate these both, the const one
|
||||||
// is actually trivially derivable from the non-const one. :(
|
// is actually trivially derivable from the non-const one. :(
|
||||||
template class array1d<void *>;
|
template class array1d<void *>;
|
||||||
template class array1d<const void *>;
|
template class array1d<const void *>;
|
||||||
|
|
||||||
template class array1d<CCTK_REAL>;
|
template class array1d<CCTK_REAL>;
|
||||||
template class array2d<CCTK_INT>;
|
template class array2d<CCTK_INT>;
|
||||||
template class array2d<CCTK_REAL>;
|
template class array2d<CCTK_REAL>;
|
||||||
template class array3d<CCTK_REAL>;
|
template class array3d<CCTK_REAL>;
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,292 +1,292 @@
|
|||||||
#ifndef AHFINDERDIRECT__ARRAY_HH
|
#ifndef AHFINDERDIRECT__ARRAY_HH
|
||||||
#define AHFINDERDIRECT__ARRAY_HH
|
#define AHFINDERDIRECT__ARRAY_HH
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class array1d
|
class array1d
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int min_i() const { return min_i_; }
|
int min_i() const { return min_i_; }
|
||||||
int max_i() const { return max_i_; }
|
int max_i() const { return max_i_; }
|
||||||
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
|
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
|
||||||
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
|
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
|
||||||
|
|
||||||
int subscript_unchecked(int i) const
|
int subscript_unchecked(int i) const
|
||||||
{
|
{
|
||||||
return offset_ + stride_i_ * i;
|
return offset_ + stride_i_ * i;
|
||||||
}
|
}
|
||||||
int subscript(int i) const
|
int subscript(int i) const
|
||||||
{
|
{
|
||||||
assert(is_valid_i(i));
|
assert(is_valid_i(i));
|
||||||
const int posn = subscript_unchecked(i);
|
const int posn = subscript_unchecked(i);
|
||||||
assert(posn >= 0);
|
assert(posn >= 0);
|
||||||
assert(posn <= max_subscript_);
|
assert(posn <= max_subscript_);
|
||||||
return posn;
|
return posn;
|
||||||
}
|
}
|
||||||
int subscript_offset() const { return offset_; }
|
int subscript_offset() const { return offset_; }
|
||||||
int subscript_stride_i() const { return stride_i_; }
|
int subscript_stride_i() const { return stride_i_; }
|
||||||
|
|
||||||
// normal-use access functions
|
// normal-use access functions
|
||||||
// ... rvalue
|
// ... rvalue
|
||||||
const T &operator()(int i) const { return array_[subscript(i)]; }
|
const T &operator()(int i) const { return array_[subscript(i)]; }
|
||||||
// ... lvalue
|
// ... lvalue
|
||||||
T &operator()(int i) { return array_[subscript(i)]; }
|
T &operator()(int i) { return array_[subscript(i)]; }
|
||||||
|
|
||||||
// get access to internal 0-origin 1D storage array
|
// get access to internal 0-origin 1D storage array
|
||||||
// (low-level, dangerous, use with caution!)
|
// (low-level, dangerous, use with caution!)
|
||||||
// ... semantics of N_array() may not be what you want
|
// ... semantics of N_array() may not be what you want
|
||||||
// if strides specify noncontiguous storage
|
// if strides specify noncontiguous storage
|
||||||
int N_array() const { return max_subscript_ + stride_i_; }
|
int N_array() const { return max_subscript_ + stride_i_; }
|
||||||
const T *data_array() const { return const_cast<const T *>(array_); }
|
const T *data_array() const { return const_cast<const T *>(array_); }
|
||||||
T *data_array() { return array_; }
|
T *data_array() { return array_; }
|
||||||
|
|
||||||
// constructor, destructor
|
// constructor, destructor
|
||||||
// ... constructor initializes all array elements to T(0.0)
|
// ... constructor initializes all array elements to T(0.0)
|
||||||
// ... omitted strides default to C storage order
|
// ... omitted strides default to C storage order
|
||||||
array1d(int min_i_in, int max_i_in,
|
array1d(int min_i_in, int max_i_in,
|
||||||
T *array_in = NULL, // caller-provided storage array
|
T *array_in = NULL, // caller-provided storage array
|
||||||
// if non-NULL
|
// if non-NULL
|
||||||
int stride_i_in = 0);
|
int stride_i_in = 0);
|
||||||
~array1d();
|
~array1d();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// we forbid copying and passing by value
|
// we forbid copying and passing by value
|
||||||
// by declaring the copy constructor and assignment operator
|
// by declaring the copy constructor and assignment operator
|
||||||
// private, but never defining them
|
// private, but never defining them
|
||||||
array1d(const array1d<T> &rhs);
|
array1d(const array1d<T> &rhs);
|
||||||
array1d<T> &operator=(const array1d<T> &rhs);
|
array1d<T> &operator=(const array1d<T> &rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// n.b. we declare the array pointer first in the class
|
// n.b. we declare the array pointer first in the class
|
||||||
// ==> it's probably at 0 offset
|
// ==> it's probably at 0 offset
|
||||||
// ==> we may get slightly faster array access
|
// ==> we may get slightly faster array access
|
||||||
T *array_; // --> new-allocated 1D storage array
|
T *array_; // --> new-allocated 1D storage array
|
||||||
|
|
||||||
// subscripting info
|
// subscripting info
|
||||||
// n.b. put this next in class so it should be in the same
|
// n.b. put this next in class so it should be in the same
|
||||||
// cpu cache line as array_ ==> faster array access
|
// cpu cache line as array_ ==> faster array access
|
||||||
int offset_, stride_i_;
|
int offset_, stride_i_;
|
||||||
|
|
||||||
// min/max array bounds
|
// min/max array bounds
|
||||||
const int min_i_, max_i_;
|
const int min_i_, max_i_;
|
||||||
int max_subscript_;
|
int max_subscript_;
|
||||||
|
|
||||||
// n.b. put this at end of class since performance doesn't matter
|
// n.b. put this at end of class since performance doesn't matter
|
||||||
bool we_own_array_; // true ==> array_ --> new[] array which we own
|
bool we_own_array_; // true ==> array_ --> new[] array which we own
|
||||||
// false ==> array_ --> client-owned storage
|
// false ==> array_ --> client-owned storage
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class array2d
|
class array2d
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// array info
|
// array info
|
||||||
int min_i() const { return min_i_; }
|
int min_i() const { return min_i_; }
|
||||||
int max_i() const { return max_i_; }
|
int max_i() const { return max_i_; }
|
||||||
int min_j() const { return min_j_; }
|
int min_j() const { return min_j_; }
|
||||||
int max_j() const { return max_j_; }
|
int max_j() const { return max_j_; }
|
||||||
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
|
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
|
||||||
int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
|
int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
|
||||||
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
|
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
|
||||||
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
|
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
|
||||||
bool is_valid_ij(int i, int j) const
|
bool is_valid_ij(int i, int j) const
|
||||||
{
|
{
|
||||||
return is_valid_i(i) && is_valid_j(j);
|
return is_valid_i(i) && is_valid_j(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
int subscript_unchecked(int i, int j) const
|
int subscript_unchecked(int i, int j) const
|
||||||
{
|
{
|
||||||
return offset_ + stride_i_ * i + stride_j_ * j;
|
return offset_ + stride_i_ * i + stride_j_ * j;
|
||||||
}
|
}
|
||||||
int subscript(int i, int j) const
|
int subscript(int i, int j) const
|
||||||
{
|
{
|
||||||
// n.b. we want each assert() here to be on a separate
|
// n.b. we want each assert() here to be on a separate
|
||||||
// source line, so an assert() failure message can
|
// source line, so an assert() failure message can
|
||||||
// pinpoint *which* index is bad
|
// pinpoint *which* index is bad
|
||||||
assert(is_valid_i(i));
|
assert(is_valid_i(i));
|
||||||
assert(is_valid_j(j));
|
assert(is_valid_j(j));
|
||||||
const int posn = subscript_unchecked(i, j);
|
const int posn = subscript_unchecked(i, j);
|
||||||
assert(posn >= 0);
|
assert(posn >= 0);
|
||||||
assert(posn <= max_subscript_);
|
assert(posn <= max_subscript_);
|
||||||
return posn;
|
return posn;
|
||||||
}
|
}
|
||||||
int subscript_offset() const { return offset_; }
|
int subscript_offset() const { return offset_; }
|
||||||
int subscript_stride_i() const { return stride_i_; }
|
int subscript_stride_i() const { return stride_i_; }
|
||||||
int subscript_stride_j() const { return stride_j_; }
|
int subscript_stride_j() const { return stride_j_; }
|
||||||
|
|
||||||
// normal-use access functions
|
// normal-use access functions
|
||||||
// ... rvalue
|
// ... rvalue
|
||||||
const T &operator()(int i, int j) const
|
const T &operator()(int i, int j) const
|
||||||
{
|
{
|
||||||
return array_[subscript(i, j)];
|
return array_[subscript(i, j)];
|
||||||
}
|
}
|
||||||
// ... lvalue
|
// ... lvalue
|
||||||
T &operator()(int i, int j)
|
T &operator()(int i, int j)
|
||||||
{
|
{
|
||||||
return array_[subscript(i, j)];
|
return array_[subscript(i, j)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// get access to internal 0-origin 1D storage array
|
// get access to internal 0-origin 1D storage array
|
||||||
// (low-level, dangerous, use with caution!)
|
// (low-level, dangerous, use with caution!)
|
||||||
// ... semantics of N_array() may not be what you want
|
// ... semantics of N_array() may not be what you want
|
||||||
// if strides specify noncontiguous storage
|
// if strides specify noncontiguous storage
|
||||||
int N_array() const { return max_subscript_ + stride_j_; }
|
int N_array() const { return max_subscript_ + stride_j_; }
|
||||||
const T *data_array() const { return const_cast<const T *>(array_); }
|
const T *data_array() const { return const_cast<const T *>(array_); }
|
||||||
T *data_array() { return array_; }
|
T *data_array() { return array_; }
|
||||||
|
|
||||||
// constructor, destructor
|
// constructor, destructor
|
||||||
// ... constructor initializes all array elements to T(0.0)
|
// ... constructor initializes all array elements to T(0.0)
|
||||||
// ... omitted strides default to C storage order
|
// ... omitted strides default to C storage order
|
||||||
array2d(int min_i_in, int max_i_in,
|
array2d(int min_i_in, int max_i_in,
|
||||||
int min_j_in, int max_j_in,
|
int min_j_in, int max_j_in,
|
||||||
T *array_in = NULL, // caller-provided storage array
|
T *array_in = NULL, // caller-provided storage array
|
||||||
// if non-NULL
|
// if non-NULL
|
||||||
int stride_i_in = 0, int stride_j_in = 0);
|
int stride_i_in = 0, int stride_j_in = 0);
|
||||||
~array2d();
|
~array2d();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// we forbid copying and passing by value
|
// we forbid copying and passing by value
|
||||||
// by declaring the copy constructor and assignment operator
|
// by declaring the copy constructor and assignment operator
|
||||||
// private, but never defining them
|
// private, but never defining them
|
||||||
array2d(const array2d<T> &rhs);
|
array2d(const array2d<T> &rhs);
|
||||||
array2d<T> &operator=(const array2d<T> &rhs);
|
array2d<T> &operator=(const array2d<T> &rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// n.b. we declare the array pointer first in the class
|
// n.b. we declare the array pointer first in the class
|
||||||
// ==> it's probably at 0 offset
|
// ==> it's probably at 0 offset
|
||||||
// ==> we may get slightly faster array access
|
// ==> we may get slightly faster array access
|
||||||
T *array_; // --> new-allocated 1D storage array
|
T *array_; // --> new-allocated 1D storage array
|
||||||
|
|
||||||
// subscripting info
|
// subscripting info
|
||||||
// n.b. put this next in class so it should be in the same
|
// n.b. put this next in class so it should be in the same
|
||||||
// cpu cache line as array_ ==> faster array access
|
// cpu cache line as array_ ==> faster array access
|
||||||
int offset_, stride_i_, stride_j_;
|
int offset_, stride_i_, stride_j_;
|
||||||
|
|
||||||
// min/max array bounds
|
// min/max array bounds
|
||||||
const int min_i_, max_i_;
|
const int min_i_, max_i_;
|
||||||
const int min_j_, max_j_;
|
const int min_j_, max_j_;
|
||||||
int max_subscript_;
|
int max_subscript_;
|
||||||
|
|
||||||
// n.b. put this at end of class since performance doesn't matter
|
// n.b. put this at end of class since performance doesn't matter
|
||||||
bool we_own_array_; // true ==> array_ --> new[] array which we own
|
bool we_own_array_; // true ==> array_ --> new[] array which we own
|
||||||
// false ==> array_ --> client-owned storage
|
// false ==> array_ --> client-owned storage
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class array3d
|
class array3d
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// array info
|
// array info
|
||||||
int min_i() const { return min_i_; }
|
int min_i() const { return min_i_; }
|
||||||
int max_i() const { return max_i_; }
|
int max_i() const { return max_i_; }
|
||||||
int min_j() const { return min_j_; }
|
int min_j() const { return min_j_; }
|
||||||
int max_j() const { return max_j_; }
|
int max_j() const { return max_j_; }
|
||||||
int min_k() const { return min_k_; }
|
int min_k() const { return min_k_; }
|
||||||
int max_k() const { return max_k_; }
|
int max_k() const { return max_k_; }
|
||||||
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
|
int N_i() const { return jtutil::how_many_in_range(min_i_, max_i_); }
|
||||||
int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
|
int N_j() const { return jtutil::how_many_in_range(min_j_, max_j_); }
|
||||||
int N_k() const { return jtutil::how_many_in_range(min_k_, max_k_); }
|
int N_k() const { return jtutil::how_many_in_range(min_k_, max_k_); }
|
||||||
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
|
bool is_valid_i(int i) const { return (i >= min_i_) && (i <= max_i_); }
|
||||||
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
|
bool is_valid_j(int j) const { return (j >= min_j_) && (j <= max_j_); }
|
||||||
bool is_valid_k(int k) const { return (k >= min_k_) && (k <= max_k_); }
|
bool is_valid_k(int k) const { return (k >= min_k_) && (k <= max_k_); }
|
||||||
bool is_valid_ijk(int i, int j, int k) const
|
bool is_valid_ijk(int i, int j, int k) const
|
||||||
{
|
{
|
||||||
return is_valid_i(i) && is_valid_j(j) && is_valid_k(k);
|
return is_valid_i(i) && is_valid_j(j) && is_valid_k(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
int subscript_unchecked(int i, int j, int k) const
|
int subscript_unchecked(int i, int j, int k) const
|
||||||
{
|
{
|
||||||
return offset_ + stride_i_ * i + stride_j_ * j + stride_k_ * k;
|
return offset_ + stride_i_ * i + stride_j_ * j + stride_k_ * k;
|
||||||
}
|
}
|
||||||
int subscript(int i, int j, int k) const
|
int subscript(int i, int j, int k) const
|
||||||
{
|
{
|
||||||
// n.b. we want each assert() here to be on a separate
|
// n.b. we want each assert() here to be on a separate
|
||||||
// source line, so an assert() failure message can
|
// source line, so an assert() failure message can
|
||||||
// pinpoint *which* index is bad
|
// pinpoint *which* index is bad
|
||||||
assert(is_valid_i(i));
|
assert(is_valid_i(i));
|
||||||
assert(is_valid_j(j));
|
assert(is_valid_j(j));
|
||||||
assert(is_valid_k(k));
|
assert(is_valid_k(k));
|
||||||
const int posn = subscript_unchecked(i, j, k);
|
const int posn = subscript_unchecked(i, j, k);
|
||||||
assert(posn >= 0);
|
assert(posn >= 0);
|
||||||
assert(posn <= max_subscript_);
|
assert(posn <= max_subscript_);
|
||||||
return posn;
|
return posn;
|
||||||
}
|
}
|
||||||
int subscript_offset() const { return offset_; }
|
int subscript_offset() const { return offset_; }
|
||||||
int subscript_stride_i() const { return stride_i_; }
|
int subscript_stride_i() const { return stride_i_; }
|
||||||
int subscript_stride_j() const { return stride_j_; }
|
int subscript_stride_j() const { return stride_j_; }
|
||||||
int subscript_stride_k() const { return stride_k_; }
|
int subscript_stride_k() const { return stride_k_; }
|
||||||
|
|
||||||
// normal-use access functions
|
// normal-use access functions
|
||||||
// ... rvalue
|
// ... rvalue
|
||||||
const T &operator()(int i, int j, int k) const
|
const T &operator()(int i, int j, int k) const
|
||||||
{
|
{
|
||||||
return array_[subscript(i, j, k)];
|
return array_[subscript(i, j, k)];
|
||||||
}
|
}
|
||||||
// ... lvalue
|
// ... lvalue
|
||||||
T &operator()(int i, int j, int k)
|
T &operator()(int i, int j, int k)
|
||||||
{
|
{
|
||||||
return array_[subscript(i, j, k)];
|
return array_[subscript(i, j, k)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// get access to internal 0-origin 1D storage array
|
// get access to internal 0-origin 1D storage array
|
||||||
// (low-level, dangerous, use with caution!)
|
// (low-level, dangerous, use with caution!)
|
||||||
// ... semantics of N_array() may not be what you want
|
// ... semantics of N_array() may not be what you want
|
||||||
// if strides specify noncontiguous storage
|
// if strides specify noncontiguous storage
|
||||||
int N_array() const { return max_subscript_ + stride_k_; }
|
int N_array() const { return max_subscript_ + stride_k_; }
|
||||||
const T *data_array() const { return const_cast<const T *>(array_); }
|
const T *data_array() const { return const_cast<const T *>(array_); }
|
||||||
T *data_array() { return array_; }
|
T *data_array() { return array_; }
|
||||||
|
|
||||||
// constructor, destructor
|
// constructor, destructor
|
||||||
// ... constructor initializes all array elements to T(0.0)
|
// ... constructor initializes all array elements to T(0.0)
|
||||||
// ... omitted strides default to C storage order
|
// ... omitted strides default to C storage order
|
||||||
array3d(int min_i_in, int max_i_in,
|
array3d(int min_i_in, int max_i_in,
|
||||||
int min_j_in, int max_j_in,
|
int min_j_in, int max_j_in,
|
||||||
int min_k_in, int max_k_in,
|
int min_k_in, int max_k_in,
|
||||||
T *array_in = NULL, // caller-provided storage array
|
T *array_in = NULL, // caller-provided storage array
|
||||||
// if non-NULL
|
// if non-NULL
|
||||||
int stride_i_in = 0, int stride_j_in = 0, int stride_k_in = 0);
|
int stride_i_in = 0, int stride_j_in = 0, int stride_k_in = 0);
|
||||||
~array3d();
|
~array3d();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// we forbid copying and passing by value
|
// we forbid copying and passing by value
|
||||||
// by declaring the copy constructor and assignment operator
|
// by declaring the copy constructor and assignment operator
|
||||||
// private, but never defining them
|
// private, but never defining them
|
||||||
array3d(const array3d<T> &rhs);
|
array3d(const array3d<T> &rhs);
|
||||||
array3d<T> &operator=(const array3d<T> &rhs);
|
array3d<T> &operator=(const array3d<T> &rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// n.b. we declare the array pointer first in the class
|
// n.b. we declare the array pointer first in the class
|
||||||
// ==> it's probably at 0 offset
|
// ==> it's probably at 0 offset
|
||||||
// ==> we may get slightly faster array access
|
// ==> we may get slightly faster array access
|
||||||
T *array_; // --> new-allocated 1D storage array
|
T *array_; // --> new-allocated 1D storage array
|
||||||
|
|
||||||
// subscripting info
|
// subscripting info
|
||||||
// n.b. put this next in class so it should be in the same
|
// n.b. put this next in class so it should be in the same
|
||||||
// cpu cache line as array_ ==> faster array access
|
// cpu cache line as array_ ==> faster array access
|
||||||
int offset_, stride_i_, stride_j_, stride_k_;
|
int offset_, stride_i_, stride_j_, stride_k_;
|
||||||
|
|
||||||
// min/max array bounds
|
// min/max array bounds
|
||||||
const int min_i_, max_i_;
|
const int min_i_, max_i_;
|
||||||
const int min_j_, max_j_;
|
const int min_j_, max_j_;
|
||||||
const int min_k_, max_k_;
|
const int min_k_, max_k_;
|
||||||
int max_subscript_;
|
int max_subscript_;
|
||||||
|
|
||||||
// n.b. put this at end of class since performance doesn't matter
|
// n.b. put this at end of class since performance doesn't matter
|
||||||
bool we_own_array_; // true ==> array_ --> new[] array which we own
|
bool we_own_array_; // true ==> array_ --> new[] array which we own
|
||||||
// false ==> array_ --> client-owned storage
|
// false ==> array_ --> client-owned storage
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
|
|
||||||
#endif /* AHFINDERDIRECT__ARRAY_HH */
|
#endif /* AHFINDERDIRECT__ARRAY_HH */
|
||||||
@@ -1,58 +1,58 @@
|
|||||||
#ifndef _CCTK_H_
|
#ifndef _CCTK_H_
|
||||||
#define _CCTK_H_ 1
|
#define _CCTK_H_ 1
|
||||||
|
|
||||||
/* Grab the main configuration info. */
|
/* Grab the main configuration info. */
|
||||||
#include "cctk_Config.h"
|
#include "cctk_Config.h"
|
||||||
|
|
||||||
#define CCTK_THORNSTRING "AHFinderDirect"
|
#define CCTK_THORNSTRING "AHFinderDirect"
|
||||||
|
|
||||||
/* Include the constants */
|
/* Include the constants */
|
||||||
#include "cctk_Constants.h"
|
#include "cctk_Constants.h"
|
||||||
|
|
||||||
/* get the definition of ptrdiff_t */
|
/* get the definition of ptrdiff_t */
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
int CCTK_VInfo(const char *thorn, const char *format, ...);
|
int CCTK_VInfo(const char *thorn, const char *format, ...);
|
||||||
int CCTK_VWarn(int level,
|
int CCTK_VWarn(int level,
|
||||||
int line,
|
int line,
|
||||||
const char *file,
|
const char *file,
|
||||||
const char *thorn,
|
const char *thorn,
|
||||||
const char *format,
|
const char *format,
|
||||||
...);
|
...);
|
||||||
#define CCTK_ERROR_INTERP_GHOST_SIZE_TOO_SMALL (-1001)
|
#define CCTK_ERROR_INTERP_GHOST_SIZE_TOO_SMALL (-1001)
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define HAVE_INLINE
|
#define HAVE_INLINE
|
||||||
#else
|
#else
|
||||||
#ifndef inline
|
#ifndef inline
|
||||||
#define HAVE_INLINE
|
#define HAVE_INLINE
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CCTK_PRINTSEPARATOR \
|
#define CCTK_PRINTSEPARATOR \
|
||||||
printf("--------------------------------------------------------------------------------\n");
|
printf("--------------------------------------------------------------------------------\n");
|
||||||
|
|
||||||
#define _DECLARE_CCTK_ARGUMENTS _DECLARE_CCTK_CARGUMENTS
|
#define _DECLARE_CCTK_ARGUMENTS _DECLARE_CCTK_CARGUMENTS
|
||||||
#define _DECLARE_CCTK_CARGUMENTS \
|
#define _DECLARE_CCTK_CARGUMENTS \
|
||||||
ptrdiff_t cctki_dummy_int; \
|
ptrdiff_t cctki_dummy_int; \
|
||||||
CCTK_REAL cctk_time = cctkGH->PhysTime; \
|
CCTK_REAL cctk_time = cctkGH->PhysTime; \
|
||||||
int cctk_iteration = 1; \
|
int cctk_iteration = 1; \
|
||||||
int cctk_dim = 3;
|
int cctk_dim = 3;
|
||||||
|
|
||||||
#define CCTK_EQUALS(a, b) (CCTK_Equals((a), (b)))
|
#define CCTK_EQUALS(a, b) (CCTK_Equals((a), (b)))
|
||||||
|
|
||||||
#define CCTK_PASS_CTOC cctkGH
|
#define CCTK_PASS_CTOC cctkGH
|
||||||
|
|
||||||
#define CCTK_ORIGIN_SPACE(x) (cctk_origin_space[x] + cctk_delta_space[x] / cctk_levfac[x] * cctk_levoff[x] / cctk_levoffdenom[x])
|
#define CCTK_ORIGIN_SPACE(x) (cctk_origin_space[x] + cctk_delta_space[x] / cctk_levfac[x] * cctk_levoff[x] / cctk_levoffdenom[x])
|
||||||
#define CCTK_DELTA_SPACE(x) (cctk_delta_space[x] / cctk_levfac[x])
|
#define CCTK_DELTA_SPACE(x) (cctk_delta_space[x] / cctk_levfac[x])
|
||||||
#define CCTK_DELTA_TIME (cctk_delta_time / cctk_timefac)
|
#define CCTK_DELTA_TIME (cctk_delta_time / cctk_timefac)
|
||||||
#define CCTK_LSSH(stag, dim) cctk_lssh[(stag) + CCTK_NSTAGGER * (dim)]
|
#define CCTK_LSSH(stag, dim) cctk_lssh[(stag) + CCTK_NSTAGGER * (dim)]
|
||||||
#define CCTK_LSSH_IDX(stag, dim) ((stag) + CCTK_NSTAGGER * (dim))
|
#define CCTK_LSSH_IDX(stag, dim) ((stag) + CCTK_NSTAGGER * (dim))
|
||||||
|
|
||||||
#define CCTK_WARN(a, b) CCTK_Warn(a, __LINE__, __FILE__, CCTK_THORNSTRING, b)
|
#define CCTK_WARN(a, b) CCTK_Warn(a, __LINE__, __FILE__, CCTK_THORNSTRING, b)
|
||||||
|
|
||||||
#define CCTK_MALLOC(s) CCTKi_Malloc(s, __LINE__, __FILE__)
|
#define CCTK_MALLOC(s) CCTKi_Malloc(s, __LINE__, __FILE__)
|
||||||
#define CCTK_FREE(p) CCTKi_Free(p)
|
#define CCTK_FREE(p) CCTKi_Free(p)
|
||||||
|
|
||||||
#define CCTK_INFO(a) CCTK_Info(CCTK_THORNSTRING, (a))
|
#define CCTK_INFO(a) CCTK_Info(CCTK_THORNSTRING, (a))
|
||||||
#define CCTK_PARAMWARN(a) CCTK_ParamWarn(CCTK_THORNSTRING, (a))
|
#define CCTK_PARAMWARN(a) CCTK_ParamWarn(CCTK_THORNSTRING, (a))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -1,168 +1,168 @@
|
|||||||
#ifndef _CCTK_CONFIG_H_
|
#ifndef _CCTK_CONFIG_H_
|
||||||
#define _CCTK_CONFIG_H_
|
#define _CCTK_CONFIG_H_
|
||||||
|
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
|
|
||||||
#define CCTK_FCALL
|
#define CCTK_FCALL
|
||||||
|
|
||||||
#define HAVE_GETHOSTBYNAME 1
|
#define HAVE_GETHOSTBYNAME 1
|
||||||
#define HAVE_GETOPT_LONG_ONLY 1
|
#define HAVE_GETOPT_LONG_ONLY 1
|
||||||
#define HAVE_CRYPT 1
|
#define HAVE_CRYPT 1
|
||||||
#define HAVE_FINITE 1
|
#define HAVE_FINITE 1
|
||||||
#define HAVE_ISNAN 1
|
#define HAVE_ISNAN 1
|
||||||
#define HAVE_ISINF 1
|
#define HAVE_ISINF 1
|
||||||
#define HAVE_MKSTEMP 1
|
#define HAVE_MKSTEMP 1
|
||||||
#define HAVE_VA_COPY 1
|
#define HAVE_VA_COPY 1
|
||||||
|
|
||||||
/* Do we have mode_t ? */
|
/* Do we have mode_t ? */
|
||||||
#define HAVE_MODE_T 1
|
#define HAVE_MODE_T 1
|
||||||
|
|
||||||
#define HAVE_SOCKLEN_T 1
|
#define HAVE_SOCKLEN_T 1
|
||||||
#ifdef HAVE_SOCKLEN_T
|
#ifdef HAVE_SOCKLEN_T
|
||||||
# define CCTK_SOCKLEN_T socklen_t
|
# define CCTK_SOCKLEN_T socklen_t
|
||||||
#else
|
#else
|
||||||
# define CCTK_SOCKLEN_T int
|
# define CCTK_SOCKLEN_T int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAVE_TIME_H 1
|
#define HAVE_TIME_H 1
|
||||||
#define HAVE_SYS_IOCTL_H 1
|
#define HAVE_SYS_IOCTL_H 1
|
||||||
#define HAVE_SYS_SOCKET_H 1
|
#define HAVE_SYS_SOCKET_H 1
|
||||||
#define HAVE_SYS_TIME_H 1
|
#define HAVE_SYS_TIME_H 1
|
||||||
#define HAVE_SYS_TYPES_H 1
|
#define HAVE_SYS_TYPES_H 1
|
||||||
#define HAVE_UNISTD_H 1
|
#define HAVE_UNISTD_H 1
|
||||||
#define HAVE_STRING_H 1
|
#define HAVE_STRING_H 1
|
||||||
#define HAVE_ASSERT_H 1
|
#define HAVE_ASSERT_H 1
|
||||||
#define HAVE_TGMATH_H 1
|
#define HAVE_TGMATH_H 1
|
||||||
#define HAVE_SYS_STAT_H 1
|
#define HAVE_SYS_STAT_H 1
|
||||||
#define HAVE_GETOPT_H 1
|
#define HAVE_GETOPT_H 1
|
||||||
#define HAVE_REGEX_H 1
|
#define HAVE_REGEX_H 1
|
||||||
#define HAVE_NETINET_IN_H 1
|
#define HAVE_NETINET_IN_H 1
|
||||||
#define HAVE_NETDB_H 1
|
#define HAVE_NETDB_H 1
|
||||||
#define HAVE_ARPA_INET_H 1
|
#define HAVE_ARPA_INET_H 1
|
||||||
#define HAVE_CRYPT_H 1
|
#define HAVE_CRYPT_H 1
|
||||||
#define HAVE_DIRENT_H 1
|
#define HAVE_DIRENT_H 1
|
||||||
#define HAVE_SIGNAL_H 1
|
#define HAVE_SIGNAL_H 1
|
||||||
#define HAVE_MALLOC_H 1
|
#define HAVE_MALLOC_H 1
|
||||||
#define HAVE_MALLINFO 1
|
#define HAVE_MALLINFO 1
|
||||||
#define HAVE_MALLOPT 1
|
#define HAVE_MALLOPT 1
|
||||||
#define HAVE_M_MMAP_THRESHOLD_VALUE 1
|
#define HAVE_M_MMAP_THRESHOLD_VALUE 1
|
||||||
|
|
||||||
#define TIME_WITH_SYS_TIME 1
|
#define TIME_WITH_SYS_TIME 1
|
||||||
|
|
||||||
#define HAVE_VECTOR 1
|
#define HAVE_VECTOR 1
|
||||||
#define HAVE_VECTOR_H 1
|
#define HAVE_VECTOR_H 1
|
||||||
|
|
||||||
#define GETTIMEOFDAY_NEEDS_TIMEZONE 1
|
#define GETTIMEOFDAY_NEEDS_TIMEZONE 1
|
||||||
|
|
||||||
#define CCTK_CACHELINE_BYTES 64
|
#define CCTK_CACHELINE_BYTES 64
|
||||||
#define CCTK_CACHE_SIZE 1024*1024
|
#define CCTK_CACHE_SIZE 1024*1024
|
||||||
|
|
||||||
#define NULL_DEVICE "/dev/null"
|
#define NULL_DEVICE "/dev/null"
|
||||||
|
|
||||||
#define CCTK_BUILD_OS "linux-gnu"
|
#define CCTK_BUILD_OS "linux-gnu"
|
||||||
#define CCTK_BUILD_CPU "x86_64"
|
#define CCTK_BUILD_CPU "x86_64"
|
||||||
#define CCTK_BUILD_VENDOR "unknown"
|
#define CCTK_BUILD_VENDOR "unknown"
|
||||||
|
|
||||||
#define SIZEOF_SHORT_INT 2
|
#define SIZEOF_SHORT_INT 2
|
||||||
#define SIZEOF_INT 4
|
#define SIZEOF_INT 4
|
||||||
#define SIZEOF_LONG_INT 8
|
#define SIZEOF_LONG_INT 8
|
||||||
#define SIZEOF_LONG_LONG 8
|
#define SIZEOF_LONG_LONG 8
|
||||||
#define SIZEOF_LONG_DOUBLE 16
|
#define SIZEOF_LONG_DOUBLE 16
|
||||||
#define SIZEOF_DOUBLE 8
|
#define SIZEOF_DOUBLE 8
|
||||||
#define SIZEOF_FLOAT 4
|
#define SIZEOF_FLOAT 4
|
||||||
#define SIZEOF_CHAR_P 8
|
#define SIZEOF_CHAR_P 8
|
||||||
|
|
||||||
#define CCTK_REAL_PRECISION_8 1
|
#define CCTK_REAL_PRECISION_8 1
|
||||||
|
|
||||||
#define CCTK_INTEGER_PRECISION_4 1
|
#define CCTK_INTEGER_PRECISION_4 1
|
||||||
|
|
||||||
#define HAVE_CCTK_INT8 1
|
#define HAVE_CCTK_INT8 1
|
||||||
#define HAVE_CCTK_INT4 1
|
#define HAVE_CCTK_INT4 1
|
||||||
#define HAVE_CCTK_INT2 1
|
#define HAVE_CCTK_INT2 1
|
||||||
#define HAVE_CCTK_INT1 1
|
#define HAVE_CCTK_INT1 1
|
||||||
|
|
||||||
#define HAVE_CCTK_REAL16 1
|
#define HAVE_CCTK_REAL16 1
|
||||||
#define HAVE_CCTK_REAL8 1
|
#define HAVE_CCTK_REAL8 1
|
||||||
#define HAVE_CCTK_REAL4 1
|
#define HAVE_CCTK_REAL4 1
|
||||||
|
|
||||||
#define CCTK_INT8 long int
|
#define CCTK_INT8 long int
|
||||||
#define CCTK_INT4 int
|
#define CCTK_INT4 int
|
||||||
#define CCTK_INT2 short int
|
#define CCTK_INT2 short int
|
||||||
#define CCTK_INT1 signed char
|
#define CCTK_INT1 signed char
|
||||||
|
|
||||||
#define CCTK_REAL16 long double
|
#define CCTK_REAL16 long double
|
||||||
#define CCTK_REAL8 double
|
#define CCTK_REAL8 double
|
||||||
#define CCTK_REAL4 float
|
#define CCTK_REAL4 float
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
|
||||||
#ifdef CCTK_C_RESTRICT
|
#ifdef CCTK_C_RESTRICT
|
||||||
#define restrict CCTK_C_RESTRICT
|
#define restrict CCTK_C_RESTRICT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allow the use of CCTK_RESTRICT as a qualifier always. */
|
/* Allow the use of CCTK_RESTRICT as a qualifier always. */
|
||||||
#ifdef CCTK_C_RESTRICT
|
#ifdef CCTK_C_RESTRICT
|
||||||
#define CCTK_RESTRICT CCTK_C_RESTRICT
|
#define CCTK_RESTRICT CCTK_C_RESTRICT
|
||||||
#else
|
#else
|
||||||
#define CCTK_RESTRICT restrict
|
#define CCTK_RESTRICT restrict
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CCTK_C_BOOL
|
#ifdef HAVE_CCTK_C_BOOL
|
||||||
#define CCTK_HAVE_C_BOOL
|
#define CCTK_HAVE_C_BOOL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ! defined __cplusplus */
|
#endif /* ! defined __cplusplus */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* C++ specific stuff */
|
/* C++ specific stuff */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
/* Some C++ compilers don't have bool ! */
|
/* Some C++ compilers don't have bool ! */
|
||||||
#define HAVE_CCTK_CXX_BOOL 1
|
#define HAVE_CCTK_CXX_BOOL 1
|
||||||
|
|
||||||
#ifndef HAVE_CCTK_CXX_BOOL
|
#ifndef HAVE_CCTK_CXX_BOOL
|
||||||
typedef enum {false, true} bool;
|
typedef enum {false, true} bool;
|
||||||
#else
|
#else
|
||||||
/* deprecated in beta15 */
|
/* deprecated in beta15 */
|
||||||
#define CCTK_HAVE_CXX_BOOL
|
#define CCTK_HAVE_CXX_BOOL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some C++ compilers recognise the restrict keyword */
|
/* Some C++ compilers recognise the restrict keyword */
|
||||||
#define CCTK_CXX_RESTRICT __restrict__
|
#define CCTK_CXX_RESTRICT __restrict__
|
||||||
|
|
||||||
/* Since this is non-standard leave commented out for the moment */
|
/* Since this is non-standard leave commented out for the moment */
|
||||||
#if 0
|
#if 0
|
||||||
/* Define to empty if the keyword does not work. */
|
/* Define to empty if the keyword does not work. */
|
||||||
#ifdef CCTK_CXX_RESTRICT
|
#ifdef CCTK_CXX_RESTRICT
|
||||||
#define restrict CCTK_CXX_RESTRICT
|
#define restrict CCTK_CXX_RESTRICT
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allow the use of CCTK_RESTRICT as a qualifier always. */
|
/* Allow the use of CCTK_RESTRICT as a qualifier always. */
|
||||||
#ifdef CCTK_CXX_RESTRICT
|
#ifdef CCTK_CXX_RESTRICT
|
||||||
#define CCTK_RESTRICT CCTK_CXX_RESTRICT
|
#define CCTK_RESTRICT CCTK_CXX_RESTRICT
|
||||||
#else
|
#else
|
||||||
#define CCTK_RESTRICT restrict
|
#define CCTK_RESTRICT restrict
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
#ifdef FCODE
|
#ifdef FCODE
|
||||||
|
|
||||||
#define HAVE_CCTK_FORTRAN_REAL4 1
|
#define HAVE_CCTK_FORTRAN_REAL4 1
|
||||||
#define HAVE_CCTK_FORTRAN_REAL8 1
|
#define HAVE_CCTK_FORTRAN_REAL8 1
|
||||||
#define HAVE_CCTK_FORTRAN_REAL16 1
|
#define HAVE_CCTK_FORTRAN_REAL16 1
|
||||||
|
|
||||||
#define HAVE_CCTK_FORTRAN_COMPLEX8 1
|
#define HAVE_CCTK_FORTRAN_COMPLEX8 1
|
||||||
#define HAVE_CCTK_FORTRAN_COMPLEX16 1
|
#define HAVE_CCTK_FORTRAN_COMPLEX16 1
|
||||||
#define HAVE_CCTK_FORTRAN_COMPLEX32 1
|
#define HAVE_CCTK_FORTRAN_COMPLEX32 1
|
||||||
|
|
||||||
#endif /* FCODE */
|
#endif /* FCODE */
|
||||||
|
|
||||||
/* Now include the code to pick an appropriate precison for reals and ints */
|
/* Now include the code to pick an appropriate precison for reals and ints */
|
||||||
#include "cctk_Types.h"
|
#include "cctk_Types.h"
|
||||||
|
|
||||||
#endif /* _CCTK_CONFIG_H_ */
|
#endif /* _CCTK_CONFIG_H_ */
|
||||||
@@ -1,57 +1,57 @@
|
|||||||
#ifndef _CCTK_CONSTANTS_H_
|
#ifndef _CCTK_CONSTANTS_H_
|
||||||
#define _CCTK_CONSTANTS_H_
|
#define _CCTK_CONSTANTS_H_
|
||||||
|
|
||||||
#define CCTK_VARIABLE_VOID 100
|
#define CCTK_VARIABLE_VOID 100
|
||||||
#define CCTK_VARIABLE_BYTE 101
|
#define CCTK_VARIABLE_BYTE 101
|
||||||
#define CCTK_VARIABLE_INT 102
|
#define CCTK_VARIABLE_INT 102
|
||||||
#define CCTK_VARIABLE_INT1 103
|
#define CCTK_VARIABLE_INT1 103
|
||||||
#define CCTK_VARIABLE_INT2 104
|
#define CCTK_VARIABLE_INT2 104
|
||||||
#define CCTK_VARIABLE_INT4 105
|
#define CCTK_VARIABLE_INT4 105
|
||||||
#define CCTK_VARIABLE_INT8 106
|
#define CCTK_VARIABLE_INT8 106
|
||||||
#define CCTK_VARIABLE_REAL 107
|
#define CCTK_VARIABLE_REAL 107
|
||||||
#define CCTK_VARIABLE_REAL4 108
|
#define CCTK_VARIABLE_REAL4 108
|
||||||
#define CCTK_VARIABLE_REAL8 109
|
#define CCTK_VARIABLE_REAL8 109
|
||||||
#define CCTK_VARIABLE_REAL16 110
|
#define CCTK_VARIABLE_REAL16 110
|
||||||
#define CCTK_VARIABLE_COMPLEX 111
|
#define CCTK_VARIABLE_COMPLEX 111
|
||||||
#define CCTK_VARIABLE_COMPLEX8 112
|
#define CCTK_VARIABLE_COMPLEX8 112
|
||||||
#define CCTK_VARIABLE_COMPLEX16 113
|
#define CCTK_VARIABLE_COMPLEX16 113
|
||||||
#define CCTK_VARIABLE_COMPLEX32 114
|
#define CCTK_VARIABLE_COMPLEX32 114
|
||||||
#define CCTK_VARIABLE_CHAR 115
|
#define CCTK_VARIABLE_CHAR 115
|
||||||
#define CCTK_VARIABLE_STRING 116
|
#define CCTK_VARIABLE_STRING 116
|
||||||
#define CCTK_VARIABLE_POINTER 117
|
#define CCTK_VARIABLE_POINTER 117
|
||||||
#define CCTK_VARIABLE_POINTER_TO_CONST 118
|
#define CCTK_VARIABLE_POINTER_TO_CONST 118
|
||||||
#define CCTK_VARIABLE_FPOINTER 119
|
#define CCTK_VARIABLE_FPOINTER 119
|
||||||
|
|
||||||
/* DEPRECATED IN BETA 12 */
|
/* DEPRECATED IN BETA 12 */
|
||||||
#define CCTK_VARIABLE_FN_POINTER CCTK_VARIABLE_FPOINTER
|
#define CCTK_VARIABLE_FN_POINTER CCTK_VARIABLE_FPOINTER
|
||||||
|
|
||||||
/* steerable status of parameters */
|
/* steerable status of parameters */
|
||||||
#define CCTK_STEERABLE_NEVER 200
|
#define CCTK_STEERABLE_NEVER 200
|
||||||
#define CCTK_STEERABLE_ALWAYS 201
|
#define CCTK_STEERABLE_ALWAYS 201
|
||||||
#define CCTK_STEERABLE_RECOVER 202
|
#define CCTK_STEERABLE_RECOVER 202
|
||||||
|
|
||||||
/* number of staggerings */
|
/* number of staggerings */
|
||||||
#define CCTK_NSTAGGER 3
|
#define CCTK_NSTAGGER 3
|
||||||
|
|
||||||
/* group distributions */
|
/* group distributions */
|
||||||
#define CCTK_DISTRIB_CONSTANT 301
|
#define CCTK_DISTRIB_CONSTANT 301
|
||||||
#define CCTK_DISTRIB_DEFAULT 302
|
#define CCTK_DISTRIB_DEFAULT 302
|
||||||
|
|
||||||
/* group types */
|
/* group types */
|
||||||
#define CCTK_SCALAR 401
|
#define CCTK_SCALAR 401
|
||||||
#define CCTK_GF 402
|
#define CCTK_GF 402
|
||||||
#define CCTK_ARRAY 403
|
#define CCTK_ARRAY 403
|
||||||
|
|
||||||
/* group scopes */
|
/* group scopes */
|
||||||
#define CCTK_PRIVATE 501
|
#define CCTK_PRIVATE 501
|
||||||
#define CCTK_PROTECTED 502
|
#define CCTK_PROTECTED 502
|
||||||
#define CCTK_PUBLIC 503
|
#define CCTK_PUBLIC 503
|
||||||
|
|
||||||
/* constants for CCTK_TraverseString() */
|
/* constants for CCTK_TraverseString() */
|
||||||
#define CCTK_VAR 601
|
#define CCTK_VAR 601
|
||||||
#define CCTK_GROUP 602
|
#define CCTK_GROUP 602
|
||||||
#define CCTK_GROUP_OR_VAR 603
|
#define CCTK_GROUP_OR_VAR 603
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CCTK_CONSTANTS_ */
|
#endif /* _CCTK_CONSTANTS_ */
|
||||||
|
|
||||||
@@ -1,180 +1,180 @@
|
|||||||
#ifndef _CCTK_TYPES_H_
|
#ifndef _CCTK_TYPES_H_
|
||||||
#define _CCTK_TYPES_H_
|
#define _CCTK_TYPES_H_
|
||||||
|
|
||||||
#ifndef _CCTK_CONFIG_H_
|
#ifndef _CCTK_CONFIG_H_
|
||||||
#include "cctk_Config.h"
|
#include "cctk_Config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void *CCTK_POINTER;
|
typedef void *CCTK_POINTER;
|
||||||
typedef const void *CCTK_POINTER_TO_CONST;
|
typedef const void *CCTK_POINTER_TO_CONST;
|
||||||
typedef void (*CCTK_FPOINTER)(void);
|
typedef void (*CCTK_FPOINTER)(void);
|
||||||
#define HAVE_CCTK_POINTER 1
|
#define HAVE_CCTK_POINTER 1
|
||||||
#define HAVE_CCTK_POINTER_TO_CONST 1
|
#define HAVE_CCTK_POINTER_TO_CONST 1
|
||||||
#define HAVE_CCTK_FPOINTER 1
|
#define HAVE_CCTK_FPOINTER 1
|
||||||
|
|
||||||
/* Character types */
|
/* Character types */
|
||||||
typedef char CCTK_CHAR;
|
typedef char CCTK_CHAR;
|
||||||
typedef const char * CCTK_STRING;
|
typedef const char * CCTK_STRING;
|
||||||
#define HAVE_CCTK_CHAR 1
|
#define HAVE_CCTK_CHAR 1
|
||||||
#define HAVE_CCTK_STRING 1
|
#define HAVE_CCTK_STRING 1
|
||||||
|
|
||||||
/* Structures for complex types */
|
/* Structures for complex types */
|
||||||
|
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
#define HAVE_CCTK_COMPLEX32 1
|
#define HAVE_CCTK_COMPLEX32 1
|
||||||
typedef struct CCTK_COMPLEX32
|
typedef struct CCTK_COMPLEX32
|
||||||
{
|
{
|
||||||
CCTK_REAL16 Re;
|
CCTK_REAL16 Re;
|
||||||
CCTK_REAL16 Im;
|
CCTK_REAL16 Im;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
CCTK_REAL16 real() const { return Re; }
|
CCTK_REAL16 real() const { return Re; }
|
||||||
CCTK_REAL16 imag() const { return Im; }
|
CCTK_REAL16 imag() const { return Im; }
|
||||||
#endif
|
#endif
|
||||||
} CCTK_COMPLEX32;
|
} CCTK_COMPLEX32;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
#define HAVE_CCTK_COMPLEX16 1
|
#define HAVE_CCTK_COMPLEX16 1
|
||||||
typedef struct CCTK_COMPLEX16
|
typedef struct CCTK_COMPLEX16
|
||||||
{
|
{
|
||||||
CCTK_REAL8 Re;
|
CCTK_REAL8 Re;
|
||||||
CCTK_REAL8 Im;
|
CCTK_REAL8 Im;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
CCTK_REAL8 real() const { return Re; }
|
CCTK_REAL8 real() const { return Re; }
|
||||||
CCTK_REAL8 imag() const { return Im; }
|
CCTK_REAL8 imag() const { return Im; }
|
||||||
#endif
|
#endif
|
||||||
} CCTK_COMPLEX16;
|
} CCTK_COMPLEX16;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
#define HAVE_CCTK_COMPLEX8 1
|
#define HAVE_CCTK_COMPLEX8 1
|
||||||
typedef struct CCTK_COMPLEX8
|
typedef struct CCTK_COMPLEX8
|
||||||
{
|
{
|
||||||
CCTK_REAL4 Re;
|
CCTK_REAL4 Re;
|
||||||
CCTK_REAL4 Im;
|
CCTK_REAL4 Im;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
CCTK_REAL4 real() const { return Re; }
|
CCTK_REAL4 real() const { return Re; }
|
||||||
CCTK_REAL4 imag() const { return Im; }
|
CCTK_REAL4 imag() const { return Im; }
|
||||||
#endif
|
#endif
|
||||||
} CCTK_COMPLEX8;
|
} CCTK_COMPLEX8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Small positive integer type */
|
/* Small positive integer type */
|
||||||
typedef unsigned char CCTK_BYTE;
|
typedef unsigned char CCTK_BYTE;
|
||||||
#define HAVE_CCTK_BYTE 1
|
#define HAVE_CCTK_BYTE 1
|
||||||
|
|
||||||
/* Define stuff for fortran. */
|
/* Define stuff for fortran. */
|
||||||
#ifdef FCODE
|
#ifdef FCODE
|
||||||
|
|
||||||
#define CCTK_POINTER integer*SIZEOF_CHAR_P
|
#define CCTK_POINTER integer*SIZEOF_CHAR_P
|
||||||
#define CCTK_POINTER_TO_CONST integer*SIZEOF_CHAR_P
|
#define CCTK_POINTER_TO_CONST integer*SIZEOF_CHAR_P
|
||||||
/* TODO: add autoconf for determining the size of function pointers */
|
/* TODO: add autoconf for determining the size of function pointers */
|
||||||
#define CCTK_FPOINTER integer*SIZEOF_CHAR_P
|
#define CCTK_FPOINTER integer*SIZEOF_CHAR_P
|
||||||
#define HAVE_CCTK_POINTER 1
|
#define HAVE_CCTK_POINTER 1
|
||||||
#define HAVE_CCTK_POINTER_TO_CONST 1
|
#define HAVE_CCTK_POINTER_TO_CONST 1
|
||||||
#define HAVE_CCTK_FPOINTER 1
|
#define HAVE_CCTK_FPOINTER 1
|
||||||
|
|
||||||
/* Character types */
|
/* Character types */
|
||||||
/* A single character does not exist in Fortran; in Fortran, all
|
/* A single character does not exist in Fortran; in Fortran, all
|
||||||
character types are strings. Hence we do not define CCTK_CHAR. */
|
character types are strings. Hence we do not define CCTK_CHAR. */
|
||||||
/* #define CCTK_CHAR CHARACTER */
|
/* #define CCTK_CHAR CHARACTER */
|
||||||
/* #define HAVE_CCTK_CHAR 1 */
|
/* #define HAVE_CCTK_CHAR 1 */
|
||||||
/* This is a C-string, i.e., only a pointer */
|
/* This is a C-string, i.e., only a pointer */
|
||||||
#define CCTK_STRING CCTK_POINTER_TO_CONST
|
#define CCTK_STRING CCTK_POINTER_TO_CONST
|
||||||
#define HAVE_CCTK_STRING 1
|
#define HAVE_CCTK_STRING 1
|
||||||
|
|
||||||
#ifdef HAVE_CCTK_INT8
|
#ifdef HAVE_CCTK_INT8
|
||||||
#define CCTK_INT8 INTEGER*8
|
#define CCTK_INT8 INTEGER*8
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT4
|
#ifdef HAVE_CCTK_INT4
|
||||||
#define CCTK_INT4 INTEGER*4
|
#define CCTK_INT4 INTEGER*4
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT2
|
#ifdef HAVE_CCTK_INT2
|
||||||
#define CCTK_INT2 INTEGER*2
|
#define CCTK_INT2 INTEGER*2
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT1
|
#ifdef HAVE_CCTK_INT1
|
||||||
#define CCTK_INT1 INTEGER*1
|
#define CCTK_INT1 INTEGER*1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
#define CCTK_REAL16 REAL*16
|
#define CCTK_REAL16 REAL*16
|
||||||
#define HAVE_CCTK_COMPLEX32 1
|
#define HAVE_CCTK_COMPLEX32 1
|
||||||
#define CCTK_COMPLEX32 COMPLEX*32
|
#define CCTK_COMPLEX32 COMPLEX*32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
#define CCTK_REAL8 REAL*8
|
#define CCTK_REAL8 REAL*8
|
||||||
#define HAVE_CCTK_COMPLEX16 1
|
#define HAVE_CCTK_COMPLEX16 1
|
||||||
#define CCTK_COMPLEX16 COMPLEX*16
|
#define CCTK_COMPLEX16 COMPLEX*16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
#define CCTK_REAL4 REAL*4
|
#define CCTK_REAL4 REAL*4
|
||||||
#define HAVE_CCTK_COMPLEX8 1
|
#define HAVE_CCTK_COMPLEX8 1
|
||||||
#define CCTK_COMPLEX8 COMPLEX*8
|
#define CCTK_COMPLEX8 COMPLEX*8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Should be unsigned, but Fortran doesn't have that */
|
/* Should be unsigned, but Fortran doesn't have that */
|
||||||
#define CCTK_BYTE INTEGER*1
|
#define CCTK_BYTE INTEGER*1
|
||||||
#define HAVE_CCTK_BYTE 1
|
#define HAVE_CCTK_BYTE 1
|
||||||
|
|
||||||
#endif /*FCODE */
|
#endif /*FCODE */
|
||||||
|
|
||||||
/* Now pick the types based upon the precision variable. */
|
/* Now pick the types based upon the precision variable. */
|
||||||
|
|
||||||
/* Floating point precision */
|
/* Floating point precision */
|
||||||
#ifdef CCTK_REAL_PRECISION_16
|
#ifdef CCTK_REAL_PRECISION_16
|
||||||
#define CCTK_REAL_PRECISION 16
|
#define CCTK_REAL_PRECISION 16
|
||||||
#define CCTK_REAL CCTK_REAL16
|
#define CCTK_REAL CCTK_REAL16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CCTK_REAL_PRECISION_8
|
#ifdef CCTK_REAL_PRECISION_8
|
||||||
#define CCTK_REAL_PRECISION 8
|
#define CCTK_REAL_PRECISION 8
|
||||||
#define CCTK_REAL CCTK_REAL8
|
#define CCTK_REAL CCTK_REAL8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CCTK_REAL_PRECISION_4
|
#ifdef CCTK_REAL_PRECISION_4
|
||||||
#define CCTK_REAL_PRECISION 4
|
#define CCTK_REAL_PRECISION 4
|
||||||
#define CCTK_REAL CCTK_REAL4
|
#define CCTK_REAL CCTK_REAL4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Integer precision */
|
/* Integer precision */
|
||||||
|
|
||||||
#ifdef CCTK_INTEGER_PRECISION_8
|
#ifdef CCTK_INTEGER_PRECISION_8
|
||||||
#define CCTK_INTEGER_PRECISION 8
|
#define CCTK_INTEGER_PRECISION 8
|
||||||
#define CCTK_INT CCTK_INT8
|
#define CCTK_INT CCTK_INT8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CCTK_INTEGER_PRECISION_4
|
#ifdef CCTK_INTEGER_PRECISION_4
|
||||||
#define CCTK_INTEGER_PRECISION 4
|
#define CCTK_INTEGER_PRECISION 4
|
||||||
#define CCTK_INT CCTK_INT4
|
#define CCTK_INT CCTK_INT4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CCTK_INTEGER_PRECISION_2
|
#ifdef CCTK_INTEGER_PRECISION_2
|
||||||
#define CCTK_INTEGER_PRECISION 2
|
#define CCTK_INTEGER_PRECISION 2
|
||||||
#define CCTK_INT CCTK_INT2
|
#define CCTK_INT CCTK_INT2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CCTK_INTEGER_PRECISION_1
|
#ifdef CCTK_INTEGER_PRECISION_1
|
||||||
#define CCTK_INTEGER_PRECISION 1
|
#define CCTK_INTEGER_PRECISION 1
|
||||||
#define CCTK_INT CCTK_INT1
|
#define CCTK_INT CCTK_INT1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Complex precision */
|
/* Complex precision */
|
||||||
#ifdef CCTK_REAL_PRECISION_16
|
#ifdef CCTK_REAL_PRECISION_16
|
||||||
#define CCTK_COMPLEX_PRECISION 32
|
#define CCTK_COMPLEX_PRECISION 32
|
||||||
#define CCTK_COMPLEX CCTK_COMPLEX32
|
#define CCTK_COMPLEX CCTK_COMPLEX32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CCTK_REAL_PRECISION_8
|
#ifdef CCTK_REAL_PRECISION_8
|
||||||
#define CCTK_COMPLEX_PRECISION 16
|
#define CCTK_COMPLEX_PRECISION 16
|
||||||
#define CCTK_COMPLEX CCTK_COMPLEX16
|
#define CCTK_COMPLEX CCTK_COMPLEX16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CCTK_REAL_PRECISION_4
|
#ifdef CCTK_REAL_PRECISION_4
|
||||||
#define CCTK_COMPLEX_PRECISION 8
|
#define CCTK_COMPLEX_PRECISION 8
|
||||||
#define CCTK_COMPLEX CCTK_COMPLEX8
|
#define CCTK_COMPLEX CCTK_COMPLEX8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*_CCTK_TYPES_H_ */
|
#endif /*_CCTK_TYPES_H_ */
|
||||||
|
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
#ifndef AHFINDERDIRECT__CONFIG_H
|
#ifndef AHFINDERDIRECT__CONFIG_H
|
||||||
#define AHFINDERDIRECT__CONFIG_H
|
#define AHFINDERDIRECT__CONFIG_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
size_t Util_Strlcat(char* dst, const char* src, size_t dst_size);
|
size_t Util_Strlcat(char* dst, const char* src, size_t dst_size);
|
||||||
size_t Util_Strlcpy(char* dst, const char* src, size_t dst_size);
|
size_t Util_Strlcpy(char* dst, const char* src, size_t dst_size);
|
||||||
|
|
||||||
typedef CCTK_REAL fp;
|
typedef CCTK_REAL fp;
|
||||||
|
|
||||||
typedef CCTK_INT integer;
|
typedef CCTK_INT integer;
|
||||||
|
|
||||||
#endif /* AHFINDERDIRECT__CONFIG_H */
|
#endif /* AHFINDERDIRECT__CONFIG_H */
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,173 +1,173 @@
|
|||||||
#ifndef COORDS_H
|
#ifndef COORDS_H
|
||||||
#define COORDS_H
|
#define COORDS_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace local_coords
|
namespace local_coords
|
||||||
{
|
{
|
||||||
|
|
||||||
// compare if two angles are fuzzily equal mod 2*pi radians (360 degrees)
|
// compare if two angles are fuzzily equal mod 2*pi radians (360 degrees)
|
||||||
bool fuzzy_EQ_ang(fp ang1, fp ang2); // radians
|
bool fuzzy_EQ_ang(fp ang1, fp ang2); // radians
|
||||||
bool fuzzy_EQ_dang(fp dang1, fp dang2); // degrees
|
bool fuzzy_EQ_dang(fp dang1, fp dang2); // degrees
|
||||||
|
|
||||||
// modulo-reduce {ang,dang} to be (fuzzily) within the range
|
// modulo-reduce {ang,dang} to be (fuzzily) within the range
|
||||||
// [min,max]_{ang,dang}, or error_exit() if no such value exists
|
// [min,max]_{ang,dang}, or error_exit() if no such value exists
|
||||||
fp modulo_reduce_ang(fp ang, fp min_ang, fp max_ang);
|
fp modulo_reduce_ang(fp ang, fp min_ang, fp max_ang);
|
||||||
fp modulo_reduce_dang(fp dang, fp min_dang, fp max_dang);
|
fp modulo_reduce_dang(fp dang, fp min_dang, fp max_dang);
|
||||||
|
|
||||||
} // close namespace local_coords::
|
} // close namespace local_coords::
|
||||||
|
|
||||||
namespace local_coords
|
namespace local_coords
|
||||||
{
|
{
|
||||||
// (r,(mu,nu,phi)) <--> (x,y,z)
|
// (r,(mu,nu,phi)) <--> (x,y,z)
|
||||||
void xyz_of_r_mu_nu(fp r, fp mu, fp nu, fp &x, fp &y, fp &z);
|
void xyz_of_r_mu_nu(fp r, fp mu, fp nu, fp &x, fp &y, fp &z);
|
||||||
void xyz_of_r_mu_phi(fp r, fp mu, fp phi, fp &x, fp &y, fp &z);
|
void xyz_of_r_mu_phi(fp r, fp mu, fp phi, fp &x, fp &y, fp &z);
|
||||||
void xyz_of_r_nu_phi(fp r, fp nu, fp phi, fp &x, fp &y, fp &z);
|
void xyz_of_r_nu_phi(fp r, fp nu, fp phi, fp &x, fp &y, fp &z);
|
||||||
fp r_of_xyz(fp x, fp y, fp z);
|
fp r_of_xyz(fp x, fp y, fp z);
|
||||||
fp mu_of_yz(fp y, fp z);
|
fp mu_of_yz(fp y, fp z);
|
||||||
fp nu_of_xz(fp x, fp z);
|
fp nu_of_xz(fp x, fp z);
|
||||||
fp phi_of_xy(fp x, fp y);
|
fp phi_of_xy(fp x, fp y);
|
||||||
|
|
||||||
// ((mu,nu,phi)) --> the 3rd
|
// ((mu,nu,phi)) --> the 3rd
|
||||||
fp phi_of_mu_nu(fp mu, fp nu);
|
fp phi_of_mu_nu(fp mu, fp nu);
|
||||||
fp nu_of_mu_phi(fp mu, fp phi);
|
fp nu_of_mu_phi(fp mu, fp phi);
|
||||||
fp mu_of_nu_phi(fp nu, fp phi);
|
fp mu_of_nu_phi(fp nu, fp phi);
|
||||||
|
|
||||||
// partial {x,y,z} / partial {mu,nu,phi}
|
// partial {x,y,z} / partial {mu,nu,phi}
|
||||||
void partial_xyz_wrt_r_mu_nu(fp r, fp mu, fp nu,
|
void partial_xyz_wrt_r_mu_nu(fp r, fp mu, fp nu,
|
||||||
fp &partial_x_wrt_r, fp &partial_x_wrt_mu, fp &partial_x_wrt_nu,
|
fp &partial_x_wrt_r, fp &partial_x_wrt_mu, fp &partial_x_wrt_nu,
|
||||||
fp &partial_y_wrt_r, fp &partial_y_wrt_mu, fp &partial_y_wrt_nu,
|
fp &partial_y_wrt_r, fp &partial_y_wrt_mu, fp &partial_y_wrt_nu,
|
||||||
fp &partial_z_wrt_r, fp &partial_z_wrt_mu, fp &partial_z_wrt_nu);
|
fp &partial_z_wrt_r, fp &partial_z_wrt_mu, fp &partial_z_wrt_nu);
|
||||||
void partial_xyz_wrt_r_mu_phi(fp r, fp mu, fp phi,
|
void partial_xyz_wrt_r_mu_phi(fp r, fp mu, fp phi,
|
||||||
fp &partial_x_wrt_r, fp &partial_x_wrt_mu, fp &partial_x_wrt_phi,
|
fp &partial_x_wrt_r, fp &partial_x_wrt_mu, fp &partial_x_wrt_phi,
|
||||||
fp &partial_y_wrt_r, fp &partial_y_wrt_mu, fp &partial_y_wrt_phi,
|
fp &partial_y_wrt_r, fp &partial_y_wrt_mu, fp &partial_y_wrt_phi,
|
||||||
fp &partial_z_wrt_r, fp &partial_z_wrt_mu, fp &partial_z_wrt_phi);
|
fp &partial_z_wrt_r, fp &partial_z_wrt_mu, fp &partial_z_wrt_phi);
|
||||||
void partial_xyz_wrt_r_nu_phi(fp r, fp nu, fp phi,
|
void partial_xyz_wrt_r_nu_phi(fp r, fp nu, fp phi,
|
||||||
fp &partial_x_wrt_r, fp &partial_x_wrt_nu, fp &partial_x_wrt_phi,
|
fp &partial_x_wrt_r, fp &partial_x_wrt_nu, fp &partial_x_wrt_phi,
|
||||||
fp &partial_y_wrt_r, fp &partial_y_wrt_nu, fp &partial_y_wrt_phi,
|
fp &partial_y_wrt_r, fp &partial_y_wrt_nu, fp &partial_y_wrt_phi,
|
||||||
fp &partial_z_wrt_r, fp &partial_z_wrt_nu, fp &partial_z_wrt_phi);
|
fp &partial_z_wrt_r, fp &partial_z_wrt_nu, fp &partial_z_wrt_phi);
|
||||||
|
|
||||||
// partial {mu,nu,phi} / partial {x,y,z}
|
// partial {mu,nu,phi} / partial {x,y,z}
|
||||||
fp partial_mu_wrt_y(fp y, fp z);
|
fp partial_mu_wrt_y(fp y, fp z);
|
||||||
fp partial_mu_wrt_z(fp y, fp z);
|
fp partial_mu_wrt_z(fp y, fp z);
|
||||||
fp partial_nu_wrt_x(fp x, fp z);
|
fp partial_nu_wrt_x(fp x, fp z);
|
||||||
fp partial_nu_wrt_z(fp x, fp z);
|
fp partial_nu_wrt_z(fp x, fp z);
|
||||||
fp partial_phi_wrt_x(fp x, fp y);
|
fp partial_phi_wrt_x(fp x, fp y);
|
||||||
fp partial_phi_wrt_y(fp x, fp y);
|
fp partial_phi_wrt_y(fp x, fp y);
|
||||||
|
|
||||||
// partial^2 {mu,nu,phi} / partial {x,y,z}{x,y,z}
|
// partial^2 {mu,nu,phi} / partial {x,y,z}{x,y,z}
|
||||||
fp partial2_mu_wrt_yy(fp y, fp z);
|
fp partial2_mu_wrt_yy(fp y, fp z);
|
||||||
fp partial2_mu_wrt_yz(fp y, fp z);
|
fp partial2_mu_wrt_yz(fp y, fp z);
|
||||||
fp partial2_mu_wrt_zz(fp y, fp z);
|
fp partial2_mu_wrt_zz(fp y, fp z);
|
||||||
fp partial2_nu_wrt_xx(fp x, fp z);
|
fp partial2_nu_wrt_xx(fp x, fp z);
|
||||||
fp partial2_nu_wrt_xz(fp x, fp z);
|
fp partial2_nu_wrt_xz(fp x, fp z);
|
||||||
fp partial2_nu_wrt_zz(fp x, fp z);
|
fp partial2_nu_wrt_zz(fp x, fp z);
|
||||||
fp partial2_phi_wrt_xx(fp x, fp y);
|
fp partial2_phi_wrt_xx(fp x, fp y);
|
||||||
fp partial2_phi_wrt_xy(fp x, fp y);
|
fp partial2_phi_wrt_xy(fp x, fp y);
|
||||||
fp partial2_phi_wrt_yy(fp x, fp y);
|
fp partial2_phi_wrt_yy(fp x, fp y);
|
||||||
|
|
||||||
// usual polar spherical (r,theta,phi) <--> (x,y,z)
|
// usual polar spherical (r,theta,phi) <--> (x,y,z)
|
||||||
void xyz_of_r_theta_phi(fp r, fp theta, fp phi, fp &x, fp &y, fp &z);
|
void xyz_of_r_theta_phi(fp r, fp theta, fp phi, fp &x, fp &y, fp &z);
|
||||||
void r_theta_phi_of_xyz(fp x, fp y, fp z, fp &r, fp &theta, fp &phi);
|
void r_theta_phi_of_xyz(fp x, fp y, fp z, fp &r, fp &theta, fp &phi);
|
||||||
// ... already have r_of_xyz()
|
// ... already have r_of_xyz()
|
||||||
// ... already have phi_of_xy()
|
// ... already have phi_of_xy()
|
||||||
fp theta_of_xyz(fp x, fp y, fp z);
|
fp theta_of_xyz(fp x, fp y, fp z);
|
||||||
|
|
||||||
// ((mu,nu,phi)) <--> usual polar spherical (theta,phi)
|
// ((mu,nu,phi)) <--> usual polar spherical (theta,phi)
|
||||||
// ... note phi is the same coordinate in both systems
|
// ... note phi is the same coordinate in both systems
|
||||||
void theta_phi_of_mu_nu(fp mu, fp nu, fp &ps_theta, fp &ps_phi);
|
void theta_phi_of_mu_nu(fp mu, fp nu, fp &ps_theta, fp &ps_phi);
|
||||||
void theta_phi_of_mu_phi(fp mu, fp phi, fp &ps_theta, fp &ps_phi);
|
void theta_phi_of_mu_phi(fp mu, fp phi, fp &ps_theta, fp &ps_phi);
|
||||||
void theta_phi_of_nu_phi(fp nu, fp phi, fp &ps_theta, fp &ps_phi);
|
void theta_phi_of_nu_phi(fp nu, fp phi, fp &ps_theta, fp &ps_phi);
|
||||||
void mu_nu_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &nu);
|
void mu_nu_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &nu);
|
||||||
void mu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &phi);
|
void mu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &mu, fp &phi);
|
||||||
void nu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &nu, fp &phi);
|
void nu_phi_of_theta_phi(fp ps_theta, fp ps_phi, fp &nu, fp &phi);
|
||||||
|
|
||||||
// ((mu,nu,phi)) --> direction cosines (xcos,ycos,zcos)
|
// ((mu,nu,phi)) --> direction cosines (xcos,ycos,zcos)
|
||||||
void xyzcos_of_mu_nu(fp mu, fp nu, fp &xcos, fp &ycos, fp &zcos);
|
void xyzcos_of_mu_nu(fp mu, fp nu, fp &xcos, fp &ycos, fp &zcos);
|
||||||
void xyzcos_of_mu_phi(fp mu, fp phi, fp &xcos, fp &ycos, fp &zcos);
|
void xyzcos_of_mu_phi(fp mu, fp phi, fp &xcos, fp &ycos, fp &zcos);
|
||||||
void xyzcos_of_nu_phi(fp nu, fp phi, fp &xcos, fp &ycos, fp &zcos);
|
void xyzcos_of_nu_phi(fp nu, fp phi, fp &xcos, fp &ycos, fp &zcos);
|
||||||
} // close namespace local_coords::
|
} // close namespace local_coords::
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** bit masks for coordinates ****
|
// ***** bit masks for coordinates ****
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// We need to manipulate coordinates to do calculations like "which
|
// We need to manipulate coordinates to do calculations like "which
|
||||||
// coordinate do these two patches have in common". We do these by
|
// coordinate do these two patches have in common". We do these by
|
||||||
// Boolean operations on integers using the following bit masks:
|
// Boolean operations on integers using the following bit masks:
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace local_coords
|
namespace local_coords
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef int coords_set;
|
typedef int coords_set;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
coords_set_mu = 0x1,
|
coords_set_mu = 0x1,
|
||||||
coords_set_nu = 0x2,
|
coords_set_nu = 0x2,
|
||||||
coords_set_phi = 0x4,
|
coords_set_phi = 0x4,
|
||||||
|
|
||||||
coords_set_empty = 0x0,
|
coords_set_empty = 0x0,
|
||||||
coords_set_all = coords_set_mu | coords_set_nu | coords_set_phi // no comma
|
coords_set_all = coords_set_mu | coords_set_nu | coords_set_phi // no comma
|
||||||
};
|
};
|
||||||
|
|
||||||
// human-readable coordinate names for debugging etc
|
// human-readable coordinate names for debugging etc
|
||||||
const char *name_of_coords_set(coords_set S);
|
const char *name_of_coords_set(coords_set S);
|
||||||
|
|
||||||
// set complement of coordinates
|
// set complement of coordinates
|
||||||
inline coords_set coords_set_not(coords_set S)
|
inline coords_set coords_set_not(coords_set S)
|
||||||
{
|
{
|
||||||
return coords_set_all & ~S;
|
return coords_set_all & ~S;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // close namespace local_coords::
|
} // close namespace local_coords::
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This class stores the origin point of our local coordinates, and
|
// This class stores the origin point of our local coordinates, and
|
||||||
// provides conversions between local and global coordinates.
|
// provides conversions between local and global coordinates.
|
||||||
//
|
//
|
||||||
class global_coords
|
class global_coords
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// get global (x,y,z) coordinates of local origin point
|
// get global (x,y,z) coordinates of local origin point
|
||||||
fp origin_x() const { return origin_x_; }
|
fp origin_x() const { return origin_x_; }
|
||||||
fp origin_y() const { return origin_y_; }
|
fp origin_y() const { return origin_y_; }
|
||||||
fp origin_z() const { return origin_z_; }
|
fp origin_z() const { return origin_z_; }
|
||||||
|
|
||||||
// constructor: specify global (x,y,z) coordinates of local origin point
|
// constructor: specify global (x,y,z) coordinates of local origin point
|
||||||
global_coords(fp origin_x_in, fp origin_y_in, fp origin_z_in)
|
global_coords(fp origin_x_in, fp origin_y_in, fp origin_z_in)
|
||||||
: origin_x_(origin_x_in),
|
: origin_x_(origin_x_in),
|
||||||
origin_y_(origin_y_in),
|
origin_y_(origin_y_in),
|
||||||
origin_z_(origin_z_in)
|
origin_z_(origin_z_in)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// destructor: compiler-generated no-op is ok
|
// destructor: compiler-generated no-op is ok
|
||||||
|
|
||||||
void recentering(fp x, fp y, fp z)
|
void recentering(fp x, fp y, fp z)
|
||||||
{
|
{
|
||||||
origin_x_ = x;
|
origin_x_ = x;
|
||||||
origin_y_ = y;
|
origin_y_ = y;
|
||||||
origin_z_ = z;
|
origin_z_ = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// we forbid copying and passing by value
|
// we forbid copying and passing by value
|
||||||
// by declaring the copy constructor and assignment operator
|
// by declaring the copy constructor and assignment operator
|
||||||
// private, but never defining them
|
// private, but never defining them
|
||||||
global_coords(const global_coords &rhs);
|
global_coords(const global_coords &rhs);
|
||||||
global_coords &operator=(const global_coords &rhs);
|
global_coords &operator=(const global_coords &rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// global (x,y,z) coordinates of local origin point
|
// global (x,y,z) coordinates of local origin point
|
||||||
fp origin_x_, origin_y_, origin_z_;
|
fp origin_x_, origin_y_, origin_z_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* COORDS_H */
|
#endif /* COORDS_H */
|
||||||
@@ -1,93 +1,93 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
|
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
|
||||||
fp_t fixed_point)
|
fp_t fixed_point)
|
||||||
: min_i_(min_i_in), max_i_(max_i_in),
|
: min_i_(min_i_in), max_i_(max_i_in),
|
||||||
map_is_plus_(false)
|
map_is_plus_(false)
|
||||||
{
|
{
|
||||||
const fp_t d_offset = 2.0 * fixed_point;
|
const fp_t d_offset = 2.0 * fixed_point;
|
||||||
if (!fuzzy<fp_t>::is_integer(d_offset))
|
if (!fuzzy<fp_t>::is_integer(d_offset))
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** cpm_map::cpm_map (mirror):\n"
|
"***** cpm_map::cpm_map (mirror):\n"
|
||||||
" fixed_point=%g isn't (fuzzily) integral or half-integral!\n",
|
" fixed_point=%g isn't (fuzzily) integral or half-integral!\n",
|
||||||
double(fixed_point)); /*NOTREACHED*/
|
double(fixed_point)); /*NOTREACHED*/
|
||||||
|
|
||||||
offset_ = round<fp_t>::to_integer(d_offset);
|
offset_ = round<fp_t>::to_integer(d_offset);
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
map_unchecked(fuzzy<fp_t>::floor(fixed_point)) ==
|
map_unchecked(fuzzy<fp_t>::floor(fixed_point)) ==
|
||||||
fuzzy<fp_t>::ceiling(fixed_point));
|
fuzzy<fp_t>::ceiling(fixed_point));
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function constructs a generic cpm_map object, with the mapping
|
// This function constructs a generic cpm_map object, with the mapping
|
||||||
// specified by a sample point sample_i --> sample_j and by sign.
|
// specified by a sample point sample_i --> sample_j and by sign.
|
||||||
// The sample point need not be in the map's domain/range.
|
// The sample point need not be in the map's domain/range.
|
||||||
//
|
//
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
|
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
|
||||||
int sample_i, int sample_j,
|
int sample_i, int sample_j,
|
||||||
bool map_is_plus_in)
|
bool map_is_plus_in)
|
||||||
: min_i_(min_i_in), max_i_(max_i_in),
|
: min_i_(min_i_in), max_i_(max_i_in),
|
||||||
offset_(map_is_plus_in ? sample_j - sample_i
|
offset_(map_is_plus_in ? sample_j - sample_i
|
||||||
: sample_j + sample_i),
|
: sample_j + sample_i),
|
||||||
map_is_plus_(map_is_plus_in)
|
map_is_plus_(map_is_plus_in)
|
||||||
{
|
{
|
||||||
assert(map_unchecked(sample_i) == sample_j);
|
assert(map_unchecked(sample_i) == sample_j);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function constructs a generic cpm_map object, with the mapping
|
// This function constructs a generic cpm_map object, with the mapping
|
||||||
// specified by a *fp* sample point sample_i --> sample_j (which
|
// specified by a *fp* sample point sample_i --> sample_j (which
|
||||||
// must specify an integer --> integer mapping, i.e. 4.2 --> 4.2 is
|
// must specify an integer --> integer mapping, i.e. 4.2 --> 4.2 is
|
||||||
// ok for a + map, and 4.5 --> 4.5 is ok for a minus map, but 4.2 --> 4.7
|
// ok for a + map, and 4.5 --> 4.5 is ok for a minus map, but 4.2 --> 4.7
|
||||||
// is never ok) and by sign. The sample point need not be in the map's
|
// is never ok) and by sign. The sample point need not be in the map's
|
||||||
// domain/range.
|
// domain/range.
|
||||||
//
|
//
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
|
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
|
||||||
fp_t sample_i, fp_t sample_j,
|
fp_t sample_i, fp_t sample_j,
|
||||||
bool map_is_plus_in)
|
bool map_is_plus_in)
|
||||||
: min_i_(min_i_in), max_i_(max_i_in),
|
: min_i_(min_i_in), max_i_(max_i_in),
|
||||||
map_is_plus_(map_is_plus_in)
|
map_is_plus_(map_is_plus_in)
|
||||||
{
|
{
|
||||||
const fp_t fp_offset = map_is_plus_in ? sample_j - sample_i
|
const fp_t fp_offset = map_is_plus_in ? sample_j - sample_i
|
||||||
: sample_j + sample_i;
|
: sample_j + sample_i;
|
||||||
if (!fuzzy<fp_t>::is_integer(fp_offset))
|
if (!fuzzy<fp_t>::is_integer(fp_offset))
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** cpm_map::cpm_map (generic via fp sample point):\n"
|
"***** cpm_map::cpm_map (generic via fp sample point):\n"
|
||||||
" fp_offset=%g isn't fuzzily integral!\n"
|
" fp_offset=%g isn't fuzzily integral!\n"
|
||||||
" ==> sample_i=%g --> sample_j=%g\n"
|
" ==> sample_i=%g --> sample_j=%g\n"
|
||||||
" doesn't fuzzily specify an integer --> integer mapping!\n",
|
" doesn't fuzzily specify an integer --> integer mapping!\n",
|
||||||
double(fp_offset),
|
double(fp_offset),
|
||||||
double(sample_i), double(sample_j)); /*NOTREACHED*/
|
double(sample_i), double(sample_j)); /*NOTREACHED*/
|
||||||
|
|
||||||
offset_ = round<fp_t>::to_integer(fp_offset);
|
offset_ = round<fp_t>::to_integer(fp_offset);
|
||||||
|
|
||||||
// verify that we have setup correct
|
// verify that we have setup correct
|
||||||
assert(
|
assert(
|
||||||
map_unchecked(fuzzy<fp_t>::floor(sample_i)) ==
|
map_unchecked(fuzzy<fp_t>::floor(sample_i)) ==
|
||||||
(map_is_plus_in ? fuzzy<fp_t>::floor(sample_j)
|
(map_is_plus_in ? fuzzy<fp_t>::floor(sample_j)
|
||||||
: fuzzy<fp_t>::ceiling(sample_j)));
|
: fuzzy<fp_t>::ceiling(sample_j)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template class cpm_map<float>;
|
template class cpm_map<float>;
|
||||||
template class cpm_map<double>;
|
template class cpm_map<double>;
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,120 +1,120 @@
|
|||||||
#ifndef AHFINDERDIRECT__CPM_MAP_HH
|
#ifndef AHFINDERDIRECT__CPM_MAP_HH
|
||||||
#define AHFINDERDIRECT__CPM_MAP_HH
|
#define AHFINDERDIRECT__CPM_MAP_HH
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
class cpm_map
|
class cpm_map
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// bounds info -- domain
|
// bounds info -- domain
|
||||||
int min_i() const { return min_i_; }
|
int min_i() const { return min_i_; }
|
||||||
int max_i() const { return max_i_; }
|
int max_i() const { return max_i_; }
|
||||||
int N_points() const
|
int N_points() const
|
||||||
{
|
{
|
||||||
return jtutil::how_many_in_range(min_i_, max_i_);
|
return jtutil::how_many_in_range(min_i_, max_i_);
|
||||||
}
|
}
|
||||||
bool in_domain(int i) const { return (i >= min_i_) && (i <= max_i_); }
|
bool in_domain(int i) const { return (i >= min_i_) && (i <= max_i_); }
|
||||||
|
|
||||||
// is the mapping + or - ?
|
// is the mapping + or - ?
|
||||||
bool is_plus() const { return map_is_plus_; }
|
bool is_plus() const { return map_is_plus_; }
|
||||||
bool is_minus() const { return !map_is_plus_; }
|
bool is_minus() const { return !map_is_plus_; }
|
||||||
int sign() const { return map_is_plus_ ? +1 : -1; }
|
int sign() const { return map_is_plus_ ? +1 : -1; }
|
||||||
fp_t fp_sign() const { return map_is_plus_ ? +1.0 : -1.0; }
|
fp_t fp_sign() const { return map_is_plus_ ? +1.0 : -1.0; }
|
||||||
|
|
||||||
// the mapping itself
|
// the mapping itself
|
||||||
int map_unchecked(int i) const
|
int map_unchecked(int i) const
|
||||||
{
|
{
|
||||||
return map_is_plus_ ? offset_ + i
|
return map_is_plus_ ? offset_ + i
|
||||||
: offset_ - i;
|
: offset_ - i;
|
||||||
}
|
}
|
||||||
int inv_map_unchecked(int j) const
|
int inv_map_unchecked(int j) const
|
||||||
{
|
{
|
||||||
return map_is_plus_ ? j - offset_
|
return map_is_plus_ ? j - offset_
|
||||||
: offset_ - j;
|
: offset_ - j;
|
||||||
}
|
}
|
||||||
int map(int i) const
|
int map(int i) const
|
||||||
{
|
{
|
||||||
assert(in_domain(i));
|
assert(in_domain(i));
|
||||||
return map_unchecked(i);
|
return map_unchecked(i);
|
||||||
}
|
}
|
||||||
int inv_map(int j) const
|
int inv_map(int j) const
|
||||||
{
|
{
|
||||||
int i = inv_map_unchecked(j);
|
int i = inv_map_unchecked(j);
|
||||||
assert(in_domain(i));
|
assert(in_domain(i));
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// bounds info -- range
|
// bounds info -- range
|
||||||
// ... we use the unchecked map here in case the domain is empty
|
// ... we use the unchecked map here in case the domain is empty
|
||||||
int min_j() const
|
int min_j() const
|
||||||
{
|
{
|
||||||
return map_is_plus_ ? map_unchecked(min_i_)
|
return map_is_plus_ ? map_unchecked(min_i_)
|
||||||
: map_unchecked(max_i_);
|
: map_unchecked(max_i_);
|
||||||
}
|
}
|
||||||
int max_j() const
|
int max_j() const
|
||||||
{
|
{
|
||||||
return map_is_plus_ ? map_unchecked(max_i_)
|
return map_is_plus_ ? map_unchecked(max_i_)
|
||||||
: map_unchecked(min_i_);
|
: map_unchecked(min_i_);
|
||||||
}
|
}
|
||||||
bool in_range(int j) const { return in_domain(inv_map_unchecked(j)); }
|
bool in_range(int j) const { return in_domain(inv_map_unchecked(j)); }
|
||||||
|
|
||||||
//
|
//
|
||||||
// constructors
|
// constructors
|
||||||
//
|
//
|
||||||
|
|
||||||
// "mirror" map: i --> const - i
|
// "mirror" map: i --> const - i
|
||||||
// ... map specified by fixed point (must be integer or half-integer)
|
// ... map specified by fixed point (must be integer or half-integer)
|
||||||
// ... fixed point need not be in domain/range
|
// ... fixed point need not be in domain/range
|
||||||
cpm_map(int min_i_in, int max_i_in,
|
cpm_map(int min_i_in, int max_i_in,
|
||||||
fp_t fixed_point);
|
fp_t fixed_point);
|
||||||
|
|
||||||
// "shift" map: i --> const + i
|
// "shift" map: i --> const + i
|
||||||
// ... map specified by shift amount
|
// ... map specified by shift amount
|
||||||
// ... default is identity map
|
// ... default is identity map
|
||||||
cpm_map(int min_i_in, int max_i_in,
|
cpm_map(int min_i_in, int max_i_in,
|
||||||
int shift_amount = 0)
|
int shift_amount = 0)
|
||||||
: min_i_(min_i_in), max_i_(max_i_in),
|
: min_i_(min_i_in), max_i_(max_i_in),
|
||||||
offset_(shift_amount), map_is_plus_(true)
|
offset_(shift_amount), map_is_plus_(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// generic map: i --> const +/- i
|
// generic map: i --> const +/- i
|
||||||
// ... map specified by sample point sample_i --> sample_j
|
// ... map specified by sample point sample_i --> sample_j
|
||||||
// and by sign (one of {plus,minus}_map )
|
// and by sign (one of {plus,minus}_map )
|
||||||
// ... sample point need not be in domain/range
|
// ... sample point need not be in domain/range
|
||||||
cpm_map(int min_i_in, int max_i_in,
|
cpm_map(int min_i_in, int max_i_in,
|
||||||
int sample_i, int sample_j,
|
int sample_i, int sample_j,
|
||||||
bool map_is_plus_in);
|
bool map_is_plus_in);
|
||||||
|
|
||||||
// generic map: i --> const +/- i
|
// generic map: i --> const +/- i
|
||||||
// ... map specified by *fp* sample point sample_i --> sample_j
|
// ... map specified by *fp* sample point sample_i --> sample_j
|
||||||
// (must specify an integer --> integer mapping)
|
// (must specify an integer --> integer mapping)
|
||||||
// and by sign (one of {plus,minus}_map )
|
// and by sign (one of {plus,minus}_map )
|
||||||
// ... hence if sign is -1, then sample_i and sample_j
|
// ... hence if sign is -1, then sample_i and sample_j
|
||||||
// must both be half-integral
|
// must both be half-integral
|
||||||
// ... sample point need *not* be in domain/range
|
// ... sample point need *not* be in domain/range
|
||||||
cpm_map(int min_i_in, int max_i_in,
|
cpm_map(int min_i_in, int max_i_in,
|
||||||
fp_t sample_i, fp_t sample_j,
|
fp_t sample_i, fp_t sample_j,
|
||||||
bool map_is_plus_in);
|
bool map_is_plus_in);
|
||||||
|
|
||||||
// no need for explicit destructor, compiler-generated no-op is ok
|
// no need for explicit destructor, compiler-generated no-op is ok
|
||||||
// ditto for copy constructor and assignment operator
|
// ditto for copy constructor and assignment operator
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// bounds (inclusive)
|
// bounds (inclusive)
|
||||||
int min_i_, max_i_;
|
int min_i_, max_i_;
|
||||||
|
|
||||||
// these define the actual mapping
|
// these define the actual mapping
|
||||||
int offset_;
|
int offset_;
|
||||||
bool map_is_plus_;
|
bool map_is_plus_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
|
|
||||||
#endif /* AHFINDERDIRECT__CPM_MAP_HH */
|
#endif /* AHFINDERDIRECT__CPM_MAP_HH */
|
||||||
@@ -1,108 +1,108 @@
|
|||||||
#ifndef DRIVER_H
|
#ifndef DRIVER_H
|
||||||
#define DRIVER_H
|
#define DRIVER_H
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "util_Table.h"
|
#include "util_Table.h"
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "fd_grid.h"
|
#include "fd_grid.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
#include "patch_edge.h"
|
#include "patch_edge.h"
|
||||||
#include "patch_interp.h"
|
#include "patch_interp.h"
|
||||||
#include "ghost_zone.h"
|
#include "ghost_zone.h"
|
||||||
#include "patch_system.h"
|
#include "patch_system.h"
|
||||||
|
|
||||||
#include "Jacobian.h"
|
#include "Jacobian.h"
|
||||||
|
|
||||||
#include "gfns.h"
|
#include "gfns.h"
|
||||||
#include "gr.h"
|
#include "gr.h"
|
||||||
|
|
||||||
#include "horizon_sequence.h"
|
#include "horizon_sequence.h"
|
||||||
#include "BH_diagnostics.h"
|
#include "BH_diagnostics.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
struct iteration_status_buffers
|
struct iteration_status_buffers
|
||||||
{
|
{
|
||||||
int *hn_buffer;
|
int *hn_buffer;
|
||||||
int *iteration_buffer;
|
int *iteration_buffer;
|
||||||
enum expansion_status *expansion_status_buffer;
|
enum expansion_status *expansion_status_buffer;
|
||||||
fp *mean_horizon_radius_buffer;
|
fp *mean_horizon_radius_buffer;
|
||||||
fp *Theta_infinity_norm_buffer;
|
fp *Theta_infinity_norm_buffer;
|
||||||
bool *found_horizon_buffer;
|
bool *found_horizon_buffer;
|
||||||
|
|
||||||
jtutil::array2d<CCTK_REAL> *send_buffer_ptr;
|
jtutil::array2d<CCTK_REAL> *send_buffer_ptr;
|
||||||
jtutil::array2d<CCTK_REAL> *receive_buffer_ptr;
|
jtutil::array2d<CCTK_REAL> *receive_buffer_ptr;
|
||||||
|
|
||||||
iteration_status_buffers()
|
iteration_status_buffers()
|
||||||
: hn_buffer(NULL), iteration_buffer(NULL),
|
: hn_buffer(NULL), iteration_buffer(NULL),
|
||||||
expansion_status_buffer(NULL),
|
expansion_status_buffer(NULL),
|
||||||
mean_horizon_radius_buffer(NULL),
|
mean_horizon_radius_buffer(NULL),
|
||||||
Theta_infinity_norm_buffer(NULL),
|
Theta_infinity_norm_buffer(NULL),
|
||||||
found_horizon_buffer(NULL),
|
found_horizon_buffer(NULL),
|
||||||
send_buffer_ptr(NULL), receive_buffer_ptr(NULL)
|
send_buffer_ptr(NULL), receive_buffer_ptr(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// This struct holds interprocessor-communication buffers for broadcasting
|
// This struct holds interprocessor-communication buffers for broadcasting
|
||||||
// the BH diagnostics and horizon shape from the processor which finds a
|
// the BH diagnostics and horizon shape from the processor which finds a
|
||||||
// given horizon, to all processors.
|
// given horizon, to all processors.
|
||||||
//
|
//
|
||||||
struct horizon_buffers
|
struct horizon_buffers
|
||||||
{
|
{
|
||||||
int N_buffer;
|
int N_buffer;
|
||||||
double *send_buffer;
|
double *send_buffer;
|
||||||
double *receive_buffer;
|
double *receive_buffer;
|
||||||
|
|
||||||
horizon_buffers()
|
horizon_buffers()
|
||||||
: N_buffer(0),
|
: N_buffer(0),
|
||||||
send_buffer(NULL),
|
send_buffer(NULL),
|
||||||
receive_buffer(NULL)
|
receive_buffer(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
struct AH_data
|
struct AH_data
|
||||||
{
|
{
|
||||||
patch_system *ps_ptr;
|
patch_system *ps_ptr;
|
||||||
Jacobian *Jac_ptr;
|
Jacobian *Jac_ptr;
|
||||||
double surface_expansion;
|
double surface_expansion;
|
||||||
|
|
||||||
bool initial_find_flag;
|
bool initial_find_flag;
|
||||||
bool recentering_flag, stop_finding, find_trigger;
|
bool recentering_flag, stop_finding, find_trigger;
|
||||||
|
|
||||||
bool found_flag; // did we find this horizon (successfully)
|
bool found_flag; // did we find this horizon (successfully)
|
||||||
|
|
||||||
struct BH_diagnostics BH_diagnostics;
|
struct BH_diagnostics BH_diagnostics;
|
||||||
FILE *BH_diagnostics_fileptr;
|
FILE *BH_diagnostics_fileptr;
|
||||||
|
|
||||||
// interprocessor-communication buffers
|
// interprocessor-communication buffers
|
||||||
// for this horizon's BH diagnostics and (optionally) horizon shape
|
// for this horizon's BH diagnostics and (optionally) horizon shape
|
||||||
struct horizon_buffers horizon_buffers;
|
struct horizon_buffers horizon_buffers;
|
||||||
};
|
};
|
||||||
|
|
||||||
// initial_guess.cc
|
// initial_guess.cc
|
||||||
void setup_initial_guess(patch_system &ps,
|
void setup_initial_guess(patch_system &ps,
|
||||||
fp x_center, fp y_center, fp z_center,
|
fp x_center, fp y_center, fp z_center,
|
||||||
fp x_radius, fp y_radius, fp z_radius);
|
fp x_radius, fp y_radius, fp z_radius);
|
||||||
|
|
||||||
// Newton.cc
|
// Newton.cc
|
||||||
void Newton(int N_procs, int N_active_procs, int my_proc,
|
void Newton(int N_procs, int N_active_procs, int my_proc,
|
||||||
horizon_sequence &hs, struct AH_data *const AH_data_array[],
|
horizon_sequence &hs, struct AH_data *const AH_data_array[],
|
||||||
struct iteration_status_buffers &isb, int *dumpid, double *);
|
struct iteration_status_buffers &isb, int *dumpid, double *);
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* DRIVER_H */
|
#endif /* DRIVER_H */
|
||||||
@@ -1,38 +1,38 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
int error_exit(int msg_level, const char *format, ...)
|
int error_exit(int msg_level, const char *format, ...)
|
||||||
{
|
{
|
||||||
const int N_buffer = 2000;
|
const int N_buffer = 2000;
|
||||||
char buffer[N_buffer];
|
char buffer[N_buffer];
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
vsnprintf(buffer, N_buffer, format, ap);
|
vsnprintf(buffer, N_buffer, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
const int len = strlen(buffer);
|
const int len = strlen(buffer);
|
||||||
if ((len > 0) && (buffer[len - 1] == '\n'))
|
if ((len > 0) && (buffer[len - 1] == '\n'))
|
||||||
then buffer[len - 1] = '\0';
|
then buffer[len - 1] = '\0';
|
||||||
|
|
||||||
CCTK_VWarn(msg_level, __LINE__, __FILE__, CCTK_THORNSTRING, "%s", buffer);
|
CCTK_VWarn(msg_level, __LINE__, __FILE__, CCTK_THORNSTRING, "%s", buffer);
|
||||||
|
|
||||||
// if we got here, evidently msg_level wasn't drastic enough
|
// if we got here, evidently msg_level wasn't drastic enough
|
||||||
abort(); /*NOTREACHED*/
|
abort(); /*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,386 +1,386 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "macrodef.h"
|
#include "macrodef.h"
|
||||||
#ifdef With_AHF
|
#ifdef With_AHF
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "util_Table.h"
|
#include "util_Table.h"
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "fd_grid.h"
|
#include "fd_grid.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
#include "patch_edge.h"
|
#include "patch_edge.h"
|
||||||
#include "patch_interp.h"
|
#include "patch_interp.h"
|
||||||
#include "ghost_zone.h"
|
#include "ghost_zone.h"
|
||||||
#include "patch_system.h"
|
#include "patch_system.h"
|
||||||
|
|
||||||
#include "Jacobian.h"
|
#include "Jacobian.h"
|
||||||
|
|
||||||
#include "gfns.h"
|
#include "gfns.h"
|
||||||
#include "gr.h"
|
#include "gr.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
using jtutil::error_exit;
|
using jtutil::error_exit;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
void expansion_Jacobian_partial_SD(patch_system &ps, Jacobian &Jac,
|
void expansion_Jacobian_partial_SD(patch_system &ps, Jacobian &Jac,
|
||||||
bool print_msg_flag);
|
bool print_msg_flag);
|
||||||
|
|
||||||
void add_ghost_zone_Jacobian(const patch_system &ps,
|
void add_ghost_zone_Jacobian(const patch_system &ps,
|
||||||
Jacobian &Jac,
|
Jacobian &Jac,
|
||||||
fp mol,
|
fp mol,
|
||||||
const patch &xp, const ghost_zone &xmgz,
|
const patch &xp, const ghost_zone &xmgz,
|
||||||
int x_II,
|
int x_II,
|
||||||
int xm_irho, int xm_isigma);
|
int xm_irho, int xm_isigma);
|
||||||
|
|
||||||
enum expansion_status
|
enum expansion_status
|
||||||
expansion_Jacobian_dr_FD(patch_system *ps_ptr, Jacobian *Jac_ptr, fp add_to_expansion,
|
expansion_Jacobian_dr_FD(patch_system *ps_ptr, Jacobian *Jac_ptr, fp add_to_expansion,
|
||||||
bool initial_flag,
|
bool initial_flag,
|
||||||
bool print_msg_flag);
|
bool print_msg_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// If ps_ptr != NULL and Jac_ptr != NULL, this function computes the
|
// If ps_ptr != NULL and Jac_ptr != NULL, this function computes the
|
||||||
// Jacobian matrix J[Theta(h)] of the expansion Theta(h). We assume
|
// Jacobian matrix J[Theta(h)] of the expansion Theta(h). We assume
|
||||||
// that Theta(h) has already been computed.
|
// that Theta(h) has already been computed.
|
||||||
//
|
//
|
||||||
// If ps_ptr == NULL and Jac_ptr == NULL, this function does a dummy
|
// If ps_ptr == NULL and Jac_ptr == NULL, this function does a dummy
|
||||||
// computation, in which only any expansion() (and hence geometry
|
// computation, in which only any expansion() (and hence geometry
|
||||||
// interpolator) calls are done, these with the number of interpolation
|
// interpolator) calls are done, these with the number of interpolation
|
||||||
// points set to 0 and all the output array pointers set to NULL.
|
// points set to 0 and all the output array pointers set to NULL.
|
||||||
//
|
//
|
||||||
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
|
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
|
||||||
//
|
//
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// ps_ptr --> The patch system, or == NULL to do (only) a dummy computation.
|
// ps_ptr --> The patch system, or == NULL to do (only) a dummy computation.
|
||||||
// Jac_ptr --> The Jacobian, or == NULL to do (only) a dummy computation.
|
// Jac_ptr --> The Jacobian, or == NULL to do (only) a dummy computation.
|
||||||
// add_to_expansion = A real number to add to the expansion.
|
// add_to_expansion = A real number to add to the expansion.
|
||||||
//
|
//
|
||||||
// Results:
|
// Results:
|
||||||
// This function returns a status code indicating whether the computation
|
// This function returns a status code indicating whether the computation
|
||||||
// succeeded or failed, and if the latter, what caused the failure.
|
// succeeded or failed, and if the latter, what caused the failure.
|
||||||
//
|
//
|
||||||
enum expansion_status
|
enum expansion_status
|
||||||
expansion_Jacobian(patch_system *ps_ptr, Jacobian *Jac_ptr,
|
expansion_Jacobian(patch_system *ps_ptr, Jacobian *Jac_ptr,
|
||||||
fp add_to_expansion,
|
fp add_to_expansion,
|
||||||
bool initial_flag,
|
bool initial_flag,
|
||||||
bool print_msg_flag /* = false */)
|
bool print_msg_flag /* = false */)
|
||||||
{
|
{
|
||||||
const bool active_flag = (ps_ptr != NULL) && (Jac_ptr != NULL);
|
const bool active_flag = (ps_ptr != NULL) && (Jac_ptr != NULL);
|
||||||
enum expansion_status status;
|
enum expansion_status status;
|
||||||
|
|
||||||
if (active_flag)
|
if (active_flag)
|
||||||
then expansion_Jacobian_partial_SD(*ps_ptr, *Jac_ptr,
|
then expansion_Jacobian_partial_SD(*ps_ptr, *Jac_ptr,
|
||||||
print_msg_flag);
|
print_msg_flag);
|
||||||
// this function looks at ps_ptr and Jac_ptr (non-NULL vs NULL)
|
// this function looks at ps_ptr and Jac_ptr (non-NULL vs NULL)
|
||||||
// to choose a normal vs dummy computation
|
// to choose a normal vs dummy computation
|
||||||
{
|
{
|
||||||
status = expansion_Jacobian_dr_FD(ps_ptr, Jac_ptr, add_to_expansion,
|
status = expansion_Jacobian_dr_FD(ps_ptr, Jac_ptr, add_to_expansion,
|
||||||
initial_flag,
|
initial_flag,
|
||||||
print_msg_flag);
|
print_msg_flag);
|
||||||
if (status != expansion_success)
|
if (status != expansion_success)
|
||||||
then return status; // *** ERROR RETURN ***
|
then return status; // *** ERROR RETURN ***
|
||||||
}
|
}
|
||||||
|
|
||||||
return expansion_success; // *** NORMAL RETURN ***
|
return expansion_success; // *** NORMAL RETURN ***
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// This function computes the partial derivative terms in the Jacobian
|
// This function computes the partial derivative terms in the Jacobian
|
||||||
// matrix of the expansion Theta(h), by symbolic differentiation from
|
// matrix of the expansion Theta(h), by symbolic differentiation from
|
||||||
// the Jacobian coefficient (angular) gridfns. The Jacobian is traversed
|
// the Jacobian coefficient (angular) gridfns. The Jacobian is traversed
|
||||||
// by rows, using equation (25) of my 1996 apparent horizon finding paper.
|
// by rows, using equation (25) of my 1996 apparent horizon finding paper.
|
||||||
//
|
//
|
||||||
// Inputs (angular gridfns, on ghosted grid):
|
// Inputs (angular gridfns, on ghosted grid):
|
||||||
// h # shape of trial surface
|
// h # shape of trial surface
|
||||||
// Theta # Theta(h) assumed to already be computed
|
// Theta # Theta(h) assumed to already be computed
|
||||||
// partial_Theta_wrt_partial_d_h # Jacobian coefficients
|
// partial_Theta_wrt_partial_d_h # Jacobian coefficients
|
||||||
// partial_Theta_wrt_partial_dd_h # (also assumed to already be computed)
|
// partial_Theta_wrt_partial_dd_h # (also assumed to already be computed)
|
||||||
//
|
//
|
||||||
// Outputs:
|
// Outputs:
|
||||||
// The Jacobian matrix is stored in the Jacobian object Jac.
|
// The Jacobian matrix is stored in the Jacobian object Jac.
|
||||||
//
|
//
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void expansion_Jacobian_partial_SD(patch_system &ps, Jacobian &Jac,
|
void expansion_Jacobian_partial_SD(patch_system &ps, Jacobian &Jac,
|
||||||
bool print_msg_flag)
|
bool print_msg_flag)
|
||||||
{
|
{
|
||||||
Jac.zero_matrix();
|
Jac.zero_matrix();
|
||||||
ps.compute_synchronize_Jacobian();
|
ps.compute_synchronize_Jacobian();
|
||||||
|
|
||||||
for (int xpn = 0; xpn < ps.N_patches(); ++xpn)
|
for (int xpn = 0; xpn < ps.N_patches(); ++xpn)
|
||||||
{
|
{
|
||||||
patch &xp = ps.ith_patch(xpn);
|
patch &xp = ps.ith_patch(xpn);
|
||||||
|
|
||||||
for (int x_irho = xp.min_irho(); x_irho <= xp.max_irho(); ++x_irho)
|
for (int x_irho = xp.min_irho(); x_irho <= xp.max_irho(); ++x_irho)
|
||||||
{
|
{
|
||||||
for (int x_isigma = xp.min_isigma(); x_isigma <= xp.max_isigma(); ++x_isigma)
|
for (int x_isigma = xp.min_isigma(); x_isigma <= xp.max_isigma(); ++x_isigma)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// compute the main Jacobian terms for this grid point, i.e.
|
// compute the main Jacobian terms for this grid point, i.e.
|
||||||
// partial Theta(this point x, Jacobian row II)
|
// partial Theta(this point x, Jacobian row II)
|
||||||
// ---------------------------------------------
|
// ---------------------------------------------
|
||||||
// partial h(other points y, Jacobian column JJ)
|
// partial h(other points y, Jacobian column JJ)
|
||||||
//
|
//
|
||||||
|
|
||||||
// Jacobian row index
|
// Jacobian row index
|
||||||
const int II = ps.gpn_of_patch_irho_isigma(xp, x_irho, x_isigma);
|
const int II = ps.gpn_of_patch_irho_isigma(xp, x_irho, x_isigma);
|
||||||
|
|
||||||
// Jacobian coefficients for this point
|
// Jacobian coefficients for this point
|
||||||
const fp Jacobian_coeff_rho = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_d_h_1,
|
const fp Jacobian_coeff_rho = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_d_h_1,
|
||||||
x_irho, x_isigma);
|
x_irho, x_isigma);
|
||||||
const fp Jacobian_coeff_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_d_h_2,
|
const fp Jacobian_coeff_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_d_h_2,
|
||||||
x_irho, x_isigma);
|
x_irho, x_isigma);
|
||||||
const fp Jacobian_coeff_rho_rho = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_11,
|
const fp Jacobian_coeff_rho_rho = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_11,
|
||||||
x_irho, x_isigma);
|
x_irho, x_isigma);
|
||||||
const fp Jacobian_coeff_rho_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_12,
|
const fp Jacobian_coeff_rho_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_12,
|
||||||
x_irho, x_isigma);
|
x_irho, x_isigma);
|
||||||
const fp Jacobian_coeff_sigma_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_22,
|
const fp Jacobian_coeff_sigma_sigma = xp.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_22,
|
||||||
x_irho, x_isigma);
|
x_irho, x_isigma);
|
||||||
|
|
||||||
// partial_rho, partial_rho_rho
|
// partial_rho, partial_rho_rho
|
||||||
{
|
{
|
||||||
for (int m_irho = xp.molecule_min_m();
|
for (int m_irho = xp.molecule_min_m();
|
||||||
m_irho <= xp.molecule_max_m();
|
m_irho <= xp.molecule_max_m();
|
||||||
++m_irho)
|
++m_irho)
|
||||||
{
|
{
|
||||||
const int xm_irho = x_irho + m_irho;
|
const int xm_irho = x_irho + m_irho;
|
||||||
const fp Jac_rho = Jacobian_coeff_rho * xp.partial_rho_coeff(m_irho);
|
const fp Jac_rho = Jacobian_coeff_rho * xp.partial_rho_coeff(m_irho);
|
||||||
const fp Jac_rho_rho = Jacobian_coeff_rho_rho * xp.partial_rho_rho_coeff(m_irho);
|
const fp Jac_rho_rho = Jacobian_coeff_rho_rho * xp.partial_rho_rho_coeff(m_irho);
|
||||||
const fp Jac_sum = Jac_rho + Jac_rho_rho;
|
const fp Jac_sum = Jac_rho + Jac_rho_rho;
|
||||||
if (xp.is_in_nominal_grid(xm_irho, x_isigma))
|
if (xp.is_in_nominal_grid(xm_irho, x_isigma))
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, xm_irho, x_isigma);
|
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, xm_irho, x_isigma);
|
||||||
Jac.sum_into_element(II, xm_JJ, Jac_sum);
|
Jac.sum_into_element(II, xm_JJ, Jac_sum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
add_ghost_zone_Jacobian(ps, Jac,
|
add_ghost_zone_Jacobian(ps, Jac,
|
||||||
Jac_sum,
|
Jac_sum,
|
||||||
xp, xp.minmax_rho_ghost_zone(m_irho < 0),
|
xp, xp.minmax_rho_ghost_zone(m_irho < 0),
|
||||||
II, xm_irho, x_isigma);
|
II, xm_irho, x_isigma);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// partial_sigma, partial_sigma_sigma
|
// partial_sigma, partial_sigma_sigma
|
||||||
{
|
{
|
||||||
for (int m_isigma = xp.molecule_min_m();
|
for (int m_isigma = xp.molecule_min_m();
|
||||||
m_isigma <= xp.molecule_max_m();
|
m_isigma <= xp.molecule_max_m();
|
||||||
++m_isigma)
|
++m_isigma)
|
||||||
{
|
{
|
||||||
const int xm_isigma = x_isigma + m_isigma;
|
const int xm_isigma = x_isigma + m_isigma;
|
||||||
const fp Jac_sigma = Jacobian_coeff_sigma * xp.partial_sigma_coeff(m_isigma);
|
const fp Jac_sigma = Jacobian_coeff_sigma * xp.partial_sigma_coeff(m_isigma);
|
||||||
const fp Jac_sigma_sigma = Jacobian_coeff_sigma_sigma * xp.partial_sigma_sigma_coeff(m_isigma);
|
const fp Jac_sigma_sigma = Jacobian_coeff_sigma_sigma * xp.partial_sigma_sigma_coeff(m_isigma);
|
||||||
const fp Jac_sum = Jac_sigma + Jac_sigma_sigma;
|
const fp Jac_sum = Jac_sigma + Jac_sigma_sigma;
|
||||||
if (xp.is_in_nominal_grid(x_irho, xm_isigma))
|
if (xp.is_in_nominal_grid(x_irho, xm_isigma))
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, x_irho, xm_isigma);
|
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, x_irho, xm_isigma);
|
||||||
Jac.sum_into_element(II, xm_JJ, Jac_sum);
|
Jac.sum_into_element(II, xm_JJ, Jac_sum);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
add_ghost_zone_Jacobian(ps, Jac,
|
add_ghost_zone_Jacobian(ps, Jac,
|
||||||
Jac_sum,
|
Jac_sum,
|
||||||
xp, xp.minmax_sigma_ghost_zone(m_isigma < 0),
|
xp, xp.minmax_sigma_ghost_zone(m_isigma < 0),
|
||||||
II, x_irho, xm_isigma);
|
II, x_irho, xm_isigma);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// partial_rho_sigma
|
// partial_rho_sigma
|
||||||
{
|
{
|
||||||
for (int m_irho = xp.molecule_min_m();
|
for (int m_irho = xp.molecule_min_m();
|
||||||
m_irho <= xp.molecule_max_m();
|
m_irho <= xp.molecule_max_m();
|
||||||
++m_irho)
|
++m_irho)
|
||||||
{
|
{
|
||||||
for (int m_isigma = xp.molecule_min_m();
|
for (int m_isigma = xp.molecule_min_m();
|
||||||
m_isigma <= xp.molecule_max_m();
|
m_isigma <= xp.molecule_max_m();
|
||||||
++m_isigma)
|
++m_isigma)
|
||||||
{
|
{
|
||||||
const int xm_irho = x_irho + m_irho;
|
const int xm_irho = x_irho + m_irho;
|
||||||
const int xm_isigma = x_isigma + m_isigma;
|
const int xm_isigma = x_isigma + m_isigma;
|
||||||
const fp Jac_rho_sigma = Jacobian_coeff_rho_sigma * xp.partial_rho_sigma_coeff(m_irho, m_isigma);
|
const fp Jac_rho_sigma = Jacobian_coeff_rho_sigma * xp.partial_rho_sigma_coeff(m_irho, m_isigma);
|
||||||
if (xp.is_in_nominal_grid(xm_irho, xm_isigma))
|
if (xp.is_in_nominal_grid(xm_irho, xm_isigma))
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, xm_irho, xm_isigma);
|
const int xm_JJ = Jac.II_of_patch_irho_isigma(xp, xm_irho, xm_isigma);
|
||||||
Jac.sum_into_element(II, xm_JJ, Jac_rho_sigma);
|
Jac.sum_into_element(II, xm_JJ, Jac_rho_sigma);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ghost_zone &xmgz = xp.corner_ghost_zone_containing_point(m_irho < 0, m_isigma < 0,
|
const ghost_zone &xmgz = xp.corner_ghost_zone_containing_point(m_irho < 0, m_isigma < 0,
|
||||||
xm_irho, xm_isigma);
|
xm_irho, xm_isigma);
|
||||||
add_ghost_zone_Jacobian(ps, Jac,
|
add_ghost_zone_Jacobian(ps, Jac,
|
||||||
Jac_rho_sigma,
|
Jac_rho_sigma,
|
||||||
xp, xmgz,
|
xp, xmgz,
|
||||||
II, xm_irho, xm_isigma);
|
II, xm_irho, xm_isigma);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function adds the ghost-zone Jacobian dependency contributions
|
// This function adds the ghost-zone Jacobian dependency contributions
|
||||||
// for a single ghost-zone point, to a Jacobian matrix.
|
// for a single ghost-zone point, to a Jacobian matrix.
|
||||||
//
|
//
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// ps = The patch system.
|
// ps = The patch system.
|
||||||
// Jac = (out) The Jacobian matrix.
|
// Jac = (out) The Jacobian matrix.
|
||||||
// mol = The molecule coefficient.
|
// mol = The molecule coefficient.
|
||||||
// xp = The patch containing the center point of the molecule.
|
// xp = The patch containing the center point of the molecule.
|
||||||
// xmgz = If the x+m point is in a ghost zone, this must be that ghost zone.
|
// xmgz = If the x+m point is in a ghost zone, this must be that ghost zone.
|
||||||
// If the x+m point is not in a ghost zone, this argument is ignored.
|
// If the x+m point is not in a ghost zone, this argument is ignored.
|
||||||
// x_II = The Jacobian row of the x point.
|
// x_II = The Jacobian row of the x point.
|
||||||
// xm_(irho,isigma) = The coordinates (in xp) of the x+m point of the molecule.
|
// xm_(irho,isigma) = The coordinates (in xp) of the x+m point of the molecule.
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void add_ghost_zone_Jacobian(const patch_system &ps,
|
void add_ghost_zone_Jacobian(const patch_system &ps,
|
||||||
Jacobian &Jac,
|
Jacobian &Jac,
|
||||||
fp mol,
|
fp mol,
|
||||||
const patch &xp, const ghost_zone &xmgz,
|
const patch &xp, const ghost_zone &xmgz,
|
||||||
int x_II,
|
int x_II,
|
||||||
int xm_irho, int xm_isigma)
|
int xm_irho, int xm_isigma)
|
||||||
{
|
{
|
||||||
const patch_edge &xme = xmgz.my_edge();
|
const patch_edge &xme = xmgz.my_edge();
|
||||||
const int xm_iperp = xme.iperp_of_irho_isigma(xm_irho, xm_isigma);
|
const int xm_iperp = xme.iperp_of_irho_isigma(xm_irho, xm_isigma);
|
||||||
const int xm_ipar = xme.ipar_of_irho_isigma(xm_irho, xm_isigma);
|
const int xm_ipar = xme.ipar_of_irho_isigma(xm_irho, xm_isigma);
|
||||||
|
|
||||||
// FIXME: this won't change from one call to another
|
// FIXME: this won't change from one call to another
|
||||||
// ==> it would be more efficient to reuse the same buffer
|
// ==> it would be more efficient to reuse the same buffer
|
||||||
// across multiple calls on this function
|
// across multiple calls on this function
|
||||||
int global_min_ym, global_max_ym;
|
int global_min_ym, global_max_ym;
|
||||||
ps.synchronize_Jacobian_global_minmax_ym(global_min_ym, global_max_ym);
|
ps.synchronize_Jacobian_global_minmax_ym(global_min_ym, global_max_ym);
|
||||||
jtutil::array1d<fp> Jacobian_buffer(global_min_ym, global_max_ym);
|
jtutil::array1d<fp> Jacobian_buffer(global_min_ym, global_max_ym);
|
||||||
|
|
||||||
// on what other points y does this molecule point xm depend
|
// on what other points y does this molecule point xm depend
|
||||||
// via the patch_system::synchronize() operation?
|
// via the patch_system::synchronize() operation?
|
||||||
int y_iperp;
|
int y_iperp;
|
||||||
int y_posn, min_ym, max_ym;
|
int y_posn, min_ym, max_ym;
|
||||||
const patch_edge &ye = ps.synchronize_Jacobian(xmgz,
|
const patch_edge &ye = ps.synchronize_Jacobian(xmgz,
|
||||||
xm_iperp, xm_ipar,
|
xm_iperp, xm_ipar,
|
||||||
y_iperp,
|
y_iperp,
|
||||||
y_posn, min_ym, max_ym,
|
y_posn, min_ym, max_ym,
|
||||||
Jacobian_buffer);
|
Jacobian_buffer);
|
||||||
patch &yp = ye.my_patch();
|
patch &yp = ye.my_patch();
|
||||||
|
|
||||||
// add the Jacobian contributions from the ym points
|
// add the Jacobian contributions from the ym points
|
||||||
for (int ym = min_ym; ym <= max_ym; ++ym)
|
for (int ym = min_ym; ym <= max_ym; ++ym)
|
||||||
{
|
{
|
||||||
const int y_ipar = y_posn + ym;
|
const int y_ipar = y_posn + ym;
|
||||||
const int y_irho = ye.irho_of_iperp_ipar(y_iperp, y_ipar);
|
const int y_irho = ye.irho_of_iperp_ipar(y_iperp, y_ipar);
|
||||||
const int y_isigma = ye.isigma_of_iperp_ipar(y_iperp, y_ipar);
|
const int y_isigma = ye.isigma_of_iperp_ipar(y_iperp, y_ipar);
|
||||||
const int y_JJ = Jac.II_of_patch_irho_isigma(yp, y_irho, y_isigma);
|
const int y_JJ = Jac.II_of_patch_irho_isigma(yp, y_irho, y_isigma);
|
||||||
Jac.sum_into_element(x_II, y_JJ, mol * Jacobian_buffer(ym));
|
Jac.sum_into_element(x_II, y_JJ, mol * Jacobian_buffer(ym));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// If ps_ptr != NULL and Jac_ptr != NULL, this function sums the d/dr
|
// If ps_ptr != NULL and Jac_ptr != NULL, this function sums the d/dr
|
||||||
// terms into the Jacobian matrix of the expansion Theta(h), computing
|
// terms into the Jacobian matrix of the expansion Theta(h), computing
|
||||||
// those terms by finite differencing.
|
// those terms by finite differencing.
|
||||||
//
|
//
|
||||||
// If ps_ptr == NULL and Jac_ptr == NULL, this function does a dummy
|
// If ps_ptr == NULL and Jac_ptr == NULL, this function does a dummy
|
||||||
// computation, in which only any expansion() (and hence geometry
|
// computation, in which only any expansion() (and hence geometry
|
||||||
// interpolator) calls are done, these with the number of interpolation
|
// interpolator) calls are done, these with the number of interpolation
|
||||||
// points set to 0 and all the output array pointers set to NULL.
|
// points set to 0 and all the output array pointers set to NULL.
|
||||||
//
|
//
|
||||||
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
|
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
|
||||||
//
|
//
|
||||||
// The basic algorithm is that
|
// The basic algorithm is that
|
||||||
// Jac += diag[ (Theta(h+epsilon) - Theta(h)) / epsilon ]
|
// Jac += diag[ (Theta(h+epsilon) - Theta(h)) / epsilon ]
|
||||||
//
|
//
|
||||||
// Inputs (angular gridfns, on ghosted grid):
|
// Inputs (angular gridfns, on ghosted grid):
|
||||||
// h # shape of trial surface
|
// h # shape of trial surface
|
||||||
// Theta # Theta(h) assumed to already be computed
|
// Theta # Theta(h) assumed to already be computed
|
||||||
//
|
//
|
||||||
// Outputs:
|
// Outputs:
|
||||||
// Jac += d/dr terms
|
// Jac += d/dr terms
|
||||||
//
|
//
|
||||||
// Results:
|
// Results:
|
||||||
// This function returns a status code indicating whether the computation
|
// This function returns a status code indicating whether the computation
|
||||||
// succeeded or failed, and if the latter, what caused the failure.
|
// succeeded or failed, and if the latter, what caused the failure.
|
||||||
//
|
//
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
enum expansion_status
|
enum expansion_status
|
||||||
expansion_Jacobian_dr_FD(patch_system *ps_ptr, Jacobian *Jac_ptr, fp add_to_expansion,
|
expansion_Jacobian_dr_FD(patch_system *ps_ptr, Jacobian *Jac_ptr, fp add_to_expansion,
|
||||||
bool initial_flag,
|
bool initial_flag,
|
||||||
bool print_msg_flag)
|
bool print_msg_flag)
|
||||||
{
|
{
|
||||||
const bool active_flag = (ps_ptr != NULL) && (Jac_ptr != NULL);
|
const bool active_flag = (ps_ptr != NULL) && (Jac_ptr != NULL);
|
||||||
|
|
||||||
const double epsilon = 1e-6;
|
const double epsilon = 1e-6;
|
||||||
// compute Theta(h+epsilon)
|
// compute Theta(h+epsilon)
|
||||||
if (active_flag)
|
if (active_flag)
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
ps_ptr->gridfn_copy(gfns::gfn__Theta, gfns::gfn__save_Theta);
|
ps_ptr->gridfn_copy(gfns::gfn__Theta, gfns::gfn__save_Theta);
|
||||||
ps_ptr->add_to_ghosted_gridfn(epsilon, gfns::gfn__h);
|
ps_ptr->add_to_ghosted_gridfn(epsilon, gfns::gfn__h);
|
||||||
}
|
}
|
||||||
const enum expansion_status status = expansion(ps_ptr, add_to_expansion,
|
const enum expansion_status status = expansion(ps_ptr, add_to_expansion,
|
||||||
initial_flag);
|
initial_flag);
|
||||||
if (status != expansion_success)
|
if (status != expansion_success)
|
||||||
then return status; // *** ERROR RETURN ***
|
then return status; // *** ERROR RETURN ***
|
||||||
|
|
||||||
if (active_flag)
|
if (active_flag)
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
for (int pn = 0; pn < ps_ptr->N_patches(); ++pn)
|
for (int pn = 0; pn < ps_ptr->N_patches(); ++pn)
|
||||||
{
|
{
|
||||||
patch &p = ps_ptr->ith_patch(pn);
|
patch &p = ps_ptr->ith_patch(pn);
|
||||||
for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho)
|
for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho)
|
||||||
{
|
{
|
||||||
for (int isigma = p.min_isigma();
|
for (int isigma = p.min_isigma();
|
||||||
isigma <= p.max_isigma();
|
isigma <= p.max_isigma();
|
||||||
++isigma)
|
++isigma)
|
||||||
{
|
{
|
||||||
const int II = ps_ptr->gpn_of_patch_irho_isigma(p, irho, isigma);
|
const int II = ps_ptr->gpn_of_patch_irho_isigma(p, irho, isigma);
|
||||||
const fp old_Theta = p.gridfn(gfns::gfn__save_Theta,
|
const fp old_Theta = p.gridfn(gfns::gfn__save_Theta,
|
||||||
irho, isigma);
|
irho, isigma);
|
||||||
const fp new_Theta = p.gridfn(gfns::gfn__Theta,
|
const fp new_Theta = p.gridfn(gfns::gfn__Theta,
|
||||||
irho, isigma);
|
irho, isigma);
|
||||||
const fp d_dr_term = (new_Theta - old_Theta) / epsilon;
|
const fp d_dr_term = (new_Theta - old_Theta) / epsilon;
|
||||||
Jac_ptr->sum_into_element(II, II, d_dr_term);
|
Jac_ptr->sum_into_element(II, II, d_dr_term);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore h and Theta
|
// restore h and Theta
|
||||||
ps_ptr->add_to_ghosted_gridfn(-epsilon, gfns::gfn__h);
|
ps_ptr->add_to_ghosted_gridfn(-epsilon, gfns::gfn__h);
|
||||||
ps_ptr->gridfn_copy(gfns::gfn__save_Theta, gfns::gfn__Theta);
|
ps_ptr->gridfn_copy(gfns::gfn__save_Theta, gfns::gfn__Theta);
|
||||||
}
|
}
|
||||||
|
|
||||||
return expansion_success; // *** NORMAL RETURN ***
|
return expansion_success; // *** NORMAL RETURN ***
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif
|
#endif
|
||||||
@@ -1,79 +1,79 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "fd_grid.h"
|
#include "fd_grid.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
using jtutil::error_exit;
|
using jtutil::error_exit;
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function computes a single coefficient of a 1st derivative
|
// This function computes a single coefficient of a 1st derivative
|
||||||
// molecule, for unit grid spacing.
|
// molecule, for unit grid spacing.
|
||||||
//
|
//
|
||||||
// static
|
// static
|
||||||
fp fd_grid::dx_coeff(int m)
|
fp fd_grid::dx_coeff(int m)
|
||||||
{
|
{
|
||||||
switch (m)
|
switch (m)
|
||||||
{
|
{
|
||||||
case -2:
|
case -2:
|
||||||
return FD_GRID__ORDER4__DX__COEFF_M2;
|
return FD_GRID__ORDER4__DX__COEFF_M2;
|
||||||
case -1:
|
case -1:
|
||||||
return FD_GRID__ORDER4__DX__COEFF_M1;
|
return FD_GRID__ORDER4__DX__COEFF_M1;
|
||||||
case 0:
|
case 0:
|
||||||
return FD_GRID__ORDER4__DX__COEFF_0;
|
return FD_GRID__ORDER4__DX__COEFF_0;
|
||||||
case +1:
|
case +1:
|
||||||
return FD_GRID__ORDER4__DX__COEFF_P1;
|
return FD_GRID__ORDER4__DX__COEFF_P1;
|
||||||
case +2:
|
case +2:
|
||||||
return FD_GRID__ORDER4__DX__COEFF_P2;
|
return FD_GRID__ORDER4__DX__COEFF_P2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cout << "***** fd_grid::dx_coeff(): m=" << m << " is outside order=4 molecule radius=" << FD_GRID__MOL_RADIUS << endl;
|
cout << "***** fd_grid::dx_coeff(): m=" << m << " is outside order=4 molecule radius=" << FD_GRID__MOL_RADIUS << endl;
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function computes a single coefficient of a 2nd derivative
|
// This function computes a single coefficient of a 2nd derivative
|
||||||
// molecule, for unit grid spacing.
|
// molecule, for unit grid spacing.
|
||||||
//
|
//
|
||||||
// static
|
// static
|
||||||
fp fd_grid::dxx_coeff(int m)
|
fp fd_grid::dxx_coeff(int m)
|
||||||
{
|
{
|
||||||
switch (m)
|
switch (m)
|
||||||
{
|
{
|
||||||
case -2:
|
case -2:
|
||||||
return FD_GRID__ORDER4__DXX__COEFF_M2;
|
return FD_GRID__ORDER4__DXX__COEFF_M2;
|
||||||
case -1:
|
case -1:
|
||||||
return FD_GRID__ORDER4__DXX__COEFF_M1;
|
return FD_GRID__ORDER4__DXX__COEFF_M1;
|
||||||
case 0:
|
case 0:
|
||||||
return FD_GRID__ORDER4__DXX__COEFF_0;
|
return FD_GRID__ORDER4__DXX__COEFF_0;
|
||||||
case +1:
|
case +1:
|
||||||
return FD_GRID__ORDER4__DXX__COEFF_P1;
|
return FD_GRID__ORDER4__DXX__COEFF_P1;
|
||||||
case +2:
|
case +2:
|
||||||
return FD_GRID__ORDER4__DXX__COEFF_P2;
|
return FD_GRID__ORDER4__DXX__COEFF_P2;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
cout << "***** fd_grid::dx_coeff(): m=" << m << " is outside order=4 molecule radius=" << FD_GRID__MOL_RADIUS << endl;
|
cout << "***** fd_grid::dx_coeff(): m=" << m << " is outside order=4 molecule radius=" << FD_GRID__MOL_RADIUS << endl;
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,459 +1,459 @@
|
|||||||
#ifndef FD_GRID_H
|
#ifndef FD_GRID_H
|
||||||
#define FD_GRID_H
|
#define FD_GRID_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// *** Implementation Notes -- Overview ***
|
// *** Implementation Notes -- Overview ***
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// The key design problem for our finite differencing is how to
|
// The key design problem for our finite differencing is how to
|
||||||
// implement an entire family of 5(9) finite difference operations in
|
// implement an entire family of 5(9) finite difference operations in
|
||||||
// 2D(3D)
|
// 2D(3D)
|
||||||
//
|
//
|
||||||
// partial_rho partial_sigma
|
// partial_rho partial_sigma
|
||||||
// partial_{rho,rho} partial_{rho,sigma}
|
// partial_{rho,rho} partial_{rho,sigma}
|
||||||
// partial_{sigma,sigma}
|
// partial_{sigma,sigma}
|
||||||
//
|
//
|
||||||
// partial_x partial_y partial_z
|
// partial_x partial_y partial_z
|
||||||
// partial_xx partial_xy partial_xz
|
// partial_xx partial_xy partial_xz
|
||||||
// partial_yy partial_yz
|
// partial_yy partial_yz
|
||||||
// partial_zz
|
// partial_zz
|
||||||
//
|
//
|
||||||
// without having to write out the finite differencing molecules multiple
|
// without having to write out the finite differencing molecules multiple
|
||||||
// times, and while still preserving maximum inline-function efficiency.
|
// times, and while still preserving maximum inline-function efficiency.
|
||||||
// In particular, mixed 2nd-order derivative operations like partial_xy
|
// In particular, mixed 2nd-order derivative operations like partial_xy
|
||||||
// should be automatically composed from the two individual 1st derivative
|
// should be automatically composed from the two individual 1st derivative
|
||||||
// operations (partial_x and partial_y).
|
// operations (partial_x and partial_y).
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// Our basic approach is to define each finite difference molecule in
|
// Our basic approach is to define each finite difference molecule in
|
||||||
// a generic 1-dimensional form using an abstract "data(m)" interface.
|
// a generic 1-dimensional form using an abstract "data(m)" interface.
|
||||||
// Here we use the terminology that a finite difference molecule is
|
// Here we use the terminology that a finite difference molecule is
|
||||||
// defined as
|
// defined as
|
||||||
// out[k] = sum(m) c[m] * in[k+m]
|
// out[k] = sum(m) c[m] * in[k+m]
|
||||||
// where c[] is the vector/matrix of molecule coefficients, and m is
|
// where c[] is the vector/matrix of molecule coefficients, and m is
|
||||||
// the (integer) relative grid coordinate within a molecule.
|
// the (integer) relative grid coordinate within a molecule.
|
||||||
//
|
//
|
||||||
// That is, for example, we define the usual 2nd order centered 1st
|
// That is, for example, we define the usual 2nd order centered 1st
|
||||||
// derivative operator as
|
// derivative operator as
|
||||||
// diff = 0.5*inv_delta_x*(data(+1) - data(-1))
|
// diff = 0.5*inv_delta_x*(data(+1) - data(-1))
|
||||||
// leaving unspecified just what the data source is. We then use this
|
// leaving unspecified just what the data source is. We then use this
|
||||||
// with an appropriate data source (indexing along that gridfn array axis)
|
// with an appropriate data source (indexing along that gridfn array axis)
|
||||||
// for each directional derivative operation, and we compose two of
|
// for each directional derivative operation, and we compose two of
|
||||||
// these, using the first along x as the data source for the second
|
// these, using the first along x as the data source for the second
|
||||||
// along y, for the mixed 2nd-order derivative operation.
|
// along y, for the mixed 2nd-order derivative operation.
|
||||||
//
|
//
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// *** Implementation Notes -- Techniques using C++ Templates ***
|
// *** Implementation Notes -- Techniques using C++ Templates ***
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// There are two plausible ways to use C++ templates
|
// There are two plausible ways to use C++ templates
|
||||||
// [C++ templates are described in detail in chapter 13 of
|
// [C++ templates are described in detail in chapter 13 of
|
||||||
// Stroustrup's "The C++ Programming Language" (3rd Edition),
|
// Stroustrup's "The C++ Programming Language" (3rd Edition),
|
||||||
// hereinafter "C++PL", and chapter 15 of Stroustrup's
|
// hereinafter "C++PL", and chapter 15 of Stroustrup's
|
||||||
// "The Design and Evolution of C++", hereinafter "D&EC++".]
|
// "The Design and Evolution of C++", hereinafter "D&EC++".]
|
||||||
// to write the sort of generic-at-compile-time code we want:
|
// to write the sort of generic-at-compile-time code we want:
|
||||||
// - Template specializations for each axis, as discussed in D&EC++
|
// - Template specializations for each axis, as discussed in D&EC++
|
||||||
// section 15.10.3.
|
// section 15.10.3.
|
||||||
// - Overloaded functions for each axis, with an argument type
|
// - Overloaded functions for each axis, with an argument type
|
||||||
// (possibly that of an extra unused argument) selecting the
|
// (possibly that of an extra unused argument) selecting the
|
||||||
// appropriate axis and hence the appropriate function. This
|
// appropriate axis and hence the appropriate function. This
|
||||||
// technique is discussed in D&EC++ section 15.6.3.1.
|
// technique is discussed in D&EC++ section 15.6.3.1.
|
||||||
//
|
//
|
||||||
// Quoting from D&EC++ (section 15.6.3.1),
|
// Quoting from D&EC++ (section 15.6.3.1),
|
||||||
//
|
//
|
||||||
// The fundamental observation is that every property
|
// The fundamental observation is that every property
|
||||||
// of a type or an algorithm can be represented by a
|
// of a type or an algorithm can be represented by a
|
||||||
// type (possibly defined specificaly to do exactly
|
// type (possibly defined specificaly to do exactly
|
||||||
// that). That done, such a type can be used to guide
|
// that). That done, such a type can be used to guide
|
||||||
// the overload resolution to select a function that
|
// the overload resolution to select a function that
|
||||||
// depends on the desired property. [...]
|
// depends on the desired property. [...]
|
||||||
//
|
//
|
||||||
// Please note that thanks to inlining this resolution
|
// Please note that thanks to inlining this resolution
|
||||||
// is done at compile-time, so the appropriate [...]
|
// is done at compile-time, so the appropriate [...]
|
||||||
// function will be called directly without any run-time
|
// function will be called directly without any run-time
|
||||||
// overhead.
|
// overhead.
|
||||||
//
|
//
|
||||||
// Quoting from C++PL3 (section 13.4),
|
// Quoting from C++PL3 (section 13.4),
|
||||||
//
|
//
|
||||||
// Passing [...] operations as a template parameter has two
|
// Passing [...] operations as a template parameter has two
|
||||||
// significant benefits compared to alternatives such as
|
// significant benefits compared to alternatives such as
|
||||||
// passing pointers to functions. Several operations can
|
// passing pointers to functions. Several operations can
|
||||||
// be passed as a single argument with no run-time cost.
|
// be passed as a single argument with no run-time cost.
|
||||||
// In addition, the [...] operators [passed this way] are
|
// In addition, the [...] operators [passed this way] are
|
||||||
// trivial to inline, whereas inlininkg a call through a
|
// trivial to inline, whereas inlininkg a call through a
|
||||||
// pointer to function requires exceptional attention from
|
// pointer to function requires exceptional attention from
|
||||||
// a compiler.
|
// a compiler.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// In my opinion the template-specialization design is cleaner, and it
|
// In my opinion the template-specialization design is cleaner, and it
|
||||||
// clearly has no run-time cost (whereas the overloaded-function design
|
// clearly has no run-time cost (whereas the overloaded-function design
|
||||||
// may have a run-time cost for constructing and passing unused objects),
|
// may have a run-time cost for constructing and passing unused objects),
|
||||||
// so we use it here.
|
// so we use it here.
|
||||||
//
|
//
|
||||||
// There are, however, two (non-fatal) problema with this approach:
|
// There are, however, two (non-fatal) problema with this approach:
|
||||||
// - Unfortunately, it appears C++ (or at least gcc 2.95.1) forbids
|
// - Unfortunately, it appears C++ (or at least gcc 2.95.1) forbids
|
||||||
// template specialization within a class, so some of the functions
|
// template specialization within a class, so some of the functions
|
||||||
// which whould logically be class members, must instead be defined
|
// which whould logically be class members, must instead be defined
|
||||||
// outside any class. We use the namespace fd_stuff:: to hide
|
// outside any class. We use the namespace fd_stuff:: to hide
|
||||||
// these from the outside world.
|
// these from the outside world.
|
||||||
// - C++PL3, section C.13.3, states that
|
// - C++PL3, section C.13.3, states that
|
||||||
// Only class templates can be template arguments.
|
// Only class templates can be template arguments.
|
||||||
// so we have to use dummy classes around some of our template
|
// so we have to use dummy classes around some of our template
|
||||||
// functions. To avoid extra constructor/destructor overhead, we
|
// functions. To avoid extra constructor/destructor overhead, we
|
||||||
// make these template functions static.
|
// make these template functions static.
|
||||||
//
|
//
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// *** Implementation Notes -- Techniques using the C/C++ Preprocessor ***
|
// *** Implementation Notes -- Techniques using the C/C++ Preprocessor ***
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// The fundamental problem with the template approaches is portability:
|
// The fundamental problem with the template approaches is portability:
|
||||||
// Although the C++ standard describes powerful template facilities, not
|
// Although the C++ standard describes powerful template facilities, not
|
||||||
// all C++ compilers yet fully support these. As an alternative, we can
|
// all C++ compilers yet fully support these. As an alternative, we can
|
||||||
// use the C/C++ preprocessor. This is ugly and dangerous (global names!),
|
// use the C/C++ preprocessor. This is ugly and dangerous (global names!),
|
||||||
// but is probably simpler than any of the template approaches. It can
|
// but is probably simpler than any of the template approaches. It can
|
||||||
// provide the same finite differencing functionality and efficiency as
|
// provide the same finite differencing functionality and efficiency as
|
||||||
// the template-based approaches.
|
// the template-based approaches.
|
||||||
//
|
//
|
||||||
// Because of its greater portability, we use the preprocessor-based
|
// Because of its greater portability, we use the preprocessor-based
|
||||||
// approach here.
|
// approach here.
|
||||||
//
|
//
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// *** Implementation Notes -- Run-Time Choice of Molecules ***
|
// *** Implementation Notes -- Run-Time Choice of Molecules ***
|
||||||
//
|
//
|
||||||
// *If* we want to allow the finite differencing scheme to be changed
|
// *If* we want to allow the finite differencing scheme to be changed
|
||||||
// at run-time (e.g. from a parameter file), there are three plausible
|
// at run-time (e.g. from a parameter file), there are three plausible
|
||||||
// ways to do this:
|
// ways to do this:
|
||||||
// - Using switch(molecule_type) , as is standard in C. This is
|
// - Using switch(molecule_type) , as is standard in C. This is
|
||||||
// simple, and for this particular application quite well-structured
|
// simple, and for this particular application quite well-structured
|
||||||
// and maintainable (there are only a few different molecule types,
|
// and maintainable (there are only a few different molecule types,
|
||||||
// all centralized in this file).
|
// all centralized in this file).
|
||||||
// - Using virtual functions, with molecule a virtual base class
|
// - Using virtual functions, with molecule a virtual base class
|
||||||
// and individual molecules derived from it. This is elegant, but
|
// and individual molecules derived from it. This is elegant, but
|
||||||
// may have some performance problems (below). It also requires some
|
// may have some performance problems (below). It also requires some
|
||||||
// sort of switch-based "object factory" to interface with with the
|
// sort of switch-based "object factory" to interface with with the
|
||||||
// molecule-choice parameters.
|
// molecule-choice parameters.
|
||||||
// - Write all the finite differencing code multiple times, once for
|
// - Write all the finite differencing code multiple times, once for
|
||||||
// each finite differencing scheme.
|
// each finite differencing scheme.
|
||||||
//
|
//
|
||||||
// The typical use of these functions will be from within a loop over
|
// The typical use of these functions will be from within a loop over
|
||||||
// a whole grid. In both cases we can expect excellent accuracy from
|
// a whole grid. In both cases we can expect excellent accuracy from
|
||||||
// modern hardware branch prediction (and thus minimal performance loss
|
// modern hardware branch prediction (and thus minimal performance loss
|
||||||
// from the branching). It's reasonable to expect a compiler to fully
|
// from the branching). It's reasonable to expect a compiler to fully
|
||||||
// inline the switch-based code, exposing all the gridfn array subscriptings
|
// inline the switch-based code, exposing all the gridfn array subscriptings
|
||||||
// to strength reduction etc, but this is much trickier for the
|
// to strength reduction etc, but this is much trickier for the
|
||||||
// virtual-function--based code. For this reason, the switch-based
|
// virtual-function--based code. For this reason, the switch-based
|
||||||
// design seems superior to the virtual-function--based one.
|
// design seems superior to the virtual-function--based one.
|
||||||
//
|
//
|
||||||
// However, at present we don't implement any run-time selection: we
|
// However, at present we don't implement any run-time selection: we
|
||||||
// "just" fix the finite differencing scheme at compile time via the
|
// "just" fix the finite differencing scheme at compile time via the
|
||||||
// preprocessor.
|
// preprocessor.
|
||||||
//
|
//
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// *** finite difference molecules ***
|
// *** finite difference molecules ***
|
||||||
//
|
//
|
||||||
|
|
||||||
//**************************************
|
//**************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// define the actual molecules
|
// define the actual molecules
|
||||||
//
|
//
|
||||||
// In the following macros, we first define all the distinct floating-
|
// In the following macros, we first define all the distinct floating-
|
||||||
// -point numbers appearing in a molecules as "K" constants (all > 0),
|
// -point numbers appearing in a molecules as "K" constants (all > 0),
|
||||||
// then define the actual derivative and its molecule coefficients
|
// then define the actual derivative and its molecule coefficients
|
||||||
// using +/- the "K" constants, with multiplies by 1.0 elided and 0
|
// using +/- the "K" constants, with multiplies by 1.0 elided and 0
|
||||||
// terms skipped in computing the derivative. This (hopefully) gives
|
// terms skipped in computing the derivative. This (hopefully) gives
|
||||||
// maximum efficiency by avoiding the generated code loading the same
|
// maximum efficiency by avoiding the generated code loading the same
|
||||||
// constants multiple times.
|
// constants multiple times.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// The molecule macros all take the following arguments:
|
// The molecule macros all take the following arguments:
|
||||||
// inv_delta_x_ = inverse of grid spacing in the finite differencing
|
// inv_delta_x_ = inverse of grid spacing in the finite differencing
|
||||||
// direction
|
// direction
|
||||||
// data_= a data-fetching function or macro: data_(ghosted_gfn, irho, isigma)
|
// data_= a data-fetching function or macro: data_(ghosted_gfn, irho, isigma)
|
||||||
// is the data to be finite differenced
|
// is the data to be finite differenced
|
||||||
// irho_plus_m_ = a function or macro: irho_plus_m_(irho,m) returns the
|
// irho_plus_m_ = a function or macro: irho_plus_m_(irho,m) returns the
|
||||||
// rho coordinate to be passed to data_() for the [m]
|
// rho coordinate to be passed to data_() for the [m]
|
||||||
// molecule coefficient
|
// molecule coefficient
|
||||||
// isigma_plus_m_ = same thing, for the sigma coordinate
|
// isigma_plus_m_ = same thing, for the sigma coordinate
|
||||||
//
|
//
|
||||||
// n.b. We grab the variables ghosted_gfn, irho, and isigma from the calling
|
// n.b. We grab the variables ghosted_gfn, irho, and isigma from the calling
|
||||||
// environment, and we define assorted local variables as needed!
|
// environment, and we define assorted local variables as needed!
|
||||||
//
|
//
|
||||||
|
|
||||||
//**************************************
|
//**************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// 2nd order
|
// 2nd order
|
||||||
//
|
//
|
||||||
|
|
||||||
#define FD_GRID__ORDER2__MOL_RADIUS 1
|
#define FD_GRID__ORDER2__MOL_RADIUS 1
|
||||||
#define FD_GRID__ORDER2__MOL_DIAMETER 3
|
#define FD_GRID__ORDER2__MOL_DIAMETER 3
|
||||||
|
|
||||||
#define FD_GRID__ORDER2__DX__KPM1 0.5
|
#define FD_GRID__ORDER2__DX__KPM1 0.5
|
||||||
#define FD_GRID__ORDER2__DX(inv_delta_x_, data_, \
|
#define FD_GRID__ORDER2__DX(inv_delta_x_, data_, \
|
||||||
irho_plus_m_, isigma_plus_m_) \
|
irho_plus_m_, isigma_plus_m_) \
|
||||||
const fp data_p1 = data_(ghosted_gfn, \
|
const fp data_p1 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, +1), \
|
irho_plus_m_(irho, +1), \
|
||||||
isigma_plus_m_(isigma, +1)); \
|
isigma_plus_m_(isigma, +1)); \
|
||||||
const fp data_m1 = data_(ghosted_gfn, \
|
const fp data_m1 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, -1), \
|
irho_plus_m_(irho, -1), \
|
||||||
isigma_plus_m_(isigma, -1)); \
|
isigma_plus_m_(isigma, -1)); \
|
||||||
const fp sum = FD_GRID__ORDER2__DX__KPM1 * (data_p1 - data_m1); \
|
const fp sum = FD_GRID__ORDER2__DX__KPM1 * (data_p1 - data_m1); \
|
||||||
return inv_delta_x_ * sum; /* end macro */
|
return inv_delta_x_ * sum; /* end macro */
|
||||||
#define FD_GRID__ORDER2__DX__COEFF_M1 (-FD_GRID__ORDER2__DX__KPM1)
|
#define FD_GRID__ORDER2__DX__COEFF_M1 (-FD_GRID__ORDER2__DX__KPM1)
|
||||||
#define FD_GRID__ORDER2__DX__COEFF_0 0.0
|
#define FD_GRID__ORDER2__DX__COEFF_0 0.0
|
||||||
#define FD_GRID__ORDER2__DX__COEFF_P1 (+FD_GRID__ORDER2__DX__KPM1)
|
#define FD_GRID__ORDER2__DX__COEFF_P1 (+FD_GRID__ORDER2__DX__KPM1)
|
||||||
|
|
||||||
#define FD_GRID__ORDER2__DXX__K0 2.0
|
#define FD_GRID__ORDER2__DXX__K0 2.0
|
||||||
#define FD_GRID__ORDER2__DXX(inv_delta_x_, data_, \
|
#define FD_GRID__ORDER2__DXX(inv_delta_x_, data_, \
|
||||||
irho_plus_m_, isigma_plus_m_) \
|
irho_plus_m_, isigma_plus_m_) \
|
||||||
const fp data_p1 = data_(ghosted_gfn, \
|
const fp data_p1 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, +1), \
|
irho_plus_m_(irho, +1), \
|
||||||
isigma_plus_m_(isigma, +1)); \
|
isigma_plus_m_(isigma, +1)); \
|
||||||
const fp data_0 = data_(ghosted_gfn, \
|
const fp data_0 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, 0), \
|
irho_plus_m_(irho, 0), \
|
||||||
isigma_plus_m_(isigma, 0)); \
|
isigma_plus_m_(isigma, 0)); \
|
||||||
const fp data_m1 = data_(ghosted_gfn, \
|
const fp data_m1 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, -1), \
|
irho_plus_m_(irho, -1), \
|
||||||
isigma_plus_m_(isigma, -1)); \
|
isigma_plus_m_(isigma, -1)); \
|
||||||
const fp sum = data_m1 - FD_GRID__ORDER2__DXX__K0 * data_0 + data_p1; \
|
const fp sum = data_m1 - FD_GRID__ORDER2__DXX__K0 * data_0 + data_p1; \
|
||||||
return jtutil::pow2(inv_delta_x_) * sum; /* end macro */
|
return jtutil::pow2(inv_delta_x_) * sum; /* end macro */
|
||||||
#define FD_GRID__ORDER2__DXX__COEFF_M1 1.0
|
#define FD_GRID__ORDER2__DXX__COEFF_M1 1.0
|
||||||
#define FD_GRID__ORDER2__DXX__COEFF_0 (-FD_GRID__ORDER2__DXX__K0)
|
#define FD_GRID__ORDER2__DXX__COEFF_0 (-FD_GRID__ORDER2__DXX__K0)
|
||||||
#define FD_GRID__ORDER2__DXX__COEFF_P1 1.0
|
#define FD_GRID__ORDER2__DXX__COEFF_P1 1.0
|
||||||
|
|
||||||
//**************************************
|
//**************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// 4th order
|
// 4th order
|
||||||
//
|
//
|
||||||
|
|
||||||
#define FD_GRID__ORDER4__MOL_RADIUS 2
|
#define FD_GRID__ORDER4__MOL_RADIUS 2
|
||||||
#define FD_GRID__ORDER4__MOL_DIAMETER 5
|
#define FD_GRID__ORDER4__MOL_DIAMETER 5
|
||||||
|
|
||||||
#define FD_GRID__ORDER4__DX__KPM2 (1.0 / 12.0)
|
#define FD_GRID__ORDER4__DX__KPM2 (1.0 / 12.0)
|
||||||
#define FD_GRID__ORDER4__DX__KPM1 (8.0 / 12.0)
|
#define FD_GRID__ORDER4__DX__KPM1 (8.0 / 12.0)
|
||||||
#define FD_GRID__ORDER4__DX(inv_delta_x_, data_, \
|
#define FD_GRID__ORDER4__DX(inv_delta_x_, data_, \
|
||||||
irho_plus_m_, isigma_plus_m_) \
|
irho_plus_m_, isigma_plus_m_) \
|
||||||
const fp data_p2 = data_(ghosted_gfn, \
|
const fp data_p2 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, +2), \
|
irho_plus_m_(irho, +2), \
|
||||||
isigma_plus_m_(isigma, +2)); \
|
isigma_plus_m_(isigma, +2)); \
|
||||||
const fp data_p1 = data_(ghosted_gfn, \
|
const fp data_p1 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, +1), \
|
irho_plus_m_(irho, +1), \
|
||||||
isigma_plus_m_(isigma, +1)); \
|
isigma_plus_m_(isigma, +1)); \
|
||||||
const fp data_m1 = data_(ghosted_gfn, \
|
const fp data_m1 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, -1), \
|
irho_plus_m_(irho, -1), \
|
||||||
isigma_plus_m_(isigma, -1)); \
|
isigma_plus_m_(isigma, -1)); \
|
||||||
const fp data_m2 = data_(ghosted_gfn, \
|
const fp data_m2 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, -2), \
|
irho_plus_m_(irho, -2), \
|
||||||
isigma_plus_m_(isigma, -2)); \
|
isigma_plus_m_(isigma, -2)); \
|
||||||
const fp sum = FD_GRID__ORDER4__DX__KPM1 * (data_p1 - data_m1) + FD_GRID__ORDER4__DX__KPM2 * (data_m2 - data_p2); \
|
const fp sum = FD_GRID__ORDER4__DX__KPM1 * (data_p1 - data_m1) + FD_GRID__ORDER4__DX__KPM2 * (data_m2 - data_p2); \
|
||||||
/* printf("(%2d %2d) %f %f %f %f\n",irho, isigma,data_m2, data_m1,data_p1, data_p2);*/ \
|
/* printf("(%2d %2d) %f %f %f %f\n",irho, isigma,data_m2, data_m1,data_p1, data_p2);*/ \
|
||||||
return inv_delta_x_ * sum; /* end macro */
|
return inv_delta_x_ * sum; /* end macro */
|
||||||
#define FD_GRID__ORDER4__DX__COEFF_M2 (+FD_GRID__ORDER4__DX__KPM2)
|
#define FD_GRID__ORDER4__DX__COEFF_M2 (+FD_GRID__ORDER4__DX__KPM2)
|
||||||
#define FD_GRID__ORDER4__DX__COEFF_M1 (-FD_GRID__ORDER4__DX__KPM1)
|
#define FD_GRID__ORDER4__DX__COEFF_M1 (-FD_GRID__ORDER4__DX__KPM1)
|
||||||
#define FD_GRID__ORDER4__DX__COEFF_0 0.0
|
#define FD_GRID__ORDER4__DX__COEFF_0 0.0
|
||||||
#define FD_GRID__ORDER4__DX__COEFF_P1 (+FD_GRID__ORDER4__DX__KPM1)
|
#define FD_GRID__ORDER4__DX__COEFF_P1 (+FD_GRID__ORDER4__DX__KPM1)
|
||||||
#define FD_GRID__ORDER4__DX__COEFF_P2 (-FD_GRID__ORDER4__DX__KPM2)
|
#define FD_GRID__ORDER4__DX__COEFF_P2 (-FD_GRID__ORDER4__DX__KPM2)
|
||||||
|
|
||||||
//**************************************
|
//**************************************
|
||||||
|
|
||||||
#define FD_GRID__ORDER4__DXX__KPM2 (1.0 / 12.0)
|
#define FD_GRID__ORDER4__DXX__KPM2 (1.0 / 12.0)
|
||||||
#define FD_GRID__ORDER4__DXX__KPM1 (16.0 / 12.0)
|
#define FD_GRID__ORDER4__DXX__KPM1 (16.0 / 12.0)
|
||||||
#define FD_GRID__ORDER4__DXX__K0 (30.0 / 12.0)
|
#define FD_GRID__ORDER4__DXX__K0 (30.0 / 12.0)
|
||||||
#define FD_GRID__ORDER4__DXX(inv_delta_x_, data_, \
|
#define FD_GRID__ORDER4__DXX(inv_delta_x_, data_, \
|
||||||
irho_plus_m_, isigma_plus_m_) \
|
irho_plus_m_, isigma_plus_m_) \
|
||||||
const fp data_p2 = data_(ghosted_gfn, \
|
const fp data_p2 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, +2), \
|
irho_plus_m_(irho, +2), \
|
||||||
isigma_plus_m_(isigma, +2)); \
|
isigma_plus_m_(isigma, +2)); \
|
||||||
const fp data_p1 = data_(ghosted_gfn, \
|
const fp data_p1 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, +1), \
|
irho_plus_m_(irho, +1), \
|
||||||
isigma_plus_m_(isigma, +1)); \
|
isigma_plus_m_(isigma, +1)); \
|
||||||
const fp data_0 = data_(ghosted_gfn, \
|
const fp data_0 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, 0), \
|
irho_plus_m_(irho, 0), \
|
||||||
isigma_plus_m_(isigma, 0)); \
|
isigma_plus_m_(isigma, 0)); \
|
||||||
const fp data_m1 = data_(ghosted_gfn, \
|
const fp data_m1 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, -1), \
|
irho_plus_m_(irho, -1), \
|
||||||
isigma_plus_m_(isigma, -1)); \
|
isigma_plus_m_(isigma, -1)); \
|
||||||
const fp data_m2 = data_(ghosted_gfn, \
|
const fp data_m2 = data_(ghosted_gfn, \
|
||||||
irho_plus_m_(irho, -2), \
|
irho_plus_m_(irho, -2), \
|
||||||
isigma_plus_m_(isigma, -2)); \
|
isigma_plus_m_(isigma, -2)); \
|
||||||
const fp sum = -FD_GRID__ORDER4__DXX__K0 * data_0 + FD_GRID__ORDER4__DXX__KPM1 * (data_m1 + data_p1) - FD_GRID__ORDER4__DXX__KPM2 * (data_m2 + data_p2); \
|
const fp sum = -FD_GRID__ORDER4__DXX__K0 * data_0 + FD_GRID__ORDER4__DXX__KPM1 * (data_m1 + data_p1) - FD_GRID__ORDER4__DXX__KPM2 * (data_m2 + data_p2); \
|
||||||
return jtutil::pow2(inv_delta_x_) * sum; /* end macro */
|
return jtutil::pow2(inv_delta_x_) * sum; /* end macro */
|
||||||
#define FD_GRID__ORDER4__DXX__COEFF_M2 (-FD_GRID__ORDER4__DXX__KPM2)
|
#define FD_GRID__ORDER4__DXX__COEFF_M2 (-FD_GRID__ORDER4__DXX__KPM2)
|
||||||
#define FD_GRID__ORDER4__DXX__COEFF_M1 (+FD_GRID__ORDER4__DXX__KPM1)
|
#define FD_GRID__ORDER4__DXX__COEFF_M1 (+FD_GRID__ORDER4__DXX__KPM1)
|
||||||
#define FD_GRID__ORDER4__DXX__COEFF_0 (-FD_GRID__ORDER4__DXX__K0)
|
#define FD_GRID__ORDER4__DXX__COEFF_0 (-FD_GRID__ORDER4__DXX__K0)
|
||||||
#define FD_GRID__ORDER4__DXX__COEFF_P1 (+FD_GRID__ORDER4__DXX__KPM1)
|
#define FD_GRID__ORDER4__DXX__COEFF_P1 (+FD_GRID__ORDER4__DXX__KPM1)
|
||||||
#define FD_GRID__ORDER4__DXX__COEFF_P2 (-FD_GRID__ORDER4__DXX__KPM2)
|
#define FD_GRID__ORDER4__DXX__COEFF_P2 (-FD_GRID__ORDER4__DXX__KPM2)
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
#define FD_GRID__MOL_RADIUS FD_GRID__ORDER4__MOL_RADIUS
|
#define FD_GRID__MOL_RADIUS FD_GRID__ORDER4__MOL_RADIUS
|
||||||
#define FD_GRID__MOL_DIAMETER FD_GRID__ORDER4__MOL_DIAMETER
|
#define FD_GRID__MOL_DIAMETER FD_GRID__ORDER4__MOL_DIAMETER
|
||||||
#define FD_GRID__DX FD_GRID__ORDER4__DX
|
#define FD_GRID__DX FD_GRID__ORDER4__DX
|
||||||
#define FD_GRID__DXX FD_GRID__ORDER4__DXX
|
#define FD_GRID__DXX FD_GRID__ORDER4__DXX
|
||||||
|
|
||||||
#define FD_GRID__MOL_AREA (FD_GRID__MOL_DIAMETER * FD_GRID__MOL_DIAMETER)
|
#define FD_GRID__MOL_AREA (FD_GRID__MOL_DIAMETER * FD_GRID__MOL_DIAMETER)
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** fd_grid - grid with finite differencing operations *****
|
// ***** fd_grid - grid with finite differencing operations *****
|
||||||
//
|
//
|
||||||
// An fd_grid is identical to a grid except that it also defines
|
// An fd_grid is identical to a grid except that it also defines
|
||||||
// (rho,sigma)-coordinate finite differencing operations on gridfns.
|
// (rho,sigma)-coordinate finite differencing operations on gridfns.
|
||||||
//
|
//
|
||||||
|
|
||||||
class fd_grid
|
class fd_grid
|
||||||
: public grid
|
: public grid
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// molecule sizes
|
// molecule sizes
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
// n.b. this interface implicitly assumes that all molecules
|
// n.b. this interface implicitly assumes that all molecules
|
||||||
// are centered and are the same order and size
|
// are centered and are the same order and size
|
||||||
static int finite_diff_order() { return 4; }
|
static int finite_diff_order() { return 4; }
|
||||||
static int molecule_radius() { return FD_GRID__MOL_RADIUS; }
|
static int molecule_radius() { return FD_GRID__MOL_RADIUS; }
|
||||||
static int molecule_diameter() { return FD_GRID__MOL_DIAMETER; }
|
static int molecule_diameter() { return FD_GRID__MOL_DIAMETER; }
|
||||||
static int molecule_min_m() { return -FD_GRID__MOL_RADIUS; }
|
static int molecule_min_m() { return -FD_GRID__MOL_RADIUS; }
|
||||||
static int molecule_max_m() { return FD_GRID__MOL_RADIUS; }
|
static int molecule_max_m() { return FD_GRID__MOL_RADIUS; }
|
||||||
|
|
||||||
//
|
//
|
||||||
// helper functions to compute (irho,isigma) + [m]
|
// helper functions to compute (irho,isigma) + [m]
|
||||||
// along each axis
|
// along each axis
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
static int rho_axis__irho_plus_m(int irho, int m) { return irho + m; }
|
static int rho_axis__irho_plus_m(int irho, int m) { return irho + m; }
|
||||||
static int rho_axis__isigma_plus_m(int isigma, int m) { return isigma; }
|
static int rho_axis__isigma_plus_m(int isigma, int m) { return isigma; }
|
||||||
static int sigma_axis__irho_plus_m(int irho, int m) { return irho; }
|
static int sigma_axis__irho_plus_m(int irho, int m) { return irho; }
|
||||||
static int sigma_axis__isigma_plus_m(int isigma, int m) { return isigma + m; }
|
static int sigma_axis__isigma_plus_m(int isigma, int m) { return isigma + m; }
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** finite differencing *****
|
// ***** finite differencing *****
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
// 1st derivatives
|
// 1st derivatives
|
||||||
fp partial_rho(int ghosted_gfn, int irho, int isigma)
|
fp partial_rho(int ghosted_gfn, int irho, int isigma)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
FD_GRID__DX(inverse_delta_rho(),
|
FD_GRID__DX(inverse_delta_rho(),
|
||||||
ghosted_gridfn,
|
ghosted_gridfn,
|
||||||
rho_axis__irho_plus_m,
|
rho_axis__irho_plus_m,
|
||||||
rho_axis__isigma_plus_m);
|
rho_axis__isigma_plus_m);
|
||||||
}
|
}
|
||||||
fp partial_sigma(int ghosted_gfn, int irho, int isigma)
|
fp partial_sigma(int ghosted_gfn, int irho, int isigma)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
FD_GRID__DX(inverse_delta_sigma(),
|
FD_GRID__DX(inverse_delta_sigma(),
|
||||||
ghosted_gridfn,
|
ghosted_gridfn,
|
||||||
sigma_axis__irho_plus_m,
|
sigma_axis__irho_plus_m,
|
||||||
sigma_axis__isigma_plus_m);
|
sigma_axis__isigma_plus_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "pure" 2nd derivatives
|
// "pure" 2nd derivatives
|
||||||
fp partial_rho_rho(int ghosted_gfn, int irho, int isigma)
|
fp partial_rho_rho(int ghosted_gfn, int irho, int isigma)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
FD_GRID__DXX(inverse_delta_rho(),
|
FD_GRID__DXX(inverse_delta_rho(),
|
||||||
ghosted_gridfn,
|
ghosted_gridfn,
|
||||||
rho_axis__irho_plus_m,
|
rho_axis__irho_plus_m,
|
||||||
rho_axis__isigma_plus_m);
|
rho_axis__isigma_plus_m);
|
||||||
}
|
}
|
||||||
fp partial_sigma_sigma(int ghosted_gfn, int irho, int isigma)
|
fp partial_sigma_sigma(int ghosted_gfn, int irho, int isigma)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
FD_GRID__DXX(inverse_delta_sigma(),
|
FD_GRID__DXX(inverse_delta_sigma(),
|
||||||
ghosted_gridfn,
|
ghosted_gridfn,
|
||||||
sigma_axis__irho_plus_m,
|
sigma_axis__irho_plus_m,
|
||||||
sigma_axis__isigma_plus_m);
|
sigma_axis__isigma_plus_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mixed 2nd partial derivative
|
// mixed 2nd partial derivative
|
||||||
fp partial_rho_sigma(int ghosted_gfn, int irho, int isigma)
|
fp partial_rho_sigma(int ghosted_gfn, int irho, int isigma)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
FD_GRID__DX(inverse_delta_rho(),
|
FD_GRID__DX(inverse_delta_rho(),
|
||||||
partial_sigma,
|
partial_sigma,
|
||||||
rho_axis__irho_plus_m,
|
rho_axis__irho_plus_m,
|
||||||
rho_axis__isigma_plus_m);
|
rho_axis__isigma_plus_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** molecule coefficients *****
|
// ***** molecule coefficients *****
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
// molecule coefficients
|
// molecule coefficients
|
||||||
// n.b. this interface implicitly assumes that all molecules
|
// n.b. this interface implicitly assumes that all molecules
|
||||||
// are position-independent
|
// are position-independent
|
||||||
fp partial_rho_coeff(int m) const
|
fp partial_rho_coeff(int m) const
|
||||||
{
|
{
|
||||||
return inverse_delta_rho() * dx_coeff(m);
|
return inverse_delta_rho() * dx_coeff(m);
|
||||||
}
|
}
|
||||||
fp partial_sigma_coeff(int m) const
|
fp partial_sigma_coeff(int m) const
|
||||||
{
|
{
|
||||||
return inverse_delta_sigma() * dx_coeff(m);
|
return inverse_delta_sigma() * dx_coeff(m);
|
||||||
}
|
}
|
||||||
fp partial_rho_rho_coeff(int m) const
|
fp partial_rho_rho_coeff(int m) const
|
||||||
{
|
{
|
||||||
return jtutil::pow2(inverse_delta_rho()) * dxx_coeff(m);
|
return jtutil::pow2(inverse_delta_rho()) * dxx_coeff(m);
|
||||||
}
|
}
|
||||||
fp partial_sigma_sigma_coeff(int m) const
|
fp partial_sigma_sigma_coeff(int m) const
|
||||||
{
|
{
|
||||||
return jtutil::pow2(inverse_delta_sigma()) * dxx_coeff(m);
|
return jtutil::pow2(inverse_delta_sigma()) * dxx_coeff(m);
|
||||||
}
|
}
|
||||||
fp partial_rho_sigma_coeff(int m_rho, int m_sigma) const
|
fp partial_rho_sigma_coeff(int m_rho, int m_sigma) const
|
||||||
{
|
{
|
||||||
return partial_rho_coeff(m_rho) * partial_sigma_coeff(m_sigma);
|
return partial_rho_coeff(m_rho) * partial_sigma_coeff(m_sigma);
|
||||||
}
|
}
|
||||||
|
|
||||||
// worker functions: molecule coefficients for unit grid spacing
|
// worker functions: molecule coefficients for unit grid spacing
|
||||||
private:
|
private:
|
||||||
static fp dx_coeff(int m);
|
static fp dx_coeff(int m);
|
||||||
static fp dxx_coeff(int m);
|
static fp dxx_coeff(int m);
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** constructor, destructor *****
|
// ***** constructor, destructor *****
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
// constructor: pass through to grid:: constructor
|
// constructor: pass through to grid:: constructor
|
||||||
fd_grid(const grid_array_pars &grid_array_pars_in,
|
fd_grid(const grid_array_pars &grid_array_pars_in,
|
||||||
const grid_pars &grid_pars_in)
|
const grid_pars &grid_pars_in)
|
||||||
: grid(grid_array_pars_in, grid_pars_in)
|
: grid(grid_array_pars_in, grid_pars_in)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// compiler-generated default destructor is ok
|
// compiler-generated default destructor is ok
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// we forbid copying and passing by value
|
// we forbid copying and passing by value
|
||||||
// by declaring the copy constructor and assignment operator
|
// by declaring the copy constructor and assignment operator
|
||||||
// private, but never defining them
|
// private, but never defining them
|
||||||
fd_grid(const fd_grid &rhs);
|
fd_grid(const fd_grid &rhs);
|
||||||
fd_grid &operator=(const fd_grid &rhs);
|
fd_grid &operator=(const fd_grid &rhs);
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* FD_GRID_H */
|
#endif /* FD_GRID_H */
|
||||||
@@ -1,137 +1,137 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "macrodef.h"
|
#include "macrodef.h"
|
||||||
#ifdef With_AHF
|
#ifdef With_AHF
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "fd_grid.h"
|
#include "fd_grid.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
#include "patch_edge.h"
|
#include "patch_edge.h"
|
||||||
#include "patch_interp.h"
|
#include "patch_interp.h"
|
||||||
#include "ghost_zone.h"
|
#include "ghost_zone.h"
|
||||||
#include "patch_system.h"
|
#include "patch_system.h"
|
||||||
|
|
||||||
#include "Jacobian.h"
|
#include "Jacobian.h"
|
||||||
|
|
||||||
#include "gfns.h"
|
#include "gfns.h"
|
||||||
#include "gr.h"
|
#include "gr.h"
|
||||||
|
|
||||||
#include "horizon_sequence.h"
|
#include "horizon_sequence.h"
|
||||||
#include "BH_diagnostics.h"
|
#include "BH_diagnostics.h"
|
||||||
#include "myglobal.h"
|
#include "myglobal.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
void recentering(patch_system &ps, double max_x, double max_y, double max_z,
|
void recentering(patch_system &ps, double max_x, double max_y, double max_z,
|
||||||
double min_x, double min_y, double min_z,
|
double min_x, double min_y, double min_z,
|
||||||
double centroid_x, double centroid_y, double centroid_z);
|
double centroid_x, double centroid_y, double centroid_z);
|
||||||
extern struct state state;
|
extern struct state state;
|
||||||
|
|
||||||
void AHFinderDirect_find_horizons(int HN, int *dumpid,
|
void AHFinderDirect_find_horizons(int HN, int *dumpid,
|
||||||
double *xc, double *yc, double *zc, double *xr, double *yr, double *zr,
|
double *xc, double *yc, double *zc, double *xr, double *yr, double *zr,
|
||||||
bool *trigger, double *dT)
|
bool *trigger, double *dT)
|
||||||
{
|
{
|
||||||
const int my_proc = state.my_proc;
|
const int my_proc = state.my_proc;
|
||||||
horizon_sequence &hs = *state.my_hs;
|
horizon_sequence &hs = *state.my_hs;
|
||||||
if (my_proc == 0 && hs.N_horizons() != HN)
|
if (my_proc == 0 && hs.N_horizons() != HN)
|
||||||
{
|
{
|
||||||
cout << "input number " << HN << " != " << "number of wanted horizons " << hs.N_horizons() << endl;
|
cout << "input number " << HN << " != " << "number of wanted horizons " << hs.N_horizons() << endl;
|
||||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
state.ADM->AH_Prepare_derivatives();
|
state.ADM->AH_Prepare_derivatives();
|
||||||
|
|
||||||
for (int hn = hs.init_hn(); hs.is_genuine(); hn = hs.next_hn())
|
for (int hn = hs.init_hn(); hs.is_genuine(); hn = hs.next_hn())
|
||||||
{
|
{
|
||||||
int ihn = hs.get_hn();
|
int ihn = hs.get_hn();
|
||||||
assert(ihn > 0 && ihn <= HN);
|
assert(ihn > 0 && ihn <= HN);
|
||||||
ihn = ihn - 1;
|
ihn = ihn - 1;
|
||||||
|
|
||||||
struct AH_data &AH_data = *state.AH_data_array[hn];
|
struct AH_data &AH_data = *state.AH_data_array[hn];
|
||||||
|
|
||||||
AH_data.find_trigger = trigger[ihn];
|
AH_data.find_trigger = trigger[ihn];
|
||||||
if (AH_data.find_trigger)
|
if (AH_data.find_trigger)
|
||||||
{
|
{
|
||||||
if (AH_data.found_flag)
|
if (AH_data.found_flag)
|
||||||
AH_data.initial_find_flag = false;
|
AH_data.initial_find_flag = false;
|
||||||
else if (AH_data.recentering_flag == false)
|
else if (AH_data.recentering_flag == false)
|
||||||
{
|
{
|
||||||
patch_system &ps = *AH_data.ps_ptr;
|
patch_system &ps = *AH_data.ps_ptr;
|
||||||
recentering(ps, xc[ihn] + xr[ihn] / 2, yc[ihn] + yr[ihn] / 2, zc[ihn] + zr[ihn] / 2,
|
recentering(ps, xc[ihn] + xr[ihn] / 2, yc[ihn] + yr[ihn] / 2, zc[ihn] + zr[ihn] / 2,
|
||||||
xc[ihn] - xr[ihn] / 2, yc[ihn] - yr[ihn] / 2, zc[ihn] - zr[ihn] / 2,
|
xc[ihn] - xr[ihn] / 2, yc[ihn] - yr[ihn] / 2, zc[ihn] - zr[ihn] / 2,
|
||||||
xc[ihn], yc[ihn], zc[ihn]);
|
xc[ihn], yc[ihn], zc[ihn]);
|
||||||
setup_initial_guess(ps, xc[ihn], yc[ihn], zc[ihn], xr[ihn], yr[ihn], zr[ihn]);
|
setup_initial_guess(ps, xc[ihn], yc[ihn], zc[ihn], xr[ihn], yr[ihn], zr[ihn]);
|
||||||
AH_data.initial_find_flag = true;
|
AH_data.initial_find_flag = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AH_data.stop_finding == true;
|
AH_data.stop_finding == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end for hn
|
} // end for hn
|
||||||
|
|
||||||
Newton(state.N_procs, state.N_active_procs, my_proc,
|
Newton(state.N_procs, state.N_active_procs, my_proc,
|
||||||
*state.my_hs, state.AH_data_array,
|
*state.my_hs, state.AH_data_array,
|
||||||
state.isb, dumpid, dT);
|
state.isb, dumpid, dT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AHFinderDirect_enforcefind(int HN,
|
void AHFinderDirect_enforcefind(int HN,
|
||||||
double *xc, double *yc, double *zc, double *xr, double *yr, double *zr)
|
double *xc, double *yc, double *zc, double *xr, double *yr, double *zr)
|
||||||
{
|
{
|
||||||
const int my_proc = state.my_proc;
|
const int my_proc = state.my_proc;
|
||||||
horizon_sequence &hs = *state.my_hs;
|
horizon_sequence &hs = *state.my_hs;
|
||||||
if (my_proc == 0 && hs.N_horizons() != HN)
|
if (my_proc == 0 && hs.N_horizons() != HN)
|
||||||
{
|
{
|
||||||
cout << "input number " << HN << " != " << "number of wanted horizons " << hs.N_horizons() << endl;
|
cout << "input number " << HN << " != " << "number of wanted horizons " << hs.N_horizons() << endl;
|
||||||
MPI_Abort(MPI_COMM_WORLD, 1);
|
MPI_Abort(MPI_COMM_WORLD, 1);
|
||||||
}
|
}
|
||||||
bool *trigger;
|
bool *trigger;
|
||||||
int *dumpid;
|
int *dumpid;
|
||||||
double *dTT;
|
double *dTT;
|
||||||
trigger = new bool[HN];
|
trigger = new bool[HN];
|
||||||
dumpid = new int[HN];
|
dumpid = new int[HN];
|
||||||
dTT = new double[HN];
|
dTT = new double[HN];
|
||||||
for (int ihn = 0; ihn < HN; ihn++)
|
for (int ihn = 0; ihn < HN; ihn++)
|
||||||
{
|
{
|
||||||
trigger[ihn] = true;
|
trigger[ihn] = true;
|
||||||
dumpid[ihn] = 1;
|
dumpid[ihn] = 1;
|
||||||
dTT[ihn] = 1;
|
dTT[ihn] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int hn = hs.init_hn(); hs.is_genuine(); hn = hs.next_hn())
|
for (int hn = hs.init_hn(); hs.is_genuine(); hn = hs.next_hn())
|
||||||
{
|
{
|
||||||
int ihn = hs.get_hn();
|
int ihn = hs.get_hn();
|
||||||
assert(ihn > 0 && ihn <= HN);
|
assert(ihn > 0 && ihn <= HN);
|
||||||
|
|
||||||
struct AH_data &AH_data = *state.AH_data_array[hn];
|
struct AH_data &AH_data = *state.AH_data_array[hn];
|
||||||
|
|
||||||
AH_data.find_trigger = true;
|
AH_data.find_trigger = true;
|
||||||
AH_data.stop_finding = false;
|
AH_data.stop_finding = false;
|
||||||
AH_data.found_flag = false;
|
AH_data.found_flag = false;
|
||||||
AH_data.recentering_flag = false;
|
AH_data.recentering_flag = false;
|
||||||
AH_data.initial_find_flag = true;
|
AH_data.initial_find_flag = true;
|
||||||
|
|
||||||
} // end for hn
|
} // end for hn
|
||||||
|
|
||||||
AHFinderDirect_find_horizons(HN, dumpid, xc, yc, zc, xr, yr, zr, trigger, dTT);
|
AHFinderDirect_find_horizons(HN, dumpid, xc, yc, zc, xr, yr, zr, trigger, dTT);
|
||||||
|
|
||||||
delete[] trigger;
|
delete[] trigger;
|
||||||
delete[] dumpid;
|
delete[] dumpid;
|
||||||
delete[] dTT;
|
delete[] dTT;
|
||||||
}
|
}
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif
|
#endif
|
||||||
@@ -1,63 +1,63 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
bool fuzzy<fp_t>::EQ(fp_t x, fp_t y)
|
bool fuzzy<fp_t>::EQ(fp_t x, fp_t y)
|
||||||
{
|
{
|
||||||
fp_t max_abs = jtutil::tmax(jtutil::abs(x), jtutil::abs(y));
|
fp_t max_abs = jtutil::tmax(jtutil::abs(x), jtutil::abs(y));
|
||||||
fp_t epsilon = jtutil::tmax(tolerance_, tolerance_ * max_abs);
|
fp_t epsilon = jtutil::tmax(tolerance_, tolerance_ * max_abs);
|
||||||
|
|
||||||
return jtutil::abs(x - y) <= epsilon;
|
return jtutil::abs(x - y) <= epsilon;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
bool fuzzy<fp_t>::is_integer(fp_t x)
|
bool fuzzy<fp_t>::is_integer(fp_t x)
|
||||||
{
|
{
|
||||||
int i = round<fp_t>::to_integer(x);
|
int i = round<fp_t>::to_integer(x);
|
||||||
return EQ(x, fp_t(i));
|
return EQ(x, fp_t(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
int fuzzy<fp_t>::floor(fp_t x)
|
int fuzzy<fp_t>::floor(fp_t x)
|
||||||
{
|
{
|
||||||
return fuzzy<fp_t>::is_integer(x)
|
return fuzzy<fp_t>::is_integer(x)
|
||||||
? round<fp_t>::to_integer(x)
|
? round<fp_t>::to_integer(x)
|
||||||
: round<fp_t>::floor(x);
|
: round<fp_t>::floor(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
int fuzzy<fp_t>::ceiling(fp_t x)
|
int fuzzy<fp_t>::ceiling(fp_t x)
|
||||||
{
|
{
|
||||||
return fuzzy<fp_t>::is_integer(x)
|
return fuzzy<fp_t>::is_integer(x)
|
||||||
? round<fp_t>::to_integer(x)
|
? round<fp_t>::to_integer(x)
|
||||||
: round<fp_t>::ceiling(x);
|
: round<fp_t>::ceiling(x);
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
float fuzzy<float>::tolerance_ = 1.0e-5; // about 100 * FLT_EPSILON
|
float fuzzy<float>::tolerance_ = 1.0e-5; // about 100 * FLT_EPSILON
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
double fuzzy<double>::tolerance_ = 1.0e-12; // about 1e4 * DBL_EPSILON
|
double fuzzy<double>::tolerance_ = 1.0e-12; // about 1e4 * DBL_EPSILON
|
||||||
|
|
||||||
// template instantiations
|
// template instantiations
|
||||||
template class fuzzy<float>;
|
template class fuzzy<float>;
|
||||||
template class fuzzy<double>;
|
template class fuzzy<double>;
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,98 +1,98 @@
|
|||||||
#ifndef GFNS_H
|
#ifndef GFNS_H
|
||||||
#define GFNS_H
|
#define GFNS_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace gfns
|
namespace gfns
|
||||||
{
|
{
|
||||||
|
|
||||||
// ghosted gridfns
|
// ghosted gridfns
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ghosted_min_gfn = -1, // must set this by hand so
|
ghosted_min_gfn = -1, // must set this by hand so
|
||||||
// ghosted_max_gfn is still < 0
|
// ghosted_max_gfn is still < 0
|
||||||
gfn__h = ghosted_min_gfn,
|
gfn__h = ghosted_min_gfn,
|
||||||
ghosted_max_gfn = gfn__h
|
ghosted_max_gfn = gfn__h
|
||||||
};
|
};
|
||||||
|
|
||||||
// nominal gridfns
|
// nominal gridfns
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
nominal_min_gfn = 1,
|
nominal_min_gfn = 1,
|
||||||
|
|
||||||
//
|
//
|
||||||
// for a skeletal patch system we don't need any nominal gridfns
|
// for a skeletal patch system we don't need any nominal gridfns
|
||||||
//
|
//
|
||||||
skeletal_nominal_max_gfn = nominal_min_gfn - 1,
|
skeletal_nominal_max_gfn = nominal_min_gfn - 1,
|
||||||
|
|
||||||
//
|
//
|
||||||
// most of these gridfns have access macros in "cg.hh";
|
// most of these gridfns have access macros in "cg.hh";
|
||||||
// the ones that don't are marked explicitly
|
// the ones that don't are marked explicitly
|
||||||
//
|
//
|
||||||
gfn__global_x = nominal_min_gfn, // no access macro
|
gfn__global_x = nominal_min_gfn, // no access macro
|
||||||
gfn__global_y, // no access macro
|
gfn__global_y, // no access macro
|
||||||
gfn__global_z, // no access macro
|
gfn__global_z, // no access macro
|
||||||
|
|
||||||
gfn__global_xx, // no access macro
|
gfn__global_xx, // no access macro
|
||||||
gfn__global_xy, // no access macro
|
gfn__global_xy, // no access macro
|
||||||
gfn__global_xz, // no access macro
|
gfn__global_xz, // no access macro
|
||||||
gfn__global_yy, // no access macro
|
gfn__global_yy, // no access macro
|
||||||
gfn__global_yz, // no access macro
|
gfn__global_yz, // no access macro
|
||||||
gfn__global_zz, // no access macro
|
gfn__global_zz, // no access macro
|
||||||
|
|
||||||
gfn__g_dd_11,
|
gfn__g_dd_11,
|
||||||
gfn__g_dd_12,
|
gfn__g_dd_12,
|
||||||
gfn__g_dd_13,
|
gfn__g_dd_13,
|
||||||
gfn__g_dd_22,
|
gfn__g_dd_22,
|
||||||
gfn__g_dd_23,
|
gfn__g_dd_23,
|
||||||
gfn__g_dd_33,
|
gfn__g_dd_33,
|
||||||
gfn__partial_d_g_dd_111,
|
gfn__partial_d_g_dd_111,
|
||||||
gfn__partial_d_g_dd_112,
|
gfn__partial_d_g_dd_112,
|
||||||
gfn__partial_d_g_dd_113,
|
gfn__partial_d_g_dd_113,
|
||||||
gfn__partial_d_g_dd_122,
|
gfn__partial_d_g_dd_122,
|
||||||
gfn__partial_d_g_dd_123,
|
gfn__partial_d_g_dd_123,
|
||||||
gfn__partial_d_g_dd_133,
|
gfn__partial_d_g_dd_133,
|
||||||
gfn__partial_d_g_dd_211,
|
gfn__partial_d_g_dd_211,
|
||||||
gfn__partial_d_g_dd_212,
|
gfn__partial_d_g_dd_212,
|
||||||
gfn__partial_d_g_dd_213,
|
gfn__partial_d_g_dd_213,
|
||||||
gfn__partial_d_g_dd_222,
|
gfn__partial_d_g_dd_222,
|
||||||
gfn__partial_d_g_dd_223,
|
gfn__partial_d_g_dd_223,
|
||||||
gfn__partial_d_g_dd_233,
|
gfn__partial_d_g_dd_233,
|
||||||
gfn__partial_d_g_dd_311,
|
gfn__partial_d_g_dd_311,
|
||||||
gfn__partial_d_g_dd_312,
|
gfn__partial_d_g_dd_312,
|
||||||
gfn__partial_d_g_dd_313,
|
gfn__partial_d_g_dd_313,
|
||||||
gfn__partial_d_g_dd_322,
|
gfn__partial_d_g_dd_322,
|
||||||
gfn__partial_d_g_dd_323,
|
gfn__partial_d_g_dd_323,
|
||||||
gfn__partial_d_g_dd_333,
|
gfn__partial_d_g_dd_333,
|
||||||
gfn__K_dd_11,
|
gfn__K_dd_11,
|
||||||
gfn__K_dd_12,
|
gfn__K_dd_12,
|
||||||
gfn__K_dd_13,
|
gfn__K_dd_13,
|
||||||
gfn__K_dd_22,
|
gfn__K_dd_22,
|
||||||
gfn__K_dd_23,
|
gfn__K_dd_23,
|
||||||
gfn__K_dd_33,
|
gfn__K_dd_33,
|
||||||
gfn__trK,
|
gfn__trK,
|
||||||
|
|
||||||
gfn__psi, // no access macro
|
gfn__psi, // no access macro
|
||||||
gfn__partial_d_psi_1, // no access macro
|
gfn__partial_d_psi_1, // no access macro
|
||||||
gfn__partial_d_psi_2, // no access macro
|
gfn__partial_d_psi_2, // no access macro
|
||||||
gfn__partial_d_psi_3, // no access macro
|
gfn__partial_d_psi_3, // no access macro
|
||||||
|
|
||||||
gfn__Theta,
|
gfn__Theta,
|
||||||
gfn__partial_Theta_wrt_partial_d_h_1,
|
gfn__partial_Theta_wrt_partial_d_h_1,
|
||||||
gfn__partial_Theta_wrt_partial_d_h_2,
|
gfn__partial_Theta_wrt_partial_d_h_2,
|
||||||
gfn__partial_Theta_wrt_partial_dd_h_11,
|
gfn__partial_Theta_wrt_partial_dd_h_11,
|
||||||
gfn__partial_Theta_wrt_partial_dd_h_12,
|
gfn__partial_Theta_wrt_partial_dd_h_12,
|
||||||
gfn__partial_Theta_wrt_partial_dd_h_22,
|
gfn__partial_Theta_wrt_partial_dd_h_22,
|
||||||
gfn__Delta_h,
|
gfn__Delta_h,
|
||||||
gfn__save_Theta,
|
gfn__save_Theta,
|
||||||
gfn__oldh, // used for dh/dt
|
gfn__oldh, // used for dh/dt
|
||||||
gfn__one,
|
gfn__one,
|
||||||
nominal_max_gfn = gfn__one // no comma
|
nominal_max_gfn = gfn__one // no comma
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gfns::
|
} // namespace gfns::
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* GFNS_H */
|
#endif /* GFNS_H */
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,40 +1,40 @@
|
|||||||
#ifndef GR_H
|
#ifndef GR_H
|
||||||
#define GR_H
|
#define GR_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
enum expansion_status
|
enum expansion_status
|
||||||
{
|
{
|
||||||
expansion_success,
|
expansion_success,
|
||||||
|
|
||||||
expansion_failure__surface_nonfinite,
|
expansion_failure__surface_nonfinite,
|
||||||
|
|
||||||
expansion_failure__surface_too_large,
|
expansion_failure__surface_too_large,
|
||||||
|
|
||||||
expansion_failure__surface_outside_grid,
|
expansion_failure__surface_outside_grid,
|
||||||
|
|
||||||
expansion_failure__surface_in_excised_region,
|
expansion_failure__surface_in_excised_region,
|
||||||
|
|
||||||
expansion_failure__geometry_nonfinite,
|
expansion_failure__geometry_nonfinite,
|
||||||
|
|
||||||
expansion_failure__gij_not_positive_definite // no comma
|
expansion_failure__gij_not_positive_definite // no comma
|
||||||
};
|
};
|
||||||
|
|
||||||
// expansion.cc
|
// expansion.cc
|
||||||
enum expansion_status
|
enum expansion_status
|
||||||
expansion(patch_system *ps_ptr, fp add_to_expansion,
|
expansion(patch_system *ps_ptr, fp add_to_expansion,
|
||||||
bool initial_flag,
|
bool initial_flag,
|
||||||
bool Jacobian_flag = false,
|
bool Jacobian_flag = false,
|
||||||
jtutil::norm<fp> *H_norms_ptr = NULL);
|
jtutil::norm<fp> *H_norms_ptr = NULL);
|
||||||
|
|
||||||
// expansion_Jacobian.cc
|
// expansion_Jacobian.cc
|
||||||
enum expansion_status
|
enum expansion_status
|
||||||
expansion_Jacobian(patch_system *ps_ptr, Jacobian *Jac_ptr,
|
expansion_Jacobian(patch_system *ps_ptr, Jacobian *Jac_ptr,
|
||||||
fp add_to_expansion,
|
fp add_to_expansion,
|
||||||
bool initial_flag,
|
bool initial_flag,
|
||||||
bool print_msg_flag = false);
|
bool print_msg_flag = false);
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* GR_H */
|
#endif /* GR_H */
|
||||||
@@ -1,76 +1,76 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include "horizon_sequence.h"
|
#include "horizon_sequence.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
horizon_sequence::horizon_sequence(int N_horizons_in)
|
horizon_sequence::horizon_sequence(int N_horizons_in)
|
||||||
: N_horizons_(N_horizons_in),
|
: N_horizons_(N_horizons_in),
|
||||||
my_N_horizons_(0), // sequence starts out empty
|
my_N_horizons_(0), // sequence starts out empty
|
||||||
posn_(-1),
|
posn_(-1),
|
||||||
my_hn_(new int[N_horizons_in])
|
my_hn_(new int[N_horizons_in])
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
horizon_sequence::~horizon_sequence()
|
horizon_sequence::~horizon_sequence()
|
||||||
{
|
{
|
||||||
delete[] my_hn_;
|
delete[] my_hn_;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// This function appends hn to the sequence. It returns the new value
|
// This function appends hn to the sequence. It returns the new value
|
||||||
// of my_N_horizons().
|
// of my_N_horizons().
|
||||||
//
|
//
|
||||||
int horizon_sequence::append_hn(int hn)
|
int horizon_sequence::append_hn(int hn)
|
||||||
{
|
{
|
||||||
assert(hn > 0); // can only append genuine horizons
|
assert(hn > 0); // can only append genuine horizons
|
||||||
assert(my_N_horizons_ < N_horizons_); // make sure there's space for it
|
assert(my_N_horizons_ < N_horizons_); // make sure there's space for it
|
||||||
my_hn_[my_N_horizons_++] = hn;
|
my_hn_[my_N_horizons_++] = hn;
|
||||||
posn_ = 0;
|
posn_ = 0;
|
||||||
return my_N_horizons_;
|
return my_N_horizons_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function computes the internal position immediately following
|
// This function computes the internal position immediately following
|
||||||
// a given internal position in the sequence.
|
// a given internal position in the sequence.
|
||||||
//
|
//
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// p = (in) The current internal position, with posn_ semantics
|
// p = (in) The current internal position, with posn_ semantics
|
||||||
//
|
//
|
||||||
// Results:
|
// Results:
|
||||||
// This function returns the next internal position after p.
|
// This function returns the next internal position after p.
|
||||||
//
|
//
|
||||||
int horizon_sequence::next_posn(int pos)
|
int horizon_sequence::next_posn(int pos)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return (pos < 0) ? pos - 1
|
return (pos < 0) ? pos - 1
|
||||||
: (pos + 1 < my_N_horizons_) ? pos + 1
|
: (pos + 1 < my_N_horizons_) ? pos + 1
|
||||||
: -1;
|
: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function determines whether or not a given hn is genuine.
|
// This function determines whether or not a given hn is genuine.
|
||||||
//
|
//
|
||||||
bool horizon_sequence::is_hn_genuine(int hn)
|
bool horizon_sequence::is_hn_genuine(int hn)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
for (int pos = 0; pos < my_N_horizons_; ++pos)
|
for (int pos = 0; pos < my_N_horizons_; ++pos)
|
||||||
{
|
{
|
||||||
if (my_hn_[pos] == hn)
|
if (my_hn_[pos] == hn)
|
||||||
then return true;
|
then return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,72 +1,72 @@
|
|||||||
#ifndef HORIZON_SEQUENCE_H
|
#ifndef HORIZON_SEQUENCE_H
|
||||||
#define HORIZON_SEQUENCE_H
|
#define HORIZON_SEQUENCE_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
class horizon_sequence
|
class horizon_sequence
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int N_horizons() const { return N_horizons_; }
|
int N_horizons() const { return N_horizons_; }
|
||||||
|
|
||||||
int my_N_horizons() const { return my_N_horizons_; }
|
int my_N_horizons() const { return my_N_horizons_; }
|
||||||
|
|
||||||
bool has_genuine_horizons() const { return my_N_horizons_ > 0; }
|
bool has_genuine_horizons() const { return my_N_horizons_ > 0; }
|
||||||
|
|
||||||
bool is_dummy() const { return posn_is_dummy(posn_); }
|
bool is_dummy() const { return posn_is_dummy(posn_); }
|
||||||
bool is_genuine() const { return posn_is_genuine(posn_); }
|
bool is_genuine() const { return posn_is_genuine(posn_); }
|
||||||
|
|
||||||
bool is_next_genuine() const
|
bool is_next_genuine() const
|
||||||
{
|
{
|
||||||
return posn_is_genuine(next_posn(posn_));
|
return posn_is_genuine(next_posn(posn_));
|
||||||
}
|
}
|
||||||
|
|
||||||
int dummy_number() const { return is_genuine() ? 0 : -posn_; }
|
int dummy_number() const { return is_genuine() ? 0 : -posn_; }
|
||||||
|
|
||||||
int get_hn() const
|
int get_hn() const
|
||||||
{
|
{
|
||||||
return posn_is_genuine(posn_) ? my_hn_[posn_] : 0;
|
return posn_is_genuine(posn_) ? my_hn_[posn_] : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_hn_genuine(int hn) const;
|
bool is_hn_genuine(int hn) const;
|
||||||
|
|
||||||
int init_hn()
|
int init_hn()
|
||||||
{
|
{
|
||||||
posn_ = (my_N_horizons_ == 0) ? -1 : 0;
|
posn_ = (my_N_horizons_ == 0) ? -1 : 0;
|
||||||
return get_hn();
|
return get_hn();
|
||||||
}
|
}
|
||||||
|
|
||||||
int next_hn()
|
int next_hn()
|
||||||
{
|
{
|
||||||
posn_ = next_posn(posn_);
|
posn_ = next_posn(posn_);
|
||||||
return get_hn();
|
return get_hn();
|
||||||
}
|
}
|
||||||
|
|
||||||
horizon_sequence(int N_horizons);
|
horizon_sequence(int N_horizons);
|
||||||
~horizon_sequence();
|
~horizon_sequence();
|
||||||
|
|
||||||
int append_hn(int hn);
|
int append_hn(int hn);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool posn_is_genuine(int pos) const
|
bool posn_is_genuine(int pos) const
|
||||||
{
|
{
|
||||||
return (pos >= 0) && (pos < my_N_horizons_);
|
return (pos >= 0) && (pos < my_N_horizons_);
|
||||||
}
|
}
|
||||||
bool posn_is_dummy(int pos) const
|
bool posn_is_dummy(int pos) const
|
||||||
{
|
{
|
||||||
return !posn_is_genuine(pos);
|
return !posn_is_genuine(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int next_posn(int pos) const;
|
int next_posn(int pos) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const int N_horizons_;
|
const int N_horizons_;
|
||||||
int my_N_horizons_;
|
int my_N_horizons_;
|
||||||
|
|
||||||
int posn_;
|
int posn_;
|
||||||
|
|
||||||
int *my_hn_;
|
int *my_hn_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* HORIZON_SEQUENCE_H */
|
#endif /* HORIZON_SEQUENCE_H */
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,24 +1,24 @@
|
|||||||
|
|
||||||
#ifndef ILUCG_H
|
#ifndef ILUCG_H
|
||||||
#define ILUCG_H
|
#define ILUCG_H
|
||||||
|
|
||||||
#ifdef fortran1
|
#ifdef fortran1
|
||||||
#define f_ilucg ilucg
|
#define f_ilucg ilucg
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran2
|
#ifdef fortran2
|
||||||
#define f_ilucg ILUCG
|
#define f_ilucg ILUCG
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran3
|
#ifdef fortran3
|
||||||
#define f_ilucg ilucg_
|
#define f_ilucg ilucg_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_ilucg(const int &N,
|
void f_ilucg(const int &N,
|
||||||
const int *IA, const int *JA, const double *A,
|
const int *IA, const int *JA, const double *A,
|
||||||
const double *B, double *X,
|
const double *B, double *X,
|
||||||
int *ITEMP, double *RTEMP,
|
int *ITEMP, double *RTEMP,
|
||||||
const double &EPS, const int &ITER, int &ISTATUS);
|
const double &EPS, const int &ITER, int &ISTATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ILUCG_H */
|
#endif /* ILUCG_H */
|
||||||
@@ -1,132 +1,132 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "util_Table.h"
|
#include "util_Table.h"
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "fd_grid.h"
|
#include "fd_grid.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
#include "patch_edge.h"
|
#include "patch_edge.h"
|
||||||
#include "patch_interp.h"
|
#include "patch_interp.h"
|
||||||
#include "ghost_zone.h"
|
#include "ghost_zone.h"
|
||||||
#include "patch_system.h"
|
#include "patch_system.h"
|
||||||
|
|
||||||
#include "Jacobian.h"
|
#include "Jacobian.h"
|
||||||
|
|
||||||
#include "gfns.h"
|
#include "gfns.h"
|
||||||
#include "gr.h"
|
#include "gr.h"
|
||||||
|
|
||||||
#include "horizon_sequence.h"
|
#include "horizon_sequence.h"
|
||||||
#include "BH_diagnostics.h"
|
#include "BH_diagnostics.h"
|
||||||
#include "myglobal.h"
|
#include "myglobal.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
extern struct state state;
|
extern struct state state;
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
// ellipsoid has global-coordinates center (A,B,C), radius (a,b,c)
|
// ellipsoid has global-coordinates center (A,B,C), radius (a,b,c)
|
||||||
// angular coordinate system has center (U,V,W)
|
// angular coordinate system has center (U,V,W)
|
||||||
//
|
//
|
||||||
// direction cosines wrt angular coordinate center are (xcos,ycos,zcos)
|
// direction cosines wrt angular coordinate center are (xcos,ycos,zcos)
|
||||||
// i.e. a point has coordinates (U+xcos*r, V+ycos*r, W+zcos*r)
|
// i.e. a point has coordinates (U+xcos*r, V+ycos*r, W+zcos*r)
|
||||||
//
|
//
|
||||||
// then the equation of the ellipsoid is
|
// then the equation of the ellipsoid is
|
||||||
// (U+xcos*r - A)^2 (V+ycos*r - B)^2 (W+zcos*r - C)^2
|
// (U+xcos*r - A)^2 (V+ycos*r - B)^2 (W+zcos*r - C)^2
|
||||||
// ----------------- + ---------------- + ----------------- = 1
|
// ----------------- + ---------------- + ----------------- = 1
|
||||||
// a^2 b^2 c^2
|
// a^2 b^2 c^2
|
||||||
//
|
//
|
||||||
// to solve this, we introduce intermediate variables
|
// to solve this, we introduce intermediate variables
|
||||||
// AU = A - U
|
// AU = A - U
|
||||||
// BV = B - V
|
// BV = B - V
|
||||||
// CW = C - W
|
// CW = C - W
|
||||||
//
|
//
|
||||||
void setup_initial_guess(patch_system &ps,
|
void setup_initial_guess(patch_system &ps,
|
||||||
fp x_center, fp y_center, fp z_center,
|
fp x_center, fp y_center, fp z_center,
|
||||||
fp x_radius, fp y_radius, fp z_radius)
|
fp x_radius, fp y_radius, fp z_radius)
|
||||||
{
|
{
|
||||||
for (int pn = 0; pn < ps.N_patches(); ++pn)
|
for (int pn = 0; pn < ps.N_patches(); ++pn)
|
||||||
{
|
{
|
||||||
patch &p = ps.ith_patch(pn);
|
patch &p = ps.ith_patch(pn);
|
||||||
|
|
||||||
for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho)
|
for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho)
|
||||||
{
|
{
|
||||||
for (int isigma = p.min_isigma();
|
for (int isigma = p.min_isigma();
|
||||||
isigma <= p.max_isigma();
|
isigma <= p.max_isigma();
|
||||||
++isigma)
|
++isigma)
|
||||||
{
|
{
|
||||||
const fp rho = p.rho_of_irho(irho);
|
const fp rho = p.rho_of_irho(irho);
|
||||||
const fp sigma = p.sigma_of_isigma(isigma);
|
const fp sigma = p.sigma_of_isigma(isigma);
|
||||||
fp xcos, ycos, zcos;
|
fp xcos, ycos, zcos;
|
||||||
p.xyzcos_of_rho_sigma(rho, sigma, xcos, ycos, zcos);
|
p.xyzcos_of_rho_sigma(rho, sigma, xcos, ycos, zcos);
|
||||||
|
|
||||||
// set up variables used by Maple-generated code
|
// set up variables used by Maple-generated code
|
||||||
const fp AU = x_center - ps.origin_x();
|
const fp AU = x_center - ps.origin_x();
|
||||||
const fp BV = y_center - ps.origin_y();
|
const fp BV = y_center - ps.origin_y();
|
||||||
const fp CW = z_center - ps.origin_z();
|
const fp CW = z_center - ps.origin_z();
|
||||||
const fp a = x_radius;
|
const fp a = x_radius;
|
||||||
const fp b = y_radius;
|
const fp b = y_radius;
|
||||||
const fp c = z_radius;
|
const fp c = z_radius;
|
||||||
|
|
||||||
// compute the solutions r_plus and r_minus
|
// compute the solutions r_plus and r_minus
|
||||||
fp r_plus, r_minus;
|
fp r_plus, r_minus;
|
||||||
{
|
{
|
||||||
fp t1, t2, t3, t5, t6, t7, t9, t10, t12, t28;
|
fp t1, t2, t3, t5, t6, t7, t9, t10, t12, t28;
|
||||||
fp t30, t33, t35, t36, t40, t42, t43, t48, t49, t52;
|
fp t30, t33, t35, t36, t40, t42, t43, t48, t49, t52;
|
||||||
fp t55;
|
fp t55;
|
||||||
t1 = a * a;
|
t1 = a * a;
|
||||||
t2 = b * b;
|
t2 = b * b;
|
||||||
t3 = t1 * t2;
|
t3 = t1 * t2;
|
||||||
t5 = t3 * zcos * CW;
|
t5 = t3 * zcos * CW;
|
||||||
t6 = c * c;
|
t6 = c * c;
|
||||||
t7 = t1 * t6;
|
t7 = t1 * t6;
|
||||||
t9 = t7 * ycos * BV;
|
t9 = t7 * ycos * BV;
|
||||||
t10 = t2 * t6;
|
t10 = t2 * t6;
|
||||||
t12 = t10 * xcos * AU;
|
t12 = t10 * xcos * AU;
|
||||||
t28 = xcos * xcos;
|
t28 = xcos * xcos;
|
||||||
t30 = CW * CW;
|
t30 = CW * CW;
|
||||||
t33 = BV * BV;
|
t33 = BV * BV;
|
||||||
t35 = t10 * t28;
|
t35 = t10 * t28;
|
||||||
t36 = ycos * ycos;
|
t36 = ycos * ycos;
|
||||||
t40 = AU * AU;
|
t40 = AU * AU;
|
||||||
t42 = t7 * t36;
|
t42 = t7 * t36;
|
||||||
t43 = zcos * zcos;
|
t43 = zcos * zcos;
|
||||||
t48 = t3 * t43;
|
t48 = t3 * t43;
|
||||||
t49 = -2.0 * t1 * zcos * CW * ycos * BV - 2.0 * t2 * zcos * CW * xcos * AU - 2.0 * t6 * ycos * BV * xcos * AU + t2 * t28 * t30 + t6 * t28 * t33 - t35 + t1 * t36 * t30 + t6 * t36 * t40 - t42 + t1 * t43 * t33 + t2 * t43 * t40 -
|
t49 = -2.0 * t1 * zcos * CW * ycos * BV - 2.0 * t2 * zcos * CW * xcos * AU - 2.0 * t6 * ycos * BV * xcos * AU + t2 * t28 * t30 + t6 * t28 * t33 - t35 + t1 * t36 * t30 + t6 * t36 * t40 - t42 + t1 * t43 * t33 + t2 * t43 * t40 -
|
||||||
t48;
|
t48;
|
||||||
t52 = sqrt(-t3 * t6 * t49);
|
t52 = sqrt(-t3 * t6 * t49);
|
||||||
t55 = 1 / (t35 + t42 + t48);
|
t55 = 1 / (t35 + t42 + t48);
|
||||||
r_plus = (t5 + t9 + t12 + t52) * t55;
|
r_plus = (t5 + t9 + t12 + t52) * t55;
|
||||||
r_minus = (t5 + t9 + t12 - t52) * t55;
|
r_minus = (t5 + t9 + t12 - t52) * t55;
|
||||||
}
|
}
|
||||||
|
|
||||||
// exactly one of the solutions (call it r) should be positive
|
// exactly one of the solutions (call it r) should be positive
|
||||||
fp r;
|
fp r;
|
||||||
if ((r_plus > 0.0) && (r_minus < 0.0))
|
if ((r_plus > 0.0) && (r_minus < 0.0))
|
||||||
then r = r_plus;
|
then r = r_plus;
|
||||||
else if ((r_plus < 0.0) && (r_minus > 0.0))
|
else if ((r_plus < 0.0) && (r_minus > 0.0))
|
||||||
then r = r_minus;
|
then r = r_minus;
|
||||||
else if (state.my_proc == 0)
|
else if (state.my_proc == 0)
|
||||||
printf("\nsetup_coord_ellipsoid():\nexpected exactly one r>0 solution to quadratic, got 0 or 2!\n%s patch (irho,isigma)=(%d,%d) ==> (rho,sigma)=(%g,%g)\ndirection cosines (xcos,ycos,zcos)=(%g,%g,%g)\nr_plus=%g r_minus=%g\n==> this probably means the initial guess surface doesn't contain\nthe local origin point, or more generally that the initial\nguess surface isn't a Strahlkoerper (\"star-shaped region\")\nwith respect to the local origin point\n", p.name(), irho, isigma, double(rho), double(sigma), double(xcos), double(ycos), double(zcos), double(r_plus), double(r_minus));
|
printf("\nsetup_coord_ellipsoid():\nexpected exactly one r>0 solution to quadratic, got 0 or 2!\n%s patch (irho,isigma)=(%d,%d) ==> (rho,sigma)=(%g,%g)\ndirection cosines (xcos,ycos,zcos)=(%g,%g,%g)\nr_plus=%g r_minus=%g\n==> this probably means the initial guess surface doesn't contain\nthe local origin point, or more generally that the initial\nguess surface isn't a Strahlkoerper (\"star-shaped region\")\nwith respect to the local origin point\n", p.name(), irho, isigma, double(rho), double(sigma), double(xcos), double(ycos), double(zcos), double(r_plus), double(r_minus));
|
||||||
|
|
||||||
// r = horizon radius at this grid point
|
// r = horizon radius at this grid point
|
||||||
p.ghosted_gridfn(gfns::gfn__h, irho, isigma) = r;
|
p.ghosted_gridfn(gfns::gfn__h, irho, isigma) = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,244 +1,244 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
linear_map<fp_t>::linear_map(int min_int_in, int max_int_in,
|
linear_map<fp_t>::linear_map(int min_int_in, int max_int_in,
|
||||||
fp_t min_fp_in, fp_t delta_fp_in, fp_t max_fp_in)
|
fp_t min_fp_in, fp_t delta_fp_in, fp_t max_fp_in)
|
||||||
: delta_(delta_fp_in), inverse_delta_(1.0 / delta_fp_in),
|
: delta_(delta_fp_in), inverse_delta_(1.0 / delta_fp_in),
|
||||||
min_int_(min_int_in), max_int_(max_int_in)
|
min_int_(min_int_in), max_int_(max_int_in)
|
||||||
{
|
{
|
||||||
constructor_common(min_fp_in, max_fp_in);
|
constructor_common(min_fp_in, max_fp_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
linear_map<fp_t>::linear_map(const linear_map<fp_t> &lm_in,
|
linear_map<fp_t>::linear_map(const linear_map<fp_t> &lm_in,
|
||||||
int min_int_in, int max_int_in) // subrange
|
int min_int_in, int max_int_in) // subrange
|
||||||
: delta_(lm_in.delta_fp()), inverse_delta_(lm_in.inverse_delta_fp()),
|
: delta_(lm_in.delta_fp()), inverse_delta_(lm_in.inverse_delta_fp()),
|
||||||
min_int_(min_int_in), max_int_(max_int_in)
|
min_int_(min_int_in), max_int_(max_int_in)
|
||||||
{
|
{
|
||||||
if (!(is_in_range(min_int_in) && is_in_range(max_int_in)))
|
if (!(is_in_range(min_int_in) && is_in_range(max_int_in)))
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** linear_map<fp_t>::linear_map:\n"
|
"***** linear_map<fp_t>::linear_map:\n"
|
||||||
" min_int_in=%d and/or max_int_in=%d\n"
|
" min_int_in=%d and/or max_int_in=%d\n"
|
||||||
" aren't in integer range [%d,%d] of existing linear_map!\n",
|
" aren't in integer range [%d,%d] of existing linear_map!\n",
|
||||||
min_int_, max_int_,
|
min_int_, max_int_,
|
||||||
lm_in.min_int(), lm_in.max_int()); /*NOTREACHED*/
|
lm_in.min_int(), lm_in.max_int()); /*NOTREACHED*/
|
||||||
|
|
||||||
constructor_common(lm_in.fp_of_int_unchecked(min_int_in),
|
constructor_common(lm_in.fp_of_int_unchecked(min_int_in),
|
||||||
lm_in.fp_of_int_unchecked(max_int_in));
|
lm_in.fp_of_int_unchecked(max_int_in));
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function does the common argument validation and setup for
|
// This function does the common argument validation and setup for
|
||||||
// all the constructors of class linear_map<fp_t>:: .
|
// all the constructors of class linear_map<fp_t>:: .
|
||||||
//
|
//
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
void linear_map<fp_t>::constructor_common(fp_t min_fp_in, fp_t max_fp_in)
|
void linear_map<fp_t>::constructor_common(fp_t min_fp_in, fp_t max_fp_in)
|
||||||
// assumes
|
// assumes
|
||||||
// min_int_, max_int_, delta_, inverse_delta_
|
// min_int_, max_int_, delta_, inverse_delta_
|
||||||
// are already initialized
|
// are already initialized
|
||||||
// ==> ok to use min_int(), max_int(), delta_fp(), inverse_delta_fp()
|
// ==> ok to use min_int(), max_int(), delta_fp(), inverse_delta_fp()
|
||||||
// ... other class members *not* yet initialized
|
// ... other class members *not* yet initialized
|
||||||
{
|
{
|
||||||
origin_ = 0.0; // temp value
|
origin_ = 0.0; // temp value
|
||||||
origin_ = min_fp_in - fp_of_int_unchecked(min_int());
|
origin_ = min_fp_in - fp_of_int_unchecked(min_int());
|
||||||
|
|
||||||
// this should be guaranteed by the above calculation
|
// this should be guaranteed by the above calculation
|
||||||
assert(fuzzy<fp_t>::EQ(fp_of_int_unchecked(min_int()), min_fp_in));
|
assert(fuzzy<fp_t>::EQ(fp_of_int_unchecked(min_int()), min_fp_in));
|
||||||
|
|
||||||
// this is a test of the consistency of the input arguments
|
// this is a test of the consistency of the input arguments
|
||||||
if (fuzzy<fp_t>::NE(fp_of_int_unchecked(max_int()), max_fp_in))
|
if (fuzzy<fp_t>::NE(fp_of_int_unchecked(max_int()), max_fp_in))
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** linear_map<fp_t>::linear_map:\n"
|
"***** linear_map<fp_t>::linear_map:\n"
|
||||||
" int range [%d,%d]\n"
|
" int range [%d,%d]\n"
|
||||||
" and fp range [%g(%g)%g]\n"
|
" and fp range [%g(%g)%g]\n"
|
||||||
" are (fuzzily) inconsistent!\n",
|
" are (fuzzily) inconsistent!\n",
|
||||||
min_int(), max_int(),
|
min_int(), max_int(),
|
||||||
double(min_fp_in), double(delta_fp()), double(max_fp_in));
|
double(min_fp_in), double(delta_fp()), double(max_fp_in));
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function converts fp --> int coordinate, returning the result
|
// This function converts fp --> int coordinate, returning the result
|
||||||
// as an fp (which need not be fuzzily integral).
|
// as an fp (which need not be fuzzily integral).
|
||||||
//
|
//
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
fp_t linear_map<fp_t>::fp_int_of_fp(fp_t x)
|
fp_t linear_map<fp_t>::fp_int_of_fp(fp_t x)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
if (!is_in_range(x))
|
if (!is_in_range(x))
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** linear_map<fp_t>::fp_int_of_fp:\n"
|
"***** linear_map<fp_t>::fp_int_of_fp:\n"
|
||||||
" fp value x=%g is (fuzzily) outside the grid!\n"
|
" fp value x=%g is (fuzzily) outside the grid!\n"
|
||||||
" {min(delta)max}_fp = %g(%g)%g\n",
|
" {min(delta)max}_fp = %g(%g)%g\n",
|
||||||
double(x),
|
double(x),
|
||||||
double(min_fp()), double(delta_fp()), double(max_fp()));
|
double(min_fp()), double(delta_fp()), double(max_fp()));
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
|
||||||
return inverse_delta_ * (x - origin_);
|
return inverse_delta_ * (x - origin_);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function converts fp --> int and checks that the result is
|
// This function converts fp --> int and checks that the result is
|
||||||
// fuzzily integral. (The nia argument specifies what to do if the
|
// fuzzily integral. (The nia argument specifies what to do if the
|
||||||
// result *isn't* fuzzily integral.)
|
// result *isn't* fuzzily integral.)
|
||||||
//
|
//
|
||||||
// FIXME:
|
// FIXME:
|
||||||
// Having to explicitly specify the namespace for jtutil::round<fp_t>::
|
// Having to explicitly specify the namespace for jtutil::round<fp_t>::
|
||||||
// is ++ugly. :(
|
// is ++ugly. :(
|
||||||
//
|
//
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
int linear_map<fp_t>::int_of_fp(fp_t x, noninteger_action nia /* = nia_error */)
|
int linear_map<fp_t>::int_of_fp(fp_t x, noninteger_action nia /* = nia_error */)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
const fp_t fp_int = fp_int_of_fp(x);
|
const fp_t fp_int = fp_int_of_fp(x);
|
||||||
|
|
||||||
if (fuzzy<fp_t>::is_integer(fp_int))
|
if (fuzzy<fp_t>::is_integer(fp_int))
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
// x is (fuzzily) a grid point ==> return that
|
// x is (fuzzily) a grid point ==> return that
|
||||||
return jtutil::round<fp_t>::to_integer(fp_int); // *** EARLY RETURN ***
|
return jtutil::round<fp_t>::to_integer(fp_int); // *** EARLY RETURN ***
|
||||||
}
|
}
|
||||||
|
|
||||||
// get to here ==> x isn't (fuzzily) a grid point
|
// get to here ==> x isn't (fuzzily) a grid point
|
||||||
static const char *const noninteger_msg =
|
static const char *const noninteger_msg =
|
||||||
"%s linear_map<fp_t>::int_of_fp:\n"
|
"%s linear_map<fp_t>::int_of_fp:\n"
|
||||||
" x=%g isn't (fuzzily) a grid point!\n"
|
" x=%g isn't (fuzzily) a grid point!\n"
|
||||||
" {min(delta)max}_fp() = %g(%g)%g\n";
|
" {min(delta)max}_fp() = %g(%g)%g\n";
|
||||||
switch (nia)
|
switch (nia)
|
||||||
{
|
{
|
||||||
case nia_error:
|
case nia_error:
|
||||||
error_exit(ERROR_EXIT,
|
error_exit(ERROR_EXIT,
|
||||||
noninteger_msg,
|
noninteger_msg,
|
||||||
"*****",
|
"*****",
|
||||||
double(x),
|
double(x),
|
||||||
double(min_fp()), double(delta_fp()), double(max_fp()));
|
double(min_fp()), double(delta_fp()), double(max_fp()));
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
|
||||||
case nia_warning:
|
case nia_warning:
|
||||||
printf(noninteger_msg,
|
printf(noninteger_msg,
|
||||||
"---",
|
"---",
|
||||||
double(x),
|
double(x),
|
||||||
double(min_fp()), double(delta_fp()), double(max_fp()));
|
double(min_fp()), double(delta_fp()), double(max_fp()));
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case nia_round:
|
case nia_round:
|
||||||
return jtutil::round<fp_t>::to_integer(fp_int); // *** EARLY RETURN ***
|
return jtutil::round<fp_t>::to_integer(fp_int); // *** EARLY RETURN ***
|
||||||
|
|
||||||
case nia_floor:
|
case nia_floor:
|
||||||
return jtutil::round<fp_t>::floor(fp_int); // *** EARLY RETURN ***
|
return jtutil::round<fp_t>::floor(fp_int); // *** EARLY RETURN ***
|
||||||
|
|
||||||
case nia_ceiling:
|
case nia_ceiling:
|
||||||
return jtutil::round<fp_t>::ceiling(fp_int); // *** EARLY RETURN ***
|
return jtutil::round<fp_t>::ceiling(fp_int); // *** EARLY RETURN ***
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error_exit(PANIC_EXIT,
|
error_exit(PANIC_EXIT,
|
||||||
"***** linear_map<fp_t>::int_of_fp: illegal nia=(int)%d\n"
|
"***** linear_map<fp_t>::int_of_fp: illegal nia=(int)%d\n"
|
||||||
" (this should never happen!)\n",
|
" (this should never happen!)\n",
|
||||||
int(nia)); /*NOTREACHED*/
|
int(nia)); /*NOTREACHED*/
|
||||||
}
|
}
|
||||||
return 0; // dummy return to quiet gcc
|
return 0; // dummy return to quiet gcc
|
||||||
// (which doesn't grok that error_exit() never returns)
|
// (which doesn't grok that error_exit() never returns)
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function converts "delta" spacings in the fp coordinate to
|
// This function converts "delta" spacings in the fp coordinate to
|
||||||
// corresponding "delta" spacings in the int coordinate, and checks that
|
// corresponding "delta" spacings in the int coordinate, and checks that
|
||||||
// the result is fuzzily integral. (The nia argument specifies what to
|
// the result is fuzzily integral. (The nia argument specifies what to
|
||||||
// do if the result *isn't* fuzzily integral.)
|
// do if the result *isn't* fuzzily integral.)
|
||||||
//
|
//
|
||||||
// FIXME:
|
// FIXME:
|
||||||
// Having to explicitly specify the namespace for jtutil::round<fp_t>::
|
// Having to explicitly specify the namespace for jtutil::round<fp_t>::
|
||||||
// is ++ugly. :(
|
// is ++ugly. :(
|
||||||
//
|
//
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
int linear_map<fp_t>::delta_int_of_delta_fp(fp_t delta_x, noninteger_action nia /* = nia_error */)
|
int linear_map<fp_t>::delta_int_of_delta_fp(fp_t delta_x, noninteger_action nia /* = nia_error */)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
const fp_t fp_delta_int = inverse_delta_ * delta_x;
|
const fp_t fp_delta_int = inverse_delta_ * delta_x;
|
||||||
|
|
||||||
if (fuzzy<fp_t>::is_integer(fp_delta_int))
|
if (fuzzy<fp_t>::is_integer(fp_delta_int))
|
||||||
then
|
then
|
||||||
{
|
{
|
||||||
// delta_x is (fuzzily) an integer number of grid spacings
|
// delta_x is (fuzzily) an integer number of grid spacings
|
||||||
// ==> return that
|
// ==> return that
|
||||||
return jtutil::round<fp_t>::to_integer(fp_delta_int);
|
return jtutil::round<fp_t>::to_integer(fp_delta_int);
|
||||||
// *** EARLY RETURN ***
|
// *** EARLY RETURN ***
|
||||||
}
|
}
|
||||||
|
|
||||||
// get to here ==> delta_x isn't (fuzzily) an integer number of grid spacings
|
// get to here ==> delta_x isn't (fuzzily) an integer number of grid spacings
|
||||||
static const char *const noninteger_msg =
|
static const char *const noninteger_msg =
|
||||||
"%s linear_map<fp_t>::delta_int_of_delta_fp:\n"
|
"%s linear_map<fp_t>::delta_int_of_delta_fp:\n"
|
||||||
" delta_x=%g isn't (fuzzily) an integer number of grid spacings!\n"
|
" delta_x=%g isn't (fuzzily) an integer number of grid spacings!\n"
|
||||||
" {min(delta)max}_fp() = %g(%g)%g\n";
|
" {min(delta)max}_fp() = %g(%g)%g\n";
|
||||||
switch (nia)
|
switch (nia)
|
||||||
{
|
{
|
||||||
case nia_error:
|
case nia_error:
|
||||||
error_exit(ERROR_EXIT,
|
error_exit(ERROR_EXIT,
|
||||||
noninteger_msg,
|
noninteger_msg,
|
||||||
"*****",
|
"*****",
|
||||||
double(delta_x),
|
double(delta_x),
|
||||||
double(min_fp()), double(delta_fp()), double(max_fp()));
|
double(min_fp()), double(delta_fp()), double(max_fp()));
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
|
||||||
case nia_warning:
|
case nia_warning:
|
||||||
printf(noninteger_msg,
|
printf(noninteger_msg,
|
||||||
"---",
|
"---",
|
||||||
double(delta_x),
|
double(delta_x),
|
||||||
double(min_fp()), double(delta_fp()), double(max_fp()));
|
double(min_fp()), double(delta_fp()), double(max_fp()));
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case nia_round:
|
case nia_round:
|
||||||
return jtutil::round<fp_t>::to_integer(fp_delta_int);
|
return jtutil::round<fp_t>::to_integer(fp_delta_int);
|
||||||
// *** EARLY RETURN ***
|
// *** EARLY RETURN ***
|
||||||
|
|
||||||
case nia_floor:
|
case nia_floor:
|
||||||
return jtutil::round<fp_t>::floor(fp_delta_int); // *** EARLY RETURN ***
|
return jtutil::round<fp_t>::floor(fp_delta_int); // *** EARLY RETURN ***
|
||||||
|
|
||||||
case nia_ceiling:
|
case nia_ceiling:
|
||||||
return jtutil::round<fp_t>::ceiling(fp_delta_int);
|
return jtutil::round<fp_t>::ceiling(fp_delta_int);
|
||||||
// *** EARLY RETURN ***
|
// *** EARLY RETURN ***
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error_exit(PANIC_EXIT,
|
error_exit(PANIC_EXIT,
|
||||||
"***** linear_map<fp_t>::delta_int_of_delta_fp: illegal nia=(int)%d\n"
|
"***** linear_map<fp_t>::delta_int_of_delta_fp: illegal nia=(int)%d\n"
|
||||||
" (this should never happen!)\n",
|
" (this should never happen!)\n",
|
||||||
int(nia)); /*NOTREACHED*/
|
int(nia)); /*NOTREACHED*/
|
||||||
}
|
}
|
||||||
return 0; // dummy return to quiet gcc
|
return 0; // dummy return to quiet gcc
|
||||||
// (which doesn't grok that error_exit() never returns)
|
// (which doesn't grok that error_exit() never returns)
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** template instantiation *****
|
// ***** template instantiation *****
|
||||||
//
|
//
|
||||||
|
|
||||||
template class linear_map<float>;
|
template class linear_map<float>;
|
||||||
template class linear_map<double>;
|
template class linear_map<double>;
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,131 +1,131 @@
|
|||||||
#ifndef AHFINDERDIRECT__LINEAR_MAP_HH
|
#ifndef AHFINDERDIRECT__LINEAR_MAP_HH
|
||||||
#define AHFINDERDIRECT__LINEAR_MAP_HH
|
#define AHFINDERDIRECT__LINEAR_MAP_HH
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
class linear_map
|
class linear_map
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// integer bounds info
|
// integer bounds info
|
||||||
int min_int() const { return min_int_; }
|
int min_int() const { return min_int_; }
|
||||||
int max_int() const { return max_int_; }
|
int max_int() const { return max_int_; }
|
||||||
int N_points() const
|
int N_points() const
|
||||||
{
|
{
|
||||||
return jtutil::how_many_in_range(min_int_, max_int_);
|
return jtutil::how_many_in_range(min_int_, max_int_);
|
||||||
}
|
}
|
||||||
bool is_in_range(int i) const
|
bool is_in_range(int i) const
|
||||||
{
|
{
|
||||||
return (i >= min_int()) && (i <= max_int());
|
return (i >= min_int()) && (i <= max_int());
|
||||||
}
|
}
|
||||||
int clamp(int i) const
|
int clamp(int i) const
|
||||||
{
|
{
|
||||||
if (i < min_int())
|
if (i < min_int())
|
||||||
then return min_int();
|
then return min_int();
|
||||||
else if (i > max_int())
|
else if (i > max_int())
|
||||||
then return max_int();
|
then return max_int();
|
||||||
else
|
else
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert int --> fp
|
// convert int --> fp
|
||||||
fp_t fp_of_int_unchecked(int i) const
|
fp_t fp_of_int_unchecked(int i) const
|
||||||
{
|
{
|
||||||
return origin_ + delta_ * i;
|
return origin_ + delta_ * i;
|
||||||
}
|
}
|
||||||
fp_t fp_of_int(int i) const
|
fp_t fp_of_int(int i) const
|
||||||
{
|
{
|
||||||
assert(is_in_range(i));
|
assert(is_in_range(i));
|
||||||
return fp_of_int_unchecked(i);
|
return fp_of_int_unchecked(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// converg delta_int --> delta_fp
|
// converg delta_int --> delta_fp
|
||||||
fp_t delta_fp_of_delta_int(int delta_i) const
|
fp_t delta_fp_of_delta_int(int delta_i) const
|
||||||
{
|
{
|
||||||
return delta_ * delta_i;
|
return delta_ * delta_i;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fp bounds info
|
// fp bounds info
|
||||||
fp_t origin() const { return origin_; }
|
fp_t origin() const { return origin_; }
|
||||||
fp_t delta_fp() const { return delta_; }
|
fp_t delta_fp() const { return delta_; }
|
||||||
fp_t inverse_delta_fp() const { return inverse_delta_; }
|
fp_t inverse_delta_fp() const { return inverse_delta_; }
|
||||||
fp_t min_fp() const { return fp_of_int_unchecked(min_int_); }
|
fp_t min_fp() const { return fp_of_int_unchecked(min_int_); }
|
||||||
fp_t max_fp() const { return fp_of_int_unchecked(max_int_); }
|
fp_t max_fp() const { return fp_of_int_unchecked(max_int_); }
|
||||||
bool is_in_range(fp_t x) const
|
bool is_in_range(fp_t x) const
|
||||||
{
|
{
|
||||||
return fuzzy<fp_t>::GE(x, min_fp()) && fuzzy<fp_t>::LE(x, max_fp());
|
return fuzzy<fp_t>::GE(x, min_fp()) && fuzzy<fp_t>::LE(x, max_fp());
|
||||||
}
|
}
|
||||||
fp_t clamp(fp_t x) const
|
fp_t clamp(fp_t x) const
|
||||||
{
|
{
|
||||||
if (x < min_fp())
|
if (x < min_fp())
|
||||||
then return min_fp();
|
then return min_fp();
|
||||||
else if (x > max_fp())
|
else if (x > max_fp())
|
||||||
then return max_fp();
|
then return max_fp();
|
||||||
else
|
else
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert linear map indices <--> C-style 0-origin indices
|
// convert linear map indices <--> C-style 0-origin indices
|
||||||
int zero_origin_int(int i) const { return i - min_int(); }
|
int zero_origin_int(int i) const { return i - min_int(); }
|
||||||
int map_int(int zero_origin_i) { return zero_origin_i + min_int(); }
|
int map_int(int zero_origin_i) { return zero_origin_i + min_int(); }
|
||||||
|
|
||||||
// convert fp --> int coordinate, but return result as fp
|
// convert fp --> int coordinate, but return result as fp
|
||||||
// (which need not be fuzzily integral)
|
// (which need not be fuzzily integral)
|
||||||
fp_t fp_int_of_fp(fp_t x) const;
|
fp_t fp_int_of_fp(fp_t x) const;
|
||||||
|
|
||||||
// convert fp --> int, check being fuzzily integral
|
// convert fp --> int, check being fuzzily integral
|
||||||
enum noninteger_action // what to do if "int"
|
enum noninteger_action // what to do if "int"
|
||||||
// isn't fuzzily integral?
|
// isn't fuzzily integral?
|
||||||
{
|
{
|
||||||
nia_error, // jtutil::error_exit(...)
|
nia_error, // jtutil::error_exit(...)
|
||||||
nia_warning, // print warning msg,
|
nia_warning, // print warning msg,
|
||||||
// then round to nearest
|
// then round to nearest
|
||||||
nia_round, // (silently) round to nearest
|
nia_round, // (silently) round to nearest
|
||||||
nia_floor, // (silently) round to -infinity
|
nia_floor, // (silently) round to -infinity
|
||||||
nia_ceiling // (silently) round to +infinity
|
nia_ceiling // (silently) round to +infinity
|
||||||
};
|
};
|
||||||
int int_of_fp(fp_t x, noninteger_action nia = nia_error) const;
|
int int_of_fp(fp_t x, noninteger_action nia = nia_error) const;
|
||||||
|
|
||||||
// convert delta_fp --> delta_int, check being fuzzily integral
|
// convert delta_fp --> delta_int, check being fuzzily integral
|
||||||
int delta_int_of_delta_fp(fp_t delta_x,
|
int delta_int_of_delta_fp(fp_t delta_x,
|
||||||
noninteger_action nia = nia_error)
|
noninteger_action nia = nia_error)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
// constructors
|
// constructors
|
||||||
linear_map(int min_int_in, int max_int_in,
|
linear_map(int min_int_in, int max_int_in,
|
||||||
fp_t min_fp_in, fp_t delta_fp_in, fp_t max_fp_in);
|
fp_t min_fp_in, fp_t delta_fp_in, fp_t max_fp_in);
|
||||||
// ... construct with subrange of existing linear_map
|
// ... construct with subrange of existing linear_map
|
||||||
linear_map(const linear_map<fp_t> &lm_in,
|
linear_map(const linear_map<fp_t> &lm_in,
|
||||||
int min_int_in, int max_int_in);
|
int min_int_in, int max_int_in);
|
||||||
|
|
||||||
// no need for explicit destructor, compiler-generated no-op is ok
|
// no need for explicit destructor, compiler-generated no-op is ok
|
||||||
|
|
||||||
// no need for copy constructor or assignment operator,
|
// no need for copy constructor or assignment operator,
|
||||||
// compiler-generated defaults are ok
|
// compiler-generated defaults are ok
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common code (argument validation & setup) for all constructors
|
// common code (argument validation & setup) for all constructors
|
||||||
// assumes min_int_, max_int_, delta_ already initialized,
|
// assumes min_int_, max_int_, delta_ already initialized,
|
||||||
// other class members *not* initialized
|
// other class members *not* initialized
|
||||||
void constructor_common(fp_t min_fp_in, fp_t max_fp_in);
|
void constructor_common(fp_t min_fp_in, fp_t max_fp_in);
|
||||||
|
|
||||||
// these define the actual mapping
|
// these define the actual mapping
|
||||||
// via the fp_of_int() function (above)
|
// via the fp_of_int() function (above)
|
||||||
fp_t origin_, delta_;
|
fp_t origin_, delta_;
|
||||||
|
|
||||||
// cache of 1.0/delta_
|
// cache of 1.0/delta_
|
||||||
// ==> avoids fp divide in inverse_delta_fp()
|
// ==> avoids fp divide in inverse_delta_fp()
|
||||||
// ==> also makes fp --> int conversions slightly faster
|
// ==> also makes fp --> int conversions slightly faster
|
||||||
fp_t inverse_delta_;
|
fp_t inverse_delta_;
|
||||||
|
|
||||||
const int min_int_, max_int_;
|
const int min_int_, max_int_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
|
|
||||||
#endif /* AHFINDERDIRECT__LINEAR_MAP_HH */
|
#endif /* AHFINDERDIRECT__LINEAR_MAP_HH */
|
||||||
@@ -1,66 +1,66 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
double signum(double x)
|
double signum(double x)
|
||||||
{
|
{
|
||||||
if (x == 0.0)
|
if (x == 0.0)
|
||||||
then return 0.0;
|
then return 0.0;
|
||||||
else
|
else
|
||||||
return (x > 0.0) ? 1.0 : -1.0;
|
return (x > 0.0) ? 1.0 : -1.0;
|
||||||
}
|
}
|
||||||
double hypot3(double x, double y, double z)
|
double hypot3(double x, double y, double z)
|
||||||
{
|
{
|
||||||
return sqrt(x * x + y * y + z * z);
|
return sqrt(x * x + y * y + z * z);
|
||||||
}
|
}
|
||||||
double arctan_xy(double x, double y)
|
double arctan_xy(double x, double y)
|
||||||
{
|
{
|
||||||
return ((x == 0.0) && (y == 0.0)) ? 0.0 : atan2(y, x);
|
return ((x == 0.0) && (y == 0.0)) ? 0.0 : atan2(y, x);
|
||||||
}
|
}
|
||||||
double modulo_reduce(double x, double xmod, double xmin, double xmax)
|
double modulo_reduce(double x, double xmod, double xmin, double xmax)
|
||||||
{
|
{
|
||||||
double xx = x;
|
double xx = x;
|
||||||
|
|
||||||
while (fuzzy<double>::LT(xx, xmin))
|
while (fuzzy<double>::LT(xx, xmin))
|
||||||
{
|
{
|
||||||
xx += xmod;
|
xx += xmod;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fuzzy<double>::GT(xx, xmax))
|
while (fuzzy<double>::GT(xx, xmax))
|
||||||
{
|
{
|
||||||
xx -= xmod;
|
xx -= xmod;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(fuzzy<double>::GE(xx, xmin) && fuzzy<double>::LE(xx, xmax)))
|
if (!(fuzzy<double>::GE(xx, xmin) && fuzzy<double>::LE(xx, xmax)))
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** modulo_reduce(): no modulo value is fuzzily within specified range!\n"
|
"***** modulo_reduce(): no modulo value is fuzzily within specified range!\n"
|
||||||
" x = %g xmod = %g\n"
|
" x = %g xmod = %g\n"
|
||||||
" [xmin,xmax] = [%g,%g]\n"
|
" [xmin,xmax] = [%g,%g]\n"
|
||||||
" ==> xx = %g\n",
|
" ==> xx = %g\n",
|
||||||
x, xmod,
|
x, xmod,
|
||||||
xmin, xmax,
|
xmin, xmax,
|
||||||
xx); /*NOTREACHED*/
|
xx); /*NOTREACHED*/
|
||||||
|
|
||||||
return xx;
|
return xx;
|
||||||
}
|
}
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
void zero_C_array(int N, fp_t array[])
|
void zero_C_array(int N, fp_t array[])
|
||||||
{
|
{
|
||||||
for (int i = 0; i < N; ++i)
|
for (int i = 0; i < N; ++i)
|
||||||
{
|
{
|
||||||
array[i] = 0;
|
array[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template void zero_C_array<CCTK_REAL>(int, CCTK_REAL[]);
|
template void zero_C_array<CCTK_REAL>(int, CCTK_REAL[]);
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,65 +1,65 @@
|
|||||||
#ifndef MYGLOBAL_H
|
#ifndef MYGLOBAL_H
|
||||||
#define MYGLOBAL_H
|
#define MYGLOBAL_H
|
||||||
|
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
#include "MyList.h"
|
#include "MyList.h"
|
||||||
|
|
||||||
#ifdef USE_GPU
|
#ifdef USE_GPU
|
||||||
#include "bssn_gpu_class.h"
|
#include "bssn_gpu_class.h"
|
||||||
#else
|
#else
|
||||||
#include "bssn_class.h"
|
#include "bssn_class.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
int globalInterpGFL(double *X, double *Y, double *Z, int Ns,
|
int globalInterpGFL(double *X, double *Y, double *Z, int Ns,
|
||||||
double *Data);
|
double *Data);
|
||||||
|
|
||||||
int globalInterpGFLlash(double *X, double *Y, double *Z, int Ns,
|
int globalInterpGFLlash(double *X, double *Y, double *Z, int Ns,
|
||||||
double *Data);
|
double *Data);
|
||||||
|
|
||||||
void AHFinderDirect_setup(MyList<var> *AHList, MyList<var> *GaugeList, bssn_class *ADM,
|
void AHFinderDirect_setup(MyList<var> *AHList, MyList<var> *GaugeList, bssn_class *ADM,
|
||||||
int Symmetry, int HN, double *PhysTime);
|
int Symmetry, int HN, double *PhysTime);
|
||||||
|
|
||||||
void AHFinderDirect_cleanup();
|
void AHFinderDirect_cleanup();
|
||||||
|
|
||||||
void AHFinderDirect_find_horizons(int HN, int *dumpid,
|
void AHFinderDirect_find_horizons(int HN, int *dumpid,
|
||||||
double *xc, double *yc, double *zc, double *xr, double *yr, double *zr,
|
double *xc, double *yc, double *zc, double *xr, double *yr, double *zr,
|
||||||
bool *trigger, double *);
|
bool *trigger, double *);
|
||||||
|
|
||||||
void AHFinderDirect_enforcefind(int HN,
|
void AHFinderDirect_enforcefind(int HN,
|
||||||
double *xc, double *yc, double *zc, double *xr, double *yr, double *zr);
|
double *xc, double *yc, double *zc, double *xr, double *yr, double *zr);
|
||||||
//
|
//
|
||||||
struct state
|
struct state
|
||||||
{
|
{
|
||||||
int N_procs; // total number of processors
|
int N_procs; // total number of processors
|
||||||
int my_proc; // processor number of this processor
|
int my_proc; // processor number of this processor
|
||||||
// (0 to N_procs-1)
|
// (0 to N_procs-1)
|
||||||
|
|
||||||
int Symmetry;
|
int Symmetry;
|
||||||
double *PhysTime;
|
double *PhysTime;
|
||||||
|
|
||||||
MyList<var> *AHList;
|
MyList<var> *AHList;
|
||||||
MyList<var> *GaugeList;
|
MyList<var> *GaugeList;
|
||||||
|
|
||||||
bssn_class *ADM;
|
bssn_class *ADM;
|
||||||
|
|
||||||
int N_horizons; // total number of genuine horizons
|
int N_horizons; // total number of genuine horizons
|
||||||
// being searched for
|
// being searched for
|
||||||
int N_active_procs; // total number of active processors
|
int N_active_procs; // total number of active processors
|
||||||
// (the active processors are processor
|
// (the active processors are processor
|
||||||
// numbers 0 to N_active_procs-1)
|
// numbers 0 to N_active_procs-1)
|
||||||
|
|
||||||
struct iteration_status_buffers isb;
|
struct iteration_status_buffers isb;
|
||||||
|
|
||||||
horizon_sequence *my_hs;
|
horizon_sequence *my_hs;
|
||||||
|
|
||||||
struct AH_data **AH_data_array;
|
struct AH_data **AH_data_array;
|
||||||
|
|
||||||
double *Data, *oX, *oY, *oZ;
|
double *Data, *oX, *oY, *oZ;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif /* MYGLOBAL_H */
|
#endif /* MYGLOBAL_H */
|
||||||
@@ -1,68 +1,68 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
norm<fp_t>::norm()
|
norm<fp_t>::norm()
|
||||||
: N_(0L),
|
: N_(0L),
|
||||||
sum_(0.0), sum2_(0.0),
|
sum_(0.0), sum2_(0.0),
|
||||||
max_abs_value_(0.0), min_abs_value_(0.0),
|
max_abs_value_(0.0), min_abs_value_(0.0),
|
||||||
max_value_(0.0), min_value_(0.0)
|
max_value_(0.0), min_value_(0.0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
void norm<fp_t>::reset()
|
void norm<fp_t>::reset()
|
||||||
{
|
{
|
||||||
N_ = 0L;
|
N_ = 0L;
|
||||||
sum_ = 0.0;
|
sum_ = 0.0;
|
||||||
sum2_ = 0.0;
|
sum2_ = 0.0;
|
||||||
max_abs_value_ = 0.0;
|
max_abs_value_ = 0.0;
|
||||||
min_abs_value_ = 0.0;
|
min_abs_value_ = 0.0;
|
||||||
max_value_ = 0.0;
|
max_value_ = 0.0;
|
||||||
min_value_ = 0.0;
|
min_value_ = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
void norm<fp_t>::data(fp_t x)
|
void norm<fp_t>::data(fp_t x)
|
||||||
{
|
{
|
||||||
sum_ += x;
|
sum_ += x;
|
||||||
sum2_ += x * x;
|
sum2_ += x * x;
|
||||||
|
|
||||||
const fp_t abs_x = jtutil::abs<fp_t>(x);
|
const fp_t abs_x = jtutil::abs<fp_t>(x);
|
||||||
max_abs_value_ = jtutil::tmax(max_abs_value_, abs_x);
|
max_abs_value_ = jtutil::tmax(max_abs_value_, abs_x);
|
||||||
min_abs_value_ = (N_ == 0) ? abs_x : jtutil::tmin(min_abs_value_, abs_x);
|
min_abs_value_ = (N_ == 0) ? abs_x : jtutil::tmin(min_abs_value_, abs_x);
|
||||||
|
|
||||||
min_value_ = (N_ == 0) ? x : jtutil::tmin(min_value_, x);
|
min_value_ = (N_ == 0) ? x : jtutil::tmin(min_value_, x);
|
||||||
max_value_ = (N_ == 0) ? x : jtutil::tmax(max_value_, x);
|
max_value_ = (N_ == 0) ? x : jtutil::tmax(max_value_, x);
|
||||||
|
|
||||||
++N_;
|
++N_;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
fp_t norm<fp_t>::mean() const { return sum_ / fp_t(N_); }
|
fp_t norm<fp_t>::mean() const { return sum_ / fp_t(N_); }
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
fp_t norm<fp_t>::two_norm() const { return sqrt(sum2_); }
|
fp_t norm<fp_t>::two_norm() const { return sqrt(sum2_); }
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
fp_t norm<fp_t>::rms_norm() const
|
fp_t norm<fp_t>::rms_norm() const
|
||||||
{
|
{
|
||||||
assert(is_nonempty());
|
assert(is_nonempty());
|
||||||
return sqrt(sum2_ / fp_t(N_));
|
return sqrt(sum2_ / fp_t(N_));
|
||||||
}
|
}
|
||||||
|
|
||||||
template class jtutil::norm<float>;
|
template class jtutil::norm<float>;
|
||||||
template class jtutil::norm<double>;
|
template class jtutil::norm<double>;
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,320 +1,320 @@
|
|||||||
#ifndef TPATCH_EDGE_H
|
#ifndef TPATCH_EDGE_H
|
||||||
#define TPATCH_EDGE_H
|
#define TPATCH_EDGE_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// patch_edge -- perpendicular/parallel geometry of one side of a patch
|
// patch_edge -- perpendicular/parallel geometry of one side of a patch
|
||||||
//
|
//
|
||||||
// A patch_edge object is a very light-weight object which represents
|
// A patch_edge object is a very light-weight object which represents
|
||||||
// the basic geometry of a min/max rho/sigma side of a patch, i.e. it
|
// the basic geometry of a min/max rho/sigma side of a patch, i.e. it
|
||||||
// provides which-side-am-I predicates, coordinate conversions between
|
// provides which-side-am-I predicates, coordinate conversions between
|
||||||
// (perp,par) and (rho,sigma), etc. Every patch has (points to) 4 patch_edge
|
// (perp,par) and (rho,sigma), etc. Every patch has (points to) 4 patch_edge
|
||||||
// objects, one for each of the patch's sides. See the comments in
|
// objects, one for each of the patch's sides. See the comments in
|
||||||
// "patch.hh" for a "big picture" discussion of patches, patch edges,
|
// "patch.hh" for a "big picture" discussion of patches, patch edges,
|
||||||
// ghost zones, and patch interpolation regions.
|
// ghost zones, and patch interpolation regions.
|
||||||
//
|
//
|
||||||
// Note that since patch_edge has only const member functions
|
// Note that since patch_edge has only const member functions
|
||||||
// (and members!), a patch_edge object is effectively always const .
|
// (and members!), a patch_edge object is effectively always const .
|
||||||
// This means there's no harm in always declaring patch_edge objects
|
// This means there's no harm in always declaring patch_edge objects
|
||||||
// to be const .
|
// to be const .
|
||||||
//
|
//
|
||||||
|
|
||||||
class patch_edge
|
class patch_edge
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// ***** meta-info *****
|
// ***** meta-info *****
|
||||||
//
|
//
|
||||||
|
|
||||||
// meta-info about patch
|
// meta-info about patch
|
||||||
patch &my_patch() const { return my_patch_; }
|
patch &my_patch() const { return my_patch_; }
|
||||||
|
|
||||||
// meta-info about edge
|
// meta-info about edge
|
||||||
bool is_rho() const { return is_rho_; }
|
bool is_rho() const { return is_rho_; }
|
||||||
bool is_min() const { return is_min_; }
|
bool is_min() const { return is_min_; }
|
||||||
bool perp_is_rho() const { return is_rho(); }
|
bool perp_is_rho() const { return is_rho(); }
|
||||||
bool par_is_rho() const { return !is_rho(); }
|
bool par_is_rho() const { return !is_rho(); }
|
||||||
|
|
||||||
// human-readable {min,max}_{rho,sigma} name (for debugging etc)
|
// human-readable {min,max}_{rho,sigma} name (for debugging etc)
|
||||||
const char *name() const
|
const char *name() const
|
||||||
{
|
{
|
||||||
return is_min()
|
return is_min()
|
||||||
? (is_rho() ? "min_rho" : "min_sigma")
|
? (is_rho() ? "min_rho" : "min_sigma")
|
||||||
: (is_rho() ? "max_rho" : "max_sigma");
|
: (is_rho() ? "max_rho" : "max_sigma");
|
||||||
}
|
}
|
||||||
|
|
||||||
// are two edges really the same edge?
|
// are two edges really the same edge?
|
||||||
bool operator==(const patch_edge &other_edge) const
|
bool operator==(const patch_edge &other_edge) const
|
||||||
{
|
{
|
||||||
return (my_patch() == other_edge.my_patch()) && (is_rho() == other_edge.is_rho()) && (is_min() == other_edge.is_min());
|
return (my_patch() == other_edge.my_patch()) && (is_rho() == other_edge.is_rho()) && (is_min() == other_edge.is_min());
|
||||||
}
|
}
|
||||||
bool operator!=(const patch_edge &other_edge) const
|
bool operator!=(const patch_edge &other_edge) const
|
||||||
{
|
{
|
||||||
return !operator==(other_edge);
|
return !operator==(other_edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** adjacent edges *****
|
// ***** adjacent edges *****
|
||||||
//
|
//
|
||||||
|
|
||||||
// get adjacent edges to our min/max par corners
|
// get adjacent edges to our min/max par corners
|
||||||
const patch_edge &min_par_adjacent_edge() const
|
const patch_edge &min_par_adjacent_edge() const
|
||||||
{
|
{
|
||||||
return my_patch()
|
return my_patch()
|
||||||
.minmax_ang_patch_edge(grid::side_is_min, par_is_rho());
|
.minmax_ang_patch_edge(grid::side_is_min, par_is_rho());
|
||||||
}
|
}
|
||||||
const patch_edge &max_par_adjacent_edge() const
|
const patch_edge &max_par_adjacent_edge() const
|
||||||
{
|
{
|
||||||
return my_patch()
|
return my_patch()
|
||||||
.minmax_ang_patch_edge(grid::side_is_max, par_is_rho());
|
.minmax_ang_patch_edge(grid::side_is_max, par_is_rho());
|
||||||
}
|
}
|
||||||
const patch_edge &minmax_par_adjacent_edge(bool want_min) const
|
const patch_edge &minmax_par_adjacent_edge(bool want_min) const
|
||||||
{
|
{
|
||||||
return want_min ? min_par_adjacent_edge()
|
return want_min ? min_par_adjacent_edge()
|
||||||
: max_par_adjacent_edge();
|
: max_par_adjacent_edge();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** gridfn subscripting and coordinate maps *****
|
// ***** gridfn subscripting and coordinate maps *****
|
||||||
//
|
//
|
||||||
|
|
||||||
// gridfn strides perpendicular/parallel to the edge
|
// gridfn strides perpendicular/parallel to the edge
|
||||||
int perp_stride() const
|
int perp_stride() const
|
||||||
{
|
{
|
||||||
return my_patch().iang_stride(perp_is_rho());
|
return my_patch().iang_stride(perp_is_rho());
|
||||||
}
|
}
|
||||||
int par_stride() const
|
int par_stride() const
|
||||||
{
|
{
|
||||||
return my_patch().iang_stride(par_is_rho());
|
return my_patch().iang_stride(par_is_rho());
|
||||||
}
|
}
|
||||||
int ghosted_perp_stride() const
|
int ghosted_perp_stride() const
|
||||||
{
|
{
|
||||||
return my_patch().ghosted_iang_stride(perp_is_rho());
|
return my_patch().ghosted_iang_stride(perp_is_rho());
|
||||||
}
|
}
|
||||||
int ghosted_par_stride() const
|
int ghosted_par_stride() const
|
||||||
{
|
{
|
||||||
return my_patch().ghosted_iang_stride(par_is_rho());
|
return my_patch().ghosted_iang_stride(par_is_rho());
|
||||||
}
|
}
|
||||||
|
|
||||||
// coordinate maps perpendicular/parallel to the edge
|
// coordinate maps perpendicular/parallel to the edge
|
||||||
// ... range is that of the grid *including* ghost zones
|
// ... range is that of the grid *including* ghost zones
|
||||||
const jtutil::linear_map<fp> &perp_map() const
|
const jtutil::linear_map<fp> &perp_map() const
|
||||||
{
|
{
|
||||||
return my_patch().ang_map(perp_is_rho());
|
return my_patch().ang_map(perp_is_rho());
|
||||||
}
|
}
|
||||||
const jtutil::linear_map<fp> &par_map() const
|
const jtutil::linear_map<fp> &par_map() const
|
||||||
{
|
{
|
||||||
return my_patch().ang_map(par_is_rho());
|
return my_patch().ang_map(par_is_rho());
|
||||||
}
|
}
|
||||||
|
|
||||||
// meta-info about perp/par coordinates
|
// meta-info about perp/par coordinates
|
||||||
// ... as (mu,nu,phi) tensor indices
|
// ... as (mu,nu,phi) tensor indices
|
||||||
local_coords::coords_set coords_set_perp() const
|
local_coords::coords_set coords_set_perp() const
|
||||||
{
|
{
|
||||||
return perp_is_rho() ? my_patch().coords_set_rho()
|
return perp_is_rho() ? my_patch().coords_set_rho()
|
||||||
: my_patch().coords_set_sigma();
|
: my_patch().coords_set_sigma();
|
||||||
}
|
}
|
||||||
local_coords::coords_set coords_set_par() const
|
local_coords::coords_set coords_set_par() const
|
||||||
{
|
{
|
||||||
return par_is_rho() ? my_patch().coords_set_rho()
|
return par_is_rho() ? my_patch().coords_set_rho()
|
||||||
: my_patch().coords_set_sigma();
|
: my_patch().coords_set_sigma();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** coordinate conversions *****
|
// ***** coordinate conversions *****
|
||||||
//
|
//
|
||||||
|
|
||||||
// coordinate conversions based on ghost zone direction
|
// coordinate conversions based on ghost zone direction
|
||||||
// ... (iperp,ipar) <--> (perp,par)
|
// ... (iperp,ipar) <--> (perp,par)
|
||||||
fp perp_of_iperp(int iperp) const
|
fp perp_of_iperp(int iperp) const
|
||||||
{
|
{
|
||||||
return my_patch().ang_of_iang(perp_is_rho(), iperp);
|
return my_patch().ang_of_iang(perp_is_rho(), iperp);
|
||||||
}
|
}
|
||||||
fp par_of_ipar(int ipar) const
|
fp par_of_ipar(int ipar) const
|
||||||
{
|
{
|
||||||
return my_patch().ang_of_iang(par_is_rho(), ipar);
|
return my_patch().ang_of_iang(par_is_rho(), ipar);
|
||||||
}
|
}
|
||||||
fp fp_iperp_of_perp(fp perp) const
|
fp fp_iperp_of_perp(fp perp) const
|
||||||
{
|
{
|
||||||
return my_patch().fp_iang_of_ang(perp_is_rho(), perp);
|
return my_patch().fp_iang_of_ang(perp_is_rho(), perp);
|
||||||
}
|
}
|
||||||
fp fp_ipar_of_par(fp par) const
|
fp fp_ipar_of_par(fp par) const
|
||||||
{
|
{
|
||||||
return my_patch().fp_iang_of_ang(par_is_rho(), par);
|
return my_patch().fp_iang_of_ang(par_is_rho(), par);
|
||||||
}
|
}
|
||||||
int iperp_of_perp(fp perp, jtutil::linear_map<fp>::noninteger_action
|
int iperp_of_perp(fp perp, jtutil::linear_map<fp>::noninteger_action
|
||||||
nia = jtutil::linear_map<fp>::nia_error)
|
nia = jtutil::linear_map<fp>::nia_error)
|
||||||
{
|
{
|
||||||
return my_patch().iang_of_ang(perp_is_rho(), perp, nia);
|
return my_patch().iang_of_ang(perp_is_rho(), perp, nia);
|
||||||
}
|
}
|
||||||
int ipar_of_par(fp par, jtutil::linear_map<fp>::noninteger_action
|
int ipar_of_par(fp par, jtutil::linear_map<fp>::noninteger_action
|
||||||
nia = jtutil::linear_map<fp>::nia_error)
|
nia = jtutil::linear_map<fp>::nia_error)
|
||||||
{
|
{
|
||||||
return my_patch().iang_of_ang(par_is_rho(), par, nia);
|
return my_patch().iang_of_ang(par_is_rho(), par, nia);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ... (perp,par) --> (rho,sigma)
|
// ... (perp,par) --> (rho,sigma)
|
||||||
int irho_of_iperp_ipar(int iperp, int ipar) const
|
int irho_of_iperp_ipar(int iperp, int ipar) const
|
||||||
{
|
{
|
||||||
return perp_is_rho() ? iperp : ipar;
|
return perp_is_rho() ? iperp : ipar;
|
||||||
}
|
}
|
||||||
int isigma_of_iperp_ipar(int iperp, int ipar) const
|
int isigma_of_iperp_ipar(int iperp, int ipar) const
|
||||||
{
|
{
|
||||||
return perp_is_rho() ? ipar : iperp;
|
return perp_is_rho() ? ipar : iperp;
|
||||||
}
|
}
|
||||||
fp rho_of_perp_par(fp perp, fp par) const
|
fp rho_of_perp_par(fp perp, fp par) const
|
||||||
{
|
{
|
||||||
return perp_is_rho() ? perp : par;
|
return perp_is_rho() ? perp : par;
|
||||||
}
|
}
|
||||||
fp sigma_of_perp_par(fp perp, fp par) const
|
fp sigma_of_perp_par(fp perp, fp par) const
|
||||||
{
|
{
|
||||||
return perp_is_rho() ? par : perp;
|
return perp_is_rho() ? par : perp;
|
||||||
}
|
}
|
||||||
// ... (rho,sigma) --> (perp,par)
|
// ... (rho,sigma) --> (perp,par)
|
||||||
int iperp_of_irho_isigma(int irho, int isigma) const
|
int iperp_of_irho_isigma(int irho, int isigma) const
|
||||||
{
|
{
|
||||||
return perp_is_rho() ? irho : isigma;
|
return perp_is_rho() ? irho : isigma;
|
||||||
}
|
}
|
||||||
int ipar_of_irho_isigma(int irho, int isigma) const
|
int ipar_of_irho_isigma(int irho, int isigma) const
|
||||||
{
|
{
|
||||||
return par_is_rho() ? irho : isigma;
|
return par_is_rho() ? irho : isigma;
|
||||||
}
|
}
|
||||||
fp perp_of_rho_sigma(fp rho, fp sigma) const
|
fp perp_of_rho_sigma(fp rho, fp sigma) const
|
||||||
{
|
{
|
||||||
return perp_is_rho() ? rho : sigma;
|
return perp_is_rho() ? rho : sigma;
|
||||||
}
|
}
|
||||||
fp par_of_rho_sigma(fp rho, fp sigma) const
|
fp par_of_rho_sigma(fp rho, fp sigma) const
|
||||||
{
|
{
|
||||||
return par_is_rho() ? rho : sigma;
|
return par_is_rho() ? rho : sigma;
|
||||||
}
|
}
|
||||||
|
|
||||||
// outer perp of nominal grid on this edge
|
// outer perp of nominal grid on this edge
|
||||||
// ... this is outermost *grid point*
|
// ... this is outermost *grid point*
|
||||||
fp grid_outer_iperp() const
|
fp grid_outer_iperp() const
|
||||||
{
|
{
|
||||||
return my_patch().minmax_iang(is_min(), is_rho());
|
return my_patch().minmax_iang(is_min(), is_rho());
|
||||||
}
|
}
|
||||||
// ... this is actual outer edge of grid
|
// ... this is actual outer edge of grid
|
||||||
// (might be halfway between two grid points)
|
// (might be halfway between two grid points)
|
||||||
fp grid_outer_perp() const
|
fp grid_outer_perp() const
|
||||||
{
|
{
|
||||||
return my_patch().minmax_ang(is_min(), is_rho());
|
return my_patch().minmax_ang(is_min(), is_rho());
|
||||||
}
|
}
|
||||||
// ... this is grid_outer_perp() converted back to the iperp
|
// ... this is grid_outer_perp() converted back to the iperp
|
||||||
// coordinate, but still returned as floating-point;
|
// coordinate, but still returned as floating-point;
|
||||||
// it will be either integer or half-integer
|
// it will be either integer or half-integer
|
||||||
fp fp_grid_outer_iperp() const
|
fp fp_grid_outer_iperp() const
|
||||||
{
|
{
|
||||||
return fp_iperp_of_perp(grid_outer_perp());
|
return fp_iperp_of_perp(grid_outer_perp());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** min/max/outer coordinates of edge *****
|
// ***** min/max/outer coordinates of edge *****
|
||||||
//
|
//
|
||||||
|
|
||||||
// min/max/size ipar of the edge
|
// min/max/size ipar of the edge
|
||||||
// (these are exteme limits for any iperp, a given ghost zone
|
// (these are exteme limits for any iperp, a given ghost zone
|
||||||
// or interpolation region may have tighter and/or iperp-dependent
|
// or interpolation region may have tighter and/or iperp-dependent
|
||||||
// limits)
|
// limits)
|
||||||
// ... not including corners
|
// ... not including corners
|
||||||
int min_ipar_without_corners() const
|
int min_ipar_without_corners() const
|
||||||
{
|
{
|
||||||
return my_patch().min_iang(par_is_rho());
|
return my_patch().min_iang(par_is_rho());
|
||||||
}
|
}
|
||||||
int max_ipar_without_corners() const
|
int max_ipar_without_corners() const
|
||||||
{
|
{
|
||||||
return my_patch().max_iang(par_is_rho());
|
return my_patch().max_iang(par_is_rho());
|
||||||
}
|
}
|
||||||
// ... including corners
|
// ... including corners
|
||||||
int min_ipar_with_corners() const
|
int min_ipar_with_corners() const
|
||||||
{
|
{
|
||||||
return my_patch().ghosted_min_iang(par_is_rho());
|
return my_patch().ghosted_min_iang(par_is_rho());
|
||||||
}
|
}
|
||||||
int max_ipar_with_corners() const
|
int max_ipar_with_corners() const
|
||||||
{
|
{
|
||||||
return my_patch().ghosted_max_iang(par_is_rho());
|
return my_patch().ghosted_max_iang(par_is_rho());
|
||||||
}
|
}
|
||||||
// ... of the corners themselves
|
// ... of the corners themselves
|
||||||
int min_ipar_corner__min_ipar() const
|
int min_ipar_corner__min_ipar() const
|
||||||
{
|
{
|
||||||
return min_ipar_with_corners();
|
return min_ipar_with_corners();
|
||||||
}
|
}
|
||||||
int min_ipar_corner__max_ipar() const
|
int min_ipar_corner__max_ipar() const
|
||||||
{
|
{
|
||||||
return min_ipar_without_corners() - 1;
|
return min_ipar_without_corners() - 1;
|
||||||
}
|
}
|
||||||
int max_ipar_corner__min_ipar() const
|
int max_ipar_corner__min_ipar() const
|
||||||
{
|
{
|
||||||
return max_ipar_without_corners() + 1;
|
return max_ipar_without_corners() + 1;
|
||||||
}
|
}
|
||||||
int max_ipar_corner__max_ipar() const
|
int max_ipar_corner__max_ipar() const
|
||||||
{
|
{
|
||||||
return max_ipar_with_corners();
|
return max_ipar_with_corners();
|
||||||
}
|
}
|
||||||
|
|
||||||
// membership predicates for ipar corners, non-corners
|
// membership predicates for ipar corners, non-corners
|
||||||
bool ipar_is_in_min_ipar_corner(int ipar) const
|
bool ipar_is_in_min_ipar_corner(int ipar) const
|
||||||
{
|
{
|
||||||
return (ipar >= min_ipar_corner__min_ipar()) && (ipar <= min_ipar_corner__max_ipar());
|
return (ipar >= min_ipar_corner__min_ipar()) && (ipar <= min_ipar_corner__max_ipar());
|
||||||
}
|
}
|
||||||
bool ipar_is_in_max_ipar_corner(int ipar) const
|
bool ipar_is_in_max_ipar_corner(int ipar) const
|
||||||
{
|
{
|
||||||
return (ipar >= max_ipar_corner__min_ipar()) && (ipar <= max_ipar_corner__max_ipar());
|
return (ipar >= max_ipar_corner__min_ipar()) && (ipar <= max_ipar_corner__max_ipar());
|
||||||
}
|
}
|
||||||
bool ipar_is_in_corner(int ipar) const
|
bool ipar_is_in_corner(int ipar) const
|
||||||
{
|
{
|
||||||
return ipar_is_in_min_ipar_corner(ipar) || ipar_is_in_max_ipar_corner(ipar);
|
return ipar_is_in_min_ipar_corner(ipar) || ipar_is_in_max_ipar_corner(ipar);
|
||||||
}
|
}
|
||||||
bool ipar_is_in_noncorner(int ipar) const
|
bool ipar_is_in_noncorner(int ipar) const
|
||||||
{
|
{
|
||||||
return (ipar >= min_ipar_without_corners()) && (ipar <= max_ipar_without_corners());
|
return (ipar >= min_ipar_without_corners()) && (ipar <= max_ipar_without_corners());
|
||||||
}
|
}
|
||||||
|
|
||||||
// convenience function selecting amongst the above
|
// convenience function selecting amongst the above
|
||||||
// membership predicates
|
// membership predicates
|
||||||
bool ipar_is_in_selected_part(bool want_corners,
|
bool ipar_is_in_selected_part(bool want_corners,
|
||||||
bool want_noncorner,
|
bool want_noncorner,
|
||||||
int ipar)
|
int ipar)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
return (want_corners && ipar_is_in_corner(ipar)) || (want_noncorner && ipar_is_in_noncorner(ipar));
|
return (want_corners && ipar_is_in_corner(ipar)) || (want_noncorner && ipar_is_in_noncorner(ipar));
|
||||||
}
|
}
|
||||||
|
|
||||||
// outer (farthest from patch center) iperp of nominal grid
|
// outer (farthest from patch center) iperp of nominal grid
|
||||||
int nominal_grid_outer_iperp() const
|
int nominal_grid_outer_iperp() const
|
||||||
{
|
{
|
||||||
return my_patch()
|
return my_patch()
|
||||||
.minmax_iang(is_min(), is_rho());
|
.minmax_iang(is_min(), is_rho());
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** constructor, destructor *****
|
// ***** constructor, destructor *****
|
||||||
//
|
//
|
||||||
|
|
||||||
patch_edge(patch &my_patch_in,
|
patch_edge(patch &my_patch_in,
|
||||||
bool is_min_in, bool is_rho_in)
|
bool is_min_in, bool is_rho_in)
|
||||||
: my_patch_(my_patch_in),
|
: my_patch_(my_patch_in),
|
||||||
is_min_(is_min_in), is_rho_(is_rho_in)
|
is_min_(is_min_in), is_rho_(is_rho_in)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// compiler-synthesized (no-op) destructor is fine
|
// compiler-synthesized (no-op) destructor is fine
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// we forbid copying and passing by value
|
// we forbid copying and passing by value
|
||||||
// by declaring the copy constructor and assignment operator
|
// by declaring the copy constructor and assignment operator
|
||||||
// private, but never defining them
|
// private, but never defining them
|
||||||
patch_edge(const patch_edge &rhs);
|
patch_edge(const patch_edge &rhs);
|
||||||
patch_edge &operator=(const patch_edge &rhs);
|
patch_edge &operator=(const patch_edge &rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
patch &my_patch_;
|
patch &my_patch_;
|
||||||
const bool is_min_, is_rho_;
|
const bool is_min_, is_rho_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* TPATCH_EDGE_H */
|
#endif /* TPATCH_EDGE_H */
|
||||||
@@ -1,187 +1,187 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "patch_info.h"
|
#include "patch_info.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
using jtutil::error_exit;
|
using jtutil::error_exit;
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function computes, and returns a reference to, a
|
// This function computes, and returns a reference to, a
|
||||||
// struct grid_arrays::grid_array_pars from the info in a
|
// struct grid_arrays::grid_array_pars from the info in a
|
||||||
// struct patch_info and the additional information in the arguments.
|
// struct patch_info and the additional information in the arguments.
|
||||||
//
|
//
|
||||||
// The result refers to an internal static buffer in this function; the
|
// The result refers to an internal static buffer in this function; the
|
||||||
// usual caveats about lifetimes/overwriting apply.
|
// usual caveats about lifetimes/overwriting apply.
|
||||||
//
|
//
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// ghost_zone_width = Width in grid points of all ghost zones.
|
// ghost_zone_width = Width in grid points of all ghost zones.
|
||||||
// patch_extend_width = Number of grid points to extend each patch past
|
// patch_extend_width = Number of grid points to extend each patch past
|
||||||
// "just touching" so as to overlap neighboring patches.
|
// "just touching" so as to overlap neighboring patches.
|
||||||
// Thus patches overlap by
|
// Thus patches overlap by
|
||||||
// patch_overlap_width = 2*patch_extend_width + 1
|
// patch_overlap_width = 2*patch_extend_width + 1
|
||||||
// grid points. For example, with patch_extend_width == 2,
|
// grid points. For example, with patch_extend_width == 2,
|
||||||
// here are the grid points of two neighboring patches:
|
// here are the grid points of two neighboring patches:
|
||||||
// x x x x x X X
|
// x x x x x X X
|
||||||
// |
|
// |
|
||||||
// O O o o o o o
|
// O O o o o o o
|
||||||
// Here | marks the "just touching" boundary,
|
// Here | marks the "just touching" boundary,
|
||||||
// x and o the grid points before this extension,
|
// x and o the grid points before this extension,
|
||||||
// and X and O the extra grid points added by this
|
// and X and O the extra grid points added by this
|
||||||
// extension.
|
// extension.
|
||||||
// N_zones_per_right_angle = This sets the grid spacing (same in both
|
// N_zones_per_right_angle = This sets the grid spacing (same in both
|
||||||
// directions) to 90.0 / N_zones_per_right_angle.
|
// directions) to 90.0 / N_zones_per_right_angle.
|
||||||
// It's a fatal error (error_exit()) if this
|
// It's a fatal error (error_exit()) if this
|
||||||
// doesn't evenly divide the grid sizes in both
|
// doesn't evenly divide the grid sizes in both
|
||||||
// directions.
|
// directions.
|
||||||
//
|
//
|
||||||
const grid_arrays::grid_array_pars&
|
const grid_arrays::grid_array_pars&
|
||||||
patch_info::grid_array_pars(int ghost_zone_width, int patch_extend_width,
|
patch_info::grid_array_pars(int ghost_zone_width, int patch_extend_width,
|
||||||
int N_zones_per_right_angle)
|
int N_zones_per_right_angle)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
struct grid_arrays::grid_array_pars grid_array_pars_buffer;
|
struct grid_arrays::grid_array_pars grid_array_pars_buffer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// the values of min_(irho,isigma) are actually arbitrary, but for
|
// the values of min_(irho,isigma) are actually arbitrary, but for
|
||||||
// debugging convenience it's handy to have (irho,isigma) ranges map
|
// debugging convenience it's handy to have (irho,isigma) ranges map
|
||||||
// one-to-one with (rho,sigma) ranges across all patches; the assignments
|
// one-to-one with (rho,sigma) ranges across all patches; the assignments
|
||||||
// here have this property
|
// here have this property
|
||||||
//
|
//
|
||||||
const fp delta_drho_dsigma = 90.0 / fp(N_zones_per_right_angle);
|
const fp delta_drho_dsigma = 90.0 / fp(N_zones_per_right_angle);
|
||||||
grid_array_pars_buffer.min_irho
|
grid_array_pars_buffer.min_irho
|
||||||
= jtutil::round<fp>::to_integer(min_drho /delta_drho_dsigma);
|
= jtutil::round<fp>::to_integer(min_drho /delta_drho_dsigma);
|
||||||
grid_array_pars_buffer.min_isigma
|
grid_array_pars_buffer.min_isigma
|
||||||
= jtutil::round<fp>::to_integer(min_dsigma/delta_drho_dsigma);
|
= jtutil::round<fp>::to_integer(min_dsigma/delta_drho_dsigma);
|
||||||
|
|
||||||
verify_grid_spacing_ok(N_zones_per_right_angle);
|
verify_grid_spacing_ok(N_zones_per_right_angle);
|
||||||
const int N_irho_zones
|
const int N_irho_zones
|
||||||
= jtutil::round<fp>::to_integer(
|
= jtutil::round<fp>::to_integer(
|
||||||
fp(N_zones_per_right_angle) * (max_drho -min_drho ) / 90.0
|
fp(N_zones_per_right_angle) * (max_drho -min_drho ) / 90.0
|
||||||
);
|
);
|
||||||
const int N_isigma_zones
|
const int N_isigma_zones
|
||||||
= jtutil::round<fp>::to_integer(
|
= jtutil::round<fp>::to_integer(
|
||||||
fp(N_zones_per_right_angle) * (max_dsigma-min_dsigma) / 90.0
|
fp(N_zones_per_right_angle) * (max_dsigma-min_dsigma) / 90.0
|
||||||
);
|
);
|
||||||
|
|
||||||
grid_array_pars_buffer.max_irho
|
grid_array_pars_buffer.max_irho
|
||||||
= grid_array_pars_buffer.min_irho + N_irho_zones;
|
= grid_array_pars_buffer.min_irho + N_irho_zones;
|
||||||
grid_array_pars_buffer.max_isigma
|
grid_array_pars_buffer.max_isigma
|
||||||
= grid_array_pars_buffer.min_isigma + N_isigma_zones;
|
= grid_array_pars_buffer.min_isigma + N_isigma_zones;
|
||||||
|
|
||||||
grid_array_pars_buffer.min_irho -= patch_extend_width;
|
grid_array_pars_buffer.min_irho -= patch_extend_width;
|
||||||
grid_array_pars_buffer.min_isigma -= patch_extend_width;
|
grid_array_pars_buffer.min_isigma -= patch_extend_width;
|
||||||
grid_array_pars_buffer.max_irho += patch_extend_width;
|
grid_array_pars_buffer.max_irho += patch_extend_width;
|
||||||
grid_array_pars_buffer.max_isigma += patch_extend_width;
|
grid_array_pars_buffer.max_isigma += patch_extend_width;
|
||||||
|
|
||||||
grid_array_pars_buffer.min_rho_ghost_zone_width = ghost_zone_width;
|
grid_array_pars_buffer.min_rho_ghost_zone_width = ghost_zone_width;
|
||||||
grid_array_pars_buffer.max_rho_ghost_zone_width = ghost_zone_width;
|
grid_array_pars_buffer.max_rho_ghost_zone_width = ghost_zone_width;
|
||||||
grid_array_pars_buffer.min_sigma_ghost_zone_width = ghost_zone_width;
|
grid_array_pars_buffer.min_sigma_ghost_zone_width = ghost_zone_width;
|
||||||
grid_array_pars_buffer.max_sigma_ghost_zone_width = ghost_zone_width;
|
grid_array_pars_buffer.max_sigma_ghost_zone_width = ghost_zone_width;
|
||||||
|
|
||||||
return grid_array_pars_buffer;
|
return grid_array_pars_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// This function computes, and returns a reference to, a
|
// This function computes, and returns a reference to, a
|
||||||
// struct grid_arrays::grid_pars from the info in a struct patch_info
|
// struct grid_arrays::grid_pars from the info in a struct patch_info
|
||||||
// and the additional information in the arguments.
|
// and the additional information in the arguments.
|
||||||
//
|
//
|
||||||
// The result refers to an internal static buffer in this function; the
|
// The result refers to an internal static buffer in this function; the
|
||||||
// usual caveats about lifetimes/overwriting apply.
|
// usual caveats about lifetimes/overwriting apply.
|
||||||
//
|
//
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// patch_extend_width = Number of grid points to extend each patch past
|
// patch_extend_width = Number of grid points to extend each patch past
|
||||||
// "just touching" so as to overlap neighboring patches.
|
// "just touching" so as to overlap neighboring patches.
|
||||||
// Thus patches overlap by 2*patch_extend_width + 1 grid
|
// Thus patches overlap by 2*patch_extend_width + 1 grid
|
||||||
// points. For example, with patch_extend_width == 2, here
|
// points. For example, with patch_extend_width == 2, here
|
||||||
// are the grid points of two neighboring patches:
|
// are the grid points of two neighboring patches:
|
||||||
// x x x x x X X
|
// x x x x x X X
|
||||||
// |
|
// |
|
||||||
// O O o o o o o
|
// O O o o o o o
|
||||||
// Here | marks the "just touching" boundary,
|
// Here | marks the "just touching" boundary,
|
||||||
// x and o the grid points before this extension,
|
// x and o the grid points before this extension,
|
||||||
// and X and O the extra grid points added by this
|
// and X and O the extra grid points added by this
|
||||||
// extension.
|
// extension.
|
||||||
// N_zones_per_right_angle = This sets the grid spacing (same in both
|
// N_zones_per_right_angle = This sets the grid spacing (same in both
|
||||||
// directions) to 90.0 / N_zones_per_right_angle.
|
// directions) to 90.0 / N_zones_per_right_angle.
|
||||||
// It's a fatal error (error_exit()) if this
|
// It's a fatal error (error_exit()) if this
|
||||||
// doesn't evenly divide the grid sizes in both
|
// doesn't evenly divide the grid sizes in both
|
||||||
// directions.
|
// directions.
|
||||||
//
|
//
|
||||||
const grid::grid_pars& patch_info::grid_pars(int patch_extend_width,
|
const grid::grid_pars& patch_info::grid_pars(int patch_extend_width,
|
||||||
int N_zones_per_right_angle)
|
int N_zones_per_right_angle)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
static
|
static
|
||||||
struct grid::grid_pars grid_pars_buffer;
|
struct grid::grid_pars grid_pars_buffer;
|
||||||
|
|
||||||
verify_grid_spacing_ok(N_zones_per_right_angle);
|
verify_grid_spacing_ok(N_zones_per_right_angle);
|
||||||
const fp delta_drho_dsigma = 90.0 / fp(N_zones_per_right_angle);
|
const fp delta_drho_dsigma = 90.0 / fp(N_zones_per_right_angle);
|
||||||
const fp extend_drho_dsigma = fp(patch_extend_width) * delta_drho_dsigma;
|
const fp extend_drho_dsigma = fp(patch_extend_width) * delta_drho_dsigma;
|
||||||
|
|
||||||
grid_pars_buffer. min_drho = min_drho - extend_drho_dsigma;
|
grid_pars_buffer. min_drho = min_drho - extend_drho_dsigma;
|
||||||
grid_pars_buffer.delta_drho = delta_drho_dsigma;
|
grid_pars_buffer.delta_drho = delta_drho_dsigma;
|
||||||
grid_pars_buffer. max_drho = max_drho + extend_drho_dsigma;
|
grid_pars_buffer. max_drho = max_drho + extend_drho_dsigma;
|
||||||
grid_pars_buffer. min_dsigma = min_dsigma - extend_drho_dsigma;
|
grid_pars_buffer. min_dsigma = min_dsigma - extend_drho_dsigma;
|
||||||
grid_pars_buffer.delta_dsigma = delta_drho_dsigma;
|
grid_pars_buffer.delta_dsigma = delta_drho_dsigma;
|
||||||
grid_pars_buffer. max_dsigma = max_dsigma + extend_drho_dsigma;
|
grid_pars_buffer. max_dsigma = max_dsigma + extend_drho_dsigma;
|
||||||
|
|
||||||
return grid_pars_buffer;
|
return grid_pars_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function verifies that the grid spacing evenly divides the
|
// This function verifies that the grid spacing evenly divides the
|
||||||
// grid sizes in both directions, and does an error_exit() if not.
|
// grid sizes in both directions, and does an error_exit() if not.
|
||||||
//
|
//
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// N_zones_per_right_angle = This sets the grid spacing (same in both
|
// N_zones_per_right_angle = This sets the grid spacing (same in both
|
||||||
// directions) to 90.0 / N_zones_per_right_angle.
|
// directions) to 90.0 / N_zones_per_right_angle.
|
||||||
//
|
//
|
||||||
void patch_info::verify_grid_spacing_ok(int N_zones_per_right_angle)
|
void patch_info::verify_grid_spacing_ok(int N_zones_per_right_angle)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
const fp N_irho_zones_fp
|
const fp N_irho_zones_fp
|
||||||
= fp(N_zones_per_right_angle) * (max_drho -min_drho ) / 90.0;
|
= fp(N_zones_per_right_angle) * (max_drho -min_drho ) / 90.0;
|
||||||
const fp N_isigma_zones_fp
|
const fp N_isigma_zones_fp
|
||||||
= fp(N_zones_per_right_angle) * (max_dsigma-min_dsigma) / 90.0;
|
= fp(N_zones_per_right_angle) * (max_dsigma-min_dsigma) / 90.0;
|
||||||
|
|
||||||
if (! ( jtutil::fuzzy<fp>::is_integer(N_irho_zones_fp)
|
if (! ( jtutil::fuzzy<fp>::is_integer(N_irho_zones_fp)
|
||||||
&& jtutil::fuzzy<fp>::is_integer(N_isigma_zones_fp) ) )
|
&& jtutil::fuzzy<fp>::is_integer(N_isigma_zones_fp) ) )
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** patch_info::verify_grid_spacing_ok():\n"
|
"***** patch_info::verify_grid_spacing_ok():\n"
|
||||||
" N_zones_per_right_angle=%d gives grid spacing which\n"
|
" N_zones_per_right_angle=%d gives grid spacing which\n"
|
||||||
" doesn't evenly divide grid sizes!\n"
|
" doesn't evenly divide grid sizes!\n"
|
||||||
" [min,max]_drho=[%g,%g] [min,max]_dsigma=[%g,%g]\n"
|
" [min,max]_drho=[%g,%g] [min,max]_dsigma=[%g,%g]\n"
|
||||||
" ==> N_irho_zones_fp=%g N_isigma_zones_fp=%g\n"
|
" ==> N_irho_zones_fp=%g N_isigma_zones_fp=%g\n"
|
||||||
,
|
,
|
||||||
N_zones_per_right_angle,
|
N_zones_per_right_angle,
|
||||||
double(min_drho), double(max_drho),
|
double(min_drho), double(max_drho),
|
||||||
double(min_dsigma), double(max_dsigma),
|
double(min_dsigma), double(max_dsigma),
|
||||||
double(N_irho_zones_fp), double(N_isigma_zones_fp));
|
double(N_irho_zones_fp), double(N_isigma_zones_fp));
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,70 +1,70 @@
|
|||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This (POD, and hence static-initializable) struct gives a minimal
|
// This (POD, and hence static-initializable) struct gives a minimal
|
||||||
// set of information which varies from one patch to another.
|
// set of information which varies from one patch to another.
|
||||||
//
|
//
|
||||||
// The member functions allow computing all the grid:: constructor
|
// The member functions allow computing all the grid:: constructor
|
||||||
// arguments; with these in hand it's fairly easy to construct the
|
// arguments; with these in hand it's fairly easy to construct the
|
||||||
// patch itself. This scheme doesn't allow the most general possible
|
// patch itself. This scheme doesn't allow the most general possible
|
||||||
// type of patch (eg it constrains all ghost zones to have the same width,
|
// type of patch (eg it constrains all ghost zones to have the same width,
|
||||||
// and it requires the grid spacing to evenly divide 90 degrees), but
|
// and it requires the grid spacing to evenly divide 90 degrees), but
|
||||||
// it does cover all the cases that seem to come up in practice.
|
// it does cover all the cases that seem to come up in practice.
|
||||||
//
|
//
|
||||||
// Arguments for member functions:
|
// Arguments for member functions:
|
||||||
// ghost_zone_width = Width in grid points of all ghost zones.
|
// ghost_zone_width = Width in grid points of all ghost zones.
|
||||||
// patch_extend_width = Number of grid points to extend each patch past
|
// patch_extend_width = Number of grid points to extend each patch past
|
||||||
// "just touching" so as to overlap neighboring patches.
|
// "just touching" so as to overlap neighboring patches.
|
||||||
// Thus patches overlap by
|
// Thus patches overlap by
|
||||||
// patch_overlap_width = 2*patch_extend_width + 1
|
// patch_overlap_width = 2*patch_extend_width + 1
|
||||||
// grid points. For example, with patch_extend_width == 2,
|
// grid points. For example, with patch_extend_width == 2,
|
||||||
// here are the grid points of two neighboring patches:
|
// here are the grid points of two neighboring patches:
|
||||||
// x x x x x X X
|
// x x x x x X X
|
||||||
// |
|
// |
|
||||||
// O O o o o o o
|
// O O o o o o o
|
||||||
// Here | marks the "just touching" boundary,
|
// Here | marks the "just touching" boundary,
|
||||||
// x and o the grid points before this extension,
|
// x and o the grid points before this extension,
|
||||||
// and X and O the extra grid points added by this
|
// and X and O the extra grid points added by this
|
||||||
// extension.
|
// extension.
|
||||||
// N_zones_per_right_angle = This sets the grid spacing (same in both
|
// N_zones_per_right_angle = This sets the grid spacing (same in both
|
||||||
// directions) to 90.0 / N_zones_per_right_angle.
|
// directions) to 90.0 / N_zones_per_right_angle.
|
||||||
// It's a fatal error (error_exit()) if this
|
// It's a fatal error (error_exit()) if this
|
||||||
// doesn't evenly divide the grid sizes in both
|
// doesn't evenly divide the grid sizes in both
|
||||||
// directions.
|
// directions.
|
||||||
//
|
//
|
||||||
struct patch_info
|
struct patch_info
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
bool is_plus;
|
bool is_plus;
|
||||||
char ctype;
|
char ctype;
|
||||||
fp min_drho, max_drho;
|
fp min_drho, max_drho;
|
||||||
fp min_dsigma, max_dsigma;
|
fp min_dsigma, max_dsigma;
|
||||||
|
|
||||||
// compute and return reference to struct grid_arrays::grid_array_pars
|
// compute and return reference to struct grid_arrays::grid_array_pars
|
||||||
// ... result refers to internal static buffer;
|
// ... result refers to internal static buffer;
|
||||||
// the usual caveats about lifetimes/overwriting apply
|
// the usual caveats about lifetimes/overwriting apply
|
||||||
const grid_arrays::grid_array_pars &
|
const grid_arrays::grid_array_pars &
|
||||||
grid_array_pars(int ghost_zone_width, int patch_extend_width,
|
grid_array_pars(int ghost_zone_width, int patch_extend_width,
|
||||||
int N_zones_per_right_angle)
|
int N_zones_per_right_angle)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
// compute and return reference to struct grid::grid_pars
|
// compute and return reference to struct grid::grid_pars
|
||||||
// ... result refers to internal static buffer;
|
// ... result refers to internal static buffer;
|
||||||
// the usual caveats about lifetimes/overwriting apply
|
// the usual caveats about lifetimes/overwriting apply
|
||||||
const grid::grid_pars &grid_pars(int patch_extend_width,
|
const grid::grid_pars &grid_pars(int patch_extend_width,
|
||||||
int N_zones_per_right_angle)
|
int N_zones_per_right_angle)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// verify that grid spacing evenly divides grid sizes
|
// verify that grid spacing evenly divides grid sizes
|
||||||
// in both directions; no-op if ok, error_exit() if not ok
|
// in both directions; no-op if ok, error_exit() if not ok
|
||||||
void verify_grid_spacing_ok(int N_zones_per_right_angle)
|
void verify_grid_spacing_ok(int N_zones_per_right_angle)
|
||||||
const;
|
const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,360 +1,360 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "util_Table.h"
|
#include "util_Table.h"
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "fd_grid.h"
|
#include "fd_grid.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
#include "patch_edge.h"
|
#include "patch_edge.h"
|
||||||
#include "patch_interp.h"
|
#include "patch_interp.h"
|
||||||
#include "ghost_zone.h"
|
#include "ghost_zone.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
int lagrange_interp(double coor_orin, double dx, double *gf,
|
int lagrange_interp(double coor_orin, double dx, double *gf,
|
||||||
int PTS, double ipx, double *out, int *mposn, double *Jac,
|
int PTS, double ipx, double *out, int *mposn, double *Jac,
|
||||||
int ORD) // ORD-1 order lagrange interpolation
|
int ORD) // ORD-1 order lagrange interpolation
|
||||||
{
|
{
|
||||||
assert(PTS >= ORD);
|
assert(PTS >= ORD);
|
||||||
int mi, mf;
|
int mi, mf;
|
||||||
|
|
||||||
double *L, *x;
|
double *L, *x;
|
||||||
L = new double[PTS];
|
L = new double[PTS];
|
||||||
x = new double[PTS];
|
x = new double[PTS];
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
//-- Determine molecular range
|
//-- Determine molecular range
|
||||||
// for odd points, say 5, the molecular is
|
// for odd points, say 5, the molecular is
|
||||||
// |
|
// |
|
||||||
// +-----+---x-+-----+-----+
|
// +-----+---x-+-----+-----+
|
||||||
//
|
//
|
||||||
mi = jtutil::round<double>::ceiling((ipx - coor_orin) / dx) - ORD / 2;
|
mi = jtutil::round<double>::ceiling((ipx - coor_orin) / dx) - ORD / 2;
|
||||||
mf = mi + ORD;
|
mf = mi + ORD;
|
||||||
if (mi < 0)
|
if (mi < 0)
|
||||||
{
|
{
|
||||||
mi = 0;
|
mi = 0;
|
||||||
mf = ORD;
|
mf = ORD;
|
||||||
}
|
}
|
||||||
else if (mf > PTS)
|
else if (mf > PTS)
|
||||||
{
|
{
|
||||||
mf = PTS;
|
mf = PTS;
|
||||||
mi = PTS - ORD;
|
mi = PTS - ORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-- Setup coordinate by input origin, dx
|
//-- Setup coordinate by input origin, dx
|
||||||
for (j = mi; j < mf; j++)
|
for (j = mi; j < mf; j++)
|
||||||
x[j] = coor_orin + j * dx;
|
x[j] = coor_orin + j * dx;
|
||||||
|
|
||||||
//-- Lagrange basis function
|
//-- Lagrange basis function
|
||||||
*out = 0;
|
*out = 0;
|
||||||
for (i = mi; i < mf; i++)
|
for (i = mi; i < mf; i++)
|
||||||
{
|
{
|
||||||
L[i] = 1.0;
|
L[i] = 1.0;
|
||||||
for (k = mi; k < mf; k++)
|
for (k = mi; k < mf; k++)
|
||||||
if (k != i)
|
if (k != i)
|
||||||
{
|
{
|
||||||
L[i] *= (ipx - x[k]) / (x[i] - x[k]);
|
L[i] *= (ipx - x[k]) / (x[i] - x[k]);
|
||||||
}
|
}
|
||||||
*out += *(gf + i) * L[i];
|
*out += *(gf + i) * L[i];
|
||||||
*Jac = L[i];
|
*Jac = L[i];
|
||||||
Jac++;
|
Jac++;
|
||||||
}
|
}
|
||||||
|
|
||||||
*mposn = mi;
|
*mposn = mi;
|
||||||
|
|
||||||
delete[] L;
|
delete[] L;
|
||||||
delete[] x;
|
delete[] x;
|
||||||
|
|
||||||
return 0; // Normal retrun
|
return 0; // Normal retrun
|
||||||
}
|
}
|
||||||
|
|
||||||
using jtutil::error_exit;
|
using jtutil::error_exit;
|
||||||
|
|
||||||
patch_interp::patch_interp(const patch_edge &my_edge_in,
|
patch_interp::patch_interp(const patch_edge &my_edge_in,
|
||||||
int min_iperp_in, int max_iperp_in,
|
int min_iperp_in, int max_iperp_in,
|
||||||
const jtutil::array1d<int> &min_parindex_array_in,
|
const jtutil::array1d<int> &min_parindex_array_in,
|
||||||
const jtutil::array1d<int> &max_parindex_array_in,
|
const jtutil::array1d<int> &max_parindex_array_in,
|
||||||
const jtutil::array2d<fp> &interp_par_in,
|
const jtutil::array2d<fp> &interp_par_in,
|
||||||
bool ok_to_use_min_par_ghost_zone,
|
bool ok_to_use_min_par_ghost_zone,
|
||||||
bool ok_to_use_max_par_ghost_zone,
|
bool ok_to_use_max_par_ghost_zone,
|
||||||
int interp_handle_in, int interp_par_table_handle_in)
|
int interp_handle_in, int interp_par_table_handle_in)
|
||||||
: my_patch_(my_edge_in.my_patch()),
|
: my_patch_(my_edge_in.my_patch()),
|
||||||
my_edge_(my_edge_in),
|
my_edge_(my_edge_in),
|
||||||
min_gfn_(my_patch().ghosted_min_gfn()),
|
min_gfn_(my_patch().ghosted_min_gfn()),
|
||||||
max_gfn_(my_patch().ghosted_max_gfn()),
|
max_gfn_(my_patch().ghosted_max_gfn()),
|
||||||
ok_to_use_min_par_ghost_zone_(ok_to_use_min_par_ghost_zone),
|
ok_to_use_min_par_ghost_zone_(ok_to_use_min_par_ghost_zone),
|
||||||
ok_to_use_max_par_ghost_zone_(ok_to_use_max_par_ghost_zone),
|
ok_to_use_max_par_ghost_zone_(ok_to_use_max_par_ghost_zone),
|
||||||
min_iperp_(min_iperp_in), max_iperp_(max_iperp_in),
|
min_iperp_(min_iperp_in), max_iperp_(max_iperp_in),
|
||||||
min_ipar_(ok_to_use_min_par_ghost_zone
|
min_ipar_(ok_to_use_min_par_ghost_zone
|
||||||
? my_edge_in.min_ipar_with_corners()
|
? my_edge_in.min_ipar_with_corners()
|
||||||
: my_edge_in.min_ipar_without_corners()),
|
: my_edge_in.min_ipar_without_corners()),
|
||||||
max_ipar_(ok_to_use_max_par_ghost_zone
|
max_ipar_(ok_to_use_max_par_ghost_zone
|
||||||
? my_edge_in.max_ipar_with_corners()
|
? my_edge_in.max_ipar_with_corners()
|
||||||
: my_edge_in.max_ipar_without_corners()),
|
: my_edge_in.max_ipar_without_corners()),
|
||||||
min_parindex_array_(min_parindex_array_in),
|
min_parindex_array_(min_parindex_array_in),
|
||||||
max_parindex_array_(max_parindex_array_in),
|
max_parindex_array_(max_parindex_array_in),
|
||||||
interp_par_(interp_par_in),
|
interp_par_(interp_par_in),
|
||||||
interp_handle_(interp_handle_in),
|
interp_handle_(interp_handle_in),
|
||||||
interp_par_table_handle_(1),
|
interp_par_table_handle_(1),
|
||||||
gridfn_coord_origin_(my_edge().par_map().fp_of_int(min_ipar_)),
|
gridfn_coord_origin_(my_edge().par_map().fp_of_int(min_ipar_)),
|
||||||
gridfn_coord_delta_(my_edge().par_map().delta_fp()),
|
gridfn_coord_delta_(my_edge().par_map().delta_fp()),
|
||||||
gridfn_data_ptrs_(min_gfn_, max_gfn_),
|
gridfn_data_ptrs_(min_gfn_, max_gfn_),
|
||||||
interp_data_buffer_ptrs_(min_gfn_, max_gfn_) // no comma
|
interp_data_buffer_ptrs_(min_gfn_, max_gfn_) // no comma
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
const CCTK_INT stride = my_edge().ghosted_par_stride();
|
const CCTK_INT stride = my_edge().ghosted_par_stride();
|
||||||
|
|
||||||
status = 0;
|
status = 0;
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** patch_interp::patch_interp():\n"
|
"***** patch_interp::patch_interp():\n"
|
||||||
" can't set gridfn stride in interpolator parmameter table!\n"
|
" can't set gridfn stride in interpolator parmameter table!\n"
|
||||||
" error status=%d\n",
|
" error status=%d\n",
|
||||||
status); /*NOTREACHED*/
|
status); /*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
patch_interp::~patch_interp()
|
patch_interp::~patch_interp()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void patch_interp::interpolate(int ghosted_min_gfn_to_interp,
|
void patch_interp::interpolate(int ghosted_min_gfn_to_interp,
|
||||||
int ghosted_max_gfn_to_interp,
|
int ghosted_max_gfn_to_interp,
|
||||||
jtutil::array3d<fp> &data_buffer,
|
jtutil::array3d<fp> &data_buffer,
|
||||||
jtutil::array2d<CCTK_INT> &posn_buffer,
|
jtutil::array2d<CCTK_INT> &posn_buffer,
|
||||||
jtutil::array3d<fp> &Jacobian_buffer)
|
jtutil::array3d<fp> &Jacobian_buffer)
|
||||||
const
|
const
|
||||||
|
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
const int N_dims = 1;
|
const int N_dims = 1;
|
||||||
const int N_gridfns = jtutil::how_many_in_range(ghosted_min_gfn_to_interp,
|
const int N_gridfns = jtutil::how_many_in_range(ghosted_min_gfn_to_interp,
|
||||||
ghosted_max_gfn_to_interp);
|
ghosted_max_gfn_to_interp);
|
||||||
const CCTK_INT N_gridfn_data_points = jtutil::how_many_in_range(min_ipar(), max_ipar());
|
const CCTK_INT N_gridfn_data_points = jtutil::how_many_in_range(min_ipar(), max_ipar());
|
||||||
|
|
||||||
//-- Jacobian
|
//-- Jacobian
|
||||||
const int Jacobian_interp_point_stride = Jacobian_buffer.subscript_stride_j();
|
const int Jacobian_interp_point_stride = Jacobian_buffer.subscript_stride_j();
|
||||||
|
|
||||||
//
|
//
|
||||||
// do the interpolations at each iperp
|
// do the interpolations at each iperp
|
||||||
//
|
//
|
||||||
for (int iperp = min_iperp(); iperp <= max_iperp(); ++iperp)
|
for (int iperp = min_iperp(); iperp <= max_iperp(); ++iperp)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// interpolation-point coordinates
|
// interpolation-point coordinates
|
||||||
//
|
//
|
||||||
const int min_parindex = min_parindex_array_(iperp);
|
const int min_parindex = min_parindex_array_(iperp);
|
||||||
const int max_parindex = max_parindex_array_(iperp);
|
const int max_parindex = max_parindex_array_(iperp);
|
||||||
const CCTK_INT N_interp_points = jtutil::how_many_in_range(min_parindex, max_parindex);
|
const CCTK_INT N_interp_points = jtutil::how_many_in_range(min_parindex, max_parindex);
|
||||||
const fp *const interp_coords_ptr = &interp_par_(iperp, min_parindex);
|
const fp *const interp_coords_ptr = &interp_par_(iperp, min_parindex);
|
||||||
const void *const interp_coords[N_dims] = {static_cast<const void *>(interp_coords_ptr)};
|
const void *const interp_coords[N_dims] = {static_cast<const void *>(interp_coords_ptr)};
|
||||||
|
|
||||||
//
|
//
|
||||||
// pointers to gridfn data to interpolate, and to result buffer
|
// pointers to gridfn data to interpolate, and to result buffer
|
||||||
//
|
//
|
||||||
for (int ghosted_gfn = ghosted_min_gfn_to_interp;
|
for (int ghosted_gfn = ghosted_min_gfn_to_interp;
|
||||||
ghosted_gfn <= ghosted_max_gfn_to_interp;
|
ghosted_gfn <= ghosted_max_gfn_to_interp;
|
||||||
++ghosted_gfn)
|
++ghosted_gfn)
|
||||||
{
|
{
|
||||||
// set up data pointer to --> (iperp,min_ipar) gridfn
|
// set up data pointer to --> (iperp,min_ipar) gridfn
|
||||||
const int start_irho = my_edge().irho_of_iperp_ipar(iperp, min_ipar());
|
const int start_irho = my_edge().irho_of_iperp_ipar(iperp, min_ipar());
|
||||||
const int start_isigma = my_edge().isigma_of_iperp_ipar(iperp, min_ipar());
|
const int start_isigma = my_edge().isigma_of_iperp_ipar(iperp, min_ipar());
|
||||||
gridfn_data_ptrs_(ghosted_gfn) = static_cast<const void *>(
|
gridfn_data_ptrs_(ghosted_gfn) = static_cast<const void *>(
|
||||||
&my_patch()
|
&my_patch()
|
||||||
.ghosted_gridfn(ghosted_gfn,
|
.ghosted_gridfn(ghosted_gfn,
|
||||||
start_irho, start_isigma));
|
start_irho, start_isigma));
|
||||||
interp_data_buffer_ptrs_(ghosted_gfn) = static_cast<void *>(
|
interp_data_buffer_ptrs_(ghosted_gfn) = static_cast<void *>(
|
||||||
&data_buffer(ghosted_gfn, iperp, min_parindex));
|
&data_buffer(ghosted_gfn, iperp, min_parindex));
|
||||||
}
|
}
|
||||||
const void *const *const gridfn_data = &gridfn_data_ptrs_(ghosted_min_gfn_to_interp);
|
const void *const *const gridfn_data = &gridfn_data_ptrs_(ghosted_min_gfn_to_interp);
|
||||||
void *const *const interp_buffer = &interp_data_buffer_ptrs_(ghosted_min_gfn_to_interp);
|
void *const *const interp_buffer = &interp_data_buffer_ptrs_(ghosted_min_gfn_to_interp);
|
||||||
|
|
||||||
//-- molecule position
|
//-- molecule position
|
||||||
CCTK_POINTER molecule_posn_ptrs[N_dims] = {static_cast<CCTK_POINTER>(&posn_buffer(iperp, min_parindex))};
|
CCTK_POINTER molecule_posn_ptrs[N_dims] = {static_cast<CCTK_POINTER>(&posn_buffer(iperp, min_parindex))};
|
||||||
//-- Jacobian
|
//-- Jacobian
|
||||||
CCTK_POINTER const Jacobian_ptrs[1] //[N_gridfns]
|
CCTK_POINTER const Jacobian_ptrs[1] //[N_gridfns]
|
||||||
= {static_cast<CCTK_POINTER>(
|
= {static_cast<CCTK_POINTER>(
|
||||||
&Jacobian_buffer(iperp, min_parindex, 0))};
|
&Jacobian_buffer(iperp, min_parindex, 0))};
|
||||||
// Jacobian_buffer has continuous memory allocation.
|
// Jacobian_buffer has continuous memory allocation.
|
||||||
|
|
||||||
const CCTK_INT stride = my_edge().ghosted_par_stride();
|
const CCTK_INT stride = my_edge().ghosted_par_stride();
|
||||||
double y[N_gridfn_data_points];
|
double y[N_gridfn_data_points];
|
||||||
|
|
||||||
for (int i = 0; i < N_gridfn_data_points; i++)
|
for (int i = 0; i < N_gridfn_data_points; i++)
|
||||||
{
|
{
|
||||||
y[i] = *((double *)(*gridfn_data) + stride * i);
|
y[i] = *((double *)(*gridfn_data) + stride * i);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int ORD = 6;
|
const int ORD = 6;
|
||||||
double Jac[ORD];
|
double Jac[ORD];
|
||||||
int posn; // of molecular, starting from 0
|
int posn; // of molecular, starting from 0
|
||||||
for (int i = 0; i < N_interp_points; i++)
|
for (int i = 0; i < N_interp_points; i++)
|
||||||
{
|
{
|
||||||
status = lagrange_interp(gridfn_coord_origin_, gridfn_coord_delta_,
|
status = lagrange_interp(gridfn_coord_origin_, gridfn_coord_delta_,
|
||||||
y, N_gridfn_data_points,
|
y, N_gridfn_data_points,
|
||||||
*((double *)interp_coords[0] + i), ((double *)(*interp_buffer) + i),
|
*((double *)interp_coords[0] + i), ((double *)(*interp_buffer) + i),
|
||||||
&posn, Jac, ORD);
|
&posn, Jac, ORD);
|
||||||
|
|
||||||
*((int *)molecule_posn_ptrs[0] + i) = posn + 2;
|
*((int *)molecule_posn_ptrs[0] + i) = posn + 2;
|
||||||
|
|
||||||
memcpy((double *)(Jacobian_ptrs[0]) + Jacobian_buffer.min_k() +
|
memcpy((double *)(Jacobian_ptrs[0]) + Jacobian_buffer.min_k() +
|
||||||
Jacobian_interp_point_stride * i,
|
Jacobian_interp_point_stride * i,
|
||||||
Jac, sizeof(Jac));
|
Jac, sizeof(Jac));
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert the molecule positions from parindex-min_ipar
|
// convert the molecule positions from parindex-min_ipar
|
||||||
// to parindex values (again, cf comments on array subscripting
|
// to parindex values (again, cf comments on array subscripting
|
||||||
// at the start of "patch_interp.hh")
|
// at the start of "patch_interp.hh")
|
||||||
for (int parindex = min_parindex;
|
for (int parindex = min_parindex;
|
||||||
parindex <= max_parindex;
|
parindex <= max_parindex;
|
||||||
++parindex)
|
++parindex)
|
||||||
{
|
{
|
||||||
posn_buffer(iperp, parindex) += min_ipar();
|
posn_buffer(iperp, parindex) += min_ipar();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** patch_interp::interpolate():\n"
|
"***** patch_interp::interpolate():\n"
|
||||||
" error return %d from interpolator at iperp=%d of [%d,%d]!\n"
|
" error return %d from interpolator at iperp=%d of [%d,%d]!\n"
|
||||||
" my_patch()=\"%s\" my_edge()=\"%s\"\n",
|
" my_patch()=\"%s\" my_edge()=\"%s\"\n",
|
||||||
status, iperp, min_iperp(), max_iperp(),
|
status, iperp, min_iperp(), max_iperp(),
|
||||||
my_patch().name(), my_edge().name()); /*NOTREACHED*/
|
my_patch().name(), my_edge().name()); /*NOTREACHED*/
|
||||||
|
|
||||||
} // end for iperp
|
} // end for iperp
|
||||||
}
|
}
|
||||||
|
|
||||||
void patch_interp::verify_Jacobian_sparsity_pattern_ok()
|
void patch_interp::verify_Jacobian_sparsity_pattern_ok()
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
CCTK_INT MSS_is_fn_of_interp_coords = 0, MSS_is_fn_of_input_array_values = 0;
|
CCTK_INT MSS_is_fn_of_interp_coords = 0, MSS_is_fn_of_input_array_values = 0;
|
||||||
CCTK_INT Jacobian_is_fn_of_input_array_values = 0;
|
CCTK_INT Jacobian_is_fn_of_input_array_values = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// verify that we grok the Jacobian sparsity pattern
|
// verify that we grok the Jacobian sparsity pattern
|
||||||
//
|
//
|
||||||
if (MSS_is_fn_of_interp_coords || MSS_is_fn_of_input_array_values || Jacobian_is_fn_of_input_array_values)
|
if (MSS_is_fn_of_interp_coords || MSS_is_fn_of_input_array_values || Jacobian_is_fn_of_input_array_values)
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** patch_interp::verify_Jacobian_sparsity_pattern_ok():\n"
|
"***** patch_interp::verify_Jacobian_sparsity_pattern_ok():\n"
|
||||||
" implementation restriction: we only grok Jacobians with\n"
|
" implementation restriction: we only grok Jacobians with\n"
|
||||||
" fixed-sized hypercube-shaped molecules, independent of\n"
|
" fixed-sized hypercube-shaped molecules, independent of\n"
|
||||||
" the interpolation coordinates and the floating-point values!\n"
|
" the interpolation coordinates and the floating-point values!\n"
|
||||||
" MSS_is_fn_of_interp_coords=(int)%d (we only grok 0)\n"
|
" MSS_is_fn_of_interp_coords=(int)%d (we only grok 0)\n"
|
||||||
" MSS_is_fn_of_input_array_values=(int)%d (we only grok 0)\n"
|
" MSS_is_fn_of_input_array_values=(int)%d (we only grok 0)\n"
|
||||||
" Jacobian_is_fn_of_input_array_values=(int)%d (we only grok 0)\n",
|
" Jacobian_is_fn_of_input_array_values=(int)%d (we only grok 0)\n",
|
||||||
MSS_is_fn_of_interp_coords,
|
MSS_is_fn_of_interp_coords,
|
||||||
MSS_is_fn_of_input_array_values,
|
MSS_is_fn_of_input_array_values,
|
||||||
Jacobian_is_fn_of_input_array_values);
|
Jacobian_is_fn_of_input_array_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function queries the interpolator to get the [min,max] ipar m
|
// This function queries the interpolator to get the [min,max] ipar m
|
||||||
// coordinates of the interpolation molecules.
|
// coordinates of the interpolation molecules.
|
||||||
//
|
//
|
||||||
// (This API implicitly assumes that the Jacobian sparsity is one which
|
// (This API implicitly assumes that the Jacobian sparsity is one which
|
||||||
// is "ok" as verified by verify_Jacobian_sparsity_pattern_ok() .)
|
// is "ok" as verified by verify_Jacobian_sparsity_pattern_ok() .)
|
||||||
//
|
//
|
||||||
void patch_interp::molecule_minmax_ipar_m(int &min_ipar_m, int &max_ipar_m)
|
void patch_interp::molecule_minmax_ipar_m(int &min_ipar_m, int &max_ipar_m)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
min_ipar_m = -2;
|
min_ipar_m = -2;
|
||||||
max_ipar_m = 3;
|
max_ipar_m = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function queries the interpolator at each iperp to find out the
|
// This function queries the interpolator at each iperp to find out the
|
||||||
// molecule ipar positions (which we implicitly assume to be independent
|
// molecule ipar positions (which we implicitly assume to be independent
|
||||||
// of ghosted_gfn), and stores these in posn_buffer(iperp, parindex) .
|
// of ghosted_gfn), and stores these in posn_buffer(iperp, parindex) .
|
||||||
//
|
//
|
||||||
// (This API implicitly assumes that the Jacobian sparsity is one which
|
// (This API implicitly assumes that the Jacobian sparsity is one which
|
||||||
// is "ok" as verified by verify_Jacobian_sparsity_pattern_ok() .)
|
// is "ok" as verified by verify_Jacobian_sparsity_pattern_ok() .)
|
||||||
//
|
//
|
||||||
void patch_interp::molecule_posn(jtutil::array2d<CCTK_INT> &posn_buffer)
|
void patch_interp::molecule_posn(jtutil::array2d<CCTK_INT> &posn_buffer)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
const int N_dims = 1;
|
const int N_dims = 1;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
for (int iperp = min_iperp(); iperp <= max_iperp(); ++iperp)
|
for (int iperp = min_iperp(); iperp <= max_iperp(); ++iperp)
|
||||||
{
|
{
|
||||||
const int min_parindex = min_parindex_array_(iperp);
|
const int min_parindex = min_parindex_array_(iperp);
|
||||||
const int max_parindex = max_parindex_array_(iperp);
|
const int max_parindex = max_parindex_array_(iperp);
|
||||||
|
|
||||||
// set up the molecule-position query in the parameter table
|
// set up the molecule-position query in the parameter table
|
||||||
CCTK_POINTER molecule_posn_ptrs[N_dims] = {static_cast<CCTK_POINTER>(&posn_buffer(iperp, min_parindex))};
|
CCTK_POINTER molecule_posn_ptrs[N_dims] = {static_cast<CCTK_POINTER>(&posn_buffer(iperp, min_parindex))};
|
||||||
status = 0; // Util_TableSetPointerArray(interp_par_table_handle_, N_dims,
|
status = 0; // Util_TableSetPointerArray(interp_par_table_handle_, N_dims,
|
||||||
// molecule_posn_ptrs, "molecule_positions");
|
// molecule_posn_ptrs, "molecule_positions");
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** patch_interp::molecule_posn():\n"
|
"***** patch_interp::molecule_posn():\n"
|
||||||
" can't set molecule position query\n"
|
" can't set molecule position query\n"
|
||||||
" in interpolator parmameter table at iperp=%d of [%d,%d]!\n"
|
" in interpolator parmameter table at iperp=%d of [%d,%d]!\n"
|
||||||
" error status=%d\n",
|
" error status=%d\n",
|
||||||
iperp, min_iperp(), max_iperp(),
|
iperp, min_iperp(), max_iperp(),
|
||||||
status); /*NOTREACHED*/
|
status); /*NOTREACHED*/
|
||||||
|
|
||||||
for (int parindex = min_parindex;
|
for (int parindex = min_parindex;
|
||||||
parindex <= max_parindex;
|
parindex <= max_parindex;
|
||||||
++parindex)
|
++parindex)
|
||||||
{
|
{
|
||||||
posn_buffer(iperp, parindex) += min_ipar();
|
posn_buffer(iperp, parindex) += min_ipar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void patch_interp::Jacobian(jtutil::array3d<fp> &Jacobian_buffer)
|
void patch_interp::Jacobian(jtutil::array3d<fp> &Jacobian_buffer)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
const int N_dims = 1;
|
const int N_dims = 1;
|
||||||
const int N_gridfns = 1;
|
const int N_gridfns = 1;
|
||||||
|
|
||||||
int status1, status2;
|
int status1, status2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// set Jacobian stride info in parameter table
|
// set Jacobian stride info in parameter table
|
||||||
//
|
//
|
||||||
const int Jacobian_interp_point_stride = Jacobian_buffer.subscript_stride_j();
|
const int Jacobian_interp_point_stride = Jacobian_buffer.subscript_stride_j();
|
||||||
|
|
||||||
status1 = 0;
|
status1 = 0;
|
||||||
|
|
||||||
status2 = 0;
|
status2 = 0;
|
||||||
|
|
||||||
if ((status1 < 0) || (status2 < 0))
|
if ((status1 < 0) || (status2 < 0))
|
||||||
then error_exit(ERROR_EXIT,
|
then error_exit(ERROR_EXIT,
|
||||||
"***** patch_interp::Jacobian():\n"
|
"***** patch_interp::Jacobian():\n"
|
||||||
" can't set Jacobian stride info in interpolator parmameter table!\n"
|
" can't set Jacobian stride info in interpolator parmameter table!\n"
|
||||||
" error status1=%d status2=%d\n",
|
" error status1=%d status2=%d\n",
|
||||||
status1, status2);
|
status1, status2);
|
||||||
|
|
||||||
//
|
//
|
||||||
// query the Jacobians at each iperp
|
// query the Jacobians at each iperp
|
||||||
//
|
//
|
||||||
for (int iperp = min_iperp(); iperp <= max_iperp(); ++iperp)
|
for (int iperp = min_iperp(); iperp <= max_iperp(); ++iperp)
|
||||||
{
|
{
|
||||||
const int min_parindex = min_parindex_array_(iperp);
|
const int min_parindex = min_parindex_array_(iperp);
|
||||||
const int max_parindex = max_parindex_array_(iperp);
|
const int max_parindex = max_parindex_array_(iperp);
|
||||||
|
|
||||||
//
|
//
|
||||||
// set up the Jacobian query in the parameter table
|
// set up the Jacobian query in the parameter table
|
||||||
//
|
//
|
||||||
CCTK_POINTER const Jacobian_ptrs[N_gridfns] = {static_cast<CCTK_POINTER>(
|
CCTK_POINTER const Jacobian_ptrs[N_gridfns] = {static_cast<CCTK_POINTER>(
|
||||||
&Jacobian_buffer(iperp, min_parindex, 0))};
|
&Jacobian_buffer(iperp, min_parindex, 0))};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,293 +1,293 @@
|
|||||||
#ifndef TPATCH_INTERP_H
|
#ifndef TPATCH_INTERP_H
|
||||||
#define TPATCH_INTERP_H
|
#define TPATCH_INTERP_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
// patch_interp - interpolation from a patch
|
// patch_interp - interpolation from a patch
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// A patch_interp object is responsible for interpolating gridfn data
|
// A patch_interp object is responsible for interpolating gridfn data
|
||||||
// from its owning patch for use by another patch's ghost_zone object
|
// from its owning patch for use by another patch's ghost_zone object
|
||||||
// (in setting up the gridfn in the other ghost zone). A patch_interp
|
// (in setting up the gridfn in the other ghost zone). A patch_interp
|
||||||
// object deals only in its own patch's coordinates; other code elsewhere
|
// object deals only in its own patch's coordinates; other code elsewhere
|
||||||
// (in practice in interpatch_ghost_zone::) is responsible for translating
|
// (in practice in interpatch_ghost_zone::) is responsible for translating
|
||||||
// other patch's coordinates into our coordinates.
|
// other patch's coordinates into our coordinates.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// A patch_interp defines a "patch interpolation region", the region of
|
// A patch_interp defines a "patch interpolation region", the region of
|
||||||
// its owning patch from which this interpolation will use gridfn data.
|
// its owning patch from which this interpolation will use gridfn data.
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// The way the patch coordnates are constructed, any two adjacent patches
|
// The way the patch coordnates are constructed, any two adjacent patches
|
||||||
// share a common (perpendicular) coordinate. Thus we only have to do
|
// share a common (perpendicular) coordinate. Thus we only have to do
|
||||||
// 1-dimensional interpolation here (in the parallel direction). In
|
// 1-dimensional interpolation here (in the parallel direction). In
|
||||||
// other words, for each iperp we interpolate in par.
|
// other words, for each iperp we interpolate in par.
|
||||||
//
|
//
|
||||||
// In general we interpolate each gridfn at a number of distinct par
|
// In general we interpolate each gridfn at a number of distinct par
|
||||||
// for each iperp; the integer "parindex" indexes these points. We
|
// for each iperp; the integer "parindex" indexes these points. We
|
||||||
// attach no particular semantics to parindex, and it need not be
|
// attach no particular semantics to parindex, and it need not be
|
||||||
// 0-origin or have the same range for each iperp. [In practice,
|
// 0-origin or have the same range for each iperp. [In practice,
|
||||||
// parindex will be the other patch's ipar coordinate.] However,
|
// parindex will be the other patch's ipar coordinate.] However,
|
||||||
// we assume that the range of parindex is roughly similar for each
|
// we assume that the range of parindex is roughly similar for each
|
||||||
// iperp, so it's ok to use (iperp,parindex) as a 2-D rectangular
|
// iperp, so it's ok to use (iperp,parindex) as a 2-D rectangular
|
||||||
// index space.
|
// index space.
|
||||||
//
|
//
|
||||||
// For example, we might interpolate at the points
|
// For example, we might interpolate at the points
|
||||||
// ipar ipar ipar ipar ipar ipar ipar ipar ipar
|
// ipar ipar ipar ipar ipar ipar ipar ipar ipar
|
||||||
// 1 2 3 4 5 6 7 8 9
|
// 1 2 3 4 5 6 7 8 9
|
||||||
// iperp=10 (2a) (3b) (4c)
|
// iperp=10 (2a) (3b) (4c)
|
||||||
// iperp=11 (2d) (3e) (4f) (5g)
|
// iperp=11 (2d) (3e) (4f) (5g)
|
||||||
// where the (2a)-(5g) are the interpolation points, with 2-5 being the
|
// where the (2a)-(5g) are the interpolation points, with 2-5 being the
|
||||||
// parindex values and a-g being unique identifiers used in our description
|
// parindex values and a-g being unique identifiers used in our description
|
||||||
// below. In terms of our member data, this interpolation region would
|
// below. In terms of our member data, this interpolation region would
|
||||||
// be described by
|
// be described by
|
||||||
// [min,max]_iperp_=[10,11]
|
// [min,max]_iperp_=[10,11]
|
||||||
// [min,max]_ipar_=[1,9]
|
// [min,max]_ipar_=[1,9]
|
||||||
// [min,max]_parindex_array_(10)=[2,5]
|
// [min,max]_parindex_array_(10)=[2,5]
|
||||||
// [min,max]_parindex_array_(11)=[2,6]
|
// [min,max]_parindex_array_(11)=[2,6]
|
||||||
// interp_par_(10,2) = x[a]
|
// interp_par_(10,2) = x[a]
|
||||||
// interp_par_(10,3) = x[b]
|
// interp_par_(10,3) = x[b]
|
||||||
// interp_par_(10,4) = x[c]
|
// interp_par_(10,4) = x[c]
|
||||||
// interp_par_(11,2) = x[d]
|
// interp_par_(11,2) = x[d]
|
||||||
// interp_par_(11,3) = x[e]
|
// interp_par_(11,3) = x[e]
|
||||||
// interp_par_(11,4) = x[f]
|
// interp_par_(11,4) = x[f]
|
||||||
// interp_par_(11,5) = x[g]
|
// interp_par_(11,5) = x[g]
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// We use the Cactus local interpolator CCTK_InterpLocalUniform()
|
// We use the Cactus local interpolator CCTK_InterpLocalUniform()
|
||||||
// to do the interpolation. To minimize interpolator overheads, we
|
// to do the interpolation. To minimize interpolator overheads, we
|
||||||
// interpolate all the gridfns at each iperp in a single interpolator
|
// interpolate all the gridfns at each iperp in a single interpolator
|
||||||
// call. [Different iperp values involve different sets of (1-D)
|
// call. [Different iperp values involve different sets of (1-D)
|
||||||
// gridfn data, and so inherently require distinct interpolator calls.]
|
// gridfn data, and so inherently require distinct interpolator calls.]
|
||||||
//
|
//
|
||||||
// Setting up the array subscripting for the interpolator to access
|
// Setting up the array subscripting for the interpolator to access
|
||||||
// the gridfn data is a bit tricky: The interpolator accesses the
|
// the gridfn data is a bit tricky: The interpolator accesses the
|
||||||
// gridfn data using the generic (1-D) subscripting expression
|
// gridfn data using the generic (1-D) subscripting expression
|
||||||
// data[offset + i*stride]
|
// data[offset + i*stride]
|
||||||
// where i is the data array index. However, we'd rather not use
|
// where i is the data array index. However, we'd rather not use
|
||||||
// offset , because it has to be supplied in the parameter table as
|
// offset , because it has to be supplied in the parameter table as
|
||||||
// an array subscripted by gfn , and so would require changing the
|
// an array subscripted by gfn , and so would require changing the
|
||||||
// parameter table for each call on interpolate() (with potentially
|
// parameter table for each call on interpolate() (with potentially
|
||||||
// different numbers of gridfns being interpolated). Instead, at each
|
// different numbers of gridfns being interpolated). Instead, at each
|
||||||
// iperp we use i = ipar-min_ipar , so the default offset=0 makes
|
// iperp we use i = ipar-min_ipar , so the default offset=0 makes
|
||||||
// the subscripting expression zero for ipar = min_ipar . This also
|
// the subscripting expression zero for ipar = min_ipar . This also
|
||||||
// makes the interpolator's min_i = 0 and max_i be dims-1 (both
|
// makes the interpolator's min_i = 0 and max_i be dims-1 (both
|
||||||
// the defaults), so those also don't have to be set in the parameter
|
// the defaults), so those also don't have to be set in the parameter
|
||||||
// table either. We set the interpolator's data coordinate origin to
|
// table either. We set the interpolator's data coordinate origin to
|
||||||
// the par coordinate for min_ipar , so it correctly maps i --> par .
|
// the par coordinate for min_ipar , so it correctly maps i --> par .
|
||||||
// With this strategy we can share the interpolator parameter table
|
// With this strategy we can share the interpolator parameter table
|
||||||
// across all the iperp values, and we don't need to modify the
|
// across all the iperp values, and we don't need to modify the
|
||||||
// parameter table at all after the initial setup in our constructor.
|
// parameter table at all after the initial setup in our constructor.
|
||||||
// However, we do have to adjust the molecule positions in
|
// However, we do have to adjust the molecule positions in
|
||||||
// patch_interp::molecule_posn() , since the interpolator will return
|
// patch_interp::molecule_posn() , since the interpolator will return
|
||||||
// i values, while molecule_posn() needs ipar values.
|
// i values, while molecule_posn() needs ipar values.
|
||||||
//
|
//
|
||||||
|
|
||||||
class patch_interp
|
class patch_interp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// to which patch/edge do we belong?
|
// to which patch/edge do we belong?
|
||||||
const patch& my_patch() const { return my_patch_; }
|
const patch& my_patch() const { return my_patch_; }
|
||||||
const patch_edge& my_edge() const { return my_edge_; }
|
const patch_edge& my_edge() const { return my_edge_; }
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// ***** main client interface *****
|
// ***** main client interface *****
|
||||||
//
|
//
|
||||||
// interpolate specified range of ghosted gridfns
|
// interpolate specified range of ghosted gridfns
|
||||||
// at all the coordinates specified when we were constructed,
|
// at all the coordinates specified when we were constructed,
|
||||||
// store interpolated data in
|
// store interpolated data in
|
||||||
// data_buffer(ghosted_gfn, iperp, parindex)
|
// data_buffer(ghosted_gfn, iperp, parindex)
|
||||||
void interpolate(int ghosted_min_gfn_to_interp,
|
void interpolate(int ghosted_min_gfn_to_interp,
|
||||||
int ghosted_max_gfn_to_interp,
|
int ghosted_max_gfn_to_interp,
|
||||||
jtutil::array3d<fp>& data_buffer)
|
jtutil::array3d<fp>& data_buffer)
|
||||||
const;
|
const;
|
||||||
void interpolate(int ghosted_min_gfn_to_interp,
|
void interpolate(int ghosted_min_gfn_to_interp,
|
||||||
int ghosted_max_gfn_to_interp,
|
int ghosted_max_gfn_to_interp,
|
||||||
jtutil::array3d<fp>& data_buffer,
|
jtutil::array3d<fp>& data_buffer,
|
||||||
jtutil::array2d<CCTK_INT>& posn_buffer,
|
jtutil::array2d<CCTK_INT>& posn_buffer,
|
||||||
jtutil::array3d<fp>& Jacobian_buffe)
|
jtutil::array3d<fp>& Jacobian_buffe)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// ***** Jacobian of interpolate() *****
|
// ***** Jacobian of interpolate() *****
|
||||||
//
|
//
|
||||||
|
|
||||||
// verify (no-op if ok, error_exit() if not) that interpolator
|
// verify (no-op if ok, error_exit() if not) that interpolator
|
||||||
// has a Jacobian sparsity pattern which we grok: at present this
|
// has a Jacobian sparsity pattern which we grok: at present this
|
||||||
// means molecules are fixed-sized hypercubes, with size/shape
|
// means molecules are fixed-sized hypercubes, with size/shape
|
||||||
// independent of interpolation coordinates and the floating-point
|
// independent of interpolation coordinates and the floating-point
|
||||||
// values in the input arrays
|
// values in the input arrays
|
||||||
void verify_Jacobian_sparsity_pattern_ok() const;
|
void verify_Jacobian_sparsity_pattern_ok() const;
|
||||||
|
|
||||||
//
|
//
|
||||||
// The API for the remaining Jacobian functions implicitly
|
// The API for the remaining Jacobian functions implicitly
|
||||||
// assumes that the Jacobian sparsity pattern is "ok" as
|
// assumes that the Jacobian sparsity pattern is "ok" as
|
||||||
// verified by verify_Jacobian_sparsity_pattern_ok() ,
|
// verified by verify_Jacobian_sparsity_pattern_ok() ,
|
||||||
// and in particular that [min,max]_ipar_m are independent
|
// and in particular that [min,max]_ipar_m are independent
|
||||||
// of iperp and parindex.
|
// of iperp and parindex.
|
||||||
//
|
//
|
||||||
|
|
||||||
// get [min,max] ipar m coordinates of interpolation molecules
|
// get [min,max] ipar m coordinates of interpolation molecules
|
||||||
void molecule_minmax_ipar_m(int& min_ipar_m, int& max_ipar_m) const;
|
void molecule_minmax_ipar_m(int& min_ipar_m, int& max_ipar_m) const;
|
||||||
|
|
||||||
// get interpolation molecule ipar positions in
|
// get interpolation molecule ipar positions in
|
||||||
// molecule_posn_buffer(iperp, parindex)
|
// molecule_posn_buffer(iperp, parindex)
|
||||||
// ... array type is CCTK_INT so we can pass by reference
|
// ... array type is CCTK_INT so we can pass by reference
|
||||||
// to interpolator
|
// to interpolator
|
||||||
void molecule_posn(jtutil::array2d<CCTK_INT>& posn_buffer) const;
|
void molecule_posn(jtutil::array2d<CCTK_INT>& posn_buffer) const;
|
||||||
|
|
||||||
// get Jacobian of interpolated data with respect to this patch's
|
// get Jacobian of interpolated data with respect to this patch's
|
||||||
// ghosted gridfns,
|
// ghosted gridfns,
|
||||||
// partial interpolate() data_buffer(ghosted_gfn, iperp, parindex)
|
// partial interpolate() data_buffer(ghosted_gfn, iperp, parindex)
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// partial ghosted_gridfn(ghosted_gfn, iperp, posn+ipar_m)
|
// partial ghosted_gridfn(ghosted_gfn, iperp, posn+ipar_m)
|
||||||
// store Jacobian in
|
// store Jacobian in
|
||||||
// Jacobian_buffer(iperp, parindex, ipar_m)
|
// Jacobian_buffer(iperp, parindex, ipar_m)
|
||||||
// where we implicitly assume the Jacobian to be independent of
|
// where we implicitly assume the Jacobian to be independent of
|
||||||
// ghosted_gfn, and where
|
// ghosted_gfn, and where
|
||||||
// posn = posn_buffer(iperp, parindex)
|
// posn = posn_buffer(iperp, parindex)
|
||||||
// as returned by molecule_posn()
|
// as returned by molecule_posn()
|
||||||
void Jacobian(jtutil::array3d<fp>& Jacobian_buffer) const;
|
void Jacobian(jtutil::array3d<fp>& Jacobian_buffer) const;
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** internal functions *****
|
// ***** internal functions *****
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
// [min,max] iperp for interpolation and gridfn data
|
// [min,max] iperp for interpolation and gridfn data
|
||||||
int min_iperp() const { return min_iperp_; }
|
int min_iperp() const { return min_iperp_; }
|
||||||
int max_iperp() const { return max_iperp_; }
|
int max_iperp() const { return max_iperp_; }
|
||||||
|
|
||||||
// min/max (iperp,ipar) of the gridfn data to use for interpolation
|
// min/max (iperp,ipar) of the gridfn data to use for interpolation
|
||||||
int min_ipar() const { return min_ipar_; }
|
int min_ipar() const { return min_ipar_; }
|
||||||
int max_ipar() const { return max_ipar_; }
|
int max_ipar() const { return max_ipar_; }
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** constructor, destructor, et al *****
|
// ***** constructor, destructor, et al *****
|
||||||
//
|
//
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Constructor arguments:
|
// Constructor arguments:
|
||||||
// my_edge_in = Identifies the patch/edge to which this
|
// my_edge_in = Identifies the patch/edge to which this
|
||||||
// interpolation region is to belong.
|
// interpolation region is to belong.
|
||||||
// [min,max]_iperp_in = The range of iperp for this interpolation
|
// [min,max]_iperp_in = The range of iperp for this interpolation
|
||||||
// region
|
// region
|
||||||
// [min,max]_parindex_array_in(iperp)
|
// [min,max]_parindex_array_in(iperp)
|
||||||
// = [min,max] range of parindex actually used at each iperp.
|
// = [min,max] range of parindex actually used at each iperp.
|
||||||
// We keep references to these arrays, so they should have
|
// We keep references to these arrays, so they should have
|
||||||
// lifetimes at last as long as that of this object.
|
// lifetimes at last as long as that of this object.
|
||||||
// interp_par_in(iperp,parindex)
|
// interp_par_in(iperp,parindex)
|
||||||
// = Gives the par coordinates at which we will interpolate;
|
// = Gives the par coordinates at which we will interpolate;
|
||||||
// array entries outside the range [min,max]_parindex_in
|
// array entries outside the range [min,max]_parindex_in
|
||||||
// are unused. We keep a reference to this array, so it
|
// are unused. We keep a reference to this array, so it
|
||||||
// should have a lifetime at last as long as that of this
|
// should have a lifetime at last as long as that of this
|
||||||
// object.
|
// object.
|
||||||
// ok_to_use_[min,max]_par_ghost_zone
|
// ok_to_use_[min,max]_par_ghost_zone
|
||||||
// = Boolean flags saying whether or not we should use gridfn
|
// = Boolean flags saying whether or not we should use gridfn
|
||||||
// data from the [min,max]_par ghost zones in the interpolation.
|
// data from the [min,max]_par ghost zones in the interpolation.
|
||||||
// interp_handle_in = Cactus handle to the interpatch interpolation
|
// interp_handle_in = Cactus handle to the interpatch interpolation
|
||||||
// operator.
|
// operator.
|
||||||
// interp_par_table_handle_in
|
// interp_par_table_handle_in
|
||||||
// = Cactus handle to a Cactus key/value table giving
|
// = Cactus handle to a Cactus key/value table giving
|
||||||
// parameters (eg order) for the interpatch interpolation
|
// parameters (eg order) for the interpatch interpolation
|
||||||
// operator. This class internally clones this table and
|
// operator. This class internally clones this table and
|
||||||
// modifies the clone, so the original table is not modified
|
// modifies the clone, so the original table is not modified
|
||||||
// by any actions of this class.
|
// by any actions of this class.
|
||||||
//
|
//
|
||||||
// This constructor requires that this patch's gridfns already
|
// This constructor requires that this patch's gridfns already
|
||||||
// exist, since we size various arrays based on the patch's min/max
|
// exist, since we size various arrays based on the patch's min/max
|
||||||
// ghosted gfn.
|
// ghosted gfn.
|
||||||
//
|
//
|
||||||
patch_interp(const patch_edge& my_edge_in,
|
patch_interp(const patch_edge& my_edge_in,
|
||||||
int min_iperp_in, int max_iperp_in,
|
int min_iperp_in, int max_iperp_in,
|
||||||
const jtutil::array1d<int>& min_parindex_array_in,
|
const jtutil::array1d<int>& min_parindex_array_in,
|
||||||
const jtutil::array1d<int>& max_parindex_array_in,
|
const jtutil::array1d<int>& max_parindex_array_in,
|
||||||
const jtutil::array2d<fp>& interp_par_in,
|
const jtutil::array2d<fp>& interp_par_in,
|
||||||
bool ok_to_use_min_par_ghost_zone,
|
bool ok_to_use_min_par_ghost_zone,
|
||||||
bool ok_to_use_max_par_ghost_zone,
|
bool ok_to_use_max_par_ghost_zone,
|
||||||
int interp_handle_in, int interp_par_table_handle_in);
|
int interp_handle_in, int interp_par_table_handle_in);
|
||||||
~patch_interp();
|
~patch_interp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// we forbid copying and passing by value
|
// we forbid copying and passing by value
|
||||||
// by declaring the copy constructor and assignment operator
|
// by declaring the copy constructor and assignment operator
|
||||||
// private, but never defining them
|
// private, but never defining them
|
||||||
patch_interp(const patch_interp& rhs);
|
patch_interp(const patch_interp& rhs);
|
||||||
patch_interp& operator=(const patch_interp& rhs);
|
patch_interp& operator=(const patch_interp& rhs);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// ***** data members *****
|
// ***** data members *****
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
const patch& my_patch_;
|
const patch& my_patch_;
|
||||||
const patch_edge& my_edge_;
|
const patch_edge& my_edge_;
|
||||||
|
|
||||||
// range of gfn we can handle
|
// range of gfn we can handle
|
||||||
// (any given interpolate() call may specify a subrange)
|
// (any given interpolate() call may specify a subrange)
|
||||||
const int min_gfn_, max_gfn_;
|
const int min_gfn_, max_gfn_;
|
||||||
|
|
||||||
// these are strictly speaking redundant
|
// these are strictly speaking redundant
|
||||||
// but we keep them for use in debugging
|
// but we keep them for use in debugging
|
||||||
bool ok_to_use_min_par_ghost_zone_, ok_to_use_max_par_ghost_zone_;
|
bool ok_to_use_min_par_ghost_zone_, ok_to_use_max_par_ghost_zone_;
|
||||||
|
|
||||||
// patch interpolation region,
|
// patch interpolation region,
|
||||||
// i.e. range of (iperp,ipar) in this patch from which
|
// i.e. range of (iperp,ipar) in this patch from which
|
||||||
// we will use gridfn data in interpolation
|
// we will use gridfn data in interpolation
|
||||||
const int min_iperp_, max_iperp_;
|
const int min_iperp_, max_iperp_;
|
||||||
const int min_ipar_, max_ipar_;
|
const int min_ipar_, max_ipar_;
|
||||||
|
|
||||||
// [min,max] parindex at each iperp
|
// [min,max] parindex at each iperp
|
||||||
// ... these are references to arrays passed in to our constructor
|
// ... these are references to arrays passed in to our constructor
|
||||||
// ==> we do *not* own them!
|
// ==> we do *not* own them!
|
||||||
// ... indices are (iperp)
|
// ... indices are (iperp)
|
||||||
const jtutil::array1d<int>& min_parindex_array_;
|
const jtutil::array1d<int>& min_parindex_array_;
|
||||||
const jtutil::array1d<int>& max_parindex_array_;
|
const jtutil::array1d<int>& max_parindex_array_;
|
||||||
|
|
||||||
// interp_par_(iperp,parindex)
|
// interp_par_(iperp,parindex)
|
||||||
// = Gives the par coordinates at which we will interpolate;
|
// = Gives the par coordinates at which we will interpolate;
|
||||||
// array entries outside the range [min,max]_parindex_in
|
// array entries outside the range [min,max]_parindex_in
|
||||||
// are unused (n.b. this interface implicitly takes the
|
// are unused (n.b. this interface implicitly takes the
|
||||||
// par coordinates to be independent of ghosted_gfn).
|
// par coordinates to be independent of ghosted_gfn).
|
||||||
// ... this is a reference to an array passed in to our constructor
|
// ... this is a reference to an array passed in to our constructor
|
||||||
// ==> we do *not* own this!
|
// ==> we do *not* own this!
|
||||||
const jtutil::array2d<fp>& interp_par_; // indices (iperp,parindex)
|
const jtutil::array2d<fp>& interp_par_; // indices (iperp,parindex)
|
||||||
|
|
||||||
// Cactus handle to the interpolation operator
|
// Cactus handle to the interpolation operator
|
||||||
int interp_handle_;
|
int interp_handle_;
|
||||||
|
|
||||||
// Cactus handle to our private Cactus key/value table
|
// Cactus handle to our private Cactus key/value table
|
||||||
// giving parameters for the interpolation operator
|
// giving parameters for the interpolation operator
|
||||||
// ... this starts out as a copy of the passed-in table,
|
// ... this starts out as a copy of the passed-in table,
|
||||||
// then gets extra stuff added to it specific to this
|
// then gets extra stuff added to it specific to this
|
||||||
// interpolation region; it's shared across all iperp
|
// interpolation region; it's shared across all iperp
|
||||||
// ... we own this table
|
// ... we own this table
|
||||||
const int interp_par_table_handle_;
|
const int interp_par_table_handle_;
|
||||||
|
|
||||||
// (par) origin and delta values of the gridfn data
|
// (par) origin and delta values of the gridfn data
|
||||||
const fp gridfn_coord_origin_, gridfn_coord_delta_;
|
const fp gridfn_coord_origin_, gridfn_coord_delta_;
|
||||||
|
|
||||||
// --> start of gridfn data to use for interpolation
|
// --> start of gridfn data to use for interpolation
|
||||||
// (reset for each iperp)
|
// (reset for each iperp)
|
||||||
// ... we do *not* own the pointed-to data!
|
// ... we do *not* own the pointed-to data!
|
||||||
// ... index is (gfn)
|
// ... index is (gfn)
|
||||||
mutable jtutil::array1d<const void*> gridfn_data_ptrs_;
|
mutable jtutil::array1d<const void*> gridfn_data_ptrs_;
|
||||||
|
|
||||||
// --> start of interpolation data buffer for each gridfn
|
// --> start of interpolation data buffer for each gridfn
|
||||||
// (reset for each iperp)
|
// (reset for each iperp)
|
||||||
// ... we do *not* own the pointed-to data!
|
// ... we do *not* own the pointed-to data!
|
||||||
// ... index is (gfn)
|
// ... index is (gfn)
|
||||||
mutable jtutil::array1d<void*> interp_data_buffer_ptrs_;
|
mutable jtutil::array1d<void*> interp_data_buffer_ptrs_;
|
||||||
};
|
};
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* TPATCH_INTERP_H */
|
#endif /* TPATCH_INTERP_H */
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,183 +1,183 @@
|
|||||||
#ifndef TPATCH_SYSTEM_INFO_H
|
#ifndef TPATCH_SYSTEM_INFO_H
|
||||||
#define TPATCH_SYSTEM_INFO_H
|
#define TPATCH_SYSTEM_INFO_H
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This namespace contains static data describing the patch sizes and
|
// This namespace contains static data describing the patch sizes and
|
||||||
// shapes for each type of patch system. Since this data only describes
|
// shapes for each type of patch system. Since this data only describes
|
||||||
// the patch sizes/shapes, we don't distinguish between the different
|
// the patch sizes/shapes, we don't distinguish between the different
|
||||||
// boundary conditions.
|
// boundary conditions.
|
||||||
//
|
//
|
||||||
|
|
||||||
namespace patch_system_info
|
namespace patch_system_info
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// full-sphere patch system
|
// full-sphere patch system
|
||||||
// ... covers all 4pi steradians
|
// ... covers all 4pi steradians
|
||||||
//
|
//
|
||||||
namespace full_sphere
|
namespace full_sphere
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
patch_number__pz = 0,
|
patch_number__pz = 0,
|
||||||
patch_number__px,
|
patch_number__px,
|
||||||
patch_number__py,
|
patch_number__py,
|
||||||
patch_number__mx,
|
patch_number__mx,
|
||||||
patch_number__my,
|
patch_number__my,
|
||||||
patch_number__mz,
|
patch_number__mz,
|
||||||
N_patches // no comma
|
N_patches // no comma
|
||||||
};
|
};
|
||||||
static const struct patch_info patch_info_array[N_patches] = {
|
static const struct patch_info patch_info_array[N_patches] = {
|
||||||
// +z patch (90 x 90 degrees): dmu [ -45, 45], dnu [ -45, 45]
|
// +z patch (90 x 90 degrees): dmu [ -45, 45], dnu [ -45, 45]
|
||||||
{"+z", patch::patch_is_plus, 'z', -45.0, 45.0, -45.0, 45.0},
|
{"+z", patch::patch_is_plus, 'z', -45.0, 45.0, -45.0, 45.0},
|
||||||
|
|
||||||
// +x patch (90 x 90 degrees): dnu [ 45, 135], dphi [ -45, 45]
|
// +x patch (90 x 90 degrees): dnu [ 45, 135], dphi [ -45, 45]
|
||||||
{"+x", patch::patch_is_plus, 'x', 45.0, 135.0, -45.0, 45.0},
|
{"+x", patch::patch_is_plus, 'x', 45.0, 135.0, -45.0, 45.0},
|
||||||
|
|
||||||
// +y patch (90 x 90 degrees): dmu [ 45, 135], dphi [ 45, 135]
|
// +y patch (90 x 90 degrees): dmu [ 45, 135], dphi [ 45, 135]
|
||||||
{"+y", patch::patch_is_plus, 'y', 45.0, 135.0, 45.0, 135.0},
|
{"+y", patch::patch_is_plus, 'y', 45.0, 135.0, 45.0, 135.0},
|
||||||
|
|
||||||
// -x patch (90 x 90 degrees): dnu [-135, -45], dphi [ 135, 225]
|
// -x patch (90 x 90 degrees): dnu [-135, -45], dphi [ 135, 225]
|
||||||
{"-x", patch::patch_is_minus, 'x', -135.0, -45.0, 135.0, 225.0},
|
{"-x", patch::patch_is_minus, 'x', -135.0, -45.0, 135.0, 225.0},
|
||||||
|
|
||||||
// -y patch (90 x 90 degrees): dmu [-135, -45], dphi [-135, -45]
|
// -y patch (90 x 90 degrees): dmu [-135, -45], dphi [-135, -45]
|
||||||
{"-y", patch::patch_is_minus, 'y', -135.0, -45.0, -135.0, -45.0},
|
{"-y", patch::patch_is_minus, 'y', -135.0, -45.0, -135.0, -45.0},
|
||||||
|
|
||||||
// -z patch (90 x 90 degrees): dmu [ 135, 225], dnu [ 135, 225]
|
// -z patch (90 x 90 degrees): dmu [ 135, 225], dnu [ 135, 225]
|
||||||
{"-z", patch::patch_is_minus, 'z', 135.0, 225.0, 135.0, 225.0},
|
{"-z", patch::patch_is_minus, 'z', 135.0, 225.0, 135.0, 225.0},
|
||||||
};
|
};
|
||||||
} // namespace patch_system_info::full_sphere
|
} // namespace patch_system_info::full_sphere
|
||||||
|
|
||||||
//
|
//
|
||||||
// +z hemisphere (half) patch system
|
// +z hemisphere (half) patch system
|
||||||
// ... mirror symmetry across z=0 plane
|
// ... mirror symmetry across z=0 plane
|
||||||
//
|
//
|
||||||
namespace plus_z_hemisphere
|
namespace plus_z_hemisphere
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
patch_number__pz = 0,
|
patch_number__pz = 0,
|
||||||
patch_number__px,
|
patch_number__px,
|
||||||
patch_number__py,
|
patch_number__py,
|
||||||
patch_number__mx,
|
patch_number__mx,
|
||||||
patch_number__my,
|
patch_number__my,
|
||||||
N_patches // no comma
|
N_patches // no comma
|
||||||
};
|
};
|
||||||
static const struct patch_info patch_info_array[N_patches] = {
|
static const struct patch_info patch_info_array[N_patches] = {
|
||||||
// +z patch (90 x 90 degrees): dmu [ -45, 45], dnu [ -45, 45]
|
// +z patch (90 x 90 degrees): dmu [ -45, 45], dnu [ -45, 45]
|
||||||
{"+z", patch::patch_is_plus, 'z', -45.0, 45.0, -45.0, 45.0},
|
{"+z", patch::patch_is_plus, 'z', -45.0, 45.0, -45.0, 45.0},
|
||||||
|
|
||||||
// +x patch (45 x 90 degrees): dnu [ 45, 90], dphi [ -45, 45]
|
// +x patch (45 x 90 degrees): dnu [ 45, 90], dphi [ -45, 45]
|
||||||
{"+x", patch::patch_is_plus, 'x', 45.0, 90.0, -45.0, 45.0},
|
{"+x", patch::patch_is_plus, 'x', 45.0, 90.0, -45.0, 45.0},
|
||||||
|
|
||||||
// +y patch (45 x 90 degrees): dmu [ 45, 90], dphi [ 45, 135]
|
// +y patch (45 x 90 degrees): dmu [ 45, 90], dphi [ 45, 135]
|
||||||
{"+y", patch::patch_is_plus, 'y', 45.0, 90.0, 45.0, 135.0},
|
{"+y", patch::patch_is_plus, 'y', 45.0, 90.0, 45.0, 135.0},
|
||||||
|
|
||||||
// -x patch (45 x 90 degrees): dnu [ -90, -45], dphi [ 135, 225]
|
// -x patch (45 x 90 degrees): dnu [ -90, -45], dphi [ 135, 225]
|
||||||
{"-x", patch::patch_is_minus, 'x', -90.0, -45.0, 135.0, 225.0},
|
{"-x", patch::patch_is_minus, 'x', -90.0, -45.0, 135.0, 225.0},
|
||||||
|
|
||||||
// -y patch (45 x 90 degrees): dmu [ -90, -45], dphi [-135, -45]
|
// -y patch (45 x 90 degrees): dmu [ -90, -45], dphi [-135, -45]
|
||||||
{"-y", patch::patch_is_minus, 'y', -90.0, -45.0, -135.0, -45.0},
|
{"-y", patch::patch_is_minus, 'y', -90.0, -45.0, -135.0, -45.0},
|
||||||
};
|
};
|
||||||
} // namespace patch_system_info::plus_z_hemisphere
|
} // namespace patch_system_info::plus_z_hemisphere
|
||||||
|
|
||||||
//
|
//
|
||||||
// +[xy] "vertical" quarter-grid (quadrant) patch system
|
// +[xy] "vertical" quarter-grid (quadrant) patch system
|
||||||
// two types of boundary conditions:
|
// two types of boundary conditions:
|
||||||
// ... mirror symmetry across x=0 and y=0 planes
|
// ... mirror symmetry across x=0 and y=0 planes
|
||||||
// ... 90 degree periodic rotation symmetry about z axis
|
// ... 90 degree periodic rotation symmetry about z axis
|
||||||
//
|
//
|
||||||
namespace plus_xy_quadrant
|
namespace plus_xy_quadrant
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
patch_number__pz = 0,
|
patch_number__pz = 0,
|
||||||
patch_number__px,
|
patch_number__px,
|
||||||
patch_number__py,
|
patch_number__py,
|
||||||
patch_number__mz,
|
patch_number__mz,
|
||||||
N_patches // no comma
|
N_patches // no comma
|
||||||
};
|
};
|
||||||
static const struct patch_info patch_info_array[N_patches] = {
|
static const struct patch_info patch_info_array[N_patches] = {
|
||||||
// +z patch (45 x 45 degrees): dmu [ 0, 45], dnu [ 0, 45]
|
// +z patch (45 x 45 degrees): dmu [ 0, 45], dnu [ 0, 45]
|
||||||
{"+z", patch::patch_is_plus, 'z', 0.0, 45.0, 0.0, 45.0},
|
{"+z", patch::patch_is_plus, 'z', 0.0, 45.0, 0.0, 45.0},
|
||||||
|
|
||||||
// +x patch (90 x 45 degrees): dnu [ 45, 135], dphi [ 0, 45]
|
// +x patch (90 x 45 degrees): dnu [ 45, 135], dphi [ 0, 45]
|
||||||
{"+x", patch::patch_is_plus, 'x', 45.0, 135.0, 0.0, 45.0},
|
{"+x", patch::patch_is_plus, 'x', 45.0, 135.0, 0.0, 45.0},
|
||||||
|
|
||||||
// +y patch (90 x 45 degrees): dmu [ 45, 135], dphi [ 45, 90]
|
// +y patch (90 x 45 degrees): dmu [ 45, 135], dphi [ 45, 90]
|
||||||
{"+y", patch::patch_is_plus, 'y', 45.0, 135.0, 45.0, 90.0},
|
{"+y", patch::patch_is_plus, 'y', 45.0, 135.0, 45.0, 90.0},
|
||||||
|
|
||||||
// -z patch (45 x 45 degrees): dmu [ 135, 180], dnu [ 135, 180]
|
// -z patch (45 x 45 degrees): dmu [ 135, 180], dnu [ 135, 180]
|
||||||
{"-z", patch::patch_is_minus, 'z', 135.0, 180.0, 135.0, 180.0},
|
{"-z", patch::patch_is_minus, 'z', 135.0, 180.0, 135.0, 180.0},
|
||||||
};
|
};
|
||||||
} // namespace patch_system_info::plus_xy_quadrant
|
} // namespace patch_system_info::plus_xy_quadrant
|
||||||
|
|
||||||
//
|
//
|
||||||
// +[xz] "horizontal" quarter-grid (quadrant) patch system
|
// +[xz] "horizontal" quarter-grid (quadrant) patch system
|
||||||
// two types of boundary conditions
|
// two types of boundary conditions
|
||||||
// ... mirror symmetry across x=0 plane, z=0 plane
|
// ... mirror symmetry across x=0 plane, z=0 plane
|
||||||
// ... 180 degree periodic rotation symmetry about z axis,
|
// ... 180 degree periodic rotation symmetry about z axis,
|
||||||
// mirror symmetry across z=0 plane
|
// mirror symmetry across z=0 plane
|
||||||
//
|
//
|
||||||
namespace plus_xz_quadrant
|
namespace plus_xz_quadrant
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
patch_number__pz = 0,
|
patch_number__pz = 0,
|
||||||
patch_number__px,
|
patch_number__px,
|
||||||
patch_number__py,
|
patch_number__py,
|
||||||
patch_number__my,
|
patch_number__my,
|
||||||
N_patches // no comma
|
N_patches // no comma
|
||||||
};
|
};
|
||||||
static const struct patch_info patch_info_array[N_patches] = {
|
static const struct patch_info patch_info_array[N_patches] = {
|
||||||
// +z patch (90 x 45 degrees): dmu [ -45, 45], dnu [ 0, 45]
|
// +z patch (90 x 45 degrees): dmu [ -45, 45], dnu [ 0, 45]
|
||||||
{"+z", patch::patch_is_plus, 'z', -45.0, 45.0, 0.0, 45.0},
|
{"+z", patch::patch_is_plus, 'z', -45.0, 45.0, 0.0, 45.0},
|
||||||
|
|
||||||
// +x patch (45 x 90 degrees): dnu [ 45, 90], dphi [ -45, 45]
|
// +x patch (45 x 90 degrees): dnu [ 45, 90], dphi [ -45, 45]
|
||||||
{"+x", patch::patch_is_plus, 'x', 45.0, 90.0, -45.0, 45.0},
|
{"+x", patch::patch_is_plus, 'x', 45.0, 90.0, -45.0, 45.0},
|
||||||
|
|
||||||
// +y patch (45 x 45 degrees): dmu [ 45, 90], dphi [ 45, 90]
|
// +y patch (45 x 45 degrees): dmu [ 45, 90], dphi [ 45, 90]
|
||||||
{"+y", patch::patch_is_plus, 'y', 45.0, 90.0, 45.0, 90.0},
|
{"+y", patch::patch_is_plus, 'y', 45.0, 90.0, 45.0, 90.0},
|
||||||
|
|
||||||
// -y patch (45 x 45 degrees): dmu [ -90, -45], dphi [ -90, -45]
|
// -y patch (45 x 45 degrees): dmu [ -90, -45], dphi [ -90, -45]
|
||||||
{"-y", patch::patch_is_minus, 'y', -90.0, -45.0, -90.0, -45.0},
|
{"-y", patch::patch_is_minus, 'y', -90.0, -45.0, -90.0, -45.0},
|
||||||
};
|
};
|
||||||
} // namespace patch_system_info::plus_xz_quadrant_rotating
|
} // namespace patch_system_info::plus_xz_quadrant_rotating
|
||||||
|
|
||||||
//
|
//
|
||||||
// +[xyz] (octant) patch system
|
// +[xyz] (octant) patch system
|
||||||
// two types of boundary conditions:
|
// two types of boundary conditions:
|
||||||
// ... mirror symmetry across x=0 plane, y=0 plane, z=0 plane
|
// ... mirror symmetry across x=0 plane, y=0 plane, z=0 plane
|
||||||
// ... 90 degree periodic rotation symmetry about z axis,
|
// ... 90 degree periodic rotation symmetry about z axis,
|
||||||
// mirror symmetry across z=0 plane
|
// mirror symmetry across z=0 plane
|
||||||
//
|
//
|
||||||
namespace plus_xyz_octant
|
namespace plus_xyz_octant
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
patch_number__pz = 0,
|
patch_number__pz = 0,
|
||||||
patch_number__px,
|
patch_number__px,
|
||||||
patch_number__py,
|
patch_number__py,
|
||||||
N_patches // no comma
|
N_patches // no comma
|
||||||
};
|
};
|
||||||
static const struct patch_info patch_info_array[N_patches] = {
|
static const struct patch_info patch_info_array[N_patches] = {
|
||||||
// +z patch (45 x 45 degrees): dmu [ 0, 45], dnu [ 0, 45]
|
// +z patch (45 x 45 degrees): dmu [ 0, 45], dnu [ 0, 45]
|
||||||
{"+z", patch::patch_is_plus, 'z', 0.0, 45.0, 0.0, 45.0},
|
{"+z", patch::patch_is_plus, 'z', 0.0, 45.0, 0.0, 45.0},
|
||||||
|
|
||||||
// +x patch (45 x 45 degrees): dnu [ 45, 90], dphi [ 0, 45]
|
// +x patch (45 x 45 degrees): dnu [ 45, 90], dphi [ 0, 45]
|
||||||
{"+x", patch::patch_is_plus, 'x', 45.0, 90.0, 0.0, 45.0},
|
{"+x", patch::patch_is_plus, 'x', 45.0, 90.0, 0.0, 45.0},
|
||||||
|
|
||||||
// +y patch (45 x 45 degrees): dmu [ 45, 90], dphi [ 45, 90]
|
// +y patch (45 x 45 degrees): dmu [ 45, 90], dphi [ 45, 90]
|
||||||
{"+y", patch::patch_is_plus, 'y', 45.0, 90.0, 45.0, 90.0},
|
{"+y", patch::patch_is_plus, 'y', 45.0, 90.0, 45.0, 90.0},
|
||||||
};
|
};
|
||||||
} // namespace patch_system_info::octant_mirrored
|
} // namespace patch_system_info::octant_mirrored
|
||||||
|
|
||||||
} // namespace patch_system_info::
|
} // namespace patch_system_info::
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
#endif /* TPATCH_SYSTEM_INFO_H */
|
#endif /* TPATCH_SYSTEM_INFO_H */
|
||||||
@@ -1,38 +1,38 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
int round<fp_t>::to_integer(fp_t x)
|
int round<fp_t>::to_integer(fp_t x)
|
||||||
{
|
{
|
||||||
return (x >= 0.0)
|
return (x >= 0.0)
|
||||||
? int(x + 0.5) // eg 3.6 --> int(4.1) = 4
|
? int(x + 0.5) // eg 3.6 --> int(4.1) = 4
|
||||||
: -int((-x) + 0.5); // eg -3.6 --> - int(4.1) = -4
|
: -int((-x) + 0.5); // eg -3.6 --> - int(4.1) = -4
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
int round<fp_t>::floor(fp_t x)
|
int round<fp_t>::floor(fp_t x)
|
||||||
{
|
{
|
||||||
return (x >= 0.0)
|
return (x >= 0.0)
|
||||||
? int(x)
|
? int(x)
|
||||||
: -ceiling(-x);
|
: -ceiling(-x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
int round<fp_t>::ceiling(fp_t x)
|
int round<fp_t>::ceiling(fp_t x)
|
||||||
{
|
{
|
||||||
return (x >= 0.0)
|
return (x >= 0.0)
|
||||||
? int(x) + (x != fp_t(int(x)))
|
? int(x) + (x != fp_t(int(x)))
|
||||||
: -floor(-x);
|
: -floor(-x);
|
||||||
}
|
}
|
||||||
|
|
||||||
template class round<float>;
|
template class round<float>;
|
||||||
template class round<double>;
|
template class round<double>;
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,188 +1,188 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
#include "util_Table.h"
|
#include "util_Table.h"
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "cpm_map.h"
|
#include "cpm_map.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
#include "fd_grid.h"
|
#include "fd_grid.h"
|
||||||
#include "patch.h"
|
#include "patch.h"
|
||||||
#include "patch_edge.h"
|
#include "patch_edge.h"
|
||||||
#include "patch_interp.h"
|
#include "patch_interp.h"
|
||||||
#include "ghost_zone.h"
|
#include "ghost_zone.h"
|
||||||
#include "patch_system.h"
|
#include "patch_system.h"
|
||||||
|
|
||||||
#include "Jacobian.h"
|
#include "Jacobian.h"
|
||||||
|
|
||||||
#include "gfns.h"
|
#include "gfns.h"
|
||||||
#include "gr.h"
|
#include "gr.h"
|
||||||
|
|
||||||
#include "horizon_sequence.h"
|
#include "horizon_sequence.h"
|
||||||
#include "BH_diagnostics.h"
|
#include "BH_diagnostics.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#include "myglobal.h"
|
#include "myglobal.h"
|
||||||
#include "bssn_class.h"
|
#include "bssn_class.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
struct state state;
|
struct state state;
|
||||||
|
|
||||||
using jtutil::error_exit;
|
using jtutil::error_exit;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
int allocate_horizons_to_processor(int N_procs, int my_proc,
|
int allocate_horizons_to_processor(int N_procs, int my_proc,
|
||||||
int N_horizons, bool multiproc_flag,
|
int N_horizons, bool multiproc_flag,
|
||||||
horizon_sequence &my_hs)
|
horizon_sequence &my_hs)
|
||||||
{
|
{
|
||||||
const int N_active_procs = multiproc_flag ? Mymin(N_procs, N_horizons)
|
const int N_active_procs = multiproc_flag ? Mymin(N_procs, N_horizons)
|
||||||
: 1;
|
: 1;
|
||||||
// Implementation note:
|
// Implementation note:
|
||||||
// We allocate the horizons to active processors in round-robin order.
|
// We allocate the horizons to active processors in round-robin order.
|
||||||
//
|
//
|
||||||
int proc = 0;
|
int proc = 0;
|
||||||
for (int hn = 1; hn <= N_horizons; ++hn)
|
for (int hn = 1; hn <= N_horizons; ++hn)
|
||||||
{
|
{
|
||||||
if (proc == my_proc)
|
if (proc == my_proc)
|
||||||
my_hs.append_hn(hn);
|
my_hs.append_hn(hn);
|
||||||
if (++proc >= N_active_procs)
|
if (++proc >= N_active_procs)
|
||||||
proc = 0;
|
proc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return N_active_procs;
|
return N_active_procs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern struct state state;
|
extern struct state state;
|
||||||
|
|
||||||
void AHFinderDirect_setup(MyList<var> *AHList, MyList<var> *GaugeList, bssn_class *ADM,
|
void AHFinderDirect_setup(MyList<var> *AHList, MyList<var> *GaugeList, bssn_class *ADM,
|
||||||
int Symmetry, int HN, double *PhysTime)
|
int Symmetry, int HN, double *PhysTime)
|
||||||
{
|
{
|
||||||
enum patch_system::patch_system_type ps_type;
|
enum patch_system::patch_system_type ps_type;
|
||||||
|
|
||||||
switch (Symmetry)
|
switch (Symmetry)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
ps_type = patch_system::patch_system__plus_xyz_octant_mirrored;
|
ps_type = patch_system::patch_system__plus_xyz_octant_mirrored;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ps_type = patch_system::patch_system__plus_z_hemisphere;
|
ps_type = patch_system::patch_system__plus_z_hemisphere;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
ps_type = patch_system::patch_system__full_sphere;
|
ps_type = patch_system::patch_system__full_sphere;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
jtutil::error_exit(ERROR_EXIT, "** Symmetry=%d is not support by AHFD yet.", Symmetry);
|
jtutil::error_exit(ERROR_EXIT, "** Symmetry=%d is not support by AHFD yet.", Symmetry);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nprocs = 1, myrank = 0;
|
int nprocs = 1, myrank = 0;
|
||||||
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||||
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
|
||||||
|
|
||||||
state.PhysTime = PhysTime; // Synchonize the PhysTime
|
state.PhysTime = PhysTime; // Synchonize the PhysTime
|
||||||
state.Symmetry = Symmetry;
|
state.Symmetry = Symmetry;
|
||||||
state.AHList = AHList;
|
state.AHList = AHList;
|
||||||
state.GaugeList = GaugeList;
|
state.GaugeList = GaugeList;
|
||||||
state.ADM = ADM;
|
state.ADM = ADM;
|
||||||
state.N_procs = nprocs;
|
state.N_procs = nprocs;
|
||||||
state.my_proc = myrank;
|
state.my_proc = myrank;
|
||||||
|
|
||||||
state.N_horizons = HN;
|
state.N_horizons = HN;
|
||||||
|
|
||||||
//
|
//
|
||||||
// (genuine) horizon sequence for this processor
|
// (genuine) horizon sequence for this processor
|
||||||
//
|
//
|
||||||
state.my_hs = new horizon_sequence(state.N_horizons);
|
state.my_hs = new horizon_sequence(state.N_horizons);
|
||||||
horizon_sequence &hs = *state.my_hs;
|
horizon_sequence &hs = *state.my_hs;
|
||||||
|
|
||||||
const bool multiproc_flag = true;
|
const bool multiproc_flag = true;
|
||||||
state.N_active_procs = allocate_horizons_to_processor(state.N_procs, state.my_proc,
|
state.N_active_procs = allocate_horizons_to_processor(state.N_procs, state.my_proc,
|
||||||
state.N_horizons, multiproc_flag,
|
state.N_horizons, multiproc_flag,
|
||||||
hs);
|
hs);
|
||||||
|
|
||||||
// ... horizon numbers run from 1 to N_horizons inclusive
|
// ... horizon numbers run from 1 to N_horizons inclusive
|
||||||
// so the array size is N_horizons+1
|
// so the array size is N_horizons+1
|
||||||
state.AH_data_array = new AH_data *[HN + 1];
|
state.AH_data_array = new AH_data *[HN + 1];
|
||||||
for (int hn = 0; hn <= HN; ++hn)
|
for (int hn = 0; hn <= HN; ++hn)
|
||||||
{
|
{
|
||||||
state.AH_data_array[hn] = NULL;
|
state.AH_data_array[hn] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NNP = 0, NNP_out;
|
int NNP = 0, NNP_out;
|
||||||
for (int hn = 1; hn <= hs.N_horizons(); ++hn)
|
for (int hn = 1; hn <= hs.N_horizons(); ++hn)
|
||||||
{
|
{
|
||||||
const bool genuine_flag = hs.is_hn_genuine(hn);
|
const bool genuine_flag = hs.is_hn_genuine(hn);
|
||||||
state.AH_data_array[hn] = new AH_data;
|
state.AH_data_array[hn] = new AH_data;
|
||||||
struct AH_data &AH_data = *state.AH_data_array[hn];
|
struct AH_data &AH_data = *state.AH_data_array[hn];
|
||||||
|
|
||||||
AH_data.recentering_flag = false;
|
AH_data.recentering_flag = false;
|
||||||
AH_data.stop_finding = false;
|
AH_data.stop_finding = false;
|
||||||
|
|
||||||
// create the patch system
|
// create the patch system
|
||||||
AH_data.ps_ptr = new patch_system(0, 0, 0, // just dummy set, we will recenter it when setting initial guess
|
AH_data.ps_ptr = new patch_system(0, 0, 0, // just dummy set, we will recenter it when setting initial guess
|
||||||
ps_type, 2, 1,
|
ps_type, 2, 1,
|
||||||
20, 1,
|
20, 1,
|
||||||
// (genuine_flag ? 53 : 0),
|
// (genuine_flag ? 53 : 0),
|
||||||
(genuine_flag ? gfns::nominal_max_gfn
|
(genuine_flag ? gfns::nominal_max_gfn
|
||||||
: gfns::skeletal_nominal_max_gfn),
|
: gfns::skeletal_nominal_max_gfn),
|
||||||
-1, -1,
|
-1, -1,
|
||||||
1, 1,
|
1, 1,
|
||||||
1, 1,
|
1, 1,
|
||||||
true, false);
|
true, false);
|
||||||
patch_system &ps = *AH_data.ps_ptr;
|
patch_system &ps = *AH_data.ps_ptr;
|
||||||
|
|
||||||
if (genuine_flag)
|
if (genuine_flag)
|
||||||
ps.set_gridfn_to_constant(1.0, gfns::gfn__one);
|
ps.set_gridfn_to_constant(1.0, gfns::gfn__one);
|
||||||
|
|
||||||
AH_data.Jac_ptr = genuine_flag ? new Jacobian(ps) : NULL;
|
AH_data.Jac_ptr = genuine_flag ? new Jacobian(ps) : NULL;
|
||||||
|
|
||||||
AH_data.surface_expansion = 0;
|
AH_data.surface_expansion = 0;
|
||||||
|
|
||||||
AH_data.initial_find_flag = genuine_flag;
|
AH_data.initial_find_flag = genuine_flag;
|
||||||
|
|
||||||
AH_data.found_flag = false;
|
AH_data.found_flag = false;
|
||||||
AH_data.BH_diagnostics_fileptr = NULL;
|
AH_data.BH_diagnostics_fileptr = NULL;
|
||||||
|
|
||||||
NNP = Mymax(NNP, AH_data.ps_ptr->N_grid_points());
|
NNP = Mymax(NNP, AH_data.ps_ptr->N_grid_points());
|
||||||
} // end of for hn
|
} // end of for hn
|
||||||
|
|
||||||
MPI_Allreduce(&NNP, &NNP_out, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
|
MPI_Allreduce(&NNP, &NNP_out, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
|
||||||
|
|
||||||
state.Data = new double[NNP_out * 35];
|
state.Data = new double[NNP_out * 35];
|
||||||
state.oX = new double[NNP_out];
|
state.oX = new double[NNP_out];
|
||||||
state.oY = new double[NNP_out];
|
state.oY = new double[NNP_out];
|
||||||
state.oZ = new double[NNP_out];
|
state.oZ = new double[NNP_out];
|
||||||
}
|
}
|
||||||
void AHFinderDirect_cleanup()
|
void AHFinderDirect_cleanup()
|
||||||
{
|
{
|
||||||
horizon_sequence &hs = *state.my_hs;
|
horizon_sequence &hs = *state.my_hs;
|
||||||
for (int hn = 1; hn <= hs.N_horizons(); ++hn)
|
for (int hn = 1; hn <= hs.N_horizons(); ++hn)
|
||||||
{
|
{
|
||||||
struct AH_data &AH_data = *state.AH_data_array[hn];
|
struct AH_data &AH_data = *state.AH_data_array[hn];
|
||||||
if (AH_data.ps_ptr)
|
if (AH_data.ps_ptr)
|
||||||
delete AH_data.ps_ptr;
|
delete AH_data.ps_ptr;
|
||||||
if (AH_data.Jac_ptr)
|
if (AH_data.Jac_ptr)
|
||||||
delete AH_data.Jac_ptr;
|
delete AH_data.Jac_ptr;
|
||||||
delete state.AH_data_array[hn];
|
delete state.AH_data_array[hn];
|
||||||
} // end of for hn
|
} // end of for hn
|
||||||
delete[] state.AH_data_array;
|
delete[] state.AH_data_array;
|
||||||
delete state.my_hs;
|
delete state.my_hs;
|
||||||
delete[] state.oX;
|
delete[] state.oX;
|
||||||
delete[] state.oY;
|
delete[] state.oY;
|
||||||
delete[] state.oZ;
|
delete[] state.oZ;
|
||||||
delete[] state.Data;
|
delete[] state.Data;
|
||||||
}
|
}
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
@@ -1,24 +1,24 @@
|
|||||||
#ifndef AHFINDERDIRECT__STDC_H
|
#ifndef AHFINDERDIRECT__STDC_H
|
||||||
#define AHFINDERDIRECT__STDC_H
|
#define AHFINDERDIRECT__STDC_H
|
||||||
|
|
||||||
#define then /* empty */
|
#define then /* empty */
|
||||||
|
|
||||||
#ifdef M_PI
|
#ifdef M_PI
|
||||||
#define PI M_PI
|
#define PI M_PI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define iabs(x_) abs(x_)
|
#define iabs(x_) abs(x_)
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
|
|
||||||
int error_exit(int msg_level, const char *format, ...);
|
int error_exit(int msg_level, const char *format, ...);
|
||||||
|
|
||||||
#define ERROR_EXIT (-1)
|
#define ERROR_EXIT (-1)
|
||||||
#define PANIC_EXIT (-2)
|
#define PANIC_EXIT (-2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* AHFINDERDIRECT__STDC_H */
|
#endif /* AHFINDERDIRECT__STDC_H */
|
||||||
@@ -1,128 +1,128 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "cctk.h"
|
#include "cctk.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "stdc.h"
|
#include "stdc.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "array.h"
|
#include "array.h"
|
||||||
#include "linear_map.h"
|
#include "linear_map.h"
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
#include "tgrid.h"
|
#include "tgrid.h"
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function constructs a grid_arrays object.
|
// This function constructs a grid_arrays object.
|
||||||
//
|
//
|
||||||
grid_arrays::grid_arrays(const grid_array_pars &grid_array_pars_in)
|
grid_arrays::grid_arrays(const grid_array_pars &grid_array_pars_in)
|
||||||
|
|
||||||
: gridfn_data_(NULL),
|
: gridfn_data_(NULL),
|
||||||
ghosted_gridfn_data_(NULL),
|
ghosted_gridfn_data_(NULL),
|
||||||
|
|
||||||
// these are all set properly by setup_gridfn_storage()
|
// these are all set properly by setup_gridfn_storage()
|
||||||
min_gfn_(0), max_gfn_(0),
|
min_gfn_(0), max_gfn_(0),
|
||||||
ghosted_min_gfn_(0), ghosted_max_gfn_(0),
|
ghosted_min_gfn_(0), ghosted_max_gfn_(0),
|
||||||
|
|
||||||
min_irho_(grid_array_pars_in.min_irho),
|
min_irho_(grid_array_pars_in.min_irho),
|
||||||
max_irho_(grid_array_pars_in.max_irho),
|
max_irho_(grid_array_pars_in.max_irho),
|
||||||
min_isigma_(grid_array_pars_in.min_isigma),
|
min_isigma_(grid_array_pars_in.min_isigma),
|
||||||
max_isigma_(grid_array_pars_in.max_isigma),
|
max_isigma_(grid_array_pars_in.max_isigma),
|
||||||
|
|
||||||
ghosted_min_irho_(grid_array_pars_in.min_irho - grid_array_pars_in.min_rho_ghost_zone_width),
|
ghosted_min_irho_(grid_array_pars_in.min_irho - grid_array_pars_in.min_rho_ghost_zone_width),
|
||||||
ghosted_max_irho_(grid_array_pars_in.max_irho + grid_array_pars_in.max_rho_ghost_zone_width),
|
ghosted_max_irho_(grid_array_pars_in.max_irho + grid_array_pars_in.max_rho_ghost_zone_width),
|
||||||
ghosted_min_isigma_(grid_array_pars_in.min_isigma - grid_array_pars_in.min_sigma_ghost_zone_width),
|
ghosted_min_isigma_(grid_array_pars_in.min_isigma - grid_array_pars_in.min_sigma_ghost_zone_width),
|
||||||
ghosted_max_isigma_(grid_array_pars_in.max_isigma + grid_array_pars_in.max_sigma_ghost_zone_width)
|
ghosted_max_isigma_(grid_array_pars_in.max_isigma + grid_array_pars_in.max_sigma_ghost_zone_width)
|
||||||
// no comma
|
// no comma
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function sets up the gridfn storage arrays in a grid_arrays object.
|
// This function sets up the gridfn storage arrays in a grid_arrays object.
|
||||||
//
|
//
|
||||||
void grid_arrays::setup_gridfn_storage(const gridfn_pars &gridfn_pars_in,
|
void grid_arrays::setup_gridfn_storage(const gridfn_pars &gridfn_pars_in,
|
||||||
const gridfn_pars &ghosted_gridfn_pars_in)
|
const gridfn_pars &ghosted_gridfn_pars_in)
|
||||||
{
|
{
|
||||||
assert(gridfn_data_ == NULL);
|
assert(gridfn_data_ == NULL);
|
||||||
gridfn_data_ = new jtutil::array3d<fp>(gridfn_pars_in.min_gfn,
|
gridfn_data_ = new jtutil::array3d<fp>(gridfn_pars_in.min_gfn,
|
||||||
gridfn_pars_in.max_gfn,
|
gridfn_pars_in.max_gfn,
|
||||||
min_irho(), max_irho(),
|
min_irho(), max_irho(),
|
||||||
min_isigma(), max_isigma(),
|
min_isigma(), max_isigma(),
|
||||||
gridfn_pars_in.storage_array,
|
gridfn_pars_in.storage_array,
|
||||||
gridfn_pars_in.gfn_stride,
|
gridfn_pars_in.gfn_stride,
|
||||||
gridfn_pars_in.irho_stride,
|
gridfn_pars_in.irho_stride,
|
||||||
gridfn_pars_in.isigma_stride);
|
gridfn_pars_in.isigma_stride);
|
||||||
|
|
||||||
assert(ghosted_gridfn_data_ == NULL);
|
assert(ghosted_gridfn_data_ == NULL);
|
||||||
ghosted_gridfn_data_ = new jtutil::array3d<fp>(ghosted_gridfn_pars_in.min_gfn,
|
ghosted_gridfn_data_ = new jtutil::array3d<fp>(ghosted_gridfn_pars_in.min_gfn,
|
||||||
ghosted_gridfn_pars_in.max_gfn,
|
ghosted_gridfn_pars_in.max_gfn,
|
||||||
ghosted_min_irho(), ghosted_max_irho(),
|
ghosted_min_irho(), ghosted_max_irho(),
|
||||||
ghosted_min_isigma(), ghosted_max_isigma(),
|
ghosted_min_isigma(), ghosted_max_isigma(),
|
||||||
ghosted_gridfn_pars_in.storage_array,
|
ghosted_gridfn_pars_in.storage_array,
|
||||||
ghosted_gridfn_pars_in.gfn_stride,
|
ghosted_gridfn_pars_in.gfn_stride,
|
||||||
ghosted_gridfn_pars_in.irho_stride,
|
ghosted_gridfn_pars_in.irho_stride,
|
||||||
ghosted_gridfn_pars_in.isigma_stride);
|
ghosted_gridfn_pars_in.isigma_stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function destroys a grid_arrays object.
|
// This function destroys a grid_arrays object.
|
||||||
//
|
//
|
||||||
grid_arrays::~grid_arrays()
|
grid_arrays::~grid_arrays()
|
||||||
{
|
{
|
||||||
delete ghosted_gridfn_data_;
|
delete ghosted_gridfn_data_;
|
||||||
delete gridfn_data_;
|
delete gridfn_data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function constructs a grid object.
|
// This function constructs a grid object.
|
||||||
//
|
//
|
||||||
grid::grid(const grid_array_pars &grid_array_pars_in,
|
grid::grid(const grid_array_pars &grid_array_pars_in,
|
||||||
const grid_pars &grid_pars_in)
|
const grid_pars &grid_pars_in)
|
||||||
|
|
||||||
: grid_arrays(grid_array_pars_in),
|
: grid_arrays(grid_array_pars_in),
|
||||||
|
|
||||||
rho_map_(grid_array_pars_in.min_irho - grid_array_pars_in.min_rho_ghost_zone_width,
|
rho_map_(grid_array_pars_in.min_irho - grid_array_pars_in.min_rho_ghost_zone_width,
|
||||||
grid_array_pars_in.max_irho + grid_array_pars_in.max_rho_ghost_zone_width,
|
grid_array_pars_in.max_irho + grid_array_pars_in.max_rho_ghost_zone_width,
|
||||||
jtutil::radians_of_degrees(
|
jtutil::radians_of_degrees(
|
||||||
grid_pars_in.min_drho - grid_array_pars_in.min_rho_ghost_zone_width * grid_pars_in.delta_drho),
|
grid_pars_in.min_drho - grid_array_pars_in.min_rho_ghost_zone_width * grid_pars_in.delta_drho),
|
||||||
jtutil::radians_of_degrees(grid_pars_in.delta_drho),
|
jtutil::radians_of_degrees(grid_pars_in.delta_drho),
|
||||||
jtutil::radians_of_degrees(
|
jtutil::radians_of_degrees(
|
||||||
grid_pars_in.max_drho + grid_array_pars_in.max_rho_ghost_zone_width * grid_pars_in.delta_drho)),
|
grid_pars_in.max_drho + grid_array_pars_in.max_rho_ghost_zone_width * grid_pars_in.delta_drho)),
|
||||||
|
|
||||||
sigma_map_(grid_array_pars_in.min_isigma - grid_array_pars_in.min_sigma_ghost_zone_width,
|
sigma_map_(grid_array_pars_in.min_isigma - grid_array_pars_in.min_sigma_ghost_zone_width,
|
||||||
grid_array_pars_in.max_isigma + grid_array_pars_in.max_sigma_ghost_zone_width,
|
grid_array_pars_in.max_isigma + grid_array_pars_in.max_sigma_ghost_zone_width,
|
||||||
jtutil::radians_of_degrees(
|
jtutil::radians_of_degrees(
|
||||||
grid_pars_in.min_dsigma - grid_array_pars_in.min_sigma_ghost_zone_width * grid_pars_in.delta_dsigma),
|
grid_pars_in.min_dsigma - grid_array_pars_in.min_sigma_ghost_zone_width * grid_pars_in.delta_dsigma),
|
||||||
jtutil::radians_of_degrees(grid_pars_in.delta_dsigma),
|
jtutil::radians_of_degrees(grid_pars_in.delta_dsigma),
|
||||||
jtutil::radians_of_degrees(
|
jtutil::radians_of_degrees(
|
||||||
grid_pars_in.max_dsigma + grid_array_pars_in.max_sigma_ghost_zone_width * grid_pars_in.delta_dsigma)),
|
grid_pars_in.max_dsigma + grid_array_pars_in.max_sigma_ghost_zone_width * grid_pars_in.delta_dsigma)),
|
||||||
|
|
||||||
min_rho_(jtutil::radians_of_degrees(grid_pars_in.min_drho)),
|
min_rho_(jtutil::radians_of_degrees(grid_pars_in.min_drho)),
|
||||||
max_rho_(jtutil::radians_of_degrees(grid_pars_in.max_drho)),
|
max_rho_(jtutil::radians_of_degrees(grid_pars_in.max_drho)),
|
||||||
min_sigma_(jtutil::radians_of_degrees(grid_pars_in.min_dsigma)),
|
min_sigma_(jtutil::radians_of_degrees(grid_pars_in.min_dsigma)),
|
||||||
max_sigma_(jtutil::radians_of_degrees(grid_pars_in.max_dsigma))
|
max_sigma_(jtutil::radians_of_degrees(grid_pars_in.max_dsigma))
|
||||||
// no comma
|
// no comma
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,157 +1,157 @@
|
|||||||
#ifndef AHFINDERDIRECT__UTIL_HH
|
#ifndef AHFINDERDIRECT__UTIL_HH
|
||||||
#define AHFINDERDIRECT__UTIL_HH
|
#define AHFINDERDIRECT__UTIL_HH
|
||||||
#ifdef newc
|
#ifdef newc
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <strstream>
|
#include <strstream>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#else
|
#else
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <iomanip.h>
|
#include <iomanip.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PI M_PI
|
#define PI M_PI
|
||||||
|
|
||||||
namespace AHFinderDirect
|
namespace AHFinderDirect
|
||||||
{
|
{
|
||||||
namespace jtutil
|
namespace jtutil
|
||||||
{
|
{
|
||||||
inline int how_many_in_range(int low, int high) { return high - low + 1; }
|
inline int how_many_in_range(int low, int high) { return high - low + 1; }
|
||||||
|
|
||||||
inline int is_even(int i) { return !(i & 0x1); }
|
inline int is_even(int i) { return !(i & 0x1); }
|
||||||
inline int is_odd(int i) { return (i & 0x1); }
|
inline int is_odd(int i) { return (i & 0x1); }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T tmin(T x, T y) { return (x < y) ? x : y; }
|
inline T tmin(T x, T y) { return (x < y) ? x : y; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T tmax(T x, T y) { return (x > y) ? x : y; }
|
inline T tmax(T x, T y) { return (x > y) ? x : y; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T abs(T x) { return (x > 0) ? x : -x; }
|
inline T abs(T x) { return (x > 0) ? x : -x; }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T pow2(T x) { return x * x; }
|
inline T pow2(T x) { return x * x; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T pow3(T x) { return x * x * x; }
|
inline T pow3(T x) { return x * x * x; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T pow4(T x) { return pow2(pow2(x)); }
|
inline T pow4(T x) { return pow2(pow2(x)); }
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
inline fp_t degrees_of_radians(fp_t radians) { return (180.0 / PI) * radians; }
|
inline fp_t degrees_of_radians(fp_t radians) { return (180.0 / PI) * radians; }
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
inline fp_t radians_of_degrees(fp_t degrees) { return (PI / 180.0) * degrees; }
|
inline fp_t radians_of_degrees(fp_t degrees) { return (PI / 180.0) * degrees; }
|
||||||
|
|
||||||
// in miscfp.cc
|
// in miscfp.cc
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
double signum(double x);
|
double signum(double x);
|
||||||
double hypot3(double x, double y, double z);
|
double hypot3(double x, double y, double z);
|
||||||
double arctan_xy(double x, double y);
|
double arctan_xy(double x, double y);
|
||||||
|
|
||||||
double modulo_reduce(double x, double xmod, double xmin, double xmax);
|
double modulo_reduce(double x, double xmod, double xmin, double xmax);
|
||||||
|
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
void zero_C_array(int N, fp_t array[]);
|
void zero_C_array(int N, fp_t array[]);
|
||||||
|
|
||||||
// in error_exit.cc
|
// in error_exit.cc
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
int error_exit(int msg_level, const char *format, ...);
|
int error_exit(int msg_level, const char *format, ...);
|
||||||
|
|
||||||
// in norm.cc
|
// in norm.cc
|
||||||
//
|
//
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
class norm
|
class norm
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// get norms etc
|
// get norms etc
|
||||||
fp_t mean() const;
|
fp_t mean() const;
|
||||||
fp_t two_norm() const; // sqrt(sum x_i^2)
|
fp_t two_norm() const; // sqrt(sum x_i^2)
|
||||||
fp_t rms_norm() const; // sqrt(average of x_i^2)
|
fp_t rms_norm() const; // sqrt(average of x_i^2)
|
||||||
fp_t infinity_norm() const { return max_abs_value_; }
|
fp_t infinity_norm() const { return max_abs_value_; }
|
||||||
|
|
||||||
fp_t max_abs_value() const { return max_abs_value_; }
|
fp_t max_abs_value() const { return max_abs_value_; }
|
||||||
fp_t min_abs_value() const { return min_abs_value_; }
|
fp_t min_abs_value() const { return min_abs_value_; }
|
||||||
|
|
||||||
fp_t max_value() const { return max_value_; }
|
fp_t max_value() const { return max_value_; }
|
||||||
fp_t min_value() const { return min_value_; }
|
fp_t min_value() const { return min_value_; }
|
||||||
|
|
||||||
// specify data point
|
// specify data point
|
||||||
void data(fp_t x);
|
void data(fp_t x);
|
||||||
|
|
||||||
// have any data points been specified?
|
// have any data points been specified?
|
||||||
bool is_empty() const { return N_ == 0; }
|
bool is_empty() const { return N_ == 0; }
|
||||||
bool is_nonempty() const { return N_ > 0; }
|
bool is_nonempty() const { return N_ > 0; }
|
||||||
|
|
||||||
// reset ==> just like newly-constructed object
|
// reset ==> just like newly-constructed object
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
// constructor, destructor
|
// constructor, destructor
|
||||||
// ... compiler-generated no-op destructor is ok
|
// ... compiler-generated no-op destructor is ok
|
||||||
norm();
|
norm();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// we forbid copying and passing by value
|
// we forbid copying and passing by value
|
||||||
// by declaring the copy constructor and assignment operator
|
// by declaring the copy constructor and assignment operator
|
||||||
// private, but never defining them
|
// private, but never defining them
|
||||||
norm(const norm &rhs);
|
norm(const norm &rhs);
|
||||||
norm &operator=(const norm &rhs);
|
norm &operator=(const norm &rhs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
long N_; // # of data points
|
long N_; // # of data points
|
||||||
fp_t sum_; // sum(data)
|
fp_t sum_; // sum(data)
|
||||||
fp_t sum2_; // sum(data^2)
|
fp_t sum2_; // sum(data^2)
|
||||||
fp_t max_abs_value_; // max |data|
|
fp_t max_abs_value_; // max |data|
|
||||||
fp_t min_abs_value_; // min |data|
|
fp_t min_abs_value_; // min |data|
|
||||||
fp_t max_value_; // max data
|
fp_t max_value_; // max data
|
||||||
fp_t min_value_; // min data
|
fp_t min_value_; // min data
|
||||||
};
|
};
|
||||||
|
|
||||||
// in fuzzy.cc
|
// in fuzzy.cc
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
class fuzzy
|
class fuzzy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// comparison tolerance (may be modified by user code if needed)
|
// comparison tolerance (may be modified by user code if needed)
|
||||||
static fp_t get_tolerance() { return tolerance_; }
|
static fp_t get_tolerance() { return tolerance_; }
|
||||||
static void set_tolerance(fp_t new_tolerance)
|
static void set_tolerance(fp_t new_tolerance)
|
||||||
{
|
{
|
||||||
tolerance_ = new_tolerance;
|
tolerance_ = new_tolerance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fuzzy commparisons
|
// fuzzy commparisons
|
||||||
static bool EQ(fp_t x, fp_t y);
|
static bool EQ(fp_t x, fp_t y);
|
||||||
static bool NE(fp_t x, fp_t y) { return !EQ(x, y); }
|
static bool NE(fp_t x, fp_t y) { return !EQ(x, y); }
|
||||||
static bool LT(fp_t x, fp_t y) { return EQ(x, y) ? false : (x < y); }
|
static bool LT(fp_t x, fp_t y) { return EQ(x, y) ? false : (x < y); }
|
||||||
static bool LE(fp_t x, fp_t y) { return EQ(x, y) ? true : (x < y); }
|
static bool LE(fp_t x, fp_t y) { return EQ(x, y) ? true : (x < y); }
|
||||||
static bool GT(fp_t x, fp_t y) { return EQ(x, y) ? false : (x > y); }
|
static bool GT(fp_t x, fp_t y) { return EQ(x, y) ? false : (x > y); }
|
||||||
static bool GE(fp_t x, fp_t y) { return EQ(x, y) ? true : (x > y); }
|
static bool GE(fp_t x, fp_t y) { return EQ(x, y) ? true : (x > y); }
|
||||||
|
|
||||||
static bool is_integer(fp_t x); // is x fuzzily an integer?
|
static bool is_integer(fp_t x); // is x fuzzily an integer?
|
||||||
static int floor(fp_t x); // round x fuzzily down to integer
|
static int floor(fp_t x); // round x fuzzily down to integer
|
||||||
static int ceiling(fp_t x); // round x fuzzily up to integer
|
static int ceiling(fp_t x); // round x fuzzily up to integer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// comparison tolerance
|
// comparison tolerance
|
||||||
// ... must be explicitly initialized when instantiating
|
// ... must be explicitly initialized when instantiating
|
||||||
// for a new <fp_t> type, see "fuzzy.cc" for details/examples
|
// for a new <fp_t> type, see "fuzzy.cc" for details/examples
|
||||||
static fp_t tolerance_;
|
static fp_t tolerance_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// in round.cc
|
// in round.cc
|
||||||
template <typename fp_t>
|
template <typename fp_t>
|
||||||
class round
|
class round
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static int to_integer(fp_t x); // round to nearest integer
|
static int to_integer(fp_t x); // round to nearest integer
|
||||||
|
|
||||||
static int floor(fp_t x); // round down to integer
|
static int floor(fp_t x); // round down to integer
|
||||||
static int ceiling(fp_t x); // round up to integer
|
static int ceiling(fp_t x); // round up to integer
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace jtutil
|
} // namespace jtutil
|
||||||
} // namespace AHFinderDirect
|
} // namespace AHFinderDirect
|
||||||
|
|
||||||
#endif /* AHFINDERDIRECT__UTIL_HH */
|
#endif /* AHFINDERDIRECT__UTIL_HH */
|
||||||
@@ -1,45 +1,45 @@
|
|||||||
#ifndef _UTIL_STRING_H_
|
#ifndef _UTIL_STRING_H_
|
||||||
#define _UTIL_STRING_H_ 1
|
#define _UTIL_STRING_H_ 1
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Util_StrSep(const char **stringp,
|
const char *Util_StrSep(const char **stringp,
|
||||||
const char *delim);
|
const char *delim);
|
||||||
|
|
||||||
int Util_SplitString(char **before,
|
int Util_SplitString(char **before,
|
||||||
char **after,
|
char **after,
|
||||||
const char *string,
|
const char *string,
|
||||||
const char *sep);
|
const char *sep);
|
||||||
|
|
||||||
int Util_SplitFilename(char **dir,
|
int Util_SplitFilename(char **dir,
|
||||||
char **file,
|
char **file,
|
||||||
const char *string);
|
const char *string);
|
||||||
|
|
||||||
char *Util_Strdup(const char *s);
|
char *Util_Strdup(const char *s);
|
||||||
|
|
||||||
size_t Util_Strlcpy(char *dst, const char *src, size_t dst_size);
|
size_t Util_Strlcpy(char *dst, const char *src, size_t dst_size);
|
||||||
size_t Util_Strlcat(char *dst, const char *src, size_t dst_size);
|
size_t Util_Strlcat(char *dst, const char *src, size_t dst_size);
|
||||||
|
|
||||||
int Util_StrCmpi(const char *string1,
|
int Util_StrCmpi(const char *string1,
|
||||||
const char *string2);
|
const char *string2);
|
||||||
int Util_StrMemCmpi(const char *string1,
|
int Util_StrMemCmpi(const char *string1,
|
||||||
const char *string2,
|
const char *string2,
|
||||||
size_t len2);
|
size_t len2);
|
||||||
|
|
||||||
int Util_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
int Util_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
|
||||||
int Util_snprintf(char *str, size_t count, const char *fmt, ...);
|
int Util_snprintf(char *str, size_t count, const char *fmt, ...);
|
||||||
|
|
||||||
int Util_asprintf(char **buffer, const char *fmt, ...);
|
int Util_asprintf(char **buffer, const char *fmt, ...);
|
||||||
int Util_asnprintf(char **buffer, size_t size, const char *fmt, ...);
|
int Util_asnprintf(char **buffer, size_t size, const char *fmt, ...);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _UTIL_STRING_H_ */
|
#endif /* _UTIL_STRING_H_ */
|
||||||
@@ -1,496 +1,496 @@
|
|||||||
#ifndef _UTIL_TABLE_H_
|
#ifndef _UTIL_TABLE_H_
|
||||||
#define _UTIL_TABLE_H_ 1
|
#define _UTIL_TABLE_H_ 1
|
||||||
|
|
||||||
#include "cctk_Types.h"
|
#include "cctk_Types.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/***** Macros for Flags Word **************************************************/
|
/***** Macros for Flags Word **************************************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The hexadecimal forms are more convenient for thinking about
|
* The hexadecimal forms are more convenient for thinking about
|
||||||
* bitwise-oring, but alas Fortran 77 doesn't seem to support
|
* bitwise-oring, but alas Fortran 77 doesn't seem to support
|
||||||
* hexadecimal constants, so we give the actual values in decimal.
|
* hexadecimal constants, so we give the actual values in decimal.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_TABLE_FLAGS_DEFAULT
|
@defines UTIL_TABLE_FLAGS_DEFAULT
|
||||||
@desc flags-word macro: no flags set (default)
|
@desc flags-word macro: no flags set (default)
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_TABLE_FLAGS_DEFAULT 0
|
#define UTIL_TABLE_FLAGS_DEFAULT 0
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_TABLE_FLAGS_CASE_INSENSITIVE
|
@defines UTIL_TABLE_FLAGS_CASE_INSENSITIVE
|
||||||
@desc flags-word macro: key comparisons are case-insensitive
|
@desc flags-word macro: key comparisons are case-insensitive
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_TABLE_FLAGS_CASE_INSENSITIVE 1 /* 0x1 */
|
#define UTIL_TABLE_FLAGS_CASE_INSENSITIVE 1 /* 0x1 */
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_TABLE_FLAGS_USER_DEFINED_BASE
|
@defines UTIL_TABLE_FLAGS_USER_DEFINED_BASE
|
||||||
@desc flags-word macro: user-defined flags word bit masks
|
@desc flags-word macro: user-defined flags word bit masks
|
||||||
should use only this and higher bit positions (i.e.
|
should use only this and higher bit positions (i.e.
|
||||||
all bit positions below this one are reserved for
|
all bit positions below this one are reserved for
|
||||||
current or future Cactus use)
|
current or future Cactus use)
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_TABLE_FLAGS_USER_DEFINED_BASE 65536 /* 0x10000 */
|
#define UTIL_TABLE_FLAGS_USER_DEFINED_BASE 65536 /* 0x10000 */
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/***** Error Codes ************************************************************/
|
/***** Error Codes ************************************************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* error codes specific to the table routines (between -100 and -199)
|
* error codes specific to the table routines (between -100 and -199)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_ERROR_TABLE_BAD_FLAGS
|
@defines UTIL_ERROR_TABLE_BAD_FLAGS
|
||||||
@desc error return code: flags word is invalid
|
@desc error return code: flags word is invalid
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_ERROR_TABLE_BAD_FLAGS (-100)
|
#define UTIL_ERROR_TABLE_BAD_FLAGS (-100)
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_ERROR_TABLE_BAD_KEY
|
@defines UTIL_ERROR_TABLE_BAD_KEY
|
||||||
@desc error return code: key contains '/' character
|
@desc error return code: key contains '/' character
|
||||||
or is otherwise invalid
|
or is otherwise invalid
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_ERROR_TABLE_BAD_KEY (-101)
|
#define UTIL_ERROR_TABLE_BAD_KEY (-101)
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_ERROR_TABLE_STRING_TRUNCATED
|
@defines UTIL_ERROR_TABLE_STRING_TRUNCATED
|
||||||
@desc error return code: string was truncated to fit in buffer
|
@desc error return code: string was truncated to fit in buffer
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_ERROR_TABLE_STRING_TRUNCATED (-102)
|
#define UTIL_ERROR_TABLE_STRING_TRUNCATED (-102)
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_ERROR_TABLE_NO_SUCH_KEY
|
@defines UTIL_ERROR_TABLE_NO_SUCH_KEY
|
||||||
@desc error return code: no such key in table
|
@desc error return code: no such key in table
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_ERROR_TABLE_NO_SUCH_KEY (-103)
|
#define UTIL_ERROR_TABLE_NO_SUCH_KEY (-103)
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_ERROR_TABLE_WRONG_DATA_TYPE
|
@defines UTIL_ERROR_TABLE_WRONG_DATA_TYPE
|
||||||
@desc error return code: value associated with this key
|
@desc error return code: value associated with this key
|
||||||
has the wrong data type for this function
|
has the wrong data type for this function
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_ERROR_TABLE_WRONG_DATA_TYPE (-104)
|
#define UTIL_ERROR_TABLE_WRONG_DATA_TYPE (-104)
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_ERROR_TABLE_VALUE_IS_EMPTY
|
@defines UTIL_ERROR_TABLE_VALUE_IS_EMPTY
|
||||||
@desc error return code: value associated with this key
|
@desc error return code: value associated with this key
|
||||||
is an empty (0-element) array
|
is an empty (0-element) array
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_ERROR_TABLE_VALUE_IS_EMPTY (-105)
|
#define UTIL_ERROR_TABLE_VALUE_IS_EMPTY (-105)
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_ERROR_TABLE_ITERATOR_IS_NULL
|
@defines UTIL_ERROR_TABLE_ITERATOR_IS_NULL
|
||||||
@desc error return code: table iterator is in "null-pointer" state
|
@desc error return code: table iterator is in "null-pointer" state
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_ERROR_TABLE_ITERATOR_IS_NULL (-106)
|
#define UTIL_ERROR_TABLE_ITERATOR_IS_NULL (-106)
|
||||||
|
|
||||||
/*@@
|
/*@@
|
||||||
@defines UTIL_ERROR_TABLE_NO_MIXED_TYPE_ARRAY
|
@defines UTIL_ERROR_TABLE_NO_MIXED_TYPE_ARRAY
|
||||||
@desc error return code: different array values have different
|
@desc error return code: different array values have different
|
||||||
datatypes
|
datatypes
|
||||||
@@*/
|
@@*/
|
||||||
#define UTIL_ERROR_TABLE_NO_MIXED_TYPE_ARRAY (-107)
|
#define UTIL_ERROR_TABLE_NO_MIXED_TYPE_ARRAY (-107)
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/***** Main Table API *********************************************************/
|
/***** Main Table API *********************************************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/* create/destroy */
|
/* create/destroy */
|
||||||
int Util_TableCreate(int flags);
|
int Util_TableCreate(int flags);
|
||||||
int Util_TableClone(int handle);
|
int Util_TableClone(int handle);
|
||||||
int Util_TableDestroy(int handle);
|
int Util_TableDestroy(int handle);
|
||||||
|
|
||||||
/* query */
|
/* query */
|
||||||
int Util_TableQueryFlags(int handle);
|
int Util_TableQueryFlags(int handle);
|
||||||
int Util_TableQueryNKeys(int handle);
|
int Util_TableQueryNKeys(int handle);
|
||||||
int Util_TableQueryMaxKeyLength(int handle);
|
int Util_TableQueryMaxKeyLength(int handle);
|
||||||
int Util_TableQueryValueInfo(int handle,
|
int Util_TableQueryValueInfo(int handle,
|
||||||
CCTK_INT *type_code, CCTK_INT *N_elements,
|
CCTK_INT *type_code, CCTK_INT *N_elements,
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
/* misc stuff */
|
/* misc stuff */
|
||||||
int Util_TableDeleteKey(int handle, const char *key);
|
int Util_TableDeleteKey(int handle, const char *key);
|
||||||
|
|
||||||
/* convenience routines to create and/or set from a "parameter-file" string */
|
/* convenience routines to create and/or set from a "parameter-file" string */
|
||||||
int Util_TableCreateFromString(const char string[]);
|
int Util_TableCreateFromString(const char string[]);
|
||||||
int Util_TableSetFromString(int handle, const char string[]);
|
int Util_TableSetFromString(int handle, const char string[]);
|
||||||
|
|
||||||
/* set/get a C-style null-terminated character string */
|
/* set/get a C-style null-terminated character string */
|
||||||
int Util_TableSetString(int handle,
|
int Util_TableSetString(int handle,
|
||||||
const char *string,
|
const char *string,
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableGetString(int handle,
|
int Util_TableGetString(int handle,
|
||||||
int buffer_length, char buffer[],
|
int buffer_length, char buffer[],
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
/* set/get generic types described by CCTK_VARIABLE_* type codes */
|
/* set/get generic types described by CCTK_VARIABLE_* type codes */
|
||||||
int Util_TableSetGeneric(int handle,
|
int Util_TableSetGeneric(int handle,
|
||||||
int type_code, const void *value_ptr,
|
int type_code, const void *value_ptr,
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableSetGenericArray(int handle,
|
int Util_TableSetGenericArray(int handle,
|
||||||
int type_code, int N_elements, const void *array,
|
int type_code, int N_elements, const void *array,
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableGetGeneric(int handle,
|
int Util_TableGetGeneric(int handle,
|
||||||
int type_code, void *value_ptr,
|
int type_code, void *value_ptr,
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableGetGenericArray(int handle,
|
int Util_TableGetGenericArray(int handle,
|
||||||
int type_code, int N_elements, void *array,
|
int type_code, int N_elements, void *array,
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
/**************************************/
|
/**************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set routines
|
* set routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* pointers */
|
/* pointers */
|
||||||
int Util_TableSetPointer(int handle, CCTK_POINTER value, const char *key);
|
int Util_TableSetPointer(int handle, CCTK_POINTER value, const char *key);
|
||||||
int Util_TableSetPointerToConst(int handle,
|
int Util_TableSetPointerToConst(int handle,
|
||||||
CCTK_POINTER_TO_CONST value,
|
CCTK_POINTER_TO_CONST value,
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableSetFPointer(int handle, CCTK_FPOINTER value, const char *key);
|
int Util_TableSetFPointer(int handle, CCTK_FPOINTER value, const char *key);
|
||||||
/*
|
/*
|
||||||
* ... the following function (an alias for the previous one) is for
|
* ... the following function (an alias for the previous one) is for
|
||||||
* backwards compatability only, and is deprecated as of 4.0beta13
|
* backwards compatability only, and is deprecated as of 4.0beta13
|
||||||
*/
|
*/
|
||||||
int Util_TableSetFnPointer(int handle, CCTK_FPOINTER value, const char *key);
|
int Util_TableSetFnPointer(int handle, CCTK_FPOINTER value, const char *key);
|
||||||
|
|
||||||
/* a single character */
|
/* a single character */
|
||||||
int Util_TableSetChar(int handle, CCTK_CHAR value, const char *key);
|
int Util_TableSetChar(int handle, CCTK_CHAR value, const char *key);
|
||||||
|
|
||||||
/* integers */
|
/* integers */
|
||||||
int Util_TableSetByte(int handle, CCTK_BYTE value, const char *key);
|
int Util_TableSetByte(int handle, CCTK_BYTE value, const char *key);
|
||||||
int Util_TableSetInt(int handle, CCTK_INT value, const char *key);
|
int Util_TableSetInt(int handle, CCTK_INT value, const char *key);
|
||||||
#ifdef HAVE_CCTK_INT1
|
#ifdef HAVE_CCTK_INT1
|
||||||
int Util_TableSetInt1(int handle, CCTK_INT1 value, const char *key);
|
int Util_TableSetInt1(int handle, CCTK_INT1 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT2
|
#ifdef HAVE_CCTK_INT2
|
||||||
int Util_TableSetInt2(int handle, CCTK_INT2 value, const char *key);
|
int Util_TableSetInt2(int handle, CCTK_INT2 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT4
|
#ifdef HAVE_CCTK_INT4
|
||||||
int Util_TableSetInt4(int handle, CCTK_INT4 value, const char *key);
|
int Util_TableSetInt4(int handle, CCTK_INT4 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT8
|
#ifdef HAVE_CCTK_INT8
|
||||||
int Util_TableSetInt8(int handle, CCTK_INT8 value, const char *key);
|
int Util_TableSetInt8(int handle, CCTK_INT8 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* real numbers */
|
/* real numbers */
|
||||||
int Util_TableSetReal(int handle, CCTK_REAL value, const char *key);
|
int Util_TableSetReal(int handle, CCTK_REAL value, const char *key);
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
int Util_TableSetReal4(int handle, CCTK_REAL4 value, const char *key);
|
int Util_TableSetReal4(int handle, CCTK_REAL4 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
int Util_TableSetReal8(int handle, CCTK_REAL8 value, const char *key);
|
int Util_TableSetReal8(int handle, CCTK_REAL8 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
int Util_TableSetReal16(int handle, CCTK_REAL16 value, const char *key);
|
int Util_TableSetReal16(int handle, CCTK_REAL16 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* complex numbers */
|
/* complex numbers */
|
||||||
int Util_TableSetComplex(int handle, CCTK_COMPLEX value, const char *key);
|
int Util_TableSetComplex(int handle, CCTK_COMPLEX value, const char *key);
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
int Util_TableSetComplex8(int handle, CCTK_COMPLEX8 value, const char *key);
|
int Util_TableSetComplex8(int handle, CCTK_COMPLEX8 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
int Util_TableSetComplex16(int handle, CCTK_COMPLEX16 value, const char *key);
|
int Util_TableSetComplex16(int handle, CCTK_COMPLEX16 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
int Util_TableSetComplex32(int handle, CCTK_COMPLEX32 value, const char *key);
|
int Util_TableSetComplex32(int handle, CCTK_COMPLEX32 value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************/
|
/**************************************/
|
||||||
|
|
||||||
/* arrays of pointers */
|
/* arrays of pointers */
|
||||||
int Util_TableSetPointerArray(int handle,
|
int Util_TableSetPointerArray(int handle,
|
||||||
int N_elements, const CCTK_POINTER array[],
|
int N_elements, const CCTK_POINTER array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableSetPointerToConstArray(int handle,
|
int Util_TableSetPointerToConstArray(int handle,
|
||||||
int N_elements,
|
int N_elements,
|
||||||
const CCTK_POINTER_TO_CONST array[],
|
const CCTK_POINTER_TO_CONST array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableSetFPointerArray(int handle,
|
int Util_TableSetFPointerArray(int handle,
|
||||||
int N_elements, const CCTK_FPOINTER array[],
|
int N_elements, const CCTK_FPOINTER array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
/*
|
/*
|
||||||
* ... the following function (an alias for the previous one) is for
|
* ... the following function (an alias for the previous one) is for
|
||||||
* backwards compatability only, and is deprecated as of 4.0beta13
|
* backwards compatability only, and is deprecated as of 4.0beta13
|
||||||
*/
|
*/
|
||||||
int Util_TableSetFnPointerArray(int handle,
|
int Util_TableSetFnPointerArray(int handle,
|
||||||
int N_elements, const CCTK_FPOINTER array[],
|
int N_elements, const CCTK_FPOINTER array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
/* arrays of characters (i.e. character strings with known length) */
|
/* arrays of characters (i.e. character strings with known length) */
|
||||||
/* note null termination is *not* required or enforced */
|
/* note null termination is *not* required or enforced */
|
||||||
int Util_TableSetCharArray(int handle,
|
int Util_TableSetCharArray(int handle,
|
||||||
int N_elements, const CCTK_CHAR array[],
|
int N_elements, const CCTK_CHAR array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
/* arrays of integers */
|
/* arrays of integers */
|
||||||
int Util_TableSetByteArray(int handle,
|
int Util_TableSetByteArray(int handle,
|
||||||
int N_elements, const CCTK_BYTE array[],
|
int N_elements, const CCTK_BYTE array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableSetIntArray(int handle,
|
int Util_TableSetIntArray(int handle,
|
||||||
int N_elements, const CCTK_INT array[],
|
int N_elements, const CCTK_INT array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#ifdef HAVE_CCTK_INT1
|
#ifdef HAVE_CCTK_INT1
|
||||||
int Util_TableSetInt1Array(int handle,
|
int Util_TableSetInt1Array(int handle,
|
||||||
int N_elements, const CCTK_INT1 array[],
|
int N_elements, const CCTK_INT1 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT2
|
#ifdef HAVE_CCTK_INT2
|
||||||
int Util_TableSetInt2Array(int handle,
|
int Util_TableSetInt2Array(int handle,
|
||||||
int N_elements, const CCTK_INT2 array[],
|
int N_elements, const CCTK_INT2 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT4
|
#ifdef HAVE_CCTK_INT4
|
||||||
int Util_TableSetInt4Array(int handle,
|
int Util_TableSetInt4Array(int handle,
|
||||||
int N_elements, const CCTK_INT4 array[],
|
int N_elements, const CCTK_INT4 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT8
|
#ifdef HAVE_CCTK_INT8
|
||||||
int Util_TableSetInt8Array(int handle,
|
int Util_TableSetInt8Array(int handle,
|
||||||
int N_elements, const CCTK_INT8 array[],
|
int N_elements, const CCTK_INT8 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* arrays of real numbers */
|
/* arrays of real numbers */
|
||||||
int Util_TableSetRealArray(int handle,
|
int Util_TableSetRealArray(int handle,
|
||||||
int N_elements, const CCTK_REAL array[],
|
int N_elements, const CCTK_REAL array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
int Util_TableSetReal4Array(int handle,
|
int Util_TableSetReal4Array(int handle,
|
||||||
int N_elements, const CCTK_REAL4 array[],
|
int N_elements, const CCTK_REAL4 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
int Util_TableSetReal8Array(int handle,
|
int Util_TableSetReal8Array(int handle,
|
||||||
int N_elements, const CCTK_REAL8 array[],
|
int N_elements, const CCTK_REAL8 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
int Util_TableSetReal16Array(int handle,
|
int Util_TableSetReal16Array(int handle,
|
||||||
int N_elements, const CCTK_REAL16 array[],
|
int N_elements, const CCTK_REAL16 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* arrays of complex numbers */
|
/* arrays of complex numbers */
|
||||||
int Util_TableSetComplexArray(int handle,
|
int Util_TableSetComplexArray(int handle,
|
||||||
int N_elements, const CCTK_COMPLEX array[],
|
int N_elements, const CCTK_COMPLEX array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
int Util_TableSetComplex8Array(int handle,
|
int Util_TableSetComplex8Array(int handle,
|
||||||
int N_elements, const CCTK_COMPLEX8 array[],
|
int N_elements, const CCTK_COMPLEX8 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
int Util_TableSetComplex16Array(int handle,
|
int Util_TableSetComplex16Array(int handle,
|
||||||
int N_elements, const CCTK_COMPLEX16 array[],
|
int N_elements, const CCTK_COMPLEX16 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
int Util_TableSetComplex32Array(int handle,
|
int Util_TableSetComplex32Array(int handle,
|
||||||
int N_elements, const CCTK_COMPLEX32 array[],
|
int N_elements, const CCTK_COMPLEX32 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************/
|
/**************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get routines
|
* get routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* pointers */
|
/* pointers */
|
||||||
int Util_TableGetPointer(int handle, CCTK_POINTER *value, const char *key);
|
int Util_TableGetPointer(int handle, CCTK_POINTER *value, const char *key);
|
||||||
int Util_TableGetPointerToConst(int handle,
|
int Util_TableGetPointerToConst(int handle,
|
||||||
CCTK_POINTER_TO_CONST *value,
|
CCTK_POINTER_TO_CONST *value,
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
int Util_TableGetFPointer(int handle, CCTK_FPOINTER *value, const char *key);
|
int Util_TableGetFPointer(int handle, CCTK_FPOINTER *value, const char *key);
|
||||||
/*
|
/*
|
||||||
* ... the following function (an alias for the previous one) is for
|
* ... the following function (an alias for the previous one) is for
|
||||||
* backwards compatability only, and is deprecated as of 4.0beta13
|
* backwards compatability only, and is deprecated as of 4.0beta13
|
||||||
*/
|
*/
|
||||||
int Util_TableGetFnPointer(int handle, CCTK_FPOINTER *value, const char *key);
|
int Util_TableGetFnPointer(int handle, CCTK_FPOINTER *value, const char *key);
|
||||||
|
|
||||||
/* a single character */
|
/* a single character */
|
||||||
int Util_TableGetChar(int handle, CCTK_CHAR *value, const char *key);
|
int Util_TableGetChar(int handle, CCTK_CHAR *value, const char *key);
|
||||||
|
|
||||||
/* integers */
|
/* integers */
|
||||||
int Util_TableGetByte(int handle, CCTK_BYTE *value, const char *key);
|
int Util_TableGetByte(int handle, CCTK_BYTE *value, const char *key);
|
||||||
int Util_TableGetInt(int handle, CCTK_INT *value, const char *key);
|
int Util_TableGetInt(int handle, CCTK_INT *value, const char *key);
|
||||||
#ifdef HAVE_CCTK_INT1
|
#ifdef HAVE_CCTK_INT1
|
||||||
int Util_TableGetInt1(int handle, CCTK_INT1 *value, const char *key);
|
int Util_TableGetInt1(int handle, CCTK_INT1 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT2
|
#ifdef HAVE_CCTK_INT2
|
||||||
int Util_TableGetInt2(int handle, CCTK_INT2 *value, const char *key);
|
int Util_TableGetInt2(int handle, CCTK_INT2 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT4
|
#ifdef HAVE_CCTK_INT4
|
||||||
int Util_TableGetInt4(int handle, CCTK_INT4 *value, const char *key);
|
int Util_TableGetInt4(int handle, CCTK_INT4 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT8
|
#ifdef HAVE_CCTK_INT8
|
||||||
int Util_TableGetInt8(int handle, CCTK_INT8 *value, const char *key);
|
int Util_TableGetInt8(int handle, CCTK_INT8 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* real numbers */
|
/* real numbers */
|
||||||
int Util_TableGetReal(int handle, CCTK_REAL *value, const char *key);
|
int Util_TableGetReal(int handle, CCTK_REAL *value, const char *key);
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
int Util_TableGetReal4(int handle, CCTK_REAL4 *value, const char *key);
|
int Util_TableGetReal4(int handle, CCTK_REAL4 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
int Util_TableGetReal8(int handle, CCTK_REAL8 *value, const char *key);
|
int Util_TableGetReal8(int handle, CCTK_REAL8 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
int Util_TableGetReal16(int handle, CCTK_REAL16 *value, const char *key);
|
int Util_TableGetReal16(int handle, CCTK_REAL16 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* complex numbers */
|
/* complex numbers */
|
||||||
int Util_TableGetComplex(int handle, CCTK_COMPLEX *value, const char *key);
|
int Util_TableGetComplex(int handle, CCTK_COMPLEX *value, const char *key);
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
int Util_TableGetComplex8(int handle, CCTK_COMPLEX8 *value, const char *key);
|
int Util_TableGetComplex8(int handle, CCTK_COMPLEX8 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
int Util_TableGetComplex16(int handle, CCTK_COMPLEX16 *value, const char *key);
|
int Util_TableGetComplex16(int handle, CCTK_COMPLEX16 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
int Util_TableGetComplex32(int handle, CCTK_COMPLEX32 *value, const char *key);
|
int Util_TableGetComplex32(int handle, CCTK_COMPLEX32 *value, const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************/
|
/**************************************/
|
||||||
|
|
||||||
/* arrays of pointers */
|
/* arrays of pointers */
|
||||||
int Util_TableGetPointerArray(int handle,
|
int Util_TableGetPointerArray(int handle,
|
||||||
int N_elements, CCTK_POINTER array[],
|
int N_elements, CCTK_POINTER array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableGetPointerToConstArray(int handle,
|
int Util_TableGetPointerToConstArray(int handle,
|
||||||
int N_elements,
|
int N_elements,
|
||||||
CCTK_POINTER_TO_CONST array[],
|
CCTK_POINTER_TO_CONST array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
int Util_TableGetFPointerArray(int handle,
|
int Util_TableGetFPointerArray(int handle,
|
||||||
int N_elements, CCTK_FPOINTER array[],
|
int N_elements, CCTK_FPOINTER array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
/*
|
/*
|
||||||
* ... the following function (an alias for the previous one) is for
|
* ... the following function (an alias for the previous one) is for
|
||||||
* backwards compatability only, and is deprecated as of 4.0beta13
|
* backwards compatability only, and is deprecated as of 4.0beta13
|
||||||
*/
|
*/
|
||||||
int Util_TableGetFnPointerArray(int handle,
|
int Util_TableGetFnPointerArray(int handle,
|
||||||
int N_elements, CCTK_FPOINTER array[],
|
int N_elements, CCTK_FPOINTER array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
/* arrays of characters (i.e. character strings of known length) */
|
/* arrays of characters (i.e. character strings of known length) */
|
||||||
/* note null termination is *not* required or enforced */
|
/* note null termination is *not* required or enforced */
|
||||||
int Util_TableGetCharArray(int handle,
|
int Util_TableGetCharArray(int handle,
|
||||||
int N_elements, CCTK_CHAR array[],
|
int N_elements, CCTK_CHAR array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
/* integers */
|
/* integers */
|
||||||
int Util_TableGetByteArray(int handle,
|
int Util_TableGetByteArray(int handle,
|
||||||
int N_elements, CCTK_BYTE array[],
|
int N_elements, CCTK_BYTE array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
int Util_TableGetIntArray(int handle,
|
int Util_TableGetIntArray(int handle,
|
||||||
int N_elements, CCTK_INT array[],
|
int N_elements, CCTK_INT array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#ifdef HAVE_CCTK_INT1
|
#ifdef HAVE_CCTK_INT1
|
||||||
int Util_TableGetInt1Array(int handle,
|
int Util_TableGetInt1Array(int handle,
|
||||||
int N_elements, CCTK_INT1 array[],
|
int N_elements, CCTK_INT1 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT2
|
#ifdef HAVE_CCTK_INT2
|
||||||
int Util_TableGetInt2Array(int handle,
|
int Util_TableGetInt2Array(int handle,
|
||||||
int N_elements, CCTK_INT2 array[],
|
int N_elements, CCTK_INT2 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT4
|
#ifdef HAVE_CCTK_INT4
|
||||||
int Util_TableGetInt4Array(int handle,
|
int Util_TableGetInt4Array(int handle,
|
||||||
int N_elements, CCTK_INT4 array[],
|
int N_elements, CCTK_INT4 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_INT8
|
#ifdef HAVE_CCTK_INT8
|
||||||
int Util_TableGetInt8Array(int handle,
|
int Util_TableGetInt8Array(int handle,
|
||||||
int N_elements, CCTK_INT8 array[],
|
int N_elements, CCTK_INT8 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* real numbers */
|
/* real numbers */
|
||||||
int Util_TableGetRealArray(int handle,
|
int Util_TableGetRealArray(int handle,
|
||||||
int N_elements, CCTK_REAL array[],
|
int N_elements, CCTK_REAL array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
int Util_TableGetReal4Array(int handle,
|
int Util_TableGetReal4Array(int handle,
|
||||||
int N_elements, CCTK_REAL4 array[],
|
int N_elements, CCTK_REAL4 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
int Util_TableGetReal8Array(int handle,
|
int Util_TableGetReal8Array(int handle,
|
||||||
int N_elements, CCTK_REAL8 array[],
|
int N_elements, CCTK_REAL8 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
int Util_TableGetReal16Array(int handle,
|
int Util_TableGetReal16Array(int handle,
|
||||||
int N_elements, CCTK_REAL16 array[],
|
int N_elements, CCTK_REAL16 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* complex numbers */
|
/* complex numbers */
|
||||||
int Util_TableGetComplexArray(int handle,
|
int Util_TableGetComplexArray(int handle,
|
||||||
int N_elements, CCTK_COMPLEX array[],
|
int N_elements, CCTK_COMPLEX array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#ifdef HAVE_CCTK_REAL4
|
#ifdef HAVE_CCTK_REAL4
|
||||||
int Util_TableGetComplex8Array(int handle,
|
int Util_TableGetComplex8Array(int handle,
|
||||||
int N_elements, CCTK_COMPLEX8 array[],
|
int N_elements, CCTK_COMPLEX8 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL8
|
#ifdef HAVE_CCTK_REAL8
|
||||||
int Util_TableGetComplex16Array(int handle,
|
int Util_TableGetComplex16Array(int handle,
|
||||||
int N_elements, CCTK_COMPLEX16 array[],
|
int N_elements, CCTK_COMPLEX16 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_CCTK_REAL16
|
#ifdef HAVE_CCTK_REAL16
|
||||||
int Util_TableGetComplex32Array(int handle,
|
int Util_TableGetComplex32Array(int handle,
|
||||||
int N_elements, CCTK_COMPLEX32 array[],
|
int N_elements, CCTK_COMPLEX32 array[],
|
||||||
const char *key);
|
const char *key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/***** Table Iterator API *****************************************************/
|
/***** Table Iterator API *****************************************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
/* create/destroy */
|
/* create/destroy */
|
||||||
int Util_TableItCreate(int handle);
|
int Util_TableItCreate(int handle);
|
||||||
int Util_TableItClone(int ihandle);
|
int Util_TableItClone(int ihandle);
|
||||||
int Util_TableItDestroy(int ihandle);
|
int Util_TableItDestroy(int ihandle);
|
||||||
|
|
||||||
/* test for "null-pointer" state */
|
/* test for "null-pointer" state */
|
||||||
int Util_TableItQueryIsNull(int ihandle);
|
int Util_TableItQueryIsNull(int ihandle);
|
||||||
int Util_TableItQueryIsNonNull(int ihandle);
|
int Util_TableItQueryIsNonNull(int ihandle);
|
||||||
|
|
||||||
/* query what the iterator points to */
|
/* query what the iterator points to */
|
||||||
int Util_TableItQueryTableHandle(int ihandle);
|
int Util_TableItQueryTableHandle(int ihandle);
|
||||||
int Util_TableItQueryKeyValueInfo(int ihandle,
|
int Util_TableItQueryKeyValueInfo(int ihandle,
|
||||||
int key_buffer_length, char key_buffer[],
|
int key_buffer_length, char key_buffer[],
|
||||||
CCTK_INT *type_code, CCTK_INT *N_elements);
|
CCTK_INT *type_code, CCTK_INT *N_elements);
|
||||||
|
|
||||||
/* change value of iterator */
|
/* change value of iterator */
|
||||||
int Util_TableItAdvance(int ihandle);
|
int Util_TableItAdvance(int ihandle);
|
||||||
int Util_TableItResetToStart(int ihandle);
|
int Util_TableItResetToStart(int ihandle);
|
||||||
int Util_TableItSetToNull(int ihandle);
|
int Util_TableItSetToNull(int ihandle);
|
||||||
int Util_TableItSetToKey(int ihandle, const char *key);
|
int Util_TableItSetToKey(int ihandle, const char *key);
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _UTIL_TABLE_H_ */
|
#endif /* _UTIL_TABLE_H_ */
|
||||||
@@ -1,382 +1,382 @@
|
|||||||
|
|
||||||
!-------------------------------------------------------------------------------!
|
!-------------------------------------------------------------------------------!
|
||||||
! computed constraint for ADM formalism !
|
! computed constraint for ADM formalism !
|
||||||
!-------------------------------------------------------------------------------!
|
!-------------------------------------------------------------------------------!
|
||||||
subroutine constraint_adm(ex, X, Y, Z,&
|
subroutine constraint_adm(ex, X, Y, Z,&
|
||||||
dxx,gxy,gxz,dyy,gyz,dzz, &
|
dxx,gxy,gxz,dyy,gyz,dzz, &
|
||||||
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz, &
|
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz, &
|
||||||
Lap,Sfx,Sfy,Sfz,rho,Sx,Sy,Sz,&
|
Lap,Sfx,Sfy,Sfz,rho,Sx,Sy,Sz,&
|
||||||
ham_Res, movx_Res, movy_Res, movz_Res, &
|
ham_Res, movx_Res, movy_Res, movz_Res, &
|
||||||
Symmetry)
|
Symmetry)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
!~~~~~~> Input parameters:
|
!~~~~~~> Input parameters:
|
||||||
|
|
||||||
integer,intent(in ):: ex(1:3),symmetry
|
integer,intent(in ):: ex(1:3),symmetry
|
||||||
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Lap,Sfx,Sfy,Sfz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Lap,Sfx,Sfy,Sfz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: rho,Sx,Sy,Sz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: rho,Sx,Sy,Sz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: ham_Res, movx_Res, movy_Res, movz_Res
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: ham_Res, movx_Res, movy_Res, movz_Res
|
||||||
!~~~~~~> Other variables:
|
!~~~~~~> Other variables:
|
||||||
! inverse metric
|
! inverse metric
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
||||||
! first order derivative of metric, @_k g_ij
|
! first order derivative of metric, @_k g_ij
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyx,gyzx,gzzx
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyx,gyzx,gzzx
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyy,gyzy,gzzy
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyy,gyzy,gzzy
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyz,gyzz,gzzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyz,gyzz,gzzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,trK,fx,fy,fz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,trK,fx,fy,fz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamxxx, Gamxxy, Gamxxz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamxxx, Gamxxy, Gamxxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamxyy, Gamxyz, Gamxzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamxyy, Gamxyz, Gamxzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamyxx, Gamyxy, Gamyxz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamyxx, Gamyxy, Gamyxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamyyy, Gamyyz, Gamyzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamyyy, Gamyyz, Gamyzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamzxx, Gamzxy, Gamzxz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamzxx, Gamzxy, Gamzxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamzyy, Gamzyz, Gamzzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: Gamzyy, Gamzyz, Gamzzz
|
||||||
|
|
||||||
integer, parameter :: NO_SYMM = 0, EQUATORIAL = 1, OCTANT = 2
|
integer, parameter :: NO_SYMM = 0, EQUATORIAL = 1, OCTANT = 2
|
||||||
real*8, parameter :: ZERO = 0.D0, HALF = 0.5d0, ONE = 1.d0, TWO = 2.d0, FOUR = 4.d0
|
real*8, parameter :: ZERO = 0.D0, HALF = 0.5d0, ONE = 1.d0, TWO = 2.d0, FOUR = 4.d0
|
||||||
real*8, parameter :: F2o3 = 2.d0/3.d0, F8 = 8.d0, F16 = 1.6d1, SIX = 6.d0
|
real*8, parameter :: F2o3 = 2.d0/3.d0, F8 = 8.d0, F16 = 1.6d1, SIX = 6.d0
|
||||||
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
|
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
|
||||||
real*8 :: PI
|
real*8 :: PI
|
||||||
|
|
||||||
call adm_ricci_gamma(ex, X, Y, Z, &
|
call adm_ricci_gamma(ex, X, Y, Z, &
|
||||||
dxx , gxy , gxz , dyy , gyz , dzz,&
|
dxx , gxy , gxz , dyy , gyz , dzz,&
|
||||||
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
|
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
|
||||||
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
|
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
|
||||||
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
|
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
|
||||||
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
|
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
|
||||||
Symmetry)
|
Symmetry)
|
||||||
|
|
||||||
PI = dacos(-ONE)
|
PI = dacos(-ONE)
|
||||||
|
|
||||||
gxx = dxx + ONE
|
gxx = dxx + ONE
|
||||||
gyy = dyy + ONE
|
gyy = dyy + ONE
|
||||||
gzz = dzz + ONE
|
gzz = dzz + ONE
|
||||||
! invert metric
|
! invert metric
|
||||||
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
||||||
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
||||||
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
||||||
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
||||||
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
||||||
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
||||||
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
||||||
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
||||||
|
|
||||||
trK = gupxx * Kxx + gupyy * Kyy + gupzz * Kzz &
|
trK = gupxx * Kxx + gupyy * Kyy + gupzz * Kzz &
|
||||||
+ TWO * (gupxy * Kxy + gupxz * Kxz + gupyz * Kyz)
|
+ TWO * (gupxy * Kxy + gupxz * Kxz + gupyz * Kyz)
|
||||||
|
|
||||||
! ham_Res = trR + K^2 - K_ij * K^ij - 16 * PI * rho
|
! ham_Res = trR + K^2 - K_ij * K^ij - 16 * PI * rho
|
||||||
ham_Res = gupxx * Rxx + gupyy * Ryy + gupzz * Rzz + &
|
ham_Res = gupxx * Rxx + gupyy * Ryy + gupzz * Rzz + &
|
||||||
TWO* ( gupxy * Rxy + gupxz * Rxz + gupyz * Ryz )
|
TWO* ( gupxy * Rxy + gupxz * Rxz + gupyz * Ryz )
|
||||||
|
|
||||||
ham_Res = ham_Res + trK * trK -(&
|
ham_Res = ham_Res + trK * trK -(&
|
||||||
gupxx * ( &
|
gupxx * ( &
|
||||||
gupxx * Kxx * Kxx + gupyy * Kxy * Kxy + gupzz * Kxz * Kxz + &
|
gupxx * Kxx * Kxx + gupyy * Kxy * Kxy + gupzz * Kxz * Kxz + &
|
||||||
TWO * (gupxy * Kxx * Kxy + gupxz * Kxx * Kxz + gupyz * Kxy * Kxz) ) + &
|
TWO * (gupxy * Kxx * Kxy + gupxz * Kxx * Kxz + gupyz * Kxy * Kxz) ) + &
|
||||||
gupyy * ( &
|
gupyy * ( &
|
||||||
gupxx * Kxy * Kxy + gupyy * Kyy * Kyy + gupzz * Kyz * Kyz + &
|
gupxx * Kxy * Kxy + gupyy * Kyy * Kyy + gupzz * Kyz * Kyz + &
|
||||||
TWO * (gupxy * Kxy * Kyy + gupxz * Kxy * Kyz + gupyz * Kyy * Kyz) ) + &
|
TWO * (gupxy * Kxy * Kyy + gupxz * Kxy * Kyz + gupyz * Kyy * Kyz) ) + &
|
||||||
gupzz * ( &
|
gupzz * ( &
|
||||||
gupxx * Kxz * Kxz + gupyy * Kyz * Kyz + gupzz * Kzz * Kzz + &
|
gupxx * Kxz * Kxz + gupyy * Kyz * Kyz + gupzz * Kzz * Kzz + &
|
||||||
TWO * (gupxy * Kxz * Kyz + gupxz * Kxz * Kzz + gupyz * Kyz * Kzz) ) + &
|
TWO * (gupxy * Kxz * Kyz + gupxz * Kxz * Kzz + gupyz * Kyz * Kzz) ) + &
|
||||||
TWO * ( &
|
TWO * ( &
|
||||||
gupxy * ( &
|
gupxy * ( &
|
||||||
gupxx * Kxx * Kxy + gupyy * Kxy * Kyy + gupzz * Kxz * Kyz + &
|
gupxx * Kxx * Kxy + gupyy * Kxy * Kyy + gupzz * Kxz * Kyz + &
|
||||||
gupxy * (Kxx * Kyy + Kxy * Kxy) + &
|
gupxy * (Kxx * Kyy + Kxy * Kxy) + &
|
||||||
gupxz * (Kxx * Kyz + Kxz * Kxy) + &
|
gupxz * (Kxx * Kyz + Kxz * Kxy) + &
|
||||||
gupyz * (Kxy * Kyz + Kxz * Kyy) ) + &
|
gupyz * (Kxy * Kyz + Kxz * Kyy) ) + &
|
||||||
gupxz * ( &
|
gupxz * ( &
|
||||||
gupxx * Kxx * Kxz + gupyy * Kxy * Kyz + gupzz * Kxz * Kzz + &
|
gupxx * Kxx * Kxz + gupyy * Kxy * Kyz + gupzz * Kxz * Kzz + &
|
||||||
gupxy * (Kxx * Kyz + Kxy * Kxz) + &
|
gupxy * (Kxx * Kyz + Kxy * Kxz) + &
|
||||||
gupxz * (Kxx * Kzz + Kxz * Kxz) + &
|
gupxz * (Kxx * Kzz + Kxz * Kxz) + &
|
||||||
gupyz * (Kxy * Kzz + Kxz * Kyz) ) + &
|
gupyz * (Kxy * Kzz + Kxz * Kyz) ) + &
|
||||||
gupyz * ( &
|
gupyz * ( &
|
||||||
gupxx * Kxy * Kxz + gupyy * Kyy * Kyz + gupzz * Kyz * Kzz + &
|
gupxx * Kxy * Kxz + gupyy * Kyy * Kyz + gupzz * Kyz * Kzz + &
|
||||||
gupxy * (Kxy * Kyz + Kyy * Kxz) + &
|
gupxy * (Kxy * Kyz + Kyy * Kxz) + &
|
||||||
gupxz * (Kxy * Kzz + Kyz * Kxz) + &
|
gupxz * (Kxy * Kzz + Kyz * Kxz) + &
|
||||||
gupyz * (Kyy * Kzz + Kyz * Kyz) ) ))- F16 * PI * rho
|
gupyz * (Kyy * Kzz + Kyz * Kyz) ) ))- F16 * PI * rho
|
||||||
|
|
||||||
! mov_Res_j = gupkj*D_k K_ij - d_j trK - 8 PI s_j where D respect to physical metric
|
! mov_Res_j = gupkj*D_k K_ij - d_j trK - 8 PI s_j where D respect to physical metric
|
||||||
! store D_i K_jk
|
! store D_i K_jk
|
||||||
call fderivs(ex,Kxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
|
call fderivs(ex,Kxx,gxxx,gxxy,gxxz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
|
||||||
call fderivs(ex,Kxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0)
|
call fderivs(ex,Kxy,gxyx,gxyy,gxyz,X,Y,Z,ANTI,ANTI,SYM ,Symmetry,0)
|
||||||
call fderivs(ex,Kxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0)
|
call fderivs(ex,Kxz,gxzx,gxzy,gxzz,X,Y,Z,ANTI,SYM ,ANTI,Symmetry,0)
|
||||||
call fderivs(ex,Kyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
|
call fderivs(ex,Kyy,gyyx,gyyy,gyyz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
|
||||||
call fderivs(ex,Kyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0)
|
call fderivs(ex,Kyz,gyzx,gyzy,gyzz,X,Y,Z,SYM ,ANTI,ANTI,Symmetry,0)
|
||||||
call fderivs(ex,Kzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
|
call fderivs(ex,Kzz,gzzx,gzzy,gzzz,X,Y,Z,SYM ,SYM ,SYM ,Symmetry,0)
|
||||||
|
|
||||||
gxxx = gxxx - ( Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz &
|
gxxx = gxxx - ( Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz &
|
||||||
+ Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz)
|
+ Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz)
|
||||||
gxyx = gxyx - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
|
gxyx = gxyx - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
|
||||||
+ Gamxxx * Kxy + Gamyxx * Kyy + Gamzxx * Kyz)
|
+ Gamxxx * Kxy + Gamyxx * Kyy + Gamzxx * Kyz)
|
||||||
gxzx = gxzx - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
|
gxzx = gxzx - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
|
||||||
+ Gamxxx * Kxz + Gamyxx * Kyz + Gamzxx * Kzz)
|
+ Gamxxx * Kxz + Gamyxx * Kyz + Gamzxx * Kzz)
|
||||||
gyyx = gyyx - ( Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz &
|
gyyx = gyyx - ( Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz &
|
||||||
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
|
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
|
||||||
gyzx = gyzx - ( Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz &
|
gyzx = gyzx - ( Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz &
|
||||||
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
|
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
|
||||||
gzzx = gzzx - ( Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz &
|
gzzx = gzzx - ( Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz &
|
||||||
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
|
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
|
||||||
gxxy = gxxy - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
|
gxxy = gxxy - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
|
||||||
+ Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz)
|
+ Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz)
|
||||||
gxyy = gxyy - ( Gamxyy * Kxx + Gamyyy * Kxy + Gamzyy * Kxz &
|
gxyy = gxyy - ( Gamxyy * Kxx + Gamyyy * Kxy + Gamzyy * Kxz &
|
||||||
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
|
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
|
||||||
gxzy = gxzy - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
|
gxzy = gxzy - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
|
||||||
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
|
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
|
||||||
gyyy = gyyy - ( Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz &
|
gyyy = gyyy - ( Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz &
|
||||||
+ Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz)
|
+ Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz)
|
||||||
gyzy = gyzy - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
|
gyzy = gyzy - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
|
||||||
+ Gamxyy * Kxz + Gamyyy * Kyz + Gamzyy * Kzz)
|
+ Gamxyy * Kxz + Gamyyy * Kyz + Gamzyy * Kzz)
|
||||||
gzzy = gzzy - ( Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz &
|
gzzy = gzzy - ( Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz &
|
||||||
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
|
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
|
||||||
gxxz = gxxz - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
|
gxxz = gxxz - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
|
||||||
+ Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz)
|
+ Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz)
|
||||||
gxyz = gxyz - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
|
gxyz = gxyz - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
|
||||||
+ Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz)
|
+ Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz)
|
||||||
gxzz = gxzz - ( Gamxzz * Kxx + Gamyzz * Kxy + Gamzzz * Kxz &
|
gxzz = gxzz - ( Gamxzz * Kxx + Gamyzz * Kxy + Gamzzz * Kxz &
|
||||||
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
|
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
|
||||||
gyyz = gyyz - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
|
gyyz = gyyz - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
|
||||||
+ Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz)
|
+ Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz)
|
||||||
gyzz = gyzz - ( Gamxzz * Kxy + Gamyzz * Kyy + Gamzzz * Kyz &
|
gyzz = gyzz - ( Gamxzz * Kxy + Gamyzz * Kyy + Gamzzz * Kyz &
|
||||||
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
|
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
|
||||||
gzzz = gzzz - ( Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz &
|
gzzz = gzzz - ( Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz &
|
||||||
+ Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz)
|
+ Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz)
|
||||||
movx_Res = gupxx*gxxx + gupyy*gxyy + gupzz*gxzz &
|
movx_Res = gupxx*gxxx + gupyy*gxyy + gupzz*gxzz &
|
||||||
+gupxy*gxyx + gupxz*gxzx + gupyz*gxzy &
|
+gupxy*gxyx + gupxz*gxzx + gupyz*gxzy &
|
||||||
+gupxy*gxxy + gupxz*gxxz + gupyz*gxyz
|
+gupxy*gxxy + gupxz*gxxz + gupyz*gxyz
|
||||||
movy_Res = gupxx*gxyx + gupyy*gyyy + gupzz*gyzz &
|
movy_Res = gupxx*gxyx + gupyy*gyyy + gupzz*gyzz &
|
||||||
+gupxy*gyyx + gupxz*gyzx + gupyz*gyzy &
|
+gupxy*gyyx + gupxz*gyzx + gupyz*gyzy &
|
||||||
+gupxy*gxyy + gupxz*gxyz + gupyz*gyyz
|
+gupxy*gxyy + gupxz*gxyz + gupyz*gyyz
|
||||||
movz_Res = gupxx*gxzx + gupyy*gyzy + gupzz*gzzz &
|
movz_Res = gupxx*gxzx + gupyy*gyzy + gupzz*gzzz &
|
||||||
+gupxy*gyzx + gupxz*gzzx + gupyz*gzzy &
|
+gupxy*gyzx + gupxz*gzzx + gupyz*gzzy &
|
||||||
+gupxy*gxzy + gupxz*gxzz + gupyz*gyzz
|
+gupxy*gxzy + gupxz*gxzz + gupyz*gyzz
|
||||||
|
|
||||||
call fderivs(ex,trK,fx,fy,fz,X,Y,Z,SYM,SYM,SYM,Symmetry,0)
|
call fderivs(ex,trK,fx,fy,fz,X,Y,Z,SYM,SYM,SYM,Symmetry,0)
|
||||||
|
|
||||||
movx_Res = movx_Res - fx - F8*PI*sx
|
movx_Res = movx_Res - fx - F8*PI*sx
|
||||||
movy_Res = movy_Res - fy - F8*PI*sy
|
movy_Res = movy_Res - fy - F8*PI*sy
|
||||||
movz_Res = movz_Res - fz - F8*PI*sz
|
movz_Res = movz_Res - fz - F8*PI*sz
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine constraint_adm
|
end subroutine constraint_adm
|
||||||
!-------------------------------------------------------------------------------!
|
!-------------------------------------------------------------------------------!
|
||||||
! computed constraint for ADM formalism for shell !
|
! computed constraint for ADM formalism for shell !
|
||||||
!-------------------------------------------------------------------------------!
|
!-------------------------------------------------------------------------------!
|
||||||
subroutine constraint_adm_ss(ex,crho,sigma,R, X, Y, Z,&
|
subroutine constraint_adm_ss(ex,crho,sigma,R, X, Y, Z,&
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz, &
|
dRdx,dRdy,dRdz, &
|
||||||
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
|
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
|
||||||
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
|
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
|
||||||
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
|
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
|
||||||
dxx,gxy,gxz,dyy,gyz,dzz, &
|
dxx,gxy,gxz,dyy,gyz,dzz, &
|
||||||
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz, &
|
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz, &
|
||||||
Lap,Sfx,Sfy,Sfz,rho,Sx,Sy,Sz,&
|
Lap,Sfx,Sfy,Sfz,rho,Sx,Sy,Sz,&
|
||||||
Gamxxx, Gamxxy, Gamxxz,Gamxyy, Gamxyz, Gamxzz, &
|
Gamxxx, Gamxxy, Gamxxz,Gamxyy, Gamxyz, Gamxzz, &
|
||||||
Gamyxx, Gamyxy, Gamyxz,Gamyyy, Gamyyz, Gamyzz, &
|
Gamyxx, Gamyxy, Gamyxz,Gamyyy, Gamyyz, Gamyzz, &
|
||||||
Gamzxx, Gamzxy, Gamzxz,Gamzyy, Gamzyz, Gamzzz, &
|
Gamzxx, Gamzxy, Gamzxz,Gamzyy, Gamzyz, Gamzzz, &
|
||||||
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz, &
|
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz, &
|
||||||
ham_Res, movx_Res, movy_Res, movz_Res, &
|
ham_Res, movx_Res, movy_Res, movz_Res, &
|
||||||
Symmetry,Lev,sst)
|
Symmetry,Lev,sst)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
!~~~~~~> Input parameters:
|
!~~~~~~> Input parameters:
|
||||||
|
|
||||||
integer,intent(in ):: ex(1:3),symmetry,Lev,sst
|
integer,intent(in ):: ex(1:3),symmetry,Lev,sst
|
||||||
double precision,intent(in),dimension(ex(1))::crho
|
double precision,intent(in),dimension(ex(1))::crho
|
||||||
double precision,intent(in),dimension(ex(2))::sigma
|
double precision,intent(in),dimension(ex(2))::sigma
|
||||||
double precision,intent(in),dimension(ex(3))::R
|
double precision,intent(in),dimension(ex(3))::R
|
||||||
real*8, intent(in ),dimension(ex(1),ex(2),ex(3)):: X,Y,Z
|
real*8, intent(in ),dimension(ex(1),ex(2),ex(3)):: X,Y,Z
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Lap,Sfx,Sfy,Sfz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Lap,Sfx,Sfy,Sfz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: rho,Sx,Sy,Sz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: rho,Sx,Sy,Sz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
|
||||||
! second kind of Christofel symble Gamma^i_jk respect to physical metric
|
! second kind of Christofel symble Gamma^i_jk respect to physical metric
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxxx, Gamxxy, Gamxxz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxxx, Gamxxy, Gamxxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxyy, Gamxyz, Gamxzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamxyy, Gamxyz, Gamxzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyxx, Gamyxy, Gamyxz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyxx, Gamyxy, Gamyxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyyy, Gamyyz, Gamyzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamyyy, Gamyyz, Gamyzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzxx, Gamzxy, Gamzxz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzxx, Gamzxy, Gamzxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzyy, Gamzyz, Gamzzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Gamzyy, Gamzyz, Gamzzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: ham_Res, movx_Res, movy_Res, movz_Res
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: ham_Res, movx_Res, movy_Res, movz_Res
|
||||||
!~~~~~~> Other variables:
|
!~~~~~~> Other variables:
|
||||||
! inverse metric
|
! inverse metric
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
||||||
! first order derivative of metric, @_k g_ij
|
! first order derivative of metric, @_k g_ij
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxx,gxyx,gxzx
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyx,gyzx,gzzx
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyx,gyzx,gzzx
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxy,gxyy,gxzy
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyy,gyzy,gzzy
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyy,gyzy,gzzy
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxxz,gxyz,gxzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyz,gyzz,gzzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gyyz,gyzz,gzzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,trK,fx,fy,fz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,trK,fx,fy,fz
|
||||||
|
|
||||||
integer, parameter :: NO_SYMM = 0, EQUATORIAL = 1, OCTANT = 2
|
integer, parameter :: NO_SYMM = 0, EQUATORIAL = 1, OCTANT = 2
|
||||||
real*8, parameter :: ZERO = 0.D0, HALF = 0.5d0, ONE = 1.d0, TWO = 2.d0, FOUR = 4.d0
|
real*8, parameter :: ZERO = 0.D0, HALF = 0.5d0, ONE = 1.d0, TWO = 2.d0, FOUR = 4.d0
|
||||||
real*8, parameter :: F2o3 = 2.d0/3.d0, F8 = 8.d0, F16 = 1.6d1, SIX = 6.d0
|
real*8, parameter :: F2o3 = 2.d0/3.d0, F8 = 8.d0, F16 = 1.6d1, SIX = 6.d0
|
||||||
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
|
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
|
||||||
real*8 :: PI
|
real*8 :: PI
|
||||||
|
|
||||||
call adm_ricci_gamma_ss(ex,crho,sigma,R,X, Y, Z, &
|
call adm_ricci_gamma_ss(ex,crho,sigma,R,X, Y, Z, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz, &
|
dRdx,dRdy,dRdz, &
|
||||||
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
|
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
|
||||||
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
|
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
|
||||||
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
|
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
|
||||||
dxx , gxy , gxz , dyy , gyz , dzz,&
|
dxx , gxy , gxz , dyy , gyz , dzz,&
|
||||||
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
|
Gamxxx,Gamxxy,Gamxxz,Gamxyy,Gamxyz,Gamxzz,&
|
||||||
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
|
Gamyxx,Gamyxy,Gamyxz,Gamyyy,Gamyyz,Gamyzz,&
|
||||||
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
|
Gamzxx,Gamzxy,Gamzxz,Gamzyy,Gamzyz,Gamzzz,&
|
||||||
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
|
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
|
||||||
Symmetry,Lev,sst)
|
Symmetry,Lev,sst)
|
||||||
|
|
||||||
PI = dacos(-ONE)
|
PI = dacos(-ONE)
|
||||||
|
|
||||||
gxx = dxx + ONE
|
gxx = dxx + ONE
|
||||||
gyy = dyy + ONE
|
gyy = dyy + ONE
|
||||||
gzz = dzz + ONE
|
gzz = dzz + ONE
|
||||||
! invert metric
|
! invert metric
|
||||||
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
||||||
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
||||||
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
||||||
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
||||||
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
||||||
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
||||||
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
||||||
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
||||||
|
|
||||||
trK = gupxx * Kxx + gupyy * Kyy + gupzz * Kzz &
|
trK = gupxx * Kxx + gupyy * Kyy + gupzz * Kzz &
|
||||||
+ TWO * (gupxy * Kxy + gupxz * Kxz + gupyz * Kyz)
|
+ TWO * (gupxy * Kxy + gupxz * Kxz + gupyz * Kyz)
|
||||||
|
|
||||||
! ham_Res = trR + K^2 - K_ij * K^ij - 16 * PI * rho
|
! ham_Res = trR + K^2 - K_ij * K^ij - 16 * PI * rho
|
||||||
ham_Res = gupxx * Rxx + gupyy * Ryy + gupzz * Rzz + &
|
ham_Res = gupxx * Rxx + gupyy * Ryy + gupzz * Rzz + &
|
||||||
TWO* ( gupxy * Rxy + gupxz * Rxz + gupyz * Ryz )
|
TWO* ( gupxy * Rxy + gupxz * Rxz + gupyz * Ryz )
|
||||||
|
|
||||||
ham_Res = ham_Res + trK * trK -(&
|
ham_Res = ham_Res + trK * trK -(&
|
||||||
gupxx * ( &
|
gupxx * ( &
|
||||||
gupxx * Kxx * Kxx + gupyy * Kxy * Kxy + gupzz * Kxz * Kxz + &
|
gupxx * Kxx * Kxx + gupyy * Kxy * Kxy + gupzz * Kxz * Kxz + &
|
||||||
TWO * (gupxy * Kxx * Kxy + gupxz * Kxx * Kxz + gupyz * Kxy * Kxz) ) + &
|
TWO * (gupxy * Kxx * Kxy + gupxz * Kxx * Kxz + gupyz * Kxy * Kxz) ) + &
|
||||||
gupyy * ( &
|
gupyy * ( &
|
||||||
gupxx * Kxy * Kxy + gupyy * Kyy * Kyy + gupzz * Kyz * Kyz + &
|
gupxx * Kxy * Kxy + gupyy * Kyy * Kyy + gupzz * Kyz * Kyz + &
|
||||||
TWO * (gupxy * Kxy * Kyy + gupxz * Kxy * Kyz + gupyz * Kyy * Kyz) ) + &
|
TWO * (gupxy * Kxy * Kyy + gupxz * Kxy * Kyz + gupyz * Kyy * Kyz) ) + &
|
||||||
gupzz * ( &
|
gupzz * ( &
|
||||||
gupxx * Kxz * Kxz + gupyy * Kyz * Kyz + gupzz * Kzz * Kzz + &
|
gupxx * Kxz * Kxz + gupyy * Kyz * Kyz + gupzz * Kzz * Kzz + &
|
||||||
TWO * (gupxy * Kxz * Kyz + gupxz * Kxz * Kzz + gupyz * Kyz * Kzz) ) + &
|
TWO * (gupxy * Kxz * Kyz + gupxz * Kxz * Kzz + gupyz * Kyz * Kzz) ) + &
|
||||||
TWO * ( &
|
TWO * ( &
|
||||||
gupxy * ( &
|
gupxy * ( &
|
||||||
gupxx * Kxx * Kxy + gupyy * Kxy * Kyy + gupzz * Kxz * Kyz + &
|
gupxx * Kxx * Kxy + gupyy * Kxy * Kyy + gupzz * Kxz * Kyz + &
|
||||||
gupxy * (Kxx * Kyy + Kxy * Kxy) + &
|
gupxy * (Kxx * Kyy + Kxy * Kxy) + &
|
||||||
gupxz * (Kxx * Kyz + Kxz * Kxy) + &
|
gupxz * (Kxx * Kyz + Kxz * Kxy) + &
|
||||||
gupyz * (Kxy * Kyz + Kxz * Kyy) ) + &
|
gupyz * (Kxy * Kyz + Kxz * Kyy) ) + &
|
||||||
gupxz * ( &
|
gupxz * ( &
|
||||||
gupxx * Kxx * Kxz + gupyy * Kxy * Kyz + gupzz * Kxz * Kzz + &
|
gupxx * Kxx * Kxz + gupyy * Kxy * Kyz + gupzz * Kxz * Kzz + &
|
||||||
gupxy * (Kxx * Kyz + Kxy * Kxz) + &
|
gupxy * (Kxx * Kyz + Kxy * Kxz) + &
|
||||||
gupxz * (Kxx * Kzz + Kxz * Kxz) + &
|
gupxz * (Kxx * Kzz + Kxz * Kxz) + &
|
||||||
gupyz * (Kxy * Kzz + Kxz * Kyz) ) + &
|
gupyz * (Kxy * Kzz + Kxz * Kyz) ) + &
|
||||||
gupyz * ( &
|
gupyz * ( &
|
||||||
gupxx * Kxy * Kxz + gupyy * Kyy * Kyz + gupzz * Kyz * Kzz + &
|
gupxx * Kxy * Kxz + gupyy * Kyy * Kyz + gupzz * Kyz * Kzz + &
|
||||||
gupxy * (Kxy * Kyz + Kyy * Kxz) + &
|
gupxy * (Kxy * Kyz + Kyy * Kxz) + &
|
||||||
gupxz * (Kxy * Kzz + Kyz * Kxz) + &
|
gupxz * (Kxy * Kzz + Kyz * Kxz) + &
|
||||||
gupyz * (Kyy * Kzz + Kyz * Kyz) ) ))- F16 * PI * rho
|
gupyz * (Kyy * Kzz + Kyz * Kyz) ) ))- F16 * PI * rho
|
||||||
|
|
||||||
! mov_Res_j = gupkj*D_k K_ij - d_j trK - 8 PI s_j where D respect to physical metric
|
! mov_Res_j = gupkj*D_k K_ij - d_j trK - 8 PI s_j where D respect to physical metric
|
||||||
! store D_i K_jk
|
! store D_i K_jk
|
||||||
call fderivs_shc(ex,Kxx,gxxx,gxxy,gxxz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
|
call fderivs_shc(ex,Kxx,gxxx,gxxy,gxxz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz)
|
dRdx,dRdy,dRdz)
|
||||||
call fderivs_shc(ex,Kxy,gxyx,gxyy,gxyz,crho,sigma,R,ANTI,ANTI,SYM,Symmetry,Lev,sst, &
|
call fderivs_shc(ex,Kxy,gxyx,gxyy,gxyz,crho,sigma,R,ANTI,ANTI,SYM,Symmetry,Lev,sst, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz)
|
dRdx,dRdy,dRdz)
|
||||||
call fderivs_shc(ex,Kxz,gxzx,gxzy,gxzz,crho,sigma,R,ANTI,SYM ,ANTI,Symmetry,Lev,sst, &
|
call fderivs_shc(ex,Kxz,gxzx,gxzy,gxzz,crho,sigma,R,ANTI,SYM ,ANTI,Symmetry,Lev,sst, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz)
|
dRdx,dRdy,dRdz)
|
||||||
call fderivs_shc(ex,Kyy,gyyx,gyyy,gyyz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
|
call fderivs_shc(ex,Kyy,gyyx,gyyy,gyyz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz)
|
dRdx,dRdy,dRdz)
|
||||||
call fderivs_shc(ex,Kyz,gyzx,gyzy,gyzz,crho,sigma,R,SYM ,ANTI,ANTI,Symmetry,Lev,sst, &
|
call fderivs_shc(ex,Kyz,gyzx,gyzy,gyzz,crho,sigma,R,SYM ,ANTI,ANTI,Symmetry,Lev,sst, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz)
|
dRdx,dRdy,dRdz)
|
||||||
call fderivs_shc(ex,Kzz,gzzx,gzzy,gzzz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
|
call fderivs_shc(ex,Kzz,gzzx,gzzy,gzzz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz)
|
dRdx,dRdy,dRdz)
|
||||||
|
|
||||||
gxxx = gxxx - ( Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz &
|
gxxx = gxxx - ( Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz &
|
||||||
+ Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz)
|
+ Gamxxx * Kxx + Gamyxx * Kxy + Gamzxx * Kxz)
|
||||||
gxyx = gxyx - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
|
gxyx = gxyx - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
|
||||||
+ Gamxxx * Kxy + Gamyxx * Kyy + Gamzxx * Kyz)
|
+ Gamxxx * Kxy + Gamyxx * Kyy + Gamzxx * Kyz)
|
||||||
gxzx = gxzx - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
|
gxzx = gxzx - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
|
||||||
+ Gamxxx * Kxz + Gamyxx * Kyz + Gamzxx * Kzz)
|
+ Gamxxx * Kxz + Gamyxx * Kyz + Gamzxx * Kzz)
|
||||||
gyyx = gyyx - ( Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz &
|
gyyx = gyyx - ( Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz &
|
||||||
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
|
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
|
||||||
gyzx = gyzx - ( Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz &
|
gyzx = gyzx - ( Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz &
|
||||||
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
|
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
|
||||||
gzzx = gzzx - ( Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz &
|
gzzx = gzzx - ( Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz &
|
||||||
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
|
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
|
||||||
gxxy = gxxy - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
|
gxxy = gxxy - ( Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz &
|
||||||
+ Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz)
|
+ Gamxxy * Kxx + Gamyxy * Kxy + Gamzxy * Kxz)
|
||||||
gxyy = gxyy - ( Gamxyy * Kxx + Gamyyy * Kxy + Gamzyy * Kxz &
|
gxyy = gxyy - ( Gamxyy * Kxx + Gamyyy * Kxy + Gamzyy * Kxz &
|
||||||
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
|
+ Gamxxy * Kxy + Gamyxy * Kyy + Gamzxy * Kyz)
|
||||||
gxzy = gxzy - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
|
gxzy = gxzy - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
|
||||||
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
|
+ Gamxxy * Kxz + Gamyxy * Kyz + Gamzxy * Kzz)
|
||||||
gyyy = gyyy - ( Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz &
|
gyyy = gyyy - ( Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz &
|
||||||
+ Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz)
|
+ Gamxyy * Kxy + Gamyyy * Kyy + Gamzyy * Kyz)
|
||||||
gyzy = gyzy - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
|
gyzy = gyzy - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
|
||||||
+ Gamxyy * Kxz + Gamyyy * Kyz + Gamzyy * Kzz)
|
+ Gamxyy * Kxz + Gamyyy * Kyz + Gamzyy * Kzz)
|
||||||
gzzy = gzzy - ( Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz &
|
gzzy = gzzy - ( Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz &
|
||||||
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
|
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
|
||||||
gxxz = gxxz - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
|
gxxz = gxxz - ( Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz &
|
||||||
+ Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz)
|
+ Gamxxz * Kxx + Gamyxz * Kxy + Gamzxz * Kxz)
|
||||||
gxyz = gxyz - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
|
gxyz = gxyz - ( Gamxyz * Kxx + Gamyyz * Kxy + Gamzyz * Kxz &
|
||||||
+ Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz)
|
+ Gamxxz * Kxy + Gamyxz * Kyy + Gamzxz * Kyz)
|
||||||
gxzz = gxzz - ( Gamxzz * Kxx + Gamyzz * Kxy + Gamzzz * Kxz &
|
gxzz = gxzz - ( Gamxzz * Kxx + Gamyzz * Kxy + Gamzzz * Kxz &
|
||||||
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
|
+ Gamxxz * Kxz + Gamyxz * Kyz + Gamzxz * Kzz)
|
||||||
gyyz = gyyz - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
|
gyyz = gyyz - ( Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz &
|
||||||
+ Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz)
|
+ Gamxyz * Kxy + Gamyyz * Kyy + Gamzyz * Kyz)
|
||||||
gyzz = gyzz - ( Gamxzz * Kxy + Gamyzz * Kyy + Gamzzz * Kyz &
|
gyzz = gyzz - ( Gamxzz * Kxy + Gamyzz * Kyy + Gamzzz * Kyz &
|
||||||
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
|
+ Gamxyz * Kxz + Gamyyz * Kyz + Gamzyz * Kzz)
|
||||||
gzzz = gzzz - ( Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz &
|
gzzz = gzzz - ( Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz &
|
||||||
+ Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz)
|
+ Gamxzz * Kxz + Gamyzz * Kyz + Gamzzz * Kzz)
|
||||||
movx_Res = gupxx*gxxx + gupyy*gxyy + gupzz*gxzz &
|
movx_Res = gupxx*gxxx + gupyy*gxyy + gupzz*gxzz &
|
||||||
+gupxy*gxyx + gupxz*gxzx + gupyz*gxzy &
|
+gupxy*gxyx + gupxz*gxzx + gupyz*gxzy &
|
||||||
+gupxy*gxxy + gupxz*gxxz + gupyz*gxyz
|
+gupxy*gxxy + gupxz*gxxz + gupyz*gxyz
|
||||||
movy_Res = gupxx*gxyx + gupyy*gyyy + gupzz*gyzz &
|
movy_Res = gupxx*gxyx + gupyy*gyyy + gupzz*gyzz &
|
||||||
+gupxy*gyyx + gupxz*gyzx + gupyz*gyzy &
|
+gupxy*gyyx + gupxz*gyzx + gupyz*gyzy &
|
||||||
+gupxy*gxyy + gupxz*gxyz + gupyz*gyyz
|
+gupxy*gxyy + gupxz*gxyz + gupyz*gyyz
|
||||||
movz_Res = gupxx*gxzx + gupyy*gyzy + gupzz*gzzz &
|
movz_Res = gupxx*gxzx + gupyy*gyzy + gupzz*gzzz &
|
||||||
+gupxy*gyzx + gupxz*gzzx + gupyz*gzzy &
|
+gupxy*gyzx + gupxz*gzzx + gupyz*gzzy &
|
||||||
+gupxy*gxzy + gupxz*gxzz + gupyz*gyzz
|
+gupxy*gxzy + gupxz*gxzz + gupyz*gyzz
|
||||||
|
|
||||||
call fderivs_shc(ex,trK,fx,fy,fz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
|
call fderivs_shc(ex,trK,fx,fy,fz,crho,sigma,R, SYM, SYM,SYM,Symmetry,Lev,sst, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz)
|
dRdx,dRdy,dRdz)
|
||||||
|
|
||||||
movx_Res = movx_Res - fx - F8*PI*sx
|
movx_Res = movx_Res - fx - F8*PI*sx
|
||||||
movy_Res = movy_Res - fy - F8*PI*sy
|
movy_Res = movy_Res - fy - F8*PI*sy
|
||||||
movz_Res = movz_Res - fz - F8*PI*sz
|
movz_Res = movz_Res - fz - F8*PI*sz
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine constraint_adm_ss
|
end subroutine constraint_adm_ss
|
||||||
@@ -1,40 +1,40 @@
|
|||||||
|
|
||||||
!-------------------------------------------------------------------------------!
|
!-------------------------------------------------------------------------------!
|
||||||
! convert bssn variables to ADM variables !
|
! convert bssn variables to ADM variables !
|
||||||
!-------------------------------------------------------------------------------!
|
!-------------------------------------------------------------------------------!
|
||||||
subroutine bssn2adm(ex,chi,trK, &
|
subroutine bssn2adm(ex,chi,trK, &
|
||||||
gxx,gxy,gxz,gyy,gyz,gzz, &
|
gxx,gxy,gxz,gyy,gyz,gzz, &
|
||||||
Axx,Axy,Axz,Ayy,Ayz,Azz, &
|
Axx,Axy,Axz,Ayy,Ayz,Azz, &
|
||||||
adm_gxx,adm_gxy,adm_gxz,adm_gyy,adm_gyz,adm_gzz, &
|
adm_gxx,adm_gxy,adm_gxz,adm_gyy,adm_gyz,adm_gzz, &
|
||||||
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz)
|
Kxx,Kxy,Kxz,Kyy,Kyz,Kzz)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
!~~~~~~> Input parameters:
|
!~~~~~~> Input parameters:
|
||||||
|
|
||||||
integer,intent(in ):: ex(1:3)
|
integer,intent(in ):: ex(1:3)
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::chi,trK
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::chi,trK
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::gxx,gxy,gxz,gyy,gyz,gzz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::gxx,gxy,gxz,gyy,gyz,gzz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::Axx,Axy,Axz,Ayy,Ayz,Azz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::Axx,Axy,Axz,Ayy,Ayz,Azz
|
||||||
|
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: adm_gxx,adm_gxy,adm_gxz,adm_gyy,adm_gyz,adm_gzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: adm_gxx,adm_gxy,adm_gxz,adm_gyy,adm_gyz,adm_gzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
|
||||||
|
|
||||||
real*8, parameter :: F1o3=1.d0/3.d0
|
real*8, parameter :: F1o3=1.d0/3.d0
|
||||||
|
|
||||||
adm_gxx = gxx/chi
|
adm_gxx = gxx/chi
|
||||||
adm_gxy = gxy/chi
|
adm_gxy = gxy/chi
|
||||||
adm_gxz = gxz/chi
|
adm_gxz = gxz/chi
|
||||||
adm_gyy = gyy/chi
|
adm_gyy = gyy/chi
|
||||||
adm_gyz = gyz/chi
|
adm_gyz = gyz/chi
|
||||||
adm_gzz = gzz/chi
|
adm_gzz = gzz/chi
|
||||||
|
|
||||||
Kxx = Axx/chi+F1o3*trK*adm_gxx
|
Kxx = Axx/chi+F1o3*trK*adm_gxx
|
||||||
Kxy = Axy/chi+F1o3*trK*adm_gxy
|
Kxy = Axy/chi+F1o3*trK*adm_gxy
|
||||||
Kxz = Axz/chi+F1o3*trK*adm_gxz
|
Kxz = Axz/chi+F1o3*trK*adm_gxz
|
||||||
Kyy = Ayy/chi+F1o3*trK*adm_gyy
|
Kyy = Ayy/chi+F1o3*trK*adm_gyy
|
||||||
Kyz = Ayz/chi+F1o3*trK*adm_gyz
|
Kyz = Ayz/chi+F1o3*trK*adm_gyz
|
||||||
Kzz = Azz/chi+F1o3*trK*adm_gzz
|
Kzz = Azz/chi+F1o3*trK*adm_gzz
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine bssn2adm
|
end subroutine bssn2adm
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,69 +1,69 @@
|
|||||||
|
|
||||||
#ifndef BSSNEM_CLASS_H
|
#ifndef BSSNEM_CLASS_H
|
||||||
#define BSSNEM_CLASS_H
|
#define BSSNEM_CLASS_H
|
||||||
|
|
||||||
#ifdef newc
|
#ifdef newc
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#else
|
#else
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <iomanip.h>
|
#include <iomanip.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
#include "cgh.h"
|
#include "cgh.h"
|
||||||
#include "ShellPatch.h"
|
#include "ShellPatch.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
#include "MyList.h"
|
#include "MyList.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "surface_integral.h"
|
#include "surface_integral.h"
|
||||||
|
|
||||||
#include "macrodef.h"
|
#include "macrodef.h"
|
||||||
|
|
||||||
#ifdef USE_GPU
|
#ifdef USE_GPU
|
||||||
#include "bssn_gpu_class.h"
|
#include "bssn_gpu_class.h"
|
||||||
#else
|
#else
|
||||||
#include "bssn_class.h"
|
#include "bssn_class.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class bssnEM_class : public bssn_class
|
class bssnEM_class : public bssn_class
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bssnEM_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
|
bssnEM_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
|
||||||
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
|
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
|
||||||
int a_levi, int maxli, int decni, double maxrexi, double drexi);
|
int a_levi, int maxli, int decni, double maxrexi, double drexi);
|
||||||
~bssnEM_class();
|
~bssnEM_class();
|
||||||
|
|
||||||
void Initialize();
|
void Initialize();
|
||||||
void Read_Ansorg();
|
void Read_Ansorg();
|
||||||
void Setup_Initial_Data();
|
void Setup_Initial_Data();
|
||||||
void Step(int lev, int YN);
|
void Step(int lev, int YN);
|
||||||
void Compute_Phi2(int lev);
|
void Compute_Phi2(int lev);
|
||||||
void AnalysisStuff_EM(int lev, double dT_lev);
|
void AnalysisStuff_EM(int lev, double dT_lev);
|
||||||
void Interp_Constraint();
|
void Interp_Constraint();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
var *Exo, *Eyo, *Ezo, *Bxo, *Byo, *Bzo, *Kpsio, *Kphio;
|
var *Exo, *Eyo, *Ezo, *Bxo, *Byo, *Bzo, *Kpsio, *Kphio;
|
||||||
var *Ex0, *Ey0, *Ez0, *Bx0, *By0, *Bz0, *Kpsi0, *Kphi0;
|
var *Ex0, *Ey0, *Ez0, *Bx0, *By0, *Bz0, *Kpsi0, *Kphi0;
|
||||||
var *Ex, *Ey, *Ez, *Bx, *By, *Bz, *Kpsi, *Kphi;
|
var *Ex, *Ey, *Ez, *Bx, *By, *Bz, *Kpsi, *Kphi;
|
||||||
var *Ex1, *Ey1, *Ez1, *Bx1, *By1, *Bz1, *Kpsi1, *Kphi1;
|
var *Ex1, *Ey1, *Ez1, *Bx1, *By1, *Bz1, *Kpsi1, *Kphi1;
|
||||||
var *Ex_rhs, *Ey_rhs, *Ez_rhs, *Bx_rhs, *By_rhs, *Bz_rhs, *Kpsi_rhs, *Kphi_rhs;
|
var *Ex_rhs, *Ey_rhs, *Ez_rhs, *Bx_rhs, *By_rhs, *Bz_rhs, *Kpsi_rhs, *Kphi_rhs;
|
||||||
var *Jx, *Jy, *Jz, *qchar;
|
var *Jx, *Jy, *Jz, *qchar;
|
||||||
var *Rphi2, *Iphi2;
|
var *Rphi2, *Iphi2;
|
||||||
var *Rphi1, *Iphi1;
|
var *Rphi1, *Iphi1;
|
||||||
|
|
||||||
monitor *Phi2Monitor;
|
monitor *Phi2Monitor;
|
||||||
monitor *Phi1Monitor;
|
monitor *Phi1Monitor;
|
||||||
};
|
};
|
||||||
#endif /* BSSNEM_CLASS_H */
|
#endif /* BSSNEM_CLASS_H */
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,206 +1,206 @@
|
|||||||
|
|
||||||
#ifndef BSSN_CLASS_H
|
#ifndef BSSN_CLASS_H
|
||||||
#define BSSN_CLASS_H
|
#define BSSN_CLASS_H
|
||||||
|
|
||||||
#ifdef newc
|
#ifdef newc
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#else
|
#else
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <iomanip.h>
|
#include <iomanip.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
#include "macrodef.h"
|
#include "macrodef.h"
|
||||||
#include "cgh.h"
|
#include "cgh.h"
|
||||||
#include "ShellPatch.h"
|
#include "ShellPatch.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
#include "MyList.h"
|
#include "MyList.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "surface_integral.h"
|
#include "surface_integral.h"
|
||||||
#include "checkpoint.h"
|
#include "checkpoint.h"
|
||||||
|
|
||||||
extern void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN);
|
extern void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN);
|
||||||
|
|
||||||
class bssn_class
|
class bssn_class
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int ngfs;
|
int ngfs;
|
||||||
int nprocs, myrank;
|
int nprocs, myrank;
|
||||||
cgh *GH;
|
cgh *GH;
|
||||||
ShellPatch *SH;
|
ShellPatch *SH;
|
||||||
double PhysTime;
|
double PhysTime;
|
||||||
|
|
||||||
int checkrun;
|
int checkrun;
|
||||||
char checkfilename[50];
|
char checkfilename[50];
|
||||||
int Steps;
|
int Steps;
|
||||||
double StartTime, TotalTime;
|
double StartTime, TotalTime;
|
||||||
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
||||||
double LastAnas, LastConsOut;
|
double LastAnas, LastConsOut;
|
||||||
int *ConstraintRefreshLevels;
|
int *ConstraintRefreshLevels;
|
||||||
double Courant;
|
double Courant;
|
||||||
double numepss, numepsb, numepsh;
|
double numepss, numepsb, numepsh;
|
||||||
int Symmetry;
|
int Symmetry;
|
||||||
int maxl, decn;
|
int maxl, decn;
|
||||||
double maxrex, drex;
|
double maxrex, drex;
|
||||||
int trfls, a_lev;
|
int trfls, a_lev;
|
||||||
|
|
||||||
double dT;
|
double dT;
|
||||||
double chitiny;
|
double chitiny;
|
||||||
|
|
||||||
double **Porg0, **Porgbr, **Porg, **Porg1, **Porg_rhs;
|
double **Porg0, **Porgbr, **Porg, **Porg1, **Porg_rhs;
|
||||||
int BH_num, BH_num_input;
|
int BH_num, BH_num_input;
|
||||||
double *Mass, *Pmom, *Spin;
|
double *Mass, *Pmom, *Spin;
|
||||||
double ADMMass;
|
double ADMMass;
|
||||||
|
|
||||||
var *phio, *trKo;
|
var *phio, *trKo;
|
||||||
var *gxxo, *gxyo, *gxzo, *gyyo, *gyzo, *gzzo;
|
var *gxxo, *gxyo, *gxzo, *gyyo, *gyzo, *gzzo;
|
||||||
var *Axxo, *Axyo, *Axzo, *Ayyo, *Ayzo, *Azzo;
|
var *Axxo, *Axyo, *Axzo, *Ayyo, *Ayzo, *Azzo;
|
||||||
var *Gmxo, *Gmyo, *Gmzo;
|
var *Gmxo, *Gmyo, *Gmzo;
|
||||||
var *Lapo, *Sfxo, *Sfyo, *Sfzo;
|
var *Lapo, *Sfxo, *Sfyo, *Sfzo;
|
||||||
var *dtSfxo, *dtSfyo, *dtSfzo;
|
var *dtSfxo, *dtSfyo, *dtSfzo;
|
||||||
|
|
||||||
var *phi0, *trK0;
|
var *phi0, *trK0;
|
||||||
var *gxx0, *gxy0, *gxz0, *gyy0, *gyz0, *gzz0;
|
var *gxx0, *gxy0, *gxz0, *gyy0, *gyz0, *gzz0;
|
||||||
var *Axx0, *Axy0, *Axz0, *Ayy0, *Ayz0, *Azz0;
|
var *Axx0, *Axy0, *Axz0, *Ayy0, *Ayz0, *Azz0;
|
||||||
var *Gmx0, *Gmy0, *Gmz0;
|
var *Gmx0, *Gmy0, *Gmz0;
|
||||||
var *Lap0, *Sfx0, *Sfy0, *Sfz0;
|
var *Lap0, *Sfx0, *Sfy0, *Sfz0;
|
||||||
var *dtSfx0, *dtSfy0, *dtSfz0;
|
var *dtSfx0, *dtSfy0, *dtSfz0;
|
||||||
|
|
||||||
var *phi, *trK;
|
var *phi, *trK;
|
||||||
var *gxx, *gxy, *gxz, *gyy, *gyz, *gzz;
|
var *gxx, *gxy, *gxz, *gyy, *gyz, *gzz;
|
||||||
var *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz;
|
var *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz;
|
||||||
var *Gmx, *Gmy, *Gmz;
|
var *Gmx, *Gmy, *Gmz;
|
||||||
var *Lap, *Sfx, *Sfy, *Sfz;
|
var *Lap, *Sfx, *Sfy, *Sfz;
|
||||||
var *dtSfx, *dtSfy, *dtSfz;
|
var *dtSfx, *dtSfy, *dtSfz;
|
||||||
|
|
||||||
var *phi1, *trK1;
|
var *phi1, *trK1;
|
||||||
var *gxx1, *gxy1, *gxz1, *gyy1, *gyz1, *gzz1;
|
var *gxx1, *gxy1, *gxz1, *gyy1, *gyz1, *gzz1;
|
||||||
var *Axx1, *Axy1, *Axz1, *Ayy1, *Ayz1, *Azz1;
|
var *Axx1, *Axy1, *Axz1, *Ayy1, *Ayz1, *Azz1;
|
||||||
var *Gmx1, *Gmy1, *Gmz1;
|
var *Gmx1, *Gmy1, *Gmz1;
|
||||||
var *Lap1, *Sfx1, *Sfy1, *Sfz1;
|
var *Lap1, *Sfx1, *Sfy1, *Sfz1;
|
||||||
var *dtSfx1, *dtSfy1, *dtSfz1;
|
var *dtSfx1, *dtSfy1, *dtSfz1;
|
||||||
|
|
||||||
var *phi_rhs, *trK_rhs;
|
var *phi_rhs, *trK_rhs;
|
||||||
var *gxx_rhs, *gxy_rhs, *gxz_rhs, *gyy_rhs, *gyz_rhs, *gzz_rhs;
|
var *gxx_rhs, *gxy_rhs, *gxz_rhs, *gyy_rhs, *gyz_rhs, *gzz_rhs;
|
||||||
var *Axx_rhs, *Axy_rhs, *Axz_rhs, *Ayy_rhs, *Ayz_rhs, *Azz_rhs;
|
var *Axx_rhs, *Axy_rhs, *Axz_rhs, *Ayy_rhs, *Ayz_rhs, *Azz_rhs;
|
||||||
var *Gmx_rhs, *Gmy_rhs, *Gmz_rhs;
|
var *Gmx_rhs, *Gmy_rhs, *Gmz_rhs;
|
||||||
var *Lap_rhs, *Sfx_rhs, *Sfy_rhs, *Sfz_rhs;
|
var *Lap_rhs, *Sfx_rhs, *Sfy_rhs, *Sfz_rhs;
|
||||||
var *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs;
|
var *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs;
|
||||||
|
|
||||||
var *rho, *Sx, *Sy, *Sz, *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz;
|
var *rho, *Sx, *Sy, *Sz, *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz;
|
||||||
|
|
||||||
var *Gamxxx, *Gamxxy, *Gamxxz, *Gamxyy, *Gamxyz, *Gamxzz;
|
var *Gamxxx, *Gamxxy, *Gamxxz, *Gamxyy, *Gamxyz, *Gamxzz;
|
||||||
var *Gamyxx, *Gamyxy, *Gamyxz, *Gamyyy, *Gamyyz, *Gamyzz;
|
var *Gamyxx, *Gamyxy, *Gamyxz, *Gamyyy, *Gamyyz, *Gamyzz;
|
||||||
var *Gamzxx, *Gamzxy, *Gamzxz, *Gamzyy, *Gamzyz, *Gamzzz;
|
var *Gamzxx, *Gamzxy, *Gamzxz, *Gamzyy, *Gamzyz, *Gamzzz;
|
||||||
|
|
||||||
var *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz;
|
var *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz;
|
||||||
|
|
||||||
var *Rpsi4, *Ipsi4;
|
var *Rpsi4, *Ipsi4;
|
||||||
var *t1Rpsi4, *t1Ipsi4, *t2Rpsi4, *t2Ipsi4;
|
var *t1Rpsi4, *t1Ipsi4, *t2Rpsi4, *t2Ipsi4;
|
||||||
|
|
||||||
var *Cons_Ham, *Cons_Px, *Cons_Py, *Cons_Pz, *Cons_Gx, *Cons_Gy, *Cons_Gz;
|
var *Cons_Ham, *Cons_Px, *Cons_Py, *Cons_Pz, *Cons_Gx, *Cons_Gy, *Cons_Gz;
|
||||||
|
|
||||||
#ifdef Point_Psi4
|
#ifdef Point_Psi4
|
||||||
var *phix, *phiy, *phiz;
|
var *phix, *phiy, *phiz;
|
||||||
var *trKx, *trKy, *trKz;
|
var *trKx, *trKy, *trKz;
|
||||||
var *Axxx, *Axxy, *Axxz;
|
var *Axxx, *Axxy, *Axxz;
|
||||||
var *Axyx, *Axyy, *Axyz;
|
var *Axyx, *Axyy, *Axyz;
|
||||||
var *Axzx, *Axzy, *Axzz;
|
var *Axzx, *Axzy, *Axzz;
|
||||||
var *Ayyx, *Ayyy, *Ayyz;
|
var *Ayyx, *Ayyy, *Ayyz;
|
||||||
var *Ayzx, *Ayzy, *Ayzz;
|
var *Ayzx, *Ayzy, *Ayzz;
|
||||||
var *Azzx, *Azzy, *Azzz;
|
var *Azzx, *Azzy, *Azzz;
|
||||||
#endif
|
#endif
|
||||||
// FIXME: uc = StateList, up = OldStateList, upp = SynchList_cor; so never touch these three data
|
// FIXME: uc = StateList, up = OldStateList, upp = SynchList_cor; so never touch these three data
|
||||||
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
|
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
|
||||||
MyList<var> *OldStateList, *DumpList;
|
MyList<var> *OldStateList, *DumpList;
|
||||||
MyList<var> *ConstraintList;
|
MyList<var> *ConstraintList;
|
||||||
|
|
||||||
Parallel::SyncCache *sync_cache_pre; // per-level cache for predictor sync
|
Parallel::SyncCache *sync_cache_pre; // per-level cache for predictor sync
|
||||||
Parallel::SyncCache *sync_cache_cor; // per-level cache for corrector sync
|
Parallel::SyncCache *sync_cache_cor; // per-level cache for corrector sync
|
||||||
Parallel::SyncCache *sync_cache_rp_coarse; // RestrictProlong sync on PatL[lev-1]
|
Parallel::SyncCache *sync_cache_rp_coarse; // RestrictProlong sync on PatL[lev-1]
|
||||||
Parallel::SyncCache *sync_cache_rp_fine; // RestrictProlong sync on PatL[lev]
|
Parallel::SyncCache *sync_cache_rp_fine; // RestrictProlong sync on PatL[lev]
|
||||||
Parallel::SyncCache *sync_cache_restrict; // cached Restrict in RestrictProlong
|
Parallel::SyncCache *sync_cache_restrict; // cached Restrict in RestrictProlong
|
||||||
Parallel::SyncCache *sync_cache_outbd; // cached OutBdLow2Hi in RestrictProlong
|
Parallel::SyncCache *sync_cache_outbd; // cached OutBdLow2Hi in RestrictProlong
|
||||||
|
|
||||||
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
|
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
|
||||||
monitor *ConVMonitor, *TimingMonitor;
|
monitor *ConVMonitor, *TimingMonitor;
|
||||||
surface_integral *Waveshell;
|
surface_integral *Waveshell;
|
||||||
checkpoint *CheckPoint;
|
checkpoint *CheckPoint;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bssn_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
|
bssn_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
|
||||||
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
|
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
|
||||||
int a_levi, int maxli, int decni, double maxrexi, double drexi);
|
int a_levi, int maxli, int decni, double maxrexi, double drexi);
|
||||||
~bssn_class();
|
~bssn_class();
|
||||||
|
|
||||||
void Evolve(int Steps);
|
void Evolve(int Steps);
|
||||||
void RecursiveStep(int lev);
|
void RecursiveStep(int lev);
|
||||||
#if (PSTR == 3)
|
#if (PSTR == 3)
|
||||||
void RecursiveStep(int lev, int num);
|
void RecursiveStep(int lev, int num);
|
||||||
#endif
|
#endif
|
||||||
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
#if (PSTR == 1 || PSTR == 2 || PSTR == 3)
|
||||||
void ParallelStep();
|
void ParallelStep();
|
||||||
void SHStep();
|
void SHStep();
|
||||||
#endif
|
#endif
|
||||||
void RestrictProlong(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
|
void RestrictProlong(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
|
||||||
void RestrictProlong_aux(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
|
void RestrictProlong_aux(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
|
||||||
void RestrictProlong(int lev, int YN, bool BB);
|
void RestrictProlong(int lev, int YN, bool BB);
|
||||||
void ProlongRestrict(int lev, int YN, bool BB);
|
void ProlongRestrict(int lev, int YN, bool BB);
|
||||||
void Setup_Black_Hole_position();
|
void Setup_Black_Hole_position();
|
||||||
void compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int lev);
|
void compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int lev);
|
||||||
bool read_Pablo_file(int *ext, double *datain, char *filename);
|
bool read_Pablo_file(int *ext, double *datain, char *filename);
|
||||||
void write_Pablo_file(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
|
void write_Pablo_file(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
|
||||||
char *filename);
|
char *filename);
|
||||||
void AnalysisStuff(int lev, double dT_lev);
|
void AnalysisStuff(int lev, double dT_lev);
|
||||||
void Setup_KerrSchild();
|
void Setup_KerrSchild();
|
||||||
void Enforce_algcon(int lev, int fg);
|
void Enforce_algcon(int lev, int fg);
|
||||||
|
|
||||||
void testRestrict();
|
void testRestrict();
|
||||||
void testOutBd();
|
void testOutBd();
|
||||||
|
|
||||||
bool check_Stdin_Abort();
|
bool check_Stdin_Abort();
|
||||||
|
|
||||||
virtual void Setup_Initial_Data_Cao();
|
virtual void Setup_Initial_Data_Cao();
|
||||||
virtual void Setup_Initial_Data_Lousto();
|
virtual void Setup_Initial_Data_Lousto();
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual void Read_Ansorg();
|
virtual void Read_Ansorg();
|
||||||
virtual void Read_Pablo() {};
|
virtual void Read_Pablo() {};
|
||||||
virtual void Compute_Psi4(int lev);
|
virtual void Compute_Psi4(int lev);
|
||||||
virtual void Step(int lev, int YN);
|
virtual void Step(int lev, int YN);
|
||||||
virtual void Interp_Constraint(bool infg);
|
virtual void Interp_Constraint(bool infg);
|
||||||
virtual void Constraint_Out();
|
virtual void Constraint_Out();
|
||||||
virtual void Compute_Constraint();
|
virtual void Compute_Constraint();
|
||||||
|
|
||||||
#ifdef With_AHF
|
#ifdef With_AHF
|
||||||
protected:
|
protected:
|
||||||
MyList<var> *AHList, *AHDList, *GaugeList;
|
MyList<var> *AHList, *AHDList, *GaugeList;
|
||||||
int AHfindevery;
|
int AHfindevery;
|
||||||
double AHdumptime;
|
double AHdumptime;
|
||||||
int *lastahdumpid, HN_num; // number of possible horizons
|
int *lastahdumpid, HN_num; // number of possible horizons
|
||||||
int *findeveryl;
|
int *findeveryl;
|
||||||
double *xc, *yc, *zc, *xr, *yr, *zr;
|
double *xc, *yc, *zc, *xr, *yr, *zr;
|
||||||
bool *trigger;
|
bool *trigger;
|
||||||
double *dTT;
|
double *dTT;
|
||||||
int *dumpid;
|
int *dumpid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void AH_Prepare_derivatives();
|
void AH_Prepare_derivatives();
|
||||||
bool AH_Interp_Points(MyList<var> *VarList,
|
bool AH_Interp_Points(MyList<var> *VarList,
|
||||||
int NN, double **XX,
|
int NN, double **XX,
|
||||||
double *Shellf, int Symmetryi);
|
double *Shellf, int Symmetryi);
|
||||||
void AH_Step_Find(int lev, double dT_lev);
|
void AH_Step_Find(int lev, double dT_lev);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#endif /* BSSN_CLASS_H */
|
#endif /* BSSN_CLASS_H */
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,35 +1,35 @@
|
|||||||
|
|
||||||
#ifndef BSSN_H
|
#ifndef BSSN_H
|
||||||
#define BSSN_H
|
#define BSSN_H
|
||||||
|
|
||||||
#ifdef fortran1
|
#ifdef fortran1
|
||||||
#define f_compute_rhs_bssn compute_rhs_bssn
|
#define f_compute_rhs_bssn compute_rhs_bssn
|
||||||
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss
|
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss
|
||||||
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar
|
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar
|
||||||
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss
|
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss
|
||||||
#define f_compute_rhs_Z4c compute_rhs_z4c
|
#define f_compute_rhs_Z4c compute_rhs_z4c
|
||||||
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot
|
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot
|
||||||
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss
|
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss
|
||||||
#define f_compute_constraint_fr compute_constraint_fr
|
#define f_compute_constraint_fr compute_constraint_fr
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran2
|
#ifdef fortran2
|
||||||
#define f_compute_rhs_bssn COMPUTE_RHS_BSSN
|
#define f_compute_rhs_bssn COMPUTE_RHS_BSSN
|
||||||
#define f_compute_rhs_bssn_ss COMPUTE_RHS_BSSN_SS
|
#define f_compute_rhs_bssn_ss COMPUTE_RHS_BSSN_SS
|
||||||
#define f_compute_rhs_bssn_escalar COMPUTE_RHS_BSSN_ESCALAR
|
#define f_compute_rhs_bssn_escalar COMPUTE_RHS_BSSN_ESCALAR
|
||||||
#define f_compute_rhs_bssn_escalar_ss COMPUTE_RHS_BSSN_ESCALAR_SS
|
#define f_compute_rhs_bssn_escalar_ss COMPUTE_RHS_BSSN_ESCALAR_SS
|
||||||
#define f_compute_rhs_Z4c COMPUTE_RHS_Z4C
|
#define f_compute_rhs_Z4c COMPUTE_RHS_Z4C
|
||||||
#define f_compute_rhs_Z4cnot COMPUTE_RHS_Z4CNOT
|
#define f_compute_rhs_Z4cnot COMPUTE_RHS_Z4CNOT
|
||||||
#define f_compute_rhs_Z4c_ss COMPUTE_RHS_Z4C_SS
|
#define f_compute_rhs_Z4c_ss COMPUTE_RHS_Z4C_SS
|
||||||
#define f_compute_constraint_fr COMPUTE_CONSTRAINT_FR
|
#define f_compute_constraint_fr COMPUTE_CONSTRAINT_FR
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran3
|
#ifdef fortran3
|
||||||
#define f_compute_rhs_bssn compute_rhs_bssn_
|
#define f_compute_rhs_bssn compute_rhs_bssn_
|
||||||
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss_
|
#define f_compute_rhs_bssn_ss compute_rhs_bssn_ss_
|
||||||
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar_
|
#define f_compute_rhs_bssn_escalar compute_rhs_bssn_escalar_
|
||||||
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss_
|
#define f_compute_rhs_bssn_escalar_ss compute_rhs_bssn_escalar_ss_
|
||||||
#define f_compute_rhs_Z4c compute_rhs_z4c_
|
#define f_compute_rhs_Z4c compute_rhs_z4c_
|
||||||
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot_
|
#define f_compute_rhs_Z4cnot compute_rhs_z4cnot_
|
||||||
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss_
|
#define f_compute_rhs_Z4c_ss compute_rhs_z4c_ss_
|
||||||
#define f_compute_constraint_fr compute_constraint_fr_
|
#define f_compute_constraint_fr compute_constraint_fr_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -48,197 +48,197 @@ extern "C"
|
|||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_bssn(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
int f_compute_rhs_bssn(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Ricci
|
double *, double *, double *, double *, double *, double *, // Ricci
|
||||||
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
||||||
int &, int &, double &, int &);
|
int &, int &, double &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_bssn_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
|
int f_compute_rhs_bssn_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
|
||||||
double *, double *, double *, // X,Y,Z
|
double *, double *, double *, // X,Y,Z
|
||||||
double *, double *, double *, // drhodx,drhody,drhodz
|
double *, double *, double *, // drhodx,drhody,drhodz
|
||||||
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
|
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
|
||||||
double *, double *, double *, // dRdx,dRdy,dRdz
|
double *, double *, double *, // dRdx,dRdy,dRdz
|
||||||
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
||||||
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
||||||
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Ricci
|
double *, double *, double *, double *, double *, double *, // Ricci
|
||||||
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
||||||
int &, int &, double &, int &, int &);
|
int &, int &, double &, int &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_bssn_escalar(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
int f_compute_rhs_bssn_escalar(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, double *, // Sphi, Spi
|
double *, double *, // Sphi, Spi
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, double *, // Sphi, Spi
|
double *, double *, // Sphi, Spi
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Ricci
|
double *, double *, double *, double *, double *, double *, // Ricci
|
||||||
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
||||||
int &, int &, double &, int &);
|
int &, int &, double &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_bssn_escalar_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
|
int f_compute_rhs_bssn_escalar_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
|
||||||
double *, double *, double *, // X,Y,Z
|
double *, double *, double *, // X,Y,Z
|
||||||
double *, double *, double *, // drhodx,drhody,drhodz
|
double *, double *, double *, // drhodx,drhody,drhodz
|
||||||
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
|
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
|
||||||
double *, double *, double *, // dRdx,dRdy,dRdz
|
double *, double *, double *, // dRdx,dRdy,dRdz
|
||||||
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
||||||
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
||||||
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, double *, // Sphi,Spi
|
double *, double *, // Sphi,Spi
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, double *, // Sphi,Spi
|
double *, double *, // Sphi,Spi
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Ricci
|
double *, double *, double *, double *, double *, double *, // Ricci
|
||||||
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
||||||
int &, int &, double &, int &, int &);
|
int &, int &, double &, int &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_Z4c(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
int f_compute_rhs_Z4c(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, // Z4
|
double *, // Z4
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, // Z4
|
double *, // Z4
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *,
|
||||||
int &, int &, double &, int &);
|
int &, int &, double &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_Z4c_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
|
int f_compute_rhs_Z4c_ss(int *, double &, double *, double *, double *, // ex,T,rho,sigma,R
|
||||||
double *, double *, double *, // X,Y,Z
|
double *, double *, double *, // X,Y,Z
|
||||||
double *, double *, double *, // drhodx,drhody,drhodz
|
double *, double *, double *, // drhodx,drhody,drhodz
|
||||||
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
|
double *, double *, double *, // dsigmadx,dsigmady,dsigmadz
|
||||||
double *, double *, double *, // dRdx,dRdy,dRdz
|
double *, double *, double *, // dRdx,dRdy,dRdz
|
||||||
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
double *, double *, double *, double *, double *, double *, // drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
||||||
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
double *, double *, double *, double *, double *, double *, // dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
||||||
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
double *, double *, double *, double *, double *, double *, // dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, // TZ
|
double *, // TZ
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, // TZ
|
double *, // TZ
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, // stress-energy
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Christoffel
|
double *, double *, double *, double *, double *, double *, // Christoffel
|
||||||
double *, double *, double *, double *, double *, double *, // Ricci
|
double *, double *, double *, double *, double *, double *, // Ricci
|
||||||
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
double *, double *, double *, double *, double *, double *, double *, // constraint violation
|
||||||
int &, int &, double &, int &, int &);
|
int &, int &, double &, int &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_Z4cnot(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
int f_compute_rhs_Z4cnot(int *, double &, double *, double *, double *, // ex,T,X,Y,Z
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, // Z4
|
double *, // Z4
|
||||||
double *, double *, // chi, trK
|
double *, double *, // chi, trK
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, // Gam
|
double *, double *, double *, // Gam
|
||||||
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
double *, double *, double *, double *, double *, double *, double *, // Gauge
|
||||||
double *, // Z4
|
double *, // Z4
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *,
|
||||||
int &, int &, double &, int &, double &);
|
int &, int &, double &, int &, double &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_compute_constraint_fr(int *, double *, double *, double *, // ex,X,Y,Z
|
void f_compute_constraint_fr(int *, double *, double *, double *, // ex,X,Y,Z
|
||||||
double *, double *, double *, double *, // chi, trK,rho,Sphi
|
double *, double *, double *, double *, // chi, trK,rho,Sphi
|
||||||
double *, double *, double *, double *, double *, double *, // gij
|
double *, double *, double *, double *, double *, double *, // gij
|
||||||
double *, double *, double *, double *, double *, double *, // Aij
|
double *, double *, double *, double *, double *, double *, // Aij
|
||||||
double *, double *, double *, double *, double *, double *, // Rij
|
double *, double *, double *, double *, double *, double *, // Rij
|
||||||
double *, double *, double *, double *, double *, double *, // Sij
|
double *, double *, double *, double *, double *, double *, // Sij
|
||||||
double *);
|
double *);
|
||||||
} // FR_cons
|
} // FR_cons
|
||||||
|
|
||||||
#endif /* BSSN_H */
|
#endif /* BSSN_H */
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,45 +1,45 @@
|
|||||||
|
|
||||||
#ifndef EMPART_H
|
#ifndef EMPART_H
|
||||||
#define EMPART_H
|
#define EMPART_H
|
||||||
|
|
||||||
#ifdef fortran1
|
#ifdef fortran1
|
||||||
#define f_compute_rhs_empart compute_rhs_empart
|
#define f_compute_rhs_empart compute_rhs_empart
|
||||||
#define f_compute_rhs_empart_ss compute_rhs_empart_ss
|
#define f_compute_rhs_empart_ss compute_rhs_empart_ss
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran2
|
#ifdef fortran2
|
||||||
#define f_compute_rhs_empart COMPUTE_RHS_EMPART
|
#define f_compute_rhs_empart COMPUTE_RHS_EMPART
|
||||||
#define f_compute_rhs_empart_ss COMPUTE_RHS_EMPART_SS
|
#define f_compute_rhs_empart_ss COMPUTE_RHS_EMPART_SS
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran3
|
#ifdef fortran3
|
||||||
#define f_compute_rhs_empart compute_rhs_empart_
|
#define f_compute_rhs_empart compute_rhs_empart_
|
||||||
#define f_compute_rhs_empart_ss compute_rhs_empart_ss_
|
#define f_compute_rhs_empart_ss compute_rhs_empart_ss_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_empart(int *, double *, double *, double *,
|
int f_compute_rhs_empart(int *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
||||||
int &, int &, double &);
|
int &, int &, double &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_compute_rhs_empart_ss(int *, double *, double *, double *, double *, double *, double *,
|
int f_compute_rhs_empart_ss(int *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *, double *, double *, double *, double *,
|
||||||
int &, int &, double &, int &);
|
int &, int &, double &, int &);
|
||||||
}
|
}
|
||||||
#endif /* EMPART_H */
|
#endif /* EMPART_H */
|
||||||
@@ -1,230 +1,230 @@
|
|||||||
|
|
||||||
!-----------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------
|
||||||
!
|
!
|
||||||
! remove the trace of Aij
|
! remove the trace of Aij
|
||||||
! trace-free Aij and enforce the determinant of bssn metric to one
|
! trace-free Aij and enforce the determinant of bssn metric to one
|
||||||
!-----------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------
|
||||||
|
|
||||||
subroutine enforce_ag(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
|
subroutine enforce_ag(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
|
||||||
Axx, Axy, Axz, Ayy, Ayz, Azz)
|
Axx, Axy, Axz, Ayy, Ayz, Azz)
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
!~~~~~~> Input parameters:
|
!~~~~~~> Input parameters:
|
||||||
|
|
||||||
integer, intent(in) :: ex(1:3)
|
integer, intent(in) :: ex(1:3)
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
|
||||||
|
|
||||||
!~~~~~~~> Local variable:
|
!~~~~~~~> Local variable:
|
||||||
|
|
||||||
integer :: i,j,k
|
integer :: i,j,k
|
||||||
real*8 :: lgxx,lgyy,lgzz,ldetg
|
real*8 :: lgxx,lgyy,lgzz,ldetg
|
||||||
real*8 :: lgupxx,lgupxy,lgupxz,lgupyy,lgupyz,lgupzz
|
real*8 :: lgupxx,lgupxy,lgupxz,lgupyy,lgupyz,lgupzz
|
||||||
real*8 :: ltrA,lscale
|
real*8 :: ltrA,lscale
|
||||||
real*8, parameter :: F1o3 = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
|
real*8, parameter :: F1o3 = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
|
||||||
|
|
||||||
!~~~~~~>
|
!~~~~~~>
|
||||||
|
|
||||||
do k=1,ex(3)
|
do k=1,ex(3)
|
||||||
do j=1,ex(2)
|
do j=1,ex(2)
|
||||||
do i=1,ex(1)
|
do i=1,ex(1)
|
||||||
|
|
||||||
lgxx = dxx(i,j,k) + ONE
|
lgxx = dxx(i,j,k) + ONE
|
||||||
lgyy = dyy(i,j,k) + ONE
|
lgyy = dyy(i,j,k) + ONE
|
||||||
lgzz = dzz(i,j,k) + ONE
|
lgzz = dzz(i,j,k) + ONE
|
||||||
|
|
||||||
ldetg = lgxx * lgyy * lgzz &
|
ldetg = lgxx * lgyy * lgzz &
|
||||||
+ gxy(i,j,k) * gyz(i,j,k) * gxz(i,j,k) &
|
+ gxy(i,j,k) * gyz(i,j,k) * gxz(i,j,k) &
|
||||||
+ gxz(i,j,k) * gxy(i,j,k) * gyz(i,j,k) &
|
+ gxz(i,j,k) * gxy(i,j,k) * gyz(i,j,k) &
|
||||||
- gxz(i,j,k) * lgyy * gxz(i,j,k) &
|
- gxz(i,j,k) * lgyy * gxz(i,j,k) &
|
||||||
- gxy(i,j,k) * gxy(i,j,k) * lgzz &
|
- gxy(i,j,k) * gxy(i,j,k) * lgzz &
|
||||||
- lgxx * gyz(i,j,k) * gyz(i,j,k)
|
- lgxx * gyz(i,j,k) * gyz(i,j,k)
|
||||||
|
|
||||||
lgupxx = ( lgyy * lgzz - gyz(i,j,k) * gyz(i,j,k) ) / ldetg
|
lgupxx = ( lgyy * lgzz - gyz(i,j,k) * gyz(i,j,k) ) / ldetg
|
||||||
lgupxy = - ( gxy(i,j,k) * lgzz - gyz(i,j,k) * gxz(i,j,k) ) / ldetg
|
lgupxy = - ( gxy(i,j,k) * lgzz - gyz(i,j,k) * gxz(i,j,k) ) / ldetg
|
||||||
lgupxz = ( gxy(i,j,k) * gyz(i,j,k) - lgyy * gxz(i,j,k) ) / ldetg
|
lgupxz = ( gxy(i,j,k) * gyz(i,j,k) - lgyy * gxz(i,j,k) ) / ldetg
|
||||||
lgupyy = ( lgxx * lgzz - gxz(i,j,k) * gxz(i,j,k) ) / ldetg
|
lgupyy = ( lgxx * lgzz - gxz(i,j,k) * gxz(i,j,k) ) / ldetg
|
||||||
lgupyz = - ( lgxx * gyz(i,j,k) - gxy(i,j,k) * gxz(i,j,k) ) / ldetg
|
lgupyz = - ( lgxx * gyz(i,j,k) - gxy(i,j,k) * gxz(i,j,k) ) / ldetg
|
||||||
lgupzz = ( lgxx * lgyy - gxy(i,j,k) * gxy(i,j,k) ) / ldetg
|
lgupzz = ( lgxx * lgyy - gxy(i,j,k) * gxy(i,j,k) ) / ldetg
|
||||||
|
|
||||||
ltrA = lgupxx * Axx(i,j,k) + lgupyy * Ayy(i,j,k) &
|
ltrA = lgupxx * Axx(i,j,k) + lgupyy * Ayy(i,j,k) &
|
||||||
+ lgupzz * Azz(i,j,k) &
|
+ lgupzz * Azz(i,j,k) &
|
||||||
+ TWO * (lgupxy * Axy(i,j,k) + lgupxz * Axz(i,j,k) &
|
+ TWO * (lgupxy * Axy(i,j,k) + lgupxz * Axz(i,j,k) &
|
||||||
+ lgupyz * Ayz(i,j,k))
|
+ lgupyz * Ayz(i,j,k))
|
||||||
|
|
||||||
Axx(i,j,k) = Axx(i,j,k) - F1o3 * lgxx * ltrA
|
Axx(i,j,k) = Axx(i,j,k) - F1o3 * lgxx * ltrA
|
||||||
Axy(i,j,k) = Axy(i,j,k) - F1o3 * gxy(i,j,k) * ltrA
|
Axy(i,j,k) = Axy(i,j,k) - F1o3 * gxy(i,j,k) * ltrA
|
||||||
Axz(i,j,k) = Axz(i,j,k) - F1o3 * gxz(i,j,k) * ltrA
|
Axz(i,j,k) = Axz(i,j,k) - F1o3 * gxz(i,j,k) * ltrA
|
||||||
Ayy(i,j,k) = Ayy(i,j,k) - F1o3 * lgyy * ltrA
|
Ayy(i,j,k) = Ayy(i,j,k) - F1o3 * lgyy * ltrA
|
||||||
Ayz(i,j,k) = Ayz(i,j,k) - F1o3 * gyz(i,j,k) * ltrA
|
Ayz(i,j,k) = Ayz(i,j,k) - F1o3 * gyz(i,j,k) * ltrA
|
||||||
Azz(i,j,k) = Azz(i,j,k) - F1o3 * lgzz * ltrA
|
Azz(i,j,k) = Azz(i,j,k) - F1o3 * lgzz * ltrA
|
||||||
|
|
||||||
lscale = ONE / ( ldetg ** F1o3 )
|
lscale = ONE / ( ldetg ** F1o3 )
|
||||||
|
|
||||||
dxx(i,j,k) = lgxx * lscale - ONE
|
dxx(i,j,k) = lgxx * lscale - ONE
|
||||||
gxy(i,j,k) = gxy(i,j,k) * lscale
|
gxy(i,j,k) = gxy(i,j,k) * lscale
|
||||||
gxz(i,j,k) = gxz(i,j,k) * lscale
|
gxz(i,j,k) = gxz(i,j,k) * lscale
|
||||||
dyy(i,j,k) = lgyy * lscale - ONE
|
dyy(i,j,k) = lgyy * lscale - ONE
|
||||||
gyz(i,j,k) = gyz(i,j,k) * lscale
|
gyz(i,j,k) = gyz(i,j,k) * lscale
|
||||||
dzz(i,j,k) = lgzz * lscale - ONE
|
dzz(i,j,k) = lgzz * lscale - ONE
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine enforce_ag
|
end subroutine enforce_ag
|
||||||
#if 1
|
#if 1
|
||||||
!----------------------------------------------------------------------------------
|
!----------------------------------------------------------------------------------
|
||||||
! swap the turn of a and g
|
! swap the turn of a and g
|
||||||
!----------------------------------------------------------------------------------
|
!----------------------------------------------------------------------------------
|
||||||
subroutine enforce_ga(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
|
subroutine enforce_ga(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
|
||||||
Axx, Axy, Axz, Ayy, Ayz, Azz)
|
Axx, Axy, Axz, Ayy, Ayz, Azz)
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
!~~~~~~> Input parameters:
|
!~~~~~~> Input parameters:
|
||||||
|
|
||||||
integer, intent(in) :: ex(1:3)
|
integer, intent(in) :: ex(1:3)
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
|
||||||
|
|
||||||
!~~~~~~~> Local variable:
|
!~~~~~~~> Local variable:
|
||||||
|
|
||||||
integer :: i,j,k
|
integer :: i,j,k
|
||||||
real*8 :: lgxx,lgyy,lgzz,lscale
|
real*8 :: lgxx,lgyy,lgzz,lscale
|
||||||
real*8 :: lgxy,lgxz,lgyz
|
real*8 :: lgxy,lgxz,lgyz
|
||||||
real*8 :: lgupxx,lgupxy,lgupxz,lgupyy,lgupyz,lgupzz
|
real*8 :: lgupxx,lgupxy,lgupxz,lgupyy,lgupyz,lgupzz
|
||||||
real*8 :: ltrA
|
real*8 :: ltrA
|
||||||
real*8, parameter :: F1o3 = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
|
real*8, parameter :: F1o3 = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
|
||||||
|
|
||||||
!~~~~~~>
|
!~~~~~~>
|
||||||
|
|
||||||
do k=1,ex(3)
|
do k=1,ex(3)
|
||||||
do j=1,ex(2)
|
do j=1,ex(2)
|
||||||
do i=1,ex(1)
|
do i=1,ex(1)
|
||||||
|
|
||||||
! for g: normalize determinant first
|
! for g: normalize determinant first
|
||||||
lgxx = dxx(i,j,k) + ONE
|
lgxx = dxx(i,j,k) + ONE
|
||||||
lgyy = dyy(i,j,k) + ONE
|
lgyy = dyy(i,j,k) + ONE
|
||||||
lgzz = dzz(i,j,k) + ONE
|
lgzz = dzz(i,j,k) + ONE
|
||||||
lgxy = gxy(i,j,k)
|
lgxy = gxy(i,j,k)
|
||||||
lgxz = gxz(i,j,k)
|
lgxz = gxz(i,j,k)
|
||||||
lgyz = gyz(i,j,k)
|
lgyz = gyz(i,j,k)
|
||||||
|
|
||||||
lscale = lgxx * lgyy * lgzz + lgxy * lgyz * lgxz &
|
lscale = lgxx * lgyy * lgzz + lgxy * lgyz * lgxz &
|
||||||
+ lgxz * lgxy * lgyz - lgxz * lgyy * lgxz &
|
+ lgxz * lgxy * lgyz - lgxz * lgyy * lgxz &
|
||||||
- lgxy * lgxy * lgzz - lgxx * lgyz * lgyz
|
- lgxy * lgxy * lgzz - lgxx * lgyz * lgyz
|
||||||
|
|
||||||
lscale = ONE / ( lscale ** F1o3 )
|
lscale = ONE / ( lscale ** F1o3 )
|
||||||
|
|
||||||
lgxx = lgxx * lscale
|
lgxx = lgxx * lscale
|
||||||
lgxy = lgxy * lscale
|
lgxy = lgxy * lscale
|
||||||
lgxz = lgxz * lscale
|
lgxz = lgxz * lscale
|
||||||
lgyy = lgyy * lscale
|
lgyy = lgyy * lscale
|
||||||
lgyz = lgyz * lscale
|
lgyz = lgyz * lscale
|
||||||
lgzz = lgzz * lscale
|
lgzz = lgzz * lscale
|
||||||
|
|
||||||
dxx(i,j,k) = lgxx - ONE
|
dxx(i,j,k) = lgxx - ONE
|
||||||
gxy(i,j,k) = lgxy
|
gxy(i,j,k) = lgxy
|
||||||
gxz(i,j,k) = lgxz
|
gxz(i,j,k) = lgxz
|
||||||
dyy(i,j,k) = lgyy - ONE
|
dyy(i,j,k) = lgyy - ONE
|
||||||
gyz(i,j,k) = lgyz
|
gyz(i,j,k) = lgyz
|
||||||
dzz(i,j,k) = lgzz - ONE
|
dzz(i,j,k) = lgzz - ONE
|
||||||
|
|
||||||
! for A: trace-free using normalized metric (det=1, no division needed)
|
! for A: trace-free using normalized metric (det=1, no division needed)
|
||||||
lgupxx = ( lgyy * lgzz - lgyz * lgyz )
|
lgupxx = ( lgyy * lgzz - lgyz * lgyz )
|
||||||
lgupxy = - ( lgxy * lgzz - lgyz * lgxz )
|
lgupxy = - ( lgxy * lgzz - lgyz * lgxz )
|
||||||
lgupxz = ( lgxy * lgyz - lgyy * lgxz )
|
lgupxz = ( lgxy * lgyz - lgyy * lgxz )
|
||||||
lgupyy = ( lgxx * lgzz - lgxz * lgxz )
|
lgupyy = ( lgxx * lgzz - lgxz * lgxz )
|
||||||
lgupyz = - ( lgxx * lgyz - lgxy * lgxz )
|
lgupyz = - ( lgxx * lgyz - lgxy * lgxz )
|
||||||
lgupzz = ( lgxx * lgyy - lgxy * lgxy )
|
lgupzz = ( lgxx * lgyy - lgxy * lgxy )
|
||||||
|
|
||||||
ltrA = lgupxx * Axx(i,j,k) + lgupyy * Ayy(i,j,k) &
|
ltrA = lgupxx * Axx(i,j,k) + lgupyy * Ayy(i,j,k) &
|
||||||
+ lgupzz * Azz(i,j,k) &
|
+ lgupzz * Azz(i,j,k) &
|
||||||
+ TWO * (lgupxy * Axy(i,j,k) + lgupxz * Axz(i,j,k) &
|
+ TWO * (lgupxy * Axy(i,j,k) + lgupxz * Axz(i,j,k) &
|
||||||
+ lgupyz * Ayz(i,j,k))
|
+ lgupyz * Ayz(i,j,k))
|
||||||
|
|
||||||
Axx(i,j,k) = Axx(i,j,k) - F1o3 * lgxx * ltrA
|
Axx(i,j,k) = Axx(i,j,k) - F1o3 * lgxx * ltrA
|
||||||
Axy(i,j,k) = Axy(i,j,k) - F1o3 * lgxy * ltrA
|
Axy(i,j,k) = Axy(i,j,k) - F1o3 * lgxy * ltrA
|
||||||
Axz(i,j,k) = Axz(i,j,k) - F1o3 * lgxz * ltrA
|
Axz(i,j,k) = Axz(i,j,k) - F1o3 * lgxz * ltrA
|
||||||
Ayy(i,j,k) = Ayy(i,j,k) - F1o3 * lgyy * ltrA
|
Ayy(i,j,k) = Ayy(i,j,k) - F1o3 * lgyy * ltrA
|
||||||
Ayz(i,j,k) = Ayz(i,j,k) - F1o3 * lgyz * ltrA
|
Ayz(i,j,k) = Ayz(i,j,k) - F1o3 * lgyz * ltrA
|
||||||
Azz(i,j,k) = Azz(i,j,k) - F1o3 * lgzz * ltrA
|
Azz(i,j,k) = Azz(i,j,k) - F1o3 * lgzz * ltrA
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine enforce_ga
|
end subroutine enforce_ga
|
||||||
#else
|
#else
|
||||||
!----------------------------------------------------------------------------------
|
!----------------------------------------------------------------------------------
|
||||||
! duplicate bam
|
! duplicate bam
|
||||||
!----------------------------------------------------------------------------------
|
!----------------------------------------------------------------------------------
|
||||||
subroutine enforce_ga(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
|
subroutine enforce_ga(ex, dxx, gxy, gxz, dyy, gyz, dzz, &
|
||||||
Axx, Axy, Axz, Ayy, Ayz, Azz)
|
Axx, Axy, Axz, Ayy, Ayz, Azz)
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
!~~~~~~> Input parameters:
|
!~~~~~~> Input parameters:
|
||||||
|
|
||||||
integer, intent(in) :: ex(1:3)
|
integer, intent(in) :: ex(1:3)
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: dxx,dyy,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: gxy,gxz,gyz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Axx,Axy,Axz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(inout) :: Ayy,Ayz,Azz
|
||||||
|
|
||||||
!~~~~~~~> Local variable:
|
!~~~~~~~> Local variable:
|
||||||
|
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: trA
|
real*8, dimension(ex(1),ex(2),ex(3)) :: trA
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: aux,detginv
|
real*8, dimension(ex(1),ex(2),ex(3)) :: aux,detginv
|
||||||
real*8, parameter :: oot = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
|
real*8, parameter :: oot = 1.D0 / 3.D0, ONE = 1.D0, TWO = 2.D0
|
||||||
|
|
||||||
!~~~~~~>
|
!~~~~~~>
|
||||||
|
|
||||||
gxx = dxx + ONE
|
gxx = dxx + ONE
|
||||||
gyy = dyy + ONE
|
gyy = dyy + ONE
|
||||||
gzz = dzz + ONE
|
gzz = dzz + ONE
|
||||||
! for g
|
! for g
|
||||||
aux = (2.d0*gxy*gxz*gyz + gxx*gyy*gzz &
|
aux = (2.d0*gxy*gxz*gyz + gxx*gyy*gzz &
|
||||||
- gzz*gxy**2 - gyy*gxz**2 - gxx*gyz**2)**(-oot)
|
- gzz*gxy**2 - gyy*gxz**2 - gxx*gyz**2)**(-oot)
|
||||||
|
|
||||||
gxx = gxx * aux
|
gxx = gxx * aux
|
||||||
gxy = gxy * aux
|
gxy = gxy * aux
|
||||||
gxz = gxz * aux
|
gxz = gxz * aux
|
||||||
gyy = gyy * aux
|
gyy = gyy * aux
|
||||||
gyz = gyz * aux
|
gyz = gyz * aux
|
||||||
gzz = gzz * aux
|
gzz = gzz * aux
|
||||||
|
|
||||||
dxx = gxx - ONE
|
dxx = gxx - ONE
|
||||||
dyy = gyy - ONE
|
dyy = gyy - ONE
|
||||||
dzz = gzz - ONE
|
dzz = gzz - ONE
|
||||||
! for A
|
! for A
|
||||||
|
|
||||||
detginv = 1/(2.d0*gxy*gxz*gyz + gxx*gyy*gzz &
|
detginv = 1/(2.d0*gxy*gxz*gyz + gxx*gyy*gzz &
|
||||||
- gzz*gxy**2 - gyy*gxz**2 - gxx*gyz**2)
|
- gzz*gxy**2 - gyy*gxz**2 - gxx*gyz**2)
|
||||||
|
|
||||||
trA = detginv*(-2.d0*Ayz*gxx*gyz + Axx*gyy*gzz + &
|
trA = detginv*(-2.d0*Ayz*gxx*gyz + Axx*gyy*gzz + &
|
||||||
gxx*(Azz*gyy + Ayy*gzz) + 2.d0*(gxz*(Ayz*gxy - Axz*gyy + &
|
gxx*(Azz*gyy + Ayy*gzz) + 2.d0*(gxz*(Ayz*gxy - Axz*gyy + &
|
||||||
Axy*gyz) + gxy*(Axz*gyz - Axy*gzz)) - Azz*gxy**2 - Ayy*gxz**2 - &
|
Axy*gyz) + gxy*(Axz*gyz - Axy*gzz)) - Azz*gxy**2 - Ayy*gxz**2 - &
|
||||||
Axx*gyz**2)
|
Axx*gyz**2)
|
||||||
|
|
||||||
aux = -(oot*trA)
|
aux = -(oot*trA)
|
||||||
|
|
||||||
Axx = Axx + aux * gxx
|
Axx = Axx + aux * gxx
|
||||||
Axy = Axy + aux * gxy
|
Axy = Axy + aux * gxy
|
||||||
Axz = Axz + aux * gxz
|
Axz = Axz + aux * gxz
|
||||||
Ayy = Ayy + aux * gyy
|
Ayy = Ayy + aux * gyy
|
||||||
Ayz = Ayz + aux * gyz
|
Ayz = Ayz + aux * gyz
|
||||||
Azz = Azz + aux * gzz
|
Azz = Azz + aux * gzz
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine enforce_ga
|
end subroutine enforce_ga
|
||||||
#endif
|
#endif
|
||||||
@@ -1,30 +1,30 @@
|
|||||||
|
|
||||||
#ifndef ENFORCE_ALGEBRA_H
|
#ifndef ENFORCE_ALGEBRA_H
|
||||||
#define ENFORCE_ALGEBRA_H
|
#define ENFORCE_ALGEBRA_H
|
||||||
|
|
||||||
#ifdef fortran1
|
#ifdef fortran1
|
||||||
#define f_enforce_ag enforce_ag
|
#define f_enforce_ag enforce_ag
|
||||||
#define f_enforce_ga enforce_ga
|
#define f_enforce_ga enforce_ga
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran2
|
#ifdef fortran2
|
||||||
#define f_enforce_ag ENFORCE_AG
|
#define f_enforce_ag ENFORCE_AG
|
||||||
#define f_enforce_ga ENFORCE_GA
|
#define f_enforce_ga ENFORCE_GA
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran3
|
#ifdef fortran3
|
||||||
#define f_enforce_ag enforce_ag_
|
#define f_enforce_ag enforce_ag_
|
||||||
#define f_enforce_ga enforce_ga_
|
#define f_enforce_ga enforce_ga_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_enforce_ag(int *,
|
void f_enforce_ag(int *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *);
|
double *, double *, double *, double *, double *, double *);
|
||||||
}
|
}
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_enforce_ga(int *,
|
void f_enforce_ga(int *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *);
|
double *, double *, double *, double *, double *, double *);
|
||||||
}
|
}
|
||||||
#endif /* ENFORCE_ALGEBRA_H */
|
#endif /* ENFORCE_ALGEBRA_H */
|
||||||
@@ -1,245 +1,245 @@
|
|||||||
|
|
||||||
!-----------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------
|
||||||
! ADM quantites for surface intergral
|
! ADM quantites for surface intergral
|
||||||
!-----------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------
|
||||||
subroutine admmass_bssn(ex, X, Y, Z, &
|
subroutine admmass_bssn(ex, X, Y, Z, &
|
||||||
chi , trK, &
|
chi , trK, &
|
||||||
dxx , gxy , gxz , dyy , gyz , dzz , &
|
dxx , gxy , gxz , dyy , gyz , dzz , &
|
||||||
Axx , Axy , Axz , Ayy , Ayz , Azz , &
|
Axx , Axy , Axz , Ayy , Ayz , Azz , &
|
||||||
Gamx , Gamy , Gamz , &
|
Gamx , Gamy , Gamz , &
|
||||||
massx,massy,massz, symmetry)
|
massx,massy,massz, symmetry)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
!~~~~~~= Input parameters:
|
!~~~~~~= Input parameters:
|
||||||
|
|
||||||
integer,intent(in) :: ex(1:3),symmetry
|
integer,intent(in) :: ex(1:3),symmetry
|
||||||
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: massx,massy,massz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: massx,massy,massz
|
||||||
! local variables
|
! local variables
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
|
||||||
! inverse metric
|
! inverse metric
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
||||||
! partial derivative of chi, chi_i
|
! partial derivative of chi, chi_i
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: chix,chiy,chiz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: chix,chiy,chiz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: f
|
real*8, dimension(ex(1),ex(2),ex(3)) :: f
|
||||||
real*8 :: PI, F1o2pi
|
real*8 :: PI, F1o2pi
|
||||||
real*8, parameter :: ONE = 1.d0, F1o8 = 1.d0/8.d0
|
real*8, parameter :: ONE = 1.d0, F1o8 = 1.d0/8.d0
|
||||||
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
|
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
|
||||||
real*8 :: dX, dY, dZ
|
real*8 :: dX, dY, dZ
|
||||||
|
|
||||||
dX = X(2) - X(1)
|
dX = X(2) - X(1)
|
||||||
dY = Y(2) - Y(1)
|
dY = Y(2) - Y(1)
|
||||||
dZ = Z(2) - Z(1)
|
dZ = Z(2) - Z(1)
|
||||||
|
|
||||||
PI = dacos( - ONE )
|
PI = dacos( - ONE )
|
||||||
F1o2pi = ONE / ( 2.d0 * PI )
|
F1o2pi = ONE / ( 2.d0 * PI )
|
||||||
|
|
||||||
gxx = dxx + ONE
|
gxx = dxx + ONE
|
||||||
gyy = dyy + ONE
|
gyy = dyy + ONE
|
||||||
gzz = dzz + ONE
|
gzz = dzz + ONE
|
||||||
|
|
||||||
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
||||||
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
||||||
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
||||||
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
||||||
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
||||||
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
||||||
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
||||||
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
||||||
|
|
||||||
call fderivs(ex,chi,chix,chiy,chiz,X,Y,Z,SYM,SYM,SYM,Symmetry,0)
|
call fderivs(ex,chi,chix,chiy,chiz,X,Y,Z,SYM,SYM,SYM,Symmetry,0)
|
||||||
|
|
||||||
f=1/4.d0/(chi+ONE)**1.25d0
|
f=1/4.d0/(chi+ONE)**1.25d0
|
||||||
! mass_i = (Gami/8 + gupij*phi_j/(4*chi^1.25))/(2*Pi)
|
! mass_i = (Gami/8 + gupij*phi_j/(4*chi^1.25))/(2*Pi)
|
||||||
massx = (F1o8*Gamx + f*(gupxx*chix+gupxy*chiy+gupxz*chiz))*F1o2pi
|
massx = (F1o8*Gamx + f*(gupxx*chix+gupxy*chiy+gupxz*chiz))*F1o2pi
|
||||||
massy = (F1o8*Gamy + f*(gupxy*chix+gupyy*chiy+gupyz*chiz))*F1o2pi
|
massy = (F1o8*Gamy + f*(gupxy*chix+gupyy*chiy+gupyz*chiz))*F1o2pi
|
||||||
massz = (F1o8*Gamz + f*(gupxz*chix+gupyz*chiy+gupzz*chiz))*F1o2pi
|
massz = (F1o8*Gamz + f*(gupxz*chix+gupyz*chiy+gupzz*chiz))*F1o2pi
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine admmass_bssn
|
end subroutine admmass_bssn
|
||||||
!-----------------------------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------------------------
|
||||||
! P^i = int r^j p_ji
|
! P^i = int r^j p_ji
|
||||||
!-----------------------------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------------------------
|
||||||
subroutine admmomentum_bssn(ex, &
|
subroutine admmomentum_bssn(ex, &
|
||||||
chi, trK, &
|
chi, trK, &
|
||||||
dxx , gxy , gxz , dyy , gyz , dzz , &
|
dxx , gxy , gxz , dyy , gyz , dzz , &
|
||||||
Axx , Axy , Axz , Ayy , Ayz , Azz , &
|
Axx , Axy , Axz , Ayy , Ayz , Azz , &
|
||||||
Gamx , Gamy , Gamz , &
|
Gamx , Gamy , Gamz , &
|
||||||
pxx,pxy,pxz,pyy,pyz,pzz)
|
pxx,pxy,pxz,pyy,pyz,pzz)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
!~~~~~~= Input parameters:
|
!~~~~~~= Input parameters:
|
||||||
|
|
||||||
integer,intent(in) :: ex(1:3)
|
integer,intent(in) :: ex(1:3)
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: pxx,pxy,pxz,pyy,pyz,pzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: pxx,pxy,pxz,pyy,pyz,pzz
|
||||||
! local variables
|
! local variables
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: Kxx,Kxy,Kxz,Kyy,Kyz,Kzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,chim4
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,chim4
|
||||||
real*8 :: PI, F1o8pi
|
real*8 :: PI, F1o8pi
|
||||||
real*8, parameter :: ONE = 1.d0, F1o3 = 1.d0/3.d0
|
real*8, parameter :: ONE = 1.d0, F1o3 = 1.d0/3.d0
|
||||||
|
|
||||||
PI = acos( - ONE )
|
PI = acos( - ONE )
|
||||||
F1o8pi = ONE / ( 8.d0 * PI )
|
F1o8pi = ONE / ( 8.d0 * PI )
|
||||||
|
|
||||||
gxx = dxx + ONE
|
gxx = dxx + ONE
|
||||||
gyy = dyy + ONE
|
gyy = dyy + ONE
|
||||||
gzz = dzz + ONE
|
gzz = dzz + ONE
|
||||||
|
|
||||||
chim4=1.d0/(chi+ONE)**4
|
chim4=1.d0/(chi+ONE)**4
|
||||||
Kxx = chim4*(Axx+F1o3*gxx*trK)
|
Kxx = chim4*(Axx+F1o3*gxx*trK)
|
||||||
Kxy = chim4*(Axy+F1o3*gxy*trK)
|
Kxy = chim4*(Axy+F1o3*gxy*trK)
|
||||||
Kxz = chim4*(Axz+F1o3*gxz*trK)
|
Kxz = chim4*(Axz+F1o3*gxz*trK)
|
||||||
Kyy = chim4*(Ayy+F1o3*gyy*trK)
|
Kyy = chim4*(Ayy+F1o3*gyy*trK)
|
||||||
Kyz = chim4*(Ayz+F1o3*gyz*trK)
|
Kyz = chim4*(Ayz+F1o3*gyz*trK)
|
||||||
Kzz = chim4*(Azz+F1o3*gzz*trK)
|
Kzz = chim4*(Azz+F1o3*gzz*trK)
|
||||||
|
|
||||||
pxx = (Kxx-trK)*F1o8pi
|
pxx = (Kxx-trK)*F1o8pi
|
||||||
pxy = (Kxy )*F1o8pi
|
pxy = (Kxy )*F1o8pi
|
||||||
pxz = (Kxz )*F1o8pi
|
pxz = (Kxz )*F1o8pi
|
||||||
pyy = (Kyy-trK)*F1o8pi
|
pyy = (Kyy-trK)*F1o8pi
|
||||||
pyz = (Kyz )*F1o8pi
|
pyz = (Kyz )*F1o8pi
|
||||||
pzz = (Kzz-trK)*F1o8pi
|
pzz = (Kzz-trK)*F1o8pi
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine admmomentum_bssn
|
end subroutine admmomentum_bssn
|
||||||
!-----------------------------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------------------------
|
||||||
! S^i = int r^j s_ji
|
! S^i = int r^j s_ji
|
||||||
!-----------------------------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------------------------
|
||||||
subroutine admangularmomentum_bssn(ex,X,Y,Z,&
|
subroutine admangularmomentum_bssn(ex,X,Y,Z,&
|
||||||
pxx,pxy,pxz,pyy,pyz,pzz, &
|
pxx,pxy,pxz,pyy,pyz,pzz, &
|
||||||
sxx,sxy,sxz,syx,syy,syz,szx,szy,szz)
|
sxx,sxy,sxz,syx,syy,syz,szx,szy,szz)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
!~~~~~~= Input parameters:
|
!~~~~~~= Input parameters:
|
||||||
|
|
||||||
integer,intent(in) :: ex(1:3)
|
integer,intent(in) :: ex(1:3)
|
||||||
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: pxx,pxy,pxz,pyy,pyz,pzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: pxx,pxy,pxz,pyy,pyz,pzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: sxx,sxy,sxz,syx,syy,syz,szx,szy,szz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: sxx,sxy,sxz,syx,syy,syz,szx,szy,szz
|
||||||
!local variable
|
!local variable
|
||||||
real*8, dimension(ex(1),ex(2),ex(3))::XX,YY,ZZ
|
real*8, dimension(ex(1),ex(2),ex(3))::XX,YY,ZZ
|
||||||
integer::i,j,k
|
integer::i,j,k
|
||||||
|
|
||||||
do j = 1,ex(2)
|
do j = 1,ex(2)
|
||||||
do k = 1,ex(3)
|
do k = 1,ex(3)
|
||||||
XX(:,j,k) = X
|
XX(:,j,k) = X
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
do i = 1,ex(1)
|
do i = 1,ex(1)
|
||||||
do k = 1,ex(3)
|
do k = 1,ex(3)
|
||||||
YY(i,:,k) = Y
|
YY(i,:,k) = Y
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
do i = 1,ex(1)
|
do i = 1,ex(1)
|
||||||
do j = 1,ex(2)
|
do j = 1,ex(2)
|
||||||
ZZ(i,j,:) = Z
|
ZZ(i,j,:) = Z
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
sxx = YY*pxy - ZZ*pxz
|
sxx = YY*pxy - ZZ*pxz
|
||||||
sxy = YY*pyy - ZZ*pyz
|
sxy = YY*pyy - ZZ*pyz
|
||||||
sxz = YY*pyz - ZZ*pzz
|
sxz = YY*pyz - ZZ*pzz
|
||||||
syx = ZZ*pxy - YY*pxz
|
syx = ZZ*pxy - YY*pxz
|
||||||
syy = ZZ*pyy - YY*pyz
|
syy = ZZ*pyy - YY*pyz
|
||||||
syz = ZZ*pyz - YY*pzz
|
syz = ZZ*pyz - YY*pzz
|
||||||
szx = XX*pxy - YY*pxx
|
szx = XX*pxy - YY*pxx
|
||||||
szy = XX*pyy - YY*pxy
|
szy = XX*pyy - YY*pxy
|
||||||
szz = XX*pyz - YY*pxz
|
szz = XX*pyz - YY*pxz
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine admangularmomentum_bssn
|
end subroutine admangularmomentum_bssn
|
||||||
|
|
||||||
! for shell
|
! for shell
|
||||||
subroutine admmass_bssn_ss(ex,crho,sigma,R, X, Y, Z, &
|
subroutine admmass_bssn_ss(ex,crho,sigma,R, X, Y, Z, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz, &
|
dRdx,dRdy,dRdz, &
|
||||||
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
|
drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz, &
|
||||||
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
|
dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz, &
|
||||||
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
|
dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz, &
|
||||||
chi , trK, &
|
chi , trK, &
|
||||||
dxx , gxy , gxz , dyy , gyz , dzz , &
|
dxx , gxy , gxz , dyy , gyz , dzz , &
|
||||||
Axx , Axy , Axz , Ayy , Ayz , Azz , &
|
Axx , Axy , Axz , Ayy , Ayz , Azz , &
|
||||||
Gamx , Gamy , Gamz , &
|
Gamx , Gamy , Gamz , &
|
||||||
massx,massy,massz, symmetry,sst)
|
massx,massy,massz, symmetry,sst)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
!~~~~~~= Input parameters:
|
!~~~~~~= Input parameters:
|
||||||
|
|
||||||
integer,intent(in) :: ex(1:3),symmetry,sst
|
integer,intent(in) :: ex(1:3),symmetry,sst
|
||||||
double precision,intent(in),dimension(ex(1))::crho
|
double precision,intent(in),dimension(ex(1))::crho
|
||||||
double precision,intent(in),dimension(ex(2))::sigma
|
double precision,intent(in),dimension(ex(2))::sigma
|
||||||
double precision,intent(in),dimension(ex(3))::R
|
double precision,intent(in),dimension(ex(3))::R
|
||||||
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodx, drhody, drhodz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadx,dsigmady,dsigmadz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdx,dRdy,dRdz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::drhodxx,drhodxy,drhodxz,drhodyy,drhodyz,drhodzz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dsigmadxx,dsigmadxy,dsigmadxz,dsigmadyy,dsigmadyz,dsigmadzz
|
||||||
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
double precision,intent(in),dimension(ex(1),ex(2),ex(3))::dRdxx,dRdxy,dRdxz,dRdyy,dRdyz,dRdzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Gamx,Gamy,Gamz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: massx,massy,massz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(out) :: massx,massy,massz
|
||||||
! local variables
|
! local variables
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz
|
||||||
! inverse metric
|
! inverse metric
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
||||||
! partial derivative of chi, chi_i
|
! partial derivative of chi, chi_i
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: chix,chiy,chiz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: chix,chiy,chiz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: f
|
real*8, dimension(ex(1),ex(2),ex(3)) :: f
|
||||||
real*8 :: PI, F1o2pi
|
real*8 :: PI, F1o2pi
|
||||||
real*8, parameter :: ONE = 1.d0, F1o8 = 1.d0/8.d0
|
real*8, parameter :: ONE = 1.d0, F1o8 = 1.d0/8.d0
|
||||||
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
|
real*8, parameter :: SYM = 1.D0, ANTI= - 1.D0
|
||||||
real*8 :: dX, dY, dZ
|
real*8 :: dX, dY, dZ
|
||||||
|
|
||||||
dX = X(2) - X(1)
|
dX = X(2) - X(1)
|
||||||
dY = Y(2) - Y(1)
|
dY = Y(2) - Y(1)
|
||||||
dZ = Z(2) - Z(1)
|
dZ = Z(2) - Z(1)
|
||||||
|
|
||||||
PI = dacos( - ONE )
|
PI = dacos( - ONE )
|
||||||
F1o2pi = ONE / ( 2.d0 * PI )
|
F1o2pi = ONE / ( 2.d0 * PI )
|
||||||
|
|
||||||
gxx = dxx + ONE
|
gxx = dxx + ONE
|
||||||
gyy = dyy + ONE
|
gyy = dyy + ONE
|
||||||
gzz = dzz + ONE
|
gzz = dzz + ONE
|
||||||
|
|
||||||
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
||||||
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
||||||
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
||||||
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
||||||
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
||||||
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
||||||
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
||||||
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
||||||
|
|
||||||
call fderivs_shc(ex,chi,chix,chiy,chiz,crho,sigma,R, SYM, SYM,SYM,Symmetry,0,sst, &
|
call fderivs_shc(ex,chi,chix,chiy,chiz,crho,sigma,R, SYM, SYM,SYM,Symmetry,0,sst, &
|
||||||
drhodx, drhody, drhodz, &
|
drhodx, drhody, drhodz, &
|
||||||
dsigmadx,dsigmady,dsigmadz, &
|
dsigmadx,dsigmady,dsigmadz, &
|
||||||
dRdx,dRdy,dRdz)
|
dRdx,dRdy,dRdz)
|
||||||
|
|
||||||
f=1/4.d0/(chi+ONE)**1.25d0
|
f=1/4.d0/(chi+ONE)**1.25d0
|
||||||
! mass_i = (Gami/8 + gupij*phi_j/(4*chi^1.25))/(2*Pi)
|
! mass_i = (Gami/8 + gupij*phi_j/(4*chi^1.25))/(2*Pi)
|
||||||
massx = (F1o8*Gamx + f*(gupxx*chix+gupxy*chiy+gupxz*chiz))*F1o2pi
|
massx = (F1o8*Gamx + f*(gupxx*chix+gupxy*chiy+gupxz*chiz))*F1o2pi
|
||||||
massy = (F1o8*Gamy + f*(gupxy*chix+gupyy*chiy+gupyz*chiz))*F1o2pi
|
massy = (F1o8*Gamy + f*(gupxy*chix+gupyy*chiy+gupyz*chiz))*F1o2pi
|
||||||
massz = (F1o8*Gamz + f*(gupxz*chix+gupyz*chiy+gupzz*chiz))*F1o2pi
|
massz = (F1o8*Gamz + f*(gupxz*chix+gupyz*chiy+gupzz*chiz))*F1o2pi
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine admmass_bssn_ss
|
end subroutine admmass_bssn_ss
|
||||||
@@ -1,60 +1,60 @@
|
|||||||
|
|
||||||
#ifndef FADMQUANTITES_H
|
#ifndef FADMQUANTITES_H
|
||||||
#define FADMQUANTITES_H
|
#define FADMQUANTITES_H
|
||||||
|
|
||||||
#ifdef fortran1
|
#ifdef fortran1
|
||||||
#define f_admmass_bssn admmass_bssn
|
#define f_admmass_bssn admmass_bssn
|
||||||
#define f_admmass_bssn_ss admmass_bssn_ss
|
#define f_admmass_bssn_ss admmass_bssn_ss
|
||||||
#define f_admmomentum_bssn admmomentum_bssn
|
#define f_admmomentum_bssn admmomentum_bssn
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran2
|
#ifdef fortran2
|
||||||
#define f_admmass_bssn ADMMASS_BSSN
|
#define f_admmass_bssn ADMMASS_BSSN
|
||||||
#define f_admmass_bssn_ss ADMMASS_BSSN_SS
|
#define f_admmass_bssn_ss ADMMASS_BSSN_SS
|
||||||
#define f_admmomentum_bssn ADMMOMENTUM_BSSN
|
#define f_admmomentum_bssn ADMMOMENTUM_BSSN
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran3
|
#ifdef fortran3
|
||||||
#define f_admmass_bssn admmass_bssn_
|
#define f_admmass_bssn admmass_bssn_
|
||||||
#define f_admmass_bssn_ss admmass_bssn_ss_
|
#define f_admmass_bssn_ss admmass_bssn_ss_
|
||||||
#define f_admmomentum_bssn admmomentum_bssn_
|
#define f_admmomentum_bssn admmomentum_bssn_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_admmass_bssn(int *, double *, double *, double *,
|
void f_admmass_bssn(int *, double *, double *, double *,
|
||||||
double *, double *,
|
double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
int &);
|
int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_admmass_bssn_ss(int *, double *, double *, double *,
|
void f_admmass_bssn_ss(int *, double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *,
|
double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
int &, int &);
|
int &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_admmomentum_bssn(int *, double *, double *, double *,
|
void f_admmomentum_bssn(int *, double *, double *, double *,
|
||||||
double *, double *,
|
double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *,
|
double *, double *, double *, double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *,
|
double *, double *, double *,
|
||||||
double *, double *, double *, double *, double *, double *);
|
double *, double *, double *, double *, double *, double *);
|
||||||
}
|
}
|
||||||
#endif /* FADMQUANTITES_H */
|
#endif /* FADMQUANTITES_H */
|
||||||
@@ -1,91 +1,91 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "macrodef.fh"
|
#include "macrodef.fh"
|
||||||
|
|
||||||
!-----------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------
|
||||||
!
|
!
|
||||||
! compute 4 dimensional Ricci scalar
|
! compute 4 dimensional Ricci scalar
|
||||||
! this routine is valid for both box and shell
|
! this routine is valid for both box and shell
|
||||||
!
|
!
|
||||||
!-----------------------------------------------------------------------------
|
!-----------------------------------------------------------------------------
|
||||||
|
|
||||||
subroutine get4ricciscalar(ex, X, Y, Z, &
|
subroutine get4ricciscalar(ex, X, Y, Z, &
|
||||||
chi, trK, rho, &
|
chi, trK, rho, &
|
||||||
dxx,gxy,gxz,dyy,gyz,dzz, &
|
dxx,gxy,gxz,dyy,gyz,dzz, &
|
||||||
Axx,Axy,Axz,Ayy,Ayz,Azz, &
|
Axx,Axy,Axz,Ayy,Ayz,Azz, &
|
||||||
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
|
Rxx,Rxy,Rxz,Ryy,Ryz,Rzz,&
|
||||||
Sxx,Sxy,Sxz,Syy,Syz,Szz,&
|
Sxx,Sxy,Sxz,Syy,Syz,Szz,&
|
||||||
RR)
|
RR)
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
!~~~~~~> Input parameters:
|
!~~~~~~> Input parameters:
|
||||||
|
|
||||||
integer,intent(in ):: ex(1:3)
|
integer,intent(in ):: ex(1:3)
|
||||||
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
real*8, intent(in ):: X(1:ex(1)),Y(1:ex(2)),Z(1:ex(3))
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: dxx,gxy,gxz,dyy,gyz,dzz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: Axx,Axy,Axz,Ayy,Ayz,Azz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK,rho
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in ) :: chi,trK,rho
|
||||||
! physical Ricci tensor
|
! physical Ricci tensor
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: Rxx,Rxy,Rxz,Ryy,Ryz,Rzz
|
||||||
! matter
|
! matter
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: Sxx,Sxy,Sxz,Syy,Syz,Szz
|
real*8, dimension(ex(1),ex(2),ex(3)),intent(in) :: Sxx,Sxy,Sxz,Syy,Syz,Szz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)), intent(out):: RR
|
real*8, dimension(ex(1),ex(2),ex(3)), intent(out):: RR
|
||||||
|
|
||||||
!~~~~~~> Other variables:
|
!~~~~~~> Other variables:
|
||||||
|
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,chipn1
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gxx,gyy,gzz,chipn1
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupxx,gupxy,gupxz
|
||||||
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
real*8, dimension(ex(1),ex(2),ex(3)) :: gupyy,gupyz,gupzz
|
||||||
real*8, parameter :: ONE = 1.d0, TWO = 2.d0, THR = 3.d0, F8 = 8.d0, F2o3 = 2.d0/3.d0
|
real*8, parameter :: ONE = 1.d0, TWO = 2.d0, THR = 3.d0, F8 = 8.d0, F2o3 = 2.d0/3.d0
|
||||||
real*8 :: PI
|
real*8 :: PI
|
||||||
|
|
||||||
PI = dacos(-ONE)
|
PI = dacos(-ONE)
|
||||||
|
|
||||||
gxx = dxx + ONE
|
gxx = dxx + ONE
|
||||||
gyy = dyy + ONE
|
gyy = dyy + ONE
|
||||||
gzz = dzz + ONE
|
gzz = dzz + ONE
|
||||||
chipn1= chi + ONE
|
chipn1= chi + ONE
|
||||||
|
|
||||||
! invert tilted metric
|
! invert tilted metric
|
||||||
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
gupzz = gxx * gyy * gzz + gxy * gyz * gxz + gxz * gxy * gyz - &
|
||||||
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
gxz * gyy * gxz - gxy * gxy * gzz - gxx * gyz * gyz
|
||||||
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
gupxx = ( gyy * gzz - gyz * gyz ) / gupzz
|
||||||
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
gupxy = - ( gxy * gzz - gyz * gxz ) / gupzz
|
||||||
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
gupxz = ( gxy * gyz - gyy * gxz ) / gupzz
|
||||||
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
gupyy = ( gxx * gzz - gxz * gxz ) / gupzz
|
||||||
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
gupyz = - ( gxx * gyz - gxy * gxz ) / gupzz
|
||||||
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
gupzz = ( gxx * gyy - gxy * gxy ) / gupzz
|
||||||
|
|
||||||
RR =(gupxx * ( &
|
RR =(gupxx * ( &
|
||||||
gupxx * Axx * Axx + gupyy * Axy * Axy + gupzz * Axz * Axz + &
|
gupxx * Axx * Axx + gupyy * Axy * Axy + gupzz * Axz * Axz + &
|
||||||
TWO * (gupxy * Axx * Axy + gupxz * Axx * Axz + gupyz * Axy * Axz) ) + &
|
TWO * (gupxy * Axx * Axy + gupxz * Axx * Axz + gupyz * Axy * Axz) ) + &
|
||||||
gupyy * ( &
|
gupyy * ( &
|
||||||
gupxx * Axy * Axy + gupyy * Ayy * Ayy + gupzz * Ayz * Ayz + &
|
gupxx * Axy * Axy + gupyy * Ayy * Ayy + gupzz * Ayz * Ayz + &
|
||||||
TWO * (gupxy * Axy * Ayy + gupxz * Axy * Ayz + gupyz * Ayy * Ayz) ) + &
|
TWO * (gupxy * Axy * Ayy + gupxz * Axy * Ayz + gupyz * Ayy * Ayz) ) + &
|
||||||
gupzz * ( &
|
gupzz * ( &
|
||||||
gupxx * Axz * Axz + gupyy * Ayz * Ayz + gupzz * Azz * Azz + &
|
gupxx * Axz * Axz + gupyy * Ayz * Ayz + gupzz * Azz * Azz + &
|
||||||
TWO * (gupxy * Axz * Ayz + gupxz * Axz * Azz + gupyz * Ayz * Azz) ) + &
|
TWO * (gupxy * Axz * Ayz + gupxz * Axz * Azz + gupyz * Ayz * Azz) ) + &
|
||||||
TWO * ( &
|
TWO * ( &
|
||||||
gupxy * ( &
|
gupxy * ( &
|
||||||
gupxx * Axx * Axy + gupyy * Axy * Ayy + gupzz * Axz * Ayz + &
|
gupxx * Axx * Axy + gupyy * Axy * Ayy + gupzz * Axz * Ayz + &
|
||||||
gupxy * (Axx * Ayy + Axy * Axy) + &
|
gupxy * (Axx * Ayy + Axy * Axy) + &
|
||||||
gupxz * (Axx * Ayz + Axz * Axy) + &
|
gupxz * (Axx * Ayz + Axz * Axy) + &
|
||||||
gupyz * (Axy * Ayz + Axz * Ayy) ) + &
|
gupyz * (Axy * Ayz + Axz * Ayy) ) + &
|
||||||
gupxz * ( &
|
gupxz * ( &
|
||||||
gupxx * Axx * Axz + gupyy * Axy * Ayz + gupzz * Axz * Azz + &
|
gupxx * Axx * Axz + gupyy * Axy * Ayz + gupzz * Axz * Azz + &
|
||||||
gupxy * (Axx * Ayz + Axy * Axz) + &
|
gupxy * (Axx * Ayz + Axy * Axz) + &
|
||||||
gupxz * (Axx * Azz + Axz * Axz) + &
|
gupxz * (Axx * Azz + Axz * Axz) + &
|
||||||
gupyz * (Axy * Azz + Axz * Ayz) ) + &
|
gupyz * (Axy * Azz + Axz * Ayz) ) + &
|
||||||
gupyz * ( &
|
gupyz * ( &
|
||||||
gupxx * Axy * Axz + gupyy * Ayy * Ayz + gupzz * Ayz * Azz + &
|
gupxx * Axy * Axz + gupyy * Ayy * Ayz + gupzz * Ayz * Azz + &
|
||||||
gupxy * (Axy * Ayz + Ayy * Axz) + &
|
gupxy * (Axy * Ayz + Ayy * Axz) + &
|
||||||
gupxz * (Axy * Azz + Ayz * Axz) + &
|
gupxz * (Axy * Azz + Ayz * Axz) + &
|
||||||
gupyz * (Ayy * Azz + Ayz * Ayz) ) )) - F2o3*trK*trK &
|
gupyz * (Ayy * Azz + Ayz * Ayz) ) )) - F2o3*trK*trK &
|
||||||
-(gupxx*Rxx+gupyy*Ryy+gupzz*Rzz+TWO*(gupxy*Rxy+gupxz*Rxz+gupyz*Ryz))*chipn1 &
|
-(gupxx*Rxx+gupyy*Ryy+gupzz*Rzz+TWO*(gupxy*Rxy+gupxz*Rxz+gupyz*Ryz))*chipn1 &
|
||||||
-F8*PI*(THR*rho- &
|
-F8*PI*(THR*rho- &
|
||||||
(gupxx*Sxx+gupyy*Syy+gupzz*Szz+TWO*(gupxy*Sxy+gupxz*Sxz+gupyz*Syz))*chipn1)
|
(gupxx*Sxx+gupyy*Syy+gupzz*Szz+TWO*(gupxy*Sxy+gupxz*Sxz+gupyz*Syz))*chipn1)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
end subroutine get4ricciscalar
|
end subroutine get4ricciscalar
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,55 +1,55 @@
|
|||||||
|
|
||||||
#ifndef PROLONGRESTRICT_H
|
#ifndef PROLONGRESTRICT_H
|
||||||
#define PROLONGRESTRICT_H
|
#define PROLONGRESTRICT_H
|
||||||
|
|
||||||
#ifdef fortran1
|
#ifdef fortran1
|
||||||
#define f_prolong3 prolong3
|
#define f_prolong3 prolong3
|
||||||
#define f_prolongmix3 prolongmix3
|
#define f_prolongmix3 prolongmix3
|
||||||
#define f_prolongcopy3 prolongcopy3
|
#define f_prolongcopy3 prolongcopy3
|
||||||
#define f_restrict3 restrict3
|
#define f_restrict3 restrict3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef fortran2
|
#ifdef fortran2
|
||||||
#define f_prolong3 PROLONG3
|
#define f_prolong3 PROLONG3
|
||||||
#define f_prolongmix3 PROLONGMIX3
|
#define f_prolongmix3 PROLONGMIX3
|
||||||
#define f_prolongcopy3 PROLONGCOPY3
|
#define f_prolongcopy3 PROLONGCOPY3
|
||||||
#define f_restrict3 RESTRICT3
|
#define f_restrict3 RESTRICT3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef fortran3
|
#ifdef fortran3
|
||||||
#define f_prolong3 prolong3_
|
#define f_prolong3 prolong3_
|
||||||
#define f_prolongmix3 prolongmix3_
|
#define f_prolongmix3 prolongmix3_
|
||||||
#define f_prolongcopy3 prolongcopy3_
|
#define f_prolongcopy3 prolongcopy3_
|
||||||
#define f_restrict3 restrict3_
|
#define f_restrict3 restrict3_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_prolong3(int &, double *, double *, int *, double *,
|
int f_prolong3(int &, double *, double *, int *, double *,
|
||||||
double *, double *, int *, double *,
|
double *, double *, int *, double *,
|
||||||
double *, double *, double *, int &);
|
double *, double *, double *, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_restrict3(int &, double *, double *, int *, double *,
|
void f_restrict3(int &, double *, double *, int *, double *,
|
||||||
double *, double *, int *, double *,
|
double *, double *, int *, double *,
|
||||||
double *, double *, double *, int &);
|
double *, double *, double *, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_prolongmix3(int &, double *, double *, int *, double *,
|
int f_prolongmix3(int &, double *, double *, int *, double *,
|
||||||
double *, double *, int *, double *,
|
double *, double *, int *, double *,
|
||||||
double *, double *, double *, int &,
|
double *, double *, double *, int &,
|
||||||
double *, double *);
|
double *, double *);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
int f_prolongcopy3(int &, double *, double *, int *, double *,
|
int f_prolongcopy3(int &, double *, double *, int *, double *,
|
||||||
double *, double *, int *, double *,
|
double *, double *, int *, double *,
|
||||||
double *, double *, double *, int &);
|
double *, double *, double *, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* PROLONGRESTRICT_H */
|
#endif /* PROLONGRESTRICT_H */
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,53 +1,53 @@
|
|||||||
|
|
||||||
#ifndef SOMMERFELD_ROUT_H
|
#ifndef SOMMERFELD_ROUT_H
|
||||||
#define SOMMERFELD_ROUT_H
|
#define SOMMERFELD_ROUT_H
|
||||||
|
|
||||||
#ifdef fortran1
|
#ifdef fortran1
|
||||||
#define f_sommerfeld_rout sommerfeld_rout
|
#define f_sommerfeld_rout sommerfeld_rout
|
||||||
#define f_sommerfeld_routbam sommerfeld_routbam
|
#define f_sommerfeld_routbam sommerfeld_routbam
|
||||||
#define f_sommerfeld_routbam_ss sommerfeld_routbam_ss
|
#define f_sommerfeld_routbam_ss sommerfeld_routbam_ss
|
||||||
#define f_falloff_ss falloff_ss
|
#define f_falloff_ss falloff_ss
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran2
|
#ifdef fortran2
|
||||||
#define f_sommerfeld_rout SOMMERFELD_ROUT
|
#define f_sommerfeld_rout SOMMERFELD_ROUT
|
||||||
#define f_sommerfeld_rout SOMMERFELD_ROUTBAM
|
#define f_sommerfeld_rout SOMMERFELD_ROUTBAM
|
||||||
#define f_sommerfeld_rout_ss SOMMERFELD_ROUTBAM_SS
|
#define f_sommerfeld_rout_ss SOMMERFELD_ROUTBAM_SS
|
||||||
#define f_falloff_ss FALLOFF_SS
|
#define f_falloff_ss FALLOFF_SS
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran3
|
#ifdef fortran3
|
||||||
#define f_sommerfeld_rout sommerfeld_rout_
|
#define f_sommerfeld_rout sommerfeld_rout_
|
||||||
#define f_sommerfeld_routbam sommerfeld_routbam_
|
#define f_sommerfeld_routbam sommerfeld_routbam_
|
||||||
#define f_sommerfeld_routbam_ss sommerfeld_routbam_ss_
|
#define f_sommerfeld_routbam_ss sommerfeld_routbam_ss_
|
||||||
#define f_falloff_ss falloff_ss_
|
#define f_falloff_ss falloff_ss_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_sommerfeld_rout(int *, double *, double *, double *,
|
void f_sommerfeld_rout(int *, double *, double *, double *,
|
||||||
double &, double &, double &, double &, double &, double &, double &, double *,
|
double &, double &, double &, double &, double &, double &, double &, double *,
|
||||||
double *, double *, double *, double *,
|
double *, double *, double *, double *,
|
||||||
int &, int &);
|
int &, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_sommerfeld_routbam(int *, double *, double *, double *,
|
void f_sommerfeld_routbam(int *, double *, double *, double *,
|
||||||
double &, double &, double &, double &, double &, double &, double *,
|
double &, double &, double &, double &, double &, double &, double *,
|
||||||
double *, double &, double *, int &);
|
double *, double &, double *, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_sommerfeld_routbam_ss(int *, double *, double *, double *,
|
void f_sommerfeld_routbam_ss(int *, double *, double *, double *,
|
||||||
double &, double &, double &, double &, double &, double &, double *,
|
double &, double &, double &, double &, double &, double &, double *,
|
||||||
double *, double &, double *, int &);
|
double *, double &, double *, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
void f_falloff_ss(int *, double *, double *, double *,
|
void f_falloff_ss(int *, double *, double *, double *,
|
||||||
double &, double &, double &, double &, double &, double &, double *,
|
double &, double &, double &, double &, double &, double &, double *,
|
||||||
int &, double *, int &);
|
int &, double *, int &);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SOMMERFELD_ROUT_H */
|
#endif /* SOMMERFELD_ROUT_H */
|
||||||
@@ -1,74 +1,74 @@
|
|||||||
// $Id: transpbh.C,v 1.2 2013/04/19 03:49:25 zjcao Exp $
|
// $Id: transpbh.C,v 1.2 2013/04/19 03:49:25 zjcao Exp $
|
||||||
#ifdef newc
|
#ifdef newc
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#else
|
#else
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <iomanip.h>
|
#include <iomanip.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "macrodef.h"
|
#include "macrodef.h"
|
||||||
|
|
||||||
// transmit black hole's position from bssn class
|
// transmit black hole's position from bssn class
|
||||||
|
|
||||||
int BHN;
|
int BHN;
|
||||||
double Mass[3];
|
double Mass[3];
|
||||||
double PBH[9];
|
double PBH[9];
|
||||||
|
|
||||||
void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN)
|
void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN)
|
||||||
{
|
{
|
||||||
BHN = Mymax(iBHN, rBHN);
|
BHN = Mymax(iBHN, rBHN);
|
||||||
for (int i = 0; i < iBHN; i++)
|
for (int i = 0; i < iBHN; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
PBH[3 * i + j] = iPBH[i][j];
|
PBH[3 * i + j] = iPBH[i][j];
|
||||||
Mass[i] = iMass[i];
|
Mass[i] = iMass[i];
|
||||||
}
|
}
|
||||||
if (BHN < rBHN)
|
if (BHN < rBHN)
|
||||||
{
|
{
|
||||||
if (rBHN > 2)
|
if (rBHN > 2)
|
||||||
cout << "error in transpbh.C: something wrong." << endl;
|
cout << "error in transpbh.C: something wrong." << endl;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
PBH[3 + j] = -iPBH[0][j];
|
PBH[3 + j] = -iPBH[0][j];
|
||||||
|
|
||||||
Mass[1] = Mass[0];
|
Mass[1] = Mass[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef fortran1
|
#ifdef fortran1
|
||||||
void getpbh
|
void getpbh
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran2
|
#ifdef fortran2
|
||||||
void GETPBH
|
void GETPBH
|
||||||
#endif
|
#endif
|
||||||
#ifdef fortran3
|
#ifdef fortran3
|
||||||
void
|
void
|
||||||
getpbh_
|
getpbh_
|
||||||
#endif
|
#endif
|
||||||
(int &oBHN, double *oPBH, double *oMass)
|
(int &oBHN, double *oPBH, double *oMass)
|
||||||
{
|
{
|
||||||
oBHN = BHN;
|
oBHN = BHN;
|
||||||
for (int i = 0; i < BHN; i++)
|
for (int i = 0; i < BHN; i++)
|
||||||
oMass[i] = Mass[i];
|
oMass[i] = Mass[i];
|
||||||
for (int i = 0; i < 3 * BHN; i++)
|
for (int i = 0; i < 3 * BHN; i++)
|
||||||
oPBH[i] = PBH[i];
|
oPBH[i] = PBH[i];
|
||||||
|
|
||||||
// printf("have set BH_num = %d\n",oBHN);
|
// printf("have set BH_num = %d\n",oBHN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,73 +1,73 @@
|
|||||||
|
|
||||||
#ifndef BSSN_GPU_H_
|
#ifndef BSSN_GPU_H_
|
||||||
#define BSSN_GPU_H_
|
#define BSSN_GPU_H_
|
||||||
#include "bssn_macro.h"
|
#include "bssn_macro.h"
|
||||||
#include "macrodef.fh"
|
#include "macrodef.fh"
|
||||||
|
|
||||||
#define DEVICE_ID 0
|
#define DEVICE_ID 0
|
||||||
// #define DEVICE_ID_BY_MPI_RANK
|
// #define DEVICE_ID_BY_MPI_RANK
|
||||||
#define GRID_DIM 256
|
#define GRID_DIM 256
|
||||||
#define BLOCK_DIM 128
|
#define BLOCK_DIM 128
|
||||||
|
|
||||||
#define _FH2_(i, j, k) fh[(i) + (j) * _1D_SIZE[2] + (k) * _2D_SIZE[2]]
|
#define _FH2_(i, j, k) fh[(i) + (j) * _1D_SIZE[2] + (k) * _2D_SIZE[2]]
|
||||||
#define _FH3_(i, j, k) fh[(i) + (j) * _1D_SIZE[3] + (k) * _2D_SIZE[3]]
|
#define _FH3_(i, j, k) fh[(i) + (j) * _1D_SIZE[3] + (k) * _2D_SIZE[3]]
|
||||||
#define pow2(x) ((x) * (x))
|
#define pow2(x) ((x) * (x))
|
||||||
#define TimeBetween(a, b) ((b.tv_sec - a.tv_sec) + (b.tv_usec - a.tv_usec) / 1000000.0f)
|
#define TimeBetween(a, b) ((b.tv_sec - a.tv_sec) + (b.tv_usec - a.tv_usec) / 1000000.0f)
|
||||||
#define M_ metac.
|
#define M_ metac.
|
||||||
#define Mh_ meta->
|
#define Mh_ meta->
|
||||||
#define Ms_ metassc.
|
#define Ms_ metassc.
|
||||||
#define Msh_ metass->
|
#define Msh_ metass->
|
||||||
|
|
||||||
// #define TIMING
|
// #define TIMING
|
||||||
|
|
||||||
#define RHS_SS_PARA int calledby, int mpi_rank, int *ex, double &T, double *crho, double *sigma, double *R, double *X, double *Y, double *Z, double *drhodx, double *drhody, double *drhodz, double *dsigmadx, double *dsigmady, double *dsigmadz, double *dRdx, double *dRdy, double *dRdz, double *drhodxx, double *drhodxy, double *drhodxz, double *drhodyy, double *drhodyz, double *drhodzz, double *dsigmadxx, double *dsigmadxy, double *dsigmadxz, double *dsigmadyy, double *dsigmadyz, double *dsigmadzz, double *dRdxx, double *dRdxy, double *dRdxz, double *dRdyy, double *dRdyz, double *dRdzz, double *chi, double *trK, double *dxx, double *gxy, double *gxz, double *dyy, double *gyz, double *dzz, double *Axx, double *Axy, double *Axz, double *Ayy, double *Ayz, double *Azz, double *Gamx, double *Gamy, double *Gamz, double *Lap, double *betax, double *betay, double *betaz, double *dtSfx, double *dtSfy, double *dtSfz, double *chi_rhs, double *trK_rhs, double *gxx_rhs, double *gxy_rhs, double *gxz_rhs, double *gyy_rhs, double *gyz_rhs, double *gzz_rhs, double *Axx_rhs, double *Axy_rhs, double *Axz_rhs, double *Ayy_rhs, double *Ayz_rhs, double *Azz_rhs, double *Gamx_rhs, double *Gamy_rhs, double *Gamz_rhs, double *Lap_rhs, double *betax_rhs, double *betay_rhs, double *betaz_rhs, double *dtSfx_rhs, double *dtSfy_rhs, double *dtSfz_rhs, double *rho, double *Sx, double *Sy, double *Sz, double *Sxx, double *Sxy, double *Sxz, double *Syy, double *Syz, double *Szz, double *Gamxxx, double *Gamxxy, double *Gamxxz, double *Gamxyy, double *Gamxyz, double *Gamxzz, double *Gamyxx, double *Gamyxy, double *Gamyxz, double *Gamyyy, double *Gamyyz, double *Gamyzz, double *Gamzxx, double *Gamzxy, double *Gamzxz, double *Gamzyy, double *Gamzyz, double *Gamzzz, double *Rxx, double *Rxy, double *Rxz, double *Ryy, double *Ryz, double *Rzz, double *ham_Res, double *movx_Res, double *movy_Res, double *movz_Res, double *Gmx_Res, double *Gmy_Res, double *Gmz_Res, int &Symmetry, int &Lev, double &eps, int &sst, int &co
|
#define RHS_SS_PARA int calledby, int mpi_rank, int *ex, double &T, double *crho, double *sigma, double *R, double *X, double *Y, double *Z, double *drhodx, double *drhody, double *drhodz, double *dsigmadx, double *dsigmady, double *dsigmadz, double *dRdx, double *dRdy, double *dRdz, double *drhodxx, double *drhodxy, double *drhodxz, double *drhodyy, double *drhodyz, double *drhodzz, double *dsigmadxx, double *dsigmadxy, double *dsigmadxz, double *dsigmadyy, double *dsigmadyz, double *dsigmadzz, double *dRdxx, double *dRdxy, double *dRdxz, double *dRdyy, double *dRdyz, double *dRdzz, double *chi, double *trK, double *dxx, double *gxy, double *gxz, double *dyy, double *gyz, double *dzz, double *Axx, double *Axy, double *Axz, double *Ayy, double *Ayz, double *Azz, double *Gamx, double *Gamy, double *Gamz, double *Lap, double *betax, double *betay, double *betaz, double *dtSfx, double *dtSfy, double *dtSfz, double *chi_rhs, double *trK_rhs, double *gxx_rhs, double *gxy_rhs, double *gxz_rhs, double *gyy_rhs, double *gyz_rhs, double *gzz_rhs, double *Axx_rhs, double *Axy_rhs, double *Axz_rhs, double *Ayy_rhs, double *Ayz_rhs, double *Azz_rhs, double *Gamx_rhs, double *Gamy_rhs, double *Gamz_rhs, double *Lap_rhs, double *betax_rhs, double *betay_rhs, double *betaz_rhs, double *dtSfx_rhs, double *dtSfy_rhs, double *dtSfz_rhs, double *rho, double *Sx, double *Sy, double *Sz, double *Sxx, double *Sxy, double *Sxz, double *Syy, double *Syz, double *Szz, double *Gamxxx, double *Gamxxy, double *Gamxxz, double *Gamxyy, double *Gamxyz, double *Gamxzz, double *Gamyxx, double *Gamyxy, double *Gamyxz, double *Gamyyy, double *Gamyyz, double *Gamyzz, double *Gamzxx, double *Gamzxy, double *Gamzxz, double *Gamzyy, double *Gamzyz, double *Gamzzz, double *Rxx, double *Rxy, double *Rxz, double *Ryy, double *Ryz, double *Rzz, double *ham_Res, double *movx_Res, double *movy_Res, double *movz_Res, double *Gmx_Res, double *Gmy_Res, double *Gmz_Res, int &Symmetry, int &Lev, double &eps, int &sst, int &co
|
||||||
|
|
||||||
/** main function */
|
/** main function */
|
||||||
int gpu_rhs(int calledby, int mpi_rank, int *ex, double &T,
|
int gpu_rhs(int calledby, int mpi_rank, int *ex, double &T,
|
||||||
double *X, double *Y, double *Z,
|
double *X, double *Y, double *Z,
|
||||||
|
|
||||||
double *chi, double *trK,
|
double *chi, double *trK,
|
||||||
|
|
||||||
double *dxx, double *gxy, double *gxz, double *dyy, double *gyz, double *dzz,
|
double *dxx, double *gxy, double *gxz, double *dyy, double *gyz, double *dzz,
|
||||||
|
|
||||||
double *Axx, double *Axy, double *Axz, double *Ayy, double *Ayz, double *Azz,
|
double *Axx, double *Axy, double *Axz, double *Ayy, double *Ayz, double *Azz,
|
||||||
|
|
||||||
double *Gamx, double *Gamy, double *Gamz,
|
double *Gamx, double *Gamy, double *Gamz,
|
||||||
|
|
||||||
double *Lap, double *betax, double *betay, double *betaz,
|
double *Lap, double *betax, double *betay, double *betaz,
|
||||||
|
|
||||||
double *dtSfx, double *dtSfy, double *dtSfz,
|
double *dtSfx, double *dtSfy, double *dtSfz,
|
||||||
|
|
||||||
double *chi_rhs, double *trK_rhs,
|
double *chi_rhs, double *trK_rhs,
|
||||||
|
|
||||||
double *gxx_rhs, double *gxy_rhs, double *gxz_rhs, double *gyy_rhs, double *gyz_rhs, double *gzz_rhs,
|
double *gxx_rhs, double *gxy_rhs, double *gxz_rhs, double *gyy_rhs, double *gyz_rhs, double *gzz_rhs,
|
||||||
|
|
||||||
double *Axx_rhs, double *Axy_rhs, double *Axz_rhs, double *Ayy_rhs, double *Ayz_rhs, double *Azz_rhs,
|
double *Axx_rhs, double *Axy_rhs, double *Axz_rhs, double *Ayy_rhs, double *Ayz_rhs, double *Azz_rhs,
|
||||||
|
|
||||||
double *Gamx_rhs, double *Gamy_rhs, double *Gamz_rhs,
|
double *Gamx_rhs, double *Gamy_rhs, double *Gamz_rhs,
|
||||||
|
|
||||||
double *Lap_rhs, double *betax_rhs, double *betay_rhs, double *betaz_rhs,
|
double *Lap_rhs, double *betax_rhs, double *betay_rhs, double *betaz_rhs,
|
||||||
|
|
||||||
double *dtSfx_rhs, double *dtSfy_rhs, double *dtSfz_rhs,
|
double *dtSfx_rhs, double *dtSfy_rhs, double *dtSfz_rhs,
|
||||||
|
|
||||||
double *rho, double *Sx, double *Sy, double *Sz, double *Sxx,
|
double *rho, double *Sx, double *Sy, double *Sz, double *Sxx,
|
||||||
double *Sxy, double *Sxz, double *Syy, double *Syz, double *Szz,
|
double *Sxy, double *Sxz, double *Syy, double *Syz, double *Szz,
|
||||||
|
|
||||||
double *Gamxxx, double *Gamxxy, double *Gamxxz, double *Gamxyy, double *Gamxyz, double *Gamxzz,
|
double *Gamxxx, double *Gamxxy, double *Gamxxz, double *Gamxyy, double *Gamxyz, double *Gamxzz,
|
||||||
|
|
||||||
double *Gamyxx, double *Gamyxy, double *Gamyxz, double *Gamyyy, double *Gamyyz, double *Gamyzz,
|
double *Gamyxx, double *Gamyxy, double *Gamyxz, double *Gamyyy, double *Gamyyz, double *Gamyzz,
|
||||||
|
|
||||||
double *Gamzxx, double *Gamzxy, double *Gamzxz, double *Gamzyy, double *Gamzyz, double *Gamzzz,
|
double *Gamzxx, double *Gamzxy, double *Gamzxz, double *Gamzyy, double *Gamzyz, double *Gamzzz,
|
||||||
|
|
||||||
double *Rxx, double *Rxy, double *Rxz, double *Ryy, double *Ryz, double *Rzz,
|
double *Rxx, double *Rxy, double *Rxz, double *Ryy, double *Ryz, double *Rzz,
|
||||||
|
|
||||||
double *ham_Res, double *movx_Res, double *movy_Res, double *movz_Res,
|
double *ham_Res, double *movx_Res, double *movy_Res, double *movz_Res,
|
||||||
double *Gmx_Res, double *Gmy_Res, double *Gmz_Res,
|
double *Gmx_Res, double *Gmy_Res, double *Gmz_Res,
|
||||||
int &Symmetry, int &Lev, double &eps, int &co);
|
int &Symmetry, int &Lev, double &eps, int &co);
|
||||||
|
|
||||||
int gpu_rhs_ss(RHS_SS_PARA);
|
int gpu_rhs_ss(RHS_SS_PARA);
|
||||||
|
|
||||||
/** Init GPU side data in GPUMeta. */
|
/** Init GPU side data in GPUMeta. */
|
||||||
// void init_fluid_meta_gpu(GPUMeta *gpu_meta);
|
// void init_fluid_meta_gpu(GPUMeta *gpu_meta);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,210 +1,210 @@
|
|||||||
|
|
||||||
#ifndef BSSN_GPU_CLASS_H
|
#ifndef BSSN_GPU_CLASS_H
|
||||||
#define BSSN_GPU_CLASS_H
|
#define BSSN_GPU_CLASS_H
|
||||||
|
|
||||||
#ifdef newc
|
#ifdef newc
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
#else
|
#else
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <iomanip.h>
|
#include <iomanip.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
#include "macrodef.h"
|
#include "macrodef.h"
|
||||||
#include "cgh.h"
|
#include "cgh.h"
|
||||||
#include "ShellPatch.h"
|
#include "ShellPatch.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "var.h"
|
#include "var.h"
|
||||||
#include "MyList.h"
|
#include "MyList.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "surface_integral.h"
|
#include "surface_integral.h"
|
||||||
#include "checkpoint.h"
|
#include "checkpoint.h"
|
||||||
|
|
||||||
// added by yangquan
|
// added by yangquan
|
||||||
#include "bssn_macro.h"
|
#include "bssn_macro.h"
|
||||||
|
|
||||||
extern void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN);
|
extern void setpbh(int iBHN, double **iPBH, double *iMass, int rBHN);
|
||||||
|
|
||||||
class bssn_class
|
class bssn_class
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// added by yangquan
|
// added by yangquan
|
||||||
//----------------------
|
//----------------------
|
||||||
int gpu_num_mynode;
|
int gpu_num_mynode;
|
||||||
int cpu_core_num_mynode;
|
int cpu_core_num_mynode;
|
||||||
int mpi_process_num_mynode;
|
int mpi_process_num_mynode;
|
||||||
int my_sequence_mynode;
|
int my_sequence_mynode;
|
||||||
int mynode_id;
|
int mynode_id;
|
||||||
int use_gpu;
|
int use_gpu;
|
||||||
|
|
||||||
virtual void Step_GPU(int lev, int YN);
|
virtual void Step_GPU(int lev, int YN);
|
||||||
virtual void Get_runtime_envirment();
|
virtual void Get_runtime_envirment();
|
||||||
// virtual void Step_OPENMP(int lev,int YN);
|
// virtual void Step_OPENMP(int lev,int YN);
|
||||||
//----------------------
|
//----------------------
|
||||||
|
|
||||||
int ngfs;
|
int ngfs;
|
||||||
int nprocs, myrank;
|
int nprocs, myrank;
|
||||||
cgh *GH;
|
cgh *GH;
|
||||||
ShellPatch *SH;
|
ShellPatch *SH;
|
||||||
double PhysTime;
|
double PhysTime;
|
||||||
|
|
||||||
int checkrun;
|
int checkrun;
|
||||||
char checkfilename[50];
|
char checkfilename[50];
|
||||||
int Steps;
|
int Steps;
|
||||||
double StartTime, TotalTime;
|
double StartTime, TotalTime;
|
||||||
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
||||||
double LastAnas, LastConsOut;
|
double LastAnas, LastConsOut;
|
||||||
double Courant;
|
double Courant;
|
||||||
double numepss, numepsb, numepsh;
|
double numepss, numepsb, numepsh;
|
||||||
int Symmetry;
|
int Symmetry;
|
||||||
int maxl, decn;
|
int maxl, decn;
|
||||||
double maxrex, drex;
|
double maxrex, drex;
|
||||||
int trfls, a_lev;
|
int trfls, a_lev;
|
||||||
|
|
||||||
double dT;
|
double dT;
|
||||||
double chitiny;
|
double chitiny;
|
||||||
|
|
||||||
double **Porg0, **Porgbr, **Porg, **Porg1, **Porg_rhs;
|
double **Porg0, **Porgbr, **Porg, **Porg1, **Porg_rhs;
|
||||||
int BH_num, BH_num_input;
|
int BH_num, BH_num_input;
|
||||||
double *Mass, *Pmom, *Spin;
|
double *Mass, *Pmom, *Spin;
|
||||||
double ADMMass;
|
double ADMMass;
|
||||||
|
|
||||||
var *phio, *trKo;
|
var *phio, *trKo;
|
||||||
var *gxxo, *gxyo, *gxzo, *gyyo, *gyzo, *gzzo;
|
var *gxxo, *gxyo, *gxzo, *gyyo, *gyzo, *gzzo;
|
||||||
var *Axxo, *Axyo, *Axzo, *Ayyo, *Ayzo, *Azzo;
|
var *Axxo, *Axyo, *Axzo, *Ayyo, *Ayzo, *Azzo;
|
||||||
var *Gmxo, *Gmyo, *Gmzo;
|
var *Gmxo, *Gmyo, *Gmzo;
|
||||||
var *Lapo, *Sfxo, *Sfyo, *Sfzo;
|
var *Lapo, *Sfxo, *Sfyo, *Sfzo;
|
||||||
var *dtSfxo, *dtSfyo, *dtSfzo;
|
var *dtSfxo, *dtSfyo, *dtSfzo;
|
||||||
|
|
||||||
var *phi0, *trK0;
|
var *phi0, *trK0;
|
||||||
var *gxx0, *gxy0, *gxz0, *gyy0, *gyz0, *gzz0;
|
var *gxx0, *gxy0, *gxz0, *gyy0, *gyz0, *gzz0;
|
||||||
var *Axx0, *Axy0, *Axz0, *Ayy0, *Ayz0, *Azz0;
|
var *Axx0, *Axy0, *Axz0, *Ayy0, *Ayz0, *Azz0;
|
||||||
var *Gmx0, *Gmy0, *Gmz0;
|
var *Gmx0, *Gmy0, *Gmz0;
|
||||||
var *Lap0, *Sfx0, *Sfy0, *Sfz0;
|
var *Lap0, *Sfx0, *Sfy0, *Sfz0;
|
||||||
var *dtSfx0, *dtSfy0, *dtSfz0;
|
var *dtSfx0, *dtSfy0, *dtSfz0;
|
||||||
|
|
||||||
var *phi, *trK;
|
var *phi, *trK;
|
||||||
var *gxx, *gxy, *gxz, *gyy, *gyz, *gzz;
|
var *gxx, *gxy, *gxz, *gyy, *gyz, *gzz;
|
||||||
var *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz;
|
var *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz;
|
||||||
var *Gmx, *Gmy, *Gmz;
|
var *Gmx, *Gmy, *Gmz;
|
||||||
var *Lap, *Sfx, *Sfy, *Sfz;
|
var *Lap, *Sfx, *Sfy, *Sfz;
|
||||||
var *dtSfx, *dtSfy, *dtSfz;
|
var *dtSfx, *dtSfy, *dtSfz;
|
||||||
|
|
||||||
var *phi1, *trK1;
|
var *phi1, *trK1;
|
||||||
var *gxx1, *gxy1, *gxz1, *gyy1, *gyz1, *gzz1;
|
var *gxx1, *gxy1, *gxz1, *gyy1, *gyz1, *gzz1;
|
||||||
var *Axx1, *Axy1, *Axz1, *Ayy1, *Ayz1, *Azz1;
|
var *Axx1, *Axy1, *Axz1, *Ayy1, *Ayz1, *Azz1;
|
||||||
var *Gmx1, *Gmy1, *Gmz1;
|
var *Gmx1, *Gmy1, *Gmz1;
|
||||||
var *Lap1, *Sfx1, *Sfy1, *Sfz1;
|
var *Lap1, *Sfx1, *Sfy1, *Sfz1;
|
||||||
var *dtSfx1, *dtSfy1, *dtSfz1;
|
var *dtSfx1, *dtSfy1, *dtSfz1;
|
||||||
|
|
||||||
var *phi_rhs, *trK_rhs;
|
var *phi_rhs, *trK_rhs;
|
||||||
var *gxx_rhs, *gxy_rhs, *gxz_rhs, *gyy_rhs, *gyz_rhs, *gzz_rhs;
|
var *gxx_rhs, *gxy_rhs, *gxz_rhs, *gyy_rhs, *gyz_rhs, *gzz_rhs;
|
||||||
var *Axx_rhs, *Axy_rhs, *Axz_rhs, *Ayy_rhs, *Ayz_rhs, *Azz_rhs;
|
var *Axx_rhs, *Axy_rhs, *Axz_rhs, *Ayy_rhs, *Ayz_rhs, *Azz_rhs;
|
||||||
var *Gmx_rhs, *Gmy_rhs, *Gmz_rhs;
|
var *Gmx_rhs, *Gmy_rhs, *Gmz_rhs;
|
||||||
var *Lap_rhs, *Sfx_rhs, *Sfy_rhs, *Sfz_rhs;
|
var *Lap_rhs, *Sfx_rhs, *Sfy_rhs, *Sfz_rhs;
|
||||||
var *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs;
|
var *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs;
|
||||||
|
|
||||||
var *rho, *Sx, *Sy, *Sz, *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz;
|
var *rho, *Sx, *Sy, *Sz, *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz;
|
||||||
|
|
||||||
var *Gamxxx, *Gamxxy, *Gamxxz, *Gamxyy, *Gamxyz, *Gamxzz;
|
var *Gamxxx, *Gamxxy, *Gamxxz, *Gamxyy, *Gamxyz, *Gamxzz;
|
||||||
var *Gamyxx, *Gamyxy, *Gamyxz, *Gamyyy, *Gamyyz, *Gamyzz;
|
var *Gamyxx, *Gamyxy, *Gamyxz, *Gamyyy, *Gamyyz, *Gamyzz;
|
||||||
var *Gamzxx, *Gamzxy, *Gamzxz, *Gamzyy, *Gamzyz, *Gamzzz;
|
var *Gamzxx, *Gamzxy, *Gamzxz, *Gamzyy, *Gamzyz, *Gamzzz;
|
||||||
|
|
||||||
var *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz;
|
var *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz;
|
||||||
|
|
||||||
var *Rpsi4, *Ipsi4;
|
var *Rpsi4, *Ipsi4;
|
||||||
var *t1Rpsi4, *t1Ipsi4, *t2Rpsi4, *t2Ipsi4;
|
var *t1Rpsi4, *t1Ipsi4, *t2Rpsi4, *t2Ipsi4;
|
||||||
|
|
||||||
var *Cons_Ham, *Cons_Px, *Cons_Py, *Cons_Pz, *Cons_Gx, *Cons_Gy, *Cons_Gz;
|
var *Cons_Ham, *Cons_Px, *Cons_Py, *Cons_Pz, *Cons_Gx, *Cons_Gy, *Cons_Gz;
|
||||||
|
|
||||||
#ifdef Point_Psi4
|
#ifdef Point_Psi4
|
||||||
var *phix, *phiy, *phiz;
|
var *phix, *phiy, *phiz;
|
||||||
var *trKx, *trKy, *trKz;
|
var *trKx, *trKy, *trKz;
|
||||||
var *Axxx, *Axxy, *Axxz;
|
var *Axxx, *Axxy, *Axxz;
|
||||||
var *Axyx, *Axyy, *Axyz;
|
var *Axyx, *Axyy, *Axyz;
|
||||||
var *Axzx, *Axzy, *Axzz;
|
var *Axzx, *Axzy, *Axzz;
|
||||||
var *Ayyx, *Ayyy, *Ayyz;
|
var *Ayyx, *Ayyy, *Ayyz;
|
||||||
var *Ayzx, *Ayzy, *Ayzz;
|
var *Ayzx, *Ayzy, *Ayzz;
|
||||||
var *Azzx, *Azzy, *Azzz;
|
var *Azzx, *Azzy, *Azzz;
|
||||||
#endif
|
#endif
|
||||||
// FIXME: uc = StateList, up = OldStateList, upp = SynchList_cor; so never touch these three data
|
// FIXME: uc = StateList, up = OldStateList, upp = SynchList_cor; so never touch these three data
|
||||||
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
|
MyList<var> *StateList, *SynchList_pre, *SynchList_cor, *RHSList;
|
||||||
MyList<var> *OldStateList, *DumpList;
|
MyList<var> *OldStateList, *DumpList;
|
||||||
MyList<var> *ConstraintList;
|
MyList<var> *ConstraintList;
|
||||||
|
|
||||||
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
|
monitor *ErrorMonitor, *Psi4Monitor, *BHMonitor, *MAPMonitor;
|
||||||
monitor *ConVMonitor;
|
monitor *ConVMonitor;
|
||||||
surface_integral *Waveshell;
|
surface_integral *Waveshell;
|
||||||
checkpoint *CheckPoint;
|
checkpoint *CheckPoint;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bssn_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
|
bssn_class(double Couranti, double StartTimei, double TotalTimei, double DumpTimei, double d2DumpTimei, double CheckTimei, double AnasTimei,
|
||||||
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
|
int Symmetryi, int checkruni, char *checkfilenamei, double numepssi, double numepsbi, double numepshi,
|
||||||
int a_levi, int maxli, int decni, double maxrexi, double drexi);
|
int a_levi, int maxli, int decni, double maxrexi, double drexi);
|
||||||
~bssn_class();
|
~bssn_class();
|
||||||
|
|
||||||
void Evolve(int Steps);
|
void Evolve(int Steps);
|
||||||
void RecursiveStep(int lev);
|
void RecursiveStep(int lev);
|
||||||
#if (PSTR == 1)
|
#if (PSTR == 1)
|
||||||
void ParallelStep();
|
void ParallelStep();
|
||||||
void SHStep();
|
void SHStep();
|
||||||
#endif
|
#endif
|
||||||
void RestrictProlong(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
|
void RestrictProlong(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
|
||||||
void RestrictProlong_aux(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
|
void RestrictProlong_aux(int lev, int YN, bool BB, MyList<var> *SL, MyList<var> *OL, MyList<var> *corL);
|
||||||
void RestrictProlong(int lev, int YN, bool BB);
|
void RestrictProlong(int lev, int YN, bool BB);
|
||||||
void ProlongRestrict(int lev, int YN, bool BB);
|
void ProlongRestrict(int lev, int YN, bool BB);
|
||||||
void Setup_Black_Hole_position();
|
void Setup_Black_Hole_position();
|
||||||
void compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int lev);
|
void compute_Porg_rhs(double **BH_PS, double **BH_RHS, var *forx, var *fory, var *forz, int lev);
|
||||||
bool read_Pablo_file(int *ext, double *datain, char *filename);
|
bool read_Pablo_file(int *ext, double *datain, char *filename);
|
||||||
void write_Pablo_file(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
|
void write_Pablo_file(int *ext, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax,
|
||||||
char *filename);
|
char *filename);
|
||||||
void AnalysisStuff(int lev, double dT_lev);
|
void AnalysisStuff(int lev, double dT_lev);
|
||||||
void Setup_KerrSchild();
|
void Setup_KerrSchild();
|
||||||
void Enforce_algcon(int lev, int fg);
|
void Enforce_algcon(int lev, int fg);
|
||||||
|
|
||||||
void testRestrict();
|
void testRestrict();
|
||||||
void testOutBd();
|
void testOutBd();
|
||||||
|
|
||||||
virtual void Setup_Initial_Data_Lousto();
|
virtual void Setup_Initial_Data_Lousto();
|
||||||
virtual void Setup_Initial_Data_Cao();
|
virtual void Setup_Initial_Data_Cao();
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
virtual void Read_Ansorg();
|
virtual void Read_Ansorg();
|
||||||
virtual void Read_Pablo() {};
|
virtual void Read_Pablo() {};
|
||||||
virtual void Compute_Psi4(int lev);
|
virtual void Compute_Psi4(int lev);
|
||||||
virtual void Step(int lev, int YN);
|
virtual void Step(int lev, int YN);
|
||||||
virtual void Interp_Constraint(bool infg);
|
virtual void Interp_Constraint(bool infg);
|
||||||
virtual void Constraint_Out();
|
virtual void Constraint_Out();
|
||||||
virtual void Compute_Constraint();
|
virtual void Compute_Constraint();
|
||||||
|
|
||||||
#ifdef With_AHF
|
#ifdef With_AHF
|
||||||
protected:
|
protected:
|
||||||
MyList<var> *AHList, *AHDList, *GaugeList;
|
MyList<var> *AHList, *AHDList, *GaugeList;
|
||||||
int AHfindevery;
|
int AHfindevery;
|
||||||
double AHdumptime;
|
double AHdumptime;
|
||||||
int *lastahdumpid, HN_num; // number of possible horizons
|
int *lastahdumpid, HN_num; // number of possible horizons
|
||||||
int *findeveryl;
|
int *findeveryl;
|
||||||
double *xc, *yc, *zc, *xr, *yr, *zr;
|
double *xc, *yc, *zc, *xr, *yr, *zr;
|
||||||
bool *trigger;
|
bool *trigger;
|
||||||
double *dTT;
|
double *dTT;
|
||||||
int *dumpid;
|
int *dumpid;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void AH_Prepare_derivatives();
|
void AH_Prepare_derivatives();
|
||||||
bool AH_Interp_Points(MyList<var> *VarList,
|
bool AH_Interp_Points(MyList<var> *VarList,
|
||||||
int NN, double **XX,
|
int NN, double **XX,
|
||||||
double *Shellf, int Symmetryi);
|
double *Shellf, int Symmetryi);
|
||||||
void AH_Step_Find(int lev, double dT_lev);
|
void AH_Step_Find(int lev, double dT_lev);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#endif /* BSSN_GPU_CLASS_H */
|
#endif /* BSSN_GPU_CLASS_H */
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,124 +1,124 @@
|
|||||||
#include "bssn_macro.h"
|
#include "bssn_macro.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int compare_two_file(char *fname1, char *fname2, int data_num)
|
int compare_two_file(char *fname1, char *fname2, int data_num)
|
||||||
{
|
{
|
||||||
// read file
|
// read file
|
||||||
fstream file1(fname1, ios_base::in);
|
fstream file1(fname1, ios_base::in);
|
||||||
fstream file2(fname2, ios_base::in);
|
fstream file2(fname2, ios_base::in);
|
||||||
double *d1, *d2;
|
double *d1, *d2;
|
||||||
d1 = (double *)malloc(sizeof(double) * data_num);
|
d1 = (double *)malloc(sizeof(double) * data_num);
|
||||||
d2 = (double *)malloc(sizeof(double) * data_num);
|
d2 = (double *)malloc(sizeof(double) * data_num);
|
||||||
|
|
||||||
for (int i = 0; i < data_num; ++i)
|
for (int i = 0; i < data_num; ++i)
|
||||||
{
|
{
|
||||||
file1.read((char *)(d1 + i), sizeof(double));
|
file1.read((char *)(d1 + i), sizeof(double));
|
||||||
file2.read((char *)(d2 + i), sizeof(double));
|
file2.read((char *)(d2 + i), sizeof(double));
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare data
|
// compare data
|
||||||
bool is_match = true;
|
bool is_match = true;
|
||||||
for (int i = 0; i < data_num; ++i)
|
for (int i = 0; i < data_num; ++i)
|
||||||
{
|
{
|
||||||
if (d1[i] != d2[i])
|
if (d1[i] != d2[i])
|
||||||
{
|
{
|
||||||
is_match = false;
|
is_match = false;
|
||||||
cout << "miss match at position " << i << endl;
|
cout << "miss match at position " << i << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (is_match)
|
if (is_match)
|
||||||
cout << "Result is right." << endl;
|
cout << "Result is right." << endl;
|
||||||
|
|
||||||
free(d1);
|
free(d1);
|
||||||
free(d2);
|
free(d2);
|
||||||
file1.close();
|
file1.close();
|
||||||
file2.close();
|
file2.close();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
void printMatrix(int ftag1, int ftag2, double *d1, double *d2, int ord)
|
void printMatrix(int ftag1, int ftag2, double *d1, double *d2, int ord)
|
||||||
{
|
{
|
||||||
char fname1[32];
|
char fname1[32];
|
||||||
char fname2[32];
|
char fname2[32];
|
||||||
// char ftag1[32]; char ftag2[32];
|
// char ftag1[32]; char ftag2[32];
|
||||||
// sprintf(ftag1,"%d",ftag1);
|
// sprintf(ftag1,"%d",ftag1);
|
||||||
strcpy(fname1, "matrix_f.show");
|
strcpy(fname1, "matrix_f.show");
|
||||||
// strcat(fname1,ftag1);
|
// strcat(fname1,ftag1);
|
||||||
|
|
||||||
// sprintf(ftag2,"%d",ftag2);
|
// sprintf(ftag2,"%d",ftag2);
|
||||||
strcpy(fname2, "matrix_g.show");
|
strcpy(fname2, "matrix_g.show");
|
||||||
// strcat(fname2,ftag2);
|
// strcat(fname2,ftag2);
|
||||||
|
|
||||||
ofstream fout0, fout1, fout2;
|
ofstream fout0, fout1, fout2;
|
||||||
fout1.open(fname1);
|
fout1.open(fname1);
|
||||||
fout2.open(fname2);
|
fout2.open(fname2);
|
||||||
|
|
||||||
for (int k = 0; k < 65; k++)
|
for (int k = 0; k < 65; k++)
|
||||||
{
|
{
|
||||||
fout1 << "---------square " << k << " ----------" << endl;
|
fout1 << "---------square " << k << " ----------" << endl;
|
||||||
fout2 << "---------square " << k << " ----------" << endl;
|
fout2 << "---------square " << k << " ----------" << endl;
|
||||||
for (int j = 0; j < 67 + ord * 2; j++)
|
for (int j = 0; j < 67 + ord * 2; j++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 67 + ord * 2; i++)
|
for (int i = 0; i < 67 + ord * 2; i++)
|
||||||
{
|
{
|
||||||
fout1 << d1[i + j * (67 + ord * 2) + k * ((67 + ord * 2) * (67 + ord * 2))] << ' ';
|
fout1 << d1[i + j * (67 + ord * 2) + k * ((67 + ord * 2) * (67 + ord * 2))] << ' ';
|
||||||
fout2 << d2[i + j * (67 + ord * 2) + k * ((67 + ord * 2) * (67 + ord * 2))] << ' ';
|
fout2 << d2[i + j * (67 + ord * 2) + k * ((67 + ord * 2) * (67 + ord * 2))] << ' ';
|
||||||
// fout1<<test_output_g[i+j*(cg->shape[0]) + k*(_2d_size)] <<' ';
|
// fout1<<test_output_g[i+j*(cg->shape[0]) + k*(_2d_size)] <<' ';
|
||||||
// fout2<<test_fh_f [i+j*(cg->shape[0]) + k*(_2d_size)] <<' ';
|
// fout2<<test_fh_f [i+j*(cg->shape[0]) + k*(_2d_size)] <<' ';
|
||||||
}
|
}
|
||||||
fout1 << endl;
|
fout1 << endl;
|
||||||
fout2 << endl;
|
fout2 << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int compare_result(int ftag1, double *d2, int data_num)
|
int compare_result(int ftag1, double *d2, int data_num)
|
||||||
{
|
{
|
||||||
// read file
|
// read file
|
||||||
char fname1[32];
|
char fname1[32];
|
||||||
char ftag[32];
|
char ftag[32];
|
||||||
// itoa(filetag,ftag,10);
|
// itoa(filetag,ftag,10);
|
||||||
sprintf(ftag, "%d", ftag1);
|
sprintf(ftag, "%d", ftag1);
|
||||||
strcpy(fname1, "matrix_f.out");
|
strcpy(fname1, "matrix_f.out");
|
||||||
strcat(fname1, ftag);
|
strcat(fname1, ftag);
|
||||||
|
|
||||||
fstream file1(fname1, ios_base::in);
|
fstream file1(fname1, ios_base::in);
|
||||||
double *d1;
|
double *d1;
|
||||||
d1 = (double *)malloc(sizeof(double) * data_num);
|
d1 = (double *)malloc(sizeof(double) * data_num);
|
||||||
|
|
||||||
for (int i = 0; i < data_num; ++i)
|
for (int i = 0; i < data_num; ++i)
|
||||||
{
|
{
|
||||||
file1.read((char *)(d1 + i), sizeof(double));
|
file1.read((char *)(d1 + i), sizeof(double));
|
||||||
}
|
}
|
||||||
|
|
||||||
// compare data
|
// compare data
|
||||||
bool is_match = true;
|
bool is_match = true;
|
||||||
double delta;
|
double delta;
|
||||||
for (int i = 0; i < data_num; ++i)
|
for (int i = 0; i < data_num; ++i)
|
||||||
{
|
{
|
||||||
delta = d1[i] - d2[i];
|
delta = d1[i] - d2[i];
|
||||||
if (delta < 0)
|
if (delta < 0)
|
||||||
delta = -delta;
|
delta = -delta;
|
||||||
if (delta > 1e-14)
|
if (delta > 1e-14)
|
||||||
{
|
{
|
||||||
is_match = false;
|
is_match = false;
|
||||||
cout << fname1 << "::miss match at position " << i << endl;
|
cout << fname1 << "::miss match at position " << i << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// if(i<100 && i>50)
|
// if(i<100 && i>50)
|
||||||
// cout<<d1[i]<<" "<<d2[i]<<endl;
|
// cout<<d1[i]<<" "<<d2[i]<<endl;
|
||||||
}
|
}
|
||||||
if (is_match)
|
if (is_match)
|
||||||
cout << ftag1 << "::matched." << endl;
|
cout << ftag1 << "::matched." << endl;
|
||||||
|
|
||||||
if (ftag1 == 0)
|
if (ftag1 == 0)
|
||||||
{
|
{
|
||||||
printMatrix(1, 2, d1, d2, 3);
|
printMatrix(1, 2, d1, d2, 3);
|
||||||
}
|
}
|
||||||
free(d1);
|
free(d1);
|
||||||
file1.close();
|
file1.close();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1,94 +1,94 @@
|
|||||||
#ifndef BSSN_STEP_H
|
#ifndef BSSN_STEP_H
|
||||||
#define BSSN_STEP_H
|
#define BSSN_STEP_H
|
||||||
//1---------------------FLAGS---------------------
|
//1---------------------FLAGS---------------------
|
||||||
|
|
||||||
#define USE_GPU
|
#define USE_GPU
|
||||||
#define MAX_GPU_PROCESS_NUM 1
|
#define MAX_GPU_PROCESS_NUM 1
|
||||||
#define COUNT_CPU_RHS_TIME
|
#define COUNT_CPU_RHS_TIME
|
||||||
|
|
||||||
|
|
||||||
//2---------------------TIMER---------------------
|
//2---------------------TIMER---------------------
|
||||||
//2.1 TIMER_INIT
|
//2.1 TIMER_INIT
|
||||||
//2.2 TIMER_TIC_WITHOUT_OUTPUT
|
//2.2 TIMER_TIC_WITHOUT_OUTPUT
|
||||||
//2.3 TIMER_TIC(tag,order,label)
|
//2.3 TIMER_TIC(tag,order,label)
|
||||||
//2.4 TIMER_TIC_TAIL_OF_FUNC(tag,label)
|
//2.4 TIMER_TIC_TAIL_OF_FUNC(tag,label)
|
||||||
|
|
||||||
#define TIME_COUNT_EACH_RANK 0
|
#define TIME_COUNT_EACH_RANK 0
|
||||||
|
|
||||||
#define TIMER_INIT \
|
#define TIMER_INIT \
|
||||||
double clock_prev,clock_curr,step_begin_clock;\
|
double clock_prev,clock_curr,step_begin_clock;\
|
||||||
if(1 == 1){\
|
if(1 == 1){\
|
||||||
clock_curr =MPI_Wtime();\
|
clock_curr =MPI_Wtime();\
|
||||||
step_begin_clock = MPI_Wtime();\
|
step_begin_clock = MPI_Wtime();\
|
||||||
}else{\
|
}else{\
|
||||||
if(myrank == 0){\
|
if(myrank == 0){\
|
||||||
clock_curr= MPI_Wtime();\
|
clock_curr= MPI_Wtime();\
|
||||||
step_begin_clock = MPI_Wtime();\
|
step_begin_clock = MPI_Wtime();\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TIMER_TIC(tag,order,label) \
|
#define TIMER_TIC(tag,order,label) \
|
||||||
if(TIME_COUNT_EACH_RANK == 1){\
|
if(TIME_COUNT_EACH_RANK == 1){\
|
||||||
clock_prev= clock_curr;\
|
clock_prev= clock_curr;\
|
||||||
clock_curr = MPI_Wtime();\
|
clock_curr = MPI_Wtime();\
|
||||||
cout<<#tag <<order <<":MPI Rank: "<<myrank<<" "<<#label <<" "<<(clock_curr-clock_prev)<<endl;\
|
cout<<#tag <<order <<":MPI Rank: "<<myrank<<" "<<#label <<" "<<(clock_curr-clock_prev)<<endl;\
|
||||||
}else{\
|
}else{\
|
||||||
if(myrank==0){\
|
if(myrank==0){\
|
||||||
clock_prev= clock_curr;\
|
clock_prev= clock_curr;\
|
||||||
clock_curr = MPI_Wtime();\
|
clock_curr = MPI_Wtime();\
|
||||||
cout<<#tag <<order <<" "<<#label " "<<(clock_curr-clock_prev)<<endl;\
|
cout<<#tag <<order <<" "<<#label " "<<(clock_curr-clock_prev)<<endl;\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TIMER_TIC_EACH_PROC(tag,order,label) \
|
#define TIMER_TIC_EACH_PROC(tag,order,label) \
|
||||||
clock_prev= clock_curr;\
|
clock_prev= clock_curr;\
|
||||||
clock_curr = MPI_Wtime();\
|
clock_curr = MPI_Wtime();\
|
||||||
cout<<#tag <<order <<":MPI Rank: "<<myrank<<" "<<#label <<" "<<(clock_curr-clock_prev)<<endl;\
|
cout<<#tag <<order <<":MPI Rank: "<<myrank<<" "<<#label <<" "<<(clock_curr-clock_prev)<<endl;\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TIMER_TIC_WITHOUT_OUTPUT \
|
#define TIMER_TIC_WITHOUT_OUTPUT \
|
||||||
if(TIME_COUNT_EACH_RANK == 1){\
|
if(TIME_COUNT_EACH_RANK == 1){\
|
||||||
clock_curr = MPI_Wtime();\
|
clock_curr = MPI_Wtime();\
|
||||||
}else{\
|
}else{\
|
||||||
if(myrank==0){\
|
if(myrank==0){\
|
||||||
clock_curr = MPI_Wtime();\
|
clock_curr = MPI_Wtime();\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TIMER_TIC_TAIL_OF_FUNC(tag,label) \
|
#define TIMER_TIC_TAIL_OF_FUNC(tag,label) \
|
||||||
if(TIME_COUNT_EACH_RANK == 1){\
|
if(TIME_COUNT_EACH_RANK == 1){\
|
||||||
cout<<#tag <<"MPI Rank: "<<myrank<<" "<<#label <<" "<<(MPI_Wtime()-step_begin_clock)<<" seconds!"<<endl;\
|
cout<<#tag <<"MPI Rank: "<<myrank<<" "<<#label <<" "<<(MPI_Wtime()-step_begin_clock)<<" seconds!"<<endl;\
|
||||||
}else{\
|
}else{\
|
||||||
if(myrank==0)\
|
if(myrank==0)\
|
||||||
{\
|
{\
|
||||||
cout<<#tag <<#label <<" "<<(MPI_Wtime()-step_begin_clock)<<" seconds!"<<endl;\
|
cout<<#tag <<#label <<" "<<(MPI_Wtime()-step_begin_clock)<<" seconds!"<<endl;\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
|
||||||
//3---------------------GPU---------------------
|
//3---------------------GPU---------------------
|
||||||
#define CALLED_BY_STEP 0
|
#define CALLED_BY_STEP 0
|
||||||
#define CALLED_BY_CONSTRAINT 1
|
#define CALLED_BY_CONSTRAINT 1
|
||||||
|
|
||||||
#define RHS_PARA_CALLED_FIRST_TIME cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
|
#define RHS_PARA_CALLED_FIRST_TIME cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
|
||||||
|
|
||||||
#define RHS_PARA_CALLED_THEN cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi->sgfn],cg->fgfs[trK->sgfn],cg->fgfs[gxx->sgfn],cg->fgfs[gxy->sgfn],cg->fgfs[gxz->sgfn],cg->fgfs[gyy->sgfn],cg->fgfs[gyz->sgfn],cg->fgfs[gzz->sgfn],cg->fgfs[Axx->sgfn],cg->fgfs[Axy->sgfn],cg->fgfs[Axz->sgfn],cg->fgfs[Ayy->sgfn],cg->fgfs[Ayz->sgfn],cg->fgfs[Azz->sgfn],cg->fgfs[Gmx->sgfn],cg->fgfs[Gmy->sgfn],cg->fgfs[Gmz->sgfn],cg->fgfs[Lap->sgfn],cg->fgfs[Sfx->sgfn],cg->fgfs[Sfy->sgfn],cg->fgfs[Sfz->sgfn],cg->fgfs[dtSfx->sgfn],cg->fgfs[dtSfy->sgfn],cg->fgfs[dtSfz->sgfn],cg->fgfs[phi1->sgfn],cg->fgfs[trK1->sgfn],cg->fgfs[gxx1->sgfn],cg->fgfs[gxy1->sgfn],cg->fgfs[gxz1->sgfn],cg->fgfs[gyy1->sgfn],cg->fgfs[gyz1->sgfn],cg->fgfs[gzz1->sgfn],cg->fgfs[Axx1->sgfn],cg->fgfs[Axy1->sgfn],cg->fgfs[Axz1->sgfn],cg->fgfs[Ayy1->sgfn],cg->fgfs[Ayz1->sgfn],cg->fgfs[Azz1->sgfn],cg->fgfs[Gmx1->sgfn],cg->fgfs[Gmy1->sgfn],cg->fgfs[Gmz1->sgfn],cg->fgfs[Lap1->sgfn],cg->fgfs[Sfx1->sgfn],cg->fgfs[Sfy1->sgfn],cg->fgfs[Sfz1->sgfn],cg->fgfs[dtSfx1->sgfn],cg->fgfs[dtSfy1->sgfn],cg->fgfs[dtSfz1->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,cor
|
#define RHS_PARA_CALLED_THEN cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi->sgfn],cg->fgfs[trK->sgfn],cg->fgfs[gxx->sgfn],cg->fgfs[gxy->sgfn],cg->fgfs[gxz->sgfn],cg->fgfs[gyy->sgfn],cg->fgfs[gyz->sgfn],cg->fgfs[gzz->sgfn],cg->fgfs[Axx->sgfn],cg->fgfs[Axy->sgfn],cg->fgfs[Axz->sgfn],cg->fgfs[Ayy->sgfn],cg->fgfs[Ayz->sgfn],cg->fgfs[Azz->sgfn],cg->fgfs[Gmx->sgfn],cg->fgfs[Gmy->sgfn],cg->fgfs[Gmz->sgfn],cg->fgfs[Lap->sgfn],cg->fgfs[Sfx->sgfn],cg->fgfs[Sfy->sgfn],cg->fgfs[Sfz->sgfn],cg->fgfs[dtSfx->sgfn],cg->fgfs[dtSfy->sgfn],cg->fgfs[dtSfz->sgfn],cg->fgfs[phi1->sgfn],cg->fgfs[trK1->sgfn],cg->fgfs[gxx1->sgfn],cg->fgfs[gxy1->sgfn],cg->fgfs[gxz1->sgfn],cg->fgfs[gyy1->sgfn],cg->fgfs[gyz1->sgfn],cg->fgfs[gzz1->sgfn],cg->fgfs[Axx1->sgfn],cg->fgfs[Axy1->sgfn],cg->fgfs[Axz1->sgfn],cg->fgfs[Ayy1->sgfn],cg->fgfs[Ayz1->sgfn],cg->fgfs[Azz1->sgfn],cg->fgfs[Gmx1->sgfn],cg->fgfs[Gmy1->sgfn],cg->fgfs[Gmz1->sgfn],cg->fgfs[Lap1->sgfn],cg->fgfs[Sfx1->sgfn],cg->fgfs[Sfy1->sgfn],cg->fgfs[Sfz1->sgfn],cg->fgfs[dtSfx1->sgfn],cg->fgfs[dtSfy1->sgfn],cg->fgfs[dtSfz1->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,cor
|
||||||
|
|
||||||
#define RHS_PARA_CALLED_Constraint_Out cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
|
#define RHS_PARA_CALLED_Constraint_Out cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
|
||||||
|
|
||||||
|
|
||||||
#define RHS_PARA_CALLED_Interp_Constraint cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
|
#define RHS_PARA_CALLED_Interp_Constraint cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,ndeps,pre
|
||||||
|
|
||||||
#define RHS_SS_PARA_CALLED_FIRST_TIME cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
|
#define RHS_SS_PARA_CALLED_FIRST_TIME cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
|
||||||
|
|
||||||
#define RHS_SS_PARA_CALLED_THEN cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi->sgfn],cg->fgfs[trK->sgfn],cg->fgfs[gxx->sgfn],cg->fgfs[gxy->sgfn],cg->fgfs[gxz->sgfn],cg->fgfs[gyy->sgfn],cg->fgfs[gyz->sgfn],cg->fgfs[gzz->sgfn],cg->fgfs[Axx->sgfn],cg->fgfs[Axy->sgfn],cg->fgfs[Axz->sgfn],cg->fgfs[Ayy->sgfn],cg->fgfs[Ayz->sgfn],cg->fgfs[Azz->sgfn],cg->fgfs[Gmx->sgfn],cg->fgfs[Gmy->sgfn],cg->fgfs[Gmz->sgfn],cg->fgfs[Lap->sgfn],cg->fgfs[Sfx->sgfn],cg->fgfs[Sfy->sgfn],cg->fgfs[Sfz->sgfn],cg->fgfs[dtSfx->sgfn],cg->fgfs[dtSfy->sgfn],cg->fgfs[dtSfz->sgfn],cg->fgfs[phi1->sgfn],cg->fgfs[trK1->sgfn],cg->fgfs[gxx1->sgfn],cg->fgfs[gxy1->sgfn],cg->fgfs[gxz1->sgfn],cg->fgfs[gyy1->sgfn],cg->fgfs[gyz1->sgfn],cg->fgfs[gzz1->sgfn],cg->fgfs[Axx1->sgfn],cg->fgfs[Axy1->sgfn],cg->fgfs[Axz1->sgfn],cg->fgfs[Ayy1->sgfn],cg->fgfs[Ayz1->sgfn],cg->fgfs[Azz1->sgfn],cg->fgfs[Gmx1->sgfn],cg->fgfs[Gmy1->sgfn],cg->fgfs[Gmz1->sgfn],cg->fgfs[Lap1->sgfn],cg->fgfs[Sfx1->sgfn],cg->fgfs[Sfy1->sgfn],cg->fgfs[Sfz1->sgfn],cg->fgfs[dtSfx1->sgfn],cg->fgfs[dtSfy1->sgfn],cg->fgfs[dtSfz1->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,cor
|
#define RHS_SS_PARA_CALLED_THEN cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi->sgfn],cg->fgfs[trK->sgfn],cg->fgfs[gxx->sgfn],cg->fgfs[gxy->sgfn],cg->fgfs[gxz->sgfn],cg->fgfs[gyy->sgfn],cg->fgfs[gyz->sgfn],cg->fgfs[gzz->sgfn],cg->fgfs[Axx->sgfn],cg->fgfs[Axy->sgfn],cg->fgfs[Axz->sgfn],cg->fgfs[Ayy->sgfn],cg->fgfs[Ayz->sgfn],cg->fgfs[Azz->sgfn],cg->fgfs[Gmx->sgfn],cg->fgfs[Gmy->sgfn],cg->fgfs[Gmz->sgfn],cg->fgfs[Lap->sgfn],cg->fgfs[Sfx->sgfn],cg->fgfs[Sfy->sgfn],cg->fgfs[Sfz->sgfn],cg->fgfs[dtSfx->sgfn],cg->fgfs[dtSfy->sgfn],cg->fgfs[dtSfz->sgfn],cg->fgfs[phi1->sgfn],cg->fgfs[trK1->sgfn],cg->fgfs[gxx1->sgfn],cg->fgfs[gxy1->sgfn],cg->fgfs[gxz1->sgfn],cg->fgfs[gyy1->sgfn],cg->fgfs[gyz1->sgfn],cg->fgfs[gzz1->sgfn],cg->fgfs[Axx1->sgfn],cg->fgfs[Axy1->sgfn],cg->fgfs[Axz1->sgfn],cg->fgfs[Ayy1->sgfn],cg->fgfs[Ayz1->sgfn],cg->fgfs[Azz1->sgfn],cg->fgfs[Gmx1->sgfn],cg->fgfs[Gmy1->sgfn],cg->fgfs[Gmz1->sgfn],cg->fgfs[Lap1->sgfn],cg->fgfs[Sfx1->sgfn],cg->fgfs[Sfy1->sgfn],cg->fgfs[Sfz1->sgfn],cg->fgfs[dtSfx1->sgfn],cg->fgfs[dtSfy1->sgfn],cg->fgfs[dtSfz1->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,cor
|
||||||
|
|
||||||
|
|
||||||
#define RHS_PARA_CALLED_Constraint_Out_SS cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
|
#define RHS_PARA_CALLED_Constraint_Out_SS cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
|
||||||
|
|
||||||
#define RHS_PARA_CALLED_Intrp_Constraint_Out_SS cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
|
#define RHS_PARA_CALLED_Intrp_Constraint_Out_SS cg->shape,TRK4,cg->X[0],cg->X[1],cg->X[2],cg->fgfs[fngfs+ShellPatch::gx],cg->fgfs[fngfs+ShellPatch::gy],cg->fgfs[fngfs+ShellPatch::gz],cg->fgfs[fngfs+ShellPatch::drhodx],cg->fgfs[fngfs+ShellPatch::drhody],cg->fgfs[fngfs+ShellPatch::drhodz],cg->fgfs[fngfs+ShellPatch::dsigmadx],cg->fgfs[fngfs+ShellPatch::dsigmady],cg->fgfs[fngfs+ShellPatch::dsigmadz],cg->fgfs[fngfs+ShellPatch::dRdx],cg->fgfs[fngfs+ShellPatch::dRdy],cg->fgfs[fngfs+ShellPatch::dRdz],cg->fgfs[fngfs+ShellPatch::drhodxx],cg->fgfs[fngfs+ShellPatch::drhodxy],cg->fgfs[fngfs+ShellPatch::drhodxz],cg->fgfs[fngfs+ShellPatch::drhodyy],cg->fgfs[fngfs+ShellPatch::drhodyz],cg->fgfs[fngfs+ShellPatch::drhodzz],cg->fgfs[fngfs+ShellPatch::dsigmadxx],cg->fgfs[fngfs+ShellPatch::dsigmadxy],cg->fgfs[fngfs+ShellPatch::dsigmadxz],cg->fgfs[fngfs+ShellPatch::dsigmadyy],cg->fgfs[fngfs+ShellPatch::dsigmadyz],cg->fgfs[fngfs+ShellPatch::dsigmadzz],cg->fgfs[fngfs+ShellPatch::dRdxx],cg->fgfs[fngfs+ShellPatch::dRdxy],cg->fgfs[fngfs+ShellPatch::dRdxz],cg->fgfs[fngfs+ShellPatch::dRdyy],cg->fgfs[fngfs+ShellPatch::dRdyz],cg->fgfs[fngfs+ShellPatch::dRdzz],cg->fgfs[phi0->sgfn],cg->fgfs[trK0->sgfn],cg->fgfs[gxx0->sgfn],cg->fgfs[gxy0->sgfn],cg->fgfs[gxz0->sgfn],cg->fgfs[gyy0->sgfn],cg->fgfs[gyz0->sgfn],cg->fgfs[gzz0->sgfn],cg->fgfs[Axx0->sgfn],cg->fgfs[Axy0->sgfn],cg->fgfs[Axz0->sgfn],cg->fgfs[Ayy0->sgfn],cg->fgfs[Ayz0->sgfn],cg->fgfs[Azz0->sgfn],cg->fgfs[Gmx0->sgfn],cg->fgfs[Gmy0->sgfn],cg->fgfs[Gmz0->sgfn],cg->fgfs[Lap0->sgfn],cg->fgfs[Sfx0->sgfn],cg->fgfs[Sfy0->sgfn],cg->fgfs[Sfz0->sgfn],cg->fgfs[dtSfx0->sgfn],cg->fgfs[dtSfy0->sgfn],cg->fgfs[dtSfz0->sgfn],cg->fgfs[phi_rhs->sgfn],cg->fgfs[trK_rhs->sgfn],cg->fgfs[gxx_rhs->sgfn],cg->fgfs[gxy_rhs->sgfn],cg->fgfs[gxz_rhs->sgfn],cg->fgfs[gyy_rhs->sgfn],cg->fgfs[gyz_rhs->sgfn],cg->fgfs[gzz_rhs->sgfn],cg->fgfs[Axx_rhs->sgfn],cg->fgfs[Axy_rhs->sgfn],cg->fgfs[Axz_rhs->sgfn],cg->fgfs[Ayy_rhs->sgfn],cg->fgfs[Ayz_rhs->sgfn],cg->fgfs[Azz_rhs->sgfn],cg->fgfs[Gmx_rhs->sgfn],cg->fgfs[Gmy_rhs->sgfn],cg->fgfs[Gmz_rhs->sgfn],cg->fgfs[Lap_rhs->sgfn],cg->fgfs[Sfx_rhs->sgfn],cg->fgfs[Sfy_rhs->sgfn],cg->fgfs[Sfz_rhs->sgfn],cg->fgfs[dtSfx_rhs->sgfn],cg->fgfs[dtSfy_rhs->sgfn],cg->fgfs[dtSfz_rhs->sgfn],cg->fgfs[rho->sgfn],cg->fgfs[Sx->sgfn],cg->fgfs[Sy->sgfn],cg->fgfs[Sz->sgfn],cg->fgfs[Sxx->sgfn],cg->fgfs[Sxy->sgfn],cg->fgfs[Sxz->sgfn],cg->fgfs[Syy->sgfn],cg->fgfs[Syz->sgfn],cg->fgfs[Szz->sgfn],cg->fgfs[Gamxxx->sgfn],cg->fgfs[Gamxxy->sgfn],cg->fgfs[Gamxxz->sgfn],cg->fgfs[Gamxyy->sgfn],cg->fgfs[Gamxyz->sgfn],cg->fgfs[Gamxzz->sgfn],cg->fgfs[Gamyxx->sgfn],cg->fgfs[Gamyxy->sgfn],cg->fgfs[Gamyxz->sgfn],cg->fgfs[Gamyyy->sgfn],cg->fgfs[Gamyyz->sgfn],cg->fgfs[Gamyzz->sgfn],cg->fgfs[Gamzxx->sgfn],cg->fgfs[Gamzxy->sgfn],cg->fgfs[Gamzxz->sgfn],cg->fgfs[Gamzyy->sgfn],cg->fgfs[Gamzyz->sgfn],cg->fgfs[Gamzzz->sgfn],cg->fgfs[Rxx->sgfn],cg->fgfs[Rxy->sgfn],cg->fgfs[Rxz->sgfn],cg->fgfs[Ryy->sgfn],cg->fgfs[Ryz->sgfn],cg->fgfs[Rzz->sgfn],cg->fgfs[Cons_Ham->sgfn],cg->fgfs[Cons_Px->sgfn],cg->fgfs[Cons_Py->sgfn],cg->fgfs[Cons_Pz->sgfn],cg->fgfs[Cons_Gx->sgfn],cg->fgfs[Cons_Gy->sgfn],cg->fgfs[Cons_Gz->sgfn],Symmetry,lev,numepsh,sPp->data->sst,pre
|
||||||
//4------------tool------------------------------
|
//4------------tool------------------------------
|
||||||
int compare_result(int ftag1,double * d2,int data_num);
|
int compare_result(int ftag1,double * d2,int data_num);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,146 +1,146 @@
|
|||||||
#ifndef GPU_MEM_H_
|
#ifndef GPU_MEM_H_
|
||||||
#define GPU_MEM_H_
|
#define GPU_MEM_H_
|
||||||
#include "macrodef.fh"
|
#include "macrodef.fh"
|
||||||
struct Meta
|
struct Meta
|
||||||
{
|
{
|
||||||
//---------------in/out-------------------
|
//---------------in/out-------------------
|
||||||
// int * ex;
|
// int * ex;
|
||||||
// int* Symmetry,Lev,co; //not array //in
|
// int* Symmetry,Lev,co; //not array //in
|
||||||
// double * T; //not array //in
|
// double * T; //not array //in
|
||||||
double *X, *Y, *Z; // in
|
double *X, *Y, *Z; // in
|
||||||
double *chi, *dxx, *dyy, *dzz; // inout
|
double *chi, *dxx, *dyy, *dzz; // inout
|
||||||
double *trK; // in
|
double *trK; // in
|
||||||
double *gxy, *gxz, *gyz; // in
|
double *gxy, *gxz, *gyz; // in
|
||||||
double *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz; // in
|
double *Axx, *Axy, *Axz, *Ayy, *Ayz, *Azz; // in
|
||||||
double *Gamx, *Gamy, *Gamz; // in
|
double *Gamx, *Gamy, *Gamz; // in
|
||||||
double *Lap, *betax, *betay, *betaz; // inout
|
double *Lap, *betax, *betay, *betaz; // inout
|
||||||
double *dtSfx, *dtSfy, *dtSfz; // in
|
double *dtSfx, *dtSfy, *dtSfz; // in
|
||||||
double *chi_rhs, *trK_rhs; // out
|
double *chi_rhs, *trK_rhs; // out
|
||||||
double *gxx_rhs, *gxy_rhs, *gxz_rhs; // out
|
double *gxx_rhs, *gxy_rhs, *gxz_rhs; // out
|
||||||
double *gyy_rhs, *gyz_rhs, *gzz_rhs; // out
|
double *gyy_rhs, *gyz_rhs, *gzz_rhs; // out
|
||||||
double *Axx_rhs, *Axy_rhs, *Axz_rhs; // out
|
double *Axx_rhs, *Axy_rhs, *Axz_rhs; // out
|
||||||
double *Ayy_rhs, *Ayz_rhs, *Azz_rhs; // out
|
double *Ayy_rhs, *Ayz_rhs, *Azz_rhs; // out
|
||||||
double *Gamx_rhs, *Gamy_rhs, *Gamz_rhs; // out
|
double *Gamx_rhs, *Gamy_rhs, *Gamz_rhs; // out
|
||||||
double *Lap_rhs, *betax_rhs, *betay_rhs, *betaz_rhs; // out
|
double *Lap_rhs, *betax_rhs, *betay_rhs, *betaz_rhs; // out
|
||||||
double *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs; // out
|
double *dtSfx_rhs, *dtSfy_rhs, *dtSfz_rhs; // out
|
||||||
double *rho, *Sx, *Sy, *Sz; // in
|
double *rho, *Sx, *Sy, *Sz; // in
|
||||||
double *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz; // in
|
double *Sxx, *Sxy, *Sxz, *Syy, *Syz, *Szz; // in
|
||||||
|
|
||||||
// when out, physical second kind of connection //out
|
// when out, physical second kind of connection //out
|
||||||
double *Gamxxx, *Gamxxy, *Gamxxz;
|
double *Gamxxx, *Gamxxy, *Gamxxz;
|
||||||
double *Gamxyy, *Gamxyz, *Gamxzz;
|
double *Gamxyy, *Gamxyz, *Gamxzz;
|
||||||
double *Gamyxx, *Gamyxy, *Gamyxz;
|
double *Gamyxx, *Gamyxy, *Gamyxz;
|
||||||
double *Gamyyy, *Gamyyz, *Gamyzz;
|
double *Gamyyy, *Gamyyz, *Gamyzz;
|
||||||
double *Gamzxx, *Gamzxy, *Gamzxz;
|
double *Gamzxx, *Gamzxy, *Gamzxz;
|
||||||
double *Gamzyy, *Gamzyz, *Gamzzz;
|
double *Gamzyy, *Gamzyz, *Gamzzz;
|
||||||
|
|
||||||
// when out, physical Ricci tensor
|
// when out, physical Ricci tensor
|
||||||
double *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz; // out
|
double *Rxx, *Rxy, *Rxz, *Ryy, *Ryz, *Rzz; // out
|
||||||
// double * eps; //in
|
// double * eps; //in
|
||||||
double *ham_Res, *movx_Res, *movy_Res, *movz_Res; // inout
|
double *ham_Res, *movx_Res, *movy_Res, *movz_Res; // inout
|
||||||
double *Gmx_Res, *Gmy_Res, *Gmz_Res; // inout
|
double *Gmx_Res, *Gmy_Res, *Gmz_Res; // inout
|
||||||
|
|
||||||
//---------------local-------------------
|
//---------------local-------------------
|
||||||
|
|
||||||
double *gxx, *gyy, *gzz, *chix, *chiy, *chiz, *gxxx, *gxyx, *gxzx, *gyyx, *gyzx, *gzzx, *gxxy, *gxyy, *gxzy, *gyyy, *gyzy, *gzzy, *gxxz, *gxyz, *gxzz, *gyyz, *gyzz, *gzzz, *Lapx, *Lapy, *Lapz, *betaxx, *betaxy, *betaxz, *betayx, *betayy, *betayz, *betazx, *betazy, *betazz, *Gamxx, *Gamxy, *Gamxz, *Gamyx, *Gamyy, *Gamyz, *Gamzx, *Gamzy, *Gamzz, *Kx, *Ky, *Kz, *div_beta, *S, *f, *fxx, *fxy, *fxz, *fyy, *fyz, *fzz, *Gamxa, *Gamya, *Gamza, *alpn1, *chin1, *gupxx, *gupxy, *gupxz, *gupyy, *gupyz, *gupzz;
|
double *gxx, *gyy, *gzz, *chix, *chiy, *chiz, *gxxx, *gxyx, *gxzx, *gyyx, *gyzx, *gzzx, *gxxy, *gxyy, *gxzy, *gyyy, *gyzy, *gzzy, *gxxz, *gxyz, *gxzz, *gyyz, *gyzz, *gzzz, *Lapx, *Lapy, *Lapz, *betaxx, *betaxy, *betaxz, *betayx, *betayy, *betayz, *betazx, *betazy, *betazz, *Gamxx, *Gamxy, *Gamxz, *Gamyx, *Gamyy, *Gamyz, *Gamzx, *Gamzy, *Gamzz, *Kx, *Ky, *Kz, *div_beta, *S, *f, *fxx, *fxy, *fxz, *fyy, *fyz, *fzz, *Gamxa, *Gamya, *Gamza, *alpn1, *chin1, *gupxx, *gupxy, *gupxz, *gupyy, *gupyz, *gupzz;
|
||||||
|
|
||||||
//---------------subroutine----------------
|
//---------------subroutine----------------
|
||||||
double *fh;
|
double *fh;
|
||||||
double *fh2;
|
double *fh2;
|
||||||
|
|
||||||
/*double *SSS;
|
/*double *SSS;
|
||||||
double *AAS;
|
double *AAS;
|
||||||
double *ASA;
|
double *ASA;
|
||||||
double *SAA;
|
double *SAA;
|
||||||
double *ASS;
|
double *ASS;
|
||||||
double *SAS;
|
double *SAS;
|
||||||
double *SSA;*/
|
double *SSA;*/
|
||||||
//---------------GAUGE--------------
|
//---------------GAUGE--------------
|
||||||
#if (GAUGE == 2 || GAUGE == 3 || GAUGE == 4 || GAUGE == 5 || GAUGE == 6 || GAUGE == 7)
|
#if (GAUGE == 2 || GAUGE == 3 || GAUGE == 4 || GAUGE == 5 || GAUGE == 6 || GAUGE == 7)
|
||||||
double *reta;
|
double *reta;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
//------init constant memory---------
|
//------init constant memory---------
|
||||||
|
|
||||||
// 1-----for compute_rhs_bssn---------
|
// 1-----for compute_rhs_bssn---------
|
||||||
__constant__ Meta metac;
|
__constant__ Meta metac;
|
||||||
__constant__ int ex_c[3];
|
__constant__ int ex_c[3];
|
||||||
__constant__ double T_c;
|
__constant__ double T_c;
|
||||||
__constant__ int Symmetry_c;
|
__constant__ int Symmetry_c;
|
||||||
__constant__ int Lev_c;
|
__constant__ int Lev_c;
|
||||||
__constant__ int co_c;
|
__constant__ int co_c;
|
||||||
__constant__ double eps_c;
|
__constant__ double eps_c;
|
||||||
// local
|
// local
|
||||||
__constant__ double dX; // dX,dY,dZ
|
__constant__ double dX; // dX,dY,dZ
|
||||||
__constant__ double dY;
|
__constant__ double dY;
|
||||||
__constant__ double dZ;
|
__constant__ double dZ;
|
||||||
__constant__ double ZEO = 1.0;
|
__constant__ double ZEO = 1.0;
|
||||||
__constant__ double ONE = 1.0;
|
__constant__ double ONE = 1.0;
|
||||||
__constant__ double TWO = 2.0;
|
__constant__ double TWO = 2.0;
|
||||||
__constant__ double FOUR = 4.0;
|
__constant__ double FOUR = 4.0;
|
||||||
__constant__ double EIGHT = 8.0;
|
__constant__ double EIGHT = 8.0;
|
||||||
__constant__ double HALF = 0.5;
|
__constant__ double HALF = 0.5;
|
||||||
__constant__ double THR = 3.0;
|
__constant__ double THR = 3.0;
|
||||||
__constant__ double SYM = 1.0;
|
__constant__ double SYM = 1.0;
|
||||||
__constant__ double ANTI = -1.0;
|
__constant__ double ANTI = -1.0;
|
||||||
__constant__ double FF = 0.75;
|
__constant__ double FF = 0.75;
|
||||||
__constant__ double eta = 2.0;
|
__constant__ double eta = 2.0;
|
||||||
__constant__ double F1o3;
|
__constant__ double F1o3;
|
||||||
__constant__ double F2o3;
|
__constant__ double F2o3;
|
||||||
__constant__ double F3o2 = 1.5;
|
__constant__ double F3o2 = 1.5;
|
||||||
__constant__ double F1o6;
|
__constant__ double F1o6;
|
||||||
__constant__ double F8 = 8.0;
|
__constant__ double F8 = 8.0;
|
||||||
__constant__ double F16 = 16.0;
|
__constant__ double F16 = 16.0;
|
||||||
__constant__ double PI;
|
__constant__ double PI;
|
||||||
/*__constant__ double SSS[3] = {1,1,1};
|
/*__constant__ double SSS[3] = {1,1,1};
|
||||||
__constant__ double AAS[3] = {-1,-1,1};
|
__constant__ double AAS[3] = {-1,-1,1};
|
||||||
__constant__ double ASA[3] = {-1,1,-1};
|
__constant__ double ASA[3] = {-1,1,-1};
|
||||||
__constant__ double SAA[3] = {1,-1,-1};
|
__constant__ double SAA[3] = {1,-1,-1};
|
||||||
__constant__ double ASS[3] = {-1,1,1};
|
__constant__ double ASS[3] = {-1,1,1};
|
||||||
__constant__ double SAS[3] = {1,-1,1};
|
__constant__ double SAS[3] = {1,-1,1};
|
||||||
__constant__ double SSA[3] = {1,1,-1};*/
|
__constant__ double SSA[3] = {1,1,-1};*/
|
||||||
|
|
||||||
// 2--------for fderivs------------
|
// 2--------for fderivs------------
|
||||||
__constant__ int ijk_min[3];
|
__constant__ int ijk_min[3];
|
||||||
__constant__ int ijk_min2[3];
|
__constant__ int ijk_min2[3];
|
||||||
__constant__ int ijk_min3[3];
|
__constant__ int ijk_min3[3];
|
||||||
__constant__ int ijk_max[3];
|
__constant__ int ijk_max[3];
|
||||||
__constant__ double d12dxyz[3];
|
__constant__ double d12dxyz[3];
|
||||||
__constant__ double d2dxyz[3];
|
__constant__ double d2dxyz[3];
|
||||||
|
|
||||||
// 3--------for fdderivs------------
|
// 3--------for fdderivs------------
|
||||||
__constant__ double Sdxdx;
|
__constant__ double Sdxdx;
|
||||||
__constant__ double Sdydy;
|
__constant__ double Sdydy;
|
||||||
__constant__ double Sdzdz;
|
__constant__ double Sdzdz;
|
||||||
__constant__ double Fdxdx;
|
__constant__ double Fdxdx;
|
||||||
__constant__ double Fdydy;
|
__constant__ double Fdydy;
|
||||||
__constant__ double Fdzdz;
|
__constant__ double Fdzdz;
|
||||||
__constant__ double Sdxdy;
|
__constant__ double Sdxdy;
|
||||||
__constant__ double Sdxdz;
|
__constant__ double Sdxdz;
|
||||||
__constant__ double Sdydz;
|
__constant__ double Sdydz;
|
||||||
__constant__ double Fdxdy;
|
__constant__ double Fdxdy;
|
||||||
__constant__ double Fdxdz;
|
__constant__ double Fdxdz;
|
||||||
__constant__ double Fdydz;
|
__constant__ double Fdydz;
|
||||||
|
|
||||||
// my own
|
// my own
|
||||||
__constant__ int STEP_SIZE;
|
__constant__ int STEP_SIZE;
|
||||||
/*__constant__ int MATRIX_SIZE;
|
/*__constant__ int MATRIX_SIZE;
|
||||||
__constant__ int MATRIX_SIZE_FH;
|
__constant__ int MATRIX_SIZE_FH;
|
||||||
__constant__ int SQUARE_SIZE;
|
__constant__ int SQUARE_SIZE;
|
||||||
__constant__ int SQUARE_SIZE_FH;
|
__constant__ int SQUARE_SIZE_FH;
|
||||||
__constant__ int LINE_SIZE_FH;*/
|
__constant__ int LINE_SIZE_FH;*/
|
||||||
|
|
||||||
__constant__ int _1D_SIZE[4]; // start from 0 !!
|
__constant__ int _1D_SIZE[4]; // start from 0 !!
|
||||||
__constant__ int _2D_SIZE[4]; ////start from 0 !!
|
__constant__ int _2D_SIZE[4]; ////start from 0 !!
|
||||||
__constant__ int _3D_SIZE[4]; ////start from 0 !!
|
__constant__ int _3D_SIZE[4]; ////start from 0 !!
|
||||||
|
|
||||||
#if (GAUGE == 6 || GAUGE == 7)
|
#if (GAUGE == 6 || GAUGE == 7)
|
||||||
__constant__ int BHN;
|
__constant__ int BHN;
|
||||||
__constant__ double Porg[9];
|
__constant__ double Porg[9];
|
||||||
__constant__ double Mass[3];
|
__constant__ double Mass[3];
|
||||||
__constant__ double /*r1,r2*/, M, A, /*w1,w2 (== 12)*/, C1, C2;
|
__constant__ double /*r1,r2*/, M, A, /*w1,w2 (== 12)*/, C1, C2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
#endif
|
#endif
|
||||||
@@ -1,198 +1,198 @@
|
|||||||
#ifndef GPU_MEM_H_
|
#ifndef GPU_MEM_H_
|
||||||
#define GPU_MEM_H_
|
#define GPU_MEM_H_
|
||||||
#include "macrodef.fh"
|
#include "macrodef.fh"
|
||||||
|
|
||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
struct Metass
|
struct Metass
|
||||||
{
|
{
|
||||||
double *crho,* sigma,* R,*
|
double *crho,* sigma,* R,*
|
||||||
drhodx,* drhody,* drhodz,*
|
drhodx,* drhody,* drhodz,*
|
||||||
dsigmadx,* dsigmady,* dsigmadz,*
|
dsigmadx,* dsigmady,* dsigmadz,*
|
||||||
dRdx,* dRdy,* dRdz,*
|
dRdx,* dRdy,* dRdz,*
|
||||||
drhodxx,* drhodxy,* drhodxz,*
|
drhodxx,* drhodxy,* drhodxz,*
|
||||||
drhodyy,* drhodyz,* drhodzz,*
|
drhodyy,* drhodyz,* drhodzz,*
|
||||||
dsigmadxx,* dsigmadxy,* dsigmadxz,*
|
dsigmadxx,* dsigmadxy,* dsigmadxz,*
|
||||||
dsigmadyy,* dsigmadyz,* dsigmadzz,*
|
dsigmadyy,* dsigmadyz,* dsigmadzz,*
|
||||||
dRdxx,* dRdxy,* dRdxz,*
|
dRdxx,* dRdxy,* dRdxz,*
|
||||||
dRdyy,* dRdyz,* dRdzz;
|
dRdyy,* dRdyz,* dRdzz;
|
||||||
//local
|
//local
|
||||||
double *gx,*gy,*gz,*gxx,*gxy,*gxz,*gyy,*gyz,*gzz;
|
double *gx,*gy,*gz,*gxx,*gxy,*gxz,*gyy,*gyz,*gzz;
|
||||||
};
|
};
|
||||||
|
|
||||||
__constant__ Metass metassc;
|
__constant__ Metass metassc;
|
||||||
Metass * metass;
|
Metass * metass;
|
||||||
|
|
||||||
#endif //WithShell
|
#endif //WithShell
|
||||||
|
|
||||||
struct Meta
|
struct Meta
|
||||||
{
|
{
|
||||||
//SS
|
//SS
|
||||||
|
|
||||||
//---------------in/out-------------------
|
//---------------in/out-------------------
|
||||||
//int * ex;
|
//int * ex;
|
||||||
//int* Symmetry,Lev,co; //not array //in
|
//int* Symmetry,Lev,co; //not array //in
|
||||||
//double * T; //not array //in
|
//double * T; //not array //in
|
||||||
double * X,*Y,*Z; //in
|
double * X,*Y,*Z; //in
|
||||||
double * chi,*dxx,*dyy,*dzz; //inout
|
double * chi,*dxx,*dyy,*dzz; //inout
|
||||||
double * trK ; //in
|
double * trK ; //in
|
||||||
double * gxy,*gxz,*gyz; //in
|
double * gxy,*gxz,*gyz; //in
|
||||||
double * Axx,*Axy,*Axz,*Ayy,*Ayz,*Azz; //in
|
double * Axx,*Axy,*Axz,*Ayy,*Ayz,*Azz; //in
|
||||||
double * Gamx,*Gamy,*Gamz ; //in
|
double * Gamx,*Gamy,*Gamz ; //in
|
||||||
double * Lap, *betax, *betay, *betaz; //inout
|
double * Lap, *betax, *betay, *betaz; //inout
|
||||||
double * dtSfx, *dtSfy, *dtSfz ; //in
|
double * dtSfx, *dtSfy, *dtSfz ; //in
|
||||||
double * chi_rhs,*trK_rhs ; //out
|
double * chi_rhs,*trK_rhs ; //out
|
||||||
double * gxx_rhs,*gxy_rhs,*gxz_rhs; //out
|
double * gxx_rhs,*gxy_rhs,*gxz_rhs; //out
|
||||||
double * gyy_rhs,*gyz_rhs,*gzz_rhs; //out
|
double * gyy_rhs,*gyz_rhs,*gzz_rhs; //out
|
||||||
double * Axx_rhs,*Axy_rhs,*Axz_rhs; //out
|
double * Axx_rhs,*Axy_rhs,*Axz_rhs; //out
|
||||||
double * Ayy_rhs,*Ayz_rhs,*Azz_rhs; //out
|
double * Ayy_rhs,*Ayz_rhs,*Azz_rhs; //out
|
||||||
double * Gamx_rhs,*Gamy_rhs,*Gamz_rhs;//out
|
double * Gamx_rhs,*Gamy_rhs,*Gamz_rhs;//out
|
||||||
double * Lap_rhs, *betax_rhs, *betay_rhs, *betaz_rhs;//out
|
double * Lap_rhs, *betax_rhs, *betay_rhs, *betaz_rhs;//out
|
||||||
double * dtSfx_rhs,*dtSfy_rhs,*dtSfz_rhs;//out
|
double * dtSfx_rhs,*dtSfy_rhs,*dtSfz_rhs;//out
|
||||||
double * rho,*Sx,*Sy,*Sz ; //in
|
double * rho,*Sx,*Sy,*Sz ; //in
|
||||||
double * Sxx,*Sxy,*Sxz,*Syy,*Syz,*Szz; //in
|
double * Sxx,*Sxy,*Sxz,*Syy,*Syz,*Szz; //in
|
||||||
|
|
||||||
// when out, physical second kind of connection //out
|
// when out, physical second kind of connection //out
|
||||||
double * Gamxxx, *Gamxxy, *Gamxxz;
|
double * Gamxxx, *Gamxxy, *Gamxxz;
|
||||||
double * Gamxyy, *Gamxyz, *Gamxzz;
|
double * Gamxyy, *Gamxyz, *Gamxzz;
|
||||||
double * Gamyxx, *Gamyxy, *Gamyxz;
|
double * Gamyxx, *Gamyxy, *Gamyxz;
|
||||||
double * Gamyyy, *Gamyyz, *Gamyzz;
|
double * Gamyyy, *Gamyyz, *Gamyzz;
|
||||||
double * Gamzxx, *Gamzxy,* Gamzxz;
|
double * Gamzxx, *Gamzxy,* Gamzxz;
|
||||||
double * Gamzyy, *Gamzyz, *Gamzzz;
|
double * Gamzyy, *Gamzyz, *Gamzzz;
|
||||||
|
|
||||||
//when out, physical Ricci tensor
|
//when out, physical Ricci tensor
|
||||||
double * Rxx,*Rxy,*Rxz,*Ryy,*Ryz,*Rzz; //out
|
double * Rxx,*Rxy,*Rxz,*Ryy,*Ryz,*Rzz; //out
|
||||||
//double * eps; //in
|
//double * eps; //in
|
||||||
double * ham_Res, *movx_Res, *movy_Res, *movz_Res; //inout
|
double * ham_Res, *movx_Res, *movy_Res, *movz_Res; //inout
|
||||||
double * Gmx_Res, *Gmy_Res, *Gmz_Res; //inout
|
double * Gmx_Res, *Gmy_Res, *Gmz_Res; //inout
|
||||||
|
|
||||||
|
|
||||||
//---------------local-------------------
|
//---------------local-------------------
|
||||||
|
|
||||||
double * gxx,*gyy,*gzz
|
double * gxx,*gyy,*gzz
|
||||||
, *chix,*chiy,*chiz
|
, *chix,*chiy,*chiz
|
||||||
, *gxxx,*gxyx,*gxzx,*gyyx,*gyzx,*gzzx
|
, *gxxx,*gxyx,*gxzx,*gyyx,*gyzx,*gzzx
|
||||||
, *gxxy,*gxyy,*gxzy,*gyyy,*gyzy,*gzzy
|
, *gxxy,*gxyy,*gxzy,*gyyy,*gyzy,*gzzy
|
||||||
, *gxxz,*gxyz,*gxzz,*gyyz,*gyzz,*gzzz
|
, *gxxz,*gxyz,*gxzz,*gyyz,*gyzz,*gzzz
|
||||||
, *Lapx,*Lapy,*Lapz
|
, *Lapx,*Lapy,*Lapz
|
||||||
, *betaxx,*betaxy,*betaxz
|
, *betaxx,*betaxy,*betaxz
|
||||||
, *betayx,*betayy,*betayz
|
, *betayx,*betayy,*betayz
|
||||||
, *betazx,*betazy,*betazz
|
, *betazx,*betazy,*betazz
|
||||||
, *Gamxx,*Gamxy,*Gamxz
|
, *Gamxx,*Gamxy,*Gamxz
|
||||||
, *Gamyx,*Gamyy,*Gamyz
|
, *Gamyx,*Gamyy,*Gamyz
|
||||||
, *Gamzx,*Gamzy,*Gamzz
|
, *Gamzx,*Gamzy,*Gamzz
|
||||||
, *Kx,*Ky,*Kz,*div_beta,*S
|
, *Kx,*Ky,*Kz,*div_beta,*S
|
||||||
, *f,*fxx,*fxy,*fxz,*fyy,*fyz,*fzz
|
, *f,*fxx,*fxy,*fxz,*fyy,*fyz,*fzz
|
||||||
, *Gamxa,*Gamya,*Gamza,*alpn1,*chin1
|
, *Gamxa,*Gamya,*Gamza,*alpn1,*chin1
|
||||||
, *gupxx,*gupxy,*gupxz
|
, *gupxx,*gupxy,*gupxz
|
||||||
, *gupyy,*gupyz,*gupzz;
|
, *gupyy,*gupyz,*gupzz;
|
||||||
|
|
||||||
//---------------subroutine----------------
|
//---------------subroutine----------------
|
||||||
double * fh;
|
double * fh;
|
||||||
double * fh2;
|
double * fh2;
|
||||||
|
|
||||||
/*double *SSS;
|
/*double *SSS;
|
||||||
double *AAS;
|
double *AAS;
|
||||||
double *ASA;
|
double *ASA;
|
||||||
double *SAA;
|
double *SAA;
|
||||||
double *ASS;
|
double *ASS;
|
||||||
double *SAS;
|
double *SAS;
|
||||||
double *SSA;*/
|
double *SSA;*/
|
||||||
|
|
||||||
//---------------GAUGE--------------
|
//---------------GAUGE--------------
|
||||||
#if (GAUGE == 2 || GAUGE == 3 || GAUGE == 4 || GAUGE == 5 || GAUGE == 6 || GAUGE == 7)
|
#if (GAUGE == 2 || GAUGE == 3 || GAUGE == 4 || GAUGE == 5 || GAUGE == 6 || GAUGE == 7)
|
||||||
double * reta;
|
double * reta;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------init constant memory---------
|
//------init constant memory---------
|
||||||
|
|
||||||
//1-----for compute_rhs_bssn---------
|
//1-----for compute_rhs_bssn---------
|
||||||
__constant__ Meta metac;
|
__constant__ Meta metac;
|
||||||
|
|
||||||
__constant__ int ex_c[3];
|
__constant__ int ex_c[3];
|
||||||
__constant__ double T_c;
|
__constant__ double T_c;
|
||||||
__constant__ int Symmetry_c;
|
__constant__ int Symmetry_c;
|
||||||
__constant__ int Lev_c;
|
__constant__ int Lev_c;
|
||||||
__constant__ int co_c;
|
__constant__ int co_c;
|
||||||
__constant__ double eps_c;
|
__constant__ double eps_c;
|
||||||
__constant__ int sst_c;
|
__constant__ int sst_c;
|
||||||
//local
|
//local
|
||||||
__constant__ double dX; //dX,dY,dZ
|
__constant__ double dX; //dX,dY,dZ
|
||||||
__constant__ double dY;
|
__constant__ double dY;
|
||||||
__constant__ double dZ;
|
__constant__ double dZ;
|
||||||
__constant__ double ZEO = 1.0;
|
__constant__ double ZEO = 1.0;
|
||||||
__constant__ double ONE = 1.0;
|
__constant__ double ONE = 1.0;
|
||||||
__constant__ double TWO = 2.0;
|
__constant__ double TWO = 2.0;
|
||||||
__constant__ double FOUR = 4.0;
|
__constant__ double FOUR = 4.0;
|
||||||
__constant__ double EIGHT = 8.0;
|
__constant__ double EIGHT = 8.0;
|
||||||
__constant__ double HALF = 0.5;
|
__constant__ double HALF = 0.5;
|
||||||
__constant__ double THR = 3.0;
|
__constant__ double THR = 3.0;
|
||||||
__constant__ double SYM = 1.0;
|
__constant__ double SYM = 1.0;
|
||||||
__constant__ double ANTI = -1.0;
|
__constant__ double ANTI = -1.0;
|
||||||
__constant__ double FF = 0.75;
|
__constant__ double FF = 0.75;
|
||||||
__constant__ double eta = 2.0;
|
__constant__ double eta = 2.0;
|
||||||
__constant__ double F1o3;
|
__constant__ double F1o3;
|
||||||
__constant__ double F2o3;
|
__constant__ double F2o3;
|
||||||
__constant__ double F3o2 = 1.5;
|
__constant__ double F3o2 = 1.5;
|
||||||
__constant__ double F1o6;
|
__constant__ double F1o6;
|
||||||
__constant__ double F8 = 8.0;
|
__constant__ double F8 = 8.0;
|
||||||
__constant__ double F16 = 16.0;
|
__constant__ double F16 = 16.0;
|
||||||
__constant__ double PI;
|
__constant__ double PI;
|
||||||
/*__constant__ double SSS[3] = {1,1,1};
|
/*__constant__ double SSS[3] = {1,1,1};
|
||||||
__constant__ double AAS[3] = {-1,-1,1};
|
__constant__ double AAS[3] = {-1,-1,1};
|
||||||
__constant__ double ASA[3] = {-1,1,-1};
|
__constant__ double ASA[3] = {-1,1,-1};
|
||||||
__constant__ double SAA[3] = {1,-1,-1};
|
__constant__ double SAA[3] = {1,-1,-1};
|
||||||
__constant__ double ASS[3] = {-1,1,1};
|
__constant__ double ASS[3] = {-1,1,1};
|
||||||
__constant__ double SAS[3] = {1,-1,1};
|
__constant__ double SAS[3] = {1,-1,1};
|
||||||
__constant__ double SSA[3] = {1,1,-1};*/
|
__constant__ double SSA[3] = {1,1,-1};*/
|
||||||
|
|
||||||
//2--------for fderivs------------
|
//2--------for fderivs------------
|
||||||
__constant__ int ijk_min[3];
|
__constant__ int ijk_min[3];
|
||||||
__constant__ int ijk_min2[3];
|
__constant__ int ijk_min2[3];
|
||||||
__constant__ int ijk_min3[3];
|
__constant__ int ijk_min3[3];
|
||||||
__constant__ int ijk_max[3];
|
__constant__ int ijk_max[3];
|
||||||
__constant__ int ijk_max3[3];
|
__constant__ int ijk_max3[3];
|
||||||
__constant__ double d12dxyz[3];
|
__constant__ double d12dxyz[3];
|
||||||
__constant__ double d2dxyz[3];
|
__constant__ double d2dxyz[3];
|
||||||
|
|
||||||
//3--------for fdderivs------------
|
//3--------for fdderivs------------
|
||||||
__constant__ double Sdxdx;
|
__constant__ double Sdxdx;
|
||||||
__constant__ double Sdydy;
|
__constant__ double Sdydy;
|
||||||
__constant__ double Sdzdz;
|
__constant__ double Sdzdz;
|
||||||
__constant__ double Fdxdx;
|
__constant__ double Fdxdx;
|
||||||
__constant__ double Fdydy;
|
__constant__ double Fdydy;
|
||||||
__constant__ double Fdzdz;
|
__constant__ double Fdzdz;
|
||||||
__constant__ double Sdxdy;
|
__constant__ double Sdxdy;
|
||||||
__constant__ double Sdxdz;
|
__constant__ double Sdxdz;
|
||||||
__constant__ double Sdydz;
|
__constant__ double Sdydz;
|
||||||
__constant__ double Fdxdy;
|
__constant__ double Fdxdy;
|
||||||
__constant__ double Fdxdz;
|
__constant__ double Fdxdz;
|
||||||
__constant__ double Fdydz;
|
__constant__ double Fdydz;
|
||||||
|
|
||||||
|
|
||||||
//my own
|
//my own
|
||||||
__constant__ int STEP_SIZE;
|
__constant__ int STEP_SIZE;
|
||||||
/*__constant__ int MATRIX_SIZE;
|
/*__constant__ int MATRIX_SIZE;
|
||||||
__constant__ int MATRIX_SIZE_FH;
|
__constant__ int MATRIX_SIZE_FH;
|
||||||
__constant__ int SQUARE_SIZE;
|
__constant__ int SQUARE_SIZE;
|
||||||
__constant__ int SQUARE_SIZE_FH;
|
__constant__ int SQUARE_SIZE_FH;
|
||||||
__constant__ int LINE_SIZE_FH;*/
|
__constant__ int LINE_SIZE_FH;*/
|
||||||
|
|
||||||
__constant__ int _1D_SIZE[4]; //start from 0 !!
|
__constant__ int _1D_SIZE[4]; //start from 0 !!
|
||||||
__constant__ int _2D_SIZE[4]; ////start from 0 !!
|
__constant__ int _2D_SIZE[4]; ////start from 0 !!
|
||||||
__constant__ int _3D_SIZE[4]; ////start from 0 !!
|
__constant__ int _3D_SIZE[4]; ////start from 0 !!
|
||||||
|
|
||||||
int h_1D_SIZE[4]; //start from 0 !!
|
int h_1D_SIZE[4]; //start from 0 !!
|
||||||
int h_2D_SIZE[4]; ////start from 0 !!
|
int h_2D_SIZE[4]; ////start from 0 !!
|
||||||
int h_3D_SIZE[4]; ////start from 0 !!
|
int h_3D_SIZE[4]; ////start from 0 !!
|
||||||
Meta * meta;
|
Meta * meta;
|
||||||
|
|
||||||
#if (GAUGE == 6 || GAUGE == 7)
|
#if (GAUGE == 6 || GAUGE == 7)
|
||||||
__constant__ int BHN;
|
__constant__ int BHN;
|
||||||
__constant__ double Porg[9];
|
__constant__ double Porg[9];
|
||||||
__constant__ double Mass[3];
|
__constant__ double Mass[3];
|
||||||
__constant__ double /*r1,r2*/,M,A,/*w1,w2 (== 12)*/,C1,C2;
|
__constant__ double /*r1,r2*/,M,A,/*w1,w2 (== 12)*/,C1,C2;
|
||||||
#endif
|
#endif
|
||||||
/**/
|
/**/
|
||||||
#endif
|
#endif
|
||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user