• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

arpack/H02-Aug-2021-14,7034,137

blas/H02-Aug-2021-23,57610,817

datapac/H02-Aug-2021-917469

eispack/H02-Aug-2021-7,5863,617

examples/H03-May-2022-3,4563,280

lapack/H02-Aug-2021-99,34241,808

laso/H02-Aug-2021-5,9353,010

libf2c/H02-Aug-2021-10,3088,874

linalg/H02-Aug-2021-2,5451,157

linpack/H02-Aug-2021-14,2887,022

mathews/H02-Aug-2021-523318

minpack/H02-Aug-2021-6,0182,257

napack/H02-Aug-2021-1,9841,335

opt/H02-Aug-2021-12,4945,995

sparse/H03-May-2022-10,1024,561

temperton/H02-Aug-2021-15,0868,890

tests/H03-May-2022-2,1401,136

toms/H02-Aug-2021-1,6591,238

.NoDartCoverageH A D02-Aug-20210

README.mdH A D02-Aug-20218 KiB198172

triangle.READMEH A D02-Aug-20218.5 KiB199148

triangle.cH A D02-Aug-2021636.5 KiB16,01211,435

triangle.hH A D02-Aug-202121.6 KiB30043

v3p_f2c.hH A D02-Aug-20212.1 KiB7967

v3p_f2c_mangle.hH A D02-Aug-20212.3 KiB7466

v3p_f2c_original.hH A D02-Aug-20215.2 KiB223180

v3p_f2c_unmangle.hH A D02-Aug-20211.1 KiB7466

v3p_netlib.hH A D02-Aug-20211.1 KiB5034

v3p_netlib_init.cH A D02-Aug-2021739 2513

v3p_netlib_mangle.hH A D02-Aug-202112.4 KiB379363

v3p_netlib_prototypes.hH A D02-Aug-20218.3 KiB280277

v3p_netlib_unmangle.hH A D02-Aug-20215.3 KiB370363

README.md

1This directory contains two netlib versions.  The routines have been
2grabbed from netlib and other places.  In general the C files are
3direct translations of the FORTRAN, so the `*.f` should be edited if
4improvements are required or mods are to be made.
5
6The old netlib library has been almost completely removed.  All code
7but `triangle.c` and related code belong to the newer `v3p_netlib
8library`.
9
10The `v3p_netlib` library contains updated netlib code converted with `f2c`
11in a thread-safe manner.  Sources have been modified to use the
12`v3p_*.h` headers in this directory.  Types and function names have been
13mangled to start with a `v3p_netlib_` prefix.  This distinguishes them
14from other netlib libraries and keeps the code grouped and isolated.
15
16------------------------------------------------------------------------------
17The `libf2c` directory was created as follows:
18
191. Downloaded and extracted http://www.netlib.org/f2c/libf2c.zip
20
212. Converted sources to include our mangled `f2c` header.
22
23    ```bash
24    for f in libf2c/*.c; do
25        cat $f | sed 's/f2c.h/v3p_f2c.h/' > $f.tmp && mv $f.tmp $f
26    done
27    ```
283. Added a missing leading segment to some sources.
29
30    ```bash
31    for f in libf2c/sig_die.c libf2c/cabs.c; do
32        (echo "#include \"v3p_f2c.h\"
33    #undef abs
34    #undef min
35    #undef max
36    " && cat $f) > $f.tmp &&
37        mv $f.tmp $f
38    done
39    ```
404. Remove calls to `f_exit` from `libf2c/sig_die.c`
41
425. Put `v3p_netlib_`-mangling definitions in `v3p_f2c_mangle.h` and
43`undef` directives in `v3p_f2c_unmangle.h`.  These change the symbol
44and type names using the preprocessor to avoid sweeping changes
45of the code.
46
47Updates to the `libf2c` directory for newer upstream versions should be
48made by first committing them to a new branch and then merging the
49changes to the main tree.
50
51------------------------------------------------------------------------------
52
53The other directories were created as follows:
54
551. Find needed FORTRAN routines from http://www.netlib.org/liblist.html
56
572. Use the web interface to download the routines and dependencies.
58For example at
59
60    http://www.netlib.org/cgi-bin/netlibfiles.pl?filename=/linpack/dsvdc.f
61
62    choose "yes" for including BLAS routines and package as zip or tgz.
63
643. Extract the sources into the `vxl/v3p/netlib` directory.  They should
65automatically create subdirectories like `blas/` and `linpack/` with the
66respecitve sources.
67
684. Commit the original FORTRAN sources.
69    ```bash
70    $ git commit -m "Adding original FORTRAN code for this function."
71    ```
72
735. Convert the sources to C using `f2c` and replace the `f2c.h` header
74inclusion with `v3p_netlib.h`:
75    ```bash
76    for d in blas linpack temperton eispack laso arpack lapack/complex16 lapack/double lapack/single lapack/util napack minpack opt linalg toms datapac mathews; do
77      for f in ${d}/*.f; do
78        b=`echo "$f" | sed 's/.f$//'`
79        if [ ! -f "${b}.c" ]; then
80          echo "Converting ${b}.f to ${b}.c"
81          f2c -A -a -C++ -c -ec -E -P -d${d} ${b}.f &&
82          cat ${b}.c | sed 's/f2c.h/v3p_netlib.h/' > ${b}.c.tmp &&
83          mv ${b}.c.tmp ${b}.c
84        fi
85      done
86    done
87    ```
88    ```bash
89    $ git commit -m "Converted function from FORTRAN to C."
90    ```
91
92  Note the use of options to `f2c`:
93
94    -A    = Produce ANSI C.
95    -a    = Make local variables automatic instead of static (for threads).
96    -C++  = Make code C++ compatible.
97    -c    = Include original FORTRAN code in comments.
98    -ec   = Place uninitialized COMMON blocks in separate files
99    -E    = Declare uninitialized common blocks to be extern.
100    -P    = Write ANSI C prototypes to .P files.
101    -ddir = Write output files to given directory.
102
1036. Put `v3p_netlib_`-mangling definitions in `v3p_netlib_mangle.h` and
104`undef` directives in `v3p_netlib_unmangle.h`.  These change the symbol
105and type names using the preprocessor to avoid sweeping changes of the
106code.  Use
107    ```bash
108    $ nm libv3p_netlib.a | grep " [TRD] "
109    ```
110to identify symbols in the library that have not been
111properly mangled.  Note if using shared libraries the command
112is
113    ```bash
114    $ nm libv3p_netlib.so | grep " [TRD] "
115    ```
116and the shared-library implementation functions `_fini` and `_init` should
117be left alone.
118
1197. Convert prototypes in the `*.P` files generated by `f2c` to `*.h` files
120with the mangled interface.  Include them all in `v3p_netlib_prototypes.h`.
121    ```bash
122    echo "/* Include prototype headers. */" > v3p_netlib_prototypes.h
123    for f in blas/*.P linpack/*.P temperton/*.P eispack/*.P laso/*.P arpack/*.P lapack/*/*.P napack/*.P minpack/*.P opt/*.P linalg/*.P toms/*.P datapac/*.P mathews/*.P; do
124      b=`echo "$f" | sed 's/.P//'`
125      if [ ! -f "${b}.h" ] ; then
126        echo "Converting prototype $b"
127        cat ${b}.P |
128        grep -v "^/\\*" |
129        sed 's/\([A-Za-z0-9]*\)_(/v3p_netlib_\1_(/' |
130        sed 's/(/(\n  /g' |
131        sed 's/, /,\n  /g' |
132        sed 's/)/\n  )/g' |
133        sed 's/const/v3p_netlib_const/g' |
134        sed '/ logical1/ {s/logical1/v3p_netlib_logical1/g}' |
135        sed '/ real/ {s/real/v3p_netlib_real/g}' |
136        sed '/ integer1/ {s/integer1/v3p_netlib_integer1/g}' |
137        sed '/ uinteger/ {s/uinteger/v3p_netlib_uinteger/g}' |
138        sed '/ integer/ {s/integer/v3p_netlib_integer/g}' |
139        sed '/ address/ {s/address/v3p_netlib_address/g}' |
140        sed '/ shortint/ {s/shortint/v3p_netlib_shortint/g}' |
141        sed '/ doublereal/ {s/doublereal/v3p_netlib_doublereal/g}' |
142        sed '/ doublecomplex/ {s/doublecomplex/v3p_netlib_doublecomplex/g}' |
143        sed '/ complex/ {s/complex/v3p_netlib_complex/g}' |
144        sed '/ shortlogical/ {s/shortlogical/v3p_netlib_shortlogical/g}' |
145        sed '/ logical/ {s/logical/v3p_netlib_logical/g}' |
146        sed '/ longint/ {s/longint/v3p_netlib_longint/g}' |
147        sed '/ ulongint/ {s/ulongint/v3p_netlib_ulongint/g}' |
148        sed '/ ftnlen/ {s/ftnlen/v3p_netlib_ftnlen/g}' |
149        sed '/ C_f/ {s/C_f/v3p_netlib_C_f/g}' |
150        sed '/ E_f/ {s/E_f/v3p_netlib_E_f/g}' |
151        sed '/ H_f/ {s/H_f/v3p_netlib_H_f/g}' |
152        sed '/ Z_f/ {s/Z_f/v3p_netlib_Z_f/g}' |
153        cat > ${b}.h
154      fi
155      echo "#include \"${b}.h\"" >> v3p_netlib_prototypes.h
156    done
157    ```
158    ```bash
159    $ git commit -m "Converted .P file prototypes generated by f2c to v3p_netlib_-mangled protytypes in header files."
160    ```
161Some of these prototype header files have been manually edited to add
162`v3p_netlib_const` to some of the arguments.  This is a hack to allow
163const-correct code to call the functions.  The `v3p_netlib_const` macro
164is defined to empty when building sources in side the library which
165allows the f2c-converted code to compile without manual conversion to
166const-correctness.  The macro is defined to "const" when compiling
167other sources which enforces const-correctness for code calling the
168routines.  Since the interface is `extern "C"` code, the symbol names
169are not changed by the presence or absence of `const`.
170    ```bash
171    $ git commit -m "Manually documented prototype and added v3p_netlib_const to appropriate arguments."
172    ```
173------------------------------------------------------------------------------
174
175Thread safety can be partially checked in this directory by running
176    ```bash
177    $ grep "  static" **/*.c |grep -v constant
178    ```
179Global data declared static seem to be constant, so only local
180variables are of concern, which is why the grep expression contains
181spaces.  Local statics that have been manually deemed safe (constant)
182should be marked with a
183    ```cpp
184       /* constant */
185    ```
186comment to avoid being listed in the grep output.  Local statics that
187require one-time initialization at run-time should be marked with a
188    ```cpp
189       /* runtime-initialized constant */
190    ```
191
192comment to avoid being listed in the grep output.  The routines
193holding them should be given a `v3p_netlib_*_init()` function that is
194called from `v3p_netlib_init.c` in the `v3p_netlib_initialize` function.
195
196Functions that call back to user functions have been manually given a
197userdata callback argument.  This allows them to be reentrant.
198

triangle.README

1Triangle
2A Two-Dimensional Quality Mesh Generator and Delaunay Triangulator.
3Version 1.6
4
5Show Me
6A Display Program for Meshes and More.
7Version 1.6
8
9Copyright 1993, 1995, 1997, 1998, 2002, 2005 Jonathan Richard Shewchuk
102360 Woolsey #H
11Berkeley, California  94705-1927
12Please send bugs and comments to jrs@cs.berkeley.edu
13
14Created as part of the Quake project (tools for earthquake simulation).
15Supported in part by NSF Grant CMS-9318163 and an NSERC 1967 Scholarship.
16There is no warranty whatsoever.  Use at your own risk.
17
18
19Triangle generates exact Delaunay triangulations, constrained Delaunay
20triangulations, conforming Delaunay triangulations, Voronoi diagrams, and
21high-quality triangular meshes.  The latter can be generated with no small
22or large angles, and are thus suitable for finite element analysis.
23Show Me graphically displays the contents of the geometric files used by
24Triangle.  Show Me can also write images in PostScript form.
25
26Information on the algorithms used by Triangle, including complete
27references, can be found in the comments at the beginning of the triangle.c
28source file.  Another listing of these references, with PostScript copies
29of some of the papers, is available from the Web page
30
31    http://www.cs.cmu.edu/~quake/triangle.research.html
32
33------------------------------------------------------------------------------
34
35These programs may be freely redistributed under the condition that the
36copyright notices (including the copy of this notice in the code comments
37and the copyright notice printed when the `-h' switch is selected) are
38not removed, and no compensation is received.  Private, research, and
39institutional use is free.  You may distribute modified versions of this
40code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT
41IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH
42SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND
43CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS.  Distribution of this code as
44part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT
45WITH THE AUTHOR.  (If you are not directly supplying this code to a
46customer, and you are instead telling them how they can obtain it for
47free, then you are not required to make any arrangement with me.)
48
49------------------------------------------------------------------------------
50
51The files included in this distribution are:
52
53  README           The file you're reading now.
54  triangle.c       Complete C source code for Triangle.
55  showme.c         Complete C source code for Show Me.
56  triangle.h       Include file for calling Triangle from another program.
57  tricall.c        Sample program that calls Triangle.
58  makefile         Makefile for compiling Triangle and Show Me.
59  A.poly           A sample input file.
60
61Each of Triangle and Show Me is a single portable C file.  The easiest way
62to compile them is to edit and use the included makefile.  Before
63compiling, read the makefile, which describes your options, and edit it
64accordingly.  You should specify:
65
66  The source and binary directories.
67
68  The C compiler and level of optimization.
69
70  The "correct" directories for include files (especially X include files),
71  if necessary.
72
73  Do you want single precision or double?  (The default is double.)  Do you
74  want to leave out some of Triangle's features to reduce the size of the
75  executable file?  Investigate the SINGLE, REDUCED, and CDT_ONLY symbols.
76
77  If yours is not a Unix system, define the NO_TIMER symbol to remove the
78  Unix-specific timing code.  Also, don't try to compile Show Me; it only
79  works with X Windows.
80
81  If you are compiling on an Intel x86 CPU and using gcc w/Linux or
82  Microsoft C, be sure to define the LINUX or CPU86 (for Microsoft) symbol
83  during compilation so that the exact arithmetic works right.
84
85Once you've done this, type "make" to compile the programs.  Alternatively,
86the files are usually easy to compile without a makefile:
87
88  cc -O -o triangle triangle.c -lm
89  cc -O -o showme showme.c -lX11
90
91On some systems, the C compiler won't be able to find the X include files
92or libraries, and you'll need to specify an include path or library path:
93
94  cc -O -I/usr/local/include -o showme showme.c -L/usr/local/lib -lX11
95
96Some processors, including Intel x86 family and possibly Motorola 68xxx
97family chips, are IEEE conformant but have extended length internal
98floating-point registers that may defeat Triangle's exact arithmetic
99routines by failing to cause enough roundoff error!  Typically, there is a
100way to set these internal registers so that they are rounded off to IEEE
101single or double precision format.  I believe (but I'm not certain) that
102Triangle has the right incantations for x86 chips, if you have gcc running
103under Linux (define the LINUX compiler symbol) or Microsoft C (define the
104CPU86 compiler symbol).
105
106If you have a different processor or operating system, or if I got the
107incantations wrong, you should check your C compiler or system manuals to
108find out how to configure these internal registers to the precision you are
109using.  Otherwise, the exact arithmetic routines won't be exact at all.
110See http://www.cs.cmu.edu/~quake/robust.pc.html for details.  Triangle's
111exact arithmetic hasn't a hope of working on machines like the Cray C90 or
112Y-MP, which are not IEEE conformant and have inaccurate rounding.
113
114Triangle and Show Me have both text and HTML documentation.  The latter is
115illustrated.  Find it on the Web at
116
117  http://www.cs.cmu.edu/~quake/triangle.html
118  http://www.cs.cmu.edu/~quake/showme.html
119
120Complete text instructions are printed by invoking each program with the
121`-h' switch:
122
123  triangle -h
124  showme -h
125
126The instructions are long; you'll probably want to pipe the output to
127`more' or `lpr' or redirect it to a file.
128
129Both programs give a short list of command line options if they are invoked
130without arguments (that is, just type `triangle' or `showme').
131
132Try out Triangle on the enclosed sample file, A.poly:
133
134  triangle -p A
135  showme A.poly &
136
137Triangle will read the Planar Straight Line Graph defined by A.poly, and
138write its constrained Delaunay triangulation to A.1.node and A.1.ele.
139Show Me will display the figure defined by A.poly.  There are two buttons
140marked "ele" in the Show Me window; click on the top one.  This will cause
141Show Me to load and display the triangulation.
142
143For contrast, try running
144
145  triangle -pq A
146
147Now, click on the same "ele" button.  A new triangulation will be loaded;
148this one having no angles smaller than 20 degrees.
149
150To see a Voronoi diagram, try this:
151
152  cp A.poly A.node
153  triangle -v A
154
155Click the "ele" button again.  You will see the Delaunay triangulation of
156the points in A.poly, without the segments.  Now click the top "voro" button.
157You will see the Voronoi diagram corresponding to that Delaunay triangulation.
158Click the "Reset" button to see the full extent of the diagram.
159
160------------------------------------------------------------------------------
161
162If you wish to call Triangle from another program, instructions for doing
163so are contained in the file `triangle.h' (but read Triangle's regular
164instructions first!).  Also look at `tricall.c', which provides an example
165of how to call Triangle.
166
167Type "make trilibrary" to create triangle.o, a callable object file.
168Alternatively, the object file is usually easy to compile without a
169makefile:
170
171  cc -DTRILIBRARY -O -c triangle.c
172
173Type "make distclean" to remove all the object and executable files created
174by make.
175
176------------------------------------------------------------------------------
177
178If you use Triangle, and especially if you use it to accomplish real work,
179I would like very much to hear from you.  A short letter or email (to
180jrs@cs.berkeley.edu) describing how you use Triangle will mean a lot to me.
181The more people I know are using this program, the more easily I can
182justify spending time on improvements and on the three-dimensional
183successor to Triangle, which in turn will benefit you.  Also, I can put you
184on a list to receive email whenever a new version of Triangle is available.
185
186If you use a mesh generated by Triangle or plotted by Show Me in a
187publication, please include an acknowledgment as well.  And please spell
188Triangle with a capital `T'!  If you want to include a citation, use
189`Jonathan Richard Shewchuk, ``Triangle:  Engineering a 2D Quality Mesh
190Generator and Delaunay Triangulator,'' in Applied Computational Geometry:
191Towards Geometric Engineering (Ming C. Lin and Dinesh Manocha, editors),
192volume 1148 of Lecture Notes in Computer Science, pages 203-222,
193Springer-Verlag, Berlin, May 1996.  (From the First ACM Workshop on Applied
194Computational Geometry.)'
195
196
197Jonathan Richard Shewchuk
198July 27, 2005
199