48 lines
1.8 KiB
Ruby
48 lines
1.8 KiB
Ruby
class Petsc < Formula
|
|
desc "Portable, Extensible Toolkit for Scientific Computation (real)"
|
|
homepage "https://www.mcs.anl.gov/petsc/"
|
|
url "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.10.3.tar.gz"
|
|
sha256 "f03650ea5592313dd2b8be7ae9cc498369da660185b58f9e98689a9bc355e982"
|
|
revision 1
|
|
|
|
bottle do
|
|
sha256 "590531ba5fde737e2dfb3292dbee8d6e90443f43ca07fb05a9ac35212dfa9714" => :mojave
|
|
sha256 "90409e88a4815d6fc89825a38881abd841a1005424adf95576b3e8e47a02238d" => :high_sierra
|
|
sha256 "911141ce3eedae047039027ce3ded089d9fff25560131b1f886f95e9c3d6f02c" => :sierra
|
|
end
|
|
|
|
depends_on "hdf5"
|
|
depends_on "hwloc"
|
|
depends_on "metis"
|
|
depends_on "netcdf"
|
|
depends_on "open-mpi"
|
|
depends_on "scalapack"
|
|
depends_on "suite-sparse"
|
|
|
|
conflicts_with "petsc-complex", :because => "petsc must be installed with either real or complex support, not both"
|
|
|
|
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
|