]> https://gitweb.dealii.org/ - code-gallery.git/commitdiff
Fix the braid example. 151/head
authorDavid Wells <drwells@email.unc.edu>
Fri, 23 Jun 2023 15:57:31 +0000 (11:57 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sat, 24 Jun 2023 18:17:23 +0000 (14:17 -0400)
- Rewrite CMakeLists.txt
- Fix test output

parallel_in_time/CMakeLists.txt
parallel_in_time/test/CMakeLists.txt
parallel_in_time/test/test_braid.output

index f6fbb8bb83cb20bdadcd09d5e104d087dccc50b4..2eb9385cfa40ea57ba5ed775ad2c9e5cdd6a46c3 100644 (file)
@@ -1,41 +1,10 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 3.3.0)
 
-# Set the name of the project and target:
-SET(TARGET "parallel_in_time")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
-
-SET(PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
-SET(SRC_PATH "${PROJECT_PATH}/src")
-SET(TEST_SRC_PATH "${PROJECT_PATH}/test")
-# SET(BIN_PATH  "${PROJECT_BINARY_DIR}/bin")
-SET(LIB_NAME "${TARGET}_lib")
-SET(BIN_NAME "${TARGET}")
-SET(TEST_PATH "${PROJECT_BINARY_DIR}/test")
-SET(TEST_NAME "test_${TARGET}")
-
-SET(LIB_SRC
-  ${SRC_PATH}/BraidFuncs.cc
-  ${SRC_PATH}/Utilities.cc
-  )
-
-SET(TARGET_SRC
-  ${SRC_PATH}/${TARGET}.cc
-  )
-
-SET(TEST_SRC
-  ${TEST_SRC_PATH}/test_braid.cc
-  )
-
-OPTION(DO_MFG "Do the manufactured solution run" OFF)
-
-IF(DO_MFG)
-  # If we are doing the manufactured solution, tell
-  # the C++ processor so it can enable MFG solutions
-  MESSAGE(STATUS "Manufactured solution enabled")
-  ADD_DEFINITIONS(-DDO_MFG)
-ENDIF(DO_MFG)
+PROJECT("parallel_in_time")
 
+#
+# setup deal.II
+#
 FIND_PACKAGE(deal.II 9.4.0
   HINTS ${deal.II_DIR} ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR}
   )
@@ -46,9 +15,17 @@ IF(NOT ${deal.II_FOUND})
     "or set an environment variable \"DEAL_II_DIR\" that contains this path."
     )
 ENDIF()
+DEAL_II_INITIALIZE_CACHED_VARIABLES()
+
+IF(NOT ${DEAL_II_WITH_MPI})
+  MESSAGE(FATAL_ERROR "parallel_in_time requires that deal.II be set up with MPI.")
+ENDIF()
 
-# Find braid details
-SET(BRAID_DIR "$ENV{BRAID_DIR}" CACHE INTERNAL "Copied BRAID_DIR from environment variable")
+#
+# setup braid
+#
+SET(BRAID_DIR "$ENV{BRAID_DIR}" CACHE INTERNAL
+  "Copied BRAID_DIR from environment variable")
 
 FIND_PATH(BRAID_INCLUDE_DIR
   NAMES braid.h
@@ -63,32 +40,39 @@ FIND_LIBRARY(BRAID_LIBRARY
 MESSAGE(STATUS "Braid include directory: ${BRAID_INCLUDE_DIR}")
 MESSAGE(STATUS "Braid library:           ${BRAID_LIBRARY}")
 
-# Include the braid paths and libraries
 INCLUDE_DIRECTORIES(${BRAID_INCLUDE_DIR})
 
-# Build the library
-ADD_LIBRARY(${LIB_NAME} SHARED ${LIB_SRC})
-DEAL_II_SETUP_TARGET(${LIB_NAME})
-
-DEAL_II_INITIALIZE_CACHED_VARIABLES()
-PROJECT(${TARGET})
+#
+# setup parallel_in_time
+#
+SET(SRC_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src")
+SET(LIB_NAME "parallel_in_time_lib")
 
-# Tell CMake to find MPI
-FIND_PACKAGE(MPI REQUIRED)
-ADD_DEFINITIONS(-DUSE_MPI)
-INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})
+SET(LIB_SRC
+  ${SRC_PATH}/BraidFuncs.cc
+  ${SRC_PATH}/Utilities.cc
+  )
 
-DEAL_II_INVOKE_AUTOPILOT()
-TARGET_LINK_LIBRARIES(${TARGET} ${BRAID_LIBRARY}) # link braid
-TARGET_LINK_LIBRARIES(${TARGET} ${LIB_NAME})
-SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
-  LINK_FLAGS "${MPI_LINK_FLAGS}") # Link MPI
-SET_TARGET_PROPERTIES(${MAIN_NAME} PROPERTIES
-  COMPILE_FLAGS "${MPI_COMPILE_FLAGS}") # Use MPI compile flags
+OPTION(DO_MFG "Do the manufactured solution run" OFF)
 
-# Lastly build the tests
-ENABLE_TESTING()
-ADD_SUBDIRECTORY(test)
+IF(DO_MFG)
+  # If we are doing the manufactured solution, tell
+  # the C++ processor so it can enable MFG solutions
+  MESSAGE(STATUS "Manufactured solution enabled")
+  ADD_DEFINITIONS(-DDO_MFG)
+ENDIF(DO_MFG)
 
+ADD_LIBRARY(${LIB_NAME} SHARED ${LIB_SRC})
+DEAL_II_SETUP_TARGET(${LIB_NAME})
+TARGET_LINK_LIBRARIES(${LIB_NAME} ${BRAID_LIBRARY})
 
+ADD_EXECUTABLE(parallel_in_time)
+TARGET_SOURCES(parallel_in_time PRIVATE src/parallel_in_time.cc)
+TARGET_LINK_LIBRARIES(parallel_in_time ${LIB_NAME})
+DEAL_II_SETUP_TARGET(parallel_in_time)
 
+#
+# setup tests
+#
+ENABLE_TESTING()
+ADD_SUBDIRECTORY(test)
index 27c696aade8fc82deaf949eb44669661627e005a..f414d8a043566eed292c7037a62dbce86808034a 100644 (file)
@@ -1,5 +1,5 @@
 INCLUDE_DIRECTORIES(${SRC_PATH})
-SET(TEST_LIBRARIES ${LIB_NAME} ${BRAID_LIBRARY})
+SET(TEST_LIBRARIES ${LIB_NAME})
 
 IF(DO_MFG)
   DEAL_II_PICKUP_TESTS()
index e1b73fca96bc27eee7eb78fdbbb6c7fad04bacd9..98d8d283dd74b6eaa20fc6d5dbcdc51b91528c0a 100644 (file)
@@ -4,6 +4,9 @@ Starting braid_TestInitAccess
    braid_TestInitAccess:   Starting Test 1
    braid_TestInitAccess:   u = init(t=2.00e-01)
    braid_TestInitAccess:   access(u) 
+Cycle 0:
+   Number of active cells:       12288
+   Number of degrees of freedom: 12545
 
 cycle cells dofs     L2        H1      Linfty   
     0 12288 12545 8.657e-01 7.696e+00 1.001e+00 
@@ -18,11 +21,17 @@ Starting braid_TestClone
    braid_TestClone:   u = init(t=2.00e-01)
    braid_TestClone:   v = clone(u)
    braid_TestClone:   access(u)
+Cycle 0:
+   Number of active cells:       12288
+   Number of degrees of freedom: 12545
 
 cycle cells dofs     L2        H1      Linfty   
     0 12288 12545 8.657e-01 7.696e+00 1.001e+00 
     0 12288 12545 8.657e-01 7.696e+00 1.001e+00 
    braid_TestClone:   access(v)
+Cycle 0:
+   Number of active cells:       12288
+   Number of degrees of freedom: 12545
 
 cycle cells dofs     L2        H1      Linfty   
     0 12288 12545 8.657e-01 7.696e+00 1.001e+00 
@@ -41,6 +50,9 @@ Starting braid_TestSum
    braid_TestSum:   v = clone(u)
    braid_TestSum:   v = u - v
    braid_TestSum:   access(v)
+Cycle 0:
+   Number of active cells:       12288
+   Number of degrees of freedom: 12545
 
 cycle cells dofs     L2        H1      Linfty   
     0 12288 12545 8.657e-01 7.696e+00 1.001e+00 
@@ -52,6 +64,9 @@ cycle cells dofs     L2        H1      Linfty
    braid_TestSum:   Starting Test 2
    braid_TestSum:   v = 2*u + v
    braid_TestSum:   access(v)
+Cycle 0:
+   Number of active cells:       12288
+   Number of degrees of freedom: 12545
 
 cycle cells dofs     L2        H1      Linfty   
     0 12288 12545 8.657e-01 7.696e+00 1.001e+00 
@@ -60,6 +75,9 @@ cycle cells dofs     L2        H1      Linfty
     0 12288 12545 3.225e-04 2.865e-03 3.723e-04 
     0 12288 12545 1.732e+00 1.539e+01 2.003e+00 
    braid_TestSum:   access(u)
+Cycle 0:
+   Number of active cells:       12288
+   Number of degrees of freedom: 12545
 
 cycle cells dofs     L2        H1      Linfty   
     0 12288 12545 8.657e-01 7.696e+00 1.001e+00 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.