X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ffind_maximum_values.c;fp=src%2Ffind_maximum_values.c;h=cb9134886b48b803f851e999929ad6c3952680c5;hb=ec2d2ab8e90a0c4b86ffc2385655c2fb27fcacd9;hp=0000000000000000000000000000000000000000;hpb=795fb988211df268a8f7724bd2f4493c594abee9;p=debian%2Fatlc diff --git a/src/find_maximum_values.c b/src/find_maximum_values.c new file mode 100644 index 0000000..cb91348 --- /dev/null +++ b/src/find_maximum_values.c @@ -0,0 +1,113 @@ +/* atlc - arbitrary transmission line calculator, for the analysis of +transmission lines are directional couplers. + +Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB). + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either package_version 2 +of the License, or (at your option) any later package_version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +USA. + +Dr. David Kirkby, e-mail drkirkby at gmail.com + +*/ + +#include "config.h" +#include "definitions.h" + +extern int width, height; +extern unsigned char **oddity; +extern double **Er, **Vij; + +void find_maximum_values(struct max_values *maximum_values, int zero_elementsQ) +{ + double U, V, Ex, Ey, E, permittivity; + int i, j; + + /* It makes sense to draw the even and odd mode images on the same + scale, so if its a coupler, they elements are not zeroed if the + function is called when doing the even mode, which is done + after the odd mode */ + + if(zero_elementsQ==ZERO_ELEMENTS_FIRST) + { + maximum_values->E_max=0.0; + maximum_values->Ex_or_Ey_max=0.0; + maximum_values->V_max=0.0; + maximum_values->U_max=0.0; + maximum_values->permittivity_max=0.0; + } + for(i=0;i 1.0) + printf("U=%f v=%f Er=%f at %d %d\n",U,V,Er[i][j],i, j); + + if(E>maximum_values->E_max) + maximum_values->E_max=E; + + + if(fabs(Ex)>maximum_values->Ex_or_Ey_max) + maximum_values->Ex_or_Ey_max=fabs(Ex); + + if(fabs(Ey)>maximum_values->Ex_or_Ey_max) + maximum_values->Ex_or_Ey_max=fabs(Ey); + + if(fabs(E)>maximum_values->E_max) + maximum_values->E_max=fabs(E); + + if(fabs(V) > maximum_values->V_max) + maximum_values->V_max=fabs(V); + + if(U > maximum_values->U_max) + maximum_values->U_max=U; + + if(permittivity >maximum_values->permittivity_max ) + maximum_values->permittivity_max=permittivity; + /* printf("Ex_or_Ey_max=%g E_max=%g V_max=%g U_max=%g Er_max=%g\n",maximum_values->Ex_or_Ey_max, maximum_values->E_max, maximum_values->V_max, maximum_values->U_max, maximum_values->permittivity_max); */ + } + } +}