See Examples for how to use one of the examples as a scaffold for your application.

To compile an application that depends on the IBAMR library, it is necessary to link to the IBAMR library. The following Makefile for 2D application demonstrates one way to do this:

2D Makefile

######################################################################
## Here specify the location of the IBAMR source and the location
## where IBAMR has been built.

IBAMR_SRC_DIR = /path/to/IBAMR_SRC_DIR
IBAMR_BUILD_DIR = /path/to/IBAMR_BUILD_DIR

######################################################################
## Include variables specific to the particular IBAMR build.
include $(IBAMR_BUILD_DIR)/config/make.inc

## Needed for Xcode to capture compiler errors and warnings.
ifdef XCODE_VERSION_ACTUAL
CXXFLAGS += -fno-color-diagnostics
endif

######################################################################
## Build the application.
##
## NOTE: The following assumes that all .cpp files in the present
##       directory are used to build the executable.

SRC = $(wildcard *.cpp)
CPPFLAGS += -MD -MP
PDIM = 2
OBJS = $(SRC:%.cpp=%.o) $(IBAMR_LIB_2D) $(IBTK_LIB_2D)

main2d: $(OBJS)
	$(CXX) $(CXXFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -DNDIM=$(PDIM) -o $@
clean:
	$(RM) main2d
	$(RM) *.o *.lo *.objs *.ii *.int.c
	$(RM) -r .libs

-include $(SRC:%.cpp=%.d)

Then, for this example, make main2d would compile the application using the 2D libraries.

If you instead set PDIM = 3 and other instances of 2D to 3D, then the application would compile against the 3D libraries. (See below)

3D Makefile

######################################################################
## Here specify the location of the IBAMR source and the location
## where IBAMR has been built.
IBAMR_SRC_DIR = /home/elijah/sfw/ibamr/IBAMR
IBAMR_BUILD_DIR = /home/elijah/sfw/ibamr/ibamr_master_build

######################################################################
## Include variables specific to the particular IBAMR build.
include $(IBAMR_BUILD_DIR)/config/make.inc

## Needed for Xcode to capture compiler errors and warnings.
ifdef XCODE_VERSION_ACTUAL
CXXFLAGS += -fno-color-diagnostics
endif

######################################################################
## Build the application.
##
## NOTE: The following assumes that all .cpp files in the present
##       directory are used to build the executable.

SRC = $(wildcard *.cpp)
CPPFLAGS += -MD -MP
PDIM = 3
OBJS = $(SRC:%.cpp=%.o) $(IBAMR_LIB_3D) $(IBTK_LIB_3D)

main3d: $(OBJS)
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LIBS) -DNDIM=$(PDIM) -o main3d

clean:
	$(RM) main3d_thin exe
	$(RM) *.o *.lo *.objs *.ii *.int.c
	$(RM) -r .libs

-include $(SRC:%.cpp=%.d)