Skip to content

Commit

Permalink
Merge pull request #7 from vtopt/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
thchang authored May 31, 2022
2 parents 7b985e8 + bd2881c commit f3ffef0
Show file tree
Hide file tree
Showing 20 changed files with 2,036 additions and 207 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,34 @@ Delaunay triangulation. In addition to the original Fortran source code,
this repository contains a wrapper for Python 3.6+ and C bindings.
Command line drivers are also provided with the original Fortran code.

## Organization and Usage
## Usage

The physical organization is as follows. Note that each of the following
directories could be independently downloaded.
`DELAUNAYSPARSE` contains several modes of operation.

In the original ACM TOMS release, two Fortran driver subroutines were provided:
* `DELAUNAYSPARSES` runs the serial driver to identify the vertices
of the simplex/simplices containing one or more interpolation points.
Can also (optionally) be set to compute and return the value of the
Delaunay interpolant.
* `DELAUNAYSPARSEP` runs the parallel driver to identify the vertices
of the simplex/simplices containing one or more interpolation points.
Can also (optionally) be set to compute and return the value of the
Delaunay interpolant (must set the `OMP_NUM_THREADS` environment
variable).

Additionally, two command-line drivers are provided, which read input
from files:
* `delsparses` (uses the serial driver), and
* `delsparsep` (uses the parallel driver).

In this repository, two additional interfaces are provided for calling
from C/C++ (`c_binding`) and Python 3 (`python`).

Further detailed user information is documented in the `USAGE` document.

## Organization

The physical organization is as follows.

* `src` contains the original unmodified Fortran source code, as published
in ACM TOMS Algorithm 1012. This includes 2 command line drivers
Expand All @@ -30,6 +54,10 @@ directories could be independently downloaded.
A test file `test_install.c` can be used for usage examples. This
directory's internal README also contains best practices when calling
Fortran from C/C++.
* `docs` contains the html source for generating the DelaunaySparse website.
* `USAGE` provides additional detailed user information.
* DelaunaySparse is shared under the MIT Software License, in the `LICENSE`
file.

## Citation

Expand Down
549 changes: 549 additions & 0 deletions USAGE.md

Large diffs are not rendered by default.

13 changes: 4 additions & 9 deletions c_binding/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ FORT = gfortran
CC = gcc
CFLAGS = -c
OPTS = -fopenmp
LIBS = blas.f lapack.f
LEGACY = -std=legacy

all: test_install.o delsparse_bind_c.o delsparse.o slatec.o lapack.o blas.o
$(FORT) $(OPTS) test_install.o delsparse_bind_c.o delsparse.o slatec.o lapack.o blas.o -o test_install
all: test_install.o delsparse_bind_c.o delsparse.o slatec.o delsparse.h
$(FORT) $(OPTS) test_install.o delsparse_bind_c.o delsparse.o slatec.o $(LIBS) -o test_install
./test_install

test_install.o: test_install.c
$(CC) $(CFLAGS) $(OPTS) test_install.c -o test_install.o
$(CC) $(CFLAGS) test_install.c -o test_install.o

delsparse_bind_c.o: delsparse_bind_c.f90 delsparse.o
$(FORT) $(CFLAGS) $(OPTS) delsparse_bind_c.f90 -o delsparse_bind_c.o
Expand All @@ -20,11 +21,5 @@ delsparse.o: delsparse.f90
slatec.o : slatec.f
$(FORT) $(CFLAGS) $(OPTS) $(LEGACY) slatec.f -o slatec.o

lapack.o : lapack.f
$(FORT) $(CFLAGS) $(OPTS) lapack.f -o lapack.o

blas.o : blas.f
$(FORT) $(CFLAGS) $(OPTS) blas.f -o blas.o

clean:
rm -f *.o *.mod test_install
59 changes: 59 additions & 0 deletions c_binding/delsparse.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#ifndef DELSPARSEC
#define DELSPARSEC

// serial subroutine: no optional arguments
extern void c_delaunaysparses(int *d, int *n, double pts[], int *m, double q[],
int simps[], double weights[], int ierr[]);

// serial: compute interpolant values
extern void c_delaunaysparses_interp(int *d, int *n, double pts[], int *m,
double q[], int simps[], double weights[],
int ierr[], int *ir, double interp_in[],
double interp_out[]);

// serial: optional arguments, no interpolant values
extern void c_delaunaysparses_opts(int *d, int *n, double pts[], int *m,
double q[],int simps[], double weights[],
int ierr[], double *eps, double *extrap,
double rnorm[], int *ibudget, bool *chain,
bool *exact);

// serial: optional arguments and compute interpolant values
extern void c_delaunaysparses_interp_opts(int *d, int *n, double pts[], int *m,
double q[],int simps[],
double weights[], int ierr[],
int *ir, double interp_in[],
double interp_out[], double *eps,
double *extrap, double rnorm[],
int *ibudget, bool *chain,
bool *exact);


// parallel: no optional arguments
extern void c_delaunaysparsep(int *d, int *n, double pts[], int *m, double q[],
int simps[], double weights[], int ierr[]);

// parallel: compute interpolant values
extern void c_delaunaysparsep_interp(int *d, int *n, double pts[], int *m,
double q[], int simps[], double weights[],
int ierr[], int *ir, double interp_in[],
double interp_out[]);

// parallel: optional arguments, no interpolant values
extern void c_delaunaysparsep_opts(int *d, int *n, double pts[], int *m,
double q[],int simps[], double weights[],
int ierr[], double *eps, double *extrap,
double rnorm[], int *ibudget, bool *chain,
bool *exact, int *pmode);

// parallel: optional arguments and compute interpolant values
extern void c_delaunaysparsep_interp_opts(int *d, int *n, double pts[], int *m,
double q[],int simps[],
double weights[], int ierr[],
int *ir, double interp_in[],
double interp_out[], double *eps,
double *extrap, double rnorm[],
int *ibudget, bool *chain,
bool *exact, int *pmode);

#endif
Loading

0 comments on commit f3ffef0

Please sign in to comment.