2018-02-02 06:38:57 +00:00
|
|
|
class Petsc < Formula
|
|
|
|
desc "Portable, Extensible Toolkit for Scientific Computation"
|
|
|
|
homepage "https://www.mcs.anl.gov/petsc/"
|
2018-05-21 05:05:19 +00:00
|
|
|
url "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.9.2.tar.gz"
|
|
|
|
sha256 "65100189796f05991bb2e746f56eec27f8425f6eb901f8f08459ffd2a5e6c69a"
|
2018-02-02 06:38:57 +00:00
|
|
|
|
2018-04-26 09:09:34 +00:00
|
|
|
bottle do
|
2018-05-21 05:24:18 +00:00
|
|
|
sha256 "9564f387895efdb466fa1046d653fded244981f24df1e0e2b11f2a915473ba30" => :high_sierra
|
|
|
|
sha256 "0e67b175ec324cf89fba1bc2eadc393bb059946a8e75105ee72dd404635282bb" => :sierra
|
|
|
|
sha256 "7f76b7f77d10e4c544f52403d83aea9c224b14a5cb8fc26bfc20a784fa27857a" => :el_capitan
|
2018-04-26 09:09:34 +00:00
|
|
|
end
|
|
|
|
|
2018-02-02 06:38:57 +00:00
|
|
|
depends_on "hdf5"
|
|
|
|
depends_on "hwloc"
|
|
|
|
depends_on "metis"
|
|
|
|
depends_on "netcdf"
|
|
|
|
depends_on "open-mpi"
|
|
|
|
depends_on "scalapack"
|
|
|
|
depends_on "suite-sparse"
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["CC"] = "mpicc"
|
|
|
|
ENV["CXX"] = "mpicxx"
|
|
|
|
ENV["F77"] = "mpif77"
|
|
|
|
ENV["FC"] = "mpif90"
|
|
|
|
system "./configure", "--prefix=#{prefix}",
|
|
|
|
"--with-debugging=0",
|
|
|
|
"--with-scalar-type=real",
|
|
|
|
"--with-x=0"
|
|
|
|
system "make", "all"
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
test_case = "#{pkgshare}/examples/src/ksp/ksp/examples/tutorials/ex1.c"
|
|
|
|
system "mpicc", test_case, "-I#{include}", "-L#{lib}", "-lpetsc", "-o", "test"
|
|
|
|
output = shell_output("./test")
|
|
|
|
# This PETSc example prints several lines of output. The last line contains
|
|
|
|
# an error norm, expected to be small.
|
|
|
|
line = output.lines.last
|
|
|
|
assert_match /^Norm of error .+, Iterations/, line, "Unexpected output format"
|
|
|
|
error = line.split[3].to_f
|
|
|
|
assert (error >= 0.0 && error < 1.0e-13), "Error norm too large"
|
|
|
|
end
|
|
|
|
end
|