|
| 1 | +class DamaskGrid < Formula |
| 2 | + desc "Grid solver of DAMASK - Multi-physics crystal plasticity simulation package" |
| 3 | + homepage "https://damask-multiphysics.org" |
| 4 | + url "https://damask-multiphysics.org/download/damask-3.0.2.tar.xz" |
| 5 | + sha256 "82f9b3aefde87193c12a7c908f42b711b278438f6cad650918989e37fb6dbde4" |
| 6 | + license "AGPL-3.0-only" |
| 7 | + |
| 8 | + depends_on "cmake" => :build |
| 9 | + depends_on "pkgconf" => :build |
| 10 | + depends_on "petsc" |
| 11 | + |
| 12 | + uses_from_macos "zlib" |
| 13 | + |
| 14 | + resource "testfiles" do |
| 15 | + url "https://damask-multiphysics.org/download/damask-3.0.2.tar.xz" |
| 16 | + sha256 "82f9b3aefde87193c12a7c908f42b711b278438f6cad650918989e37fb6dbde4" |
| 17 | + end |
| 18 | + |
| 19 | + def install |
| 20 | + ENV["PETSC_DIR"] = Formula["petsc"].opt_prefix |
| 21 | + args = %w[ |
| 22 | + -DDAMASK_SOLVER=grid |
| 23 | + ] |
| 24 | + system "cmake", "-S", ".", "-B", "build-grid", *args, *std_cmake_args |
| 25 | + system "cmake", "--build", "build-grid", "--target", "install" |
| 26 | + end |
| 27 | + |
| 28 | + test do |
| 29 | + resource("testfiles").stage do |
| 30 | + inreplace "examples/grid/tensionX.yaml" do |s| |
| 31 | + s.gsub! " t: 10", " t: 1" |
| 32 | + s.gsub! " t: 60", " t: 1" |
| 33 | + s.gsub! "N: 60", "N: 1" |
| 34 | + s.gsub! "N: 40", "N: 1" |
| 35 | + end |
| 36 | + |
| 37 | + args = %w[ |
| 38 | + -w examples/grid |
| 39 | + -m material.yaml |
| 40 | + -g 20grains16x16x16.vti |
| 41 | + -l tensionX.yaml |
| 42 | + -j output |
| 43 | + ] |
| 44 | + system "#{bin}/DAMASK_grid", *args |
| 45 | + assert_path_exists "examples/grid/output.hdf5", "output.hdf5 must exist" |
| 46 | + end |
| 47 | + end |
| 48 | +end |
0 commit comments