15 #include "findpts_local.h"
21 #define INITD(a,b,c) {a,b,c}
22 #define MULD(a,b,c) ((a)*(b)*(c))
23 #define INDEXD(a,na, b,nb, c) (((c)*(nb)+(b))*(na)+(a))
24 #define findpts_local_data findpts_local_data_3
25 #define findpts_local_setup findpts_local_setup_3
26 #define findpts_local_free findpts_local_free_3
27 #define findpts_local findpts_local_3
29 #define INITD(a,b,c) {a,b}
30 #define MULD(a,b,c) ((a)*(b))
31 #define INDEXD(a,na, b,nb, c) ((b)*(na)+(a))
32 #define findpts_local_data findpts_local_data_2
33 #define findpts_local_setup findpts_local_setup_2
34 #define findpts_local_free findpts_local_free_2
35 #define findpts_local findpts_local_2
42 #define NEL MULD(K,K,K)
47 #define NEWT_TOL 1024*DBL_EPSILON
48 #define MAX_HASH_SIZE NEL*MULD(NR,NS,NT)
70 double lr0[
D], lr1[
D], lr2[
D];
72 for(d=0;d<
D;++d) lr0[d]=
r[d]*(
r[d]-1)/2,
73 lr1[d]=(1+
r[d])*(1-
r[d]),
74 lr2[d]=
r[d]*(
r[d]+1)/2;
75 #define EVALR(base) ( coef [base ]*lr0[0] \
76 +coef [base+ 1]*lr1[0] \
77 +coef [base+ 2]*lr2[0] )
78 #define EVALS(base) ( EVALR(base )*lr0[1] \
79 +EVALR(base+ 3)*lr1[1] \
80 +EVALR(base+ 6)*lr2[1] )
81 #define EVALT(base) ( EVALS(base )*lr0[2] \
82 +EVALS(base+ 9)*lr1[2] \
83 +EVALS(base+18)*lr2[2] )
85 # define EVAL() EVALS(0)
87 # define EVAL() EVALT(0)
100 const double fac = 1.0/
K;
101 const double z3[3] = {-1,0,1};
112 for(kj=0;kj<
K;++kj)
for(ki=0;ki<
K;++ki) {
115 double r[
D], base[
D] =
INITD(-1+2*fac*ki,-1+2*fac*kj,-1+2*fac*kk);
118 for(k=0;k<
NT;++k) { r[2] = base[2]+fac*(1+
zt[k]);
120 for(j=0;j<
NS;++j) { r[1] = base[1]+fac*(1+
zs[j]);
121 for(i=0;i<
NR;++
i) { r[0] = base[0]+fac*(1+
zr[
i]);
134 const double fac = 1.0/
K, step = 2.0/(
K*(
TN-1));
140 for(kj=0;kj<
K;++kj)
for(ki=0;ki<
K;++ki) {
143 double r[
D], base[
D] =
INITD(-1+2*fac*ki,-1+2*fac*kj,-1+2*fac*kk);
146 for(k=0;k<
TN;++k) { r[2] = base[2]+step*k;
148 for(j=0;j<
TN;++j) { r[1] = base[1]+step*j;
149 for(i=0;i<
TN;++
i) { r[0] = base[0]+step*
i;
165 printf(
"code=%u, el=%u, dist2=%g, r=(%.17g,%.17g"
177 if(
testp[i].code==2) ++notfound;
179 printf(
"Maximum distance = %g\n%u points not found\n",
180 sqrt(dist2max), (
unsigned)notfound);
186 const unsigned x_stride[
D]=
187 INITD(
D*
sizeof(
double),
D*
sizeof(
double),
D*
sizeof(
double));
static const unsigned mr[D]
static double x3[D][MULD(3, 3, 3)]
void rand_elt_2(double *x, double *y, const double *zr, unsigned nr, const double *zs, unsigned ns)
static void test(buffer *buf)
#define INDEXD(a, na, b, nb, c)
static double quad_eval(const double coef[MULD(3, 3, 3)], const double r[D])
void rand_elt_3(double *x, double *y, double *z, const double *zr, unsigned nr, const double *zs, unsigned ns, const double *zt, unsigned nt)
static void rand_mesh(void)
static void test_mesh(void)
#define findpts_local_free
static const unsigned nr[D]
static double testx[NEL *MULD(TN, TN, TN)*D]
static struct pt_data testp[NEL *MULD(TN, TN, TN)]
establishes some macros to establish naming conventions
static const double *const elx[D]
static void print_ptdata(void)
#define findpts_local_setup