48 lines
1.8 KiB
Ruby
48 lines
1.8 KiB
Ruby
class PetscComplex < Formula
|
|
desc "Portable, Extensible Toolkit for Scientific Computation (complex)"
|
|
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"
|
|
revision 1
|
|
|
|
bottle do
|
|
sha256 "b113b3d241bc68e0fd51ea56ef94d78a0833d0d41158f2cd39e8510f5cddbd69" => :mojave
|
|
sha256 "d7980bb61e3ef91e02981da9455a2c17e07cbae647467128b152aaf59834163c" => :high_sierra
|
|
sha256 "66d5f2aea2efc4cd1a05b141cf4d7c81aab9cbc01db4cf0506387dfb38eb7297" => :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", :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=complex",
|
|
"--with-x=0"
|
|
system "make", "all"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
test_case = "#{share}/petsc/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
|