/*fabden called by dlaw command, returns density for any density law */ #include "cddefines.h" #include "dlaw.h" #include "fabden.h" double fabden(double radius, double depth) { double fabden_v , temp; # ifdef DEBUG_FUN fputs( "<+>fabden()\n", debug_fp ); # endif /* this routine is called when the DLAW command is given, * and must return the hydrogen density at the current radius or depth * RADIUS is the radius, the distance from the center of symmetry. * DEPTH is the depth into the cloud, from the illuminated face * both are in cm * * radius, depth, and the array DensityLaw are double precision, although * FABDEN itself is not * * this is one way to generate a density * fabden = radius * depth * * this is how to use the parameters on the dlaw command * fabden = DensityLaw(1) + radius * DensityLaw(2) * * following must be removed if this sub is to be used */ fprintf( ioQQQ, " the old version of FABDEN must be deleted, and a new one put in place. Sorry.\n" ); /* this sets the value to zero, and the next branch will then stop */ fabden_v = dlaw.DensityLaw[0]; /* just here to stop compilers from flagging unused vars */ temp = radius + depth ; if( fabden_v == 0. ) { puts( "[Stop in fabden]" ); exit(1); } else { /* when this routine is used the following branck is the correct exit */ # ifdef DEBUG_FUN fputs( " <->fabden()\n", debug_fp ); # endif /* following should return correct value of the density at this position, * temp is there to trick lint */ return( fabden_v*temp ); } }