c23456789 123456789 123456789 123456789 123456789 123456789 123456789 12 c c Program volare c c This program will compute volumes of Power/Voronoi cells in the c Power/Voronoi diagram of a set of points in 3-dimensional space c and areas of facets of these cells. c c It is assumed that a Regular/Delaunay tetrahedralization for c the set has already been computed using existing program regtet c and that the output tetrahedron list produced by regtet contains c only real tetrahedra (no artificial ones), i. e. logical variable c artfcl was set to .false. during the execution of regtet. It is c also assumed that the Power/Voronoi vertices and unbounded edges c of the Power/Voronoi diagram of the set have already been c computed using existing program pwrvtx with the output c tetrahedron list from regtet as input. The output Power/Voronoi c vertex and tetrahedron lists from pwrvtx are then used as input c below. It is noted that because of degeneracies there may be c facets that are not 2-dimensional any one of which will have zero c area if bounded. In addition, if weights are present, there c may be Power cells that are not 3-dimensional any one of which c will have zero volume if bounded. c c Subroutine volare is the driver routine of the program and is c called from the main routine. c c Description of output variables appears in driver routine volare. c c Author: Javier Bernal c c Disclaimer: c c This software was developed at the National Institute of Standards c and Technology by employees of the Federal Government in the c course of their official duties. Pursuant to title 17 Section 105 c of the United States Code this software is not subject to c copyright protection and is in the public domain. This software is c experimental. NIST assumes no responsibility whatsoever for its c use by other parties, and makes no guarantees, expressed or c implied, about its quality, reliability, or any other c characteristic. We would appreciate acknowledgement if the c software is used. c *MAIN c program main c integer nmax, nvmax, nfmax parameter (nmax=150000, nvmax= 7*nmax, nfmax = 8*nmax) c double precision xp(nvmax), yp(nvmax), zp(nvmax) integer ix(nvmax), iy(nvmax), iz(nvmax) integer ix2(nvmax), iy2(nvmax), iz2(nvmax) integer icon(8,nvmax), ifl(nvmax), id(nvmax) integer is(nmax), itl(nmax), ifn(nmax), ifc(nfmax) double precision vol(nmax), area(nfmax) integer nw, nt, nq, nb, icfig c integer idumy, nw2, nq2, i, j c c---------------------------------------------------------------------- c write(*,*)' ' write(*,*)'This program is for computing volumes of ', * 'Power/Voronoi cells' write(*,*)'in the Power/Voronoi diagram of a set of ', * 'points in 3-d space' write(*,*)'and for computing areas of facets ', * 'of these cells.' write(*,*)' ' write(*,*)'It is assumed that a Regular/Delaunay ', * 'tetrahedralization of the' write(*,*)'set has already been computed using existing program ', * 'regtet and' write(*,*)'that the output tetrahedron list produced by regtet ', * 'contains only' write(*,*)'real tetrahedra (logical variable artfcl was set to ', * '.false. during' write(*,*)'the execution of regtet).' write(*,*)' ' write(*,*)'It is also assumed that the Power/Voronoi vertices ', * 'and the unbounded' write(*,*)'edges of the Power/Voronoi diagram of the set have ', * 'already been' write(*,*)'computed using existing program pwrvtx with the ', * 'output tetrahedron' write(*,*)'list from regtet as input.' write(*,*)' ' write(*,*)'The output Power/Voronoi vertex and tetrahedron ', * 'lists from pwrvtx' write(*,*)'are then used as input by this program. Note that ', * 'because of' write(*,*)'degeneracies there may facets that are not ', * '2-dimensional any one' write(*,*)'of which will have zero area if bounded. ', * 'In addition, if weights' write(*,*)'are present, there may be Power cells that are ', * 'not 3-dimensional' write(*,*)'any one of which will have zero volume if bounded.' write(*,*)' ' write(*,*)'Arrays ifn, ifc, vol, area will contain output ', * 'information.' write(*,*)'Description of these arrays appears in driver ', * 'routine volare.' write(*,*)' ' write(*,*)'In the curret main program these arrays are saved ', * 'in output file' write(*,*)'areas-vols.' c c---------------------------------------------------------------------- c c open files c open (12, file = 'tetra-unbd') open (13, file = 'power-vrts') open (14, file = 'areas-vols') c c---------------------------------------------------------------------- c c read tetrahedralization information c write(*,*)' ' write(*,*)'Reading tetrahedralization information ...' read (12,*) idumy read (12,*) nw, nq if(nw.gt.nmax .or. nq.gt.nvmax) stop 10 read (12,90) ((icon(i,j), i = 1, 8), j = 1, nq) read (12,95) (is(i), i = 1, nw) 90 format (8i10) 95 format (7i10) c c---------------------------------------------------------------------- c if(idumy.lt.0) stop 20 c c---------------------------------------------------------------------- c c set icfig for power vertices c icfig = 9 c c---------------------------------------------------------------------- c c read power vertices c write(*,*)' ' write(*,*)'Reading power vertices ...' read (13,*) nw2, nt, nq2 if(nw2.ne.nw .or. nt.ge.nq2 .or. nq2.ne.nq) stop 30 read (13,*) (ifl(i),i=1,nq) do 300 i = 1, nt read (13,*) xp(i), yp(i), zp(i) 300 continue c c---------------------------------------------------------------------- c write(*,*)' ' write(*,*)'Computation of areas and volumes to begin: driver ', * 'subroutine volare' write(*,*)'will be called from the main routine and areas and ', * 'volumes will be' write(*,*)'computed.' write(*,*)' ' write(*,*)'Please wait ...' write(*,*)' ' c c---------------------------------------------------------------------- c c call volare to compute areas and volumes c call volare(xp, yp, zp, ix, iy, iz, ix2, iy2, iz2, icon, ifl, id, * is, itl, ifn, ifc, vol, area, nmax, nvmax, nfmax, * nw, nt, nq, nb, icfig) c c---------------------------------------------------------------------- c write(*,*)' ' write(*,*)'(Back to the main routine).' write(*,*)'Computation of areas and volumes has been completed.' c c---------------------------------------------------------------------- c c save areas and volumes information c write(*,*)' ' write(*,*)'Saving area and volume information ...' write (14,*) nw, nb write (14,600) (ifn(i),i=1,nw) write (14,700) (ifc(i),i=1,nb) write (14,*) (vol(i),i=1,nw) write (14,*) (area(i),i=1,nb) 600 format (7i10) 700 format (8i10) c c---------------------------------------------------------------------- c write(*,*)' ' stop end *VOLARE c********************************************************************** c c Driver subroutine of Fortran 77 program VOLARE for computing c volumes of Power/Voronoi cells in the Power/Voronoi diagram c of a set of points in 3-dimensional space and areas of facets c of these cells. c c It is assumed that a Regular/Delaunay tetrahedralization for c the set has already been computed using existing program regtet c and that the output tetrahedron list produced by regtet contains c only real tetrahedra (no artificial ones), i. e. logical variable c artfcl was set to .false. during the execution of regtet. It is c also assumed that the Power/Voronoi vertices and unbounded edges c of the Power/Voronoi diagram of the set have already been c computed using existing program pwrvtx with the output c tetrahedron list from regtet as input. The output Power/Voronoi c vertex and tetrahedron lists from pwrvtx are then used as input c by this program. It is noted that because of degeneracies there c may be facets that are not 2-dimensional any one of which will c have zero area if bounded. In addition, if weights are present, c there may be Power cells that are not 3-dimensional any one of c which will have zero volume if bounded. c c Arrays ifn, ifc, vol, area will contain output information. c For i=1,...,nw, vol(i) will be the volume of the Power/Voronoi c cell of point i if point i is active, non-redundant, and its c cell is bounded and none of its vertices was marked as being c too large by program pwrvtx. Otherwise vol(i) will equal -40.0 c if point i is not active or was marked as redundant by program c regtet; -30.0 if the Power/Voronoi cell of point i is unbounded c and has at least one vertex marked as being too large; -20.0 if c the cell is unbounded but has no vertices marked as being too c large; and -10.0 if the cell is bounded but has at least one c vertex marked as being too large. c For l=1,...,nb, area(l) will be the area of the lth facet of c the Power/Voronoi diagram of the set if the facet is bounded c and none of its vertices was marked as being too large by c program pwrvtx. Otherwise area(l) will equal -30.0 if the facet c is unbounded and has at least one vertex marked as being too c large; -20.0 if the facet is unbounded but has no vertices c marked as being too large; and -10.0 if the facet is bounded c but has at least one vertex marked as being too large. Which c facet is the lth facet is determined using arrays ifn and ifc c as described below. c c For l=1,...,nb, ifc(l) will equal an integer, 0 < ifc(l) < nw+1. c For i=1,...,nw, ifn(i) will equal zero if point i is not active c or was marked as redundant by program regtet. Otherwise if l2 c equals ifn(i) and l1 equals the largest among 0 and ifn(j), c j < i, then -1 < l1 < l2 < nb+1, i < ifc(l) for l = l1+1,...,l2, c and point ifc(l) is a Power/Voronoi neighbor of point i for each c l, l = l1+1,...,l2. For l = l1+1,...,l2, the facet shared by c point i and point ifc(l) is the lth facet of the Power/Voronoi c diagram of the set. It is noted that because of degeneracies c this facet may be not be 2-dimensional. Also it is noted that c nb equals the largest among ifn(i), i = 1,...,nw. c c The idea is to have a way of identifying each facet in terms of c the two points that define it, to do this only one time, and then c keep a list of the facets identified this way in a way that is c systematic. Essentially for each integer i, i = 1, ..., nw, if c point i is active and not redundant, two integers l1 and l2 are c identified so that the points ifc(l), l = l1+1, ..., l2, are the c Voronoi/Power neighbors of point i for which i < ifc(l). The last c inequality guarantees that each facet is identified only once. c Since point i is active and not redundant, ifn(i) is not zero and c has been set in the program so that the desired value of l2 is c actually ifn(i). If point (i-1) is active and not redundant, then c ifn(i-1) is not zero and the desired value of l1 is then ifn(i-1). c If point (i-1) is either not active or redundant then ifn(i-1) is c zero and ifn(i-2) then has to be checked in the same way, and so c on. This is why l1 is the largest of 0 and ifn(j), j