45 lines
1.6 KiB
Ruby
45 lines
1.6 KiB
Ruby
class Petsc < Formula
|
|
desc "Portable, Extensible Toolkit for Scientific Computation"
|
|
homepage "https://www.mcs.anl.gov/petsc/"
|
|
url "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.9.3.tar.gz"
|
|
sha256 "8828fe1221f038d78a8eee3325cdb22ad1055a2f0671871815ee9f47365f93bb"
|
|
|
|
bottle do
|
|
sha256 "733080c80cec9ad2c7da2fb5d922f94889421779eac6c291c9a62152f333fb6b" => :high_sierra
|
|
sha256 "e8858a1cec95cc42417773aac1b7e85db1c4938e149f7b27a20ad739a51cb395" => :sierra
|
|
sha256 "4b8ddec36720b2778df1fcdcf765bcf7a847abbeec6a7df9f09067b4ca4fb505" => :el_capitan
|
|
end
|
|
|
|
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/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
|