Skip to content
Snippets Groups Projects
Commit 3ad8d9fa authored by slevy's avatar slevy
Browse files

Pass out just the leaf nodes (stars), ignore center-of-mass nodes.

parent bc2a9e61
No related branches found
No related tags found
No related merge requests found
/*
* Network server offering particle snapshots of kira/Starlab data
* (www.manybody.org).
*
* Stuart Levy, slevy@ncsa.uiuc.edu
* National Center for Supercomputing Applications,
* University of Illinois 2001.
*/
/*
* $Log$
* Revision 1.6 2002/04/17 20:46:07 slevy
* Pass out just the leaf nodes (stars), ignore center-of-mass nodes.
*
* Revision 1.5 2002/04/17 15:51:11 slevy
* Print starlab-computed density-center position too.
* isalpha for Irix 6.5 back-compat.
......@@ -804,7 +816,7 @@ int scanopt(char *opt, char *arg) {
switch(opt[0]) {
case 'T':
tp = &curstate.T0.m[0];
if(16 != sscanf(optarg,
if(16 != sscanf(arg,
"%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f%*c%f",
tp+0,tp+1,tp+2,tp+3, tp+4,tp+5,tp+6,tp+7,
tp+8,tp+9,tp+10,tp+11, tp+12,tp+13,tp+14,tp+15)) {
......@@ -869,7 +881,7 @@ void starswap(db_star *st) {
* assuming the compiler packs bytes into a word in increasing
* address order. Seems safe.
*/
if(*(char *)one == 1) {
if(*(char *)&one == 1) {
for(i = 0, wp = (int *)st; i < 10; i++)
wp[i] = htonl(wp[i]);
st->color = htons(st->color);
......@@ -891,6 +903,7 @@ int serveonce(char *req, FILE *outf)
struct stuff *st = curstate.st;
double sx=0, sy=0, sz=0, smass=0;
float x0,y0,z0, x1,y1,z1;
int nspecks=0;
x0=y0=z0 = 1e20;
x1=y1=z1 = -1e20;
......@@ -943,8 +956,12 @@ int serveonce(char *req, FILE *outf)
T = curstate.T0;
}
nspecks = 0;
for(int i = 0; i < sl->nspecks; i++) {
struct speck *sp = NextSpeck(sl->specks, sl, i);
if(sp->val[SPECK_NCLUMP] < 0)
continue;
nspecks++;
if(has_tfm) {
vtfmpoint( &p, &sp->p, &T );
} else {
......@@ -955,8 +972,8 @@ int serveonce(char *req, FILE *outf)
star.y = p.x[1];
star.z = p.x[2];
star.magnitude = curstate.mag0 - .921 * logf( sp->val[SPECK_LUM] );
star.color = curstate.colorscale * sp->val[SPECK_TLOG];
star.num = sp->val[SPECK_ID];
star.color = (unsigned short) (curstate.colorscale * sp->val[SPECK_TLOG]);
star.num = (int) sp->val[SPECK_ID];
starswap(&star);
fwrite(&star, sizeof(star), 1, outf);
} else if(as_speck) {
......@@ -981,7 +998,7 @@ int serveonce(char *req, FILE *outf)
double tmin, tmax;
kira_get_trange( &st->dyn, st, &tmin, &tmax );
fprintf(outf, "time %lg in %lg .. %lg\n", curstate.realtime, tmin, tmax);
fprintf(outf, "nspecks %d\n", sl->nspecks);
fprintf(outf, "nspecks %d\n", nspecks);
if(smass > 0) {
fprintf(outf, "CM %lg %lg %lg\n", sx/smass, sy/smass, sz/smass);
fprintf(outf, "bbox center %g %g %g radius %g %g %g\n",
......@@ -1008,7 +1025,7 @@ int serveonce(char *req, FILE *outf)
fprintf(outf, "\n");
fprintf(outf, "group %d type %d\n", curstate.group, curstate.type);
}
return sl->nspecks;
return nspecks;
}
int serverlisten( int port ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment