| 1 |
# Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced |
| 2 |
# at the Lawrence Livermore National Laboratory. All Rights reserved. See files |
| 3 |
# LICENSE and NOTICE for details. LLNL-CODE-806117. |
| 4 |
# |
| 5 |
# This file is part of the MFEM library. For more information and source code |
| 6 |
# availability visit https://mfem.org. |
| 7 |
# |
| 8 |
# MFEM is free software; you can redistribute it and/or modify it under the |
| 9 |
# terms of the BSD-3 license. We welcome feedback and contributions, see file |
| 10 |
# CONTRIBUTING.md for details. |
| 11 |
|
| 12 |
# Use the MFEM build directory |
| 13 |
MFEM_DIR ?= ../.. |
| 14 |
MFEM_BUILD_DIR ?= ../.. |
| 15 |
MFEM_INSTALL_DIR ?= ../../mfem |
| 16 |
SRC = $(if $(MFEM_DIR:../..=),$(MFEM_DIR)/miniapps/hdiv-linear-solver/,) |
| 17 |
CONFIG_MK = $(or $(wildcard $(MFEM_BUILD_DIR)/config/config.mk),\ |
| 18 |
$(wildcard $(MFEM_INSTALL_DIR)/share/mfem/config.mk)) |
| 19 |
|
| 20 |
MFEM_LIB_FILE = mfem_is_not_built |
| 21 |
-include $(CONFIG_MK) |
| 22 |
|
| 23 |
HDIV_HEADERS = hdiv_linear_solver.hpp discrete_divergence.hpp change_basis.hpp \ |
| 24 |
../solvers/lor_mms.hpp |
| 25 |
HDIV_SRC = hdiv_linear_solver.cpp change_basis.cpp discrete_divergence.cpp |
| 26 |
HDIV_OBJ = $(HDIV_SRC:.cpp=.o) |
| 27 |
|
| 28 |
SEQ_MINIAPPS = |
| 29 |
PAR_MINIAPPS = grad_div darcy |
| 30 |
|
| 31 |
ifeq ($(MFEM_USE_MPI),NO) |
| 32 |
MINIAPPS = $(SEQ_MINIAPPS) |
| 33 |
else |
| 34 |
MINIAPPS = $(PAR_MINIAPPS) $(SEQ_MINIAPPS) |
| 35 |
endif |
| 36 |
|
| 37 |
.SUFFIXES: |
| 38 |
.SUFFIXES: .o .cpp .mk |
| 39 |
.PHONY: all clean clean-build clean-exec |
| 40 |
.PRECIOUS: %.o |
| 41 |
|
| 42 |
all: $(MINIAPPS) |
| 43 |
|
| 44 |
# Remove built-in rules |
| 45 |
%: %.cpp |
| 46 |
%.o: %.cpp |
| 47 |
|
| 48 |
$(MINIAPPS):%: %.o $(HDIV_OBJ) |
| 49 |
$(MFEM_CXX) $(MFEM_LINK_FLAGS) $(HDIV_OBJ) -o $@ $< $(MFEM_LIBS) |
| 50 |
|
| 51 |
%.o: $(SRC)%.cpp $(MFEM_LIB_FILE) $(CONFIG_MK) |
| 52 |
$(MFEM_CXX) $(MFEM_FLAGS) -c $< -o $@ |
| 53 |
|
| 54 |
MFEM_TESTS = MINIAPPS |
| 55 |
include $(MFEM_TEST_MK) |
| 56 |
|
| 57 |
# Testing: Specific execution options |
| 58 |
RUN_MPI = $(MFEM_MPIEXEC) $(MFEM_MPIEXEC_NP) $(MFEM_MPI_NP) |
| 59 |
darcy-test-par: darcy |
| 60 |
@$(call mfem-test,$<, $(RUN_MPI), H(div) Darcy solver miniapp,\ |
| 61 |
-m ../../data/fichera-q2.mesh,SKIP-NO-VIS) |
| 62 |
grad_div-test-par: grad_div |
| 63 |
@$(call mfem-test,$<, $(RUN_MPI), H(div) grad-div solver miniapp,-sp -ams \ |
| 64 |
-lor -hb -m ../../data/fichera-q2.mesh -rp 0,SKIP-NO-VIS) |
| 65 |
|
| 66 |
# Generate an error message if the MFEM library is not built and exit |
| 67 |
$(MFEM_LIB_FILE): |
| 68 |
$(error The MFEM library is not built) |
| 69 |
|
| 70 |
clean: clean-build clean-exec |
| 71 |
|
| 72 |
clean-build: |
| 73 |
rm -f *.o *~ $(MINIAPPS) |
| 74 |
rm -rf *.dSYM *.TVD.*breakpoints |
| 75 |
|
| 76 |
clean-exec: |
| 77 |
@rm -rf mesh.* sol.* ParaView |