23 #include "para_grp_parse.h"
28 int **,
int **,
int **);
30 void test_flip(
int,
int,
int *,
int *,
int*);
46 PRINTF(
"////////////////////////////////////////////////////\n");
47 PRINTF(
" Input data \n");
48 PRINTF(
"----------------------------------------------------\n");
49 PRINTF(
"Enter nplane : ");
57 PRINTF(
" nktot : %d\n",nktot);
59 PRINTF(
"////////////////////////////////////////////////////\n");
65 PRINTF(
"////////////////////////////////////////////////////\n");
66 PRINTF(
" Line decomposition \n");
67 PRINTF(
"----------------------------------------------------\n");
76 get_glenn_prms(nktot,kx,ky,&nplane,&nline,&istrt,&iend,&npts,&kx_line,&ky_line);
77 PRINTF(
"nplane %d nline %d\n",nplane,nline);
79 int *istrt_lgrp = (
int *)malloc(nplane*
sizeof(
int));
80 int *iend_lgrp = (
int *)malloc(nplane*
sizeof(
int));
81 int *npts_lgrp = (
int *)malloc(nplane*
sizeof(
int));
82 int *nline_lgrp = (
int *)malloc(nplane*
sizeof(
int));
83 int *kx_str_lgrp = (
int *)malloc(nplane*
sizeof(
int));
84 int *kx_end_lgrp = (
int *)malloc(nplane*
sizeof(
int));
85 int *ky_str_lgrp = (
int *)malloc(nplane*
sizeof(
int));
86 int *ky_end_lgrp = (
int *)malloc(nplane*
sizeof(
int));
89 istrt_lgrp,iend_lgrp,npts_lgrp,nline_lgrp,
90 kx_str_lgrp,kx_end_lgrp,ky_str_lgrp,ky_end_lgrp);
92 for(
int i=0;i<nplane;i++){
93 PRINTF(
"i=%d : n=%d istrt=%d iend=%d nline=%d ",
94 i,npts_lgrp[i],istrt_lgrp[i],iend_lgrp[i],nline_lgrp[i]);
95 PRINTF(
"kx_str %d kx_end %d ky_str %d ky_end %d\n",
96 kx_str_lgrp[i],kx_end_lgrp[i],ky_str_lgrp[i],ky_end_lgrp[i]);
99 PRINTF(
"////////////////////////////////////////////////////\n");
114 int nplane,
int *nktot_out)
121 double aplane1 = (double)(nplane-1);
122 for(
int ikx=0;ikx<=nplane;ikx++){
125 for(
int iky=kymin;iky<=nplane;iky++){
127 if(ikx==0 && iky==0)kzmin=1;
128 for(
int ikz=kzmin;ikz<=nplane;ikz++){
129 double aka = (double)ikx;
130 double akb = (double)iky;
131 double akc = (double)ikz;
132 double g = sqrt(aka*aka + akb*akb + akc*akc);
133 if(g<=aplane1){nktot++;}
139 int *kx = (
int *)malloc(2*nktot*
sizeof(
int));
140 int *ky = (
int *)malloc(2*nktot*
sizeof(
int));
141 int *kz = (
int *)malloc(2*nktot*
sizeof(
int));
144 for(
int ikx=0;ikx<=nplane;ikx++){
147 for(
int iky=kymin;iky<=nplane;iky++){
149 if(ikx==0 && iky==0)kzmin=1;
150 for(
int ikz=kzmin;ikz<=nplane;ikz++){
151 double aka = (double)ikx;
152 double akb = (double)iky;
153 double akc = (double)ikz;
154 double g = sqrt(aka*aka + akb*akb + akc*akc);
155 if(g<=aplane1){kx[ic]=ikx; ky[ic]=iky; kz[ic]=ikz; ic++;}
159 kx[ic]=0;ky[ic]=0;kz[ic]=0;
180 int *nline_ret,
int **istrt_ret,
int **iend_ret,
181 int **npts_ret,
int **kx_line_ret,
int **ky_line_ret)
190 for(
int i=1;i<nktot;i++){
191 if(kx[i]!=kx[(i-1)]){nplane++;}
192 if(ky[i]!=ky[(i-1)] || kx[i]!=kx[(i-1)]){nline++;}
195 int *iend = (
int *)malloc(nline*
sizeof(
int));
196 int *istrt = (
int *)malloc(nline*
sizeof(
int));
197 int *npts = (
int *)malloc(nline*
sizeof(
int));
198 int *kx_line = (
int *)malloc(nline*
sizeof(
int));
199 int *ky_line = (
int *)malloc(nline*
sizeof(
int));
207 for(
int i=1;i<nktot;i++){
208 if(kx[i]!=kx[(i-1)] || ky[i]!=ky[(i-1)]){
218 iend[(nline-1)]=nktot;
220 *nplane_ret = nplane;
225 *kx_line_ret = kx_line;
226 *ky_line_ret = ky_line;
240 void test_flip(
int nktot,
int nplane,
int *kx,
int *ky,
int *kz)
246 double aplane1 = (double)(nplane-1);
249 for(
int ikx=0;ikx<=nplane;ikx++){
251 for(
int iky=kymin;iky<=nplane;iky++){
253 for(
int ikz=kzmin;ikz<=nplane;ikz++){
254 double aka = (double)ikx;
255 double akb = (double)iky;
256 double akc = (double)ikz;
257 double g = sqrt(aka*aka + akb*akb + akc*akc);
260 printf(
"flip error 1\n");exit(1);
262 if(kx[ic]!=ikx || ky[ic]!=iky || kz[ic]!=ikz){
263 printf(
"flip error 2\n");exit(1);
270 if(ic!=nktot){printf(
"flip error 3\n");exit(1);}
void create_kvec(int **, int **, int **, int, int *)
= Create model data points in 3D with spherical truncation
void get_glenn_prms(int, int *, int *, int *, int *, int **, int **, int **, int **, int **)
= Decompose the nktot data points into chunks based on plane index
static void get_plane_line_prms(int, int, int, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *)
functions
static void flip_data_set(int, int *, int *, int *, int *)
void test_flip(int, int, int *, int *, int *)
= Create model data points in 3D with spherical truncation