├── Makefile ├── README ├── README.mit ├── README.sgi ├── bin └── plotfastH.m ├── config ├── doc ├── FastHenry_User_Guide.pdf └── FastHenry_nonuniform_gndplane_manual.pdf ├── examples ├── 30pin.inp ├── 3d_example2.inp ├── 3d_example2_coarse.inp ├── Zc_3d_examp2.mat ├── Zc_pin_con7.mat ├── broken.inp ├── gpexamp_copper.inp ├── hole.inp ├── holey_gp.inp ├── make_nonuniform.c ├── msm.inp ├── nonuni01.inp ├── onebargp.inp ├── pin-con2seg.inp ├── pin-con7.inp ├── pin-connect.inp ├── plane.in ├── rom_check_con7_r20.ckt ├── simple_gp.inp ├── template.inp ├── together.inp ├── together_nonuni.inp ├── trace.test.release ├── trace_over_mesh_new.inp ├── tree_sample.hier ├── tree_sample.inp └── vias.inp └── src ├── fasthenry ├── BreakupSeg.c ├── Makefile ├── Makefile.alpha ├── Makefile.dec ├── Makefile.default ├── Makefile.sgi ├── Makefile.solaris ├── Makefile.sysV ├── Makefile.x64 ├── Prec_cost.c ├── Precond.c ├── SetupComputePsi.c ├── SetupMulti.c ├── addgroundplane.c ├── barnoldi.c ├── bigmeshPre.c ├── bigmeshPre_direct.c ├── calcp.c ├── capsolve.c ├── cmplx.h ├── contact.c ├── cx_ludecomp.c ├── default_opts.c ├── deg_mutual.c ├── direct.c ├── dist_betw_fils.c ├── fillM.c ├── find_nonuni_path.c ├── findpaths.c ├── gmres.c ├── gp.h ├── hole.c ├── induct.c ├── induct.h ├── joelself.c ├── makeMakefile.c ├── mulDo.c ├── mulGlobal.c ├── mulGlobal.h ├── mulLocal.c ├── mulMats.c ├── mulMulti.c ├── mulSetup.c ├── mulStruct.h ├── mutual.c ├── newPrecond.c ├── newPrecond_cube.c ├── parse_command_line.c ├── patran.h ├── readGeom.c ├── read_tree.c ├── regurgitate.c ├── resusage.h ├── savemat_mod.c ├── sparse │ ├── MAKE.COM │ ├── Makefile │ ├── Makefile.default │ ├── Makefile.x64 │ ├── Makefile~ │ ├── MtrxError.h │ ├── MtrxExpt.h │ ├── doc │ │ ├── Makefile │ │ ├── advert.ms │ │ ├── install.ms │ │ ├── spDoc │ │ └── spDoc.ms │ ├── spAllocate.c │ ├── spBuild.c │ ├── spCompat.c │ ├── spConfig.h │ ├── spConfig.h_orig │ ├── spDefs.h │ ├── spFactor.c │ ├── spFortran.c │ ├── spMatrix.h │ ├── spOutput.c │ ├── spRevision │ ├── spSMP.c │ ├── spSolve.c │ ├── spSpice3.h │ ├── spTest.hide.c │ └── spUtils.c ├── uglieralloc.c └── writefastcap.c ├── misc ├── MakeLcircuit.c ├── Makefile ├── Makefile.default ├── Makefile.x64 ├── ReadOutput.c └── cmplx.h └── zbuf ├── Makefile ├── Makefile.alpha ├── Makefile.dec ├── Makefile.default ├── Makefile.sgi ├── Makefile.solaris ├── Makefile.sysV ├── Makefile.x64 ├── dump_struct.c ├── extras.c ├── input.c ├── invert.awk ├── mulGlobal.c ├── mulGlobal.h ├── mulStruct.h ├── patran.c ├── patran.h ├── quickif.c ├── quickif.h ├── resusage.h ├── savemat_mod.c ├── uglieralloc.c ├── zbuf.c ├── zbuf2fastcap.c ├── zbufGlobal.h ├── zbufInOut.c ├── zbufProj.c ├── zbufSort.c └── zbufStruct.h /Makefile: -------------------------------------------------------------------------------- 1 | # Master makefile for fastcap and related programs and documentation 2 | 3 | SRC = src 4 | FASTH = $(SRC)/fasthenry 5 | ZBUF = $(SRC)/zbuf 6 | MISC = $(SRC)/misc 7 | 8 | default: 9 | @echo Specify what to make: 10 | @echo " fasthenry - inductance calculation program" 11 | @echo " zbuf - geometry postscript file program" 12 | @echo " misc - utility programs" 13 | @echo " all - all of the above" 14 | @echo " clean - remove object files" 15 | 16 | fasthenry: 17 | cd $(FASTH) ; $(MAKE) fasthenry 18 | 19 | zbuf: 20 | cd $(ZBUF) ; $(MAKE) zbuf 21 | 22 | misc: 23 | cd $(MISC) ; $(MAKE) misc 24 | 25 | all: fasthenry zbuf misc 26 | 27 | clean: 28 | cd $(FASTH) ; $(MAKE) clean 29 | cd $(ZBUF) ; $(MAKE) clean 30 | cd $(MISC) ; $(MAKE) clean 31 | 32 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ========================================= 2 | FastHenry 3 | ========================================= 4 | 5 | 6 | FastHenry is the premium inductance solver originally developed at M.I.T. on Unix platform. A de-facto golden reference standard, FastHenry extracts the inductances and resistances of any arbitrary 3D conductive geometry by solving the Maxwell equations in quasi-static regime. 7 | 8 | 9 | This repository contains the source code, in three separated branches. 10 | 11 | 12 | The 'master' branch contains the original FastHenry distribution from M.I.T. plus bug fixes and porting to 64 bits and 32 bits Linux systems by FastFieldSolvers S.R.L. (http://www.fastfieldsolvers.com). 13 | Remark: in this branch the original 'README' file has been renamed 'README.mit'. Refer to the README.mit file for further details on this branch. 14 | 15 | The 'WinMSVS' branch contains the FastHenry2 code. FastHenry2 is the FastFieldSolvers S.R.L. Windows porting of FastHenry, including a GUI. It compiles under the free for open source projects MS Visual Studio 2013 Community Edition (for exact details about MS VS2013 licensing please refer to its terms and conditions from MicroSoft) 16 | 17 | The 'WRCad' branch contains the FastHenry enhancements made by Whiteley Research Inc. (http://www.wrcad.com/) for supporting superconductive elements. Code compiles for Linux 32/64 bits as well as for Windows in shell only mode, using MinGW. 18 | 19 | 20 | For pre-compiled binaries, details, branch descriptions, and instructions for compiling please visit http://www.fastfieldsolvers.com/download.htm. 21 | Access to the download pages is free, and you may access anonymously if you want. 22 | 23 | -------------------------------------------------------------------------------- /README.mit: -------------------------------------------------------------------------------- 1 | FastHenry 3.0.1 information. 2 | 3 | Updated May 28th 2012 by FastFieldSolvers, www.fastfieldsolvers.com 4 | 5 | FastHenry is a program for the efficient extraction of inductances and 6 | resistances of complex 3-D geometries of conductors. 7 | 8 | Configuring for your machine: 9 | 10 | 1. Change to the fasthenry-3.0 directory 11 | 12 | prompt % cd fasthenry-3.0 13 | 14 | 2. Configure for your machine (sets the compilation flags) 15 | 16 | SunOS 4.x, IBM RS 6000's, and other 4.2/3 BSD systems(?): 17 | prompt % config default 18 | 19 | DEC 5000s: 20 | prompt % config dec 21 | 22 | DEC Alphas: 23 | prompt % config alpha 24 | 25 | Silicon Graphics: 26 | prompt % config sgi 27 | and then read the extra instructions in README.sgi 28 | 29 | Linux: 30 | prompt % config default 31 | 32 | prompt % config x64 33 | to force compile for x86 64bit machines 34 | 35 | System V operating systems: 36 | 37 | Sun Solaris: 38 | 39 | prompt % config solaris 40 | 41 | Hewlett-Packard HP-UX, and other System V operating systems: 42 | This has not been thoroughly tested. 43 | 44 | prompt % config sysV 45 | 46 | Notes: 47 | 48 | a. For Versions of solaris before 2.5, The "ranlib" command is obsolete and 49 | doesn't exist. 50 | Either remove the ranlib command from src/fasthenry/sparse/Makefile 51 | or define a null ranlib command in your path or do "make -k all" 52 | 53 | b. In the linking stage, if you get an error that "gethostname" 54 | is undefined, then add "-DNO_GETHOSTNAME" to the CFLAGS line in 55 | src/fasthenry/Makefile and src/zbuf/Makefile after doing config. 56 | For instance 57 | 58 | CFLAGS = -O -DFIVE -DNO_GETHOSTNAME 59 | 60 | 61 | Compiling: 62 | 63 | prompt % cd fasthenry-3.0.1 64 | prompt % make all 65 | 66 | produces the executables: fasthenry-3.0.1/bin/fasthenry 67 | fasthenry-3.0.1/bin/zbuf 68 | fasthenry-3.0.1/bin/ReadOutput 69 | fasthenry-3.0.1/bin/MakeLcircuit 70 | 71 | If you want to save space after "make all", 72 | 73 | prompt % make clean 74 | 75 | will clean up *.o and *.a files. 76 | 77 | Documentation: 78 | 79 | The manuals are in Acrobat Reader pdf format in the directory 'doc' 80 | 81 | ------------------------------------------------------------- 82 | Major changes in 3.0.1 since version 3.0 83 | 84 | - Added various stability bug fixes over original 3.0 distribution 85 | 86 | - Added stability improvement under Linux 87 | 88 | - Added various includes and other minor updates to avoid warnings 89 | with latest versions of GCC 90 | 91 | - Updated source code to compile on 64 bit machines 92 | 93 | - Added Makefile option for 64 bit machines 94 | 95 | ------------------------------------------------------------- 96 | Major changes in 3.0 since version 2.5 97 | 98 | - Specify a nonuniform discretization of a reference plane to 99 | capture small features in fewer elements. 100 | 101 | - Two approaches for generating spice equivalent circuits are available: 102 | 103 | 1. An equivalent circuit for a single frequency. 104 | 105 | 2. A circuit which models the frequency 106 | dependent resistances and inductances through a reduced state-space 107 | representation 108 | 109 | Comments: Method 1 will not model frequency dependent resistance 110 | and inductance since it gives and R and L at the single specified 111 | frequency. Method 2 will model the full effects up to some frequency. 112 | 113 | - Major Bug fix: 114 | For reference planes which form segments with different 115 | widths in the x-direction versus the Y direction, the sizes weren't 116 | computed correctly in version 2.0 and above. This has been fixed. 117 | 118 | 119 | - The zbuf program now takes the ``-m'' argument to produce a 120 | Matlab file for faster visualization in matlab. This is very beneficial for 121 | large files since producing the postscript file can take $n^2$ time. 122 | The matlab file can be viewed within matlab with the 123 | fasthenry-3.0/bin/plotfastH.m matlab function. The file 124 | zbuffile.mat would be produced with ``zbuf -m zbuffile'' which can 125 | then be viewed in matlab with ``>> plotfastH('zbuffile.mat')''. 126 | Also, you can modify the file src/zbuf/dump_struct.c to output in YOUR own 127 | format instead of matlab. 128 | 129 | - Sparse preconditioner. Specify -p shells to use a 130 | preconditioner based on Byron Krauter's sparse inductance technique. 131 | 132 | - Regurgitate the input file with -v to see what FastHenry 133 | thinks it has read. Also can translate and reflect geometry before output. 134 | 135 | ------------------------------------------------------------- 136 | 137 | Changes since Version 1.0 138 | 139 | Version 1.5: 140 | 141 | 1. Better filament mutual inductance approximation for very thin segments. 142 | 2. Ability to specify ground plane holes. See example hole.inp and 143 | some of the comments toward the end of the file hole.c (I have 144 | not had a chance to update the manual.) 145 | 3. Other command line options. (Give an erroneous option at the command line 146 | to see the added options) 147 | 4. Some bug fixes. 148 | 149 | 150 | Version 2.0 - this is a far improvement over the past versions 151 | 152 | In summary: 153 | 1. A better preconditioner which allows efficient analysis of 154 | reference planes. 155 | 2. Accurate modeling with thin filaments. 156 | 3. More detailed manual 157 | 4. Many, many other features 158 | 159 | 160 | ----------------------------------------------------------------- 161 | 162 | -------------------------------------------------------------------------------- /README.sgi: -------------------------------------------------------------------------------- 1 | 2 | In version 2.0, compiling FastHenry on a Silicon Graphics workstation 3 | proved to cause some problems. 4 | 5 | Here are a couple of added steps that are necessary to get it going on 6 | an SGI. 7 | 8 | 1. Do "config sgi" in the fasthenry-2.0 directory. 9 | 10 | 2. in src/fasthenry/sparse/Makefile, add the option -cckr to the CFLAGS line: 11 | 12 | CFLAGS = -O -cckr 13 | 14 | 3. go back up to the fasthenry-2.0 directory, do 15 | 16 | make -k all 17 | 18 | You can ignore the error that ranlib is not found. 19 | 20 | 21 | -------------------------------------------------------------------------------- /bin/plotfastH.m: -------------------------------------------------------------------------------- 1 | function plotfastH(name); 2 | % Load and plot a 3D fasthenry structure produced with "zbuf -m name" 3 | % where name is without the ".mat" 4 | 5 | xt = []; yt = []; zt = []; 6 | xq = []; yq = []; zq = []; 7 | 8 | eval(['load ' name]); 9 | fprintf(1, 'loaded %d panels\n', length(xt) + length(xq)); 10 | hold off; 11 | if length(xt) > 0, 12 | ht = fill3(xt, yt, zt, 'r'); 13 | hold on; 14 | end 15 | X = max([max(xt) max(yt) max(zt)]); 16 | Y = min([min(xt) min(yt) min(zt)]); 17 | 18 | if length(xq) > 0, 19 | hq = fill3(xq, yq, zq, 'y'); 20 | end; 21 | 22 | X = max([X max(xq) max(yq) max(zq)]); 23 | Y = min([Y min(xq) min(yq) min(zq)]); 24 | 25 | 26 | axis([Y X Y X Y X]); 27 | fprintf(1, 'finished filling polygons\n'); 28 | 29 | %return; 30 | 31 | 32 | axis('square'); 33 | %return; 34 | 35 | 36 | set(ht, 'FaceColor', 'w') 37 | set(ht, 'EdgeColor', 'k') 38 | 39 | set(hq, 'FaceColor', 'w') 40 | set(hq, 'EdgeColor', 'k') 41 | axis('square'); 42 | axis('off'); 43 | return; 44 | 45 | %g = get(hq(1), 'LineWidth'); set(hq, 'LineWidth', 2*g); 46 | 47 | f = gcf; 48 | set(f, 'Color', [1 1 1]); 49 | set(f, 'InvertHardcopy', 'off'); 50 | 51 | %set(f, 'PaperOrientation', 'landscape'); 52 | print -deps panels.ps 53 | 54 | return; 55 | 56 | fprintf(1, 'printing...\n'); 57 | print -dps -Plouvre 58 | !lpq -Plouvre 59 | 60 | -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if test $1 4 | then 5 | name=$1 6 | else 7 | name="default" 8 | fi 9 | 10 | if test "$name" != "default" -a "$name" != "alpha" -a "$name" != "dec" -a "$name" != "sgi" -a "$name" != "sysV" -a "$name" != "solaris" -a "$name" != "x64" 11 | then 12 | echo config: Unknown type: $2. Choose one of: default, alpha, dec, sgi, sysV, solaris, x64 13 | else 14 | /bin/cp src/fasthenry/Makefile.$name src/fasthenry/Makefile 15 | /bin/cp src/zbuf/Makefile.$name src/zbuf/Makefile 16 | 17 | if test "$name" == "x64" 18 | then 19 | /bin/cp src/fasthenry/sparse/Makefile.$name src/fasthenry/sparse/Makefile 20 | /bin/cp src/misc/Makefile.$name src/misc/Makefile 21 | else 22 | /bin/cp src/fasthenry/sparse/Makefile.default src/fasthenry/sparse/Makefile 23 | /bin/cp src/misc/Makefile.default src/misc/Makefile 24 | fi 25 | fi 26 | 27 | -------------------------------------------------------------------------------- /doc/FastHenry_User_Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ediloren/FastHenry2/363e43ed57ad3b9affa11cba5a86624fad0edaa9/doc/FastHenry_User_Guide.pdf -------------------------------------------------------------------------------- /doc/FastHenry_nonuniform_gndplane_manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ediloren/FastHenry2/363e43ed57ad3b9affa11cba5a86624fad0edaa9/doc/FastHenry_nonuniform_gndplane_manual.pdf -------------------------------------------------------------------------------- /examples/3d_example2.inp: -------------------------------------------------------------------------------- 1 | * a M5 line (26um wide, 1um thick) over Si substrate 8um below, sigma=2.6e7 2 | * 430um thick substrate, sigma=1.5e4 1/(ohm*m) 3 | * line length=1000um 4 | .units uM 5 | * 6 | * Define substrate, sigma=1.5e4 1/(m*ohm)= 0.015 1/(um*ohm) 7 | g1 x1 = -1500 y1 = -1500 z1 = 0 8 | + x2 = 1500 y2 = -1500 z2 = 0 9 | + x3 = 1500 y3 = 1500 z3 = 0 10 | + thick = 430 sigma= 0.015 11 | *+ seg1 = 100 seg2 = 100 12 | + file=NONE 13 | * under the trace 14 | + contact decay_rect (0,0,0,50,2000,13,3000,500,3000) 15 | * the contacts 16 | + contact decay_rect (0,-1000,0,30,30,10,10,3000,3000) 17 | + contact decay_rect (0, 1000,0,30,30,10,10,3000,3000) 18 | + 19 | + nhinc = 3 rh=2 20 | * nodes to reference later: 21 | + np1 (0,-1000,0) 22 | + np2 (0,1000,0) 23 | * 24 | * line width=26um 25 | * thick h=1um sigma=2.6e7 1/(m*ohm)=26 1/(um*ohm) 26 | * 27 | NS1 x=0 y=-1000 z=223.5 28 | NS2 x=0 y=1000 z=223.5 29 | EM5 NS1 NS2 w=26 h=1 sigma=26 nwinc=4 nhinc=1 30 | .equiv NS2 np2 31 | .external NS1 np1 32 | * 33 | .freq fmin=3.3e8 fmax=3.3e8 ndec=1 34 | .end 35 | -------------------------------------------------------------------------------- /examples/3d_example2_coarse.inp: -------------------------------------------------------------------------------- 1 | * a M5 line (26um wide, 1um thick) over Si substrate 8um below, sigma=2.6e7 2 | * 430um thick substrate, sigma=1.5e4 1/(ohm*m) 3 | * line length=1000um 4 | .units uM 5 | * 6 | * Define substrate, sigma=1.5e4 1/(m*ohm)= 0.015 1/(um*ohm) 7 | g1 x1 = -1500 y1 = -1500 z1 = 0 8 | + x2 = 1500 y2 = -1500 z2 = 0 9 | + x3 = 1500 y3 = 1500 z3 = 0 10 | + thick = 430 sigma= 0.015 11 | *+ seg1 = 100 seg2 = 100 12 | + file=NONE 13 | * under the trace 14 | + contact decay_rect (0,0,0,50,2000,30,3000,500,3000) 15 | * the contacts 16 | + contact decay_rect (0,-1000,0,30,30,20,20,3000,3000) 17 | + contact decay_rect (0, 1000,0,30,30,20,20,3000,3000) 18 | + 19 | + nhinc = 3 rh=2 20 | * nodes to reference later: 21 | + np1 (0,-1000,0) 22 | + np2 (0,1000,0) 23 | * 24 | * line width=26um 25 | * thick h=1um sigma=2.6e7 1/(m*ohm)=26 1/(um*ohm) 26 | * 27 | NS1 x=0 y=-1000 z=223.5 28 | NS2 x=0 y=1000 z=223.5 29 | EM5 NS1 NS2 w=26 h=1 sigma=26 nwinc=4 nhinc=1 30 | .equiv NS2 np2 31 | .external NS1 np1 32 | * 33 | .freq fmin=0 fmax=3.3e8 ndec=1 34 | .end 35 | -------------------------------------------------------------------------------- /examples/Zc_3d_examp2.mat: -------------------------------------------------------------------------------- 1 | Row 1: ns1 to np1 2 | Impedance matrix for frequency = 3.3e+08 1 x 1 3 | 3.75027 +3.16843j 4 | -------------------------------------------------------------------------------- /examples/broken.inp: -------------------------------------------------------------------------------- 1 | *Broken plane with two traces above it 2 | * This is the example presented at DAC '93 3 | * 4 | .units mils 5 | .default nwinc=1 nhinc=1 h=1 w=8 6 | *****.default sigma=1.49e3 7 | .default z=8 8 | * 9 | *ground plane definition 10 | * 11 | g_one x1=-1000 y1=-500 z1=0.0 12 | + x2=-50 y2=-500 z2=0 13 | + x3=-50 y3=500 z3=0 14 | + thick=1 seg1=10 seg2=10 15 | + nhinc=1 16 | + nAin (-500,16,0) 17 | + nBin (-500,-16,0) 18 | + n1bridge (-50,400,0) 19 | + n2bridge (-50,-400,0) 20 | * 21 | 22 | g_two x1=1000 y1=-500 z1=0.0 23 | + x2=50 y2=-500 z2=0 24 | + x3=50 y3=500 z3=0 25 | + thick=1 seg1=10 seg2=10 26 | + nhinc=1 27 | + nAout (500,16,0) 28 | + nBout (500,-16,0) 29 | + n3bridge (50,400,0) 30 | + n4bridge (50,-400,0) 31 | * 32 | 33 | nA1 x=-500 y=16 34 | nA2 x=500 y=16 35 | EA1 nA1 nA2 36 | 37 | nB1 x=-500 y=-16 38 | nB2 x=500 y=-16 39 | EB1 nB1 nB2 40 | 41 | n1br x=-50 y=400 z=0 42 | n2br x=-50 y=-400 z=0 43 | n3br x=50 y=400 z=0 44 | n4br x=50 y=-400 z=0 45 | 46 | .equiv n1br n1bridge 47 | .equiv n2br n2bridge 48 | .equiv n3br n3bridge 49 | .equiv n4br n4bridge 50 | 51 | E1bridge n1br n3br 52 | E2bridge n2br n4br 53 | 54 | * 3 loops 55 | .external nA1 nAin trace1 56 | .equiv nA2 nAout 57 | .external nB1 nBin trace2 58 | .equiv nB2 nBout 59 | 60 | .freq fmin=1e-1 fmax=1e19 ndec=0.05 61 | .end 62 | -------------------------------------------------------------------------------- /examples/hole.inp: -------------------------------------------------------------------------------- 1 | *This is the input deck to calculate effective inductance 2 | *This plane has a dimension of 0.025 X 0.025 3 | *There is 1 injection point and 1 sink point 4 | * There is a hole in the center of radius 0.0051m 5 | * Also included (but commented out) are rectangular holes 6 | * 7 | .units meters 8 | * 9 | *ground plane definition 10 | * 11 | g1 x1=0 y1=0 z1=0.0 12 | + x2=0.025 y2=0 z2=0 13 | + x3=0.025 y3=0.025 z3=0 14 | + thick=0.001 seg1=20 seg2=20 15 | + sigma=5.8e+07 nhinc=1 16 | + nin1 (0.0025,0.01) 17 | + nout1 (0.0225,0.0150) 18 | + hole circle (0.0125,0.0125,0,0.0051) 19 | *+ hole rect (0.01,0.005,0,0.015,0.02,0) 20 | *+ hole rect (0.0075,0.02,0,0.015,0.02,0) 21 | * 22 | .equiv ninput nin1 23 | .equiv noutput nout1 24 | .external ninput noutput 25 | * 26 | * 27 | .freq fmin=2e6 fmax=2e6 ndec=0.2 28 | .end 29 | -------------------------------------------------------------------------------- /examples/holey_gp.inp: -------------------------------------------------------------------------------- 1 | * A FastHenry example using a reference plane 2 | * This example defines an L shaped trace above a ground plane 3 | * with many holes. This is nearly the same as simple_gp.inp plus the holes. 4 | 5 | * Set the units for all following dimensions 6 | .units mils 7 | * 8 | * Define ground plane and nodes to reference later 9 | * 10 | * First define 3 corners of the plane, in clockwise or counter-cw order 11 | g1 x1 = 0 y1 = 0 z1 = 0 12 | + x2 = 1000 y2 = 0 z2 = 0 13 | + x3 = 1000 y3 = 1000 z3 = 0 14 | * thickness: 15 | + thick = 1.2 16 | * discretization: 17 | + seg1 = 51 seg2 = 51 18 | * nodes to reference later: 19 | + nin (900,920,0) 20 | + nout (0,200,0) 21 | + hole rect (100,100,0,300,300,0) 22 | + hole rect (400,100,0,600,300,0) 23 | + hole rect (700,100,0,900,300,0) 24 | + 25 | + hole rect (100,400,0,300,600,0) 26 | + hole circle (500,500,0,110) 27 | + hole rect (700,400,0,900,600,0) 28 | + 29 | + hole rect (100,700,0,300,900,0) 30 | + hole rect (400,700,0,600,900,0) 31 | + hole rect (700,700,0,900,900,0) 32 | + 33 | * rectangular hole that overlaps circular hole 34 | + hole rect (480,200,0,520,800,0) 35 | 36 | * Some defaults to model skin effects 37 | .default nwinc=8 rw=1 38 | * 39 | * L shaped trace over ground plane 40 | * 41 | * The nodes 42 | N1 x=0 y=200 z=1.5 43 | N2 x=900 y=200 z=1.5 44 | N3 x=900 y=920 z=1.5 45 | 46 | * The elements connecting the nodes 47 | E1 N1 N2 w=8 h=1 48 | E2 N2 N3 w=8 h=1 49 | 50 | * Short together the end of the L shaped trace (N3) and its corresponding 51 | * point on the ground plane directly beneath (nin) 52 | .equiv nin n3 53 | 54 | * compute loop inductance from beginning of L (N1) to its corresponding 55 | * point directly underneath (nout) 56 | .external N1 nout 57 | 58 | * Do it for one very low frequency (essentially DC) and one very high frequency 59 | .freq fmin=1e-1 fmax=1e19 ndec=0.05 60 | 61 | * mark end of file 62 | .end 63 | 64 | 65 | -------------------------------------------------------------------------------- /examples/make_nonuniform.c: -------------------------------------------------------------------------------- 1 | /* Produces a fasthenry input file of filaments on a UNIFORM 2 | plane discretization */ 3 | 4 | #include 5 | #include 6 | 7 | FILE *f_uni, *f_nonuni; 8 | char *MattAlloc(); 9 | 10 | main(argc, argv) 11 | int argc; 12 | char *argv[]; 13 | { 14 | int i,j; 15 | double min_len, x_len, y_len, thickness, z, x_cur; 16 | double *y, *x_horiz, *x_vert; 17 | double *vert_width; 18 | double horiz_len, horiz_width; 19 | double extra_x, extra_y; 20 | double r0, ratio; 21 | int numequiv; 22 | 23 | x_len = 21; 24 | y_len = 21; 25 | thickness = 0.01; 26 | z = 0; 27 | r0 = 0.05; 28 | ratio = 1.0/3.0; 29 | 30 | if (sscanf(argv[1], "%lf", &r0) != 1) { 31 | printf("need one integer argument: The radius of contacts\n"); 32 | exit(1); 33 | } 34 | 35 | numequiv = 200; 36 | 37 | /* f_nonuni = fopen("fh_nonuni.inp","w"); */ 38 | f_nonuni = stdout; 39 | 40 | fprintf(f_nonuni,"* Nonuniform test for r=%lg\n",r0); 41 | fprintf(f_nonuni,".units m\n.default sigma=5.8e7\n\n"); 42 | 43 | extra_x = (x_len - 1)/2.0; 44 | extra_y = (y_len - 1)/2.0; 45 | 46 | fprintf(f_nonuni,"g1 x1=%lg y1=%lg z1=%lg x2=%lg y2=%lg z2=%lg x3=%lg y3=%lg z3=%lg\n", 47 | -extra_x, -extra_y, z, 1 + extra_x, -extra_y, z, 1 + extra_x, 48 | 1 + extra_y, z); 49 | 50 | fprintf(f_nonuni,"+ file=NONE thick=%lg \n", 51 | thickness); 52 | fprintf(f_nonuni,"+ contact decay_rect (0,0, 0, %lg, %lg, %lg, %lg, 3, 3)\n", 53 | r0, r0, r0*ratio, r0*ratio); 54 | fprintf(f_nonuni,"+ contact decay_rect (1,1, 0, %lg, %lg, %lg, %lg, 3, 3)\n", 55 | r0, r0, r0*ratio, r0*ratio); 56 | 57 | 58 | /* equiv points in a circle */ 59 | for(i = 0; i < numequiv; i++) { 60 | fprintf(f_nonuni,"+ n_in_%d (%lg,%lg,%lg)\n",i, r0*cos(i*2*M_PI/numequiv), 61 | r0*sin(i*2*M_PI/numequiv),z); 62 | fprintf(f_nonuni,"+ n_out_%d (%lg,%lg,%lg)\n", 63 | i, 1 + r0*cos(i*2*M_PI/numequiv), 64 | 1 + r0*sin(i*2*M_PI/numequiv),z); 65 | } 66 | 67 | fprintf(f_nonuni,"\n.equiv n_in "); 68 | for(i = 0; i < numequiv; i++) { 69 | fprintf(f_nonuni, "n_in_%d ",i); 70 | if (i%10 == 0) 71 | fprintf(f_nonuni, "\n+ "); 72 | } 73 | 74 | fprintf(f_nonuni,"\n.equiv n_out "); 75 | for(i = 0; i < numequiv; i++) { 76 | fprintf(f_nonuni, "n_out_%d ",i); 77 | if (i%10 == 0) 78 | fprintf(f_nonuni, "\n+ "); 79 | } 80 | 81 | 82 | fprintf(f_nonuni,"\n\n"); 83 | fprintf(f_nonuni,".external n_in n_out\n"); 84 | 85 | fprintf(f_nonuni,".freq fmin=0 fmax=1e9 ndec=1\n"); 86 | fprintf(f_nonuni,".end\n"); 87 | 88 | fclose(f_nonuni); 89 | } 90 | 91 | double **MatrixAlloc(rows, cols, size) 92 | int rows, cols, size; 93 | { 94 | 95 | double **temp; 96 | int i; 97 | 98 | temp = (double **)MattAlloc(rows,sizeof(double *)); 99 | if (temp == NULL) { 100 | printf("not enough space for matrix allocation\n"); 101 | exit(1); 102 | } 103 | 104 | for(i = 0; i < rows; i++) 105 | temp[i] = (double *)MattAlloc(cols,size); 106 | 107 | if (temp[rows - 1] == NULL) { 108 | printf("not enough space for matrix allocation\n"); 109 | exit(1); 110 | } 111 | return(temp); 112 | } 113 | 114 | char* MattAlloc(number, size) 115 | int number, size; 116 | { 117 | 118 | char *blah; 119 | 120 | blah = (char *)malloc(number*size); 121 | 122 | if (blah == NULL) { 123 | fprintf(stderr, "MattAlloc: Couldn't get space. Needed %d\n",number*size); 124 | exit(1); 125 | } 126 | 127 | return blah; 128 | } 129 | -------------------------------------------------------------------------------- /examples/nonuni01.inp: -------------------------------------------------------------------------------- 1 | * Nonuniform test for r=0.01 2 | .units m 3 | .default sigma=5.8e7 4 | 5 | g1 x1=-10 y1=-10 z1=0 x2=11 y2=-10 z2=0 x3=11 y3=11 z3=0 6 | + file=NONE thick=0.01 7 | *+ contact decay_rect (0,0, 0, 0.03, 0.03, 0.01, 0.01, 3, 3) 8 | *+ contact decay_rect (1,1, 0, 0.03, 0.03, 0.01, 0.01, 3, 3) 9 | + contact decay_rect (0,0,0,0.025, 0.025,0.001,0.001,3,3) 10 | + contact decay_rect (1,1,0,0.025, 0.025,0.001,0.001,3,3) 11 | + n_in_0 (0.01,0,0) 12 | + n_out_0 (1.01,1,0) 13 | + n_in_1 (0.00987688,0.00156434,0) 14 | + n_out_1 (1.00988,1.00156,0) 15 | + n_in_2 (0.00951057,0.00309017,0) 16 | + n_out_2 (1.00951,1.00309,0) 17 | + n_in_3 (0.00891007,0.0045399,0) 18 | + n_out_3 (1.00891,1.00454,0) 19 | + n_in_4 (0.00809017,0.00587785,0) 20 | + n_out_4 (1.00809,1.00588,0) 21 | + n_in_5 (0.00707107,0.00707107,0) 22 | + n_out_5 (1.00707,1.00707,0) 23 | + n_in_6 (0.00587785,0.00809017,0) 24 | + n_out_6 (1.00588,1.00809,0) 25 | + n_in_7 (0.0045399,0.00891007,0) 26 | + n_out_7 (1.00454,1.00891,0) 27 | + n_in_8 (0.00309017,0.00951057,0) 28 | + n_out_8 (1.00309,1.00951,0) 29 | + n_in_9 (0.00156434,0.00987688,0) 30 | + n_out_9 (1.00156,1.00988,0) 31 | + n_in_10 (6.12323e-19,0.01,0) 32 | + n_out_10 (1,1.01,0) 33 | + n_in_11 (-0.00156434,0.00987688,0) 34 | + n_out_11 (0.998436,1.00988,0) 35 | + n_in_12 (-0.00309017,0.00951057,0) 36 | + n_out_12 (0.99691,1.00951,0) 37 | + n_in_13 (-0.0045399,0.00891007,0) 38 | + n_out_13 (0.99546,1.00891,0) 39 | + n_in_14 (-0.00587785,0.00809017,0) 40 | + n_out_14 (0.994122,1.00809,0) 41 | + n_in_15 (-0.00707107,0.00707107,0) 42 | + n_out_15 (0.992929,1.00707,0) 43 | + n_in_16 (-0.00809017,0.00587785,0) 44 | + n_out_16 (0.99191,1.00588,0) 45 | + n_in_17 (-0.00891007,0.0045399,0) 46 | + n_out_17 (0.99109,1.00454,0) 47 | + n_in_18 (-0.00951057,0.00309017,0) 48 | + n_out_18 (0.990489,1.00309,0) 49 | + n_in_19 (-0.00987688,0.00156434,0) 50 | + n_out_19 (0.990123,1.00156,0) 51 | + n_in_20 (-0.01,1.22465e-18,0) 52 | + n_out_20 (0.99,1,0) 53 | + n_in_21 (-0.00987688,-0.00156434,0) 54 | + n_out_21 (0.990123,0.998436,0) 55 | + n_in_22 (-0.00951057,-0.00309017,0) 56 | + n_out_22 (0.990489,0.99691,0) 57 | + n_in_23 (-0.00891007,-0.0045399,0) 58 | + n_out_23 (0.99109,0.99546,0) 59 | + n_in_24 (-0.00809017,-0.00587785,0) 60 | + n_out_24 (0.99191,0.994122,0) 61 | + n_in_25 (-0.00707107,-0.00707107,0) 62 | + n_out_25 (0.992929,0.992929,0) 63 | + n_in_26 (-0.00587785,-0.00809017,0) 64 | + n_out_26 (0.994122,0.99191,0) 65 | + n_in_27 (-0.0045399,-0.00891007,0) 66 | + n_out_27 (0.99546,0.99109,0) 67 | + n_in_28 (-0.00309017,-0.00951057,0) 68 | + n_out_28 (0.99691,0.990489,0) 69 | + n_in_29 (-0.00156434,-0.00987688,0) 70 | + n_out_29 (0.998436,0.990123,0) 71 | + n_in_30 (-1.83697e-18,-0.01,0) 72 | + n_out_30 (1,0.99,0) 73 | + n_in_31 (0.00156434,-0.00987688,0) 74 | + n_out_31 (1.00156,0.990123,0) 75 | + n_in_32 (0.00309017,-0.00951057,0) 76 | + n_out_32 (1.00309,0.990489,0) 77 | + n_in_33 (0.0045399,-0.00891007,0) 78 | + n_out_33 (1.00454,0.99109,0) 79 | + n_in_34 (0.00587785,-0.00809017,0) 80 | + n_out_34 (1.00588,0.99191,0) 81 | + n_in_35 (0.00707107,-0.00707107,0) 82 | + n_out_35 (1.00707,0.992929,0) 83 | + n_in_36 (0.00809017,-0.00587785,0) 84 | + n_out_36 (1.00809,0.994122,0) 85 | + n_in_37 (0.00891007,-0.0045399,0) 86 | + n_out_37 (1.00891,0.99546,0) 87 | + n_in_38 (0.00951057,-0.00309017,0) 88 | + n_out_38 (1.00951,0.99691,0) 89 | + n_in_39 (0.00987688,-0.00156434,0) 90 | + n_out_39 (1.00988,0.998436,0) 91 | 92 | .equiv n_in n_in_0 n_in_1 n_in_2 n_in_3 n_in_4 n_in_5 n_in_6 n_in_7 n_in_8 n_in_9 n_in_10 n_in_11 n_in_12 n_in_13 n_in_14 n_in_15 n_in_16 n_in_17 n_in_18 n_in_19 n_in_20 n_in_21 n_in_22 n_in_23 n_in_24 n_in_25 n_in_26 n_in_27 n_in_28 n_in_29 n_in_30 n_in_31 n_in_32 n_in_33 n_in_34 n_in_35 n_in_36 n_in_37 n_in_38 n_in_39 93 | .equiv n_out n_out_0 n_out_1 n_out_2 n_out_3 n_out_4 n_out_5 n_out_6 n_out_7 n_out_8 n_out_9 n_out_10 n_out_11 n_out_12 n_out_13 n_out_14 n_out_15 n_out_16 n_out_17 n_out_18 n_out_19 n_out_20 n_out_21 n_out_22 n_out_23 n_out_24 n_out_25 n_out_26 n_out_27 n_out_28 n_out_29 n_out_30 n_out_31 n_out_32 n_out_33 n_out_34 n_out_35 n_out_36 n_out_37 n_out_38 n_out_39 94 | 95 | .external n_in n_out 96 | .freq fmin=0 fmax=1e9 ndec=1 97 | .end 98 | -------------------------------------------------------------------------------- /examples/onebargp.inp: -------------------------------------------------------------------------------- 1 | * Ground plane with a bar over it. The return path for the bar is through the 2 | * ground plane. 3 | * 4 | .units meters 5 | .default sigma = 3.5e7 6 | .default nhinc =2 7 | .default nwinc =2 8 | * 9 | * ground plane 10 | * 11 | g1 x1=0 y1=0 z1=0 x2=0.1 y2=0 z2=0 x3=0.1 y3=0.1 z3=0 thick=0.001 seg1=17 seg2=17 12 | + nodein (0.045,0.01) 13 | + nodeout (0.045,0.08) 14 | + nBin (0.075,0.07) 15 | + nBout (0,0,0) 16 | * 17 | * bar 18 | * 19 | NB1 x=0.035 y=0.03 z=0.002 20 | NB2 x=0.065 y=0.05 z=0.002 21 | NB3 x=0.080 y=0.06 z=0.002 22 | eBseg1 NB1 NB2 w=0.002 h=0.001 23 | eBseg2 NB2 NB3 w=0.002 h=0.001 24 | * 25 | .equiv nBin Nb3 26 | .external NB1 NBout 27 | .external nodein nodeout 28 | * 29 | * 30 | .freq fmin=1e2 fmax=1e10 ndec=0.125 31 | .end 32 | -------------------------------------------------------------------------------- /examples/pin-con2seg.inp: -------------------------------------------------------------------------------- 1 | ***Two segments from: PACKAGE INDUCTANCE - 35 of 68 pins*** 2 | * For experimenting with skin/proximity effect modeling 3 | * 4 | .UNITS MILS 5 | .DEFAULT RHO=.0238 6 | .DEFAULT Z=85. H=8.5 W=24. nhinc=3 nwinc=5 rh=2 rw=2 7 | * 8 | * BEAM 16 9 | * 10 | N16B Y=100. X=387.5 11 | N16C Y=100. X=493. 12 | E16C N16B N16C 13 | .EXTERNAL N16B N16C port16 14 | * 15 | * BEAM 17 16 | * 17 | N17B Y=50. X=387.5 18 | N17C Y=50. X=493. 19 | E17C N17B N17C 20 | .EXTERNAL N17B N17C port17 21 | * 22 | .freq fmin=1e1 fmax=1e12 ndec=3 23 | 24 | .END 25 | 26 | -------------------------------------------------------------------------------- /examples/pin-con7.inp: -------------------------------------------------------------------------------- 1 | ***PACKAGE INDUCTANCE - 35 of 68 pins*** 2 | * 3 | .UNITS MILS 4 | .DEFAULT RHO=.0238 5 | .DEFAULT Z=85. H=8.5 W=24. nhinc=3 nwinc=7 6 | * 7 | * BEAM 15 8 | * 9 | N15END1 Y=60. X=154.5 10 | N15A Y=60. X=300. 11 | N15B Y=150. X=397.5 12 | N15C Y=150. X=493. 13 | N15D Y=150. X=509. Z=0. 14 | N15END2 Y=150. X=551. Z=0. 15 | E15A N15END1 N15A W=12. 16 | E15B N15A N15B W=16. 17 | E15C N15B N15C 18 | E15D N15C N15D 19 | E15E N15D N15END2 20 | .EXTERNAL N15END1 N15END2 21 | * 22 | * BEAM 16 23 | * 24 | N16END1 Y=40. X=154.5 25 | N16A Y=40. X=325. 26 | N16B Y=100. X=392.5 27 | N16C Y=100. X=493. 28 | N16D Y=100. X=509. Z=0. 29 | N16END2 Y=100. X=551. Z=0. 30 | E16A N16END1 N16A W=12. 31 | E16B N16A N16B W=16. 32 | E16C N16B N16C 33 | E16D N16C N16D 34 | E16E N16D N16END2 35 | .EXTERNAL N16END1 N16END2 36 | * 37 | * BEAM 17 38 | * 39 | N17END1 Y=20. X=154.5 40 | N17A Y=20. X=350. 41 | N17B Y=50. X=387.5 42 | N17C Y=50. X=493. 43 | N17D Y=50. X=509. Z=0. 44 | N17END2 Y=50. X=551. Z=0. 45 | E17A N17END1 N17A W=12. 46 | E17B N17A N17B W=16. 47 | E17C N17B N17C 48 | E17D N17C N17D 49 | E17E N17D N17END2 50 | .EXTERNAL N17END1 N17END2 51 | * 52 | * BEAM 18 53 | * 54 | N18END1 Y=0. X=154.5 55 | N18A Y=0. X=375. 56 | N18B Y=0. X=380. 57 | N18C Y=0. X=493. 58 | N18D Y=0. X=509. Z=0. 59 | N18END2 Y=0. X=551. Z=0. 60 | E18A N18END1 N18A W=12. 61 | E18B N18A N18B W=16. 62 | E18C N18B N18C 63 | E18D N18C N18D 64 | E18E N18D N18END2 65 | .EXTERNAL N18END1 N18END2 66 | * 67 | * BEAM 19 68 | * 69 | N19END1 Y=-20. X=154.5 70 | N19A Y=-20. X=350. 71 | N19B Y=-50. X=387.5 72 | N19C Y=-50. X=493. 73 | N19D Y=-50. X=509. Z=0. 74 | N19END2 Y=-50. X=551. Z=0. 75 | E19A N19END1 N19A W=12. 76 | E19B N19A N19B W=16. 77 | E19C N19B N19C 78 | E19D N19C N19D 79 | E19E N19D N19END2 80 | .EXTERNAL N19END1 N19END2 81 | * 82 | * BEAM 20 83 | * 84 | N20END1 Y=-40. X=154.5 85 | N20A Y=-40. X=325. 86 | N20B Y=-100. X=392.5 87 | N20C Y=-100. X=493. 88 | N20D Y=-100. X=509. Z=0. 89 | N20END2 Y=-100. X=551. Z=0. 90 | E20A N20END1 N20A W=12. 91 | E20B N20A N20B W=16. 92 | E20C N20B N20C 93 | E20D N20C N20D 94 | E20E N20D N20END2 95 | .EXTERNAL N20END1 N20END2 96 | * 97 | * BEAM 21 98 | * 99 | N21END1 Y=-60. X=154.5 100 | N21A Y=-60. X=300. 101 | N21B Y=-150. X=397.5 102 | N21C Y=-150. X=493. 103 | N21D Y=-150. X=509. Z=0. 104 | N21END2 Y=-150. X=551. Z=0. 105 | E21A N21END1 N21A W=12. 106 | E21B N21A N21B W=16. 107 | E21C N21B N21C 108 | E21D N21C N21D 109 | E21E N21D N21END2 110 | .EXTERNAL N21END1 N21END2 111 | * 112 | *.freq fmin=1e0 fmax=1e12 ndec=3 113 | .freq fmin=1e0 fmax=1e12 ndec=1 114 | 115 | .END 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /examples/plane.in: -------------------------------------------------------------------------------- 1 | * a line (5um wide) over a plane 100um below 2 | * line length=4000um 3 | * 4 | * Since the line is so long, and the discretization doesn't vary along 5 | * the line, this is almost a 2D problem by discretization. But to 6 | * make it truly 2D, the nodes on the ends of the plane must be 7 | * shorted together so no current flows perpendicular to the 8 | * trace direction. That is the purpose of all the "np" node definitions. 9 | * Actually, the line is long enough that we match 2D without shorting them 10 | * together, but if you really wanted to test against 2D, follow the 11 | * instructions at the .equiv lines below. 12 | * 13 | * R/cm = 15 ohm / 0.4 cm = 37.5 Ohm/cm 14 | * L/cm = 14.8 / (2*pi*6e8) / 0.4 cm = 9.81 nH/cm 15 | * 16 | * 17 | .units uM 18 | * 19 | * Define ground plane, sigma=3.15e7 1/(m*ohm)= 31.5 1/(um*ohm) 20 | g1 x1 = -500 y1 = 0 z1 = 0 21 | + x2 = 500 y2 = 0 z2 = 0 22 | + x3 = 500 y3 = 4000 z3 = 0 23 | + thick = 11 sigma= 31.5 24 | *+ seg1 = 20 seg2 = 1 25 | + nhinc = 3 rh=2 26 | * nodes to reference later: 27 | + np1 (0,0,0) 28 | + np2 (0,4000,0) 29 | + np25 (50,4000,0) 30 | + np3 (100,4000,0) 31 | + np35 (150,4000,0) 32 | + np4 (200,4000,0) 33 | + np45 (250,4000,0) 34 | + np5 (300,4000,0) 35 | + np55 (350,4000,0) 36 | + np56 (400,4000,0) 37 | + np57 (450,4000,0) 38 | + np58 (500,4000,0) 39 | + np51 (-50,4000,0) 40 | + np6 (-100,4000,0) 41 | + np65 (-150,4000,0) 42 | + np7 (-200,4000,0) 43 | + np75 (-250,4000,0) 44 | + np8 (-300,4000,0) 45 | + np85 (-350,4000,0) 46 | + np86 (-400,4000,0) 47 | + np87 (-450,4000,0) 48 | + np88 (-500,4000,0) 49 | + np05 (50,0,0) 50 | + np10 (100,0,0) 51 | + np105 (150,0,0) 52 | + np11 (200,0,0) 53 | + np115 (250,0,0) 54 | + np12 (300,0,0) 55 | + np121 (350,0,0) 56 | + np122 (400,0,0) 57 | + np123 (450,0,0) 58 | + np124 (500,0,0) 59 | + np125 (-50,0,0) 60 | + np13 (-100,0,0) 61 | + np135 (-150,0,0) 62 | + np14 (-200,0,0) 63 | + np145 (-250,0,0) 64 | + np15 (-300,0,0) 65 | + np151 (-350,0,0) 66 | + np152 (-400,0,0) 67 | + np153 (-450,0,0) 68 | + np154 (-500,0,0) 69 | +file=NONE 70 | + contact line (-1,0,0,0,4000,-1,2.5,500) 71 | + contact line (1,0,0,0,4000,1,2.5,500) 72 | * 73 | * line width=5um 74 | * thick h=1.7um sigma=3.15e7 1/(m*ohm)=31.5 1/(um*ohm) 75 | * 76 | NS1 x=0 y=0 z=106.35 77 | NS2 x=0 y=4000 z=106.35 78 | ES NS1 NS2 w=5 h=1.7 sigma=31.5 79 | +nwinc=3 nhinc=1 80 | 81 | .equiv NS2 np2 82 | * 83 | * To make this truly 2D, comment out the above line and uncomment the 84 | * following lines up to (but not including) the .external below. 85 | * 86 | *.equiv NS2 np2 np25 np3 np35 np4 np45 np5 np55 np56 np57 np58 np51 np6 np65 np7 np75 np8 np85 np86 np87 np88 87 | *.equiv 88 | *+np1 np05 89 | *+np10 90 | *+np105 np11 np115 np12 91 | *+np121 np122 np123 np124 92 | *+np125 93 | *+np13 np135 np14 np145 np15 np151 np152 np153 np154 94 | 95 | .external NS1 np1 96 | * 97 | .freq fmin=6e8 fmax=6e8 ndec=1 98 | .end 99 | 100 | -------------------------------------------------------------------------------- /examples/rom_check_con7_r20.ckt: -------------------------------------------------------------------------------- 1 | Simple ROM example. Two inductors with mutual inductance connected in series. 2 | 3 | * ports are p0 m0 p1 m1... 4 | .include equiv_circuitROM_pin_con7_r20.spice 5 | 6 | * and instance of the state space mode 7 | Xstate p0 m0 p1 m1 p2 m2 p3 m3 p4 m4 p5 m5 p6 m6 ROMequiv_pin_con7_r20 8 | 9 | * connect m0 to ground 10 | vgnd0 m0 0 11 | vgnd1 m1 0 12 | vgnd2 m2 0 13 | vgnd3 m3 0 14 | vgnd4 m4 0 15 | vgnd5 m5 0 16 | vgnd6 m6 0 17 | 18 | isrc0 0 p0 ac 1 19 | isrc1 0 p1 ac 0 20 | isrc2 0 p2 ac 0 21 | isrc3 0 p3 ac 0 22 | isrc4 0 p4 ac 0 23 | isrc5 0 p5 ac 0 24 | isrc6 0 p6 ac 0 25 | 26 | *.tran 1ns 2us UIC 27 | .ac dec 5 1 1e12 28 | .options method=gear 29 | .print ac v(p0) v(p1) v(p2) v(p3) v(p4) v(p5) v(p6) 30 | 31 | 32 | -------------------------------------------------------------------------------- /examples/simple_gp.inp: -------------------------------------------------------------------------------- 1 | * A FastHenry example using a reference plane 2 | * This example defines an L shaped trace above a ground plane which 3 | * has a return path through the plane 4 | 5 | * Set the units for all following dimensions 6 | .units mils 7 | * 8 | * Define ground plane and nodes to reference later 9 | * 10 | * First define 3 corners of the plane, in clockwise or counter-cw order 11 | g1 x1 = 0 y1 = 0 z1 = 0 12 | + x2 = 1000 y2 = 0 z2 = 0 13 | + x3 = 1000 y3 = 1000 z3 = 0 14 | * thickness: 15 | + thick = 1.2 16 | * discretization: 17 | + seg1 = 20 seg2 = 20 18 | * nodes to reference later: 19 | + nin (800,800,0) 20 | + nout (0,200,0) 21 | 22 | * Some defaults to model skin effects 23 | .default nwinc=8 nhinc=1 24 | * 25 | * L shaped trace over ground plane 26 | * 27 | * The nodes 28 | N1 x=0 y=200 z=1.5 29 | N2 x=800 y=200 z=1.5 30 | N3 x=800 y=800 z=1.5 31 | 32 | * The elements connecting the nodes 33 | E1 N1 N2 w=8 h=1 34 | E2 N2 N3 w=8 h=1 35 | 36 | * Short together the end of the L shaped trace (N3) and its corresponding 37 | * point on the ground plane directly beneath (nin) 38 | .equiv nin n3 39 | 40 | * compute loop inductance from beginning of L (N1) to its corresponding 41 | * point directly underneath (nout) 42 | .external N1 nout 43 | 44 | * Compute impedance matrix for one very low frequency (essentially DC) 45 | * and one very high frequency 46 | .freq fmin=1e-1 fmax=1e19 ndec=0.05 47 | 48 | * mark end of file 49 | .end 50 | 51 | 52 | -------------------------------------------------------------------------------- /examples/template.inp: -------------------------------------------------------------------------------- 1 | * Template for showing autorefinement 2 | .units m 3 | .default sigma=5.8e7 4 | 5 | g1 x1=-10 y1=-10 z1=0 x2=11 y2=-10 z2=0 x3=11 y3=11 z3=0 6 | + file=NONE thick=0.01 7 | + contact decay_rect (1,1,0,0.2,0.2,0.1,0.1,20,20) 8 | *+ contact rect (1,1,0,0.5,0.5,0.1,0.1) 9 | *+ contact line (-2,-2,0,5,2,0,1,1) 10 | *+ contact point (1,1,0,0.1,0.1) 11 | + n_in (0.0,0,0) 12 | + n_out (1.0,1,0) 13 | 14 | .external n_in n_out 15 | .freq fmin=0 fmax=1e9 ndec=1 16 | .end 17 | -------------------------------------------------------------------------------- /examples/together.inp: -------------------------------------------------------------------------------- 1 | *Solid plane with two traces above it 2 | * Example presented at DAC '93 (compare mutual inductances with broken.inp) 3 | * 4 | .units mils 5 | .default nwinc=1 nhinc=1 h=1 w=8 6 | *****.default sigma=1.49e3 7 | .default z=8 8 | * 9 | *ground plane definition 10 | * 11 | g1 x1=-1000 y1=-500 z1=0.0 12 | + x2=1000 y2=-500 z2=0 13 | + x3=1000 y3=500 z3=0 14 | + thick=1 seg1=20 seg2=10 15 | + nhinc=1 16 | + nAin (-500,16,0) 17 | + nBin (-500,-16,0) 18 | + nAout (500,16,0) 19 | + nBout (500,-16,0) 20 | * 21 | 22 | nA1 x=-500 y=16 23 | nA2 x=500 y=16 24 | EA1 nA1 nA2 25 | 26 | nB1 x=-500 y=-16 27 | nB2 x=500 y=-16 28 | EB1 nB1 nB2 29 | 30 | * 3 loops 31 | .external nA1 nAin trace1 32 | .equiv nA2 nAout 33 | .external nB1 nBin trace2 34 | .equiv nB2 nBout 35 | 36 | .freq fmin=1e-1 fmax=1e19 ndec=0.05 37 | .end 38 | 39 | 40 | -------------------------------------------------------------------------------- /examples/together_nonuni.inp: -------------------------------------------------------------------------------- 1 | * This is together.inp changed to use nonuni gp discretization 2 | * 3 | *Solid plane with two traces above it 4 | * Example presented at DAC '93 (compare mutual inductances with broken.inp) 5 | * 6 | .units mils 7 | .default nwinc=1 nhinc=1 h=1 w=8 8 | *****.default sigma=1.49e3 9 | .default z=8 10 | * 11 | *ground plane definition 12 | * 13 | g1 x1=-1000 y1=-500 z1=0.0 14 | + x2=1000 y2=-500 z2=0 15 | + x3=1000 y3=500 z3=0 16 | + thick=1 17 | *+ seg1=20 seg2=10 18 | + file=NONE contact initial_grid (20,10) 19 | + nhinc=1 20 | + nAin (-500,16,0) 21 | + nBin (-500,-16,0) 22 | + nAout (500,16,0) 23 | + nBout (500,-16,0) 24 | * 25 | 26 | nA1 x=-500 y=16 27 | nA2 x=500 y=16 28 | EA1 nA1 nA2 29 | 30 | nB1 x=-500 y=-16 31 | nB2 x=500 y=-16 32 | EB1 nB1 nB2 33 | 34 | * 3 loops 35 | .external nA1 nAin trace1 36 | .equiv nA2 nAout 37 | .external nB1 nBin trace2 38 | .equiv nB2 nBout 39 | 40 | .freq fmin=1e-1 fmax=1e19 ndec=0.05 41 | .end 42 | 43 | 44 | -------------------------------------------------------------------------------- /examples/trace.test.release: -------------------------------------------------------------------------------- 1 | Comparisons for using the "contact trace" utility 2 | 3 | This gives results verifying the "contact trace" and "contact connection" 4 | utilities. 5 | 6 | We wish to use the trace and connection utilities 7 | to match known results. Particularly, we want to see if defining a diagonal 8 | trace maintains the good results. 9 | 10 | Each section below gives the modifications to the original input file 11 | given at the bottom of this document. 12 | 13 | A. using decay_rect for everything (as in Summer96/comparision/3d_example2.inp) 14 | (4884 elements, 135 sec (level 5) on alpha/ocelot)) 15 | Row 1: ns1 to np1 16 | Impedance matrix for frequency = 3.3e+08 1 x 1 17 | 3.75027 +3.16843j 18 | 19 | B. Using the trace utility for the trace: 20 | (3690 elements, 242 secs (level 4) on Alpha) 21 | 22 | *+ contact decay_rect (0,0,0,50,2000,13,3000,500,3000) 23 | + contact trace (0,-1000,0,0,1000,0,26,1) 24 | 25 | Row 1: ns1 to np1 26 | Impedance matrix for frequency = 3.3e+08 1 x 1 27 | 3.74841 +3.16417j 28 | 29 | C. Using the connection utility also: 30 | (2604 elements, 76 seconds) 31 | *+ contact decay_rect (0,-1000,0,30,30,10,10,3000,3000) 32 | *+ contact decay_rect (0, 1000,0,30,30,10,10,3000,3000) 33 | + contact connection np1 (0,-1000,0,30,30,2.5) 34 | + contact connection np2 (0, 1000,0,30,30,2.5) 35 | *+ np1 (0,-1000,0) 36 | *+ np2 (0,1000,0) 37 | 38 | Row 1: ns1 to np1 39 | Impedance matrix for frequency = 3.3e+08 1 x 1 40 | 3.63203 +3.16448j 41 | 42 | Resistance has dropped as expected since we are now forcing all 43 | nodes under the connection to be at the same potential. 44 | 45 | D. More accurately trying to capture contact: 46 | 3714 elements, level 4, 244 secs 47 | 48 | + contact connection np1 (0,-1000,0,26,26,3) 49 | + contact connection np2 (0, 1000,0,26,26,3) 50 | 51 | Row 1: ns1 to np1 52 | Impedance matrix for frequency = 3.3e+08 1 x 1 53 | 3.62884 +3.16465j 54 | 55 | 56 | E. Let's try a diagonal trace of same dimension (note ratio=2.5 for this one) 57 | 9790 filaments, level 7!, 110 seconds 58 | 59 | A diagonal trace takes many more elements since we can't exploit 60 | the slow change in current along the direction of current flow 61 | since its not along the x or y axis. 62 | 63 | + contact trace (-707.1,-707.1,0,707.1,707.1,0,26,1) 64 | + contact connection np1 (-707.1,-707.1,0,26,26,2.5) 65 | + contact connection np2 (707.1, 707.1,0,26,26,2.5) 66 | 67 | NS1 x=-707.1 y=-707.1 z=223.5 68 | NS2 x=707.1 y=707.1 z=223.5 69 | 70 | Row 1: ns1 to np1 71 | Impedance matrix for frequency = 3.3e+08 1 x 1 72 | 3.64035 +3.18872j 73 | 74 | Hmm, accuracy could be because multipole went down to level 7 for some 75 | reason. 76 | 77 | F. Let;s try same as E above, but manually ask for a coarser discretization 78 | below trace at 45 degrees 79 | 80 | + contact trace (-707.1,-707.1,0,707.1,707.1,0,26,10) 81 | 82 | 2736 elements, level 4, 123 secs 83 | 84 | Row 1: ns1 to np1 85 | Impedance matrix for frequency = 3.3e+08 1 x 1 86 | 3.6437 +3.16781j 87 | 88 | Odd, quite accurate. Perhaps we are lucky. See trial H. 89 | 90 | G. Let's do E, but run it with "-l 5" to force level 5 91 | 9484 fils, 426 sec 92 | 93 | Row 1: ns1 to np1 94 | Impedance matrix for frequency = 3.3e+08 1 x 1 95 | 3.64923 +3.18364j 96 | 97 | Not much different from E 98 | 99 | H. How much can we play with the scale factor before this makes 100 | a difference (scale factor = 20) 101 | 102 | + contact trace (-707.1,-707.1,0,707.1,707.1,0,26,20) 103 | 104 | 2308 fils, 115 seconds level 4 105 | 106 | Row 1: ns1 to np1 107 | Impedance matrix for frequency = 3.3e+08 1 x 1 108 | 3.63131 +3.17088j 109 | 110 | Ok, so it's gone back up again, so it is probably luck that F was accurate. 111 | Still a surprisingly 112 | small effect, probably because Si is so resistive and 330MHz isn't 113 | that high a frequency. Let's pick a higher frequency. 33 GHz: 114 | 115 | I. do the above comparisions for f=33GHz 116 | 133 secs. 117 | 118 | .freq fmin=3.3e10 fmax=3.3e10 ndec=1 119 | 120 | I1. For trial D, with ratio=2.5 (scale = 1, trace in y direction) 121 | 2946 fils, 157 secs 122 | 123 | + contact trace (0,-1000,0,0,1000,0,26,1) 124 | + contact connection np1 (0,-1000,0,26,26,2.5) 125 | + contact connection np2 (0, 1000,0,26,26,2.5) 126 | NS1 x=0 y=-1000 z=223.5 127 | NS2 x=0 y=1000 z=223.5 128 | *NS1 x=-707.1 y=-707.1 z=223.5 129 | *NS2 x=707.1 y=707.1 z=223.5 130 | 131 | Row 1: ns1 to np1 132 | Impedance matrix for frequency = 3.3e+10 1 x 1 133 | 12.7711 +205.346j 134 | 135 | I2.Trying the above with some extra discretization along length (decay_rect) 136 | + contact decay_rect (0,0,0,26,2000,13,100,500,3000) 137 | *+ contact trace (0,-1000,0,0,1000,0,26,1) 138 | 139 | Row 1: ns1 to np1 140 | Impedance matrix for frequency = 3.3e+10 1 x 1 141 | 12.7465 +205.59j 142 | 143 | Seems to be good results. 144 | 145 | 146 | I3. Diagonal trace: For scale=20 (trial H at 33GHz, (trace diagonal)) 147 | 148 | + contact trace (-707.1,-707.1,0,707.1,707.1,0,26,20) 149 | 150 | Row 1: ns1 to np1 151 | Impedance matrix for frequency = 3.3e+10 1 x 1 152 | 11.1734 +213.896j 153 | 154 | I4.For scale=10 (trial F at 33GHz) 155 | 145 secs 156 | 157 | + contact trace (-707.1,-707.1,0,707.1,707.1,0,26,10) 158 | 159 | Row 1: ns1 to np1 160 | Impedance matrix for frequency = 3.3e+10 1 x 1 161 | 12.5388 +207.403j 162 | 163 | I5.For scale=1 (trial E) 164 | 314 sec, 60 iters, level 7 165 | 166 | + contact trace (-707.1,-707.1,0,707.1,707.1,0,26,1) 167 | 168 | Row 1: ns1 to np1 169 | Impedance matrix for frequency = 3.3e+10 1 x 1 170 | 9.77926 +217.875j 171 | 172 | 173 | ************************************************************ 174 | ** So big question: Why does the diagonal trace give better results 175 | ** when the scale factor is 10 rather than 1??? 176 | ** (compare I1 to I5 vs. I1 to I4 for f=33GHz and 177 | ** B to E vs B to F for f=330MHz) 178 | ** The higher scale factor is enlarging elements which should lead to less 179 | ** accurate results. However when 180 | ** the scale factor goes to 20, results seem to deviate again. 181 | ************************************************************ 182 | 183 | 184 | * same as Summer96/comparison/3d_example2.inp but using the "contact trace" 185 | * 186 | * a M5 line (26um wide, 1um thick) over Si substrate 8um below, sigma=2.6e7 187 | * 430um thick substrate, sigma=1.5e4 1/(ohm*m) 188 | * line length=1000um 189 | .units uM 190 | * 191 | * Define substrate, sigma=1.5e4 1/(m*ohm)= 0.015 1/(um*ohm) 192 | g1 x1 = -1500 y1 = -1500 z1 = 0 193 | + x2 = 1500 y2 = -1500 z2 = 0 194 | + x3 = 1500 y3 = 1500 z3 = 0 195 | + thick = 430 sigma= 0.015 196 | *+ seg1 = 100 seg2 = 100 197 | + file=NONE 198 | * under the trace 199 | *+ contact decay_rect (0,0,0,50,2000,13,3000,500,3000) 200 | + contact trace (0,-1000,0,0,1000,0,26,1) 201 | * the contacts 202 | + contact decay_rect (0,-1000,0,30,30,10,10,3000,3000) 203 | + contact decay_rect (0, 1000,0,30,30,10,10,3000,3000) 204 | + 205 | + nhinc = 3 rh=2 206 | * nodes to reference later: 207 | + np1 (0,-1000,0) 208 | + np2 (0,1000,0) 209 | * 210 | * line width=26um 211 | * thick h=1um sigma=2.6e7 1/(m*ohm)=26 1/(um*ohm) 212 | * 213 | NS1 x=0 y=-1000 z=223.5 214 | NS2 x=0 y=1000 z=223.5 215 | EM5 NS1 NS2 w=26 h=1 sigma=26 nwinc=4 nhinc=1 216 | .equiv NS2 np2 217 | .external NS1 np1 218 | * 219 | .freq fmin=3.3e8 fmax=3.3e8 ndec=1 220 | .end 221 | -------------------------------------------------------------------------------- /examples/trace_over_mesh_new.inp: -------------------------------------------------------------------------------- 1 | * A set of bending traces sandwiched between meshed planes 2 | * Units of microns 3 | .units um 4 | 5 | * default dimensions of traces 6 | .default w=150 h=10 7 | 8 | * do nodes on portion running along x-direction* starting x value is fixed for all the traces along x 9 | .default x = -3700 z = 86 10 | 11 | nx0start y=0 12 | 13 | .default x = -1700 z = 86 14 | nx0end y=0 15 | 16 | * we've done nodes, now make metal between them 17 | ex0 nx0start nx0end 18 | 19 | * Do something similar for traces running in y direction 20 | .default y = 1700 z = 86 21 | ny0start x=0 22 | 23 | .default y = 8800 z = 86 24 | ny0end x=0 25 | 26 | ex0 ny0start ny0end 27 | 28 | * Now do diagonal portion connecting x traces to y traces 29 | exy0 nx0end ny0start 30 | 31 | *The meshed plane on top 32 | gpower x1=-5700 y1=-2666 z1=110 x2=2800 y2=-2666 z2=110 33 | + x3=2800 y3=10834 z3=110 thick=10 file=NONE 34 | * 35 | * do contacts to plane 36 | + contact connection nx_power0_1 (-3700,0,110,30,30,2.5) 37 | + contact connection ny_power0_1 (0,8800,110,30,30,2.5) 38 | * 39 | * Define initial meshed grid 40 | + contact initial_mesh_grid (34, 54) 41 | * 42 | * refinement under the signal traces for high freq 43 | * the x-directed traces 44 | + contact trace (-3700,0,110,-1700,0,110,30,1) 45 | * the y-directed traces 46 | + contact trace (0,1700,110,0,8800,110,30,1) 47 | * the diagonal trace 48 | + contact trace (-1700,0,110,0,1700,110,30,5) 49 | 50 | 51 | *The meshed plane on bottom 52 | gground x1=-5700 y1=-2666 z1=0 x2=2800 y2=-2666 z2=0 53 | + x3=2800 y3=10834 z3=0 thick=13 file=NONE 54 | * 55 | * do contacts to plane 56 | + contact connection nx_ground0_1 (-3700,0,0,30,30,2.5) 57 | + contact connection ny_ground0_1 (0,8800,0,30,30,2.5) 58 | * 59 | * Define initial meshed grid 60 | + contact initial_mesh_grid (34, 54) 61 | * 62 | * refinement under the signal traces for high freq 63 | * the x-directed traces 64 | + contact trace (-3700,0,0,-1700,0,0,30,1) 65 | * the y-directed traces 66 | + contact trace (0,1700,0,0,8800,0,30,1) 67 | * the diagonal trace 68 | + contact trace (-1700,0,0,0,1700,0,30,5) 69 | 70 | 71 | * Define the ports 72 | * The signal traces 73 | .external nx0start ny0end signal_trace_0 74 | 75 | * The power and ground paths 76 | .external nx_power0_1 ny_power0_1 power_path_for_trace_0_and_1 77 | .external nx_ground0_1 ny_ground0_1 ground_path_for_trace_0_and_1 78 | 79 | * start at 125MHz and go up by factor of 2 (10^(0.3) ~= 2) 80 | .freq fmin=125e6 fmax=500e6 ndec=3 81 | .end 82 | -------------------------------------------------------------------------------- /examples/tree_sample.hier: -------------------------------------------------------------------------------- 1 | 43 2 | 1 B EW 2 3 3 | 2 B EW 4 5 4 | 3 B EW 6 7 5 | 4 B NS 8 9 6 | 5 B NS 10 11 7 | 6 B NS 12 13 8 | 7 B NS 14 15 9 | 8 NONE 10 | 9 B NS 16 17 11 | 10 NONE 12 | 11 B NS 18 19 13 | 12 NONE 14 | 13 B NS 20 21 15 | 14 NONE 16 | 15 B NS 22 23 17 | 16 NONE 18 | 17 NONE 19 | 18 B NS 24 25 20 | 19 NONE 21 | 20 B EW 26 27 22 | 21 NONE 23 | 22 NONE 24 | 23 NONE 25 | 24 B EW 28 29 26 | 25 B EW 30 31 27 | 26 B NS 32 33 28 | 27 B NS 34 35 29 | 28 NONE 30 | 29 NONE 31 | 30 NONE 32 | 31 B EW 36 37 33 | 32 NONE 34 | 33 B NS 38 39 35 | 34 NONE 36 | 35 NONE 37 | 36 B NS 40 41 38 | 37 B NS 42 43 39 | 38 NONE 40 | 39 NONE 41 | 40 NONE 42 | 41 NONE 43 | 42 NONE 44 | 43 NONE -------------------------------------------------------------------------------- /examples/tree_sample.inp: -------------------------------------------------------------------------------- 1 | * A fasthenry input file for a nonuniform ground plane 2 | 3 | .units m 4 | .default sigma=5.8e7 5 | 6 | g1 y1=10 z1=10 x1=10 y2=11 z2=10 x2=10 y3=11 z3=11 x3=10 7 | + relx = 10 8 | + file=tree_sample.hier 9 | + thick=0.1 10 | + nin (,10.1,10.1) 11 | + nout (,10.9,10.5) 12 | + n3 (,10.56,10.31) 13 | + n4 (,10.5,11) 14 | 15 | .external nin nout 16 | .external nin n4 17 | .external n3 nout 18 | 19 | .freq fmin=1 fmax=1e9 ndec=0.1 20 | 21 | .end 22 | -------------------------------------------------------------------------------- /examples/vias.inp: -------------------------------------------------------------------------------- 1 | * Meshed ground plane with three vias 2 | * 3 | .units m 4 | .default sigma = 3.5e7 5 | .default nhinc =2 6 | .default nwinc =2 7 | * 8 | * ground plane 9 | * 10 | g1 x1=0 y1=0 z1=0 x2=5 y2=0 z2=0 x3=5 y3=5 z3=0 thick=0.025 seg1=10 seg2=10 segwid1=0.1 segwid2=0.1 11 | + nodein (1,1) 12 | + nodeout (1,4) 13 | + nBin (1,1) 14 | + nBout (1,4) 15 | * 16 | * bar 17 | * 18 | NB1 x=1 y=1 z=0.4 19 | NB2 x=1 y=4 z=0.4 20 | eBseg1 NB1 NB2 w=0.1 h=0.025 21 | 22 | nc1 x=0.75 y=4.25 z=0.4 23 | nc2 x=0.75 y=4.25 z=-0.4 24 | nc3 x=1 y=4.5 z=-0.4 25 | nc4 x=4 y=4.5 z=-0.4 26 | 27 | ec1 nb2 nc1 w=0.1 h=0.025 28 | ec2 nc1 nc2 w=0.15 h=0.15 29 | *ec2 nc1 nc2 w=0.05 h=0.05 30 | ec3 nc2 nc3 w=0.1 h=0.025 31 | ec4 nc3 nc4 w=0.1 h=0.025 32 | ***** 33 | Nd1 x=1.5 y=1 z=0.4 34 | Nd2 x=1.5 y=3.5 z=0.4 35 | edseg1 Nd1 Nd2 w=0.1 h=0.025 36 | 37 | ne1 x=1.25 y=3.75 z=0.4 38 | ne2 x=1.25 y=3.75 z=-0.4 39 | ne3 x=1.5 y=4 z=-0.4 40 | ne4 x=4 y=4 z=-0.4 41 | 42 | ee1 nd2 ne1 w=0.1 h=0.025 43 | ee2 ne1 ne2 w=0.15 h=0.15 44 | ee3 ne2 ne3 w=0.1 h=0.025 45 | ee4 ne3 ne4 w=0.1 h=0.025 46 | ****** 47 | Nf1 x=2 y=1 z=0.4 48 | Nf2 x=2 y=3 z=0.4 49 | efseg1 Nf1 Nf2 w=0.1 h=0.025 50 | 51 | ng1 x=1.75 y=3.25 z=0.4 52 | ng2 x=1.75 y=3.25 z=-0.4 53 | ng3 x=2 y=3.5 z=-0.4 54 | ng4 x=4 y=3.5 z=-0.4 55 | 56 | eg1 nf2 ng1 w=0.1 h=0.025 57 | eg2 ng1 ng2 w=0.15 h=0.15 58 | eg3 ng2 ng3 w=0.1 h=0.025 59 | eg4 ng3 ng4 w=0.1 h=0.025 60 | 61 | .external nb1 nc4 62 | .external nd1 ne4 63 | .external nf1 ng4 64 | .external nodein nodeout 65 | * 66 | * 67 | .freq fmin=1e2 fmax=1e18 ndec=0.125 68 | .end 69 | -------------------------------------------------------------------------------- /src/fasthenry/BreakupSeg.c: -------------------------------------------------------------------------------- 1 | /* this breaks a segment that is too long, into many shorter segments */ 2 | #include "induct.h" 3 | 4 | #define DIVFACT 1 /* a factor that is always 1 except for debugging */ 5 | 6 | DivideSegs(length, charges, indsys, is_initial) 7 | double length; 8 | charge *charges; 9 | SYS *indsys; 10 | int is_initial; /* is this the initial refinement call */ 11 | { 12 | SEGMENT *seg; 13 | int warned, warn_refine; 14 | 15 | warned = warn_refine = 0; 16 | 17 | for(seg = indsys->segment; seg != NULL; seg = seg->next) { 18 | if (seg->length > length/DIVFACT) { 19 | if (indsys->opts->auto_refine == ON || is_initial == TRUE) { 20 | if (seg->type == NORMAL) 21 | BreakupSeg(seg, length/DIVFACT, charges, indsys); 22 | else if (!warned) { 23 | fprintf(stdout, "DivideSegs: Warning: tried to divide an indivisable segment.\n"); 24 | fprintf(stdout, " Segment length: %lf, maximum allowed length: %lf", 25 | seg->length, length/DIVFACT); 26 | fprintf(stdout, " The segment is probably part of a ground plane.\n"); 27 | fprintf(stdout, " If so, decrease the partitioning level by 1 or refine the ground plane\n"); 28 | warned = 1; 29 | } 30 | } 31 | else if (!warn_refine) { 32 | warn_refine = 1; 33 | if (indsys->opts->mat_vect_prod == MULTIPOLE) 34 | fprintf(stdout, "Warning: couldn't refine segments as needed because auto_refine == OFF.\n This will decrease multipole accuracy.\n"); 35 | } 36 | 37 | } 38 | } 39 | } 40 | 41 | BreakupSeg(seg, maxlength, charges, indsys) 42 | SEGMENT *seg; 43 | double maxlength; 44 | charge *charges; 45 | SYS *indsys; 46 | { 47 | double oldlength, x, y, z, dx, dy, dz; 48 | int i, j, pieces; 49 | NODES *node0, *node1, *node; 50 | SEGMENT *newseg, *lastseg, *condseg, *origsegnext; 51 | charge *chg; 52 | NODES *nodelast, *newnode; 53 | NODES *makenode(); 54 | static char name[80 + MAXDEP*3]; 55 | charge *chgend; 56 | charge *oldnext; 57 | charge *assignFil(); 58 | NPATH *apath; 59 | SPATH *condpath, *lastpath, *headpath, *condbeg, *condend; 60 | int backwards; 61 | 62 | oldlength = seg->length; 63 | pieces = seg->length/maxlength + 1; 64 | 65 | // Enrico, commented line because length 66 | // is re-calculated later, see bug fix 67 | //seg->length = seg->length/pieces; 68 | origsegnext = seg->next; 69 | 70 | node0 = seg->node[0]; 71 | node1 = seg->node[1]; 72 | 73 | dx = (node1->x - node0->x)/ pieces; 74 | dy = (node1->y - node0->y)/ pieces; 75 | dz = (node1->z - node0->z)/ pieces; 76 | 77 | nodelast = node0; 78 | sprintf(name, "%s_0",node0->name); 79 | x = nodelast->x + dx; 80 | y = nodelast->y + dy; 81 | z = nodelast->z + dz; 82 | 83 | // Enrico, bug fix 84 | // The following piece of code has a potential numerical problem. 85 | // The problem arises when 'node0', 'node1' end points coordinates 86 | // are big numbers, but the segment length is small. 87 | // In this case, breaking up the segment, the new length of the first 88 | // sub-segment was calculated 89 | // with 'seg->length = seg->length/pieces;' (see above), while the new 90 | // end points coodinates by calculating 'dx', 'dy', 'dz' (small) and 91 | // adding them to 'node0->x', 'node0->y', 'node0->z' (big). 92 | // A possible fix would be: x = node0->x + dx = 93 | // = node0->x + (node1->x - node0->x)/ pieces = (node0->x*(pieces-1) + node1->x) / pieces; 94 | // but since all new sub-segments nodes positions are calculated starting 95 | // from 'dx', 'dy', 'dz' it is more straightforward to re-calculate 96 | // the length, as it is done for all sub-segments but the first one 97 | // later on by 'makeseg()'. 98 | // Note that this bug caused the problems in 'joelself.c', see the bug 99 | // fix in 'exact_mutual()', since there the segment length was again 100 | // calculated (indirectly, as a projection) but starting from the nodes 101 | // positions and then compared with the length stored in 'seg->length' 102 | seg->length = sqrt( (node0->x - x)*(node0->x - x) 103 | + (node0->y - y)*(node0->y - y) 104 | + (node0->z - z)*(node0->z - z) ); 105 | // 106 | // end of bug fix 107 | // 108 | 109 | if (nodelast->type != NORMAL) { 110 | printf("Internal bug. nodelast->type != NORMAL\n"); 111 | exit(1); 112 | } 113 | 114 | newnode = makenode(name, indsys->num_nodes++, x, y, z, nodelast->type, NULL); 115 | newnode->next = node0->next; 116 | node0->next = newnode; 117 | 118 | remove_from_connected_segs(seg->node[1], seg, NULL); 119 | seg->node[1] = newnode; 120 | add_to_connected_segs(newnode, seg, NULL); 121 | 122 | alterFils(seg, newnode, dx, dy, dz); /* modify the segment's fils */ 123 | 124 | lastseg = seg; 125 | nodelast = newnode; 126 | chgend = seg->filaments[seg->num_fils-1].pchg; 127 | oldnext = chgend->next; 128 | for(i = 1; i < pieces; i++) { 129 | 130 | if (i != pieces - 1) { 131 | x = nodelast->x + dx; 132 | y = nodelast->y + dy; 133 | z = nodelast->z + dz; 134 | sprintf(name, "%s_%d",node0->name, i); 135 | newnode = makenode(name, indsys->num_nodes++, x, y, z, nodelast->type, 136 | NULL); 137 | newnode->next = nodelast->next; 138 | nodelast->next = newnode; 139 | 140 | if (nodelast->type != NORMAL) { 141 | printf("Internal bug. nodelast->type != NORMAL\n"); 142 | exit(1); 143 | } 144 | 145 | } 146 | else 147 | newnode = node1; 148 | 149 | sprintf(name, "%s_%d",seg->name,i); 150 | newseg = makeseg(name, nodelast, newnode, seg->height, seg->width, 151 | seg->sigma, seg->hinc, seg->winc, seg->r_height, 152 | seg->r_width, seg->widthdir, 153 | indsys->num_segs++, NORMAL, NULL); 154 | 155 | newseg->next = lastseg->next; 156 | lastseg->next = newseg; 157 | 158 | chgend = assignFil(newseg, &(indsys->num_fils), chgend); 159 | 160 | lastseg = newseg; 161 | nodelast = newnode; 162 | 163 | } /* for(i = pieces..) */ 164 | chgend->next = oldnext; 165 | 166 | } 167 | 168 | alterFils(seg, node, dx, dy, dz) 169 | SEGMENT *seg; 170 | NODES *node; 171 | double dx, dy, dz; 172 | { 173 | FILAMENT *fil; 174 | charge *chg; 175 | int i; 176 | 177 | for(i = 0; i < seg->num_fils; i++) { 178 | fil = &(seg->filaments[i]); 179 | fil->x[1] = fil->x[0] + dx; 180 | fil->y[1] = fil->y[0] + dy; 181 | fil->z[1] = fil->z[0] + dz; 182 | fil->length = seg->length; 183 | fil->lenvect[XX] = fil->x[1] - fil->x[0]; 184 | fil->lenvect[YY] = fil->y[1] - fil->y[0]; 185 | fil->lenvect[ZZ] = fil->z[1] - fil->z[0]; 186 | chg = fil->pchg; 187 | chg->max_diag = chg->min_diag = fil->length; 188 | chg->x = (fil->x[0] + fil->x[1])/2.0; 189 | chg->y = (fil->y[0] + fil->y[1])/2.0; 190 | chg->z = (fil->z[0] + fil->z[1])/2.0; 191 | } 192 | } 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /src/fasthenry/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR -m64 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | SPLIB = sparse/sparse.a 8 | 9 | OBJS = induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o \ 10 | SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o \ 11 | Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o \ 12 | parse_command_line.o default_opts.o Prec_cost.o hole.o \ 13 | dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o \ 14 | barnoldi.o regurgitate.o 15 | 16 | MOBJS = mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o \ 17 | uglieralloc.o capsolve.o 18 | 19 | NONUNIOBJS = find_nonuni_path.o read_tree.o contact.o 20 | 21 | HEADER = induct.h cmplx.h resusage.h 22 | MULHEAD = mulStruct.h mulGlobal.h patran.h resusage.h 23 | NONUNIHEAD = gp.h 24 | 25 | fasthenry: $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) 26 | $(CC) -o fasthenry $(CFLAGS) $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) -lm 27 | mv fasthenry $(BIN)/fasthenry 28 | 29 | $(SPLIB): 30 | cd sparse; make 31 | 32 | clean: 33 | $(RM) -f *.o 34 | cd sparse; make clean 35 | 36 | $(OBJS): $(HEADER) $(MULHEAD) 37 | 38 | $(MOBJS): $(MULHEAD) 39 | 40 | $(NONUNIOBJS): $(HEADER) $(MULHEAD) $(NONUNIHEAD) 41 | -------------------------------------------------------------------------------- /src/fasthenry/Makefile.alpha: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR -DDEC -Olimit 2000 -DALPHA 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | SPLIB = sparse/sparse.a 8 | 9 | OBJS = induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o \ 10 | SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o \ 11 | Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o \ 12 | parse_command_line.o default_opts.o Prec_cost.o hole.o \ 13 | dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o \ 14 | barnoldi.o regurgitate.o 15 | 16 | MOBJS = mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o \ 17 | uglieralloc.o capsolve.o 18 | 19 | NONUNIOBJS = find_nonuni_path.o read_tree.o contact.o 20 | 21 | HEADER = induct.h cmplx.h resusage.h 22 | MULHEAD = mulStruct.h mulGlobal.h patran.h resusage.h 23 | NONUNIHEAD = gp.h 24 | 25 | fasthenry: $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) 26 | $(CC) -o fasthenry $(CFLAGS) $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) -lm 27 | mv fasthenry $(BIN)/fasthenry 28 | 29 | $(SPLIB): 30 | cd sparse; make 31 | 32 | clean: 33 | $(RM) -f *.o 34 | cd sparse; make clean 35 | 36 | $(OBJS): $(HEADER) $(MULHEAD) 37 | 38 | $(MOBJS): $(MULHEAD) 39 | 40 | $(NONUNIOBJS): $(HEADER) $(MULHEAD) $(NONUNIHEAD) 41 | -------------------------------------------------------------------------------- /src/fasthenry/Makefile.dec: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR -DDEC -Olimit 2000 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | SPLIB = sparse/sparse.a 8 | 9 | OBJS = induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o \ 10 | SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o \ 11 | Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o \ 12 | parse_command_line.o default_opts.o Prec_cost.o hole.o \ 13 | dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o \ 14 | barnoldi.o regurgitate.o 15 | 16 | MOBJS = mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o \ 17 | uglieralloc.o capsolve.o 18 | 19 | NONUNIOBJS = find_nonuni_path.o read_tree.o contact.o 20 | 21 | HEADER = induct.h cmplx.h resusage.h 22 | MULHEAD = mulStruct.h mulGlobal.h patran.h resusage.h 23 | NONUNIHEAD = gp.h 24 | 25 | fasthenry: $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) 26 | $(CC) -o fasthenry $(CFLAGS) $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) -lm 27 | mv fasthenry $(BIN)/fasthenry 28 | 29 | $(SPLIB): 30 | cd sparse; make 31 | 32 | clean: 33 | $(RM) -f *.o 34 | cd sparse; make clean 35 | 36 | $(OBJS): $(HEADER) $(MULHEAD) 37 | 38 | $(MOBJS): $(MULHEAD) 39 | 40 | $(NONUNIOBJS): $(HEADER) $(MULHEAD) $(NONUNIHEAD) 41 | -------------------------------------------------------------------------------- /src/fasthenry/Makefile.default: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | SPLIB = sparse/sparse.a 8 | 9 | OBJS = induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o \ 10 | SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o \ 11 | Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o \ 12 | parse_command_line.o default_opts.o Prec_cost.o hole.o \ 13 | dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o \ 14 | barnoldi.o regurgitate.o 15 | 16 | MOBJS = mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o \ 17 | uglieralloc.o capsolve.o 18 | 19 | NONUNIOBJS = find_nonuni_path.o read_tree.o contact.o 20 | 21 | HEADER = induct.h cmplx.h resusage.h 22 | MULHEAD = mulStruct.h mulGlobal.h patran.h resusage.h 23 | NONUNIHEAD = gp.h 24 | 25 | fasthenry: $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) 26 | $(CC) -o fasthenry $(CFLAGS) $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) -lm 27 | mv fasthenry $(BIN)/fasthenry 28 | 29 | $(SPLIB): 30 | cd sparse; make 31 | 32 | clean: 33 | $(RM) -f *.o 34 | cd sparse; make clean 35 | 36 | $(OBJS): $(HEADER) $(MULHEAD) 37 | 38 | $(MOBJS): $(MULHEAD) 39 | 40 | $(NONUNIOBJS): $(HEADER) $(MULHEAD) $(NONUNIHEAD) 41 | -------------------------------------------------------------------------------- /src/fasthenry/Makefile.sgi: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR -DSGI -Olimit 2000 -cckr 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | SPLIB = sparse/sparse.a 8 | 9 | OBJS = induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o \ 10 | SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o \ 11 | Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o \ 12 | parse_command_line.o default_opts.o Prec_cost.o hole.o \ 13 | dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o \ 14 | barnoldi.o regurgitate.o 15 | 16 | MOBJS = mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o \ 17 | uglieralloc.o capsolve.o 18 | 19 | NONUNIOBJS = find_nonuni_path.o read_tree.o contact.o 20 | 21 | HEADER = induct.h cmplx.h resusage.h 22 | MULHEAD = mulStruct.h mulGlobal.h patran.h resusage.h 23 | NONUNIHEAD = gp.h 24 | 25 | fasthenry: $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) 26 | $(CC) -o fasthenry $(CFLAGS) $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) -lm 27 | mv fasthenry $(BIN)/fasthenry 28 | 29 | $(SPLIB): 30 | cd sparse; make 31 | 32 | clean: 33 | $(RM) -f *.o 34 | cd sparse; make clean 35 | 36 | $(OBJS): $(HEADER) $(MULHEAD) 37 | 38 | $(MOBJS): $(MULHEAD) 39 | 40 | $(NONUNIOBJS): $(HEADER) $(MULHEAD) $(NONUNIHEAD) 41 | -------------------------------------------------------------------------------- /src/fasthenry/Makefile.solaris: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFIVE -DSOLARIS 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | SPLIB = sparse/sparse.a 8 | 9 | OBJS = induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o \ 10 | SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o \ 11 | Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o \ 12 | parse_command_line.o default_opts.o Prec_cost.o hole.o \ 13 | dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o \ 14 | barnoldi.o regurgitate.o 15 | 16 | MOBJS = mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o \ 17 | uglieralloc.o capsolve.o 18 | 19 | NONUNIOBJS = find_nonuni_path.o read_tree.o contact.o 20 | 21 | HEADER = induct.h cmplx.h resusage.h 22 | MULHEAD = mulStruct.h mulGlobal.h patran.h resusage.h 23 | NONUNIHEAD = gp.h 24 | 25 | fasthenry: $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) 26 | $(CC) -o fasthenry $(CFLAGS) $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) -lm 27 | mv fasthenry $(BIN)/fasthenry 28 | 29 | $(SPLIB): 30 | cd sparse; make 31 | 32 | clean: 33 | $(RM) -f *.o 34 | cd sparse; make clean 35 | 36 | $(OBJS): $(HEADER) $(MULHEAD) 37 | 38 | $(MOBJS): $(MULHEAD) 39 | 40 | $(NONUNIOBJS): $(HEADER) $(MULHEAD) $(NONUNIHEAD) 41 | -------------------------------------------------------------------------------- /src/fasthenry/Makefile.sysV: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFIVE 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | SPLIB = sparse/sparse.a 8 | 9 | OBJS = induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o \ 10 | SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o \ 11 | Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o \ 12 | parse_command_line.o default_opts.o Prec_cost.o hole.o \ 13 | dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o \ 14 | barnoldi.o regurgitate.o 15 | 16 | MOBJS = mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o \ 17 | uglieralloc.o capsolve.o 18 | 19 | NONUNIOBJS = find_nonuni_path.o read_tree.o contact.o 20 | 21 | HEADER = induct.h cmplx.h resusage.h 22 | MULHEAD = mulStruct.h mulGlobal.h patran.h resusage.h 23 | NONUNIHEAD = gp.h 24 | 25 | fasthenry: $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) 26 | $(CC) -o fasthenry $(CFLAGS) $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) -lm 27 | mv fasthenry $(BIN)/fasthenry 28 | 29 | $(SPLIB): 30 | cd sparse; make 31 | 32 | clean: 33 | $(RM) -f *.o 34 | cd sparse; make clean 35 | 36 | $(OBJS): $(HEADER) $(MULHEAD) 37 | 38 | $(MOBJS): $(MULHEAD) 39 | 40 | $(NONUNIOBJS): $(HEADER) $(MULHEAD) $(NONUNIHEAD) 41 | -------------------------------------------------------------------------------- /src/fasthenry/Makefile.x64: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR -m64 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | SPLIB = sparse/sparse.a 8 | 9 | OBJS = induct.o gmres.o savemat_mod.o readGeom.o joelself.o writefastcap.o \ 10 | SetupMulti.o calcp.o SetupComputePsi.o mulSetup.o BreakupSeg.o \ 11 | Precond.o addgroundplane.o findpaths.o fillM.o cx_ludecomp.o \ 12 | parse_command_line.o default_opts.o Prec_cost.o hole.o \ 13 | dist_betw_fils.o mutual.o newPrecond.o deg_mutual.o \ 14 | barnoldi.o regurgitate.o 15 | 16 | MOBJS = mulGlobal.o mulDo.o mulMulti.o mulLocal.o mulMats.o direct.o \ 17 | uglieralloc.o capsolve.o 18 | 19 | NONUNIOBJS = find_nonuni_path.o read_tree.o contact.o 20 | 21 | HEADER = induct.h cmplx.h resusage.h 22 | MULHEAD = mulStruct.h mulGlobal.h patran.h resusage.h 23 | NONUNIHEAD = gp.h 24 | 25 | fasthenry: $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) 26 | $(CC) -o fasthenry $(CFLAGS) $(OBJS) $(MOBJS) $(NONUNIOBJS) $(SPLIB) -lm 27 | mv fasthenry $(BIN)/fasthenry 28 | 29 | $(SPLIB): 30 | cd sparse; make 31 | 32 | clean: 33 | $(RM) -f *.o 34 | cd sparse; make clean 35 | 36 | $(OBJS): $(HEADER) $(MULHEAD) 37 | 38 | $(MOBJS): $(MULHEAD) 39 | 40 | $(NONUNIOBJS): $(HEADER) $(MULHEAD) $(NONUNIHEAD) 41 | -------------------------------------------------------------------------------- /src/fasthenry/Prec_cost.c: -------------------------------------------------------------------------------- 1 | /* these are functions used in mulSetup.c in determining whether to go down */ 2 | /* further in partitioning levels */ 3 | 4 | #include "induct.h" 5 | 6 | /* this function estimates the size of the matrix which will be inverted 7 | for this cube for the preconditioner. Since M has not been formed, and 8 | the size of the preconditioner is based on meshes, not filaments/charges, 9 | it will estimate that there is one mesh per normal filament and one mesh for 10 | every two ground plane filaments. Thus the number of meshes in a cube 11 | is cube->multisize/2. 12 | */ 13 | 14 | double OneCubeCost(cubes, i,j,k,l,side, dir_cost) 15 | cube *****cubes; 16 | int i,j,k,l,side; 17 | double *dir_cost; 18 | { 19 | int m,n,p; 20 | double total, dir_total, this_size; 21 | 22 | this_size = cubes[i][j][k][l]->upnumeles[0]; 23 | 24 | total = dir_total = 0; 25 | for(m=j-2; m <=j+2; m++) 26 | for(n=k-2; n <=k+2; n++) 27 | for(p=l-2; p <=l+2; p++) 28 | if ( (m >= 0) && (n >= 0) && (p >= 0) 29 | && (m < side) && (n < side) && (p < side) 30 | && (cubes[i][m][n][p] != NULL) ) { 31 | dir_total += cubes[i][m][n][p]->upnumeles[0]; 32 | if (abs(m-j) < 2 && abs(n-k) < 2 && abs(p-l) < 2) 33 | total += cubes[i][m][n][p]->multisize/2.0; 34 | } 35 | 36 | *dir_cost += this_size*dir_total; 37 | 38 | return total*total*total; 39 | } 40 | 41 | double ratio_of_divided_segs(length,charges,indsys) 42 | double length; 43 | charge *charges; 44 | SYS *indsys; 45 | { 46 | SEGMENT *seg; 47 | int totalfils = 0, broken = 0; 48 | double rat; 49 | 50 | if (indsys->opts->auto_refine == OFF) 51 | return 0.0; 52 | 53 | for(seg = indsys->segment; seg != NULL; seg = seg->next) { 54 | totalfils += seg->num_fils; 55 | if (seg->length > length) { 56 | broken += seg->num_fils; 57 | } 58 | } 59 | 60 | rat = (double)broken/(double)totalfils; 61 | if (indsys->opts->debug == ON) 62 | fprintf(stdout, "To be broken ratio: %lg\n", rat); 63 | return rat; 64 | } 65 | 66 | is_gp_charge(chg) 67 | charge *chg; 68 | { 69 | if (chg->fil->segm->node[0]->gp == NULL) 70 | return FALSE; 71 | else 72 | return TRUE; 73 | } 74 | 75 | add_to_counts(nc, cols, evals, cnts) 76 | cube *nc; 77 | int cols, *****evals, *****cnts; 78 | { 79 | cube *na; 80 | 81 | for(na = nc; na != NULL; na = na->parent) 82 | cnts[na->level][na->j][na->k][na->l] += cols*nc->upnumeles[0]; 83 | 84 | evals[nc->level][nc->j][nc->k][nc->l] += 1; 85 | na = nc->parent; 86 | if (na != NULL) 87 | evals[na->level][na->j][na->k][na->l] += 1; 88 | } 89 | 90 | #if 1 == 0 91 | dump_evalcnts(sys) 92 | ssystem *sys; 93 | { 94 | cube *****cubes = sys->cubes; 95 | int i,j,k,m,side; 96 | cube *nc, *na; 97 | 98 | printf(" cube parent Q2P L2P M2P\n"); 99 | printf(" lvl j,k,l j,k,l cubes size_mats cubes size_mats cubes size_mats\n"); 100 | 101 | for(side = 1, i=0; i <= sys->depth; side *= 2, i++) { 102 | for(j=0; j < side; j++) { 103 | for(k=0; k < side; k++) { 104 | for(m = 0; m < side; m++) { 105 | nc = cubes[i][j][k][m]; 106 | if (nc != NULL) { 107 | na = nc->parent; 108 | if (na == NULL) 109 | na = nc; 110 | printf("%3i %3i %3i %3i %3i %3i %3i %3d %10d %3d %10d %3d %10d\n", 111 | i, nc->j, nc->k, nc->l, na->j, na->k, na->l, 112 | sys->evalQ2Ps[i][j][k][m], sys->cntQ2Ps[i][j][k][m], 113 | sys->evalL2Ps[i][j][k][m], sys->cntL2Ps[i][j][k][m], 114 | sys->evalM2Ps[i][j][k][m], sys->cntM2Ps[i][j][k][m]); 115 | } 116 | } 117 | } 118 | } 119 | } 120 | } 121 | 122 | initCounters(sys) 123 | ssystem *sys; 124 | { 125 | int *****make_ints_for_cubes(); 126 | 127 | sys->evalQ2Ps = make_ints_for_cubes(sys); 128 | sys->evalL2Ps = make_ints_for_cubes(sys); 129 | sys->evalM2Ps = make_ints_for_cubes(sys); 130 | sys->cntQ2Ps = make_ints_for_cubes(sys); 131 | sys->cntL2Ps = make_ints_for_cubes(sys); 132 | sys->cntM2Ps = make_ints_for_cubes(sys); 133 | } 134 | 135 | int *****make_ints_for_cubes(sys) 136 | ssystem *sys; 137 | { 138 | int *****cubes; 139 | int i,j,k,m,side; 140 | 141 | CALLOC(cubes, sys->depth+1, int****, ON, AMSC); 142 | 143 | /* allocate for levels 0, 1, and 2 (always used) */ 144 | for(side = 1, i=0; i <= sys->depth; side *= 2, i++) { 145 | CALLOC(cubes[i], side, int***, ON, AMSC); 146 | for(j=0; j < side; j++) { 147 | CALLOC(cubes[i][j], side, int**, ON, AMSC); 148 | for(k=0; k < side; k++) { 149 | CALLOC(cubes[i][j][k], side, int*, ON, AMSC); 150 | for(m = 0; m < side; m++) 151 | cubes[i][j][k][m] = 0; 152 | } 153 | } 154 | } 155 | 156 | return cubes; 157 | } 158 | #endif 159 | -------------------------------------------------------------------------------- /src/fasthenry/SetupComputePsi.c: -------------------------------------------------------------------------------- 1 | /* this sets up the vectors to call Fastcap's ComputePsi */ 2 | /* It will be called twice for each coordinate direction. Once for real 3 | and once for imaginary */ 4 | 5 | #include "induct.h" 6 | 7 | /* Vs will contain the result, Im is the 'q', Size is the size of vectors. */ 8 | /* This will alter Im. Im = Precond*Im */ 9 | SetupComputePsi(Vs, sys, Im, size, chglist, w, R, indsys) 10 | CX *Vs, *Im; 11 | int size; 12 | ssystem *sys; 13 | charge *chglist; 14 | double w; /* radian frequency */ 15 | double *R; /* resistance vector */ 16 | SYS *indsys; 17 | { 18 | extern double dirtime; 19 | double *q, *p; 20 | static CX *Ib = NULL, *Vb = NULL, *Vdirect = NULL, *ctemp; 21 | int branches; 22 | CX temp; 23 | MELEMENT *mtemp; 24 | charge *chg; 25 | int i, j; 26 | double rtemp; 27 | MELEMENT **Mtrans, **Mlist; 28 | double maxdiff,pdiff; 29 | int maxindx; 30 | int ind_opcnt_mult = 0, ind_opcnt_real = 0; 31 | 32 | branches = indsys->num_fils; 33 | Mtrans = indsys->Mtrans; 34 | Mlist = indsys->Mlist; 35 | 36 | if (Ib == NULL) { 37 | Ib = (CX *)MattAlloc(branches, sizeof(CX)); 38 | Vb = (CX *)MattAlloc(branches, sizeof(CX)); 39 | ctemp = (CX *)MattAlloc(size, sizeof(CX)); 40 | #ifndef NODEBUG 41 | Vdirect = (CX *)MattAlloc(branches, sizeof(CX)); 42 | #endif 43 | } 44 | 45 | for(i = 0; i < branches; i++) 46 | Vb[i] = CXZERO; 47 | 48 | q = sys->q; 49 | p = sys->p; 50 | ASSERT(size == indsys->num_mesh); 51 | 52 | if (indsys->precond_type == LOC) { 53 | multPrecond(indsys->Precond, Im, ctemp, size); 54 | for(i = 0; i < size; i++) 55 | Im[i] = ctemp[i]; 56 | } 57 | else if (indsys->precond_type == SPARSE) 58 | spSolve(indsys->sparMatrix, Im, Im); 59 | 60 | /* do Ib = Mtrans*Im */ 61 | for(i = 0; i < branches; i++) { 62 | Ib[i] = CXZERO; 63 | for(mtemp = Mtrans[i]; mtemp != NULL; mtemp = mtemp->mnext) { 64 | if (mtemp->sign == 1) 65 | cx_add(Ib[i], Ib[i], Im[mtemp->filindex]); 66 | else 67 | cx_sub(Ib[i], Ib[i], Im[mtemp->filindex]); 68 | } 69 | } 70 | 71 | /* Evaluate M*L*Mt*Im = M*L*Ib using the multipole algorithm */ 72 | 73 | /* Do all of the non-direct parts first */ 74 | sys->DirectEval = FALSE; 75 | for(i = 0; i < 3; i++) { /* for each of the coordinate directions */ 76 | 77 | /* do the real part */ 78 | for(chg = chglist; chg != NULL; chg = chg->next) { 79 | /* fill the pseudo-charge vector */ 80 | q[chg->index] = Ib[chg->fil->filnumber].real*chg->fil->lenvect[i]; 81 | #if OPCNT == ON 82 | ind_opcnt_mult++; 83 | #endif 84 | 85 | } 86 | computePsi(sys, q, p, branches, chglist); 87 | for(chg = chglist; chg != NULL; chg = chg->next) { 88 | /* add potential due to i direction */ 89 | Vb[chg->fil->filnumber].real += p[chg->index]*chg->fil->lenvect[i]*MUOVER4PI; 90 | #if OPCNT == ON 91 | ind_opcnt_mult++; 92 | #endif 93 | } 94 | 95 | /* do the imaginary part */ 96 | for(chg = chglist; chg != NULL; chg = chg->next) { 97 | /* fill the pseudo-charge vector */ 98 | q[chg->index] = Ib[chg->fil->filnumber].imag*chg->fil->lenvect[i]; 99 | #if OPCNT == ON 100 | ind_opcnt_mult++; 101 | #endif 102 | } 103 | computePsi(sys, q, p, branches, chglist); 104 | for(chg = chglist; chg != NULL; chg = chg->next) { 105 | /* add potential due to i direction */ 106 | Vb[chg->fil->filnumber].imag += p[chg->index]*chg->fil->lenvect[i]*MUOVER4PI; 107 | #if OPCNT == ON 108 | ind_opcnt_mult++; 109 | #endif 110 | } 111 | 112 | } 113 | 114 | /* do the direct parts */ 115 | sys->DirectEval = TRUE; 116 | 117 | /* do the real part of the Direct part */ 118 | for(i = 1; i <= branches; i++) 119 | p[i] = 0; 120 | for(chg = chglist; chg != NULL; chg = chg->next) 121 | /* fill the pseudo-charge vector */ 122 | q[chg->index] = Ib[chg->fil->filnumber].real; 123 | 124 | /* starttimer; */ 125 | mulDirect(sys); 126 | mulEval(sys); 127 | /* stoptimer; */ 128 | dirtime += dtime; 129 | 130 | for(chg = chglist; chg != NULL; chg = chg->next) { 131 | /* add potential due to i direction */ 132 | Vb[chg->fil->filnumber].real += p[chg->index]; 133 | } 134 | 135 | /* do the imaginary part of the Direct part */ 136 | for(i = 1; i <= branches; i++) 137 | p[i] = 0; 138 | for(chg = chglist; chg != NULL; chg = chg->next) 139 | /* fill the pseudo-charge vector */ 140 | q[chg->index] = Ib[chg->fil->filnumber].imag; 141 | 142 | /* starttimer; */ 143 | mulDirect(sys); 144 | mulEval(sys); 145 | /* stoptimer; */ 146 | dirtime += dtime; 147 | 148 | for(chg = chglist; chg != NULL; chg = chg->next) { 149 | /* add potential due to i direction */ 150 | Vb[chg->fil->filnumber].imag += p[chg->index]; 151 | } 152 | 153 | /* do Vs = M*Vb*jw */ 154 | for(i = 0; i < size; i++) { 155 | Vs[i] = CXZERO; 156 | for(mtemp = Mlist[i]; mtemp != NULL; mtemp = mtemp->mnext) 157 | if (mtemp->sign == 1) 158 | cx_add(Vs[i], Vs[i], Vb[mtemp->filindex]); 159 | else 160 | cx_sub(Vs[i], Vs[i], Vb[mtemp->filindex]); 161 | 162 | /* multiply by jw */ 163 | rtemp = -Vs[i].imag*w; 164 | Vs[i].imag = Vs[i].real*w; 165 | Vs[i].real = rtemp; 166 | } 167 | 168 | /* add in M*R*Mt*Im = M*R*Ib */ 169 | for(i = 0; i < size; i++) { 170 | for(mtemp = Mlist[i]; mtemp != NULL; mtemp = mtemp->mnext) { 171 | cx_scalar_mult(temp, mtemp->sign*R[mtemp->filindex], Ib[mtemp->filindex]); 172 | cx_add(Vs[i], Vs[i], temp); 173 | #if OPCNT == ON 174 | ind_opcnt_mult+=2; 175 | ind_opcnt_real+=2; 176 | #endif 177 | } 178 | } 179 | 180 | #if OPCNT == ON 181 | printf("Inductance (mesh to branch) mults: %d\n",ind_opcnt_mult); 182 | printf("Just doing MRMtIm: %d\n",ind_opcnt_real); 183 | printops(); 184 | exit(0); 185 | #endif 186 | 187 | #ifdef NODEBUG 188 | /* for debugging, compare to direct Vb = ZM Ib */ 189 | realmatCXvec(Vdirect, indsys->Z, Ib, branches); 190 | maxdiff = 0; 191 | maxindx = 0; 192 | for(i = 0; i < branches; i++) { 193 | if (cx_abs(Vb[i]) > 1e-23) { 194 | cx_sub(temp, Vdirect[i], Vb[i]); 195 | pdiff = cx_abs(temp )/cx_abs(Vb[i]) ; 196 | } 197 | else 198 | pdiff = cx_abs(Vb[i]); 199 | 200 | if (pdiff > maxdiff) { 201 | maxdiff = pdiff; 202 | maxindx = i; 203 | } 204 | } 205 | if (maxdiff < .3) 206 | printf("maxdiff: %g Vb[%d]=%g Vdirect[%d]=%g\n", 207 | maxdiff,maxindx,cx_abs(Vb[maxindx]),maxindx,cx_abs(Vdirect[maxindx])); 208 | else 209 | printf("***maxdiff: %g Vb[%d]=%g Vdirect[%d]=%g***\n", 210 | maxdiff,maxindx,cx_abs(Vb[maxindx]),maxindx,cx_abs(Vdirect[maxindx])); 211 | 212 | 213 | #endif 214 | } 215 | 216 | realmatCXvec(y, A, x, size) 217 | CX *y, *x; 218 | double **A; 219 | int size; 220 | { 221 | int i, j; 222 | CX temp; 223 | 224 | for (i = 0; i < size; i++) { 225 | y[i] = CXZERO; 226 | for(j = 0; j < size; j++) { 227 | cx_scalar_mult(temp, A[i][j], x[j]); 228 | cx_add(y[i], y[i], temp); 229 | } 230 | } 231 | } 232 | 233 | /* this function fixes Eval matrices which are computed directly */ 234 | /* This is necessary since direct mutual terms are not componentwise, 235 | but the multipole routines are called once for each component direction. 236 | Basically, componentwise multiplication will cause the elements 237 | to be multiplied by the dot product of the fil->lenvect vectors of 238 | the two filaments. This will divide that product out. Also, MUOVER4PI 239 | must also be divided out 240 | */ 241 | 242 | fixEvalDirect(qchgs, numqchgs, is_dummy, pchgs, numpchgs, mat) 243 | charge **qchgs, **pchgs; 244 | int numqchgs, numpchgs; 245 | int *is_dummy; 246 | double **mat; 247 | { 248 | int i,j, k; 249 | double dotprod, magi, magj; 250 | double *lenvecti, *lenvectj; 251 | static double eps = EPS; 252 | 253 | for(i = 0; i < numpchgs; i++) { 254 | lenvecti = pchgs[i]->fil->lenvect; 255 | magi = 0; 256 | for(k = 0; k < 3; k++) 257 | magi += lenvecti[k]*lenvecti[k]; 258 | for(j = 0; j < numqchgs; j++) { 259 | lenvectj = qchgs[j]->fil->lenvect; 260 | magj = dotprod = 0; 261 | for(k = 0; k < 3; k++) { 262 | magj += lenvectj[k]*lenvectj[k]; 263 | dotprod += lenvecti[k]*lenvectj[k]; 264 | } 265 | if (fabs(dotprod)/sqrt(magi*magj) > EPS) /* filaments aren't perpendicular */ 266 | mat[i][j] = mat[i][j]/(dotprod*MUOVER4PI); 267 | else { /* if they are, mat[i][j] == 0.0, hopefully */ 268 | if (mat[i][j] != 0.0) 269 | printf("Warning: dot product = %lg < EPS, but mat[i][j] = %lg\n",dotprod, mat[i][j]); 270 | } 271 | } 272 | } 273 | } 274 | -------------------------------------------------------------------------------- /src/fasthenry/bigmeshPre_direct.c: -------------------------------------------------------------------------------- 1 | /* this preconditions the 2 | /* This preconditions one row. It is mostly a duplicate of indPrecond() 3 | code from olmulPrcond() */ 4 | 5 | #include "induct.h" 6 | #define PARTMESH OFF 7 | 8 | /* This near picks up only the hamming distance one cubes. */ 9 | #define HNEAR(nbr, nj, nk, nl) \ 10 | ((ABS((nbr)->j - (nj)) + ABS((nbr)->k - (nk)) + ABS((nbr)->l - (nl))) <= 1) 11 | 12 | /* This near picks up all 27 neighboring cubes. */ 13 | #define NEAR(nbr, nj, nk, nl) \ 14 | ((ABS((nbr)->j - (nj)) <= 1) && \ 15 | (ABS((nbr)->k - (nk)) <= 1) && \ 16 | (ABS((nbr)->l - (nl)) <= 1)) 17 | 18 | /* This near picks only the diagonal, for testing. */ 19 | #define DNEAR(nbr, nj, nk, nl) \ 20 | (((nbr)->j == (nj)) && \ 21 | ((nbr)->k == (nk)) && \ 22 | ((nbr)->l == (nl)) ) 23 | 24 | FILE *fp; 25 | 26 | bigmesh_direct(sys, indsys, w) 27 | ssystem *sys; 28 | SYS *indsys; 29 | double w; 30 | { 31 | cube *nc, *nnbr, *nnnbr; 32 | int nsize, nnsize; 33 | charge **nc_pc, **nnbr_pc; 34 | int meshmax = 0, *meshnum; 35 | CX **meshmat = NULL; 36 | int *filcount = NULL, *is_in_nc, *maxfilcount, *indx; 37 | int num_mesh = indsys->num_mesh; 38 | int filnum, i, j, k, nj, nk, nl; 39 | MELEMENT *mtran; 40 | MELEMENT **Mtrans = indsys->Mtrans; 41 | MELEMENT **Mlist = indsys->Mlist; 42 | PRE_ELEMENT **Precond = indsys->Precond; 43 | PRE_ELEMENT *pre, *prelast; 44 | int meshsize, realmrow; 45 | int counter; 46 | int debug = 0; 47 | CX **MtZM = indsys->MtZM; 48 | 49 | meshsize = count_tree_meshes(indsys->trees); 50 | 51 | if (meshsize > meshmax) { 52 | CALLOC(meshmat, meshsize + 10, CX*, ON, IND); 53 | for(i = 0; i < meshsize + 10; i++) 54 | CALLOC(meshmat[i], meshsize + 10, CX, ON, IND); 55 | meshmax = meshsize + 10; 56 | } 57 | 58 | /* conveniently, all the bigmeshes (tree meshes) are at the front of Mlist */ 59 | for(i = 0; i < meshsize; i++) 60 | for(j = 0; j < meshsize; j++) 61 | meshmat[i][j] = MtZM[i][j]; 62 | 63 | if (indsys->opts->debug == ON) { 64 | fprintf(stdout, "For big meshes:\n"); 65 | fprintf(stdout, "Inverting a %d x %d matrix\n",meshsize,meshsize); 66 | } 67 | 68 | /* now invert meshmat and skip duplicate rows and cols */ 69 | cx_invert(meshmat, meshsize); 70 | 71 | if (debug == 1) { 72 | savecmplx(fp, "after", meshmat, meshsize, meshsize); 73 | fclose(fp); 74 | } 75 | 76 | #if 1==0 /* the stupid way (adding to what is there) */ 77 | /* add the rows (don't overwrite what's there) to the preconditioner */ 78 | for(i = 0; i < meshsize; i++) { 79 | 80 | prelast = NULL; 81 | for(j = 0, pre = Precond[i]; j < meshsize; j++) { 82 | if (is_in_Precond(Precond[i], j, &prelast) == 0) { 83 | CALLOC(pre, 1, PRE_ELEMENT, ON, IND); 84 | pre->meshcol = j; 85 | pre->value = meshmat[i][j]; 86 | if (prelast == NULL) { 87 | pre->next = Precond[i]; 88 | Precond[i] = pre; 89 | } 90 | else { 91 | pre->next = prelast->next; 92 | prelast->next = pre; 93 | } 94 | } 95 | } 96 | } 97 | #endif 98 | 99 | /* add the rows to the preconditioner */ 100 | for(i = 0; i < meshsize; i++) { 101 | 102 | Precond[i] = NULL; /* a quick dumb solution */ 103 | 104 | if (Precond[i] == NULL) { 105 | CALLOC(Precond[i], 1, PRE_ELEMENT, ON, IND); 106 | Precond[i]->next = NULL; 107 | } 108 | prelast = NULL; 109 | for(j = 0, pre = Precond[i]; j < meshsize; j++) { 110 | if (pre == NULL) { 111 | CALLOC(pre, 1, PRE_ELEMENT, ON, IND); 112 | pre->next = NULL; 113 | if (prelast == NULL) { 114 | fprintf(stderr, "Hey, prelast is null!\n"); 115 | exit(1); 116 | } 117 | prelast->next = pre; 118 | } 119 | 120 | pre->meshcol = j; 121 | pre->value = meshmat[i][j]; 122 | prelast = pre; 123 | pre = pre->next; 124 | } 125 | } 126 | 127 | } 128 | 129 | is_in_Precond(prelist, col, last) 130 | PRE_ELEMENT *prelist, **last; 131 | int col; 132 | { 133 | if (prelist == NULL) { 134 | *last = NULL; 135 | return 0; 136 | } 137 | 138 | if (prelist->meshcol == col) 139 | return 1; 140 | else if (prelist->meshcol > col) { 141 | *last = NULL; 142 | return 0; 143 | } 144 | else { 145 | while(prelist->next != NULL && prelist->next->meshcol < col) 146 | prelist = prelist->next; 147 | 148 | if (prelist->next->meshcol == col) 149 | return 1; 150 | else { 151 | *last = prelist; 152 | return 0; 153 | } 154 | } 155 | } 156 | 157 | 158 | 159 | -------------------------------------------------------------------------------- /src/fasthenry/calcp.c: -------------------------------------------------------------------------------- 1 | /* this calls the routine to calculate the filament-filament 2 | interaction exactly */ 3 | 4 | #include "induct.h" 5 | 6 | static int num2nd=0, num4th=0, numexact=0; 7 | static int num2ndsav=0, num4thsav=0, numexactsav=0; 8 | 9 | double calcp(pchg1, pchg2, pfd) 10 | charge *pchg1, *pchg2; 11 | double *pfd; /* left over from fastcap */ 12 | { 13 | double mutual(), selfterm(); 14 | 15 | if (pfd != NULL) 16 | fprintf(stderr, "calcp: I don't know what to do with pfd!=NULL\n"); 17 | 18 | if (pchg1->fil->filnumber == pchg2->fil->filnumber) 19 | /* self term */ 20 | return selfterm(pchg1->fil); 21 | else 22 | /* calculate mutual inductance of the two filaments */ 23 | return mutual(pchg1->fil, pchg2->fil); 24 | } 25 | 26 | /* from the fastcap calcp */ 27 | dumpnums(flag, size) 28 | int flag, size; 29 | { 30 | double total; 31 | 32 | if(flag == ON) { /* if first call */ 33 | num2ndsav = num2nd; 34 | num4thsav = num4th; 35 | numexactsav = numexact; 36 | } 37 | else { 38 | total = num2ndsav + num4thsav + numexactsav; 39 | #if MULDAT == ON 40 | fprintf(stdout, "Potential coefficient counts\n multipole only:\n"); 41 | fprintf(stdout, 42 | " 2nd order: %d %.3g%%; 4th: %d %.3g%%; Integral: %d %.3g%%\n", 43 | num2nd, 100*(num2ndsav/total), num4th, 100*(num4thsav/total), 44 | numexact, 100*(numexactsav/total)); 45 | #endif 46 | total = num2nd + num4th + numexact; 47 | #if MULDAT == ON 48 | fprintf(stdout, " multipole plus adaptive:\n"); 49 | fprintf(stdout, 50 | " 2nd order: %d %.3g%%; 4th: %d %.3g%%; Integral: %d %.3g%%\n", 51 | num2nd, 100*(num2nd/total), num4th, 100*(num4th/total), 52 | numexact, 100*(numexact/total)); 53 | #endif 54 | fprintf(stdout, "Percentage of multiplies done by multipole: %.3g%%\n", 55 | 100*(size*size - total)/(size*size)); 56 | if(size*size == total) 57 | fprintf(stdout, "Warning: no multipole acceleration\n"); 58 | } 59 | } 60 | 61 | double tilelength(nq) 62 | charge *nq; 63 | { 64 | return nq->max_diag; 65 | } 66 | -------------------------------------------------------------------------------- /src/fasthenry/capsolve.c: -------------------------------------------------------------------------------- 1 | /* # ***** sort to /src/main 2 | # ***** */ 3 | #include "mulGlobal.h" 4 | 5 | /* 6 | ComputePsi computes the potential from the charge vector, or may 7 | include a preconditioner. It is assumed that the vectors for the 8 | charge and potential have already been set up and that the potential 9 | vector has been zeroed. ARBITRARY VECTORS CAN NOT BE USED. 10 | */ 11 | 12 | computePsi(sys, q, p, size, chglist) 13 | ssystem *sys; 14 | double *q, *p; 15 | int size; 16 | charge *chglist; 17 | { 18 | extern double dirtime, uptime, downtime, evaltime, prectime; 19 | extern int real_size; 20 | int i; 21 | 22 | ASSERT(p == sys->p); 23 | ASSERT(q == sys->q); 24 | 25 | for(i=1; i <= size; i++) p[i] = 0; 26 | 27 | #if PRECOND != NONE 28 | starttimer; 29 | mulPrecond(sys, PRECOND); 30 | stoptimer; 31 | prectime += dtime; 32 | #endif 33 | 34 | #if EXPGCR == ON 35 | blkCompressVector(q+1, size, real_size, sys->is_dummy+1); 36 | blkAqprod(p+1, q+1, real_size, sqrmat); /* offset since index from 1 */ 37 | blkExpandVector(p+1, size, real_size); /* ap changed to p, r chged to q */ 38 | blkExpandVector(q+1, size, real_size); /* 7 Oct 91 */ 39 | #else 40 | /* moved into SetupComputePsi since it only is done once 41 | starttimer; 42 | mulDirect(sys); 43 | stoptimer; 44 | dirtime += dtime; 45 | */ 46 | 47 | starttimer; 48 | mulUp(sys); 49 | stoptimer; 50 | uptime += dtime; 51 | 52 | #if DUPVEC == ON 53 | dumpLevOneUpVecs(sys); 54 | #endif 55 | 56 | #if DNTYPE == NOSHFT 57 | mulDown(sys); /* do downward pass without local exp shifts */ 58 | #endif 59 | 60 | #if DNTYPE == GRENGD 61 | mulDown(sys); /* do heirarchical local shift dwnwd pass */ 62 | #endif 63 | stoptimer; 64 | downtime += dtime; 65 | 66 | starttimer; 67 | #if MULTI == ON 68 | mulEval(sys); /* evaluate either locals or multis or both */ 69 | #endif 70 | stoptimer; 71 | evaltime += dtime; 72 | 73 | #if DMPCHG == LAST 74 | fprintf(stdout, "\nPanel potentials divided by areas\n"); 75 | dumpChgDen(stdout, p, chglist); 76 | fprintf(stdout, "End panel potentials\n"); 77 | #endif 78 | 79 | /* convert the voltage vec entries on dielectric i/f's into eps1E1-eps2E2 */ 80 | /* compute_electric_fields(sys, chglist); */ 81 | 82 | #if 1==0 83 | #if OPCNT == ON 84 | printops(); 85 | exit(0); 86 | #endif /* OPCNT == ON */ 87 | #endif 88 | 89 | #endif /* EXPGCR == ON */ 90 | } 91 | -------------------------------------------------------------------------------- /src/fasthenry/cmplx.h: -------------------------------------------------------------------------------- 1 | 2 | typedef struct cx_struct { 3 | double real; 4 | double imag; 5 | } CX; 6 | 7 | #define cx_add(z,x,y) \ 8 | do { \ 9 | (z).real = (x).real + (y).real; \ 10 | (z).imag = (x).imag + (y).imag; \ 11 | } while(0) 12 | 13 | #define cx_sub(z,x,y) \ 14 | do { \ 15 | (z).real = (x).real - (y).real; \ 16 | (z).imag = (x).imag - (y).imag; \ 17 | } while(0) 18 | 19 | #define cx_mul(z,x,y) \ 20 | do { \ 21 | (z).real = (x).real * (y).real - (x).imag * (y).imag; \ 22 | (z).imag = (x).imag * (y).real + (x).real * (y).imag; \ 23 | } while(0) 24 | 25 | #define cx_div(z,x,y) \ 26 | do { \ 27 | (z).real = 1.0 / ((y).real * (y).real + (y).imag * (y).imag); \ 28 | (z).imag = (z).real; \ 29 | (z).real *= (x).real * (y).real + (x).imag * (y).imag; \ 30 | (z).imag *= (x).imag * (y).real - (x).real * (y).imag; \ 31 | } while(0) 32 | 33 | #define cx_conj_mul(z,x,y) \ 34 | do { \ 35 | (z).real = (x).real * (y).real + (x).imag * (y).imag; \ 36 | (z).imag = (x).imag * (y).real - (x).real * (y).imag; \ 37 | } while(0) 38 | 39 | #define cx_abs(x) \ 40 | (sqrt((x).real*(x).real+(x).imag*(x).imag)) 41 | 42 | #define cx_scalar_mult(z, alpha, x) \ 43 | do { \ 44 | (z).real = alpha*(x).real; \ 45 | (z).imag = alpha*(x).imag; \ 46 | } while(0) 47 | 48 | static CX CXZERO = { 0, 0 }; 49 | static CX CXONE = { 1, 0 }; 50 | static CX CXMONE = { -1, 0 }; 51 | 52 | -------------------------------------------------------------------------------- /src/fasthenry/cx_ludecomp.c: -------------------------------------------------------------------------------- 1 | /* Complex LU decomposition routines */ 2 | /* 3 | - returned matrix has L below the diagonal, U above (GVL1 pg 58) 4 | - if allocate == TRUE ends up storing LU (could be a lot) 5 | */ 6 | 7 | #include "induct.h" 8 | 9 | CX **cx_ludecomp(matin, size, allocate) 10 | CX **matin; 11 | int size; 12 | int allocate; 13 | { 14 | extern int fulldirops; 15 | CX factor, **mat, tmp; 16 | int i, j, k; 17 | 18 | if(allocate == TRUE) { 19 | /* allocate for LU matrix and copy A */ 20 | MALLOC(mat, size, CX*, ON, IND); 21 | for(i = 0; i < size; i++) { 22 | MALLOC(mat[i], size, CX, ON, IND); 23 | for(j = 0; j < size; j++) mat[i][j] = matin[i][j]; 24 | } 25 | } 26 | else mat = matin; 27 | 28 | for(k = 0; k < size-1; k++) { /* loop on rows */ 29 | if(mat[k][k].real == 0.0 && mat[k][k].imag == 0.0) { 30 | fprintf(stderr, "ludecomp: zero pivot\n"); 31 | exit(0); 32 | } 33 | for(i = k+1; i < size; i++) { /* loop on remaining rows */ 34 | /*factor = (mat[i][k] /= mat[k][k]);*/ 35 | cx_div(tmp, mat[i][k], mat[k][k]); 36 | factor = mat[i][k] = tmp; 37 | fulldirops++; 38 | for(j = k+1; j < size; j++) { /* loop on remaining columns */ 39 | /* mat[i][j] -= (factor*mat[k][j]);*/ 40 | cx_mul(tmp, factor, mat[k][j]); 41 | cx_sub(mat[i][j], mat[i][j], tmp); 42 | fulldirops++; 43 | } 44 | } 45 | } 46 | return(mat); 47 | } 48 | 49 | /* 50 | For direct solution of Pq = psi, used if DIRSOL == ON or if preconditioning. 51 | */ 52 | void cx_lu_solve(mat, x, b, size) 53 | CX **mat, *x, *b; 54 | int size; 55 | { 56 | extern int fulldirops; 57 | int i, j; 58 | CX tmp; 59 | 60 | /* copy rhs */ 61 | if(x != b) for(i = 0; i < size; i++) x[i] = b[i]; 62 | 63 | /* forward elimination */ 64 | for(i = 0; i < size; i++) { /* loop on pivot row */ 65 | for(j = i+1; j < size; j++) { /* loop on elimnation row */ 66 | /* x[j] -= mat[j][i]*x[i]; */ 67 | cx_mul(tmp, mat[j][i], x[i]); 68 | cx_sub(x[j], x[j], tmp); 69 | fulldirops++; 70 | } 71 | } 72 | 73 | /* back substitution */ 74 | for(i--; i > -1; i--) { /* loop on rows */ 75 | for(j = i+1; j < size; j++) { /* loop on columns */ 76 | /* x[i] -= mat[i][j]*x[j]; */ 77 | cx_mul(tmp, mat[i][j], x[j]); 78 | cx_sub(x[i], x[i], tmp); 79 | fulldirops++; 80 | } 81 | /* x[i] /= mat[i][i]; */ 82 | cx_div(tmp, x[i], mat[i][i]); 83 | x[i] = tmp; 84 | fulldirops++; 85 | } 86 | } 87 | 88 | -------------------------------------------------------------------------------- /src/fasthenry/default_opts.c: -------------------------------------------------------------------------------- 1 | /* This fills an ind_opts with the default options */ 2 | /* There is little error checking that these are valid */ 3 | #include "induct.h" 4 | 5 | default_opts(opts) 6 | ind_opts *opts; 7 | { 8 | opts->soln_technique = ITERATIVE; /* -s */ 9 | opts->mat_vect_prod = MULTIPOLE; /* -m */ 10 | opts->precond = ON; /* -p */ 11 | opts->order = 2; /* -o */ 12 | opts->level = AUTO; /* -l */ 13 | opts->makeFastCapFile = OFF; /* -f */ 14 | opts->gp_draw = OFF; /* -g */ 15 | opts->auto_refine = ON; /* -a */ 16 | opts->init_refine = 0; /* -i */ 17 | opts->dumpMats = OFF; /* -d */ 18 | opts->orderROM = -1; /* -r */ 19 | opts->onlyROM = 0; /* -M */ 20 | opts->kind = MATLAB; /* -k */ 21 | opts->tol = 1e-3; /* -t */ 22 | opts->abs_tol = 1e-2; /* -b */ 23 | opts->maxiters = 200; /* -c */ 24 | opts->limit = AUTO; /* -e */ 25 | opts->debug = OFF; /* -D */ 26 | opts->portlist = NULL; /* -x */ 27 | opts->suffix = ""; /* -S */ 28 | opts->shell_r0 = 0.87; /* -R */ 29 | opts->regurgitate = FALSE; /* -v */ 30 | opts->fname = NULL; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /src/fasthenry/deg_mutual.c: -------------------------------------------------------------------------------- 1 | /* This file contains functions for computing the mutual inductance 2 | between fils which have one or more degenerate dimensions. For example, 3 | it's width = 10^4 * height */ 4 | 5 | #include "induct.h" 6 | 7 | #define LEN 4 8 | #define WID 2 9 | #define HEIGHT 1 10 | 11 | enum degen_type find_deg_dims(fil) 12 | FILAMENT *fil; 13 | { 14 | double max; 15 | 16 | max = MAX(fil->length, fil->width); 17 | max = MAX(max, fil->height); 18 | 19 | return (fil->length/max < DEG_TOL)*LEN + (fil->width/max < DEG_TOL)*WID 20 | + (fil->height/max < DEG_TOL)*HEIGHT; 21 | } 22 | 23 | double compute_for_degenerate(fil_j, fil_m, whperp, x_j, y_j, 24 | deg_j, deg_m, dist) 25 | FILAMENT *fil_j, *fil_m; 26 | int whperp; 27 | double *x_j, *y_j; /* unit vectors in the fil coord sys */ 28 | enum degen_type deg_j, deg_m; 29 | double dist; 30 | { 31 | 32 | FILAMENT nfil_j, nfil_m; /* new temp fils */ 33 | double *nx_j, *ny_j; 34 | 35 | if (deg_j == brick && deg_m == brick) { 36 | /* neither is degenerate, this shouldn't happen */ 37 | fprintf(stderr,"Hey, compute_degenerate was called, impossible!\n"); 38 | exit(1); 39 | } 40 | 41 | if ((deg_j == flat || deg_j == skinny)&&(deg_m == flat || deg_m == skinny)){ 42 | setup_tape_to_tape(fil_j,fil_m,whperp,x_j,y_j,deg_j,deg_m, 43 | &nfil_j,&nfil_m, &nx_j, &ny_j); 44 | return exact_mutual(&nfil_j, &nfil_m, whperp, nx_j, ny_j, deg_j, deg_m); 45 | } 46 | else if ( deg_m == brick && (deg_j == flat || deg_j == skinny) 47 | || deg_j == brick && (deg_m == flat || deg_m == skinny)) 48 | return do_tape_to_brick(fil_j, fil_m, whperp, x_j, y_j, deg_j, deg_m); 49 | else if ( deg_j == too_long && deg_m == too_long) 50 | return fourfil(fil_j, fil_m); 51 | else if (deg_j == too_long || deg_j == too_long) 52 | return fourfil(fil_j, fil_m); 53 | else 54 | return fourfil(fil_j, fil_m); 55 | 56 | } 57 | 58 | setup_tape_to_tape(fil_j, fil_m, whperp, x_j, y_j, deg_j, deg_m, 59 | nfil_j, nfil_m, nx_j, ny_j) 60 | FILAMENT *fil_j, *fil_m, *nfil_j, *nfil_m; 61 | int whperp; 62 | double *x_j, *y_j, **nx_j, **ny_j; /* unit vectors in the fil coord sys */ 63 | enum degen_type deg_j, deg_m; 64 | { 65 | 66 | if (deg_j == flat) { 67 | *nfil_j = *fil_j; 68 | *nfil_m = *fil_m; 69 | *nx_j = x_j; 70 | *ny_j = y_j; 71 | } 72 | else if (deg_j == skinny) { 73 | /* turn skinny into flat orientation */ 74 | *nfil_j = *fil_j; 75 | *nfil_m = *fil_m; 76 | /* swap coord sys */ 77 | *ny_j = x_j; 78 | *nx_j = y_j; 79 | /* swap height and width */ 80 | nfil_j->width = fil_j->height; 81 | nfil_j->height = fil_j->width; 82 | nfil_m->width = fil_m->height; 83 | nfil_m->height = fil_m->width; 84 | } 85 | } 86 | 87 | double do_tape_to_brick(fil_j, fil_m, whperp, x_j, y_j, deg_j, deg_m) 88 | FILAMENT *fil_j, *fil_m; 89 | int whperp; 90 | double *x_j, *y_j; /* unit vectors in the fil coord sys */ 91 | enum degen_type deg_j, deg_m; 92 | { 93 | 94 | FILAMENT nfil_j, nfil_m; 95 | double *nx_j, *ny_j, *dR; 96 | double wid_brick[3], hei_brick[3], orig_x[2], orig_y[2], orig_z[2]; 97 | double x_flat[3], y_flat[3]; 98 | double small_dim, sum; 99 | int i,j,gpoints; 100 | extern double **Gweight, **Gpoint; /* gaussian quad weights. */ 101 | enum degen_type ndeg_j, ndeg_m; 102 | 103 | /* 104 | if ( deg_m == brick && (deg_j == flat || deg_j == skinny) 105 | || deg_j == brick && (deg_m == flat || deg_m == skinny)) 106 | return do_tape_to_brick(fil_j, fil_m, whperp, x_j, y_j, deg_j, deg_m); 107 | */ 108 | 109 | if (deg_j == flat) { 110 | nfil_j = *fil_j; 111 | nfil_m = *fil_m; 112 | nx_j = x_j; 113 | ny_j = y_j; 114 | get_wid(fil_m,wid_brick); 115 | get_height(fil_m,wid_brick,hei_brick); 116 | } 117 | else if (deg_j == skinny) { 118 | /* turn skinny into flat orientation */ 119 | nfil_j = *fil_j; 120 | nfil_m = *fil_m; 121 | /* swap coord sys */ 122 | ny_j = x_j; 123 | nx_j = y_j; 124 | /* swap height and width */ 125 | nfil_j.width = fil_j->height; 126 | nfil_j.height = fil_j->width; 127 | nfil_m.width = fil_m->height; 128 | nfil_m.height = fil_m->width; 129 | /* get them swapped */ 130 | get_wid(fil_m,hei_brick); 131 | get_height(fil_m,hei_brick,wid_brick); 132 | } 133 | else if (deg_j == brick) { 134 | /* swap j and m */ 135 | nfil_j = *fil_m; 136 | nfil_m = *fil_j; 137 | get_wid(fil_m,x_flat); 138 | get_height(fil_m,x_flat,y_flat); 139 | 140 | if (deg_m == flat) { 141 | nx_j = x_flat; 142 | ny_j = y_flat; 143 | for(i = 0; i < 3; i++) { 144 | wid_brick[i] = x_j[i]; 145 | hei_brick[i] = y_j[i]; 146 | } 147 | 148 | } 149 | else { 150 | nx_j = y_flat; 151 | ny_j = x_flat; 152 | nfil_j.width = fil_m->height; 153 | nfil_j.height = fil_m->width; 154 | nfil_m.width = fil_j->height; 155 | nfil_m.height = fil_j->width; 156 | for(i = 0; i < 3; i++) { 157 | wid_brick[i] = y_j[i]; 158 | hei_brick[i] = x_j[i]; 159 | } 160 | 161 | } 162 | } 163 | 164 | /* store original brick position */ 165 | for(i = 0; i < 2; i++) { 166 | orig_x[i] = nfil_m.x[i]; 167 | orig_y[i] = nfil_m.y[i]; 168 | orig_z[i] = nfil_m.z[i]; 169 | } 170 | 171 | if (nfil_m.width > nfil_m.height) { 172 | /* the height direction will be done discretely */ 173 | small_dim = nfil_m.height/2; 174 | nfil_m.height = 0; 175 | dR = hei_brick; 176 | if (whperp == 0) /* useful for testing only. if forced == 1 */ 177 | ndeg_m = flat; 178 | else 179 | ndeg_m = skinny; 180 | } 181 | else { 182 | /* the width direction will be done discretely */ 183 | small_dim = nfil_m.width/2; 184 | nfil_m.width = 0; 185 | dR = wid_brick; 186 | if (whperp == 0) 187 | ndeg_m = skinny; 188 | else 189 | ndeg_m = flat; 190 | } 191 | 192 | /* if forced == 1, then setting ndeg_j matters */ 193 | ndeg_j = flat; 194 | nfil_j.height = 0.0; /* insure we use the middle of filament x-section*/ 195 | 196 | gpoints = 3; 197 | /* now do gaussian quadrature of tape_to_tape to approximate */ 198 | sum = 0; 199 | for(i = 0; i < gpoints; i++) { 200 | for(j = 0; j < 2; j++) { 201 | nfil_m.x[j] = orig_x[j] + dR[XX]*small_dim*Gpoint[gpoints][i]; 202 | nfil_m.y[j] = orig_y[j] + dR[YY]*small_dim*Gpoint[gpoints][i]; 203 | nfil_m.z[j] = orig_z[j] + dR[ZZ]*small_dim*Gpoint[gpoints][i]; 204 | } 205 | sum += Gweight[gpoints][i]*exact_mutual(&nfil_j, &nfil_m, whperp, 206 | nx_j, ny_j, ndeg_j, ndeg_m); 207 | } 208 | 209 | return sum/2.0; 210 | } 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | -------------------------------------------------------------------------------- /src/fasthenry/makeMakefile.c: -------------------------------------------------------------------------------- 1 | /* this makes the makefile I want by brute force since the IBMs lack an 2 | important feature */ 3 | 4 | #include 5 | #include 6 | #include 7 | #define MAXLINE 10000 8 | 9 | char *getoneline(); 10 | 11 | main(argc, argv) 12 | int argc; 13 | char *argv[]; 14 | { 15 | 16 | char *line[2], name[1000], nameroot[1000]; 17 | char linebeg[2][MAXLINE]; 18 | char dir[2][50], depend[2][1000]; 19 | int numlines = 2; 20 | int skip, i; 21 | 22 | line[0] = linebeg[0]; 23 | line[1] = linebeg[1]; 24 | strcpy(line[0],getoneline(stdin)); 25 | strcpy(line[1],getoneline(stdin)); 26 | if (line[0] == NULL || line[1] == NULL) { 27 | fprintf(stderr, "First line: .o files in DIR\nSecond line: .o files in MUL\n"); 28 | exit(1); 29 | } 30 | 31 | remove_returns(line[0]); 32 | remove_returns(line[1]); 33 | 34 | fprintf(stdout, "CFLAGS = -O -DFOUR\n"); 35 | fprintf(stdout, "DIR = .\n"); 36 | fprintf(stdout, "MUL = $(DIR)/MattMulti\n"); 37 | fprintf(stdout, "HEADER = $(DIR)/induct.h $(DIR)/cmplx.h $(DIR)/resusage.h\n"); 38 | fprintf(stdout, "MULHEAD = $(MUL)/mulStruct.h $(MUL)/mulGlobal.h $(MUL)/patran.h\n"); 39 | strcpy(dir[0],"$(DIR)"); 40 | strcpy(dir[1],"$(MUL)"); 41 | strcpy(depend[0], "$(HEADER) $(MULHEAD)"); 42 | strcpy(depend[1], "$(MULHEAD)"); 43 | 44 | fprintf(stdout, "fasthenry:\t%s %s\n",linebeg[0], linebeg[1]); 45 | fprintf(stdout, "\t$(CC) -o fasthenry $(CFLAGS) %s %s -lm\n", 46 | linebeg[0], linebeg[1]); 47 | 48 | for(i = 0; i < numlines; i++) 49 | while(notblankline(line[i])) { 50 | if (sscanf(line[i],"%s%n",name,&skip) == 1) { 51 | get_root(name, nameroot); 52 | fprintf(stdout,"%s.o:\t%s/%s.c %s\n", 53 | nameroot,dir[i],nameroot,depend[i]); 54 | fprintf(stdout,"\t$(CC) $(CFLAGS) -c %s/%s.c\n\n",dir[i],nameroot); 55 | } 56 | else { 57 | fprintf(stderr,"Huh? Rest of line: %s\n",line[i]); 58 | exit(1); 59 | } 60 | line[i] += skip; 61 | } 62 | 63 | } 64 | 65 | 66 | char *getoneline(fp) 67 | FILE *fp; 68 | { 69 | static char line[MAXLINE] = { '\0' }; 70 | char *retchar; 71 | 72 | do { 73 | retchar = fgets(line, MAXLINE, fp); 74 | } while(retchar != NULL && !notblankline(line)); 75 | 76 | if (retchar != NULL && strlen(line) == MAXLINE - 1) 77 | fprintf(stderr,"Warning: line may be too long:\n%s\n",line); 78 | 79 | if (retchar == NULL) 80 | return NULL; 81 | else 82 | return line; 83 | } 84 | 85 | int notblankline(string) 86 | char *string; 87 | { 88 | while( *string!='\0' && isspace(*string)) 89 | string++; 90 | 91 | if (*string == '\0') return 0; 92 | else return 1; 93 | } 94 | 95 | get_root(src, dest) 96 | char *src, *dest; 97 | { 98 | 99 | while(*src != '.' && *src != '\0') 100 | *dest++ = *src++; 101 | 102 | *dest = '\0'; 103 | if (*src != '.') { 104 | fprintf(stderr, "Bad .o name\n"); 105 | } 106 | } 107 | 108 | remove_returns(src) 109 | char *src; 110 | { 111 | while(*src != '\0') { 112 | if (*src == '\n') 113 | *src = ' '; 114 | src++; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/fasthenry/mulDo.c: -------------------------------------------------------------------------------- 1 | /* # ***** sort to /src/main 2 | # ***** */ 3 | #include "mulGlobal.h" 4 | 5 | #if OPCNT == ON 6 | static directops=0, upops=0, downops=0, evalops=0, evaldops=0, evalmops=0; 7 | #endif 8 | 9 | /* 10 | Compute the direct piece. 11 | */ 12 | mulDirect(sys) 13 | ssystem *sys; 14 | { 15 | int i, j, k, dsize, *is_dummy, *is_dielec; 16 | double pc, *p, *q, *qn, *pn, **mat; 17 | cube *nextc; 18 | 19 | /* Assumes the potential vector has been zero'd!!!! */ 20 | for(nextc=sys->directlist; nextc != NULL; nextc = nextc->dnext) { 21 | dsize = nextc->directnumeles[0]; /* Equals number of charges. */ 22 | q = nextc->directq[0]; 23 | p = nextc->eval; 24 | is_dummy = nextc->nbr_is_dummy[0]; 25 | is_dielec = nextc->is_dielec; 26 | /* Inside Cube piece. */ 27 | mat = nextc->directmats[0]; 28 | for(j = dsize - 1; j >= 0; j--) { 29 | #if NUMDPT == 2 30 | if(is_dielec[j]) continue; 31 | #endif 32 | for(k = dsize - 1; k >= 0; k--) { 33 | if(!is_dummy[k]) p[j] += mat[j][k] * q[k]; 34 | #if OPCNT == ON 35 | directops++; 36 | #endif 37 | } 38 | } 39 | /* Through all nearest nbrs. */ 40 | for(i=nextc->directnumvects - 1; i > 0; i--) { 41 | mat = nextc->directmats[i]; 42 | qn = nextc->directq[i]; 43 | is_dummy = nextc->nbr_is_dummy[i]; 44 | for(j = dsize - 1; j >= 0; j--) { 45 | #if NUMDPT == 2 46 | if(is_dielec[j]) continue; 47 | #endif 48 | for(k = nextc->directnumeles[i] - 1; k >= 0; k--) { 49 | if(!is_dummy[k]) p[j] += mat[j][k] * qn[k]; 50 | #if OPCNT == ON 51 | directops++; 52 | #endif 53 | } 54 | } 55 | } 56 | } 57 | } 58 | 59 | /* 60 | Block diagonal or Overlapped Preconditioner. 61 | */ 62 | mulPrecond(sys, type) 63 | ssystem *sys; 64 | int type; 65 | { 66 | int i, j, k, dsize, *is_dummy; 67 | double pc, *p, *q, *qn, *pn, **mat; 68 | cube *nc; 69 | 70 | if(type == BD) { 71 | for(nc=sys->precondlist; nc != NULL; nc = nc->pnext) { 72 | solve(nc->precond, nc->prevectq, nc->prevectq, nc->presize); 73 | } 74 | } 75 | else { 76 | /* Assumes the potential vector has been zero'd!!!! */ 77 | for(nc=sys->directlist; nc != NULL; nc = nc->dnext) { 78 | dsize = nc->directnumeles[0]; /* Equals number of charges. */ 79 | q = nc->directq[0]; 80 | p = nc->eval; 81 | is_dummy = nc->nbr_is_dummy[0]; 82 | /* Inside Cube piece. */ 83 | mat = nc->precondmats[0]; 84 | for(j = dsize - 1; j >= 0; j--) { 85 | for(k = dsize - 1; k >= 0; k--) { 86 | if(!is_dummy[k]) p[j] += mat[j][k] * q[k]; 87 | } 88 | } 89 | /* Through all nearest nbrs. */ 90 | for(i=nc->directnumvects - 1; i > 0; i--) { 91 | mat = nc->precondmats[i]; 92 | is_dummy = nc->nbr_is_dummy[i]; 93 | if(mat != NULL) { 94 | qn = nc->directq[i]; 95 | for(j = dsize - 1; j >= 0; j--) { 96 | for(k = nc->directnumeles[i] - 1; k >= 0; k--) { 97 | if(!is_dummy[k]) p[j] += mat[j][k] * qn[k]; 98 | } 99 | } 100 | } 101 | } 102 | } 103 | /* Copy ps back to qs and zero ps. */ 104 | for(nc=sys->directlist; nc != NULL; nc = nc->dnext) { 105 | dsize = nc->directnumeles[0]; /* Equals number of charges. */ 106 | q = nc->directq[0]; 107 | p = nc->eval; 108 | for(j = dsize - 1; j >= 0; j--) { 109 | q[j] = p[j]; 110 | p[j] = 0.0; 111 | } 112 | } 113 | } 114 | } 115 | 116 | 117 | /* 118 | Loop through upward pass. 119 | */ 120 | mulUp(sys) 121 | ssystem *sys; 122 | { 123 | int i, j, k, l; 124 | int msize; 125 | double *multi, *rhs, **mat; 126 | cube *nextc; 127 | 128 | if(sys->depth < 2) return; /* ret if upward pass not possible/worth it */ 129 | 130 | /* Through all the depths, starting from the bottom and not doing top. */ 131 | for(i = sys->depth; i > 0; i--) { 132 | /* Through all the cubes at depth. */ 133 | for(nextc=sys->multilist[i]; nextc != NULL; nextc = nextc->mnext) { 134 | msize = nextc->multisize; 135 | multi = nextc->multi; 136 | for(j=0; j < msize; j++) multi[j] = 0; 137 | /* Through all the nonempty children of cube. */ 138 | for(j=nextc->upnumvects - 1; j >= 0; j--) { 139 | mat = nextc->upmats[j]; 140 | rhs = nextc->upvects[j]; 141 | for(k = nextc->upnumeles[j] - 1; k >= 0; k--) { 142 | for(l = msize - 1; l >= 0; l--) { 143 | multi[l] += mat[l][k] * rhs[k]; 144 | #if OPCNT == ON 145 | upops++; 146 | #endif 147 | } 148 | } 149 | } 150 | } 151 | } 152 | } 153 | 154 | 155 | /* 156 | evaluation pass - use after mulDown or alone. 157 | */ 158 | void mulEval(sys) 159 | ssystem *sys; 160 | { 161 | int i, j, k, size, *is_dielec; 162 | cube *nc; 163 | double *eval, **mat, *vec; 164 | 165 | if(sys->depth < 2) return; /* ret if upward pass not possible/worth it */ 166 | 167 | for(nc = sys->directlist; nc != NULL; nc = nc->dnext) { 168 | size = nc->upnumeles[0]; /* number of eval pnts (chgs) in cube */ 169 | eval = nc->eval; /* vector of evaluation pnt potentials */ 170 | is_dielec = nc->is_dielec; /* vector of DIELEC/BOTH panel flags */ 171 | 172 | /* do the evaluations */ 173 | for(i = nc->evalnumvects - 1; i >= 0; i--) { 174 | if (nc->eval_isQ2P[i] == sys->DirectEval) { /* added 12/92 MK */ 175 | mat = nc->evalmats[i]; 176 | vec = nc->evalvects[i]; 177 | for(j = size - 1; j >= 0; j--) { 178 | #if NUMDPT == 2 179 | if(is_dielec[j]) continue; 180 | #endif 181 | for(k = nc->evalnumeles[i] - 1; k >= 0; k--) { 182 | eval[j] += mat[j][k] * vec[k]; 183 | #if OPCNT == ON 184 | evalops++; 185 | if (sys->DirectEval == TRUE) 186 | evaldops++; 187 | else if (sys->DirectEval == FALSE) 188 | evalmops++; 189 | else 190 | {printf("huh?"); exit(1);} 191 | #endif 192 | } 193 | } 194 | } 195 | } 196 | } 197 | } 198 | 199 | /* 200 | Loop through downward pass. 201 | */ 202 | mulDown(sys) 203 | ssystem *sys; 204 | { 205 | cube *nc; 206 | int depth, i, j, k, lsize; 207 | double **mat, *rhs, *local; 208 | 209 | if(sys->depth < 2) return; /* ret if upward pass not possible/worth it */ 210 | 211 | for(depth=2; depth <= sys->depth; depth++) { 212 | for(nc=sys->locallist[depth]; nc != NULL; nc = nc->lnext) { 213 | lsize = nc->localsize; 214 | local = nc->local; 215 | for(j=0; j < lsize; j++) local[j] = 0; 216 | /* Through all the locals for the cube. */ 217 | for(i=nc->downnumvects - 1; i >= 0; i--) { 218 | mat = nc->downmats[i]; 219 | rhs = nc->downvects[i]; 220 | for(j = lsize - 1; j >= 0; j--) { 221 | for(k = nc->downnumeles[i] - 1; k >= 0; k--) { 222 | local[j] += mat[j][k] * rhs[k]; 223 | #if OPCNT == ON 224 | downops++; 225 | #endif 226 | } 227 | } 228 | } 229 | } 230 | } 231 | } 232 | 233 | 234 | #if OPCNT == ON 235 | printops() 236 | { 237 | printf("Number of Direct Multi-Adds = %d\n", directops); 238 | printf("Number of Upward Pass Multi-Adds = %d\n", upops); 239 | printf("Number of Downward Pass Multi-Adds = %d\n", downops); 240 | printf("Number of Evaluation Pass Multi-Adds = %d\n", evalops); 241 | printf("Number of Evaluation Pass Direct Multi-Adds = %d\n", evaldops); 242 | printf("Number of Evaluation Pass Other Multi-Adds = %d\n", evalmops); 243 | printf("Total Number of Multi-Adds = %d\n", directops+upops+downops+evalops); 244 | } 245 | #endif 246 | -------------------------------------------------------------------------------- /src/fasthenry/mulGlobal.c: -------------------------------------------------------------------------------- 1 | /* # ***** sort to /src/main 2 | # ***** */ 3 | #include "mulGlobal.h" 4 | 5 | long memcount; /* allocated memory counter */ 6 | long memQ2M; /* allocated memory counters by function */ 7 | long memQ2L; 8 | long memQ2P; 9 | long memL2L; 10 | long memM2M; 11 | long memM2L; 12 | long memM2P; 13 | long memL2P; 14 | long memQ2PD; 15 | long memMSC; 16 | long memIND; 17 | 18 | #ifdef MATTDEBUG 19 | long membins[1001]; 20 | #endif 21 | 22 | /* 23 | global timer and operation count accumulators 24 | */ 25 | double prectime; /* time spent doing back solve for prec */ 26 | double prsetime; /* time spent calculating preconditioner */ 27 | double conjtime; /* time spent doing everything but A*q */ 28 | double dirtime; /* time for direct part of P*q */ 29 | double multime; /* time for multipole part of P*q */ 30 | double uptime; /* time in mulUp(), upward pass */ 31 | double downtime; /* time in mulDown(), downward pass */ 32 | double evaltime; /* time in mulEval(), evaluation pass */ 33 | int fulldirops; /* total direct operations - DIRSOL=ON only */ 34 | double lutime; /* factorization time DIRSOL=ON only */ 35 | double fullsoltime; /* time for solves, DIRSOL=ON only */ 36 | int fullPqops; /* total P*q ops using P on disk - EXPGCR=ON */ 37 | 38 | /* 39 | misc global 40 | */ 41 | NAME *start_name = NULL; /* conductor name linked list head */ 42 | NAME *current_name; /* conductor name linked list tail */ 43 | NAME *start_name_this_time; /* cond name list for the current surface */ 44 | char *kill_name_list; /* cond names whose columns are omitted */ 45 | ITER *kill_num_list; /* cond numbers whose columns are omitted */ 46 | char *kinp_name_list; /* cond names omitted from input */ 47 | ITER *kinp_num_list; /* cond numbers omitted from input */ 48 | char *qpic_name_list; /* cond column names that get q picture */ 49 | ITER *qpic_num_list; /* cond column names that get q picture */ 50 | char *kq_name_list; /* cond names removed from q picture */ 51 | ITER *kq_num_list; /* cond numbers removed from q picture */ 52 | 53 | int num_dielec_panels; /* number of dielectric interface panels */ 54 | int num_both_panels; /* number of thin-cond-on-dielec-i/f panels */ 55 | int num_cond_panels; /* number of thick conductor panels */ 56 | int up_size; /* sum of above three (real panels) */ 57 | int num_dummy_panels; /* number of off-panel eval pnt panels */ 58 | int eval_size; /* sum of above two (total panel structs) */ 59 | double iter_tol; /* iterative loop tolerence on ||r|| */ 60 | 61 | /* 62 | command line option variables - all have to do with ps file dumping 63 | */ 64 | #if CAPVEW == ON /* eliminate messy globals if not needed */ 65 | char **argvals; /* copy of argv */ 66 | int argcnt; /* copy of argc */ 67 | int s_; /* TRUE => insert showpage in .ps file(s) */ 68 | int n_; /* TRUE => number faces with input ordering */ 69 | int g_; /* TRUE => dump depth graph and quit */ 70 | int c_; /* TRUE => print command line on .ps file(s) */ 71 | int x_; /* TRUE => axes have been specified */ 72 | int k_; 73 | int rc_; /* TRUE => rm conductors in list from pic */ 74 | int rd_; /* TRUE => remove all dielec i/fs from pic */ 75 | int rb_; /* TRUE => rm BOTH-types in list from pic */ 76 | int q_; /* TRUE => dump shaded plots of q_iter iters */ 77 | int rk_; /* TRUE => rm chg den key in -q plots */ 78 | int m_; /* TRUE => switch to plot gen mode */ 79 | int f_; /* TRUE => don't fill faces (no hidden l rm) */ 80 | int dd_; /* TRUE => dump ttl charges to .ps pictures */ 81 | double view[3]; /* absolute view point of 3D geometry */ 82 | double moffset[2]; /* image offset from lower left corner */ 83 | double elevation; /* elevation of view rel to center of object */ 84 | double azimuth; /* azimuth of view rel to center of object */ 85 | double rotation; /* image rotation, degrees */ 86 | double distance; /* relative distance from center (#radii-1) */ 87 | double linewd; /* postscript line width */ 88 | double scale; /* over all image scale factor */ 89 | double axeslen; /* axes lengths in 3D distance */ 90 | double axes[10][2][3]; /* the 2d image of the coordinate axes */ 91 | int up_axis; /* X,Y or Z => which axis is vertical in pic */ 92 | char *line_file; /* pointer to .fig superimposed line file */ 93 | char *ps_file_base; /* pointer to base name for .ps files */ 94 | #endif 95 | -------------------------------------------------------------------------------- /src/fasthenry/patran.h: -------------------------------------------------------------------------------- 1 | /* # ***** sort to /src/header 2 | # ***** */ 3 | /*************************************************************************** 4 | 5 | This is the header file for patran.c. 6 | 7 | Written by Songmin Kim, July 24, 1990. 8 | 9 | ***************************************************************************/ 10 | /* Refer to Chapter 29, Neutral System, of PATRAN manual for explanation. 11 | The variable names are identical to those that appear in the manual. */ 12 | 13 | typedef struct node { 14 | int ID; 15 | double coord[3]; 16 | } NODE; 17 | 18 | typedef struct element { 19 | int ID, shape, num_nodes; 20 | int corner[4]; 21 | } ELEMENT; 22 | 23 | typedef struct grid { 24 | int ID, *equiv_ID, number_equiv_grids; 25 | double coord[3]; 26 | struct grid *next, *prev; 27 | } GRID; 28 | 29 | typedef struct cfeg { 30 | int ID, NELS, LPH, LPH_ID, LSHAPE, NODES, ICONF, NDIM; 31 | struct cfeg *next, *prev; 32 | int *element_list; 33 | } CFEG; 34 | 35 | typedef struct patch { 36 | int ID, corner[4], conductor_ID; 37 | struct patch *next, *prev; 38 | } PATCH; 39 | 40 | typedef struct sm_patch { 41 | int ID, conductor_ID; 42 | struct sm_patch *next; 43 | } SM_PATCH; 44 | 45 | /* intermediate name struct; used for compatability with patran i/f */ 46 | typedef struct name { 47 | char *name; 48 | SM_PATCH *patch_list; 49 | struct name *next; 50 | } NAME; 51 | 52 | /* used to build linked list of conductor names */ 53 | struct Name { 54 | char *name; 55 | struct Name *next; 56 | struct Name *alias_list; 57 | }; 58 | typedef struct Name Name; 59 | 60 | /* used to make linked lists of iteration or conductor #s */ 61 | struct ITER { 62 | int iter; 63 | struct ITER *next; 64 | }; 65 | typedef struct ITER ITER; 66 | -------------------------------------------------------------------------------- /src/fasthenry/regurgitate.c: -------------------------------------------------------------------------------- 1 | /* This regurgitates the input file to the output with some 2 | translations and replications if desired */ 3 | /* It outputs in SI units only */ 4 | 5 | #include "induct.h" 6 | 7 | regurgitate(indsys) 8 | SYS *indsys; 9 | { 10 | /* functions to shift coordinates */ 11 | void translate(), reflect_x(), reflect_y(), reflect_origin(), do_nothing(); 12 | 13 | /* spit out geometries and .externals */ 14 | spit(indsys, do_nothing, ""); 15 | 16 | /* 17 | spit(indsys, reflect_x, "_X"); 18 | spit(indsys, reflect_y, "_Y"); 19 | spit(indsys, reflect_origin, "_XY"); 20 | */ 21 | 22 | do_end_stuff(indsys); 23 | } 24 | 25 | do_end_stuff(indsys) 26 | SYS *indsys; 27 | { 28 | fprintf(stdout, ".freq fmin=%lg fmax=%lg ndec=%lg\n",indsys->fmin, 29 | indsys->fmax, 1.0/indsys->logofstep); 30 | 31 | fprintf(stdout, ".end\n"); 32 | 33 | } 34 | 35 | 36 | 37 | static double delta_x, delta_y, delta_z; 38 | 39 | /* set amount of translation for translate() */ 40 | set_translate(x, y, z) 41 | double x, y, z; 42 | { 43 | delta_x = x; 44 | delta_y = y; 45 | delta_z = z; 46 | } 47 | 48 | void translate(x,y,z,new_x, new_y, new_z) 49 | double x,y,z,*new_x, *new_y, *new_z; 50 | { 51 | *new_x = x + delta_x; 52 | *new_y = y + delta_y; 53 | *new_z = z + delta_z; 54 | } 55 | 56 | /* reflect about x axis (negate y) */ 57 | void reflect_x(x,y,z,new_x, new_y, new_z) 58 | double x,y,z,*new_x, *new_y, *new_z; 59 | { 60 | *new_x = x; 61 | *new_y = -y; 62 | *new_z = z; 63 | } 64 | 65 | /* reflect about y axis (negate x) */ 66 | 67 | void reflect_y(x,y,z,new_x, new_y, new_z) 68 | double x,y,z,*new_x, *new_y, *new_z; 69 | { 70 | *new_x = -x; 71 | *new_y = y; 72 | *new_z = z; 73 | } 74 | 75 | /* reflect about origin (negate x and y) */ 76 | 77 | void reflect_origin(x,y,z,new_x, new_y, new_z) 78 | double x,y,z,*new_x, *new_y, *new_z; 79 | { 80 | *new_x = -x; 81 | *new_y = -y; 82 | *new_z = z; 83 | } 84 | 85 | void do_nothing(x,y,z,new_x, new_y, new_z) 86 | double x,y,z,*new_x, *new_y, *new_z; 87 | { 88 | *new_x = x; 89 | *new_y = y; 90 | *new_z = z; 91 | } 92 | 93 | 94 | /* spit out nodes and segments and .externals */ 95 | 96 | spit(indsys, new_coords, suffix) 97 | SYS *indsys; 98 | void (*new_coords)(); 99 | char *suffix; 100 | { 101 | 102 | NODES *node; 103 | NODELIST *nodel; 104 | SEGMENT *seg; 105 | GROUNDPLANE *gp; 106 | EXTERNAL *ext; 107 | int i; 108 | double x,y,z; 109 | 110 | /* do nodes */ 111 | fprintf(stdout, "* NODES for %s\n",suffix); 112 | for(node = indsys->nodes; node != NULL; node = node->next) { 113 | if (node->type == NORMAL) { 114 | new_coords(node->x, node->y, node->z, &x, &y, &z); 115 | fprintf(stdout, "%s%s x=%lg y=%lg z=%lg\n", node->name, suffix, x, y, z); 116 | } 117 | } 118 | 119 | /*do segments */ 120 | fprintf(stdout, "* Segments for %s\n",suffix); 121 | for(seg = indsys->segment; seg != NULL; seg = seg->next) { 122 | if (seg->type == NORMAL) { 123 | fprintf(stdout, "%s%s %s%s %s%s w=%lg h=%lg nhinc=%d nwinc=%d rw=%lg rh=%lg sigma=%lg", 124 | seg->name, suffix, seg->node[0]->name, suffix, 125 | seg->node[1]->name, suffix, seg->width, 126 | seg->height, seg->hinc, 127 | seg->winc, seg->r_width, seg->r_height, seg->sigma); 128 | if (seg->widthdir != NULL) 129 | fprintf(stdout, " wx=%lg wy=%lg wz=%lg \n", seg->widthdir[XX], 130 | seg->widthdir[YY], seg->widthdir[ZZ]); 131 | else 132 | fprintf(stdout, "\n"); 133 | } 134 | } 135 | 136 | /*do planes */ 137 | fprintf(stdout, "* Planes for %s\n",suffix); 138 | for(gp = indsys->planes; gp != NULL; gp = gp->next) { 139 | 140 | if (is_nonuni_gp(gp)) { 141 | fprintf(stdout, "Nonuniform planes not supported for regurgitation at this time!\n"); 142 | continue; 143 | } 144 | 145 | fprintf(stdout, "%s%s \n",gp->name, suffix); 146 | i = 0; 147 | new_coords(gp->x[i], gp->y[i], gp->z[i], &x, &y, &z); 148 | fprintf(stdout, "+ x1=%lg y1=%lg z1=%lg\n",x, y, z); 149 | 150 | i = 1; 151 | new_coords(gp->x[i], gp->y[i], gp->z[i], &x, &y, &z); 152 | fprintf(stdout, "+ x2=%lg y2=%lg z2=%lg\n",x, y, z); 153 | 154 | i = 2; 155 | new_coords(gp->x[i], gp->y[i], gp->z[i], &x, &y, &z); 156 | fprintf(stdout, "+ x3=%lg y3=%lg z3=%lg\n",x, y, z); 157 | 158 | fprintf(stdout, "+ seg1=%d seg2=%d\n", gp->seg1, gp->seg2); 159 | fprintf(stdout, "+ thick=%lg ", gp->thick); 160 | fprintf(stdout, "segwid1=%lg segwid2=%lg ", gp->segwid1, gp->segwid2); 161 | fprintf(stdout, "sigma=%lg\n", gp->sigma); 162 | 163 | for(nodel = gp->usernode_coords; nodel != NULL; nodel=nodel->next) { 164 | fprintf(stdout, "+ %s (%lg, %lg, %lg)\n", nodel->name, nodel->x, 165 | nodel->y, nodel->z); 166 | } 167 | 168 | if (gp->list_of_holes != NULL) 169 | fprintf(stdout, "Holes cannot be regurgitated at this time!\n"); 170 | 171 | } 172 | 173 | /* do .equivs */ 174 | fprintf(stdout, "* .equivs for %s\n",suffix); 175 | for(node = indsys->nodes; node != NULL; node = node->next) { 176 | if (node->type == NORMAL && node != getrealnode(node)) { 177 | fprintf(stdout, ".equiv %s%s %s%s\n", node->name, suffix, 178 | getrealnode(node)->name, suffix); 179 | } 180 | } 181 | 182 | /* do .externals */ 183 | 184 | for(ext = indsys->externals; ext != NULL; ext = ext->next) { 185 | fprintf(stdout, ".external %s%s %s%s ", 186 | getrealnode(ext->source->node[0])->name, suffix, 187 | getrealnode(ext->source->node[1])->name, suffix); 188 | if (strcmp(ext->portname,"") != 0) 189 | fprintf(stdout, "%s%s\n",ext->portname, suffix); 190 | else 191 | fprintf(stdout, "\n"); 192 | } 193 | } 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /src/fasthenry/resusage.h: -------------------------------------------------------------------------------- 1 | /* # ***** sort to /src/header 2 | # ***** */ 3 | /* header where rusage and time structs are defined */ 4 | 5 | #ifdef FOUR 6 | #define NOTOTHER 1 7 | #include 8 | #include 9 | struct rusage timestuff; 10 | #endif 11 | 12 | #ifdef FIVE 13 | #define NOTOTHER 1 14 | #include 15 | #include 16 | #include 17 | struct tms timestuff; 18 | #endif 19 | 20 | /* define macros for time and resident memory usage checks */ 21 | 22 | static double dtime = 0.0; 23 | static long sectime, utime; 24 | 25 | #ifdef NOTOTHER 26 | 27 | #ifdef FOUR /* 4.2,3BSD (tested: Sun4, IBM6000, DEC5000) */ 28 | #define starttimer getrusage(RUSAGE_SELF, ×tuff); \ 29 | sectime = timestuff.ru_utime.tv_sec; \ 30 | utime = timestuff.ru_utime.tv_usec 31 | #define stoptimer getrusage(RUSAGE_SELF, ×tuff); \ 32 | dtime = (double)(timestuff.ru_utime.tv_sec - sectime) \ 33 | + 1.0e-6*(double)(timestuff.ru_utime.tv_usec - utime) 34 | #define DUMPRSS /* */ 35 | #endif /* FOUR */ 36 | 37 | #ifdef FIVE /* for System V (tested: HP300) */ 38 | #define starttimer times(×tuff); \ 39 | utime = timestuff.tms_utime 40 | #define stoptimer times(×tuff); \ 41 | dtime = (timestuff.tms_utime)-utime; \ 42 | dtime /= HZ 43 | #define DUMPRSS /* */ 44 | #endif /* FIVE */ 45 | 46 | #else /* default - no timers */ 47 | 48 | #define starttimer /* */ 49 | #define stoptimer /* */ 50 | #define DUMPRSS /* */ 51 | 52 | #endif /* NOTOTHER */ 53 | -------------------------------------------------------------------------------- /src/fasthenry/savemat_mod.c: -------------------------------------------------------------------------------- 1 | /* 2 | * savemat - C language routine to save a matrix in a MAT-file. 3 | * 4 | * We recommend that you use this routine, and its companion loadmat.c, 5 | * for all writing and reading of MAT-files. These routines implement 6 | * "access methods" for MAT-files. By using these routines, instead 7 | * of writing your own code to directly access the MAT-file format, 8 | * you will be unaffected by any changes that may be made to the MAT-file 9 | * structure at a future date. 10 | * 11 | * Here is an example that uses 'savemat' to save two matrices to disk, 12 | * the second of which is complex: 13 | * 14 | * FILE *fp; 15 | * double xyz[1000], ar[1000], ai[1000]; 16 | * fp = fopen("foo.mat","wb"); 17 | * savemat(fp, 2000, "xyz", 2, 3, 0, xyz, (double *)0); 18 | * savemat(fp, 2000, "a", 5, 5, 1, ar, ai); 19 | * fclose(fp); 20 | * 21 | * Author J.N. Little 11-3-86 22 | * Revised 7-23-91 to support ANSI-C 23 | */ 24 | #include 25 | // Enrico 26 | #include 27 | 28 | #ifdef ALPHA 29 | typedef struct { 30 | int type; /* type */ 31 | int mrows; /* row dimension */ 32 | int ncols; /* column dimension */ 33 | int imagf; /* flag indicating imag part */ 34 | int namlen; /* name length (including NULL) */ 35 | } Fmatrix; 36 | #else 37 | typedef struct { 38 | long type; /* type */ 39 | long mrows; /* row dimension */ 40 | long ncols; /* column dimension */ 41 | long imagf; /* flag indicating imag part */ 42 | long namlen; /* name length (including NULL) */ 43 | } Fmatrix; 44 | #endif 45 | 46 | #ifdef __STDC__ 47 | void savemat(FILE *fp, int type, char *pname, int mrows, int ncols, 48 | int imagf, double *preal, double *pimag) 49 | #else 50 | void savemat(fp, type, pname, mrows, ncols, imagf, preal, pimag) 51 | FILE *fp; /* File pointer */ 52 | int type; /* Type flag: Normally 0 for PC, 1000 for Sun, Mac, */ 53 | /* Apollo, and other Motorola format, */ 54 | /* 2000 for VAX D-float, 3000 for VAX G-float, and */ 55 | /* 4000 for CRAY */ 56 | /* Add 1 for text variables, 2 for sparse matrices */ 57 | /* See LOAD in reference section of guide for more info.*/ 58 | char *pname; /* pointer to matrix name */ 59 | int mrows; /* row dimension */ 60 | int ncols; /* column dimension */ 61 | int imagf; /* imaginary flag */ 62 | double *preal; /* pointer to real data */ 63 | double *pimag; /* pointer to imag data */ 64 | #endif 65 | { 66 | Fmatrix x; 67 | int mn; 68 | 69 | x.type = type; 70 | x.mrows = mrows; 71 | x.ncols = ncols; 72 | x.imagf = imagf; 73 | x.namlen = strlen(pname) + 1; 74 | mn = x.mrows * x.ncols; 75 | 76 | fwrite(&x, sizeof(Fmatrix), 1, fp); 77 | fwrite(pname, sizeof(char), (int)x.namlen, fp); 78 | fwrite(preal, sizeof(double), mn, fp); 79 | if (imagf) { 80 | fwrite(pimag, sizeof(double), mn, fp); 81 | } 82 | } 83 | 84 | /* 85 | MODIFIED version of above: added wr_flag to allow multiple writes 86 | to same matrix 87 | wr_flag = 0 => open, print header (like old matlab setup) 88 | wr_flag = 1 => update, print without header 89 | Doesn't work for complex. For complex, full real part must precede 90 | full imaginary. 91 | */ 92 | #ifdef __STDC__ 93 | void savemat_mod(FILE *fp, int type, char *pname, int mrows, int ncols, 94 | int imagf, double *preal, double *pimag, int wr_flag, int mn) 95 | #else 96 | void savemat_mod(fp, type, pname, mrows, ncols, imagf, preal, pimag, 97 | wr_flag, mn) 98 | FILE *fp; /* File pointer */ 99 | int type; /* Type flag: Normally 0 for PC, 1000 for Sun, Mac, */ 100 | /* Apollo, and other Motorola format, */ 101 | /* 2000 for VAX D-float, 3000 for VAX G-float, and */ 102 | /* 4000 for CRAY */ 103 | /* Add 1 for text variables, 2 for sparse matrices */ 104 | /* See LOAD in reference section of guide for more info.*/ 105 | char *pname; /* pointer to matrix name */ 106 | int mrows; /* row dimension */ 107 | int ncols; /* column dimension */ 108 | int imagf; /* imaginary flag */ 109 | double *preal; /* pointer to real data */ 110 | double *pimag; /* pointer to imag data */ 111 | int wr_flag; /* 0 for open, 1 to add to matrix */ 112 | int mn; /* real #entries, this dump only */ 113 | #endif 114 | { 115 | Fmatrix x; 116 | 117 | if(wr_flag == 0) { 118 | x.type = type; 119 | x.mrows = mrows; 120 | x.ncols = ncols; 121 | x.imagf = imagf; 122 | x.namlen = strlen(pname) + 1; 123 | 124 | fwrite(&x, sizeof(Fmatrix), 1, fp); 125 | fwrite(pname, sizeof(char), (int)x.namlen, fp); 126 | } 127 | fwrite(preal, sizeof(double), mn, fp); 128 | /* if (imagf) { 129 | fwrite(pimag, sizeof(double), mn, fp); 130 | } 131 | */ 132 | } 133 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/MAKE.COM: -------------------------------------------------------------------------------- 1 | $ def lnk$library sys$library:vaxcrtl.olb 2 | $ cc spAllocate.c 3 | $ cc spBuild.c 4 | $ cc spCompat.c 5 | $ cc spFactor.c 6 | $ cc spFortran.c 7 | $ cc spOutput.c 8 | $ cc spSolve.c 9 | $ cc spTest.c 10 | $ cc spUtils.c 11 | $ library/create/object sparse.olb - 12 | spAllocate, - 13 | spBuild, - 14 | spCompat, - 15 | spFactor, - 16 | spFortran, - 17 | spOutput, - 18 | spSolve, - 19 | spUtils 20 | $ link/exe=sparse spTest.obj, sparse.olb/library 21 | $ sparse :== $$disk2:[kundert.sparse]sparse.exe 22 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sparse1.3 2 | # 3 | # Ken Kundert 4 | # UC Berkeley 5 | # 6 | CFLAGS = -O -m64 7 | LINTFLAGS = -lc -lm 8 | SHELL = /bin/sh 9 | CC = cc 10 | 11 | HFILES = spConfig.h spDefs.h spMatrix.h 12 | CFILES = spAllocate.c spBuild.c spFactor.c spOutput.c spSolve.c spUtils.c \ 13 | spCompat.c spFortran.c 14 | OFILES = spAllocate.o spBuild.o spFactor.o spOutput.o spSolve.o spUtils.o \ 15 | spCompat.o spFortran.o 16 | LIBRARY = sparse.a 17 | DESTINATION = sparse 18 | TESTC = spTest.c 19 | TESTO = spTest.o 20 | 21 | SOURCE = $(HFILES) $(CFILES) 22 | 23 | #$(DESTINATION) : $(LIBRARY) $(TESTO) 24 | # $(CC) $(CFLAGS) -o $(DESTINATION) $(TESTO) $(LIBRARY) -lm 25 | 26 | $(LIBRARY) : $(OFILES) 27 | ar r $(LIBRARY) $? 28 | ranlib $(LIBRARY) 29 | 30 | spice : $(LIBRARY) spSMP.o 31 | cp $(LIBRARY) ../SMP.a 32 | ar r ../SMP.a spSMP.o 33 | ranlib ../SMP.a 34 | 35 | lint : 36 | @lint $(LINTFLAGS) $(CFILES) $(TESTC) | grep -v "but never used" 37 | 38 | clean : 39 | rm -f $(OFILES) $(LIBRARY) $(TESTO) $(DESTINATION) spSMP.o core 40 | 41 | touch : 42 | touch -c $(OFILES) $(LIBRARY) 43 | ranlib $(LIBRARY) 44 | 45 | tags : $(SOURCE) $(TESTC) 46 | ctags -t -w $(SOURCE) $(TESTC) 47 | 48 | $(OFILES) : $(HFILES) 49 | #$(TESTO) : $(HFILES) 50 | spSMP.o : spMatrix.h ../include/SMPdefs.h 51 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/Makefile.default: -------------------------------------------------------------------------------- 1 | # Makefile for Sparse1.3 2 | # 3 | # Ken Kundert 4 | # UC Berkeley 5 | # 6 | CFLAGS = -O 7 | LINTFLAGS = -lc -lm 8 | SHELL = /bin/sh 9 | CC = cc 10 | 11 | HFILES = spConfig.h spDefs.h spMatrix.h 12 | CFILES = spAllocate.c spBuild.c spFactor.c spOutput.c spSolve.c spUtils.c \ 13 | spCompat.c spFortran.c 14 | OFILES = spAllocate.o spBuild.o spFactor.o spOutput.o spSolve.o spUtils.o \ 15 | spCompat.o spFortran.o 16 | LIBRARY = sparse.a 17 | DESTINATION = sparse 18 | TESTC = spTest.c 19 | TESTO = spTest.o 20 | 21 | SOURCE = $(HFILES) $(CFILES) 22 | 23 | #$(DESTINATION) : $(LIBRARY) $(TESTO) 24 | # $(CC) $(CFLAGS) -o $(DESTINATION) $(TESTO) $(LIBRARY) -lm 25 | 26 | $(LIBRARY) : $(OFILES) 27 | ar r $(LIBRARY) $? 28 | ranlib $(LIBRARY) 29 | 30 | spice : $(LIBRARY) spSMP.o 31 | cp $(LIBRARY) ../SMP.a 32 | ar r ../SMP.a spSMP.o 33 | ranlib ../SMP.a 34 | 35 | lint : 36 | @lint $(LINTFLAGS) $(CFILES) $(TESTC) | grep -v "but never used" 37 | 38 | clean : 39 | rm -f $(OFILES) $(LIBRARY) $(TESTO) $(DESTINATION) spSMP.o core 40 | 41 | touch : 42 | touch -c $(OFILES) $(LIBRARY) 43 | ranlib $(LIBRARY) 44 | 45 | tags : $(SOURCE) $(TESTC) 46 | ctags -t -w $(SOURCE) $(TESTC) 47 | 48 | $(OFILES) : $(HFILES) 49 | #$(TESTO) : $(HFILES) 50 | spSMP.o : spMatrix.h ../include/SMPdefs.h 51 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/Makefile.x64: -------------------------------------------------------------------------------- 1 | # Makefile for Sparse1.3 2 | # 3 | # Ken Kundert 4 | # UC Berkeley 5 | # 6 | CFLAGS = -O -m64 7 | LINTFLAGS = -lc -lm 8 | SHELL = /bin/sh 9 | CC = cc 10 | 11 | HFILES = spConfig.h spDefs.h spMatrix.h 12 | CFILES = spAllocate.c spBuild.c spFactor.c spOutput.c spSolve.c spUtils.c \ 13 | spCompat.c spFortran.c 14 | OFILES = spAllocate.o spBuild.o spFactor.o spOutput.o spSolve.o spUtils.o \ 15 | spCompat.o spFortran.o 16 | LIBRARY = sparse.a 17 | DESTINATION = sparse 18 | TESTC = spTest.c 19 | TESTO = spTest.o 20 | 21 | SOURCE = $(HFILES) $(CFILES) 22 | 23 | #$(DESTINATION) : $(LIBRARY) $(TESTO) 24 | # $(CC) $(CFLAGS) -o $(DESTINATION) $(TESTO) $(LIBRARY) -lm 25 | 26 | $(LIBRARY) : $(OFILES) 27 | ar r $(LIBRARY) $? 28 | ranlib $(LIBRARY) 29 | 30 | spice : $(LIBRARY) spSMP.o 31 | cp $(LIBRARY) ../SMP.a 32 | ar r ../SMP.a spSMP.o 33 | ranlib ../SMP.a 34 | 35 | lint : 36 | @lint $(LINTFLAGS) $(CFILES) $(TESTC) | grep -v "but never used" 37 | 38 | clean : 39 | rm -f $(OFILES) $(LIBRARY) $(TESTO) $(DESTINATION) spSMP.o core 40 | 41 | touch : 42 | touch -c $(OFILES) $(LIBRARY) 43 | ranlib $(LIBRARY) 44 | 45 | tags : $(SOURCE) $(TESTC) 46 | ctags -t -w $(SOURCE) $(TESTC) 47 | 48 | $(OFILES) : $(HFILES) 49 | #$(TESTO) : $(HFILES) 50 | spSMP.o : spMatrix.h ../include/SMPdefs.h 51 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/Makefile~: -------------------------------------------------------------------------------- 1 | # Makefile for Sparse1.3 2 | # 3 | # Ken Kundert 4 | # UC Berkeley 5 | # 6 | CFLAGS = -O 7 | LINTFLAGS = -lc -lm 8 | SHELL = /bin/sh 9 | CC = cc 10 | 11 | HFILES = spConfig.h spDefs.h spMatrix.h 12 | CFILES = spAllocate.c spBuild.c spFactor.c spOutput.c spSolve.c spUtils.c \ 13 | spCompat.c spFortran.c 14 | OFILES = spAllocate.o spBuild.o spFactor.o spOutput.o spSolve.o spUtils.o \ 15 | spCompat.o spFortran.o 16 | LIBRARY = sparse.a 17 | DESTINATION = sparse 18 | TESTC = spTest.c 19 | TESTO = spTest.o 20 | 21 | SOURCE = $(HFILES) $(CFILES) 22 | 23 | $(DESTINATION) : $(LIBRARY) $(TESTO) 24 | $(CC) $(CFLAGS) -o $(DESTINATION) $(TESTO) $(LIBRARY) -lm 25 | 26 | $(LIBRARY) : $(OFILES) 27 | ar r $(LIBRARY) $? 28 | ranlib $(LIBRARY) 29 | 30 | spice : $(LIBRARY) spSMP.o 31 | cp $(LIBRARY) ../SMP.a 32 | ar r ../SMP.a spSMP.o 33 | ranlib ../SMP.a 34 | 35 | lint : 36 | @lint $(LINTFLAGS) $(CFILES) $(TESTC) | grep -v "but never used" 37 | 38 | clean : 39 | rm -f $(OFILES) $(LIBRARY) $(TESTO) $(DESTINATION) spSMP.o core 40 | 41 | touch : 42 | touch -c $(OFILES) $(LIBRARY) 43 | ranlib $(LIBRARY) 44 | 45 | tags : $(SOURCE) $(TESTC) 46 | ctags -t -w $(SOURCE) $(TESTC) 47 | 48 | $(OFILES) : $(HFILES) 49 | $(TESTO) : $(HFILES) 50 | spSMP.o : spMatrix.h ../include/SMPdefs.h 51 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/MtrxError.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ERROR DEFINITIONS for the sparse matrix routines. 3 | * 4 | * Author: Advising professor: 5 | * Kenneth S. Kundert Alberto Sangiovanni-Vincentelli 6 | * UC Berkeley 7 | * 8 | * This file exists solely to make Sparse1.3 upward compatible 9 | * from Sparse1.2. Use of this file is not suggested for use in new 10 | * software. 11 | */ 12 | 13 | #include "spMatrix.h" 14 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/MtrxExpt.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * ERROR DEFINITIONS for the sparse matrix routines. 4 | * 5 | * Author: Advising professor: 6 | * Kenneth S. Kundert Alberto Sangiovanni-Vincentelli 7 | * UC Berkeley 8 | * 9 | * This file exists solely to make Sparse1.3 upward compatible 10 | * from Sparse1.2. Use of this file is not suggested for use in new 11 | * software. 12 | */ 13 | 14 | #include "spMatrix.h" 15 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/doc/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sparse documentation 2 | # 3 | 4 | PRINTER = -Pprado 5 | # PRINTER = -Plps40 6 | 7 | default : usersguide 8 | all : usersguide install advert 9 | 10 | usersguide : spDoc.ms 11 | tbl spDoc.ms | eqn | ptroff -ms $(PRINTER) 12 | 13 | install : install.ms 14 | ptroff -ms $(PRINTER) install.ms 15 | 16 | advert : advert.ms 17 | tbl advert.ms | ptroff -ms $(PRINTER) 18 | 19 | all-lpr : usersguide.lpr install.lpr 20 | 21 | usersguide.lpr : spDoc 22 | spDoc : spDoc.ms 23 | tbl spDoc.ms | neqn | nroff -ms | colcrt - > spDoc 24 | 25 | install.lpr : install.ms 26 | nroff -ms install.ms | colcrt - > install.lpr 27 | 28 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/doc/advert.ms: -------------------------------------------------------------------------------- 1 | .LP 2 | .po 1.5i 3 | .nr PO 1.5i 4 | .rs 5 | .ls 1 6 | .EQ 7 | delim @@ 8 | .EN 9 | 10 | .LG 11 | .LG 12 | .I 13 | .ce 2 14 | Sparse1.3 15 | .sp .1i 16 | A Sparse Linear Equation Solver 17 | .NL 18 | .NL 19 | .sp 0.25i 20 | .LG 21 | .R 22 | .ce 2 23 | .I Kenneth\ S.\ Kundert 24 | .I Alberto\ Sangiovanni-Vincentelli 25 | .NL 26 | .sp 0.25i 27 | .PP 28 | \fISparse1.3\fP is a flexible package of subroutines written in C used 29 | to quickly and accurately solve large sparse systems of linear 30 | equations. The package is able to handle arbitrary real and complex 31 | square matrix equations. Besides being able to solve linear systems, 32 | it is also able to quickly solve transposed systems, find determinants, 33 | and estimate errors due to ill-conditioning in the system of equations 34 | and instability in the computations. \fISparse\fR also provides a test 35 | program that is able read matrix equations from a file, solve them, and 36 | print useful information about the equation and its solution. 37 | .PP 38 | \fISparse1.3\fR is generally as fast or faster than other popular 39 | sparse matrix packages when solving many matrices of similar 40 | structure. \fISparse\fR does not require or assume symmetry and is 41 | able to perform numerical pivoting to avoid unnecessary error in the 42 | solution. It handles its own memory allocation, which allows the user 43 | to forgo the hassle of providing adequate memory. It also has a 44 | natural, flexible, and efficient interface to the calling program. 45 | .PP 46 | \fISparse\fR was originally written for use in circuit simulators and 47 | is particularly apt at handling node- and modified-node admittance 48 | matrices. The systems of linear generated in a circuit simulator stem 49 | from solving large systems of nonlinear equations using Newton's method 50 | and integrating large stiff systems of ordinary differential 51 | equations. However, \fISparse\fR is also suitable for other uses, one 52 | in particular is solving the very large systems of linear equations 53 | resulting from the numerical solution of partial differential 54 | equations. 55 | .PP 56 | The \fISparse1.3\fR package is currently available from the Department 57 | of Electrical Engineering and Computer Sciences of the University of 58 | California, Berkeley. It was written in the C programming language by 59 | Kenneth Kundert and versions exist for the \s-1UNIX\s+1 and 60 | \s-1VAX/VMS\s+1 operating systems. Be sure to specify the version when 61 | ordering. \fISparse1.3\fR has replaced \fISparse1.2\fR; providing 62 | greater capability and speed, and a more refined interface to the 63 | calling program. Besides the native \fISparse1.3\fR interface, two 64 | others are also provided. The first is a \fISparse1.2\fR interface, 65 | to make \fISparse1.3\fR backward compatible. The second allows 66 | \fISparse.13\fR to be called from FORTRAN programs. 67 | .PP 68 | \fISparse\fR is available for a $150.00 charge. The package includes 69 | the source code on tape, the user's guide, and a large selection of 70 | test matrices. To obtain a copy of \fISparse\fR, send a check or money 71 | order payable to the \fIRegents of the University of California\fR to: 72 | .sp 0.25 73 | .nf 74 | EECS Industrial Liaison Program 75 | 461 Cory Hall 76 | University of California 77 | Berkeley, CA 94720 78 | .LP 79 | Please allow four weeks for delivery. 80 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/doc/install.ms: -------------------------------------------------------------------------------- 1 | 2 | .LP 3 | .EQ 4 | delim $$ 5 | .EN 6 | .if t .po 1.5i 7 | .if t .nr PO 1.5i 8 | .if n .ll 7.5i 9 | .if n .nr LL 7.5i 10 | .rs 11 | .ls 1 12 | .LP 13 | .LG 14 | .LG 15 | .ce 16 | .I "Sparse1.3 Installation Notes" 17 | .NL 18 | .NL 19 | .sp .25i 20 | .LP 21 | .LG 22 | .B "General Description" 23 | .LP 24 | When \fISparse1.3\fR is loaded from tape, a directory structure will be 25 | created. The head directory is \fBsparse\fR, it contains source and 26 | various utility files. The \fBdoc\fR subdirectory contains the users 27 | manual and the \fBmatrices\fR subdirectory contains a collection of 28 | test matrices and their solution. 29 | .LP 30 | Before compiling, the file \fBspConfig.h\fR should be modified to suit 31 | your needs. Initially, I recommend turning on the DEBUG option and 32 | testing the error state of \fISparse\fR after each call to a 33 | \fISparse\fR routine. After things are working smoothly you can remove 34 | most of the error checking. Also in \fBspConfig.h\fR is the machine 35 | constants. These should be checked and modified before compiling if 36 | you are not using a \s-1VAX\s+1. 37 | .LP 38 | \fISparse\fR is compiled by using the makefile provided. This is a 39 | script file that automatically compiles each file and creates an object 40 | file for all of \fISparse\fR. Also created is an executable test 41 | program called \fBsparse\fR. 42 | .LP 43 | The \fISparse1.3\fR manual is contained in \fBspDoc\fR and 44 | \fBspDoc.ms\fR. \fBspDoc\fR is preformatted and readable on line. 45 | \fBspDoc.ms\fR is a raw \fItroff\fR file. 46 | .sp .25i 47 | .LP 48 | .B UNIX 49 | .LP 50 | The 51 | \fItar\fR 52 | program was used to write 53 | \fISparse\fR 54 | on the tape at 1600 bpi. To read it, simply type: 55 | .IP 56 | .B "tar x" 57 | .LP 58 | This will load \fISparse\fR into the current directory and 59 | automatically create the proper subdirectories. To compile, move into 60 | the \fBsparse\fR directory and type: 61 | .IP 62 | .B make 63 | .LP 64 | To create a printed manual, move into the \fBdoc\fR subdirectory and type: 65 | .IP 66 | .B "make" 67 | .LP 68 | You may have to modify the make file to indicate the name of the printer 69 | the document should be printed on. 70 | .sp .25i 71 | .LP 72 | .B 73 | VMS 74 | .LP 75 | \fISparse\fR was written on the tape in the ansi format at 1600 bpi and 76 | so is readable by \fIcopy\fR. Once the tape has been read, a series of 77 | files with nonsensical names will exist plus the file 78 | \fBUNPACK.COM\fR. This file, when executed, creates the directory 79 | hierarchy and moves the \fISparse\fR files into the proper directory 80 | and gives them the proper names. Thus, \fISparse\fR is installed with 81 | the following command sequence: 82 | .IP 83 | .B "MOUNT MFA0: SPARSE" 84 | .br 85 | .B "COPY MFA0:*.* *.*.*" 86 | .br 87 | .B "@UNPACK" 88 | .LP 89 | The file \fBUNPACK.COM\fR is then no longer needed. 90 | .LP 91 | Before compiling, it is necessary to edit the file \fBMAKE.COM\fR. The 92 | last line of the file must be changed so that the correct directory 93 | name for \fISparse\fR is given. This last line must be executed each 94 | time you relogin and plan to use the \fISparse\fR test program; you may 95 | want to copy it into \fBLOGIN.COM\fR. To compile, type: 96 | .IP 97 | .B @MAKE 98 | .sp .75i 99 | .LP 100 | .B "Good Luck ..." 101 | .LP 102 | Every effort has been made to make \fISparse\fR 103 | a pleasant program to work with. I hope you find it so. If you have 104 | any comments, criticisms, or praise, I would like to hear from you. I 105 | would be especially be interested in reports on any bugs you may find, 106 | however I cannot promise to reply. 107 | 108 | .nf 109 | Ken Kundert 110 | Dept. of Electrical Engineering and Computer Sciences 111 | University of California 112 | Berkeley, California 94720 113 | June 1988 114 | 115 | sparse@ic.berkeley.edu 116 | ucbvax!ic!sparse 117 | -------------------------------------------------------------------------------- /src/fasthenry/sparse/spRevision: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * REVISION HISTORY 4 | * 5 | * Author: 6 | * Kenneth S. Kundert 7 | * University of California at Berkeley 8 | * College of Engineering 9 | * Department of Electrical Engineering and Computer Science 10 | * 11 | * Advising professor: 12 | * Alberto Sangiovanni-Vincentelli 13 | * 14 | * 15 | * Sparse is available for a $150.00 charge. The package includes the 16 | * source code on tape, the user's guide and a paper that discusses techniques 17 | * for solving sparse systems of equations [1]. To obtain a copy of Sparse, 18 | * send a check or money order payable to the Regents of the University of 19 | * California to: 20 | * 21 | * EECS Industrial Liaison Program 22 | * Cindy Manly 23 | * University of California 24 | * Berkeley, CA 94720 25 | * 26 | * Please allow four weeks for delivery. 27 | * 28 | * The University often does not have the resources to consult with 29 | * users on how to use or modify these programs. We would, however, like 30 | * to be notified of any problems or errors in the material provided and 31 | * appreciate copies on tape of any troublesome matrices. If the program 32 | * is enhanced or converted to run on other systems, we would like to receive 33 | * copies of the modified program so that it can be made available to the 34 | * public. 35 | * 36 | * References 37 | * [1] Kenneth S. Kundert. Sparse matrix techniques. In "Circuit Analysis, 38 | * Simulation and Design," vol. 3, pt. 1, Albert E. Ruehli (editor). 39 | * North-Holland, 1986. 40 | */ 41 | 42 | /* 43 | * Copyright information. 44 | * 45 | * Copyright (c) 1985,86,87,88 46 | * by Kenneth S. Kundert and the University of California. 47 | * 48 | * Permission to use, copy, modify, and distribute this software and its 49 | * documentation for any purpose and without fee is hereby granted, provided 50 | * that the above copyright notice appear in all copies and supporting 51 | * documentation and that the authors and the University of California 52 | * are properly credited. The authors and the University of California 53 | * make no representations as to the suitability of this software for 54 | * any purpose. It is provided `as is', without express or implied warranty. 55 | */ 56 | 57 | /* 58 | * >>> Current revision information: 59 | * $Author: kundert $ 60 | * $Date: 85/12/10 21:03:02 $ 61 | * $Revision: 2.2 $ 62 | */ 63 | 64 | 65 | 66 | 67 | 68 | 69 | /* 70 | * >>> History: 71 | * Revision 1.1 January 1985 72 | * Initial release. 73 | * 74 | * Revision 1.1a 20 March 1985 75 | * Modified DecomposeMatrix() and OrderAndDecomposeMatrix() so that 76 | * the parameters Growth, PseudoCondition and LargestElement may be 77 | * given as NULL. 78 | * 79 | * Revision 1.1b 28 March 1985 80 | * Corrected a bug that caused OrderAndDecomposeMatrix() to reorder 81 | * the matrix every time it was called. Also made many of the global 82 | * variables defined in MtrxDecom.c static. 83 | * 84 | * Revision 1.2 October 1985 85 | * This new version of Sparse is meant to make it more compatible 86 | * with interactive circuit simulators. In it the TRANSLATE 87 | * option was added, along with the ability to access the matrix 88 | * with AddElementToMatrix() and AddAdmittanceToMatrix() after it 89 | * has been reordered. Also added were the DeleteRowAndColFromMatrix(), 90 | * CleanMatrix(), GetMatrixSize(), SetMatrixReal() and SetMatrixComplex() 91 | * routines. 92 | * 93 | * Revision 1.2a April 1986 94 | * Fixed a bug that caused the matrix frame to get freed twice and one 95 | * in the test program that caused sparse to crash when a complex matrix 96 | * with no source vector was attempted. 97 | * 98 | * Revision 1.2b July 1986 99 | * Modified the test routine so that it allocates vectors from the heap 100 | * rather than the stack. 101 | * 102 | * Revision 1.2c February 1987 103 | * Fixed off-by-one error in PreorderForModifiedNodal(). 104 | * 105 | * Revision 1.2d 106 | * Modified the pivot selection algorithm so that singletons also meet 107 | * numerical threshold criterion. Deleted some global variables. Modified 108 | * test program to add command line options among other things. Made 109 | * thresholds sticky, so that once a valid threshold has been specified 110 | * for a particular matrix, it becomes the new default. 111 | * 112 | * Revision 1.3a July 1988 113 | * Made numerous changes. Highlights are: 114 | * Routine names shortened and made unique to 8 characters. 115 | * Unordering factorization is faster. 116 | * Added self initialization feature. 117 | * Sparse now aborts on errors that should not occur. 118 | * Cleaned up test program. 119 | * Separated growth and pseudocondition calculations from factorization. 120 | * Added LINPACK condition number estimator. 121 | * Rewrote spMNA_Preorder, algorithm extended to fix inadequacies. 122 | * Eliminated all global variables. 123 | * Added DIAGONAL_PIVOTING option (only diagonal pivoting before). 124 | */ 125 | -------------------------------------------------------------------------------- /src/misc/MakeLcircuit.c: -------------------------------------------------------------------------------- 1 | /* This makes an inductor circuit out of a single impedance matrix */ 2 | 3 | /* the function ReadZc returns a pointer to a linked list called 'Zlist' 4 | which contains all relevant information about a matrix. 5 | */ 6 | /* main() is an example of how to call ReadZc and access what it returns */ 7 | /* To include this in other code, remove main() and also #include "cmplx.h" 8 | and the typedef for Zlist */ 9 | 10 | /* Also, ReadZc was written quickly, so it doesn't do some vital 11 | things like check to make sure that malloc() returns nonNULL. I 12 | suggest tailoring it to your needs */ 13 | 14 | 15 | #include 16 | #include 17 | #include "cmplx.h" 18 | // Enrico 19 | #include 20 | 21 | #define LINEMAX 100000 22 | #define PI 3.141592654 23 | 24 | /* a linked list of the matrices in the given file */ 25 | typedef struct _Zlist { 26 | CX **Z; 27 | double freq; 28 | int size1, size2; 29 | struct _Zlist *next; 30 | } Zlist; 31 | 32 | Zlist *ReadZc(); 33 | 34 | main(argc, argv) 35 | int argc; 36 | char *argv[]; 37 | { 38 | FILE *fp; 39 | Zlist *Zc, *oneZ; 40 | int i,j, size, intnode, nodecount; 41 | double freq; 42 | CX **Z; 43 | double eps = 1e-6; 44 | 45 | if (argc != 2) { 46 | fprintf(stderr,"error: give one argument, and make it a filename to read\n"); 47 | exit(1); 48 | } 49 | 50 | fp = fopen(argv[1],"r"); 51 | if (fp == NULL) { 52 | fprintf(stderr, "No open\n"); 53 | exit(1); 54 | } 55 | 56 | Zc = ReadZc(fp); 57 | 58 | if (Zc->next != NULL) 59 | fprintf(stderr,"** WARNING: More than one frequency in input. Using freq=%lg\n", 60 | Zc->freq); 61 | 62 | Z = Zc->Z; 63 | 64 | size = Zc->size1; 65 | freq = Zc->freq; 66 | 67 | /* use the first Zc */ 68 | for(i = 0; i < size; i++) 69 | for(j = 0; j < size; j++) 70 | /* divide out freq */ 71 | Z[i][j].imag = Z[i][j].imag/(2*PI*freq); 72 | 73 | /* symmetrize it */ 74 | for(i = 1; i < size; i++) 75 | for(j = 0; j < i; j++) { 76 | Z[i][j].real = Z[j][i].real = (Z[i][j].real + Z[j][i].real)/2.0; 77 | Z[i][j].imag = Z[j][i].imag = (Z[i][j].imag + Z[j][i].imag)/2.0; 78 | } 79 | 80 | intnode = 2; 81 | /* self terms */ 82 | for(i = 0; i < size; i++) { 83 | /* printf("rZ_%d %d int_node%d %lg\n",i,2*i+1,intnode,Z[i][i].real);*/ 84 | printf("LZ_%d %d int_node%d_%d %lg\n",i,i*2+1,i,intnode, 85 | Z[i][i].imag); 86 | /* printf("Vam_%d int_node%d_%d %d dc=0v\n",i,i,size+intnode,i*2+2);*/ 87 | } 88 | 89 | /* mutual inductance */ 90 | for(i = 1; i < size; i++) 91 | for(j = 0; j < i; j++) 92 | printf("KZ_%d_%d LZ_%d LZ_%d %lg\n",i,j,i,j, 93 | Z[i][j].imag/sqrt(Z[i][i].imag * Z[j][j].imag)); 94 | 95 | intnode = 2; 96 | /* mutual resistance */ 97 | for(i = 0; i < size; i++) { 98 | nodecount = 0; 99 | for(j = 0; j < size; j++) 100 | if (fabs(Z[i][j].real/Z[i][i].real) > eps 101 | || fabs(Z[i][j].real/Z[j][j].real) > eps) { 102 | if (i == j) 103 | printf("RZ_%d_%d int_node%d_%d int_node%d_%d %lg\n",i,j,i, 104 | intnode+nodecount,i,intnode+nodecount+1, Z[i][j].real); 105 | else 106 | printf("HZ_%d_%d int_node%d_%d int_node%d_%d Vam_%d %lg\n",i,j,i, 107 | intnode+nodecount,i,intnode+nodecount+1, j, Z[i][j].real); 108 | nodecount++; 109 | } 110 | printf("Vam_%d int_node%d_%d %d dc=0v\n",i,i,intnode+nodecount,i*2+2); 111 | } 112 | 113 | } 114 | 115 | Zlist *ReadZc(fp) 116 | FILE *fp; 117 | { 118 | static char line[LINEMAX]; 119 | char *ptr; 120 | int i, j, size1, size2, skip; 121 | double freq; 122 | Zlist *Zc, *oneZ; 123 | double real, imag; 124 | 125 | Zc = NULL; 126 | 127 | while(fgets(line, LINEMAX, fp) != NULL) { 128 | if (sscanf(line, "Impedance matrix for frequency = %lg %d x %d", 129 | &freq, &size1, &size2) == 3) { 130 | oneZ = (Zlist *)malloc(sizeof(Zlist)); 131 | fprintf(stderr,"Reading Frequency %lg\n", freq); 132 | oneZ->freq = freq; 133 | oneZ->size1 = size1; 134 | oneZ->size2 = size2; 135 | oneZ->next = Zc; /* tack new matrix to front of list */ 136 | Zc = oneZ; 137 | oneZ->Z = (CX **)malloc(size1*sizeof(CX *)); 138 | for(i = 0; i < size1; i++) 139 | oneZ->Z[i] = (CX *)malloc(size2*sizeof(CX)); 140 | 141 | for(i = 0; i < size1; i++) { 142 | if (fgets(line, LINEMAX, fp) == NULL) { 143 | fprintf(stderr,"Unexpected end of file\n"); 144 | printerr(freq,i,0); 145 | } 146 | ptr = line; 147 | for(j = 0; j < size2; j++) { 148 | if (sscanf(ptr, "%lf%n", &real, &skip) != 1) 149 | printerr(freq,size1, size2); 150 | else 151 | oneZ->Z[i][j].real = real; 152 | ptr += skip; 153 | 154 | if (sscanf(ptr, "%lf%n", &imag, &skip) != 1) 155 | printerr(freq, i, j); 156 | else 157 | oneZ->Z[i][j].imag = imag; 158 | ptr += skip; 159 | 160 | if (ptr[0] != 'j') { 161 | fprintf(stderr,"Couldn't read j off of imaginary part\n"); 162 | printerr(freq, i, j); 163 | } 164 | ptr += 1; 165 | } 166 | } 167 | } 168 | else 169 | fprintf(stderr,"Not part of any matrix: %s", line); 170 | } 171 | 172 | return Zc; 173 | } 174 | 175 | printerr(freq, row, col) 176 | double freq; 177 | int row, col; 178 | { 179 | fprintf(stderr, "Error reading value in matrix for frequency %lg at row %d, col %d\n", freq, row, col); 180 | exit(1); 181 | } 182 | -------------------------------------------------------------------------------- /src/misc/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR -m64 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | 8 | MakeLcircuit: MakeLcircuit.o 9 | $(CC) -o MakeLcircuit $(CFLAGS) MakeLcircuit.o -lm 10 | mv MakeLcircuit $(BIN)/MakeLcircuit 11 | 12 | ReadOutput: ReadOutput.o 13 | $(CC) -o ReadOutput $(CFLAGS) ReadOutput.o 14 | mv ReadOutput $(BIN)/ReadOutput 15 | 16 | misc: MakeLcircuit ReadOutput 17 | 18 | clean: 19 | $(RM) -f *.o 20 | 21 | MakeLcircuit.o ReadOutput.o: cmplx.h 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/misc/Makefile.default: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | 8 | MakeLcircuit: MakeLcircuit.o 9 | $(CC) -o MakeLcircuit $(CFLAGS) MakeLcircuit.o -lm 10 | mv MakeLcircuit $(BIN)/MakeLcircuit 11 | 12 | ReadOutput: ReadOutput.o 13 | $(CC) -o ReadOutput $(CFLAGS) ReadOutput.o 14 | mv ReadOutput $(BIN)/ReadOutput 15 | 16 | misc: MakeLcircuit ReadOutput 17 | 18 | clean: 19 | $(RM) -f *.o 20 | 21 | MakeLcircuit.o ReadOutput.o: cmplx.h 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/misc/Makefile.x64: -------------------------------------------------------------------------------- 1 | CFLAGS = -O -DFOUR -m64 2 | 3 | SHELL = /bin/sh 4 | RM = /bin/rm 5 | BIN = ../../bin 6 | 7 | 8 | MakeLcircuit: MakeLcircuit.o 9 | $(CC) -o MakeLcircuit $(CFLAGS) MakeLcircuit.o -lm 10 | mv MakeLcircuit $(BIN)/MakeLcircuit 11 | 12 | ReadOutput: ReadOutput.o 13 | $(CC) -o ReadOutput $(CFLAGS) ReadOutput.o 14 | mv ReadOutput $(BIN)/ReadOutput 15 | 16 | misc: MakeLcircuit ReadOutput 17 | 18 | clean: 19 | $(RM) -f *.o 20 | 21 | MakeLcircuit.o ReadOutput.o: cmplx.h 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/misc/ReadOutput.c: -------------------------------------------------------------------------------- 1 | /* The following function is an example of how to read in the list of matrices 2 | contained in Zc.mat */ 3 | /* the function ReadZc returns a pointer to a linked list called 'Zlist' 4 | which contains all relevant information about a matrix. 5 | */ 6 | /* main() is an example of how to call ReadZc and access what it returns */ 7 | /* To include this in other code, remove main() and also #include "cmplx.h" 8 | and the typedef for Zlist */ 9 | 10 | /* Also, ReadZc was written quickly, so it doesn't do some vital 11 | things like check to make sure that malloc() returns nonNULL. I 12 | suggest tailoring it to your needs */ 13 | 14 | 15 | #include 16 | #include "cmplx.h" 17 | // Enrico 18 | #include 19 | 20 | #define LINEMAX 100000 21 | #define PI 3.141592654 22 | 23 | /* a linked list of the matrices in the given file */ 24 | typedef struct _Zlist { 25 | CX **Z; 26 | double freq; 27 | int size1, size2; 28 | struct _Zlist *next; 29 | } Zlist; 30 | 31 | Zlist *ReadZc(); 32 | 33 | main(argc, argv) 34 | int argc; 35 | char *argv[]; 36 | { 37 | FILE *fp; 38 | Zlist *Zc, *oneZ; 39 | int i,j; 40 | 41 | if (argc != 2) { 42 | printf("error: give one argument, and make it a filename to read\n"); 43 | exit(1); 44 | } 45 | 46 | fp = fopen(argv[1],"r"); 47 | if (fp == NULL) { 48 | fprintf(stderr, "No open\n"); 49 | exit(1); 50 | } 51 | 52 | Zc = ReadZc(fp); 53 | 54 | for(oneZ = Zc; oneZ != NULL; oneZ = oneZ->next) { 55 | printf("freq = %lg\n",oneZ->freq); 56 | for(i = 0; i < oneZ->size1; i++) { 57 | printf("Row %d: ",i); 58 | for(j = 0; j < oneZ->size2; j++) 59 | printf("%lg%+lgj ",oneZ->Z[i][j].real, 60 | oneZ->Z[i][j].imag/(2*PI*oneZ->freq)); 61 | printf("\n"); 62 | } 63 | } 64 | } 65 | 66 | Zlist *ReadZc(fp) 67 | FILE *fp; 68 | { 69 | static char line[LINEMAX]; 70 | char *ptr; 71 | int i, j, size1, size2, skip; 72 | double freq; 73 | Zlist *Zc, *oneZ; 74 | double real, imag; 75 | 76 | Zc = NULL; 77 | 78 | while(fgets(line, LINEMAX, fp) != NULL) { 79 | if (sscanf(line, "Impedance matrix for frequency = %lg %d x %d", 80 | &freq, &size1, &size2) == 3) { 81 | oneZ = (Zlist *)malloc(sizeof(Zlist)); 82 | printf("Reading Frequency %lg\n", freq); 83 | oneZ->freq = freq; 84 | oneZ->size1 = size1; 85 | oneZ->size2 = size2; 86 | oneZ->next = Zc; /* tack new matrix to front of list */ 87 | Zc = oneZ; 88 | oneZ->Z = (CX **)malloc(size1*sizeof(CX *)); 89 | for(i = 0; i < size1; i++) 90 | oneZ->Z[i] = (CX *)malloc(size2*sizeof(CX)); 91 | 92 | for(i = 0; i < size1; i++) { 93 | if (fgets(line, LINEMAX, fp) == NULL) { 94 | printf("Unexpected end of file\n"); 95 | printerr(freq,i,0); 96 | } 97 | ptr = line; 98 | for(j = 0; j < size2; j++) { 99 | if (sscanf(ptr, "%lf%n", &real, &skip) != 1) 100 | printerr(freq,size1, size2); 101 | else 102 | oneZ->Z[i][j].real = real; 103 | ptr += skip; 104 | 105 | if (sscanf(ptr, "%lf%n", &imag, &skip) != 1) 106 | printerr(freq, i, j); 107 | else 108 | oneZ->Z[i][j].imag = imag; 109 | ptr += skip; 110 | 111 | if (ptr[0] != 'j') { 112 | printf("Couldn't read j off of imaginary part\n"); 113 | printerr(freq, i, j); 114 | } 115 | ptr += 1; 116 | } 117 | } 118 | } 119 | else 120 | printf("Not part of any matrix: %s", line); 121 | } 122 | 123 | return Zc; 124 | } 125 | 126 | printerr(freq, row, col) 127 | double freq; 128 | int row, col; 129 | { 130 | fprintf(stderr, "Error reading value in matrix for frequency %lg at row %d, col %d\n", freq, row, col); 131 | exit(1); 132 | } 133 | -------------------------------------------------------------------------------- /src/misc/cmplx.h: -------------------------------------------------------------------------------- 1 | 2 | typedef struct cx_struct { 3 | double real; 4 | double imag; 5 | } CX; 6 | 7 | #define cx_add(z,x,y) \ 8 | do { \ 9 | (z).real = (x).real + (y).real; \ 10 | (z).imag = (x).imag + (y).imag; \ 11 | } while(0) 12 | 13 | #define cx_sub(z,x,y) \ 14 | do { \ 15 | (z).real = (x).real - (y).real; \ 16 | (z).imag = (x).imag - (y).imag; \ 17 | } while(0) 18 | 19 | #define cx_mul(z,x,y) \ 20 | do { \ 21 | (z).real = (x).real * (y).real - (x).imag * (y).imag; \ 22 | (z).imag = (x).imag * (y).real + (x).real * (y).imag; \ 23 | } while(0) 24 | 25 | #define cx_div(z,x,y) \ 26 | do { \ 27 | (z).real = 1.0 / ((y).real * (y).real + (y).imag * (y).imag); \ 28 | (z).imag = (z).real; \ 29 | (z).real *= (x).real * (y).real + (x).imag * (y).imag; \ 30 | (z).imag *= (x).imag * (y).real - (x).real * (y).imag; \ 31 | } while(0) 32 | 33 | #define cx_conj_mul(z,x,y) \ 34 | do { \ 35 | (z).real = (x).real * (y).real + (x).imag * (y).imag; \ 36 | (z).imag = (x).imag * (y).real - (x).real * (y).imag; \ 37 | } while(0) 38 | 39 | #define cx_abs(x) \ 40 | (sqrt((x).real*(x).real+(x).imag*(x).imag)) 41 | 42 | #define cx_scalar_mult(z, alpha, x) \ 43 | do { \ 44 | (z).real = alpha*(x).real; \ 45 | (z).imag = alpha*(x).imag; \ 46 | } while(0) 47 | 48 | static CX CXZERO = { 0, 0 }; 49 | static CX CXONE = { 1, 0 }; 50 | static CX CXMONE = { -1, 0 }; 51 | 52 | -------------------------------------------------------------------------------- /src/zbuf/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for 2 | # zbuf - capacitance or inductance visualization picture 3 | 4 | # assumed places for unaliased executables - must be same in all Makefile.* 5 | SHELL = /bin/sh 6 | AWK = awk 7 | RM = /bin/rm 8 | 9 | MAKETYPE = other 10 | # normally overidden by master Makefile 11 | TYPE = other 12 | 13 | INCL = . 14 | IO = . 15 | DIR = . 16 | MUL = . 17 | ALC = . 18 | COM = . 19 | GEN = . 20 | BIN = ../../bin 21 | TOP = .. 22 | 23 | OBJS = $(MUL)/mulGlobal.o $(DIR)/extras.o \ 24 | $(MUL)/zbuf.o \ 25 | $(ALC)/uglieralloc.o \ 26 | $(IO)/patran.o $(IO)/quickif.o \ 27 | $(IO)/input.o \ 28 | $(IO)/zbufInOut.o $(IO)/zbuf2fastcap.o $(IO)/zbufProj.o $(IO)/zbufSort.o \ 29 | $(IO)/dump_struct.o $(IO)/savemat_mod.o 30 | 31 | SRCS = $(MUL)/mulGlobal.c $(DIR)/extras.c \ 32 | $(MUL)/zbuf.c \ 33 | $(ALC)/uglieralloc.c \ 34 | $(IO)/patran.c $(IO)/quickif.c \ 35 | $(IO)/input.c \ 36 | $(IO)/zbufInOut.c $(IO)/zbuf2fastcap.c $(IO)/zbufProj.c $(IO)/zbufSort.c \ 37 | $(IO)/dump_struct.c $(IO)/savemat_mod.c 38 | 39 | LIBS = -lm 40 | 41 | # These compile flags are needed to account for differences in the 42 | # resource usage system call used to get CPU time and memory use data 43 | # - also used to select the correct CC macro definition for AIX machines 44 | # 45 | # for x86 64bit generic machine use (timers not supported) 46 | CFLAGS = -O -DOTHER -m64 47 | # for most machines running 4.2/3 use (only necessary if timers are needed) 48 | #CFLAGS = -O -DFOUR 49 | # for most machines running System V use (only necessary if timers are needed) 50 | #CFLAGS = -O -DFIVE 51 | # for IBM AIX systems use 52 | #CC = xlc 53 | 54 | zbuf: $(OBJS) 55 | $(CC) -o zbuf $(CFLAGS) $(OBJS) $(LIBS) 56 | mv zbuf $(BIN)/zbuf 57 | 58 | clean: 59 | $(RM) -f *.o 60 | 61 | $(OBJS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 62 | $(INCL)/resusage.h Makefile 63 | $(SRCS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 64 | $(INCL)/resusage.h Makefile 65 | $(IO)/quickif.c $(IO)/quickif.o : $(IO)/quickif.h Makefile 66 | -------------------------------------------------------------------------------- /src/zbuf/Makefile.alpha: -------------------------------------------------------------------------------- 1 | # Makefile for 2 | # zbuf - capacitance or inductance visualization picture 3 | 4 | # assumed places for unaliased executables - must be same in all Makefile.* 5 | SHELL = /bin/sh 6 | AWK = awk 7 | RM = /bin/rm 8 | 9 | MAKETYPE = other 10 | # normally overidden by master Makefile 11 | TYPE = other 12 | 13 | INCL = . 14 | IO = . 15 | DIR = . 16 | MUL = . 17 | ALC = . 18 | COM = . 19 | GEN = . 20 | BIN = ../../bin 21 | TOP = .. 22 | 23 | OBJS = $(MUL)/mulGlobal.o $(DIR)/extras.o \ 24 | $(MUL)/zbuf.o \ 25 | $(ALC)/uglieralloc.o \ 26 | $(IO)/patran.o $(IO)/quickif.o \ 27 | $(IO)/input.o \ 28 | $(IO)/zbufInOut.o $(IO)/zbuf2fastcap.o $(IO)/zbufProj.o $(IO)/zbufSort.o \ 29 | $(IO)/dump_struct.o $(IO)/savemat_mod.o 30 | 31 | SRCS = $(MUL)/mulGlobal.c $(DIR)/extras.c \ 32 | $(MUL)/zbuf.c \ 33 | $(ALC)/uglieralloc.c \ 34 | $(IO)/patran.c $(IO)/quickif.c \ 35 | $(IO)/input.c \ 36 | $(IO)/zbufInOut.c $(IO)/zbuf2fastcap.c $(IO)/zbufProj.c $(IO)/zbufSort.c \ 37 | $(IO)/dump_struct.c $(IO)/savemat_mod.c 38 | 39 | LIBS = -lm 40 | 41 | # These compile flags are needed to account for differences in the 42 | # resource usage system call used to get CPU time and memory use data 43 | # - also used to select the correct CC macro definition for AIX machines 44 | # 45 | # for generic machine use (timers not supported) 46 | CFLAGS = -O -DOTHER -Olimit 2000 47 | # for most machines running 4.2/3 use (only necessary if timers are needed) 48 | #CFLAGS = -O -DFOUR 49 | # for most machines running System V use (only necessary if timers are needed) 50 | #CFLAGS = -O -DFIVE 51 | # for IBM AIX systems use 52 | #CC = xlc 53 | 54 | zbuf: $(OBJS) 55 | $(CC) -o zbuf $(CFLAGS) $(OBJS) $(LIBS) 56 | mv zbuf $(BIN)/zbuf 57 | 58 | clean: 59 | $(RM) -f *.o 60 | 61 | $(OBJS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 62 | $(INCL)/resusage.h Makefile 63 | $(SRCS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 64 | $(INCL)/resusage.h Makefile 65 | $(IO)/quickif.c $(IO)/quickif.o : $(IO)/quickif.h Makefile 66 | -------------------------------------------------------------------------------- /src/zbuf/Makefile.dec: -------------------------------------------------------------------------------- 1 | # Makefile for 2 | # zbuf - capacitance or inductance visualization picture 3 | 4 | # assumed places for unaliased executables - must be same in all Makefile.* 5 | SHELL = /bin/sh 6 | AWK = awk 7 | RM = /bin/rm 8 | 9 | MAKETYPE = other 10 | # normally overidden by master Makefile 11 | TYPE = other 12 | 13 | INCL = . 14 | IO = . 15 | DIR = . 16 | MUL = . 17 | ALC = . 18 | COM = . 19 | GEN = . 20 | BIN = ../../bin 21 | TOP = .. 22 | 23 | OBJS = $(MUL)/mulGlobal.o $(DIR)/extras.o \ 24 | $(MUL)/zbuf.o \ 25 | $(ALC)/uglieralloc.o \ 26 | $(IO)/patran.o $(IO)/quickif.o \ 27 | $(IO)/input.o \ 28 | $(IO)/zbufInOut.o $(IO)/zbuf2fastcap.o $(IO)/zbufProj.o $(IO)/zbufSort.o \ 29 | $(IO)/dump_struct.o $(IO)/savemat_mod.o 30 | 31 | SRCS = $(MUL)/mulGlobal.c $(DIR)/extras.c \ 32 | $(MUL)/zbuf.c \ 33 | $(ALC)/uglieralloc.c \ 34 | $(IO)/patran.c $(IO)/quickif.c \ 35 | $(IO)/input.c \ 36 | $(IO)/zbufInOut.c $(IO)/zbuf2fastcap.c $(IO)/zbufProj.c $(IO)/zbufSort.c \ 37 | $(IO)/dump_struct.c $(IO)/savemat_mod.c 38 | 39 | LIBS = -lm 40 | 41 | # These compile flags are needed to account for differences in the 42 | # resource usage system call used to get CPU time and memory use data 43 | # - also used to select the correct CC macro definition for AIX machines 44 | # 45 | # for generic machine use (timers not supported) 46 | CFLAGS = -O -DOTHER -Olimit 2000 47 | # for most machines running 4.2/3 use (only necessary if timers are needed) 48 | #CFLAGS = -O -DFOUR 49 | # for most machines running System V use (only necessary if timers are needed) 50 | #CFLAGS = -O -DFIVE 51 | # for IBM AIX systems use 52 | #CC = xlc 53 | 54 | zbuf: $(OBJS) 55 | $(CC) -o zbuf $(CFLAGS) $(OBJS) $(LIBS) 56 | mv zbuf $(BIN)/zbuf 57 | 58 | clean: 59 | $(RM) -f *.o 60 | 61 | $(OBJS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 62 | $(INCL)/resusage.h Makefile 63 | $(SRCS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 64 | $(INCL)/resusage.h Makefile 65 | $(IO)/quickif.c $(IO)/quickif.o : $(IO)/quickif.h Makefile 66 | -------------------------------------------------------------------------------- /src/zbuf/Makefile.default: -------------------------------------------------------------------------------- 1 | # Makefile for 2 | # zbuf - capacitance or inductance visualization picture 3 | 4 | # assumed places for unaliased executables - must be same in all Makefile.* 5 | SHELL = /bin/sh 6 | AWK = awk 7 | RM = /bin/rm 8 | 9 | MAKETYPE = other 10 | # normally overidden by master Makefile 11 | TYPE = other 12 | 13 | INCL = . 14 | IO = . 15 | DIR = . 16 | MUL = . 17 | ALC = . 18 | COM = . 19 | GEN = . 20 | BIN = ../../bin 21 | TOP = .. 22 | 23 | OBJS = $(MUL)/mulGlobal.o $(DIR)/extras.o \ 24 | $(MUL)/zbuf.o \ 25 | $(ALC)/uglieralloc.o \ 26 | $(IO)/patran.o $(IO)/quickif.o \ 27 | $(IO)/input.o \ 28 | $(IO)/zbufInOut.o $(IO)/zbuf2fastcap.o $(IO)/zbufProj.o $(IO)/zbufSort.o \ 29 | $(IO)/dump_struct.o $(IO)/savemat_mod.o 30 | 31 | SRCS = $(MUL)/mulGlobal.c $(DIR)/extras.c \ 32 | $(MUL)/zbuf.c \ 33 | $(ALC)/uglieralloc.c \ 34 | $(IO)/patran.c $(IO)/quickif.c \ 35 | $(IO)/input.c \ 36 | $(IO)/zbufInOut.c $(IO)/zbuf2fastcap.c $(IO)/zbufProj.c $(IO)/zbufSort.c \ 37 | $(IO)/dump_struct.c $(IO)/savemat_mod.c 38 | 39 | LIBS = -lm 40 | 41 | # These compile flags are needed to account for differences in the 42 | # resource usage system call used to get CPU time and memory use data 43 | # - also used to select the correct CC macro definition for AIX machines 44 | # 45 | # for generic machine use (timers not supported) 46 | CFLAGS = -O -DOTHER 47 | # for most machines running 4.2/3 use (only necessary if timers are needed) 48 | #CFLAGS = -O -DFOUR 49 | # for most machines running System V use (only necessary if timers are needed) 50 | #CFLAGS = -O -DFIVE 51 | # for IBM AIX systems use 52 | #CC = xlc 53 | 54 | zbuf: $(OBJS) 55 | $(CC) -o zbuf $(CFLAGS) $(OBJS) $(LIBS) 56 | mv zbuf $(BIN)/zbuf 57 | 58 | clean: 59 | $(RM) -f *.o 60 | 61 | $(OBJS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 62 | $(INCL)/resusage.h Makefile 63 | $(SRCS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 64 | $(INCL)/resusage.h Makefile 65 | $(IO)/quickif.c $(IO)/quickif.o : $(IO)/quickif.h Makefile 66 | -------------------------------------------------------------------------------- /src/zbuf/Makefile.sgi: -------------------------------------------------------------------------------- 1 | # Makefile for 2 | # zbuf - capacitance or inductance visualization picture 3 | 4 | # assumed places for unaliased executables - must be same in all Makefile.* 5 | SHELL = /bin/sh 6 | AWK = awk 7 | RM = /bin/rm 8 | 9 | MAKETYPE = other 10 | # normally overidden by master Makefile 11 | TYPE = other 12 | 13 | INCL = . 14 | IO = . 15 | DIR = . 16 | MUL = . 17 | ALC = . 18 | COM = . 19 | GEN = . 20 | BIN = ../../bin 21 | TOP = .. 22 | 23 | OBJS = $(MUL)/mulGlobal.o $(DIR)/extras.o \ 24 | $(MUL)/zbuf.o \ 25 | $(ALC)/uglieralloc.o \ 26 | $(IO)/patran.o $(IO)/quickif.o \ 27 | $(IO)/input.o \ 28 | $(IO)/zbufInOut.o $(IO)/zbuf2fastcap.o $(IO)/zbufProj.o $(IO)/zbufSort.o \ 29 | $(IO)/dump_struct.o $(IO)/savemat_mod.o 30 | 31 | SRCS = $(MUL)/mulGlobal.c $(DIR)/extras.c \ 32 | $(MUL)/zbuf.c \ 33 | $(ALC)/uglieralloc.c \ 34 | $(IO)/patran.c $(IO)/quickif.c \ 35 | $(IO)/input.c \ 36 | $(IO)/zbufInOut.c $(IO)/zbuf2fastcap.c $(IO)/zbufProj.c $(IO)/zbufSort.c \ 37 | $(IO)/dump_struct.c $(IO)/savemat_mod.c 38 | 39 | LIBS = -lm 40 | 41 | # These compile flags are needed to account for differences in the 42 | # resource usage system call used to get CPU time and memory use data 43 | # - also used to select the correct CC macro definition for AIX machines 44 | # 45 | # for generic machine use (timers not supported) 46 | CFLAGS = -O -DOTHER -Olimit 2000 -cckr 47 | # for most machines running 4.2/3 use (only necessary if timers are needed) 48 | #CFLAGS = -O -DFOUR 49 | # for most machines running System V use (only necessary if timers are needed) 50 | #CFLAGS = -O -DFIVE 51 | # for IBM AIX systems use 52 | #CC = xlc 53 | 54 | zbuf: $(OBJS) 55 | $(CC) -o zbuf $(CFLAGS) $(OBJS) $(LIBS) 56 | mv zbuf $(BIN)/zbuf 57 | 58 | clean: 59 | $(RM) -f *.o 60 | 61 | $(OBJS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 62 | $(INCL)/resusage.h Makefile 63 | $(SRCS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 64 | $(INCL)/resusage.h Makefile 65 | $(IO)/quickif.c $(IO)/quickif.o : $(IO)/quickif.h Makefile 66 | -------------------------------------------------------------------------------- /src/zbuf/Makefile.solaris: -------------------------------------------------------------------------------- 1 | # Makefile for 2 | # zbuf - capacitance or inductance visualization picture 3 | 4 | # assumed places for unaliased executables - must be same in all Makefile.* 5 | SHELL = /bin/sh 6 | AWK = awk 7 | RM = /bin/rm 8 | 9 | MAKETYPE = other 10 | # normally overidden by master Makefile 11 | TYPE = other 12 | 13 | INCL = . 14 | IO = . 15 | DIR = . 16 | MUL = . 17 | ALC = . 18 | COM = . 19 | GEN = . 20 | BIN = ../../bin 21 | TOP = .. 22 | 23 | OBJS = $(MUL)/mulGlobal.o $(DIR)/extras.o \ 24 | $(MUL)/zbuf.o \ 25 | $(ALC)/uglieralloc.o \ 26 | $(IO)/patran.o $(IO)/quickif.o \ 27 | $(IO)/input.o \ 28 | $(IO)/zbufInOut.o $(IO)/zbuf2fastcap.o $(IO)/zbufProj.o $(IO)/zbufSort.o \ 29 | $(IO)/dump_struct.o $(IO)/savemat_mod.o 30 | 31 | SRCS = $(MUL)/mulGlobal.c $(DIR)/extras.c \ 32 | $(MUL)/zbuf.c \ 33 | $(ALC)/uglieralloc.c \ 34 | $(IO)/patran.c $(IO)/quickif.c \ 35 | $(IO)/input.c \ 36 | $(IO)/zbufInOut.c $(IO)/zbuf2fastcap.c $(IO)/zbufProj.c $(IO)/zbufSort.c \ 37 | $(IO)/dump_struct.c $(IO)/savemat_mod.c 38 | 39 | LIBS = -lm 40 | 41 | # These compile flags are needed to account for differences in the 42 | # resource usage system call used to get CPU time and memory use data 43 | # - also used to select the correct CC macro definition for AIX machines 44 | # 45 | # for generic machine use (timers not supported) 46 | CFLAGS = -O -DFIVE -DSOLARIS 47 | # for most machines running 4.2/3 use (only necessary if timers are needed) 48 | #CFLAGS = -O -DFOUR 49 | # for most machines running System V use (only necessary if timers are needed) 50 | #CFLAGS = -O -DFIVE 51 | # for IBM AIX systems use 52 | #CC = xlc 53 | 54 | zbuf: $(OBJS) 55 | $(CC) -o zbuf $(CFLAGS) $(OBJS) $(LIBS) 56 | mv zbuf $(BIN)/zbuf 57 | 58 | clean: 59 | $(RM) -f *.o 60 | 61 | $(OBJS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 62 | $(INCL)/resusage.h Makefile 63 | $(SRCS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 64 | $(INCL)/resusage.h Makefile 65 | $(IO)/quickif.c $(IO)/quickif.o : $(IO)/quickif.h Makefile 66 | -------------------------------------------------------------------------------- /src/zbuf/Makefile.sysV: -------------------------------------------------------------------------------- 1 | # Makefile for 2 | # zbuf - capacitance or inductance visualization picture 3 | 4 | # assumed places for unaliased executables - must be same in all Makefile.* 5 | SHELL = /bin/sh 6 | AWK = awk 7 | RM = /bin/rm 8 | 9 | MAKETYPE = other 10 | # normally overidden by master Makefile 11 | TYPE = other 12 | 13 | INCL = . 14 | IO = . 15 | DIR = . 16 | MUL = . 17 | ALC = . 18 | COM = . 19 | GEN = . 20 | BIN = ../../bin 21 | TOP = .. 22 | 23 | OBJS = $(MUL)/mulGlobal.o $(DIR)/extras.o \ 24 | $(MUL)/zbuf.o \ 25 | $(ALC)/uglieralloc.o \ 26 | $(IO)/patran.o $(IO)/quickif.o \ 27 | $(IO)/input.o \ 28 | $(IO)/zbufInOut.o $(IO)/zbuf2fastcap.o $(IO)/zbufProj.o $(IO)/zbufSort.o \ 29 | $(IO)/dump_struct.o $(IO)/savemat_mod.o 30 | 31 | SRCS = $(MUL)/mulGlobal.c $(DIR)/extras.c \ 32 | $(MUL)/zbuf.c \ 33 | $(ALC)/uglieralloc.c \ 34 | $(IO)/patran.c $(IO)/quickif.c \ 35 | $(IO)/input.c \ 36 | $(IO)/zbufInOut.c $(IO)/zbuf2fastcap.c $(IO)/zbufProj.c $(IO)/zbufSort.c \ 37 | $(IO)/dump_struct.c $(IO)/savemat_mod.c 38 | 39 | LIBS = -lm 40 | 41 | # These compile flags are needed to account for differences in the 42 | # resource usage system call used to get CPU time and memory use data 43 | # - also used to select the correct CC macro definition for AIX machines 44 | # 45 | # for generic machine use (timers not supported) 46 | CFLAGS = -O -DFIVE 47 | # for most machines running 4.2/3 use (only necessary if timers are needed) 48 | #CFLAGS = -O -DFOUR 49 | # for most machines running System V use (only necessary if timers are needed) 50 | #CFLAGS = -O -DFIVE 51 | # for IBM AIX systems use 52 | #CC = xlc 53 | 54 | zbuf: $(OBJS) 55 | $(CC) -o zbuf $(CFLAGS) $(OBJS) $(LIBS) 56 | mv zbuf $(BIN)/zbuf 57 | 58 | clean: 59 | $(RM) -f *.o 60 | 61 | $(OBJS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 62 | $(INCL)/resusage.h Makefile 63 | $(SRCS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 64 | $(INCL)/resusage.h Makefile 65 | $(IO)/quickif.c $(IO)/quickif.o : $(IO)/quickif.h Makefile 66 | -------------------------------------------------------------------------------- /src/zbuf/Makefile.x64: -------------------------------------------------------------------------------- 1 | # Makefile for 2 | # zbuf - capacitance or inductance visualization picture 3 | 4 | # assumed places for unaliased executables - must be same in all Makefile.* 5 | SHELL = /bin/sh 6 | AWK = awk 7 | RM = /bin/rm 8 | 9 | MAKETYPE = other 10 | # normally overidden by master Makefile 11 | TYPE = other 12 | 13 | INCL = . 14 | IO = . 15 | DIR = . 16 | MUL = . 17 | ALC = . 18 | COM = . 19 | GEN = . 20 | BIN = ../../bin 21 | TOP = .. 22 | 23 | OBJS = $(MUL)/mulGlobal.o $(DIR)/extras.o \ 24 | $(MUL)/zbuf.o \ 25 | $(ALC)/uglieralloc.o \ 26 | $(IO)/patran.o $(IO)/quickif.o \ 27 | $(IO)/input.o \ 28 | $(IO)/zbufInOut.o $(IO)/zbuf2fastcap.o $(IO)/zbufProj.o $(IO)/zbufSort.o \ 29 | $(IO)/dump_struct.o $(IO)/savemat_mod.o 30 | 31 | SRCS = $(MUL)/mulGlobal.c $(DIR)/extras.c \ 32 | $(MUL)/zbuf.c \ 33 | $(ALC)/uglieralloc.c \ 34 | $(IO)/patran.c $(IO)/quickif.c \ 35 | $(IO)/input.c \ 36 | $(IO)/zbufInOut.c $(IO)/zbuf2fastcap.c $(IO)/zbufProj.c $(IO)/zbufSort.c \ 37 | $(IO)/dump_struct.c $(IO)/savemat_mod.c 38 | 39 | LIBS = -lm 40 | 41 | # These compile flags are needed to account for differences in the 42 | # resource usage system call used to get CPU time and memory use data 43 | # - also used to select the correct CC macro definition for AIX machines 44 | # 45 | # for x86 64bit generic machine use (timers not supported) 46 | CFLAGS = -O -DOTHER -m64 47 | # for most machines running 4.2/3 use (only necessary if timers are needed) 48 | #CFLAGS = -O -DFOUR 49 | # for most machines running System V use (only necessary if timers are needed) 50 | #CFLAGS = -O -DFIVE 51 | # for IBM AIX systems use 52 | #CC = xlc 53 | 54 | zbuf: $(OBJS) 55 | $(CC) -o zbuf $(CFLAGS) $(OBJS) $(LIBS) 56 | mv zbuf $(BIN)/zbuf 57 | 58 | clean: 59 | $(RM) -f *.o 60 | 61 | $(OBJS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 62 | $(INCL)/resusage.h Makefile 63 | $(SRCS) : $(INCL)/mulStruct.h $(INCL)/mulGlobal.h $(INCL)/patran.h \ 64 | $(INCL)/resusage.h Makefile 65 | $(IO)/quickif.c $(IO)/quickif.o : $(IO)/quickif.h Makefile 66 | -------------------------------------------------------------------------------- /src/zbuf/dump_struct.c: -------------------------------------------------------------------------------- 1 | /* this is a function from Joel Phillips for generating matlab matrices 2 | for visualization of a fastcap structure */ 3 | /* It produces the file panels.mat */ 4 | 5 | #include "mulGlobal.h" 6 | 7 | dump_struct(chglist,qv) 8 | charge *chglist; 9 | double *qv; 10 | { 11 | 12 | charge *cp; 13 | double *x, *y, *z, *q; 14 | int index; 15 | FILE *fp, *fopen(); 16 | int type; 17 | int size, i; 18 | extern char *title, *ps_file_base, *in_file_name; 19 | char *fname, *concat3(); 20 | 21 | fname = concat3(ps_file_base,".","mat"); 22 | 23 | fprintf(stdout,"Dumping structure to Matlab file %s\n", fname); 24 | 25 | size = 0; 26 | for (cp = chglist; cp != NULL; cp = cp->next) { 27 | size++; 28 | } 29 | if ( (fp = fopen(fname, "w")) == NULL) { 30 | fprintf(stderr, "Can't open %s\n",fname); 31 | exit(1); 32 | } 33 | 34 | x = (double *) calloc( 4*size, sizeof(double)); 35 | y = (double *) calloc( 4*size, sizeof(double)); 36 | z = (double *) calloc( 4*size, sizeof(double)); 37 | q = (double *) calloc( 4*size, sizeof(double)); 38 | 39 | /* do the triangles */ 40 | index = 0; 41 | for (cp = chglist; cp != NULL; cp = cp->next) { 42 | if (cp->shape == 3) { 43 | for (i=0; ishape; i++) { 44 | x[3*index+i] = cp->corner[i][0] * cp->X[0] + cp->corner[i][1]*cp->Y[0] + 45 | cp->corner[i][2] * cp->Z[0] + cp->x; 46 | 47 | y[3*index+i] = cp->corner[i][0] * cp->X[1] + cp->corner[i][1]*cp->Y[1] + 48 | cp->corner[i][2] * cp->Z[1] + cp->y; 49 | 50 | z[3*index+i] = cp->corner[i][0] * cp->X[2] + cp->corner[i][1]*cp->Y[2] + 51 | cp->corner[i][2] * cp->Z[2] + cp->z; 52 | 53 | } 54 | if (qv != NULL) 55 | q[index] = qv[cp->index]; 56 | else 57 | q[index] = 0.0; 58 | index++; 59 | } 60 | } 61 | 62 | 63 | #ifdef sun 64 | type = 1000; 65 | #else 66 | type = 0000; 67 | #endif 68 | if (index > 0) { 69 | savemat(fp, type, "xt", 3, index, 0, x, NULL); 70 | savemat(fp, type, "yt", 3, index, 0, y, NULL); 71 | savemat(fp, type, "zt", 3, index, 0, z, NULL); 72 | savemat(fp, type, "qt", 3, index, 0, q, NULL); 73 | } 74 | 75 | /* now the quads */ 76 | 77 | index = 0; 78 | for (cp = chglist; cp != NULL; cp = cp->next) { 79 | if (cp->shape == 4) { 80 | for (i=0; ishape; i++) { 81 | x[4*index+i] = cp->corner[i][0] * cp->X[0] + cp->corner[i][1]*cp->Y[0] + 82 | cp->corner[i][2] * cp->Z[0] + cp->x; 83 | 84 | y[4*index+i] = cp->corner[i][0] * cp->X[1] + cp->corner[i][1]*cp->Y[1] + 85 | cp->corner[i][2] * cp->Z[1] + cp->y; 86 | 87 | z[4*index+i] = cp->corner[i][0] * cp->X[2] + cp->corner[i][1]*cp->Y[2] + 88 | cp->corner[i][2] * cp->Z[2] + cp->z; 89 | 90 | } 91 | if (qv != NULL) 92 | q[index] = qv[cp->index]; 93 | else 94 | q[index] = 0.0; 95 | index++; 96 | } 97 | } 98 | if (index > 0) { 99 | savemat(fp, type, "xq", 4, index, 0, x, NULL); 100 | savemat(fp, type, "yq", 4, index, 0, y, NULL); 101 | savemat(fp, type, "zq", 4, index, 0, z, NULL); 102 | savemat(fp, type, "qq", 4, index, 0, q, NULL); 103 | } 104 | 105 | fclose(fp); 106 | 107 | } 108 | 109 | -------------------------------------------------------------------------------- /src/zbuf/invert.awk: -------------------------------------------------------------------------------- 1 | {printf "%d\n", -1*$1} 2 | -------------------------------------------------------------------------------- /src/zbuf/mulGlobal.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990 Massachusetts Institute of Technology, Cambridge, MA. 3 | All rights reserved. 4 | 5 | This Agreement gives you, the LICENSEE, certain rights and obligations. 6 | By using the software, you indicate that you have read, understood, and 7 | will comply with the terms. 8 | 9 | Permission to use, copy and modify for internal, noncommercial purposes 10 | is hereby granted. Any distribution of this program or any part thereof 11 | is strictly prohibited without prior written consent of M.I.T. 12 | 13 | Title to copyright to this software and to any associated documentation 14 | shall at all times remain with M.I.T. and LICENSEE agrees to preserve 15 | same. LICENSEE agrees not to make any copies except for LICENSEE'S 16 | internal noncommercial use, or to use separately any portion of this 17 | software without prior written consent of M.I.T. LICENSEE agrees to 18 | place the appropriate copyright notice on any such copies. 19 | 20 | Nothing in this Agreement shall be construed as conferring rights to use 21 | in advertising, publicity or otherwise any trademark or the name of 22 | "Massachusetts Institute of Technology" or "M.I.T." 23 | 24 | M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By 25 | way of example, but not limitation, M.I.T. MAKES NO REPRESENTATIONS OR 26 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 27 | THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS OR DOCUMENTATION WILL 28 | NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 29 | M.I.T. shall not be held liable for any liability nor for any direct, 30 | indirect or consequential damages with respect to any claim by LICENSEE 31 | or any third party on account of or arising from this Agreement or use 32 | of this software. 33 | */ 34 | 35 | #include "mulGlobal.h" 36 | 37 | long memcount; /* allocated memory counter */ 38 | long memQ2M; /* allocated memory counters by function */ 39 | long memQ2L; 40 | long memQ2P; 41 | long memL2L; 42 | long memM2M; 43 | long memM2L; 44 | long memM2P; 45 | long memL2P; 46 | long memQ2PD; 47 | long memMSC; 48 | 49 | /* 50 | global timer and operation count accumulators 51 | */ 52 | double prectime; /* time spent doing back solve for prec */ 53 | double prsetime; /* time spent calculating preconditioner */ 54 | double conjtime; /* time spent doing everything but A*q */ 55 | double dirtime; /* time for direct part of P*q */ 56 | double multime; /* time for multipole part of P*q */ 57 | double uptime; /* time in mulUp(), upward pass */ 58 | double downtime; /* time in mulDown(), downward pass */ 59 | double evaltime; /* time in mulEval(), evaluation pass */ 60 | int fulldirops; /* total direct operations - DIRSOL=ON only */ 61 | double lutime; /* factorization time DIRSOL=ON only */ 62 | double fullsoltime; /* time for solves, DIRSOL=ON only */ 63 | int fullPqops; /* total P*q ops using P on disk - EXPGCR=ON */ 64 | 65 | /* 66 | misc global 67 | */ 68 | NAME *start_name = NULL; /* conductor name linked list head */ 69 | NAME *current_name; /* conductor name linked list tail */ 70 | NAME *start_name_this_time; /* cond name list for the current surface */ 71 | char *kill_name_list; /* cond names whose columns are omitted */ 72 | ITER *kill_num_list; /* cond numbers whose columns are omitted */ 73 | char *kinp_name_list; /* cond names omitted from input */ 74 | ITER *kinp_num_list; /* cond numbers omitted from input */ 75 | char *qpic_name_list; /* cond column names that get q picture */ 76 | ITER *qpic_num_list; /* cond column names that get q picture */ 77 | char *kq_name_list; /* cond names removed from q picture */ 78 | ITER *kq_num_list; /* cond numbers removed from q picture */ 79 | 80 | int num_dielec_panels; /* number of dielectric interface panels */ 81 | int num_both_panels; /* number of thin-cond-on-dielec-i/f panels */ 82 | int num_cond_panels; /* number of thick conductor panels */ 83 | int up_size; /* sum of above three (real panels) */ 84 | int num_dummy_panels; /* number of off-panel eval pnt panels */ 85 | int eval_size; /* sum of above two (total panel structs) */ 86 | double iter_tol; /* iterative loop tolerence on ||r|| */ 87 | 88 | /* 89 | command line option variables - all have to do with ps file dumping 90 | */ 91 | #if CAPVEW == ON /* eliminate messy globals if not needed */ 92 | char **argvals; /* copy of argv */ 93 | int argcnt; /* copy of argc */ 94 | int s_; /* TRUE => insert showpage in .ps file(s) */ 95 | int n_; /* TRUE => number faces with input ordering */ 96 | int g_; /* TRUE => dump depth graph and quit */ 97 | int c_; /* TRUE => print command line on .ps file(s) */ 98 | int x_; /* TRUE => axes have been specified */ 99 | int k_; 100 | int rc_; /* TRUE => rm conductors in list from pic */ 101 | int rd_; /* TRUE => remove all dielec i/fs from pic */ 102 | int rb_; /* TRUE => rm BOTH-types in list from pic */ 103 | int q_; /* TRUE => dump shaded plots of q_iter iters */ 104 | int rk_; /* TRUE => rm chg den key in -q plots */ 105 | int m_; /* TRUE => switch to plot gen mode */ 106 | int f_; /* TRUE => don't fill faces (no hidden l rm) */ 107 | int dd_; /* TRUE => dump ttl charges to .ps pictures */ 108 | double view[3]; /* absolute view point of 3D geometry */ 109 | double moffset[2]; /* image offset from lower left corner */ 110 | double elevation; /* elevation of view rel to center of object */ 111 | double azimuth; /* azimuth of view rel to center of object */ 112 | double rotation; /* image rotation, degrees */ 113 | double distance; /* relative distance from center (#radii-1) */ 114 | double linewd; /* postscript line width */ 115 | double scale; /* over all image scale factor */ 116 | double axeslen; /* axes lengths in 3D distance */ 117 | double axes[10][2][3]; /* the 2d image of the coordinate axes */ 118 | int up_axis; /* X,Y or Z => which axis is vertical in pic */ 119 | char *line_file; /* pointer to .fig superimposed line file */ 120 | char *ps_file_base; /* pointer to base name for .ps files */ 121 | char *in_file_name; /* full name of input file (fasthenry) */ 122 | #endif 123 | -------------------------------------------------------------------------------- /src/zbuf/patran.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990 Massachusetts Institute of Technology, Cambridge, MA. 3 | All rights reserved. 4 | 5 | This Agreement gives you, the LICENSEE, certain rights and obligations. 6 | By using the software, you indicate that you have read, understood, and 7 | will comply with the terms. 8 | 9 | Permission to use, copy and modify for internal, noncommercial purposes 10 | is hereby granted. Any distribution of this program or any part thereof 11 | is strictly prohibited without prior written consent of M.I.T. 12 | 13 | Title to copyright to this software and to any associated documentation 14 | shall at all times remain with M.I.T. and LICENSEE agrees to preserve 15 | same. LICENSEE agrees not to make any copies except for LICENSEE'S 16 | internal noncommercial use, or to use separately any portion of this 17 | software without prior written consent of M.I.T. LICENSEE agrees to 18 | place the appropriate copyright notice on any such copies. 19 | 20 | Nothing in this Agreement shall be construed as conferring rights to use 21 | in advertising, publicity or otherwise any trademark or the name of 22 | "Massachusetts Institute of Technology" or "M.I.T." 23 | 24 | M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By 25 | way of example, but not limitation, M.I.T. MAKES NO REPRESENTATIONS OR 26 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 27 | THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS OR DOCUMENTATION WILL 28 | NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 29 | M.I.T. shall not be held liable for any liability nor for any direct, 30 | indirect or consequential damages with respect to any claim by LICENSEE 31 | or any third party on account of or arising from this Agreement or use 32 | of this software. 33 | */ 34 | 35 | /*************************************************************************** 36 | 37 | This is the header file for patran.c. 38 | 39 | Written by Songmin Kim, July 24, 1990. 40 | 41 | ***************************************************************************/ 42 | /* Refer to Chapter 29, Neutral System, of PATRAN manual for explanation. 43 | The variable names are identical to those that appear in the manual. */ 44 | 45 | typedef struct node { 46 | int ID; 47 | double coord[3]; 48 | } NODE; 49 | 50 | typedef struct element { 51 | int ID, shape, num_nodes; 52 | int corner[4]; 53 | } ELEMENT; 54 | 55 | typedef struct grid { 56 | int ID, *equiv_ID, number_equiv_grids; 57 | double coord[3]; 58 | struct grid *next, *prev; 59 | } GRID; 60 | 61 | typedef struct cfeg { 62 | int ID, NELS, LPH, LPH_ID, LSHAPE, NODES, ICONF, NDIM; 63 | struct cfeg *next, *prev; 64 | int *element_list; 65 | } CFEG; 66 | 67 | typedef struct patch { 68 | int ID, corner[4], conductor_ID; 69 | struct patch *next, *prev; 70 | } PATCH; 71 | 72 | typedef struct sm_patch { 73 | int ID, conductor_ID; 74 | struct sm_patch *next; 75 | } SM_PATCH; 76 | 77 | /* intermediate name struct; used for compatability with patran i/f */ 78 | typedef struct name { 79 | char *name; 80 | SM_PATCH *patch_list; 81 | struct name *next; 82 | } NAME; 83 | 84 | /* used to build linked list of conductor names */ 85 | struct Name { 86 | char *name; 87 | struct Name *next; 88 | struct Name *alias_list; 89 | }; 90 | typedef struct Name Name; 91 | 92 | /* used to make linked lists of iteration or conductor #s */ 93 | struct ITER { 94 | int iter; 95 | struct ITER *next; 96 | }; 97 | typedef struct ITER ITER; 98 | -------------------------------------------------------------------------------- /src/zbuf/quickif.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990 Massachusetts Institute of Technology, Cambridge, MA. 3 | All rights reserved. 4 | 5 | This Agreement gives you, the LICENSEE, certain rights and obligations. 6 | By using the software, you indicate that you have read, understood, and 7 | will comply with the terms. 8 | 9 | Permission to use, copy and modify for internal, noncommercial purposes 10 | is hereby granted. Any distribution of this program or any part thereof 11 | is strictly prohibited without prior written consent of M.I.T. 12 | 13 | Title to copyright to this software and to any associated documentation 14 | shall at all times remain with M.I.T. and LICENSEE agrees to preserve 15 | same. LICENSEE agrees not to make any copies except for LICENSEE'S 16 | internal noncommercial use, or to use separately any portion of this 17 | software without prior written consent of M.I.T. LICENSEE agrees to 18 | place the appropriate copyright notice on any such copies. 19 | 20 | Nothing in this Agreement shall be construed as conferring rights to use 21 | in advertising, publicity or otherwise any trademark or the name of 22 | "Massachusetts Institute of Technology" or "M.I.T." 23 | 24 | M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By 25 | way of example, but not limitation, M.I.T. MAKES NO REPRESENTATIONS OR 26 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 27 | THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS OR DOCUMENTATION WILL 28 | NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 29 | M.I.T. shall not be held liable for any liability nor for any direct, 30 | indirect or consequential damages with respect to any claim by LICENSEE 31 | or any third party on account of or arising from this Agreement or use 32 | of this software. 33 | */ 34 | 35 | struct quadl { /* quadralateral element */ 36 | int cond; /* conductor number */ 37 | struct quadl *next; /* linked list pntr */ 38 | double x1; /* four corner coordinates */ 39 | double x2; 40 | double x3; 41 | double x4; 42 | double y1; 43 | double y2; 44 | double y3; 45 | double y4; 46 | double z1; 47 | double z2; 48 | double z3; 49 | double z4; 50 | }; 51 | typedef struct quadl quadl; 52 | 53 | struct tri { /* triangular element */ 54 | int cond; /* conductor number */ 55 | struct tri *next; /* linked list pntr */ 56 | double x1; /* three corner coordinates */ 57 | double x2; 58 | double x3; 59 | double y1; 60 | double y2; 61 | double y3; 62 | double z1; 63 | double z2; 64 | double z3; 65 | }; 66 | typedef struct tri tri; 67 | 68 | /* #define MAXCON 10000 /* assumes never more conductors than this */ 69 | -------------------------------------------------------------------------------- /src/zbuf/resusage.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990 Massachusetts Institute of Technology, Cambridge, MA. 3 | All rights reserved. 4 | 5 | This Agreement gives you, the LICENSEE, certain rights and obligations. 6 | By using the software, you indicate that you have read, understood, and 7 | will comply with the terms. 8 | 9 | Permission to use, copy and modify for internal, noncommercial purposes 10 | is hereby granted. Any distribution of this program or any part thereof 11 | is strictly prohibited without prior written consent of M.I.T. 12 | 13 | Title to copyright to this software and to any associated documentation 14 | shall at all times remain with M.I.T. and LICENSEE agrees to preserve 15 | same. LICENSEE agrees not to make any copies except for LICENSEE'S 16 | internal noncommercial use, or to use separately any portion of this 17 | software without prior written consent of M.I.T. LICENSEE agrees to 18 | place the appropriate copyright notice on any such copies. 19 | 20 | Nothing in this Agreement shall be construed as conferring rights to use 21 | in advertising, publicity or otherwise any trademark or the name of 22 | "Massachusetts Institute of Technology" or "M.I.T." 23 | 24 | M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By 25 | way of example, but not limitation, M.I.T. MAKES NO REPRESENTATIONS OR 26 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 27 | THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS OR DOCUMENTATION WILL 28 | NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 29 | M.I.T. shall not be held liable for any liability nor for any direct, 30 | indirect or consequential damages with respect to any claim by LICENSEE 31 | or any third party on account of or arising from this Agreement or use 32 | of this software. 33 | */ 34 | 35 | /* header where rusage and time structs are defined */ 36 | 37 | #ifdef FOUR 38 | #define NOTOTHER 1 39 | #include 40 | #include 41 | struct rusage timestuff; 42 | #endif 43 | 44 | #ifdef FIVE 45 | #define NOTOTHER 1 46 | #include 47 | #include 48 | #include 49 | struct tms timestuff; 50 | #endif 51 | 52 | /* define macros for time and resident memory usage checks */ 53 | 54 | static double dtime = 0.0; 55 | static long sectime, utime; 56 | 57 | #ifdef NOTOTHER 58 | 59 | #ifdef FOUR /* 4.2,3BSD (tested: Sun4, IBM6000, DEC5000) */ 60 | #define starttimer getrusage(RUSAGE_SELF, ×tuff); \ 61 | sectime = timestuff.ru_utime.tv_sec; \ 62 | utime = timestuff.ru_utime.tv_usec 63 | #define stoptimer getrusage(RUSAGE_SELF, ×tuff); \ 64 | dtime = (double)(timestuff.ru_utime.tv_sec - sectime) \ 65 | + 1.0e-6*(double)(timestuff.ru_utime.tv_usec - utime) 66 | #define DUMPRSS /* */ 67 | #endif /* FOUR */ 68 | 69 | #ifdef FIVE /* for System V (tested: HP300) */ 70 | #define starttimer times(×tuff); \ 71 | utime = timestuff.tms_utime 72 | #define stoptimer times(×tuff); \ 73 | dtime = (timestuff.tms_utime)-utime; \ 74 | dtime /= HZ 75 | #define DUMPRSS /* */ 76 | #endif /* FIVE */ 77 | 78 | #else /* default - no timers */ 79 | 80 | #define starttimer /* */ 81 | #define stoptimer /* */ 82 | #define DUMPRSS /* */ 83 | 84 | #endif /* NOTOTHER */ 85 | -------------------------------------------------------------------------------- /src/zbuf/savemat_mod.c: -------------------------------------------------------------------------------- 1 | /* 2 | * savemat - C language routine to save a matrix in a MAT-file. 3 | * 4 | * We recommend that you use this routine, and its companion loadmat.c, 5 | * for all writing and reading of MAT-files. These routines implement 6 | * "access methods" for MAT-files. By using these routines, instead 7 | * of writing your own code to directly access the MAT-file format, 8 | * you will be unaffected by any changes that may be made to the MAT-file 9 | * structure at a future date. 10 | * 11 | * Here is an example that uses 'savemat' to save two matrices to disk, 12 | * the second of which is complex: 13 | * 14 | * FILE *fp; 15 | * double xyz[1000], ar[1000], ai[1000]; 16 | * fp = fopen("foo.mat","wb"); 17 | * savemat(fp, 2000, "xyz", 2, 3, 0, xyz, (double *)0); 18 | * savemat(fp, 2000, "a", 5, 5, 1, ar, ai); 19 | * fclose(fp); 20 | * 21 | * Author J.N. Little 11-3-86 22 | * Revised 7-23-91 to support ANSI-C 23 | */ 24 | #include 25 | // Enrico 26 | #include 27 | 28 | #ifdef ALPHA 29 | typedef struct { 30 | int type; /* type */ 31 | int mrows; /* row dimension */ 32 | int ncols; /* column dimension */ 33 | int imagf; /* flag indicating imag part */ 34 | int namlen; /* name length (including NULL) */ 35 | } Fmatrix; 36 | #else 37 | typedef struct { 38 | long type; /* type */ 39 | long mrows; /* row dimension */ 40 | long ncols; /* column dimension */ 41 | long imagf; /* flag indicating imag part */ 42 | long namlen; /* name length (including NULL) */ 43 | } Fmatrix; 44 | #endif 45 | 46 | #ifdef __STDC__ 47 | void savemat(FILE *fp, int type, char *pname, int mrows, int ncols, 48 | int imagf, double *preal, double *pimag) 49 | #else 50 | void savemat(fp, type, pname, mrows, ncols, imagf, preal, pimag) 51 | FILE *fp; /* File pointer */ 52 | int type; /* Type flag: Normally 0 for PC, 1000 for Sun, Mac, */ 53 | /* Apollo, and other Motorola format, */ 54 | /* 2000 for VAX D-float, 3000 for VAX G-float, and */ 55 | /* 4000 for CRAY */ 56 | /* Add 1 for text variables, 2 for sparse matrices */ 57 | /* See LOAD in reference section of guide for more info.*/ 58 | char *pname; /* pointer to matrix name */ 59 | int mrows; /* row dimension */ 60 | int ncols; /* column dimension */ 61 | int imagf; /* imaginary flag */ 62 | double *preal; /* pointer to real data */ 63 | double *pimag; /* pointer to imag data */ 64 | #endif 65 | { 66 | Fmatrix x; 67 | int mn; 68 | 69 | x.type = type; 70 | x.mrows = mrows; 71 | x.ncols = ncols; 72 | x.imagf = imagf; 73 | x.namlen = strlen(pname) + 1; 74 | mn = x.mrows * x.ncols; 75 | 76 | fwrite(&x, sizeof(Fmatrix), 1, fp); 77 | fwrite(pname, sizeof(char), (int)x.namlen, fp); 78 | fwrite(preal, sizeof(double), mn, fp); 79 | if (imagf) { 80 | fwrite(pimag, sizeof(double), mn, fp); 81 | } 82 | } 83 | 84 | /* 85 | MODIFIED version of above: added wr_flag to allow multiple writes 86 | to same matrix 87 | wr_flag = 0 => open, print header (like old matlab setup) 88 | wr_flag = 1 => update, print without header 89 | Doesn't work for complex. For complex, full real part must precede 90 | full imaginary. 91 | */ 92 | #ifdef __STDC__ 93 | void savemat_mod(FILE *fp, int type, char *pname, int mrows, int ncols, 94 | int imagf, double *preal, double *pimag, int wr_flag, int mn) 95 | #else 96 | void savemat_mod(fp, type, pname, mrows, ncols, imagf, preal, pimag, 97 | wr_flag, mn) 98 | FILE *fp; /* File pointer */ 99 | int type; /* Type flag: Normally 0 for PC, 1000 for Sun, Mac, */ 100 | /* Apollo, and other Motorola format, */ 101 | /* 2000 for VAX D-float, 3000 for VAX G-float, and */ 102 | /* 4000 for CRAY */ 103 | /* Add 1 for text variables, 2 for sparse matrices */ 104 | /* See LOAD in reference section of guide for more info.*/ 105 | char *pname; /* pointer to matrix name */ 106 | int mrows; /* row dimension */ 107 | int ncols; /* column dimension */ 108 | int imagf; /* imaginary flag */ 109 | double *preal; /* pointer to real data */ 110 | double *pimag; /* pointer to imag data */ 111 | int wr_flag; /* 0 for open, 1 to add to matrix */ 112 | int mn; /* real #entries, this dump only */ 113 | #endif 114 | { 115 | Fmatrix x; 116 | 117 | if(wr_flag == 0) { 118 | x.type = type; 119 | x.mrows = mrows; 120 | x.ncols = ncols; 121 | x.imagf = imagf; 122 | x.namlen = strlen(pname) + 1; 123 | 124 | fwrite(&x, sizeof(Fmatrix), 1, fp); 125 | fwrite(pname, sizeof(char), (int)x.namlen, fp); 126 | } 127 | fwrite(preal, sizeof(double), mn, fp); 128 | /* if (imagf) { 129 | fwrite(pimag, sizeof(double), mn, fp); 130 | } 131 | */ 132 | } 133 | -------------------------------------------------------------------------------- /src/zbuf/zbuf.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990 Massachusetts Institute of Technology, Cambridge, MA. 3 | All rights reserved. 4 | 5 | This Agreement gives you, the LICENSEE, certain rights and obligations. 6 | By using the software, you indicate that you have read, understood, and 7 | will comply with the terms. 8 | 9 | Permission to use, copy and modify for internal, noncommercial purposes 10 | is hereby granted. Any distribution of this program or any part thereof 11 | is strictly prohibited without prior written consent of M.I.T. 12 | 13 | Title to copyright to this software and to any associated documentation 14 | shall at all times remain with M.I.T. and LICENSEE agrees to preserve 15 | same. LICENSEE agrees not to make any copies except for LICENSEE'S 16 | internal noncommercial use, or to use separately any portion of this 17 | software without prior written consent of M.I.T. LICENSEE agrees to 18 | place the appropriate copyright notice on any such copies. 19 | 20 | Nothing in this Agreement shall be construed as conferring rights to use 21 | in advertising, publicity or otherwise any trademark or the name of 22 | "Massachusetts Institute of Technology" or "M.I.T." 23 | 24 | M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By 25 | way of example, but not limitation, M.I.T. MAKES NO REPRESENTATIONS OR 26 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 27 | THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS OR DOCUMENTATION WILL 28 | NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 29 | M.I.T. shall not be held liable for any liability nor for any direct, 30 | indirect or consequential damages with respect to any claim by LICENSEE 31 | or any third party on account of or arising from this Agreement or use 32 | of this software. 33 | */ 34 | 35 | #include "mulGlobal.h" 36 | 37 | // Enrico 38 | #include 39 | 40 | main(argc, argv) 41 | int argc; 42 | char *argv[]; 43 | { 44 | int ttliter, i, j, num_cond; 45 | charge *chglist, *nq, *input_problem(); 46 | double *get_q(); 47 | ssystem *sys, *mulInit(); 48 | double **capmat, dirtimesav, mulsetup, initalltime, ttlsetup, ttlsolve; 49 | double relperm; 50 | int autmom, autlev, numMom, numLev; 51 | char *fname, *concat3(); 52 | 53 | extern int fulldirops, fullPqops; 54 | extern int num_dummy_panels, num_dielec_panels; 55 | extern int num_both_panels, num_cond_panels, up_size, eval_size; 56 | extern char *title, *ps_file_base, *in_file_name; 57 | extern long memcount; 58 | extern double prectime, conjtime, dirtime, multime, uptime, downtime; 59 | extern double evaltime, lutime, fullsoltime, prsetime; 60 | extern char *kill_name_list; 61 | 62 | Name *name_list; 63 | 64 | #if DUMPPS == ON || DUMPPS == ALL 65 | char filename[BUFSIZ]; 66 | #endif 67 | 68 | /*#if CAPVEW == ON*/ 69 | extern char **argvals; 70 | extern int argcnt, m_, q_, dd_; 71 | extern double ***axes; 72 | /*#endif*/ 73 | 74 | /* initialize memory and time counters, etc. */ 75 | fulldirops = fullPqops = 0; 76 | prectime = conjtime = dirtime = multime = uptime = downtime = 0.0; 77 | evaltime = lutime = fullsoltime = mulsetup = 0.0; 78 | memcount = 0; 79 | CALLOC(title, BUFSIZ, char, ON, AMSC); 80 | 81 | /* initialize defaults, etc */ 82 | autmom = autlev = ON; 83 | relperm = 1.0; 84 | argvals = argv; 85 | argcnt = argc; 86 | CALLOC(axes, 10, double **, ON, AMSC); 87 | for(i = 0; i < 10; i++) { 88 | CALLOC(axes[i], 2, double *, ON, AMSC); 89 | for(j = 0; j < 2; j++) { 90 | CALLOC(axes[i][j], 3, double, ON, AMSC); 91 | } 92 | } 93 | 94 | /* get the list of all panels in the problem */ 95 | /* - many command line parameters having to do with the postscript 96 | file dumping interface are passed back via globals (see mulGlobal.c) */ 97 | chglist = input_problem(argv, argc, &autmom, &autlev, &relperm, 98 | &numMom, &numLev, &name_list, &num_cond); 99 | 100 | /* just dump the psfile */ 101 | get_ps_file_base(argv, argc); 102 | if (!q_) { 103 | if (m_) 104 | /* dump in matlab format */ 105 | dump_struct(chglist, NULL); 106 | else { 107 | /* dump a postscript file */ 108 | fprintf(stdout,"Creating postscript file\n"); 109 | dump_ps_geometry(chglist, NULL, 0, dd_); 110 | } 111 | } 112 | else { 113 | fname = concat3(in_file_name,"_","shadings"); 114 | if (m_) 115 | /* dump in matlab format */ 116 | dump_struct(chglist, get_q(fname,chglist)); 117 | else { 118 | /* dump in postscript format */ 119 | fprintf(stdout,"Creating postscript file with shading\n"); 120 | dump_ps_geometry(chglist, get_q(fname,chglist), 0, dd_); 121 | } 122 | } 123 | exit(0); 124 | 125 | } 126 | 127 | char *concat3(st1, st2, st3) 128 | char *st1, *st2, *st3; 129 | { 130 | int length = 0; 131 | char *allthree; 132 | 133 | length = strlen(st1); 134 | length += strlen(st2); 135 | length += strlen(st3); 136 | 137 | CALLOC(allthree, length+1, char, ON, AMSC); 138 | 139 | allthree[0] = '\0'; 140 | strcat(allthree,st1); 141 | strcat(allthree,st2); 142 | strcat(allthree,st3); 143 | 144 | return allthree; 145 | } 146 | 147 | /* For FastHenry, this reads the file of shadings for each of the faces */ 148 | 149 | double *get_q(fname, chglist) 150 | char *fname; 151 | charge *chglist; 152 | { 153 | FILE *fp; 154 | int numchgs = 0; 155 | charge *chg; 156 | int error, i; 157 | double *q; 158 | 159 | fp = fopen(fname, "r"); 160 | if (fp == NULL) { 161 | printf("Couldn't open %s for -q option\n", fname); 162 | exit(1); 163 | } 164 | 165 | for(chg = chglist; chg != NULL; chg = chg->next) 166 | numchgs++; 167 | 168 | CALLOC(q, numchgs, double, ON, AMSC); 169 | error = 0; 170 | 171 | for(i = 0; i < numchgs && error == 0; i++) { 172 | if (error == 0) { 173 | if (fscanf(fp, "%lf", &q[i]) != 1) { 174 | error = 1; 175 | fprintf(stderr, "Error reading shading file. Rest of panels: q = 0\n"); 176 | } 177 | } 178 | else 179 | q[i] = 0.0; 180 | } 181 | 182 | return q; 183 | 184 | } 185 | -------------------------------------------------------------------------------- /src/zbuf/zbuf2fastcap.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990 Massachusetts Institute of Technology, Cambridge, MA. 3 | All rights reserved. 4 | 5 | This Agreement gives you, the LICENSEE, certain rights and obligations. 6 | By using the software, you indicate that you have read, understood, and 7 | will comply with the terms. 8 | 9 | Permission to use, copy and modify for internal, noncommercial purposes 10 | is hereby granted. Any distribution of this program or any part thereof 11 | is strictly prohibited without prior written consent of M.I.T. 12 | 13 | Title to copyright to this software and to any associated documentation 14 | shall at all times remain with M.I.T. and LICENSEE agrees to preserve 15 | same. LICENSEE agrees not to make any copies except for LICENSEE'S 16 | internal noncommercial use, or to use separately any portion of this 17 | software without prior written consent of M.I.T. LICENSEE agrees to 18 | place the appropriate copyright notice on any such copies. 19 | 20 | Nothing in this Agreement shall be construed as conferring rights to use 21 | in advertising, publicity or otherwise any trademark or the name of 22 | "Massachusetts Institute of Technology" or "M.I.T." 23 | 24 | M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By 25 | way of example, but not limitation, M.I.T. MAKES NO REPRESENTATIONS OR 26 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 27 | THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS OR DOCUMENTATION WILL 28 | NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 29 | M.I.T. shall not be held liable for any liability nor for any direct, 30 | indirect or consequential damages with respect to any claim by LICENSEE 31 | or any third party on account of or arising from this Agreement or use 32 | of this software. 33 | */ 34 | 35 | #include "mulGlobal.h" 36 | #include "zbufGlobal.h" 37 | 38 | /*#if CAPVEW == ON*/ 39 | /* 40 | main interface between old zbuf code and fastcap 41 | - replaces functionality of zbuf.c (main()) 42 | - dumps a geometry in .ps file format 43 | - panels are shaded using the vector entries of q; 44 | q = NULL => no shading; use_density = TRUE => divide q's by areas 45 | - file name used is .ps; ps_file_base is either 46 | the list file base, the input file base or "stdin" (see get_ps_file_info()) 47 | */ 48 | void dump_ps_geometry(chglist, q, cond, use_ttl_chg) 49 | charge *chglist; 50 | double *q; 51 | int cond; 52 | { 53 | int i, j, k, numlines, numfaces, use_density; 54 | face **faces, **sfaces, **fastcap2faces(), **depthSortFaces(); 55 | double normal[3], rhs, temp, dot(), *getAvg(); 56 | double *avg, pnt[3], radius, getSphere(), getNormal(); 57 | charge *cur_chg; 58 | line **lines, **getLines(); 59 | FILE *fp; 60 | char str[BUFSIZ]; 61 | 62 | extern char *ps_file_base; 63 | extern double view[], moffset[], distance, rotation, scale; 64 | extern double azimuth, elevation; 65 | extern char **argvals; 66 | extern int argcnt, g_; 67 | extern char *line_file; 68 | 69 | #if 1==0 70 | /* set up use density flag---not too clean; saves changes in called funcs */ 71 | if(use_ttl_chg) use_density = FALSE; 72 | else use_density = TRUE; 73 | #endif 74 | 75 | use_density = FALSE; 76 | 77 | /* convert fastcap structs to zbuf structs - COULD ELIMINATE THIS */ 78 | faces = fastcap2faces(&numfaces, chglist, q, use_density); 79 | 80 | /* get .fig format lines in file specified with -b option */ 81 | lines = getLines(line_file, &numlines); 82 | 83 | /* figure the cntr of extremal (average) coordinates of all points */ 84 | avg = getAvg(faces, numfaces, lines, numlines, OFF); 85 | 86 | /* get the radius of the smallest sphere enclosing all the lines */ 87 | radius = getSphere(avg, faces, numfaces, lines, numlines); 88 | 89 | /* get normal to image plane, adjust view point to be (1+distance)*radius 90 | away from object center point avg, view plane (1+distance/2)*radius away 91 | - view coordinates taken rel to obj center but changed to absolute */ 92 | view[0] = azimuth; view[1] = elevation; 93 | rhs = getNormal(normal, radius, avg, view, distance); 94 | 95 | #if 1 == 0 96 | fprintf(stderr, " %d faces read\n", numfaces); 97 | fprintf(stderr, " %d lines read\n", numlines); 98 | fprintf(stderr, " average obj point: (%g %g %g), radius = %g\n", 99 | avg[0], avg[1], avg[2], radius); 100 | fprintf(stderr, " absolute view point: (%g %g %g)\n", 101 | view[0],view[1],view[2]); 102 | #endif 103 | 104 | /* set up all the normals and rhs for the faces (needed for sort) */ 105 | initFaces(faces, numfaces, view); 106 | 107 | /* set up ps file name */ 108 | #if 1 == 0 109 | /* no longer for FastHenry */ 110 | if(q == NULL) sprintf(str, "%s.ps", ps_file_base); 111 | else sprintf(str, "%s%d.ps", ps_file_base, cond); 112 | #endif 113 | sprintf(str, "%s.ps", ps_file_base); 114 | 115 | 116 | /* set up the adjacency graph for the depth sort */ 117 | fprintf(stdout, "\nSorting %d faces for %s...", numfaces, str); 118 | fflush(stdout); 119 | getAdjGraph(faces, numfaces, view, rhs, normal); 120 | fprintf(stdout, "done.\n"); 121 | 122 | /* depth sort the faces */ 123 | /*fprintf(stderr, "Starting depth sort...");*/ 124 | sfaces = depthSortFaces(faces, numfaces); 125 | /*fprintf(stderr, "done.\n");*/ 126 | 127 | /* get the 2d figure and dump to ps file */ 128 | image(sfaces, numfaces, lines, numlines, normal, rhs, view); 129 | flatten(sfaces, numfaces, lines, numlines, rhs, rotation, normal, view); 130 | makePos(sfaces, numfaces, lines, numlines); 131 | scale2d(sfaces, numfaces, lines, numlines, scale, moffset); 132 | if(g_ == TRUE) { 133 | dumpCycles(sfaces, numfaces, stdout); /* DANGER - doesnt work (?) */ 134 | dumpFaceText(sfaces, numfaces, stdout); 135 | } 136 | else { 137 | if((fp = fopen(str, "w")) == NULL) { 138 | fprintf(stderr, "dump_ps_geometry: can't open\n `%s'\nto write\n", str); 139 | exit(0); 140 | } 141 | fprintf(stdout, "Writing %s...", str); 142 | dumpPs(sfaces, numfaces, lines, numlines, fp, argvals, argcnt,use_density); 143 | fprintf(stdout, "done.\n"); 144 | fclose(fp); 145 | } 146 | } 147 | /*#endif*/ 148 | -------------------------------------------------------------------------------- /src/zbuf/zbufGlobal.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990 Massachusetts Institute of Technology, Cambridge, MA. 3 | All rights reserved. 4 | 5 | This Agreement gives you, the LICENSEE, certain rights and obligations. 6 | By using the software, you indicate that you have read, understood, and 7 | will comply with the terms. 8 | 9 | Permission to use, copy and modify for internal, noncommercial purposes 10 | is hereby granted. Any distribution of this program or any part thereof 11 | is strictly prohibited without prior written consent of M.I.T. 12 | 13 | Title to copyright to this software and to any associated documentation 14 | shall at all times remain with M.I.T. and LICENSEE agrees to preserve 15 | same. LICENSEE agrees not to make any copies except for LICENSEE'S 16 | internal noncommercial use, or to use separately any portion of this 17 | software without prior written consent of M.I.T. LICENSEE agrees to 18 | place the appropriate copyright notice on any such copies. 19 | 20 | Nothing in this Agreement shall be construed as conferring rights to use 21 | in advertising, publicity or otherwise any trademark or the name of 22 | "Massachusetts Institute of Technology" or "M.I.T." 23 | 24 | M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By 25 | way of example, but not limitation, M.I.T. MAKES NO REPRESENTATIONS OR 26 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 27 | THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS OR DOCUMENTATION WILL 28 | NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 29 | M.I.T. shall not be held liable for any liability nor for any direct, 30 | indirect or consequential damages with respect to any claim by LICENSEE 31 | or any third party on account of or arising from this Agreement or use 32 | of this software. 33 | */ 34 | 35 | 36 | /* #include */ 37 | 38 | /* zbuf data structures */ 39 | #include "zbufStruct.h" 40 | 41 | #ifndef MIN 42 | #define MIN(A,B) ( (A) > (B) ? (B) : (A) ) 43 | #endif 44 | #ifndef MAX 45 | #define MAX(A,B) ( (A) > (B) ? (A) : (B) ) 46 | #endif 47 | 48 | #ifndef M_PI 49 | #define M_PI 3.1415926535897931160E0 50 | #endif 51 | 52 | #ifndef ON 53 | #define ON 1 54 | #endif 55 | #ifndef OFF 56 | #define OFF 0 57 | #endif 58 | #ifndef TRUE 59 | #define TRUE 1 60 | #endif 61 | #ifndef FALSE 62 | #define FALSE 0 63 | #endif 64 | 65 | #define FONT 5.0 /* font size used to label lines in ps file */ 66 | #define CMDFONT 10.0 /* font used to write command line */ 67 | 68 | #define OFFSETX 34.0 /* offset on x from lower left (pnts) */ 69 | #define OFFSETY 34.0 /* offset on y from lower left (pnts) */ 70 | #define IMAGEX 540.0 /* x height of image (chosen to be points) */ 71 | #define IMAGEY 720.0 /* y height of image (chosen to be points) 72 | comand line scale parameter muliplies 73 | IMAGEX/Y to get final image size 74 | - these values should allow 7.5x10 images */ 75 | #define KEYHGT IMAGEY/7.0 /* height of the shading key, -q option only */ 76 | #define KEYWID IMAGEX/7.5 /* width of the shading key, -q option only */ 77 | #define KEYBLKS 5 /* number of blocks in the key */ 78 | #define KEYPREC 5 /* precision of labels in key */ 79 | #define KEYFONT 10.0 /* font used to label key */ 80 | 81 | #define MARGIN 1e-10 /* 1 + MARGIN is considered 1; > -MARGIN=0; 82 | MARGIN should be approx machine epsilon 83 | except that PATRAN files can lead to probs*/ 84 | #define PARMGN 1.0 /* multiplies MARGIN in plane equivalence 85 | checks (see is1stFaceDeeper()) to allow the 86 | extra slop those checks apparently need */ 87 | 88 | #define LINE 1 /* used directly in setlinewidth as default */ 89 | #define LINCAP 1 /* 0 = square, 1 = round cap, 2 = square cap */ 90 | #define LINJIN 1 /* 0 = miter, 1 = round, 2 = knock off cnrs */ 91 | #define GREYLEV 0.0 /* 1 = black fill */ 92 | #define DASHED -1 /* = width arg that means draw a dashed line */ 93 | #define DASWTH 2 /* width of dashed lines */ 94 | #define OVRWTH 0 /* overide line width - get with -w option 95 | (not implemented) */ 96 | #define AXEWID 0.0 /* width of axis lines */ 97 | #define MAXSIDES 4 /* maximum #sides allowed for a face */ 98 | 99 | #define DEBUG 1 /* controls view point dump, etc. */ 100 | #define DEBUGX OFF /* doLinesIntersect stats */ 101 | #define DMPINFO OFF /* dumps face/line info when in a bind */ 102 | #define DMPMATLAB OFF /* dmps info in MATLAB format if DMPINFO==ON */ 103 | #define RMWEDGE OFF /* removes 1st quadrant dielectric panels */ 104 | 105 | #define ALEN 8 /* default arrow length in points */ 106 | #define AWID 4 /* default arrow width in points */ 107 | #define DOTSIZ 2 /* default dot radius, points */ 108 | 109 | #define POS 0 /* defined in whichSide() */ 110 | #define NEG 1 111 | #define SPLIT 2 112 | #define SAME 3 113 | 114 | #define REVERSE 2 /* defined in is1stFaceDeeper() */ 115 | 116 | #define XOVTST OFF /* cross overlap test enable--see zbufSort.c */ 117 | 118 | #ifndef XI 119 | #define XI 0 /* upward-pointing axes types */ 120 | #endif 121 | #ifndef YI 122 | #define YI 1 123 | #endif 124 | #ifndef ZI 125 | #define ZI 2 126 | #endif 127 | 128 | /* default command line options */ 129 | #define DEFAZM 50.0 /* default azimuth, degrees (-a) */ 130 | #define DEFELE 50.0 /* default elevation, degrees (-e) */ 131 | #define DEFROT 0.0 /* default rotation rel z axis, degrees (-r) */ 132 | #define DEFDST 2.0 /* default view dist, 0 = on obj edge (-d) */ 133 | #define DEFSCL 1.0 /* default scale, fractions of IMAGEX,Y (-s) */ 134 | #define DEFWID 1.0 /* default line width, points (-w) */ 135 | #define DEFAXE 1.0 /* default axes length (-x) */ 136 | #define DEFUAX ZI /* default upward-pointing axis (-u) */ 137 | 138 | -------------------------------------------------------------------------------- /src/zbuf/zbufStruct.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 1990 Massachusetts Institute of Technology, Cambridge, MA. 3 | All rights reserved. 4 | 5 | This Agreement gives you, the LICENSEE, certain rights and obligations. 6 | By using the software, you indicate that you have read, understood, and 7 | will comply with the terms. 8 | 9 | Permission to use, copy and modify for internal, noncommercial purposes 10 | is hereby granted. Any distribution of this program or any part thereof 11 | is strictly prohibited without prior written consent of M.I.T. 12 | 13 | Title to copyright to this software and to any associated documentation 14 | shall at all times remain with M.I.T. and LICENSEE agrees to preserve 15 | same. LICENSEE agrees not to make any copies except for LICENSEE'S 16 | internal noncommercial use, or to use separately any portion of this 17 | software without prior written consent of M.I.T. LICENSEE agrees to 18 | place the appropriate copyright notice on any such copies. 19 | 20 | Nothing in this Agreement shall be construed as conferring rights to use 21 | in advertising, publicity or otherwise any trademark or the name of 22 | "Massachusetts Institute of Technology" or "M.I.T." 23 | 24 | M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By 25 | way of example, but not limitation, M.I.T. MAKES NO REPRESENTATIONS OR 26 | WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 27 | THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS OR DOCUMENTATION WILL 28 | NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. 29 | M.I.T. shall not be held liable for any liability nor for any direct, 30 | indirect or consequential damages with respect to any claim by LICENSEE 31 | or any third party on account of or arising from this Agreement or use 32 | of this software. 33 | */ 34 | 35 | 36 | /* structs used by .ps file dumping part of code (zbuf)--somewhat redundant */ 37 | 38 | struct face { 39 | int numsides; /* number of sides this face has */ 40 | double **c; /* corners of the face */ 41 | double normal[3]; /* normal to the face's plane */ 42 | double rhs; /* rhs for the face's plane equation */ 43 | int index; /* input order index */ 44 | int depth; /* depth index - lower numbers are deeper */ 45 | int mark; /* flag for topological depth ordering */ 46 | double greylev; /* 0 (white) to 1 (black), default = GREYLEV */ 47 | double width; /* line width, default = LINE */ 48 | int numbehind; /* number of faces this face is behind */ 49 | struct face **behind; /* pntrs to faces this face is behind */ 50 | struct face *prev; 51 | struct face *next; 52 | }; 53 | typedef struct face face; 54 | 55 | struct line { 56 | double from[3]; 57 | double to[3]; 58 | int index; 59 | int width; 60 | double arrow; /* != 0.0 => put arrow hd on to end this sz */ 61 | double dot; /* != 0.0 => put dot on to end this sz */ 62 | struct line *prev; 63 | struct line *next; 64 | }; 65 | typedef struct line line; 66 | --------------------------------------------------------------------------------