├── NEWS ├── ChangeLog ├── makefile.am ├── .gitignore ├── demo_src ├── makefile.am ├── C │ ├── 2D │ │ ├── Ellipse │ │ │ ├── ellipse.h │ │ │ └── main_ellipse.c │ │ ├── Gaussian │ │ │ ├── gaussian.h │ │ │ ├── main_gaussian.c │ │ │ └── gaussian.c │ │ ├── Sine_line │ │ │ ├── sine_line.h │ │ │ ├── main_sine_line.c │ │ │ └── sine_line.c │ │ └── Rectangle │ │ │ ├── rectangle.h │ │ │ └── main_rectangle.c │ ├── 3D │ │ ├── Sine_surface │ │ │ ├── sine_surf.h │ │ │ └── main_sine_surf.c │ │ ├── Cap1 │ │ │ ├── cap1.h │ │ │ └── main_cap1.c │ │ ├── Cap2 │ │ │ ├── cap2.h │ │ │ └── main_cap2.c │ │ ├── Cap3 │ │ │ ├── cap3.h │ │ │ └── main_cap3.c │ │ └── Sphere │ │ │ ├── sphere.h │ │ │ └── main_sphere.c │ └── makefile.am ├── CPP │ ├── 2D │ │ ├── Ellipse │ │ │ ├── ellipse.h │ │ │ └── main_ellipse.cpp │ │ ├── Gaussian │ │ │ ├── gaussian.h │ │ │ ├── main_gaussian.cpp │ │ │ └── gaussian.cpp │ │ ├── Sine_line │ │ │ ├── sine_line.h │ │ │ ├── main_sine_line.cpp │ │ │ └── sine_line.cpp │ │ └── Rectangle │ │ │ ├── rectangle.h │ │ │ └── main_rectangle.cpp │ ├── 3D │ │ ├── Sine_surface │ │ │ ├── sine_surf.h │ │ │ ├── main_sine_surf.cpp │ │ │ └── sine_surf.cpp │ │ ├── Cap1 │ │ │ ├── cap1.h │ │ │ ├── main_cap1.cpp │ │ │ └── cap1.cpp │ │ ├── Cap2 │ │ │ ├── cap2.h │ │ │ ├── main_cap2.cpp │ │ │ └── cap2.cpp │ │ ├── Cap3 │ │ │ ├── cap3.h │ │ │ ├── main_cap3.cpp │ │ │ └── cap3.cpp │ │ └── Sphere │ │ │ ├── sphere.h │ │ │ ├── main_sphere.cpp │ │ │ └── sphere.cpp │ └── makefile.am └── Fortran │ ├── makefile.am │ ├── 3D │ ├── Cap1 │ │ ├── main_cap1.f90 │ │ └── cap1.f90 │ ├── Cap2 │ │ ├── main_cap2.f90 │ │ └── cap2.f90 │ ├── Cap3 │ │ ├── main_cap3.f90 │ │ └── cap3.f90 │ ├── Sphere │ │ ├── main_sphere.f90 │ │ └── sphere.f90 │ └── Sine_surface │ │ └── main_sine_surf.f90 │ └── 2D │ ├── Sine_line │ └── main_sine_line.f90 │ ├── Gaussian │ └── main_gaussian.f90 │ ├── Rectangle │ └── main_rectangle.f90 │ └── Ellipse │ └── main_ellipse.f90 ├── AUTHORS ├── .gitattributes ├── src ├── makefile.am ├── getcc.c ├── interface.c └── getzero.c ├── m4 ├── ltversion.m4 └── ltsugar.m4 ├── LICENSE ├── include └── vofi.h └── test-driver /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | To see recent changes, run 2 | 3 | $ git log 4 | 5 | 6 | -------------------------------------------------------------------------------- /makefile.am: -------------------------------------------------------------------------------- 1 | # Project makefile 2 | 3 | SUBDIRS = src demo_src 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## generic files to ignore 2 | *~ 3 | *.lock 4 | *.DS_Store 5 | *.swp 6 | *.out 7 | *.directory 8 | -------------------------------------------------------------------------------- /demo_src/makefile.am: -------------------------------------------------------------------------------- 1 | # C, CPP and Fortran examples makefile 2 | 3 | SUBDIRS = C CPP Fortran 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Authors: 2 | 3 | Simone Bnà (s.bn@cineca.it) 4 | Sandro Manservisi 5 | Ruben Scardovelli (ruben.scardovelli@unibo.it) 6 | Philip Yecko 7 | Stéphane zaleski 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.m4 linguist-vendored 2 | *.sh linguist-vendored 3 | *.sub linguist-vendored 4 | *.guess linguist-vendored 5 | missing linguist-vendored 6 | test-driver linguist-vendored 7 | install-sh linguist-vendored 8 | depcomp linguist-vendored 9 | configure linguist-vendored 10 | demo_src/* linguist-vendored 11 | -------------------------------------------------------------------------------- /src/makefile.am: -------------------------------------------------------------------------------- 1 | # makefile for the library 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | lib_LTLIBRARIES = libvofi.la 6 | libvofi_la_SOURCES = checkconsistency.c getcc.c getdirs.c getfh.c getintersections.c getlimits.c getmin.c getzero.c integrate.c \ 7 | interface.c 8 | libvofi_la_LDFLAGS = -avoid-version -rpath $(libdir) 9 | libvofi_la_CPPFLAGS = -I$(top_srcdir)/include 10 | 11 | ## For having included files in DISTribution & INSTallation (public headers) 12 | include_HEADERS = $(top_srcdir)/include/vofi.h 13 | 14 | ## For having included files in INSTallation (public headers) 15 | 16 | ## For having included files in DISTribution only (private headers) 17 | noinst_HEADERS = $(top_srcdir)/include/vofi_stddecl.h $(top_srcdir)/include/vofi_GL.h 18 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /demo_src/C/2D/Ellipse/ellipse.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /* grid resolution */ 20 | #define NMX 10 21 | #define NMY 10 22 | 23 | /* computational box */ 24 | #define X0 0.0 25 | #define Y0 0.0 26 | #define H 1.0 27 | 28 | -------------------------------------------------------------------------------- /demo_src/CPP/2D/Ellipse/ellipse.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | //* grid resolution * 20 | #define NMX 10 21 | #define NMY 10 22 | 23 | //* computational box * 24 | #define X0 0.0 25 | #define Y0 0.0 26 | #define H 1.0 27 | 28 | 29 | -------------------------------------------------------------------------------- /demo_src/C/2D/Gaussian/gaussian.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /* grid resolution */ 20 | #define NMX 10 21 | #define NMY 10 22 | 23 | /* computational box */ 24 | #define X0 0.0 25 | #define Y0 0.0 26 | #define H 1.0 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /demo_src/C/2D/Sine_line/sine_line.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /* grid resolution */ 20 | #define NMX 10 21 | #define NMY 10 22 | 23 | /* computational box */ 24 | #define X0 0.0 25 | #define Y0 0.0 26 | #define H 1.0 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /demo_src/CPP/2D/Gaussian/gaussian.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | //* grid resolution * 20 | #define NMX 10 21 | #define NMY 10 22 | 23 | //* computational box * 24 | #define X0 0.0 25 | #define Y0 0.0 26 | #define H 1.0 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /demo_src/CPP/2D/Sine_line/sine_line.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | //* grid resolution * 20 | #define NMX 10 21 | #define NMY 10 22 | 23 | //* computational box * 24 | #define X0 0.0 25 | #define Y0 0.0 26 | #define H 1.0 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /demo_src/C/3D/Sine_surface/sine_surf.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /* grid resolution */ 20 | #define NMX 5 21 | #define NMY 5 22 | #define NMZ 5 23 | 24 | /* computational box */ 25 | #define X0 0.0 26 | #define Y0 0.0 27 | #define Z0 0.0 28 | #define H 1.0 29 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Sine_surface/sine_surf.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | //* grid resolution * 20 | #define NMX 5 21 | #define NMY 5 22 | #define NMZ 5 23 | 24 | //* computational box * 25 | #define X0 0.0 26 | #define Y0 0.0 27 | #define Z0 0.0 28 | #define H 1.0 29 | 30 | 31 | -------------------------------------------------------------------------------- /demo_src/C/2D/Rectangle/rectangle.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) 20 | 21 | /* grid resolution */ 22 | #define NMX 10 23 | #define NMY 10 24 | 25 | /* computational box */ 26 | #define X0 0.0 27 | #define Y0 0.0 28 | #define H 1.0 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /demo_src/CPP/2D/Rectangle/rectangle.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) 20 | 21 | //* grid resolution * 22 | #define NMX 10 23 | #define NMY 10 24 | 25 | //* computational box * 26 | #define X0 0.0 27 | #define Y0 0.0 28 | #define H 1.0 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /demo_src/Fortran/makefile.am: -------------------------------------------------------------------------------- 1 | # Fortran examples makefile 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | TESTS = ellipse_f gaussian_f rectangle_f sine_line_f cap1_f cap2_f cap3_f sine_surf_f sphere_f 6 | bin_PROGRAMS = ellipse_f gaussian_f rectangle_f sine_line_f cap1_f cap2_f cap3_f sine_surf_f sphere_f 7 | ellipse_f_SOURCES = ./2D/Ellipse/ellipse.f90 ./2D/Ellipse/main_ellipse.f90 8 | gaussian_f_SOURCES = ./2D/Gaussian/gaussian.f90 ./2D/Gaussian/main_gaussian.f90 9 | rectangle_f_SOURCES = ./2D/Rectangle/rectangle.f90 ./2D/Rectangle/main_rectangle.f90 10 | sine_line_f_SOURCES = ./2D/Sine_line/sine_line.f90 ./2D/Sine_line/main_sine_line.f90 11 | cap1_f_SOURCES = ./3D/Cap1/cap1.f90 ./3D/Cap1/main_cap1.f90 12 | cap2_f_SOURCES = ./3D/Cap2/cap2.f90 ./3D/Cap2/main_cap2.f90 13 | cap3_f_SOURCES = ./3D/Cap3/cap3.f90 ./3D/Cap3/main_cap3.f90 14 | sine_surf_f_SOURCES = ./3D/Sine_surface/sine_surf.f90 ./3D/Sine_surface/main_sine_surf.f90 15 | sphere_f_SOURCES = ./3D/Sphere/sphere.f90 ./3D/Sphere/main_sphere.f90 16 | LDADD = $(abs_top_builddir)/src/libvofi.la 17 | AM_CPPFLAGS = -I$(abs_top_srcdir)/include 18 | AM_LDFLAGS = -rpath $(libdir) 19 | 20 | DISTCLEANFILES = ellipse_mod.mod gaussian_mod.mod rectangle_mod.mod sineline_mod.mod sinesurface_mod.mod 21 | 22 | installcheck: 23 | @echo "" 24 | @echo "*************************************************************" 25 | @echo "***** Running Fortran-examples in the install directory *****" 26 | @echo "*************************************************************" 27 | @echo "" 28 | @for f in $(TESTS); do $(bindir)/$$f; done -------------------------------------------------------------------------------- /demo_src/C/makefile.am: -------------------------------------------------------------------------------- 1 | # C-examples makefile 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | TESTS = ellipse_c gaussian_c rectangle_c sine_line_c cap1_c cap2_c cap3_c sine_surf_c sphere_c 6 | bin_PROGRAMS = ellipse_c gaussian_c rectangle_c sine_line_c cap1_c cap2_c cap3_c sine_surf_c sphere_c 7 | ellipse_c_SOURCES = ./2D/Ellipse/main_ellipse.c ./2D/Ellipse/ellipse.c ./2D/Ellipse/ellipse.h 8 | gaussian_c_SOURCES = ./2D/Gaussian/main_gaussian.c ./2D/Gaussian/gaussian.c ./2D/Gaussian/gaussian.h 9 | rectangle_c_SOURCES = ./2D/Rectangle/main_rectangle.c ./2D/Rectangle/rectangle.c ./2D/Rectangle/rectangle.h 10 | sine_line_c_SOURCES = ./2D/Sine_line/main_sine_line.c ./2D/Sine_line/sine_line.c ./2D/Sine_line/sine_line.h 11 | cap1_c_SOURCES = ./3D/Cap1/main_cap1.c ./3D/Cap1/cap1.c ./3D/Cap1/cap1.h 12 | cap2_c_SOURCES = ./3D/Cap2/main_cap2.c ./3D/Cap2/cap2.c ./3D/Cap2/cap2.h 13 | cap3_c_SOURCES = ./3D/Cap3/main_cap3.c ./3D/Cap3/cap3.c ./3D/Cap3/cap3.h 14 | sine_surf_c_SOURCES = ./3D/Sine_surface/main_sine_surf.c ./3D/Sine_surface/sine_surf.c ./3D/Sine_surface/sine_surf.h 15 | sphere_c_SOURCES = ./3D/Sphere/main_sphere.c ./3D/Sphere/sphere.c ./3D/Sphere/sphere.h 16 | LDADD = $(abs_top_builddir)/src/libvofi.la 17 | AM_CPPFLAGS = -I$(abs_top_srcdir)/include 18 | AM_LDFLAGS = -rpath $(libdir) 19 | 20 | installcheck: 21 | @echo "" 22 | @echo "*************************************************************" 23 | @echo "******** Running C-examples in the install directory ********" 24 | @echo "*************************************************************" 25 | @echo "" 26 | @for f in $(TESTS); do $(bindir)/$$f; done 27 | -------------------------------------------------------------------------------- /demo_src/C/3D/Cap1/cap1.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /* grid resolution */ 20 | #define NMX 1 21 | #define NMY 1 22 | #define NMZ 1 23 | 24 | /* computational box */ 25 | #define X0 0.0 26 | #define Y0 0.0 27 | #define Z0 0.0 28 | #define H 1.0 29 | 30 | #define MYPI 3.141592653589793238462643 31 | #define ALPHA MYPI/3. 32 | 33 | /* semi axes of the ellipsoid */ 34 | #define A1 4.0 35 | #define B1 5.0 36 | #define C1 6.0 37 | 38 | /* its center */ 39 | #define XC 0.50 40 | #define YC 0.45 41 | #define ZC -5.97 42 | -------------------------------------------------------------------------------- /demo_src/C/3D/Cap2/cap2.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /* grid resolution */ 20 | #define NMX 2 21 | #define NMY 1 22 | #define NMZ 1 23 | 24 | /* computational box */ 25 | #define X0 -1.0 26 | #define Y0 0.0 27 | #define Z0 0.0 28 | #define H 2.0 29 | 30 | #define MYPI 3.141592653589793238462643 31 | #define ALPHA MYPI/3. 32 | 33 | /* semi axes of the ellipsoid */ 34 | #define A1 4.0 35 | #define B1 5.0 36 | #define C1 6.0 37 | 38 | /* its center */ 39 | #define XC 0.30 40 | #define YC 0.45 41 | #define ZC -5.97 42 | -------------------------------------------------------------------------------- /demo_src/C/3D/Cap3/cap3.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /* grid resolution */ 20 | #define NMX 2 21 | #define NMY 2 22 | #define NMZ 1 23 | 24 | /* computational box */ 25 | #define X0 -1.0 26 | #define Y0 -1.0 27 | #define Z0 0.0 28 | #define H 2.0 29 | 30 | #define MYPI 3.141592653589793238462643 31 | #define ALPHA MYPI/3. 32 | 33 | /* semi axes of the ellipsoid */ 34 | #define A1 4.0 35 | #define B1 5.0 36 | #define C1 6.0 37 | 38 | /* its center */ 39 | #define XC 0.35 40 | #define YC 0.35 41 | #define ZC -5.97 42 | -------------------------------------------------------------------------------- /demo_src/C/3D/Sphere/sphere.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /* grid resolution */ 20 | #define NMX 2 21 | #define NMY 2 22 | #define NMZ 2 23 | 24 | /* computational box */ 25 | #define X0 0.0 26 | #define Y0 0.0 27 | #define Z0 0.0 28 | #define H 1.0 29 | 30 | #define MYPI 3.141592653589793238462643 31 | #define ALPHA 0.0 32 | 33 | /* semi axes of the ellipsoid (sphere) */ 34 | #define A1 1.0 35 | #define B1 1.0 36 | #define C1 1.0 37 | 38 | /* its center */ 39 | #define XC 0.0 40 | #define YC 0.0 41 | #define ZC 0.0 42 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Cap1/cap1.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | //* grid resolution * 20 | #define NMX 1 21 | #define NMY 1 22 | #define NMZ 1 23 | 24 | //* computational box * 25 | #define X0 0.0 26 | #define Y0 0.0 27 | #define Z0 0.0 28 | #define H 1.0 29 | 30 | #define MYPI 3.141592653589793238462643 31 | #define ALPHA MYPI/3. 32 | 33 | //* semi axes of the ellipsoid * 34 | #define A1 4.0 35 | #define B1 5.0 36 | #define C1 6.0 37 | 38 | //* its center * 39 | #define XC 0.50 40 | #define YC 0.45 41 | #define ZC -5.97 42 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Cap2/cap2.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | //* grid resolution * 20 | #define NMX 2 21 | #define NMY 1 22 | #define NMZ 1 23 | 24 | //* computational box * 25 | #define X0 -1.0 26 | #define Y0 0.0 27 | #define Z0 0.0 28 | #define H 2.0 29 | 30 | #define MYPI 3.141592653589793238462643 31 | #define ALPHA MYPI/3. 32 | 33 | //* semi axes of the ellipsoid * 34 | #define A1 4.0 35 | #define B1 5.0 36 | #define C1 6.0 37 | 38 | //* its center * 39 | #define XC 0.30 40 | #define YC 0.45 41 | #define ZC -5.97 42 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Cap3/cap3.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | //* grid resolution * 20 | #define NMX 2 21 | #define NMY 2 22 | #define NMZ 1 23 | 24 | //* computational box * 25 | #define X0 -1.0 26 | #define Y0 -1.0 27 | #define Z0 0.0 28 | #define H 2.0 29 | 30 | #define MYPI 3.141592653589793238462643 31 | #define ALPHA MYPI/3. 32 | 33 | //* semi axes of the ellipsoid * 34 | #define A1 4.0 35 | #define B1 5.0 36 | #define C1 6.0 37 | 38 | //* its center * 39 | #define XC 0.35 40 | #define YC 0.35 41 | #define ZC -5.97 42 | -------------------------------------------------------------------------------- /demo_src/CPP/makefile.am: -------------------------------------------------------------------------------- 1 | # Cpp-examples makefile 2 | 3 | ACLOCAL_AMFLAGS = -I m4 4 | 5 | TESTS = ellipse_cpp gaussian_cpp rectangle_cpp sine_line_cpp cap1_cpp cap2_cpp cap3_cpp sine_surf_cpp sphere_cpp 6 | bin_PROGRAMS = ellipse_cpp gaussian_cpp rectangle_cpp sine_line_cpp cap1_cpp cap2_cpp cap3_cpp sine_surf_cpp sphere_cpp 7 | ellipse_cpp_SOURCES = ./2D/Ellipse/main_ellipse.cpp ./2D/Ellipse/ellipse.cpp ./2D/Ellipse/ellipse.h 8 | gaussian_cpp_SOURCES = ./2D/Gaussian/main_gaussian.cpp ./2D/Gaussian/gaussian.cpp ./2D/Gaussian/gaussian.h 9 | rectangle_cpp_SOURCES = ./2D/Rectangle/main_rectangle.cpp ./2D/Rectangle/rectangle.cpp ./2D/Rectangle/rectangle.h 10 | sine_line_cpp_SOURCES = ./2D/Sine_line/main_sine_line.cpp ./2D/Sine_line/sine_line.cpp ./2D/Sine_line/sine_line.h 11 | cap1_cpp_SOURCES = ./3D/Cap1/main_cap1.cpp ./3D/Cap1/cap1.cpp ./3D/Cap1/cap1.h 12 | cap2_cpp_SOURCES = ./3D/Cap2/main_cap2.cpp ./3D/Cap2/cap2.cpp ./3D/Cap2/cap2.h 13 | cap3_cpp_SOURCES = ./3D/Cap3/main_cap3.cpp ./3D/Cap3/cap3.cpp ./3D/Cap3/cap3.h 14 | sine_surf_cpp_SOURCES = ./3D/Sine_surface/main_sine_surf.cpp ./3D/Sine_surface/sine_surf.cpp ./3D/Sine_surface/sine_surf.h 15 | sphere_cpp_SOURCES = ./3D/Sphere/main_sphere.cpp ./3D/Sphere/sphere.cpp ./3D/Sphere/sphere.h 16 | LDADD = $(abs_top_builddir)/src/libvofi.la 17 | AM_CPPFLAGS = -I$(abs_top_srcdir)/include 18 | AM_LDFLAGS = -rpath $(libdir) 19 | 20 | installcheck: 21 | @echo "" 22 | @echo "*************************************************************" 23 | @echo "******* Running Cpp-examples in the install directory *******" 24 | @echo "*************************************************************" 25 | @echo "" 26 | @for f in $(TESTS); do $(bindir)/$$f; done -------------------------------------------------------------------------------- /demo_src/CPP/3D/Sphere/sphere.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | //* grid resolution * 20 | #define NMX 2 21 | #define NMY 2 22 | #define NMZ 2 23 | 24 | //* computational box * 25 | #define X0 0.0 26 | #define Y0 0.0 27 | #define Z0 0.0 28 | #define H 1.0 29 | 30 | #define MYPI 3.141592653589793238462643 31 | #define ALPHA 0.0 32 | 33 | //* semi axes of the ellipsoid (sphere) * 34 | #define A1 1.0 35 | #define B1 1.0 36 | #define C1 1.0 37 | 38 | //* its center * 39 | #define XC 0.0 40 | #define YC 0.0 41 | #define ZC 0.0 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The CPC non-profit use licence agreement is an agreement between the 2 | author(s) of a program distributed by the CPC Program Library and the person 3 | who acquires it. By acquiring the program the person is agreeing to be bound 4 | by the terms of this agreement. 5 | 6 | 1. This licence entitles the licensee (one person) and the licensee's research 7 | group to obtain a copy of the source or executable code and to use the 8 | acquired program for academic or non-profit use within a research 9 | group; or, it entitles the licensee (one company, organisation or 10 | computing centre) to install the program and allow access to the 11 | executable code to members of the licensee's organisation for academic 12 | or non-profit use. No user or site will re-distribute the source code or 13 | executable code to a third party in original or modified form without the 14 | written permission of the author. 15 | 16 | 2. Publications which result from using the acquired program will reference 17 | the article in Computer Physics Communications which describes the 18 | program. 19 | 20 | 3. This licence does not permit any commercial (profit-making or 21 | proprietary) use or re-licensing or re-distributions. Persons interested in 22 | for-profit use should contact the author. 23 | 24 | 4. To the extent permissible under applicable laws, no responsibility is 25 | assumed and is hereby disclaimed by Elsevier for any injury and/or 26 | damage to persons or property as a result of any actual or alleged 27 | libelous statements, infringement of intellectual property or privacy 28 | rights, or products liability, whether resulting from negligence or 29 | otherwise, including without limitation from any use or operation of any 30 | ideas, instructions, procedures, products or methods contained in the 31 | material therein. Access to this site is provided on an "as is" basis, and 32 | Elsevier does not warrant that the information or software contained 33 | herein is complete or accurate or free from error. 34 | This information or software is provided by its creators or authors as a 35 | service to Elsevier subscribers on an "as is" basis, and if downloaded by 36 | the subscriber should be checked for defects or viruses before being 37 | used. Unless noted otherwise, the creators or authors retain copyright 38 | and other proprietary rights. -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Cap1/main_cap1.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM CAP1 20 | 21 | IMPLICIT NONE 22 | INTEGER, PARAMETER :: NMX = 1, NMY = 1, NMZ = 1 23 | INTEGER, PARAMETER :: NDIM = 3, N2D = 2, N3D = 3 24 | REAL(8), PARAMETER :: X0 = 0.D0, Y0 = 0.D0, Z0 = 0.D0, H = 1.D0 25 | INTEGER :: nx=NMX, ny=NMY, nz=NMZ, ndim0=N3D 26 | INTEGER :: i,j,k,itrue 27 | REAL(8), DIMENSION(NMX,NMY,NMZ) :: cc 28 | REAL(8), DIMENSION(3) :: xv,xloc 29 | REAL(8) :: h0,fh,vol_n 30 | REAl(8), EXTERNAL :: IMPL_FUNC,VOFI_GET_CC,VOFI_GET_FH 31 | 32 | ! ********************************************************************* 33 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 34 | ! ********************************************************************* 35 | 36 | h0 = H/nx 37 | itrue = 1 38 | 39 | ! starting point to get fh 40 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.5D0; 41 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 42 | 43 | ! put now starting point in (X0,Y0,Z0) to initialize the color function 44 | xv(1) = X0; xv(2) = Y0; xv(3) = Z0; 45 | 46 | ! xloc: minor vertex of each cell of the grid 47 | DO k=1,nz 48 | DO j=1,ny 49 | DO i=1,nx 50 | xloc(1) = xv(1) + (i-1.D0)*h0 51 | xloc(2) = xv(2) + (j-1.D0)*h0 52 | xloc(3) = xv(3) + (k-1.D0)*h0 53 | 54 | cc(i,j,k) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 55 | END DO 56 | END DO 57 | END DO 58 | 59 | ! final global check 60 | vol_n = 0.0D0 61 | 62 | DO k=1,nz 63 | DO j=1,ny 64 | DO i=1,nx 65 | vol_n = vol_n + cc(i,j,k) 66 | END DO 67 | END DO 68 | END DO 69 | 70 | vol_n = vol_n*h0*h0*h0 71 | 72 | CALL check_volume(vol_n) 73 | 74 | END PROGRAM CAP1 75 | -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Cap2/main_cap2.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM CAP2 20 | 21 | IMPLICIT NONE 22 | INTEGER, PARAMETER :: NMX = 2, NMY = 1, NMZ = 1 23 | INTEGER, PARAMETER :: NDIM = 3, N2D = 2, N3D = 3 24 | REAL(8), PARAMETER :: X0 = -1.D0, Y0 = 0.D0, Z0 = 0.D0, H = 2.D0 25 | INTEGER :: nx=NMX, ny=NMY, nz=NMZ, ndim0=N3D 26 | INTEGER :: i,j,k,itrue 27 | REAL(8), DIMENSION(NMX,NMY,NMZ) :: cc 28 | REAL(8), DIMENSION(3) :: xv,xloc 29 | REAL(8) :: h0,fh,vol_n 30 | REAl(8), EXTERNAL :: IMPL_FUNC,VOFI_GET_CC,VOFI_GET_FH 31 | 32 | ! ********************************************************************* 33 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 34 | ! ********************************************************************* 35 | 36 | h0 = H/nx 37 | itrue = 1 38 | 39 | ! starting point to get fh 40 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.5D0; 41 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 42 | 43 | ! put now starting point in (X0,Y0,Z0) to initialize the color function 44 | xv(1) = X0; xv(2) = Y0; xv(3) = Z0; 45 | 46 | ! xloc: minor vertex of each cell of the grid 47 | DO k=1,nz 48 | DO j=1,ny 49 | DO i=1,nx 50 | xloc(1) = xv(1) + (i-1.D0)*h0 51 | xloc(2) = xv(2) + (j-1.D0)*h0 52 | xloc(3) = xv(3) + (k-1.D0)*h0 53 | 54 | cc(i,j,k) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 55 | END DO 56 | END DO 57 | END DO 58 | 59 | ! final global check 60 | vol_n = 0.0D0 61 | 62 | DO k=1,nz 63 | DO j=1,ny 64 | DO i=1,nx 65 | vol_n = vol_n + cc(i,j,k) 66 | END DO 67 | END DO 68 | END DO 69 | 70 | vol_n = vol_n*h0*h0*h0 71 | 72 | CALL check_volume(vol_n) 73 | 74 | END PROGRAM CAP2 75 | -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Cap3/main_cap3.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM CAP3 20 | 21 | IMPLICIT NONE 22 | INTEGER, PARAMETER :: NMX = 2, NMY = 2, NMZ = 1 23 | INTEGER, PARAMETER :: NDIM = 3, N2D = 2, N3D = 3 24 | REAL(8), PARAMETER :: X0 = -1.D0, Y0 = -1.D0, Z0 = 0.D0, H = 2.D0 25 | INTEGER :: nx=NMX, ny=NMY, nz=NMZ, ndim0=N3D 26 | INTEGER :: i,j,k,itrue 27 | REAL(8), DIMENSION(NMX,NMY,NMZ) :: cc 28 | REAL(8), DIMENSION(3) :: xv,xloc 29 | REAL(8) :: h0,fh,vol_n 30 | REAl(8), EXTERNAL :: IMPL_FUNC,VOFI_GET_CC,VOFI_GET_FH 31 | 32 | ! ********************************************************************* 33 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 34 | ! ********************************************************************* 35 | 36 | h0 = H/nx 37 | itrue = 1 38 | 39 | ! starting point to get fh 40 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.5D0; 41 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 42 | 43 | ! put now starting point in (X0,Y0,Z0) to initialize the color function 44 | xv(1) = X0; xv(2) = Y0; xv(3) = Z0; 45 | 46 | ! xloc: minor vertex of each cell of the grid 47 | DO k=1,nz 48 | DO j=1,ny 49 | DO i=1,nx 50 | xloc(1) = xv(1) + (i-1.D0)*h0 51 | xloc(2) = xv(2) + (j-1.D0)*h0 52 | xloc(3) = xv(3) + (k-1.D0)*h0 53 | 54 | cc(i,j,k) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 55 | END DO 56 | END DO 57 | END DO 58 | 59 | ! final global check 60 | vol_n = 0.0D0 61 | 62 | DO k=1,nz 63 | DO j=1,ny 64 | DO i=1,nx 65 | vol_n = vol_n + cc(i,j,k) 66 | END DO 67 | END DO 68 | END DO 69 | 70 | vol_n = vol_n*h0*h0*h0 71 | 72 | CALL check_volume(vol_n) 73 | 74 | END PROGRAM CAP3 75 | -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Sphere/main_sphere.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM SPHERE 20 | 21 | IMPLICIT NONE 22 | INTEGER, PARAMETER :: NMX = 2, NMY = 2, NMZ = 2 23 | INTEGER, PARAMETER :: NDIM = 3, N2D = 2, N3D = 3 24 | REAL(8), PARAMETER :: X0 = 0.D0, Y0 = 0.D0, Z0 = 0.D0, H = 1.D0 25 | INTEGER :: nx=NMX, ny=NMY, nz=NMZ, ndim0=N3D 26 | INTEGER :: i,j,k,itrue 27 | REAL(8), DIMENSION(NMX,NMY,NMZ) :: cc 28 | REAL(8), DIMENSION(3) :: xv,xloc 29 | REAL(8) :: h0,fh,vol_n 30 | REAl(8), EXTERNAL :: IMPL_FUNC,VOFI_GET_CC,VOFI_GET_FH 31 | 32 | ! ********************************************************************* 33 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 34 | ! ********************************************************************* 35 | 36 | h0 = H/nx 37 | itrue = 1 38 | 39 | ! starting point to get fh 40 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.5D0; 41 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 42 | 43 | ! put now starting point in (X0,Y0,Z0) to initialize the color function 44 | xv(1) = X0; xv(2) = Y0; xv(3) = Z0; 45 | 46 | ! xloc: minor vertex of each cell of the grid 47 | DO k=1,nz 48 | DO j=1,ny 49 | DO i=1,nx 50 | xloc(1) = xv(1) + (i-1.D0)*h0 51 | xloc(2) = xv(2) + (j-1.D0)*h0 52 | xloc(3) = xv(3) + (k-1.D0)*h0 53 | 54 | cc(i,j,k) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 55 | END DO 56 | END DO 57 | END DO 58 | 59 | ! final global check 60 | vol_n = 0.0D0 61 | 62 | DO k=1,nz 63 | DO j=1,ny 64 | DO i=1,nx 65 | vol_n = vol_n + cc(i,j,k) 66 | END DO 67 | END DO 68 | END DO 69 | 70 | vol_n = vol_n*h0*h0*h0 71 | 72 | CALL check_volume(vol_n) 73 | 74 | END PROGRAM SPHERE 75 | -------------------------------------------------------------------------------- /src/getcc.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /** 20 | * @file getcc.c 21 | * @authors Simone Bnà, Sandro Manservisi, Ruben Scardovelli, 22 | * Philip Yecko and Stephane Zaleski 23 | * @date 12 November 2015 24 | * @brief Driver to compute the integration limits and the volume fraction 25 | * in two and three dimensions. 26 | */ 27 | 28 | #include "vofi_stddecl.h" 29 | 30 | /* -------------------------------------------------------------------------- * 31 | * DESCRIPTION: * 32 | * Driver to compute the volume fraction value in a given cell in two and * 33 | * three dimensions * 34 | * INPUT: pointer to the implicit function, starting point x0, grid * 35 | * spacing h0, characteristic function value fh, space dimension ndim0 * 36 | * OUTPUT: cc: volume fraction value * 37 | * -------------------------------------------------------------------------- */ 38 | 39 | vofi_real vofi_Get_cc(integrand impl_func,vofi_creal x0[],vofi_creal h0,vofi_creal fh,vofi_cint ndim0) 40 | { 41 | int nsub; 42 | vofi_real pdir[NDIM],sdir[NDIM],tdir[NDIM],side[NSEG]; 43 | vofi_real cc; 44 | dir_data icps; 45 | 46 | icps = vofi_get_dirs(impl_func,x0,pdir,sdir,tdir,h0,fh,ndim0); 47 | if (icps.icc >= 0) 48 | cc = (vofi_real) icps.icc; 49 | else { 50 | nsub = vofi_get_limits(impl_func,x0,side,pdir,sdir,tdir,h0,ndim0); 51 | if (ndim0 == 2) 52 | cc = vofi_get_area(impl_func,x0,side,pdir,sdir,h0,nsub,icps.ipt); 53 | else 54 | cc = vofi_get_volume(impl_func,x0,side,pdir,sdir,tdir,h0,nsub,icps.ipt); 55 | } 56 | 57 | return cc; 58 | } 59 | -------------------------------------------------------------------------------- /src/interface.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /** 20 | * @file interface.c 21 | * @authors Simone Bnà, Sandro Manservisi, Ruben Scardovelli, 22 | * Philip Yecko and Stephane Zaleski 23 | * @date 12 November 2015 24 | * @brief FORTRAN to C interface for the functions vofi_Get_fh 25 | * vofi_Get_cc. 26 | */ 27 | 28 | #include "vofi_stddecl.h" 29 | #include "vofi.h" 30 | 31 | /* ------------------------------------------------------------------- * 32 | * DESCRIPTION: * 33 | * FORTRAN to C interface for the function vofi_Get_fh * 34 | * INPUT and OUTPUT: see vofi_Get_fh * 35 | * ------------------------------------------------------------------- */ 36 | 37 | vofi_real EXPORT(vofi_get_fh)(integrand impl_func,vofi_creal x0[],vofi_creal *H0,vofi_cint *Ndim0,vofi_cint *iX0) 38 | { 39 | vofi_creal h0 = *H0; 40 | vofi_cint ndim0 = *Ndim0, ix0 = *iX0; 41 | vofi_real Fh; 42 | 43 | Fh = vofi_Get_fh(impl_func,x0,h0,ndim0,ix0); 44 | 45 | return Fh; 46 | } 47 | 48 | /* ------------------------------------------------------------------- * 49 | * DESCRIPTION: * 50 | * FORTRAN to C interface for the function vofi_Get_cc * 51 | * INPUT and OUTPUT: see vofi_Get_cc * 52 | * ------------------------------------------------------------------- */ 53 | 54 | vofi_real EXPORT(vofi_get_cc)(integrand impl_func,vofi_creal x0[],vofi_creal *H0,vofi_creal *Fh,vofi_cint *Ndim0) 55 | { 56 | vofi_creal h0= *H0, fh = *Fh; 57 | vofi_cint ndim0 = *Ndim0; 58 | vofi_real CC; 59 | 60 | CC = vofi_Get_cc(impl_func,x0,h0,fh,ndim0); 61 | 62 | return CC; 63 | } 64 | -------------------------------------------------------------------------------- /demo_src/Fortran/2D/Sine_line/main_sine_line.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM SINELINE 20 | 21 | USE SINELINE_MOD 22 | IMPLICIT NONE 23 | INTEGER, PARAMETER :: NMX = 10, NMY = 10, NDIM = 3, N2D = 2 24 | REAL(8), PARAMETER :: X0 = 0.D0, Y0 = 0.D0, H = 1.D0 25 | INTEGER :: nx=NMX, ny=NMY, ndim0=N2D 26 | INTEGER :: i,j,itrue 27 | REAL(8), DIMENSION(NMX,NMY) :: cc 28 | REAL(8), DIMENSION(3) :: xv,xloc 29 | CHARACTER(len=32) :: arg 30 | LOGICAL :: randominput = .FALSE. 31 | 32 | REAL(8) :: h0,fh,area_n 33 | REAl(8), EXTERNAL :: VOFI_GET_CC,VOFI_GET_FH 34 | 35 | ! ********************************************************************* 36 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 37 | ! ********************************************************************* 38 | DO i = 1, iargc() 39 | CALL getarg(i, arg) 40 | IF(arg == '-r' .OR. arg == '--randominput') THEN 41 | randominput = .TRUE. 42 | END IF 43 | END DO 44 | 45 | h0 = H/nx 46 | itrue = 1 47 | 48 | CALL INIT(randominput) 49 | 50 | ! starting point to get fh 51 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.0D0; 52 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 53 | 54 | ! put now starting point in (X0,Y0,0.) to initialize the color function 55 | xv(1) = X0; xv(2) = Y0; 56 | 57 | ! xloc: minor vertex of each cell of the grid 58 | xloc(3) = 0.0D0 59 | DO j=1,ny 60 | DO i=1,nx 61 | xloc(1) = xv(1) + (i-1.D0)*h0 62 | xloc(2) = xv(2) + (j-1.D0)*h0 63 | 64 | cc(i,j) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 65 | END DO 66 | END DO 67 | 68 | ! final global check 69 | area_n = 0.0D0 70 | 71 | DO j=1,ny 72 | DO i=1,nx 73 | area_n = area_n + cc(i,j) 74 | END DO 75 | END DO 76 | 77 | area_n = area_n*h0*h0 78 | 79 | CALL CHECK_AREA(area_n, randominput) 80 | 81 | END PROGRAM SINELINE 82 | -------------------------------------------------------------------------------- /demo_src/Fortran/2D/Gaussian/main_gaussian.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM GAUSSIAN 20 | 21 | USE GAUSSIAN_MOD 22 | IMPLICIT NONE 23 | INTEGER, PARAMETER :: NMX = 10, NMY = 10, NDIM = 3, N2D = 2 24 | REAL(8), PARAMETER :: X0 = 0.D0, Y0 = 0.D0, H = 1.D0 25 | INTEGER :: nx=NMX, ny=NMY, ndim0=N2D 26 | INTEGER :: i,j,itrue 27 | REAL(8), DIMENSION(NMX,NMY) :: cc 28 | REAL(8), DIMENSION(3) :: xv,xloc 29 | CHARACTER(len=32) :: arg 30 | LOGICAL :: randominput = .FALSE. 31 | 32 | REAL(8) :: h0,fh,area_n 33 | REAl(8), EXTERNAL :: VOFI_GET_CC,VOFI_GET_FH 34 | 35 | ! ********************************************************************* 36 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 37 | ! ********************************************************************* 38 | DO i = 1, iargc() 39 | CALL getarg(i, arg) 40 | IF(arg == '-r' .OR. arg == '--randominput') THEN 41 | randominput = .TRUE. 42 | END IF 43 | END DO 44 | 45 | ! grid spacing 46 | h0 = H/nx 47 | itrue = 1 48 | 49 | CALL INIT(randominput) 50 | 51 | ! starting point to get fh 52 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.0D0; 53 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 54 | 55 | ! put now starting point in (X0,Y0,0.) to initialize the color function 56 | xv(1) = X0; xv(2) = Y0; 57 | 58 | ! xloc: minor vertex of each cell of the grid 59 | xloc(3) = 0.0D0 60 | DO j=1,ny 61 | DO i=1,nx 62 | xloc(1) = xv(1) + (i-1.D0)*h0 63 | xloc(2) = xv(2) + (j-1.D0)*h0 64 | 65 | cc(i,j) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 66 | END DO 67 | END DO 68 | 69 | ! final global check 70 | area_n = 0.0D0 71 | 72 | DO j=1,ny 73 | DO i=1,nx 74 | area_n = area_n + cc(i,j) 75 | END DO 76 | END DO 77 | 78 | area_n = area_n*h0*h0 79 | 80 | CALL CHECK_AREA(area_n, randominput) 81 | 82 | END PROGRAM GAUSSIAN 83 | -------------------------------------------------------------------------------- /demo_src/Fortran/2D/Rectangle/main_rectangle.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM RECTANGLE 20 | 21 | USE RECTANGLE_MOD 22 | IMPLICIT NONE 23 | INTEGER, PARAMETER :: NMX = 10, NMY = 10, NDIM = 3, N2D = 2 24 | REAL(8), PARAMETER :: X0 = 0.D0, Y0 = 0.D0, H = 1.D0 25 | INTEGER :: nx=NMX, ny=NMY, ndim0=N2D 26 | INTEGER :: i,j,itrue 27 | REAL(8), DIMENSION(NMX,NMY) :: cc 28 | REAL(8), DIMENSION(3) :: xv,xloc 29 | CHARACTER(len=32) :: arg 30 | LOGICAL :: randominput = .FALSE. 31 | 32 | REAL(8) :: h0,fh,area_n 33 | REAl(8), EXTERNAL :: VOFI_GET_CC,VOFI_GET_FH 34 | 35 | ! ********************************************************************* 36 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 37 | ! ********************************************************************* 38 | DO i = 1, iargc() 39 | CALL getarg(i, arg) 40 | IF(arg == '-r' .OR. arg == '--randominput') THEN 41 | randominput = .TRUE. 42 | END IF 43 | END DO 44 | 45 | ! grid spacing 46 | h0 = H/nx 47 | itrue = 1 48 | 49 | CALL INIT(randominput) 50 | 51 | ! starting point to get fh 52 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.0D0; 53 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 54 | 55 | ! put now starting point in (X0,Y0,0.) to initialize the color function 56 | xv(1) = X0; xv(2) = Y0; 57 | 58 | ! xloc: minor vertex of each cell of the grid 59 | xloc(3) = 0.0D0 60 | DO j=1,ny 61 | DO i=1,nx 62 | xloc(1) = xv(1) + (i-1.D0)*h0 63 | xloc(2) = xv(2) + (j-1.D0)*h0 64 | 65 | cc(i,j) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 66 | END DO 67 | END DO 68 | 69 | ! final global check 70 | area_n = 0.0D0 71 | 72 | DO j=1,ny 73 | DO i=1,nx 74 | area_n = area_n + cc(i,j) 75 | END DO 76 | END DO 77 | 78 | area_n = area_n*h0*h0 79 | 80 | CALL CHECK_AREA(area_n, randominput) 81 | 82 | END PROGRAM RECTANGLE 83 | -------------------------------------------------------------------------------- /demo_src/Fortran/2D/Ellipse/main_ellipse.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM ELLIPSE 20 | 21 | USE ELLIPSE_MOD 22 | IMPLICIT NONE 23 | INTEGER, PARAMETER :: NMX = 10, NMY = 10, NDIM = 3, N2D = 2 24 | REAL(8), PARAMETER :: X0 = 0.D0, Y0 = 0.D0, H = 1.D0 25 | INTEGER :: nx=NMX, ny=NMY, ndim0=N2D 26 | INTEGER :: i,j,itrue 27 | REAL(8), DIMENSION(NMX,NMY) :: cc 28 | REAL(8), DIMENSION(3) :: xv,xloc 29 | CHARACTER(len=32) :: arg 30 | LOGICAL :: randominput = .FALSE. 31 | 32 | REAL(8) :: h0,fh,area_n 33 | REAl(8), EXTERNAL :: VOFI_GET_CC,VOFI_GET_FH 34 | 35 | 36 | ! ********************************************************************* 37 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 38 | ! ********************************************************************* 39 | DO i = 1, iargc() 40 | CALL getarg(i, arg) 41 | IF(arg == '-r' .OR. arg == '--randominput') THEN 42 | randominput = .TRUE. 43 | END IF 44 | END DO 45 | 46 | 47 | ! grid spacing 48 | h0 = H/nx 49 | itrue = 1 50 | 51 | CALL INIT(randominput) 52 | 53 | ! starting point to get fh 54 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.0D0; 55 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 56 | 57 | ! put now starting point in (X0,Y0,0.) to initialize the color function 58 | xv(1) = X0; xv(2) = Y0; 59 | 60 | ! xloc: minor vertex of each cell of the grid 61 | xloc(3) = 0.0D0 62 | DO j=1,ny 63 | DO i=1,nx 64 | xloc(1) = xv(1) + (i-1.D0)*h0 65 | xloc(2) = xv(2) + (j-1.D0)*h0 66 | 67 | cc(i,j) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 68 | END DO 69 | END DO 70 | 71 | ! final global check 72 | area_n = 0.0D0 73 | 74 | DO j=1,ny 75 | DO i=1,nx 76 | area_n = area_n + cc(i,j) 77 | END DO 78 | END DO 79 | 80 | area_n = area_n*h0*h0 81 | 82 | CALL CHECK_AREA(area_n, randominput) 83 | 84 | END PROGRAM ELLIPSE 85 | -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Sine_surface/main_sine_surf.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | PROGRAM SINESURF 20 | 21 | USE SINESURFACE_MOD 22 | IMPLICIT NONE 23 | INTEGER, PARAMETER :: NMX = 5, NMY = 5, NMZ = 5 24 | INTEGER, PARAMETER :: NDIM = 3, N2D = 2, N3D = 3 25 | REAL(8), PARAMETER :: X0 = 0.D0, Y0 = 0.D0, Z0 = 0.D0, H = 1.D0 26 | INTEGER :: nx=NMX, ny=NMY, nz=NMZ, ndim0=N3D 27 | INTEGER :: i,j,k,itrue 28 | REAL(8), DIMENSION(NMX,NMY,NMZ) :: cc 29 | REAL(8), DIMENSION(3) :: xv,xloc 30 | CHARACTER(len=32) :: arg 31 | LOGICAL :: randominput = .FALSE. 32 | 33 | REAL(8) :: h0,fh,vol_n 34 | REAl(8), EXTERNAL :: VOFI_GET_CC,VOFI_GET_FH 35 | 36 | ! ********************************************************************* 37 | ! PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD 38 | ! ********************************************************************* 39 | DO i = 1, iargc() 40 | CALL getarg(i, arg) 41 | IF(arg == '-r' .OR. arg == '--randominput') THEN 42 | randominput = .TRUE. 43 | END IF 44 | END DO 45 | 46 | h0 = H/nx 47 | itrue = 1 48 | 49 | CALL INIT(randominput) 50 | 51 | ! starting point to get fh 52 | xv(1) = 0.5D0; xv(2) = 0.5D0; xv(3) = 0.5D0; 53 | fh = VOFI_GET_FH(IMPL_FUNC,xv,h0,ndim0,itrue) 54 | 55 | ! put now starting point in (X0,Y0,Z0) to initialize the color function 56 | xv(1) = X0; xv(2) = Y0; xv(3) = Z0; 57 | 58 | ! xloc: minor vertex of each cell of the grid 59 | DO k=1,nz 60 | DO j=1,ny 61 | DO i=1,nx 62 | xloc(1) = xv(1) + (i-1.D0)*h0 63 | xloc(2) = xv(2) + (j-1.D0)*h0 64 | xloc(3) = xv(3) + (k-1.D0)*h0 65 | 66 | cc(i,j,k) = VOFI_GET_CC(IMPL_FUNC,xloc,h0,fh,ndim0) 67 | END DO 68 | END DO 69 | END DO 70 | 71 | ! final global check 72 | vol_n = 0.0D0 73 | 74 | DO k=1,nz 75 | DO j=1,ny 76 | DO i=1,nx 77 | vol_n = vol_n + cc(i,j,k) 78 | END DO 79 | END DO 80 | END DO 81 | 82 | vol_n = vol_n*h0*h0*h0 83 | 84 | CALL check_volume(vol_n, randominput) 85 | 86 | END PROGRAM SINESURF 87 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Cap1/main_cap1.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include "vofi.h" 22 | #include "cap1.h" 23 | 24 | #define NDIM 3 25 | #define N2D 2 26 | #define N3D 3 27 | 28 | extern void check_volume(vofi_creal); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern int cont_line(vofi_real *,vofi_real *,vofi_cint); 31 | 32 | //* ------------------------------------------------------------------- * 33 | //* PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | //* ------------------------------------------------------------------- * 35 | 36 | int main() 37 | { 38 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 39 | int i,j,k,itrue; 40 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,vol_n; 42 | 43 | //* -------------------------------------------------------------------------- * 44 | //* initialization of the color function with local Gauss integration * 45 | //* -------------------------------------------------------------------------- * 46 | 47 | h0 = H/nx; //* grid spacing * 48 | itrue = 1; 49 | 50 | //* starting point to get fh * 51 | x0[0] = 0.5; 52 | x0[1] = 0.5; 53 | x0[2] = 0.5; 54 | 55 | //* get the characteristic value fh of the implicit function * 56 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 57 | 58 | //* put now starting point in (X0,Y0,Z0) to initialize the color function * 59 | x0[0] = X0; 60 | x0[1] = Y0; 61 | x0[2] = Z0; 62 | 63 | //* xloc: minor vertex of each cell of the grid * 64 | for (i=0; i 20 | #include 21 | #include "vofi.h" 22 | #include "cap2.h" 23 | 24 | #define NDIM 3 25 | #define N2D 2 26 | #define N3D 3 27 | 28 | extern void check_volume(vofi_creal); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern int cont_line(vofi_real *,vofi_real *,vofi_cint); 31 | 32 | //* ------------------------------------------------------------------- * 33 | //* PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | //* ------------------------------------------------------------------- * 35 | 36 | int main() 37 | { 38 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 39 | int i,j,k,itrue; 40 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,vol_n; 42 | 43 | //* -------------------------------------------------------------------------- * 44 | //* initialization of the color function with local Gauss integration * 45 | //* -------------------------------------------------------------------------- * 46 | 47 | h0 = H/nx; //* grid spacing * 48 | itrue = 1; 49 | 50 | //* starting point to get fh * 51 | x0[0] = 0.5; 52 | x0[1] = 0.5; 53 | x0[2] = 0.5; 54 | 55 | //* get the characteristic value fh of the implicit function * 56 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 57 | 58 | //* put now starting point in (X0,Y0,Z0) to initialize the color function * 59 | x0[0] = X0; 60 | x0[1] = Y0; 61 | x0[2] = Z0; 62 | 63 | //* xloc: minor vertex of each cell of the grid * 64 | for (i=0; i 20 | #include 21 | #include "vofi.h" 22 | #include "sphere.h" 23 | 24 | #define NDIM 3 25 | #define N2D 2 26 | #define N3D 3 27 | 28 | extern void check_volume(vofi_creal); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern int cont_line(vofi_real *,vofi_real *,vofi_cint); 31 | 32 | //* ------------------------------------------------------------------- * 33 | //* PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | //* ------------------------------------------------------------------- * 35 | 36 | int main() 37 | { 38 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 39 | int i,j,k,itrue; 40 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,vol_n; 42 | 43 | //* -------------------------------------------------------------------------- * 44 | //* initialization of the color function with local Gauss integration * 45 | //* -------------------------------------------------------------------------- * 46 | 47 | h0 = H/nx; //* grid spacing * 48 | itrue = 1; 49 | 50 | //* starting point to get fh * 51 | x0[0] = 0.5; 52 | x0[1] = 0.5; 53 | x0[2] = 0.5; 54 | 55 | //* get the characteristic value fh of the implicit function * 56 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 57 | 58 | //* put now starting point in (X0,Y0,Z0) to initialize the color function * 59 | x0[0] = X0; 60 | x0[1] = Y0; 61 | x0[2] = Z0; 62 | 63 | //* xloc: minor vertex of each cell of the grid * 64 | for (i=0; i 20 | #include 21 | #include "vofi.h" 22 | #include "cap2.h" 23 | 24 | #define NDIM 3 25 | #define N2D 2 26 | #define N3D 3 27 | 28 | extern void check_volume(vofi_creal); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern int cont_line(vofi_real *,vofi_real *,vofi_cint); 31 | 32 | /* -------------------------------------------------------------------------- * 33 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD * 34 | * -------------------------------------------------------------------------- */ 35 | 36 | int main() 37 | { 38 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 39 | int i,j,k,itrue; 40 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,vol_n; 42 | 43 | /* -------------------------------------------------------------------------- * 44 | * initialization of the color function with local Gauss integration * 45 | * -------------------------------------------------------------------------- */ 46 | 47 | h0 = H/nx; /* grid spacing */ 48 | itrue = 1; 49 | 50 | /* starting point to get fh */ 51 | x0[0] = 0.5; 52 | x0[1] = 0.5; 53 | x0[2] = 0.5; 54 | 55 | /* get the characteristic value fh of the implicit function */ 56 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 57 | 58 | /* put now starting point in (X0,Y0,Z0) to initialize the color function */ 59 | x0[0] = X0; 60 | x0[1] = Y0; 61 | x0[2] = Z0; 62 | 63 | /* xloc: minor vertex of each cell of the grid */ 64 | for (i=0; i 20 | #include 21 | #include "vofi.h" 22 | #include "cap1.h" 23 | 24 | #define NDIM 3 25 | #define N2D 2 26 | #define N3D 3 27 | 28 | extern void check_volume(vofi_creal); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern int cont_line(vofi_real *,vofi_real *,vofi_cint); 31 | 32 | /* -------------------------------------------------------------------------- * 33 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD * 34 | * -------------------------------------------------------------------------- */ 35 | 36 | int main() 37 | { 38 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 39 | int i,j,k,itrue; 40 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,vol_n; 42 | 43 | /* -------------------------------------------------------------------------- * 44 | * initialization of the color function with local Gauss integration * 45 | * -------------------------------------------------------------------------- */ 46 | 47 | h0 = H/nx; /* grid spacing */ 48 | itrue = 1; 49 | 50 | /* starting point to get fh */ 51 | x0[0] = 0.5; 52 | x0[1] = 0.5; 53 | x0[2] = 0.5; 54 | 55 | /* get the characteristic value fh of the implicit function */ 56 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 57 | 58 | /* put now starting point in (X0,Y0,Z0) to initialize the color function */ 59 | x0[0] = X0; 60 | x0[1] = Y0; 61 | x0[2] = Z0; 62 | 63 | /* xloc: minor vertex of each cell of the grid */ 64 | for (i=0; i 20 | #include 21 | #include "vofi.h" 22 | #include "cap3.h" 23 | 24 | #define NDIM 3 25 | #define N2D 2 26 | #define N3D 3 27 | 28 | extern void check_volume(vofi_creal); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern int cont_line(vofi_real *,vofi_real *,vofi_cint); 31 | 32 | /* -------------------------------------------------------------------------- * 33 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD * 34 | * -------------------------------------------------------------------------- */ 35 | 36 | int main() 37 | { 38 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 39 | int i,j,k,itrue; 40 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,vol_n; 42 | 43 | /* -------------------------------------------------------------------------- * 44 | * initialization of the color function with local Gauss integration * 45 | * -------------------------------------------------------------------------- */ 46 | 47 | h0 = H/nx; /* grid spacing */ 48 | itrue = 1; 49 | 50 | /* starting point to get fh */ 51 | x0[0] = 0.5; 52 | x0[1] = 0.5; 53 | x0[2] = 0.5; 54 | 55 | /* get the characteristic value fh of the implicit function */ 56 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 57 | 58 | /* put now starting point in (X0,Y0,Z0) to initialize the color function */ 59 | x0[0] = X0; 60 | x0[1] = Y0; 61 | x0[2] = Z0; 62 | 63 | /* xloc: minor vertex of each cell of the grid */ 64 | for (i=0; i 20 | #include 21 | #include "vofi.h" 22 | #include "sphere.h" 23 | 24 | #define NDIM 3 25 | #define N2D 2 26 | #define N3D 3 27 | 28 | extern void check_volume(vofi_creal); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern int cont_line(vofi_real *,vofi_real *,vofi_cint); 31 | 32 | /* -------------------------------------------------------------------------- * 33 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD * 34 | * -------------------------------------------------------------------------- */ 35 | 36 | int main() 37 | { 38 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 39 | int i,j,k,itrue; 40 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,vol_n; 42 | 43 | /* -------------------------------------------------------------------------- * 44 | * initialization of the color function with local Gauss integration * 45 | * -------------------------------------------------------------------------- */ 46 | 47 | h0 = H/nx; /* grid spacing */ 48 | itrue = 1; 49 | 50 | /* starting point to get fh */ 51 | x0[0] = 0.5; 52 | x0[1] = 0.5; 53 | x0[2] = 0.5; 54 | 55 | /* get the characteristic value fh of the implicit function */ 56 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 57 | 58 | /* put now starting point in (X0,Y0,Z0) to initialize the color function */ 59 | x0[0] = X0; 60 | x0[1] = Y0; 61 | x0[2] = Z0; 62 | 63 | /* xloc: minor vertex of each cell of the grid */ 64 | for (i=0; i 20 | #include 21 | #include "vofi.h" 22 | #include "cap3.h" 23 | 24 | #define NDIM 3 25 | #define N2D 2 26 | #define N3D 3 27 | 28 | /* only for graphics */ 29 | FILE *fp; 30 | 31 | extern void check_volume(vofi_creal); 32 | extern vofi_real impl_func(vofi_creal []); 33 | extern int cont_line(vofi_real *,vofi_real *,vofi_cint); 34 | 35 | //* ------------------------------------------------------------------- * 36 | //* PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 37 | //* ------------------------------------------------------------------- * 38 | 39 | int main() 40 | { 41 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 42 | int i,j,k,itrue; 43 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 44 | double h0,fh,vol_n; 45 | 46 | //* -------------------------------------------------------------------------- * 47 | //* initialization of the color function with local Gauss integration * 48 | //* -------------------------------------------------------------------------- * 49 | 50 | h0 = H/nx; //* grid spacing * 51 | itrue = 1; 52 | 53 | //* starting point to get fh * 54 | x0[0] = 0.5; 55 | x0[1] = 0.5; 56 | x0[2] = 0.5; 57 | 58 | //* get the characteristic value fh of the implicit function * 59 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 60 | 61 | //* put now starting point in (X0,Y0,Z0) to initialize the color function * 62 | x0[0] = X0; 63 | x0[1] = Y0; 64 | x0[2] = Z0; 65 | 66 | //* xloc: minor vertex of each cell of the grid * 67 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "ellipse.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | 28 | extern void check_area(vofi_creal, vofi_cint); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern void init(vofi_cint); 31 | 32 | //* -------------------------------------------------------------------------- * 33 | //* PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | //* -------------------------------------------------------------------------- * 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | vofi_cint nx=NMX, ny=NMY, ndim0=N2D; 39 | int i,j,itrue; 40 | vofi_real cc[NMX][NMY],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,area_n; 42 | int randominput = 0; 43 | 44 | for (int count = 1; count < argc; ++count) 45 | { 46 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 47 | { 48 | randominput = 1; 49 | } 50 | } 51 | 52 | //* -------------------------------------------------------------------------- * 53 | //* initialization of the color function with local Gauss integration * 54 | //* -------------------------------------------------------------------------- * 55 | 56 | //* grid spacing * 57 | h0 = H/nx; 58 | itrue = 1; 59 | 60 | //* put starting point in the center of the square * 61 | x0[0] = 0.5; 62 | x0[1] = 0.5; 63 | x0[2] = 0.; 64 | 65 | init(randominput); 66 | 67 | //* get the characteristic value fh of the implicit function * 68 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 69 | 70 | //* put now starting point in (X0,Y0) to initialize the color function * 71 | x0[0] = X0; 72 | x0[1] = Y0; 73 | 74 | xloc[2] = 0.; //* xloc: minor vertex of each cell of the grid * 75 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "rectangle.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | 28 | extern void check_area(vofi_creal, vofi_cint); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern void init(vofi_cint); 31 | 32 | //* -------------------------------------------------------------------------- * 33 | //* PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | //* -------------------------------------------------------------------------- * 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | vofi_cint nx=NMX, ny=NMY, ndim0=N2D; 39 | int i,j,itrue; 40 | vofi_real cc[NMX][NMY],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,area_n; 42 | int randominput = 0; 43 | 44 | for (int count = 1; count < argc; ++count) 45 | { 46 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 47 | { 48 | randominput = 1; 49 | } 50 | } 51 | 52 | //* -------------------------------------------------------------------------- * 53 | //* initialization of the color function with local Gauss integration * 54 | //* -------------------------------------------------------------------------- * 55 | 56 | //* grid spacing * 57 | h0 = H/nx; 58 | itrue = 1; 59 | 60 | //* put starting point in the center of the square * 61 | x0[0] = 0.5; 62 | x0[1] = 0.5; 63 | x0[2] = 0.; 64 | 65 | init(randominput); 66 | 67 | //* get the characteristic value fh of the implicit function * 68 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 69 | 70 | //* put now starting point in (X0,Y0) to initialize the color function * 71 | x0[0] = X0; 72 | x0[1] = Y0; 73 | 74 | xloc[2] = 0.; //* xloc: minor vertex of each cell of the grid * 75 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "gaussian.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | 28 | extern void check_area(vofi_creal, vofi_cint); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern void init(vofi_cint); 31 | 32 | /* -------------------------------------------------------------------------- * 33 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | * -------------------------------------------------------------------------- */ 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | vofi_cint nx=NMX, ny=NMY, ndim0=N2D; 39 | int i,j,itrue; 40 | vofi_real cc[NMX][NMY],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,area_n; 42 | int randominput = 0; 43 | int count; 44 | 45 | for (count = 1; count < argc; ++count) 46 | { 47 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 48 | { 49 | randominput = 1; 50 | } 51 | } 52 | 53 | /* -------------------------------------------------------------------------- * 54 | * initialization of the color function with local Gauss integration * 55 | * -------------------------------------------------------------------------- */ 56 | 57 | /* grid spacing */ 58 | h0 = H/nx; 59 | itrue = 1; 60 | 61 | /* put starting point in the center of the square */ 62 | x0[0] = 0.5; 63 | x0[1] = 0.5; 64 | x0[2] = 0.; 65 | 66 | init(randominput); 67 | 68 | /* get the characteristic value fh of the implicit function */ 69 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 70 | 71 | /* put now starting point in (X0,Y0) to initialize the color function */ 72 | x0[0] = X0; 73 | x0[1] = Y0; 74 | 75 | /* xloc: minor vertex of each cell of the grid */ 76 | xloc[2] = 0.; 77 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "sine_line.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | 28 | extern void check_area(vofi_creal, vofi_cint); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern void init(vofi_cint); 31 | 32 | //* -------------------------------------------------------------------------- * 33 | //* PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | //* -------------------------------------------------------------------------- * 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | vofi_cint nx=NMX, ny=NMY, ndim0=N2D; 39 | int i,j,itrue; 40 | vofi_real cc[NMX][NMY],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,area_n; 42 | int randominput = 0; 43 | 44 | for (int count = 1; count < argc; ++count) 45 | { 46 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 47 | { 48 | randominput = 1; 49 | } 50 | } 51 | 52 | //* -------------------------------------------------------------------------- * 53 | //* initialization of the color function with local Gauss integration * 54 | //* -------------------------------------------------------------------------- * 55 | 56 | //* grid spacing * 57 | h0 = H/nx; 58 | itrue = 1; 59 | 60 | //* put starting point in the center of the square * 61 | x0[0] = 0.5; 62 | x0[1] = 0.5; 63 | x0[2] = 0.; 64 | 65 | init(randominput); 66 | 67 | //* get the characteristic value fh of the implicit function * 68 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 69 | 70 | //* put now starting point in (X0,Y0) to initialize the color function * 71 | x0[0] = X0; 72 | x0[1] = Y0; 73 | 74 | xloc[2] = 0.; //* xloc: minor vertex of each cell of the grid * 75 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "rectangle.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | 28 | extern void check_area(vofi_creal, vofi_cint); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern void init(vofi_cint); 31 | 32 | /* -------------------------------------------------------------------------- * 33 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | * -------------------------------------------------------------------------- */ 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | vofi_cint nx=NMX, ny=NMY, ndim0=N2D; 39 | int i,j,itrue; 40 | vofi_real cc[NMX][NMY],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,area_n; 42 | int randominput = 0; 43 | int count; 44 | 45 | for (count = 1; count < argc; ++count) 46 | { 47 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 48 | { 49 | randominput = 1; 50 | } 51 | } 52 | 53 | /* -------------------------------------------------------------------------- * 54 | * initialization of the color function with local Gauss integration * 55 | * -------------------------------------------------------------------------- */ 56 | 57 | /* grid spacing */ 58 | h0 = H/nx; 59 | itrue = 1; 60 | 61 | /* put starting point in the center of the square */ 62 | x0[0] = 0.5; 63 | x0[1] = 0.5; 64 | x0[2] = 0.; 65 | 66 | init(randominput); 67 | 68 | /* get the characteristic value fh of the implicit function */ 69 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 70 | 71 | /* put now starting point in (X0,Y0) to initialize the color function */ 72 | x0[0] = X0; 73 | x0[1] = Y0; 74 | 75 | /* xloc: minor vertex of each cell of the grid */ 76 | xloc[2] = 0.; 77 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "sine_line.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | 28 | extern void check_area(vofi_creal, vofi_cint); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern void init(vofi_cint); 31 | 32 | /* -------------------------------------------------------------------------- * 33 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | * -------------------------------------------------------------------------- */ 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | vofi_cint nx=NMX, ny=NMY, ndim0=N2D; 39 | int i,j,itrue; 40 | vofi_real cc[NMX][NMY],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,area_n; 42 | int randominput = 0; 43 | int count; 44 | 45 | for (count = 1; count < argc; ++count) 46 | { 47 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 48 | { 49 | randominput = 1; 50 | } 51 | } 52 | 53 | /* -------------------------------------------------------------------------- * 54 | * initialization of the color function with local Gauss integration * 55 | * -------------------------------------------------------------------------- */ 56 | 57 | /* grid spacing */ 58 | h0 = H/nx; 59 | itrue = 1; 60 | 61 | /* put starting point in the center of the square */ 62 | x0[0] = 0.5; 63 | x0[1] = 0.5; 64 | x0[2] = 0.; 65 | 66 | init(randominput); 67 | 68 | /* get the characteristic value fh of the implicit function */ 69 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 70 | 71 | /* put now starting point in (X0,Y0) to initialize the color function */ 72 | x0[0] = X0; 73 | x0[1] = Y0; 74 | 75 | /* xloc: minor vertex of each cell of the grid */ 76 | xloc[2] = 0.; 77 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "ellipse.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | 28 | extern void check_area(vofi_creal, vofi_cint); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern void init(vofi_cint); 31 | 32 | /* -------------------------------------------------------------------------- * 33 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | * -------------------------------------------------------------------------- */ 35 | 36 | int main(int argc, char *argv[]) 37 | { 38 | vofi_cint nx=NMX, ny=NMY, ndim0=N2D; 39 | int i,j,itrue; 40 | vofi_real cc[NMX][NMY],x0[NDIM],xloc[NDIM]; 41 | double h0,fh,area_n; 42 | int randominput = 0; 43 | int count; 44 | 45 | for (count = 1; count < argc; ++count) 46 | { 47 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 48 | { 49 | randominput = 1; 50 | } 51 | } 52 | 53 | /* -------------------------------------------------------------------------- * 54 | * initialization of the color function with a Gauss integration * 55 | * -------------------------------------------------------------------------- */ 56 | 57 | /* grid spacing */ 58 | h0 = H/nx; 59 | itrue = 1; 60 | 61 | /* put starting point in the center of the square */ 62 | x0[0] = 0.5; 63 | x0[1] = 0.5; 64 | x0[2] = 0.; 65 | 66 | /* initialize with random values if randominput is equal to 1 */ 67 | init(randominput); 68 | 69 | /* get the characteristic value fh of the implicit function */ 70 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 71 | 72 | /* put now starting point in (X0,Y0) to initialize the color function */ 73 | x0[0] = X0; 74 | x0[1] = Y0; 75 | 76 | /* xloc: minor vertex of each cell of the grid */ 77 | xloc[2] = 0.; 78 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "gaussian.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | 28 | extern void check_area(vofi_creal, vofi_cint randominput); 29 | extern vofi_real impl_func(vofi_creal []); 30 | extern void init(vofi_cint randominput); 31 | 32 | //* -------------------------------------------------------------------------- * 33 | //* PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 34 | //* [X0,X0+H] X [Y0,Y0+H] * 35 | //* -------------------------------------------------------------------------- * 36 | 37 | int main(int argc, char *argv[]) 38 | { 39 | vofi_cint nx=NMX, ny=NMY, ndim0=N2D; 40 | int i,j,itrue; 41 | vofi_real cc[NMX][NMY],x0[NDIM],xloc[NDIM]; 42 | double h0,fh,area_n; 43 | int randominput = 0; 44 | 45 | for (int count = 1; count < argc; ++count) 46 | { 47 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 48 | { 49 | randominput = 1; 50 | } 51 | } 52 | 53 | //* -------------------------------------------------------------------------- * 54 | //* initialization of the color function with local Gauss integration * 55 | //* -------------------------------------------------------------------------- * 56 | 57 | //* grid spacing * 58 | h0 = H/nx; 59 | itrue = 1; 60 | 61 | //* put starting point in the center of the square * 62 | x0[0] = 0.5; 63 | x0[1] = 0.5; 64 | x0[2] = 0.; 65 | 66 | init(randominput); 67 | 68 | //* get the characteristic value fh of the implicit function * 69 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 70 | 71 | //* put now starting point in (X0,Y0) to initialize the color function * 72 | x0[0] = X0; 73 | x0[1] = Y0; 74 | 75 | xloc[2] = 0.; //* xloc: minor vertex of each cell of the grid * 76 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "sine_surf.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | #define N3D 3 28 | 29 | extern void check_volume(vofi_creal, vofi_cint); 30 | extern vofi_real impl_func(vofi_creal []); 31 | extern void init(vofi_cint); 32 | 33 | /* -------------------------------------------------------------------------- * 34 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD * 35 | * -------------------------------------------------------------------------- */ 36 | 37 | int main(int argc, char *argv[]) 38 | { 39 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 40 | int i,j,k,itrue; 41 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 42 | double h0,fh,vol_n; 43 | int randominput = 0; 44 | int count; 45 | 46 | for (count = 1; count < argc; ++count) 47 | { 48 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 49 | { 50 | randominput = 1; 51 | } 52 | } 53 | 54 | /* -------------------------------------------------------------------------- * 55 | * initialization of the color function with local Gauss integration * 56 | * -------------------------------------------------------------------------- */ 57 | 58 | h0 = H/nx; /* grid spacing */ 59 | itrue = 1; 60 | 61 | /* starting point to get fh */ 62 | x0[0] = 0.5; 63 | x0[1] = 0.5; 64 | x0[2] = 0.5; 65 | 66 | init(randominput); 67 | 68 | /* get the characteristic value fh of the implicit function */ 69 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 70 | 71 | /* put now starting point in (X0,Y0,Z0) to initialize the color function */ 72 | x0[0] = X0; 73 | x0[1] = Y0; 74 | x0[2] = Z0; 75 | 76 | /* xloc: minor vertex of each cell of the grid */ 77 | for (i=0; i 20 | #include 21 | #include 22 | #include "vofi.h" 23 | #include "sine_surf.h" 24 | 25 | #define NDIM 3 26 | #define N2D 2 27 | #define N3D 3 28 | 29 | 30 | extern void check_volume(vofi_creal, vofi_cint); 31 | extern vofi_real impl_func(vofi_creal []); 32 | extern void init(vofi_cint); 33 | 34 | /* ------------------------------------------------------------------- * 35 | * PROGRAM TO INITIALIZE THE COLOR FUNCTION SCALAR FIELD CC * 36 | * ------------------------------------------------------------------- */ 37 | int main(int argc, char *argv[]) 38 | { 39 | vofi_cint nx=NMX,ny=NMY,nz=NMZ,ndim0=N3D; 40 | int i,j,k,itrue; 41 | vofi_real cc[NMX][NMY][NMZ],x0[NDIM],xloc[NDIM]; 42 | double h0,fh,vol_n; 43 | int randominput = 0; 44 | 45 | for (int count = 1; count < argc; ++count) 46 | { 47 | if (!strcmp(argv[count], "-r") || !strcmp(argv[count], "--randominput")) 48 | { 49 | randominput = 1; 50 | } 51 | } 52 | 53 | /* -------------------------------------------------------------------------- * 54 | * initialization of the color function with local Gauss integration * 55 | * -------------------------------------------------------------------------- */ 56 | 57 | h0 = H/nx; /* grid spacing */ 58 | itrue = 1; 59 | 60 | /* starting point to get fh */ 61 | x0[0] = 0.5; 62 | x0[1] = 0.5; 63 | x0[2] = 0.5; 64 | 65 | init(randominput); 66 | 67 | /* get the characteristic value fh of the implicit function */ 68 | fh = vofi_Get_fh(impl_func,x0,h0,ndim0,itrue); 69 | 70 | /* put now starting point in (X0,Y0,Z0) to initialize the color function */ 71 | x0[0] = X0; 72 | x0[1] = Y0; 73 | x0[2] = Z0; 74 | 75 | /* xloc: minor vertex of each cell of the grid */ 76 | for (i=0; i. 20 | 21 | # As a special exception to the GNU General Public License, if you 22 | # distribute this file as part of a program that contains a 23 | # configuration script generated by Autoconf, you may include it under 24 | # the same distribution terms that you use for the rest of that program. 25 | 26 | # This file is maintained in Automake, please report 27 | # bugs to or send patches to 28 | # . 29 | 30 | # Make unconditional expansion of undefined variables an error. This 31 | # helps a lot in preventing typo-related bugs. 32 | set -u 33 | 34 | usage_error () 35 | { 36 | echo "$0: $*" >&2 37 | print_usage >&2 38 | exit 2 39 | } 40 | 41 | print_usage () 42 | { 43 | cat <$log_file 2>&1 96 | estatus=$? 97 | if test $enable_hard_errors = no && test $estatus -eq 99; then 98 | estatus=1 99 | fi 100 | 101 | case $estatus:$expect_failure in 102 | 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; 103 | 0:*) col=$grn res=PASS recheck=no gcopy=no;; 104 | 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; 105 | 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; 106 | *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; 107 | *:*) col=$red res=FAIL recheck=yes gcopy=yes;; 108 | esac 109 | 110 | # Report outcome to console. 111 | echo "${col}${res}${std}: $test_name" 112 | 113 | # Register the test result, and other relevant metadata. 114 | echo ":test-result: $res" > $trs_file 115 | echo ":global-test-result: $res" >> $trs_file 116 | echo ":recheck: $recheck" >> $trs_file 117 | echo ":copy-in-global-log: $gcopy" >> $trs_file 118 | 119 | # Local Variables: 120 | # mode: shell-script 121 | # sh-indentation: 2 122 | # eval: (add-hook 'write-file-hooks 'time-stamp) 123 | # time-stamp-start: "scriptversion=" 124 | # time-stamp-format: "%:y-%02m-%02d.%02H" 125 | # time-stamp-time-zone: "UTC" 126 | # time-stamp-end: "; # UTC" 127 | # End: 128 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Cap1/cap1.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "cap1.h" 25 | 26 | typedef const double creal; 27 | typedef const int cint; 28 | typedef double real; 29 | using namespace std; 30 | 31 | //* -------------------------------------------------------------------------- * 32 | //* DESCRIPTION (reference phase where f(x,y,z) < 0): * 33 | //* ellipsoidal cap inside the domain [0,1]x[0,1]x[0,1] * 34 | //* f(x,y) = c1*x^2 + c2*y^2 + c3*x*y + c4*x + c5*y - c6 * 35 | //* f(x,y,z) = f(x,y) + (z-ZC)^2/C2 * 36 | //* INPUT PARAMETERS: * 37 | //* (XC,YC,ZC) center of the ellipsoid; ALPHA: angle between two axes x' and * 38 | //* x (in the x-y plane); (A1,B1,C1): semiaxis along the three ellipsoid * 39 | //* (local) axes: x',y',z' * 40 | //* -------------------------------------------------------------------------- * 41 | 42 | real impl_func(creal xy[]) 43 | { 44 | double x,y,z,A2,B2,C2,ca,sa,c1,c2,c3,c4,c5,c6,f0; 45 | 46 | x = xy[0]; 47 | y = xy[1]; 48 | z = xy[2]; 49 | 50 | A2 = A1*A1; 51 | B2 = B1*B1; 52 | C2 = C1*C1; 53 | ca = cos(ALPHA); 54 | sa = sin(ALPHA); 55 | c1 = ca*ca/A2 + sa*sa/B2; 56 | c2 = sa*sa/A2 + ca*ca/B2; 57 | c3 = 2.*ca*sa*(B2-A2)/(A2*B2); 58 | c4 = -(2.*c1*XC + c3*YC); 59 | c5 = -(2.*c2*YC + c3*XC); 60 | c6 = 1.0 - (c1*XC*XC + c2*YC*YC + c3*XC*YC); 61 | 62 | f0 = c1*x*x + c2*y*y + c3*x*y + c4*x + c5*y - c6 + (z - ZC)*(z - ZC)/C2; 63 | 64 | return f0; 65 | } 66 | 67 | //* -------------------------------------------------------------------------- * 68 | 69 | void check_volume(creal vol_n) 70 | { 71 | double h0,vol_a; 72 | 73 | h0 = C1 + ZC; 74 | vol_a = MYPI*A1*B1*h0*h0*(1. - h0/(3.*C1))/C1; 75 | 76 | cout << "-----------------------------------------------------------" << endl; 77 | cout << "----------------- CPP: cap check (1 cell) -----------------" << endl; 78 | cout << "analytical volume: " << scientific << setw(23) << setprecision(16) 79 | << vol_a << endl; 80 | cout << "numerical volume: " << scientific << setw(23) << setprecision(16) 81 | << vol_n << endl << endl; 82 | cout << "absolute error : " << scientific << setw(23) << setprecision(16) 83 | << fabs(vol_a-vol_n) << endl; 84 | cout << "relative error : " << scientific << setw(23) << setprecision(16) 85 | << fabs(vol_a-vol_n)/vol_a << endl; 86 | cout << "-----------------------------------------------------------" << endl; 87 | cout << "with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2" << endl; 88 | cout << "-----------------------------------------------------------" << endl; 89 | cout << "analytical volume: 9.4090699975015856e-03" << endl; 90 | cout << "numerical volume: 9.4090641039290823e-03" << endl << endl; 91 | cout << "absolute error : 5.8935725032877029e-09" << endl; 92 | cout << "relative error : 6.2637141660681008e-07" << endl; 93 | cout << "--------------- CPP: end cap check (1 cell) ---------------" << endl; 94 | cout << "-----------------------------------------------------------" << endl 95 | << endl; 96 | 97 | return; 98 | } 99 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Cap2/cap2.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "cap2.h" 25 | 26 | typedef const double creal; 27 | typedef const int cint; 28 | typedef double real; 29 | using namespace std; 30 | 31 | //* -------------------------------------------------------------------------- * 32 | //* DESCRIPTION (reference phase where f(x,y,z) < 0): * 33 | //* ellipsoidal cap inside the domain [-1,1]x[0,1]x[0,1] * 34 | //* f(x,y) = c1*x^2 + c2*y^2 + c3*x*y + c4*x + c5*y - c6 * 35 | //* f(x,y,z) = f(x,y) + (z-ZC)^2/C2 * 36 | //* INPUT PARAMETERS: * 37 | //* (XC,YC,ZC) center of the ellipsoid; ALPHA: angle between two axes x' and * 38 | //* x (in the x-y plane); (A1,B1,C1): semiaxis along the three ellipsoid * 39 | //* (local) axes: x',y',z' * 40 | //* -------------------------------------------------------------------------- * 41 | 42 | real impl_func(creal xy[]) 43 | { 44 | double x,y,z,A2,B2,C2,ca,sa,c1,c2,c3,c4,c5,c6,f0; 45 | 46 | x = xy[0]; 47 | y = xy[1]; 48 | z = xy[2]; 49 | 50 | A2 = A1*A1; 51 | B2 = B1*B1; 52 | C2 = C1*C1; 53 | ca = cos(ALPHA); 54 | sa = sin(ALPHA); 55 | c1 = ca*ca/A2 + sa*sa/B2; 56 | c2 = sa*sa/A2 + ca*ca/B2; 57 | c3 = 2.*ca*sa*(B2-A2)/(A2*B2); 58 | c4 = -(2.*c1*XC + c3*YC); 59 | c5 = -(2.*c2*YC + c3*XC); 60 | c6 = 1.0 - (c1*XC*XC + c2*YC*YC + c3*XC*YC); 61 | 62 | f0 = c1*x*x + c2*y*y + c3*x*y + c4*x + c5*y - c6 + (z - ZC)*(z - ZC)/C2; 63 | 64 | return f0; 65 | } 66 | 67 | //* -------------------------------------------------------------------------- * 68 | 69 | void check_volume(creal vol_n) 70 | { 71 | double h0,vol_a; 72 | 73 | h0 = C1 + ZC; 74 | vol_a = MYPI*A1*B1*h0*h0*(1. - h0/(3.*C1))/C1; 75 | 76 | cout << "-----------------------------------------------------------" << endl; 77 | cout << "----------------- CPP: cap check (2 cells) ----------------" << endl; 78 | cout << "analytical volume: " << scientific << setw(23) << setprecision(16) 79 | << vol_a << endl; 80 | cout << "numerical volume: " << scientific << setw(23) << setprecision(16) 81 | << vol_n << endl << endl; 82 | cout << "absolute error : " << scientific << setw(23) << setprecision(16) 83 | << fabs(vol_a-vol_n) << endl; 84 | cout << "relative error : " << scientific << setw(23) << setprecision(16) 85 | << fabs(vol_a-vol_n)/vol_a << endl; 86 | cout << "-----------------------------------------------------------" << endl; 87 | cout << "with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2" << endl; 88 | cout << "-----------------------------------------------------------" << endl; 89 | cout << "analytical volume: 9.4090699975015856e-03" << endl; 90 | cout << "numerical volume: 9.4090693179626327e-03" << endl << endl; 91 | cout << "absolute error : 6.7953895288574984e-10" << endl; 92 | cout << "relative error : 7.2221691736397911e-08" << endl; 93 | cout << "--------------- CPP: end cap check (2 cells) --------------" << endl; 94 | cout << "-----------------------------------------------------------" << endl 95 | << endl; 96 | 97 | return; 98 | } 99 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Cap3/cap3.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "cap3.h" 25 | 26 | typedef const double creal; 27 | typedef const int cint; 28 | typedef double real; 29 | using namespace std; 30 | 31 | //* -------------------------------------------------------------------------- * 32 | //* DESCRIPTION (reference phase where f(x,y,z) < 0): * 33 | //* ellipsoidal cap inside the domain [-1,1]x[-1,1]x[0,1] * 34 | //* f(x,y) = c1*x^2 + c2*y^2 + c3*x*y + c4*x + c5*y - c6 * 35 | //* f(x,y,z) = f(x,y) + (z-ZC)^2/C2 * 36 | //* INPUT PARAMETERS: * 37 | //* (XC,YC,ZC) center of the ellipsoid; ALPHA: angle between two axes x' and * 38 | //* x (in the x-y plane); (A1,B1,C1): semiaxis along the three ellipsoid * 39 | //* (local) axes: x',y',z' * 40 | //* -------------------------------------------------------------------------- * 41 | 42 | real impl_func(creal xy[]) 43 | { 44 | double x,y,z,A2,B2,C2,ca,sa,c1,c2,c3,c4,c5,c6,f0; 45 | 46 | x = xy[0]; 47 | y = xy[1]; 48 | z = xy[2]; 49 | 50 | A2 = A1*A1; 51 | B2 = B1*B1; 52 | C2 = C1*C1; 53 | ca = cos(ALPHA); 54 | sa = sin(ALPHA); 55 | c1 = ca*ca/A2 + sa*sa/B2; 56 | c2 = sa*sa/A2 + ca*ca/B2; 57 | c3 = 2.*ca*sa*(B2-A2)/(A2*B2); 58 | c4 = -(2.*c1*XC + c3*YC); 59 | c5 = -(2.*c2*YC + c3*XC); 60 | c6 = 1.0 - (c1*XC*XC + c2*YC*YC + c3*XC*YC); 61 | 62 | f0 = c1*x*x + c2*y*y + c3*x*y + c4*x + c5*y - c6 + (z - ZC)*(z - ZC)/C2; 63 | 64 | return f0; 65 | } 66 | 67 | //* -------------------------------------------------------------------------- * 68 | 69 | void check_volume(creal vol_n) 70 | { 71 | double h0,vol_a; 72 | 73 | h0 = C1 + ZC; 74 | vol_a = MYPI*A1*B1*h0*h0*(1. - h0/(3.*C1))/C1; 75 | 76 | cout << "-----------------------------------------------------------" << endl; 77 | cout << "----------------- CPP: cap check (3 cells) ----------------" << endl; 78 | cout << "analytical volume: " << scientific << setw(23) << setprecision(16) 79 | << vol_a << endl; 80 | cout << "numerical volume: " << scientific << setw(23) << setprecision(16) 81 | << vol_n << endl << endl; 82 | cout << "absolute error : " << scientific << setw(23) << setprecision(16) 83 | << fabs(vol_a-vol_n) << endl; 84 | cout << "relative error : " << scientific << setw(23) << setprecision(16) 85 | << fabs(vol_a-vol_n)/vol_a << endl; 86 | cout << "-----------------------------------------------------------" << endl; 87 | cout << "with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2" << endl; 88 | cout << "-----------------------------------------------------------" << endl; 89 | cout << "analytical volume: 9.4090699975015856e-03" << endl; 90 | cout << "numerical volume: 9.4090697360378721e-03" << endl << endl; 91 | cout << "absolute error : 2.6146371352731013e-10" << endl; 92 | cout << "relative error : 2.7788475757618687e-08" << endl; 93 | cout << "--------------- CPP: end cap check (3 cells) --------------" << endl; 94 | cout << "-----------------------------------------------------------" << endl 95 | << endl; 96 | 97 | return; 98 | } 99 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Sphere/sphere.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "sphere.h" 25 | 26 | typedef const double creal; 27 | typedef const int cint; 28 | typedef double real; 29 | using namespace std; 30 | 31 | //* -------------------------------------------------------------------------- * 32 | //* DESCRIPTION (reference phase where f(x,y,z) < 0): * 33 | //* ellipsoid/sphere inside the cube [0,1]x[0,1]x[0,1] * 34 | //* f(x,y) = c1*x^2 + c2*y^2 + c3*x*y + c4*x + c5*y - c6 * 35 | //* f(x,y,z) = f(x,y) + (z-ZC)^2/C2 * 36 | //* INPUT PARAMETERS: * 37 | //* (XC,YC,ZC) center of the ellipsoid; ALPHA: angle between two axes x' and * 38 | //* x (in the x-y plane); (A1,B1,C1): semiaxis along the three ellipsoid * 39 | //* (local) axes: x',y',z' * 40 | //* -------------------------------------------------------------------------- * 41 | 42 | real impl_func(creal xy[]) 43 | { 44 | double x,y,z,A2,B2,C2,ca,sa,c1,c2,c3,c4,c5,c6,f0; 45 | 46 | x = xy[0]; 47 | y = xy[1]; 48 | z = xy[2]; 49 | 50 | A2 = A1*A1; 51 | B2 = B1*B1; 52 | C2 = C1*C1; 53 | ca = cos(ALPHA); 54 | sa = sin(ALPHA); 55 | c1 = ca*ca/A2 + sa*sa/B2; 56 | c2 = sa*sa/A2 + ca*ca/B2; 57 | c3 = 2.*ca*sa*(B2-A2)/(A2*B2); 58 | c4 = -(2.*c1*XC + c3*YC); 59 | c5 = -(2.*c2*YC + c3*XC); 60 | c6 = 1.0 - (c1*XC*XC + c2*YC*YC + c3*XC*YC); 61 | 62 | f0 = c1*x*x + c2*y*y + c3*x*y + c4*x + c5*y - c6 + (z - ZC)*(z - ZC)/C2; 63 | 64 | return f0; 65 | } 66 | 67 | //* -------------------------------------------------------------------------- * 68 | 69 | void check_volume(creal vol_n) 70 | { 71 | double vol_a,inv_frac; 72 | 73 | inv_frac = 8.; 74 | vol_a = 4.*MYPI*A1*B1*C1/(3.*inv_frac); 75 | 76 | cout << "-----------------------------------------------------------" << endl; 77 | cout << "------------------- CPP: 1/8 sphere check -----------------" << endl; 78 | cout << "analytical volume: " << scientific << setw(23) << setprecision(16) 79 | << vol_a << endl; 80 | cout << "numerical volume: " << scientific << setw(23) << setprecision(16) 81 | << vol_n << endl << endl; 82 | cout << "absolute error : " << scientific << setw(23) << setprecision(16) 83 | << fabs(vol_a-vol_n) << endl; 84 | cout << "relative error : " << scientific << setw(23) << setprecision(16) 85 | << fabs(vol_a-vol_n)/vol_a << endl; 86 | cout << "-----------------------------------------------------------" << endl; 87 | cout << "with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2" << endl; 88 | cout << "-----------------------------------------------------------" << endl; 89 | cout << "analytical volume: 5.2359877559829882e-01" << endl; 90 | cout << "numerical volume: 5.2359877559829937e-01" << endl << endl; 91 | cout << "absolute error : 5.5511151231257827e-16" << endl; 92 | cout << "relative error : 1.0601848938211723e-15" << endl; 93 | cout << "----------------- CPP: end 1/8 sphere check ---------------" << endl; 94 | cout << "-----------------------------------------------------------" << endl 95 | << endl; 96 | 97 | return; 98 | } 99 | -------------------------------------------------------------------------------- /src/getzero.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | /** 20 | * @file getzero.c 21 | * @authors Simone Bnà, Sandro Manservisi, Ruben Scardovelli, 22 | * Philip Yecko and Stephane Zaleski 23 | * @date 12 November 2015 24 | * @brief it computes the zero in a given segment. 25 | */ 26 | 27 | 28 | #include "vofi_stddecl.h" 29 | 30 | /* -------------------------------------------------------------------------- * 31 | * DESCRIPTION: * 32 | * compute the zero in a given segment of length s0, the zero is strictly * 33 | * bounded, i.e. f(0)*f(s0) < 0 * 34 | * METHOD: standard hybrid method with a combination of secant and bisection * 35 | * INPUT: pointer to the implicit function, function value at the * 36 | * endpoints fe, starting point x0, direction dir, segment length s0, sign * 37 | * attribute f_sign * 38 | * OUTPUT: sz: length of the segment where f is negative * 39 | * -------------------------------------------------------------------------- */ 40 | 41 | vofi_real vofi_get_segment_zero(integrand impl_func,vofi_creal fe[],vofi_creal x0[], 42 | vofi_creal dir[],vofi_creal s0,vofi_cint f_sign) 43 | { 44 | int not_conv,iss,i,iter; 45 | vofi_cint max_iter=25; 46 | vofi_real xs[NDIM],sl,sr,ss,sold,fl,fr,fs,fold,dss,dsold,dfs,sz; 47 | 48 | 49 | if (fe[0] > 0.0) { /* sl where f(sl) < 0 */ 50 | sl = s0; 51 | sr = 0.0; 52 | fl = fe[1]; 53 | fr = fe[0]; 54 | iss = 1; 55 | } 56 | else { 57 | sl = 0.0; 58 | sr = s0; 59 | fl = fe[0]; 60 | fr = fe[1]; 61 | iss = 0; 62 | } 63 | 64 | if (fabs(fl) <= fabs(fr)) { /* ss where |fs| = MIN(|fl|,|fr|) */ 65 | ss = sl; 66 | fs = fl; 67 | } 68 | else { 69 | ss = sr; 70 | fs = fr; 71 | } 72 | xs[2] = 0.; 73 | dsold = dss = s0; 74 | not_conv = 1; 75 | dfs = (fr-fl)/(sr-sl); 76 | iter = 0; 77 | 78 | while (not_conv && iter < max_iter) { /* iterative loop */ 79 | 80 | if ( ((ss-sr)*dfs-fs)*((ss-sl)*dfs-fs) > 0.0 || 81 | fabs(2.*fs) > fabs(dsold*dfs) ) { /* bisection step */ 82 | dsold = dss; 83 | sold = ss; 84 | dss = 0.5*(sr - sl); 85 | ss = sl + dss; 86 | } 87 | else { /* secant step */ 88 | dsold = dss; 89 | sold = ss; 90 | dss = fs/dfs; 91 | ss = ss - dss; 92 | } 93 | iter++; 94 | if (fabs(dss) < EPS_R) /* convergence criterion */ 95 | not_conv = 0; 96 | 97 | if (not_conv) { /* new fs and dfs, bracket the zero */ 98 | for (i=0; i 3]), [1], 69 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 70 | [[m4_foreach([_Lt_prefix], [$2], 71 | [m4_foreach([_Lt_suffix], 72 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 73 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 74 | 75 | 76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 77 | # ----------------------------------------------------------------------- 78 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 79 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 80 | m4_define([lt_if_append_uniq], 81 | [m4_ifdef([$1], 82 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 83 | [lt_append([$1], [$2], [$3])$4], 84 | [$5])], 85 | [lt_append([$1], [$2], [$3])$4])]) 86 | 87 | 88 | # lt_dict_add(DICT, KEY, VALUE) 89 | # ----------------------------- 90 | m4_define([lt_dict_add], 91 | [m4_define([$1($2)], [$3])]) 92 | 93 | 94 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 95 | # -------------------------------------------- 96 | m4_define([lt_dict_add_subkey], 97 | [m4_define([$1($2:$3)], [$4])]) 98 | 99 | 100 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 101 | # ---------------------------------- 102 | m4_define([lt_dict_fetch], 103 | [m4_ifval([$3], 104 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 105 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 106 | 107 | 108 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 109 | # ----------------------------------------------------------------- 110 | m4_define([lt_if_dict_fetch], 111 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 112 | [$5], 113 | [$6])]) 114 | 115 | 116 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 117 | # -------------------------------------------------------------- 118 | m4_define([lt_dict_filter], 119 | [m4_if([$5], [], [], 120 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 121 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 122 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 123 | ]) 124 | -------------------------------------------------------------------------------- /demo_src/CPP/2D/Sine_line/sine_line.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "sine_line.h" 26 | 27 | typedef const double creal; 28 | typedef const int cint; 29 | typedef double real; 30 | using namespace std; 31 | 32 | //* -------------------------------------------------------------------------- * 33 | //* DESCRIPTION (reference phase where f(x,y) < 0): * 34 | //* sinusoidal line in the square [0,1]x[0,1] * 35 | //* f(x,y) = y - b0*sin(c0 pi x+ pi/d0) - a0 * 36 | //* -------------------------------------------------------------------------- * 37 | 38 | static double a0 = 0.5; 39 | static double b0 = 0.25; 40 | static double c0 = 4.0; 41 | static double d0 = 14.0; 42 | 43 | 44 | /* -------------------------------------------------------------------------- */ 45 | 46 | void init(cint randominput) 47 | { 48 | 49 | if(randominput) { 50 | /* initialize random number generator. */ 51 | srand(time(0)); 52 | 53 | /* a0 --> from 0.45 to 0.55 */ 54 | double scalingfactor = 0.1; 55 | a0 = 0.45 + ((double)rand() / RAND_MAX)*scalingfactor; 56 | /* b0 --> from 0.20 to 0.30 */ 57 | b0 = 0.20 + ((double)rand() / RAND_MAX)*scalingfactor; 58 | /* c0 --> from 0.35 to 0.45 */ 59 | c0 = 0.35 + ((double)rand() / RAND_MAX)*scalingfactor; 60 | /* d0 --> from 13.95 to 14.05 */ 61 | d0 = 13.95 + ((double)rand() / RAND_MAX)*scalingfactor; 62 | } 63 | 64 | return; 65 | } 66 | 67 | /* -------------------------------------------------------------------------- */ 68 | 69 | real impl_func(creal xy[]) 70 | { 71 | double x,y,f0; 72 | 73 | x = xy[0]; 74 | y = xy[1]; 75 | 76 | f0 = y - a0 - b0*sin(c0*M_PI*x + M_PI/d0); 77 | 78 | return f0; 79 | } 80 | 81 | //* -------------------------------------------------------------------------- * 82 | 83 | void check_area(creal area_n, cint randominput) 84 | { 85 | real area_a; 86 | 87 | //* analytical integration with x in [0,1] * 88 | area_a = a0 + b0*(-cos((c0 + 1./d0)*M_PI) + cos(M_PI/d0))/(c0*M_PI); 89 | 90 | cout << "-----------------------------------------------------------" << endl; 91 | cout << "------------------- CPP: sine line check ------------------" << endl; 92 | cout << "analytical area : " << scientific << setw(23) << setprecision(16) 93 | << area_a << endl; 94 | cout << "numerical area : " << scientific << setw(23) << setprecision(16) 95 | << area_n << endl << endl; 96 | cout << "absolute error : " << scientific << setw(23) << setprecision(16) 97 | << fabs(area_a-area_n) << endl; 98 | cout << "relative error : " << scientific << setw(23) << setprecision(16) 99 | << fabs(area_a-area_n)/area_a << endl; 100 | cout << "-----------------------------------------------------------" << endl; 101 | if(!randominput) { 102 | cout << "with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2" << endl; 103 | cout << "-----------------------------------------------------------" << endl; 104 | cout << "analytical area : 5.0000000000000000e-01" << endl; 105 | cout << "numerical area : 4.9999999999993749e-01" << endl << endl; 106 | cout << "absolute error : 6.2505556286396313e-14" << endl; 107 | cout << "relative error : 1.2501111257279263e-13" << endl; 108 | cout << "----------------- CPP: end sine line check ----------------" << endl; 109 | cout << "-----------------------------------------------------------" << endl; 110 | } 111 | cout << endl; 112 | 113 | return; 114 | } 115 | -------------------------------------------------------------------------------- /demo_src/CPP/3D/Sine_surface/sine_surf.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "sine_surf.h" 25 | 26 | typedef const double creal; 27 | typedef const int cint; 28 | typedef double real; 29 | using namespace std; 30 | 31 | //* -------------------------------------------------------------------------- * 32 | //* DESCRIPTION (reference phase where f(x,y,z) < 0): * 33 | //* sinusoidal surface inside the cube [0,1]x[0,1]x[0,1] * 34 | //* f(x,y,z) = z - a0 - b0*sin(c1*pi*x + pi*d1)*sin(c1*pi*x + pi*e1) * 35 | //* -------------------------------------------------------------------------- * 36 | 37 | static double a0 = 0.5; 38 | static double b0 = 1./6.; 39 | static double c1 = 1.6; 40 | static double d1 = 1./7.; 41 | static double e1 = 1./5.; 42 | 43 | 44 | /* -------------------------------------------------------------------------- */ 45 | 46 | void init(cint randominput) 47 | { 48 | 49 | if(randominput) { 50 | /* initialize random number generator. */ 51 | srand(time(0)); 52 | 53 | double scalingfactor = 0.05; 54 | 55 | /* b0 --> from 1.15 to 1.20 */ 56 | b0 = 1.15 + ((double)rand() / RAND_MAX)*scalingfactor; 57 | 58 | /* c1 --> from 1.6 to 1.65 */ 59 | c1 = 1.6 + ((double)rand() / RAND_MAX)*scalingfactor; 60 | 61 | /* d1 --> from 0.12 to 0.17 */ 62 | d1 = 0.12 + ((double)rand() / RAND_MAX)*scalingfactor; 63 | 64 | /* e1 --> from 0.15 to 0.25 */ 65 | e1 = 0.15 + ((double)rand() / RAND_MAX)*scalingfactor; 66 | 67 | } 68 | 69 | return; 70 | } 71 | 72 | 73 | real impl_func(creal xy[]) 74 | { 75 | double x,y,z,f0; 76 | 77 | x = xy[0]; 78 | y = xy[1]; 79 | z = xy[2]; 80 | 81 | f0 = z - a0 - b0*sin(M_PI*(c1*x+d1))*sin(M_PI*(c1*y+e1)); 82 | 83 | return f0; 84 | } 85 | 86 | //* -------------------------------------------------------------------------- * 87 | 88 | void check_volume(creal vol_n, cint randominput) 89 | { 90 | double vol_a; 91 | 92 | vol_a = a0 + (b0/(c1*M_PI*c1*M_PI))*(cos(d1*M_PI) - cos((d1+c1)*M_PI))*(cos(e1*M_PI) - cos((e1+c1)*M_PI)); 93 | 94 | cout << "-----------------------------------------------------------" << endl; 95 | cout << "--------------- CPP: sinusoidal surface check -------------" << endl; 96 | cout << "analytical volume: " << scientific << setw(23) << setprecision(16) 97 | << vol_a << endl; 98 | cout << "numerical volume: " << scientific << setw(23) << setprecision(16) 99 | << vol_n << endl << endl; 100 | cout << "absolute error : " << scientific << setw(23) << setprecision(16) 101 | << fabs(vol_a-vol_n) << endl; 102 | cout << "relative error : " << scientific << setw(23) << setprecision(16) 103 | << fabs(vol_a-vol_n)/vol_a << endl; 104 | cout << "-----------------------------------------------------------" << endl; 105 | if(!randominput) { 106 | cout << "with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2" << endl; 107 | cout << "-----------------------------------------------------------" << endl; 108 | cout << "analytical volume: 5.0000000000000000e-01" << endl; 109 | cout << "numerical volume: 5.0000000000000011e-01" << endl << endl; 110 | cout << "absolute error : 1.1102230246251565e-16" << endl; 111 | cout << "relative error : 2.2204460492503131e-16" << endl; 112 | cout << "------------- CPP: end sinusoidal surface check -----------" << endl; 113 | cout << "-----------------------------------------------------------" << endl; 114 | } 115 | cout << endl; 116 | 117 | return; 118 | } 119 | -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Sphere/sphere.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | !* -------------------------------------------------------------------------- * 20 | !* DESCRIPTION (reference phase where f(x,y,z) < 0): * 21 | !* ellipsoid/sphere inside the cube [0,1]x[0,1]x[0,1] * 22 | !* f(x,y) = c1*x^2 + c2*y^2 + c3*x*y + c4*x + c5*y - c6 * 23 | !* f(x,y,z) = f(x,y) + (z-ZC)^2/C2 * 24 | !* INPUT PARAMETERS: * 25 | !* (XC,YC,ZC) center of the ellipsoid; ALPHA: angle between two axes x' and * 26 | !* x (in the x-y plane); (A1,B1,C1): semiaxis along the three ellipsoid * 27 | !* (local) axes: x',y',z' * 28 | !* -------------------------------------------------------------------------- * 29 | 30 | REAL(8) FUNCTION IMPL_FUNC (xyz) 31 | 32 | IMPLICIT NONE 33 | REAL(8), DIMENSION(3), INTENT(IN) :: xyz 34 | 35 | REAL(8), PARAMETER :: MYPI = 3.141592653589793238462643D0 36 | REAL(8), PARAMETER :: ALPHA = 0.D0 37 | REAL(8), PARAMETER :: A1 = 1.D0, B1 = 1.D0, C1 = 1.D0 38 | REAL(8), PARAMETER :: XC = 0.D0, YC = 0.D0, ZC = 0.D0 39 | 40 | REAL(8) :: x,y,z,ca,sa,co1,co2,co3,co4,co5,co6,a2,b2,c2 41 | 42 | INTRINSIC DSIN,DCOS 43 | 44 | x = xyz(1) 45 | y = xyz(2) 46 | z = xyz(3) 47 | 48 | a2 = A1*A1 49 | b2 = B1*B1 50 | c2 = C1*C1 51 | ca = DCOS(ALPHA) 52 | sa = DSIN(ALPHA) 53 | co1 = ca*ca/a2 + sa*sa/b2 54 | co2 = sa*sa/a2 + ca*ca/b2 55 | co3 = 2.D0*ca*sa*(b2-a2)/(a2*b2) 56 | co4 = -(2.D0*co1*XC + co3*YC) 57 | co5 = -(2.D0*co2*YC + co3*XC) 58 | co6 = 1.0D0 - (co1*XC*XC + co2*YC*YC + co3*XC*YC) 59 | 60 | IMPL_FUNC = co1*x*x + co2*y*y + co3*x*y + co4*x + co5*y - co6 61 | IMPL_FUNC = IMPL_FUNC + (z - ZC)*(z - ZC)/c2 62 | 63 | RETURN 64 | 65 | END FUNCTION IMPL_FUNC 66 | 67 | !* -------------------------------------------------------------------------- * 68 | 69 | SUBROUTINE CHECK_VOLUME(volnum) 70 | 71 | IMPLICIT NONE 72 | REAL(8),INTENT(IN) :: volnum 73 | 74 | REAL(8), PARAMETER :: MYPI = 3.141592653589793238462643D0 75 | REAL(8), PARAMETER :: ALPHA = 0.D0 76 | REAL(8), PARAMETER :: A1 = 1.D0, B1 = 1.D0, C1 = 1.D0 77 | REAL(8), PARAMETER :: XC = 0.D0, YC = 0.D0, ZC = 0.D0 78 | 79 | REAL(8) :: volana,invfrac 80 | 81 | INTRINSIC DABS 82 | 83 | invfrac = 8.D0 84 | volana = 4.D0*MYPI*A1*B1*C1/(3.D0*invfrac); 85 | 86 | write(*,*) '-----------------------------------------------------------' 87 | write(*,*) '------------------- F: 1/8 sphere check -------------------' 88 | write(*,100) volana 89 | write(*,101) volnum 90 | write(*,*) ' ' 91 | write(*,102) DABS(volnum-volana) 92 | write(*,103) DABS(volnum-volana)/volana 93 | write(*,*) '-----------------------------------------------------------' 94 | write(*,*) 'with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2' 95 | write(*,*) '-----------------------------------------------------------' 96 | write(*,*) 'analytical volume: 5.2359877559829882E-01' 97 | write(*,*) 'numerical volume: 5.2359877559829937E-01' 98 | write(*,*) ' ' 99 | write(*,*) 'absolute error : 5.5511151231257827E-16' 100 | write(*,*) 'relative error : 1.0601848938211723E-15' 101 | write(*,*) '----------------- F: end 1/8 sphere check -----------------' 102 | write(*,*) '-----------------------------------------------------------' 103 | write(*,*) ' ' 104 | 100 FORMAT(' analytical volume: ', ES23.16) 105 | 101 FORMAT(' numerical volume: ', ES23.16) 106 | 102 FORMAT(' absolute error : ', ES23.16) 107 | 103 FORMAT(' relative error : ', ES23.16) 108 | 109 | END SUBROUTINE CHECK_VOLUME 110 | -------------------------------------------------------------------------------- /demo_src/CPP/2D/Gaussian/gaussian.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "gaussian.h" 26 | 27 | typedef const double creal; 28 | typedef const int cint; 29 | typedef double real; 30 | using namespace std; 31 | 32 | //* -------------------------------------------------------------------------- * 33 | //* DESCRIPTION (reference phase where f(x,y) < 0): * 34 | //* gaussian line in the square [0,1]x[0,1] * 35 | //* f(x,y) = y - yy0 - a0 exp[-ga (x - xx0)^2] * 36 | //* -------------------------------------------------------------------------- * 37 | 38 | static double yy0 = 0.22; 39 | static double a0 = 0.51; 40 | static double xx0 = 0.541; 41 | static double ga = 60.3; 42 | 43 | 44 | /* -------------------------------------------------------------------------- */ 45 | 46 | void init(cint randominput) 47 | { 48 | 49 | if(randominput) { 50 | 51 | /* initialize random number generator. */ 52 | srand(time(0)); 53 | 54 | double scalingfactor = 0.06; 55 | /* yy0 --> from 0.19 to 0.25 */ 56 | yy0 = 0.19 + ((double)rand() / RAND_MAX)*scalingfactor; 57 | 58 | /* xx0 --> from 0.511 to 0.561 */ 59 | xx0 = 0.511 + ((double)rand() / RAND_MAX)*scalingfactor; 60 | 61 | /* a0 --> from 0.48 to 0.54 */ 62 | a0 = 0.48 + ((double)rand() / RAND_MAX)*scalingfactor; 63 | 64 | /* ga --> from 60.00 to 0.60.6 */ 65 | ga = 60. + ((double)rand() / RAND_MAX)*scalingfactor; 66 | 67 | } 68 | return; 69 | } 70 | 71 | /* -------------------------------------------------------------------------- */ 72 | 73 | real impl_func(creal xy[]) 74 | { 75 | double x,y,f0; 76 | 77 | x = xy[0]; 78 | y = xy[1]; 79 | 80 | f0 = y - yy0 - a0*exp(-ga*(x-xx0)*(x-xx0)); 81 | 82 | return f0; 83 | } 84 | 85 | //* -------------------------------------------------------------------------- * 86 | 87 | void check_area(creal area_n, cint randominput) 88 | { 89 | real area_a; 90 | 91 | /* analytical integration with x in [0,1] */ 92 | area_a = yy0 + 0.5*a0*sqrt(M_PI/ga)*(erf(sqrt(ga)*(1.-xx0) )-erf(-sqrt(ga)*xx0)); 93 | 94 | cout << "-----------------------------------------------------------" << endl; 95 | cout << "------------------- CPP: gaussian check -------------------" << endl; 96 | cout << "analytical area : " << scientific << setw(23) << setprecision(16) 97 | << area_a << endl; 98 | cout << "numerical area : " << scientific << setw(23) << setprecision(16) 99 | << area_n << endl << endl; 100 | cout << "absolute error : " << scientific << setw(23) << setprecision(16) 101 | << fabs(area_a-area_n) << endl; 102 | cout << "relative error : " << scientific << setw(23) << setprecision(16) 103 | << fabs(area_a-area_n)/area_a << endl; 104 | cout << "-----------------------------------------------------------" << endl; 105 | if(!randominput) { 106 | cout << "with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2" << endl; 107 | cout << "-----------------------------------------------------------" << endl; 108 | cout << "analytical area : 3.3640894546075428e-01" << endl; 109 | cout << "numerical area : 3.3640894546075717e-01" << endl << endl; 110 | cout << "absolute error : 2.8865798640254070e-15" << endl; 111 | cout << "relative error : 8.5805680942041349e-15" << endl; 112 | cout << "----------------- CPP: end gaussian check -----------------" << endl; 113 | cout << "-----------------------------------------------------------" << endl; 114 | } 115 | cout << endl; 116 | 117 | return; 118 | } 119 | -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Cap1/cap1.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | !* -------------------------------------------------------------------------- * 20 | !* DESCRIPTION (reference phase where f(x,y,z) < 0): * 21 | !* ellipsoidal cap inside the domain [0,1]x[0,1]x[0,1] * 22 | !* f(x,y) = c1*x^2 + c2*y^2 + c3*x*y + c4*x + c5*y - c6 * 23 | !* f(x,y,z) = f(x,y) + (z-ZC)^2/C2 * 24 | !* INPUT PARAMETERS: * 25 | !* (XC,YC,ZC) center of the ellipsoid; ALPHA: angle between two axes x' and * 26 | !* x (in the x-y plane); (A1,B1,C1): semiaxis along the three ellipsoid * 27 | !* (local) axes: x',y',z' * 28 | !* -------------------------------------------------------------------------- * 29 | 30 | REAL(8) FUNCTION IMPL_FUNC (xyz) 31 | 32 | IMPLICIT NONE 33 | REAL(8), DIMENSION(3), INTENT(IN) :: xyz 34 | 35 | REAL(8), PARAMETER :: MYPI = 3.141592653589793238462643D0 36 | REAL(8), PARAMETER :: ALPHA = MYPI/3.D0 37 | REAL(8), PARAMETER :: A1 = 4.D0, B1 = 5.D0, C1 = 6.D0 38 | REAL(8), PARAMETER :: XC = 0.50D0, YC = 0.45D0, ZC = -5.97D0 39 | 40 | REAL(8) :: x,y,z,ca,sa,co1,co2,co3,co4,co5,co6,a2,b2,c2 41 | 42 | INTRINSIC DSIN,DCOS 43 | 44 | x = xyz(1) 45 | y = xyz(2) 46 | z = xyz(3) 47 | 48 | a2 = A1*A1 49 | b2 = B1*B1 50 | c2 = C1*C1 51 | ca = DCOS(ALPHA) 52 | sa = DSIN(ALPHA) 53 | co1 = ca*ca/a2 + sa*sa/b2 54 | co2 = sa*sa/a2 + ca*ca/b2 55 | co3 = 2.D0*ca*sa*(b2-a2)/(a2*b2) 56 | co4 = -(2.D0*co1*XC + co3*YC) 57 | co5 = -(2.D0*co2*YC + co3*XC) 58 | co6 = 1.0D0 - (co1*XC*XC + co2*YC*YC + co3*XC*YC) 59 | 60 | IMPL_FUNC = co1*x*x + co2*y*y + co3*x*y + co4*x + co5*y - co6 61 | IMPL_FUNC = IMPL_FUNC + (z - ZC)*(z - ZC)/c2 62 | 63 | RETURN 64 | 65 | END FUNCTION IMPL_FUNC 66 | 67 | !* -------------------------------------------------------------------------- * 68 | 69 | SUBROUTINE CHECK_VOLUME(volnum) 70 | 71 | IMPLICIT NONE 72 | REAL(8),INTENT(IN) :: volnum 73 | 74 | REAL(8), PARAMETER :: MYPI = 3.141592653589793238462643D0 75 | REAL(8), PARAMETER :: ALPHA = MYPI/3.D0 76 | REAL(8), PARAMETER :: A1 = 4.D0, B1 = 5.D0, C1 = 6.D0 77 | REAL(8), PARAMETER :: XC = 0.50D0, YC = 0.45D0, ZC = -5.97D0 78 | 79 | REAL(8) :: volana,h0 80 | 81 | INTRINSIC DABS 82 | 83 | h0 = C1 + ZC 84 | volana = MYPI*A1*B1*h0*h0*(1. - h0/(3.*C1))/C1 85 | 86 | write(*,*) '-----------------------------------------------------------' 87 | write(*,*) '------------------ F: cap check (1 cell) ------------------' 88 | write(*,100) volana 89 | write(*,101) volnum 90 | write(*,*) ' ' 91 | write(*,102) DABS(volnum-volana) 92 | write(*,103) DABS(volnum-volana)/volana 93 | write(*,*) '-----------------------------------------------------------' 94 | write(*,*) 'with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2' 95 | write(*,*) '-----------------------------------------------------------' 96 | write(*,*) 'analytical volume: 9.4090699975015856e-03' 97 | write(*,*) 'numerical volume: 9.4090641039290823E-03' 98 | write(*,*) ' ' 99 | write(*,*) 'absolute error : 5.8935725032877029E-09' 100 | write(*,*) 'relative error : 6.2637141660681008E-07' 101 | write(*,*) '---------------- F: end cap check (1 cell) ----------------' 102 | write(*,*) '-----------------------------------------------------------' 103 | write(*,*) ' ' 104 | 100 FORMAT(' analytical volume: ', ES23.16) 105 | 101 FORMAT(' numerical volume: ', ES23.16) 106 | 102 FORMAT(' absolute error : ', ES23.16) 107 | 103 FORMAT(' relative error : ', ES23.16) 108 | 109 | END SUBROUTINE CHECK_VOLUME 110 | -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Cap2/cap2.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | !* -------------------------------------------------------------------------- * 20 | !* DESCRIPTION (reference phase where f(x,y,z) < 0): * 21 | !* ellipsoidal cap inside the domain [-1,1]x[0,1]x[0,1] * 22 | !* f(x,y) = c1*x^2 + c2*y^2 + c3*x*y + c4*x + c5*y - c6 * 23 | !* f(x,y,z) = f(x,y) + (z-ZC)^2/C2 * 24 | !* INPUT PARAMETERS: * 25 | !* (XC,YC,ZC) center of the ellipsoid; ALPHA: angle between two axes x' and * 26 | !* x (in the x-y plane); (A1,B1,C1): semiaxis along the three ellipsoid * 27 | !* (local) axes: x',y',z' * 28 | !* -------------------------------------------------------------------------- * 29 | 30 | REAL(8) FUNCTION IMPL_FUNC (xyz) 31 | 32 | IMPLICIT NONE 33 | REAL(8), DIMENSION(3), INTENT(IN) :: xyz 34 | 35 | REAL(8), PARAMETER :: MYPI = 3.141592653589793238462643D0 36 | REAL(8), PARAMETER :: ALPHA = MYPI/3.D0 37 | REAL(8), PARAMETER :: A1 = 4.D0, B1 = 5.D0, C1 = 6.D0 38 | REAL(8), PARAMETER :: XC = 0.30D0, YC = 0.45D0, ZC = -5.97D0 39 | 40 | REAL(8) :: x,y,z,ca,sa,co1,co2,co3,co4,co5,co6,a2,b2,c2 41 | 42 | INTRINSIC DSIN,DCOS 43 | 44 | x = xyz(1) 45 | y = xyz(2) 46 | z = xyz(3) 47 | 48 | a2 = A1*A1 49 | b2 = B1*B1 50 | c2 = C1*C1 51 | ca = DCOS(ALPHA) 52 | sa = DSIN(ALPHA) 53 | co1 = ca*ca/a2 + sa*sa/b2 54 | co2 = sa*sa/a2 + ca*ca/b2 55 | co3 = 2.D0*ca*sa*(b2-a2)/(a2*b2) 56 | co4 = -(2.D0*co1*XC + co3*YC) 57 | co5 = -(2.D0*co2*YC + co3*XC) 58 | co6 = 1.0D0 - (co1*XC*XC + co2*YC*YC + co3*XC*YC) 59 | 60 | IMPL_FUNC = co1*x*x + co2*y*y + co3*x*y + co4*x + co5*y - co6 61 | IMPL_FUNC = IMPL_FUNC + (z - ZC)*(z - ZC)/c2 62 | 63 | RETURN 64 | 65 | END FUNCTION IMPL_FUNC 66 | 67 | !* -------------------------------------------------------------------------- * 68 | 69 | SUBROUTINE CHECK_VOLUME(volnum) 70 | 71 | IMPLICIT NONE 72 | REAL(8),INTENT(IN) :: volnum 73 | 74 | REAL(8), PARAMETER :: MYPI = 3.141592653589793238462643D0 75 | REAL(8), PARAMETER :: ALPHA = MYPI/3.D0 76 | REAL(8), PARAMETER :: A1 = 4.D0, B1 = 5.D0, C1 = 6.D0 77 | REAL(8), PARAMETER :: XC = 0.30D0, YC = 0.45D0, ZC = -5.97D0 78 | 79 | REAL(8) :: volana,h0 80 | 81 | INTRINSIC DABS 82 | 83 | h0 = C1 + ZC 84 | volana = MYPI*A1*B1*h0*h0*(1. - h0/(3.*C1))/C1 85 | 86 | write(*,*) '-----------------------------------------------------------' 87 | write(*,*) '------------------ F: cap check (2 cells) -----------------' 88 | write(*,100) volana 89 | write(*,101) volnum 90 | write(*,*) ' ' 91 | write(*,102) DABS(volnum-volana) 92 | write(*,103) DABS(volnum-volana)/volana 93 | write(*,*) '-----------------------------------------------------------' 94 | write(*,*) 'with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2' 95 | write(*,*) '-----------------------------------------------------------' 96 | write(*,*) 'analytical volume: 9.4090699975015856E-03' 97 | write(*,*) 'numerical volume: 9.4090693179626327E-03' 98 | write(*,*) ' ' 99 | write(*,*) 'absolute error : 6.7953895288574984E-10' 100 | write(*,*) 'relative error : 7.2221691736397911E-08' 101 | write(*,*) '---------------- F: end cap check (2 cells) ---------------' 102 | write(*,*) '-----------------------------------------------------------' 103 | write(*,*) ' ' 104 | 100 FORMAT(' analytical volume: ', ES23.16) 105 | 101 FORMAT(' numerical volume: ', ES23.16) 106 | 102 FORMAT(' absolute error : ', ES23.16) 107 | 103 FORMAT(' relative error : ', ES23.16) 108 | 109 | END SUBROUTINE CHECK_VOLUME 110 | -------------------------------------------------------------------------------- /demo_src/Fortran/3D/Cap3/cap3.f90: -------------------------------------------------------------------------------- 1 | !**************************************************************************** 2 | !* Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | !* Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | !* (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | !* Via dei Colli 16, 40136 Bologna, Italy * 6 | !* (b) Physics Department, Cooper Union, New York, NY, USA * 7 | !* (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | !* Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | !* (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | !* Paris, France * 11 | !* * 12 | !* You should have received a copy of the CPC license along with Vofi. * 13 | !* If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | !* * 15 | !* e-mail: ruben.scardovelli@unibo.it * 16 | !* * 17 | !**************************************************************************** 18 | 19 | !* -------------------------------------------------------------------------- * 20 | !* DESCRIPTION (reference phase where f(x,y,z) < 0): * 21 | !* ellipsoidal cap inside the domain [-1,1]x[-1,1]x[0,1] * 22 | !* f(x,y) = c1*x^2 + c2*y^2 + c3*x*y + c4*x + c5*y - c6 * 23 | !* f(x,y,z) = f(x,y) + (z-ZC)^2/C2 * 24 | !* INPUT PARAMETERS: * 25 | !* (XC,YC,ZC) center of the ellipsoid; ALPHA: angle between two axes x' and * 26 | !* x (in the x-y plane); (A1,B1,C1): semiaxis along the three ellipsoid * 27 | !* (local) axes: x',y',z' * 28 | !* -------------------------------------------------------------------------- * 29 | 30 | REAL(8) FUNCTION IMPL_FUNC (xyz) 31 | 32 | IMPLICIT NONE 33 | REAL(8), DIMENSION(3), INTENT(IN) :: xyz 34 | 35 | REAL(8), PARAMETER :: MYPI = 3.141592653589793238462643D0 36 | REAL(8), PARAMETER :: ALPHA = MYPI/3.D0 37 | REAL(8), PARAMETER :: A1 = 4.D0, B1 = 5.D0, C1 = 6.D0 38 | REAL(8), PARAMETER :: XC = 0.35D0, YC = 0.35D0, ZC = -5.97D0 39 | 40 | REAL(8) :: x,y,z,ca,sa,co1,co2,co3,co4,co5,co6,a2,b2,c2 41 | 42 | INTRINSIC DSIN,DCOS 43 | 44 | x = xyz(1) 45 | y = xyz(2) 46 | z = xyz(3) 47 | 48 | a2 = A1*A1 49 | b2 = B1*B1 50 | c2 = C1*C1 51 | ca = DCOS(ALPHA) 52 | sa = DSIN(ALPHA) 53 | co1 = ca*ca/a2 + sa*sa/b2 54 | co2 = sa*sa/a2 + ca*ca/b2 55 | co3 = 2.D0*ca*sa*(b2-a2)/(a2*b2) 56 | co4 = -(2.D0*co1*XC + co3*YC) 57 | co5 = -(2.D0*co2*YC + co3*XC) 58 | co6 = 1.0D0 - (co1*XC*XC + co2*YC*YC + co3*XC*YC) 59 | 60 | IMPL_FUNC = co1*x*x + co2*y*y + co3*x*y + co4*x + co5*y - co6 61 | IMPL_FUNC = IMPL_FUNC + (z - ZC)*(z - ZC)/c2 62 | 63 | RETURN 64 | 65 | END FUNCTION IMPL_FUNC 66 | 67 | !* -------------------------------------------------------------------------- * 68 | 69 | SUBROUTINE CHECK_VOLUME(volnum) 70 | 71 | IMPLICIT NONE 72 | REAL(8),INTENT(IN) :: volnum 73 | 74 | REAL(8), PARAMETER :: MYPI = 3.141592653589793238462643D0 75 | REAL(8), PARAMETER :: ALPHA = MYPI/3.D0 76 | REAL(8), PARAMETER :: A1 = 4.D0, B1 = 5.D0, C1 = 6.D0 77 | REAL(8), PARAMETER :: XC = 0.35D0, YC = 0.35D0, ZC = -5.97D0 78 | 79 | REAL(8) :: volana,h0 80 | 81 | INTRINSIC DABS 82 | 83 | h0 = C1 + ZC 84 | volana = MYPI*A1*B1*h0*h0*(1. - h0/(3.*C1))/C1 85 | 86 | write(*,*) '-----------------------------------------------------------' 87 | write(*,*) '------------------ F: cap check (3 cells) -----------------' 88 | write(*,100) volana 89 | write(*,101) volnum 90 | write(*,*) ' ' 91 | write(*,102) DABS(volnum-volana) 92 | write(*,103) DABS(volnum-volana)/volana 93 | write(*,*) '-----------------------------------------------------------' 94 | write(*,*) 'with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2' 95 | write(*,*) '-----------------------------------------------------------' 96 | write(*,*) 'analytical volume: 9.4090699975015856E-03' 97 | write(*,*) 'numerical volume: 9.4090697360378721E-03' 98 | write(*,*) ' ' 99 | write(*,*) 'absolute error : 2.6146371352731013E-10' 100 | write(*,*) 'relative error : 2.7788475757618687E-08' 101 | write(*,*) '---------------- F: end cap check (3 cells) ---------------' 102 | write(*,*) '-----------------------------------------------------------' 103 | write(*,*) ' ' 104 | 100 FORMAT(' analytical volume: ', ES23.16) 105 | 101 FORMAT(' numerical volume: ', ES23.16) 106 | 102 FORMAT(' absolute error : ', ES23.16) 107 | 103 FORMAT(' relative error : ', ES23.16) 108 | 109 | END SUBROUTINE CHECK_VOLUME 110 | -------------------------------------------------------------------------------- /demo_src/C/2D/Sine_line/sine_line.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "sine_line.h" 24 | 25 | typedef const double creal; 26 | typedef const int cint; 27 | typedef double real; 28 | 29 | /* -------------------------------------------------------------------------- * 30 | * DESCRIPTION (reference phase where f(x,y) < 0): * 31 | * sinusoidal line in the square [0,1]x[0,1] * 32 | * f(x,y) = y - b0*sin(c0 pi x+ pi/d0) - a0 * 33 | * -------------------------------------------------------------------------- */ 34 | 35 | static double a0 = 0.5; 36 | static double b0 = 0.25; 37 | static double c0 = 4.0; 38 | static double d0 = 14.0; 39 | 40 | 41 | /* -------------------------------------------------------------------------- */ 42 | 43 | void init(cint randominput) 44 | { 45 | 46 | if(randominput) { 47 | 48 | /* initialize random number generator. */ 49 | srand(time(0)); 50 | 51 | /* a0 --> from 0.45 to 0.55 */ 52 | double scalingfactor = 0.1; 53 | a0 = 0.45 + ((double)rand() / RAND_MAX)*scalingfactor; 54 | /* b0 --> from 0.20 to 0.30 */ 55 | b0 = 0.20 + ((double)rand() / RAND_MAX)*scalingfactor; 56 | /* c0 --> from 0.35 to 0.45 */ 57 | c0 = 0.35 + ((double)rand() / RAND_MAX)*scalingfactor; 58 | /* d0 --> from 13.95 to 14.05 */ 59 | d0 = 13.95 + ((double)rand() / RAND_MAX)*scalingfactor; 60 | 61 | } 62 | 63 | return; 64 | } 65 | 66 | /* -------------------------------------------------------------------------- */ 67 | 68 | real impl_func(creal xy[]) 69 | { 70 | double x,y,f0; 71 | 72 | x = xy[0]; 73 | y = xy[1]; 74 | 75 | f0 = y - a0 - b0*sin(c0*M_PI*x + M_PI/d0); 76 | 77 | return f0; 78 | } 79 | 80 | /* -------------------------------------------------------------------------- */ 81 | 82 | void check_area(creal area_n, cint randominput) 83 | { 84 | real area_a; 85 | 86 | /* analytical integration with x in [0,1] */ 87 | area_a = a0 + b0*(-cos((c0 + 1./d0)*M_PI) + cos(M_PI/d0))/(c0*M_PI); 88 | 89 | fprintf (stdout,"------------------------------------------------------------------------\n"); 90 | fprintf (stdout,"--------------------- C: sine line check -------------------------------\n"); 91 | fprintf (stdout," * sinusoidal line in the square [%.1f,%.1f]x[%.1f,%.1f] in a %dX%d grid *\n", X0, X0+H, Y0, Y0+H, NMX, NMY); 92 | fprintf (stdout," * f(x,y) = y - b0*sin(c0 pi x+ pi/d0) - a0 *\n"); 93 | fprintf (stdout,"------------------------------------------------------------------------\n"); 94 | fprintf (stdout,"a0: %23.16e\n",a0); 95 | fprintf (stdout,"b0: %23.16e\n",b0); 96 | fprintf (stdout,"c0: %23.16e\n",c0); 97 | fprintf (stdout,"d0: %23.16e\n",d0); 98 | fprintf (stdout,"-----------------------------------------------------------\n"); 99 | fprintf (stdout,"analytical area : %23.16e\n",area_a); 100 | fprintf (stdout,"numerical area : %23.16e\n\n",area_n); 101 | fprintf (stdout,"absolute error : %23.16e\n",fabs(area_a-area_n)); 102 | fprintf (stdout,"relative error : %23.16e\n",fabs(area_a-area_n)/area_a); 103 | fprintf (stdout,"-----------------------------------------------------------\n"); 104 | if(!randominput) { 105 | fprintf (stdout,"with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2\n"); 106 | fprintf (stdout,"-----------------------------------------------------------\n"); 107 | fprintf (stdout,"analytical area : 5.0000000000000000e-01\n"); 108 | fprintf (stdout,"numerical area : 4.9999999999993749e-01\n\n"); 109 | fprintf (stdout,"absolute error : 6.2505556286396313e-14\n"); 110 | fprintf (stdout,"relative error : 1.2501111257279263e-13\n"); 111 | fprintf (stdout,"----------------- C: end sine line check ------------------\n"); 112 | fprintf (stdout,"-----------------------------------------------------------\n"); 113 | } 114 | fprintf (stdout,"\n"); 115 | 116 | return; 117 | } 118 | -------------------------------------------------------------------------------- /demo_src/C/2D/Gaussian/gaussian.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Copyright (C) 2015 by Simone Bnà(a), Sandro Manservisi(a), * 3 | * Ruben Scardovelli(a), Philip Yecko(b) and Stephane Zaleski(c,d) * 4 | * (a) DIN–Lab. di Montecuccolino, Università di Bologna, * 5 | * Via dei Colli 16, 40136 Bologna, Italy * 6 | * (b) Physics Department, Cooper Union, New York, NY, USA * 7 | * (c) Sorbonne Universités, UPMC Univ Paris 06, UMR 7190, * 8 | * Institut Jean Le Rond d’Alembert, F-75005, Paris, France * 9 | * (d) CNRS, UMR 7190, Institut Jean Le Rond d’Alembert, F-75005, * 10 | * Paris, France * 11 | * * 12 | * You should have received a copy of the CPC license along with Vofi. * 13 | * If not, see http://cpc.cs.qub.ac.uk/licence/licence.html. * 14 | * * 15 | * e-mail: ruben.scardovelli@unibo.it * 16 | * * 17 | ****************************************************************************/ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "gaussian.h" 24 | 25 | typedef const double creal; 26 | typedef const int cint; 27 | typedef double real; 28 | 29 | /* -------------------------------------------------------------------------- * 30 | * DESCRIPTION (reference phase where f(x,y) < 0): * 31 | * gaussian line in the square [0,1]x[0,1] * 32 | * f(x,y) = y - yy0 - a0 exp[-ga (x - xx0)^2] * 33 | * -------------------------------------------------------------------------- */ 34 | 35 | static double yy0 = 0.22; 36 | static double a0 = 0.51; 37 | static double xx0 = 0.541; 38 | static double ga = 60.3; 39 | 40 | 41 | /* -------------------------------------------------------------------------- */ 42 | 43 | void init(cint randominput) 44 | { 45 | 46 | if(randominput) { 47 | 48 | /* initialize random number generator. */ 49 | srand(time(0)); 50 | 51 | double scalingfactor = 0.06; 52 | /* yy0 --> from 0.19 to 0.25 */ 53 | yy0 = 0.19 + ((double)rand() / RAND_MAX)*scalingfactor; 54 | 55 | /* xx0 --> from 0.511 to 0.561 */ 56 | xx0 = 0.511 + ((double)rand() / RAND_MAX)*scalingfactor; 57 | 58 | /* a0 --> from 0.48 to 0.54 */ 59 | a0 = 0.48 + ((double)rand() / RAND_MAX)*scalingfactor; 60 | 61 | /* ga --> from 60.00 to 0.60.6 */ 62 | ga = 60. + ((double)rand() / RAND_MAX)*scalingfactor; 63 | 64 | } 65 | 66 | return; 67 | } 68 | 69 | /* -------------------------------------------------------------------------- */ 70 | 71 | real impl_func(creal xy[]) 72 | { 73 | double x,y,f0; 74 | 75 | x = xy[0]; 76 | y = xy[1]; 77 | 78 | f0 = y - yy0 - a0*exp(-ga*(x-xx0)*(x-xx0)); 79 | 80 | return f0; 81 | } 82 | 83 | /* -------------------------------------------------------------------------- */ 84 | 85 | void check_area(creal area_n, cint randominput) 86 | { 87 | real area_a; 88 | 89 | /* analytical integration with x in [0,1] */ 90 | area_a = yy0 + 0.5*a0*sqrt(M_PI/ga)*(erf(sqrt(ga)*(1.-xx0) )-erf(-sqrt(ga)*xx0)); 91 | 92 | fprintf (stdout,"----------------------------------------------------------------------\n"); 93 | fprintf (stdout,"--------------------- C: gaussian check ------------------------------\n"); 94 | fprintf (stdout," * gaussian line in the square [%.1f,%.1f]x[%.1f,%.1f] in a %dX%d grid *\n", X0, X0+H, Y0, Y0+H, NMX, NMY); 95 | fprintf (stdout," * f(x,y) = y - yy0 - a0 exp[-ga (x - xx0)^2] *\n"); 96 | fprintf (stdout,"----------------------------------------------------------------------\n"); 97 | fprintf (stdout,"yy0: %23.16e\n",yy0); 98 | fprintf (stdout,"xx0: %23.16e\n",xx0); 99 | fprintf (stdout,"a0: %23.16e\n",a0); 100 | fprintf (stdout,"ga: %23.16e\n",ga); 101 | fprintf (stdout,"--------------------------------------------------------------------\n"); 102 | fprintf (stdout,"analytical area : %23.16e\n",area_a); 103 | fprintf (stdout,"numerical area : %23.16e\n\n",area_n); 104 | fprintf (stdout,"absolute error : %23.16e\n",fabs(area_a-area_n)); 105 | fprintf (stdout,"relative error : %23.16e\n",fabs(area_a-area_n)/area_a); 106 | fprintf (stdout,"-----------------------------------------------------------\n"); 107 | if(!randominput) { 108 | fprintf (stdout,"with Intel i7 3.4 GHz + Linux openSUSE 13.1 + gcc 4.8.1 -O2\n"); 109 | fprintf (stdout,"-----------------------------------------------------------\n"); 110 | fprintf (stdout,"analytical area : 3.3640894546075428e-01\n"); 111 | fprintf (stdout,"numerical area : 3.3640894546075722e-01\n\n"); 112 | fprintf (stdout,"absolute error : 2.9420910152566648e-15\n"); 113 | fprintf (stdout,"relative error : 8.7455790190926756e-15\n"); 114 | fprintf (stdout,"------------------ C: end gaussian check ------------------\n"); 115 | fprintf (stdout,"-----------------------------------------------------------\n"); 116 | } 117 | fprintf (stdout,"\n"); 118 | 119 | return; 120 | } 121 | --------------------------------------------------------------------------------