voro++: migrate from homebrew/science
Closes #16743. Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
parent
9eb05327f0
commit
b1212cd8ab
1 changed files with 30 additions and 0 deletions
30
Formula/voro++.rb
Normal file
30
Formula/voro++.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
class Voroxx < Formula
|
||||
desc "3D Voronoi cell software library"
|
||||
homepage "http://math.lbl.gov/voro++"
|
||||
url "http://math.lbl.gov/voro++/download/dir/voro++-0.4.6.tar.gz"
|
||||
sha256 "ef7970071ee2ce3800daa8723649ca069dc4c71cc25f0f7d22552387f3ea437e"
|
||||
revision 1
|
||||
|
||||
def install
|
||||
system "make", "install", "PREFIX=#{prefix}"
|
||||
pkgshare.install("examples")
|
||||
mv prefix/"man", share/"man"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.cpp").write <<-EOS.undent
|
||||
#include "voro++.hh"
|
||||
double rnd() { return double(rand())/RAND_MAX; }
|
||||
int main() {
|
||||
voro::container con(0, 1, 0, 1, 0, 1, 6, 6, 6, false, false, false, 8);
|
||||
for (int i = 0; i < 20; i++) con.put(i, rnd(), rnd(), rnd());
|
||||
if (fabs(con.sum_cell_volumes() - 1) > 1.e-8) abort();
|
||||
con.draw_cells_gnuplot("test.gnu");
|
||||
}
|
||||
EOS
|
||||
system ENV.cxx, "test.cpp", "-I#{include}/voro++", "-L#{lib}",
|
||||
"-lvoro++"
|
||||
system "./a.out"
|
||||
assert File.exist?("test.gnu")
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue