Commit 158afd5f authored by Jonathan Hu's avatar Jonathan Hu
Browse files

Xpetra: split CrsMatrixWrap

into decl/def files
Part of #4986

Moved cmake function XPETRA_PROCESS_ETI_TEMPLATE to its own file
because both xpetra/src and xpetra/sup use it.
parent 83e8dfb6
......@@ -919,6 +919,7 @@ IF (Stokhos_ENABLE_Sacado)
GLOBAL_SET(XPETRA_SC_LO_GO_NO_ETI_CLASSES )
IF (Xpetra_ENABLE_EXPLICIT_INSTANTIATION)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../../xpetra/src/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../../xpetra/sup/Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../../xpetra/src/Utils/ExplicitInstantiation/ETI_MULTIVECTOR_classes.cmake)
SET(XPETRA_ALL_ETI_CLASSES ${XPETRA_SC_LO_GO_NO_ETI_CLASSES} ${XPETRA_MULTIVECTOR_ETI_CLASSES})
ENDIF()
......
......@@ -16,48 +16,9 @@ TRIBITS_CONFIGURE_FILE(${PACKAGE_NAME}_config.hpp)
# src
#
############################################################################################
FUNCTION(XPETRA_PROCESS_ETI_TEMPLATE ETI_CLASSES TEMPLATE_FILE PROCESSED_FILE SOURCES_LIST)
SET(SRCS "")
FOREACH(CLASS ${ETI_CLASSES})
# find spearator of class name and (optional) conditions
string(FIND ${CLASS} "-" DASHPOS)
IF ('${DASHPOS}' STREQUAL '-1')
string(SUBSTRING ${CLASS} 0 ${DASHPOS} CLASS_NAME)
#MESSAGE("New class name = ${CLASS_NAME}")
set (CONDITION_NAME "")
set (CONDITION_NAME_END "")
ELSE()
string(SUBSTRING ${CLASS} 0 ${DASHPOS} CLASS_NAME)
#MESSAGE("New class name = ${CLASS_NAME}")
string(SUBSTRING ${CLASS} ${DASHPOS} -1 CONDITION_NAME)
string(REPLACE "[" "(" CONDITION_NAME ${CONDITION_NAME})
string(REPLACE "]" ")" CONDITION_NAME ${CONDITION_NAME})
string(REPLACE "." " " CONDITION_NAME ${CONDITION_NAME})
string(REPLACE "-" "" CONDITION_NAME ${CONDITION_NAME})
string(REPLACE "?" "#" CONDITION_NAME ${CONDITION_NAME})
string(STRIP CONDITION_NAME ${CONDITION_NAME})
#MESSAGE("New condition name = ${CONDITION_NAME}")
set (CONDITION_NAME_END "#endif")
ENDIF()
string(REPLACE "::" "_" CLASS_FILE_NAME "${CLASS_NAME}")
string(TOUPPER "${CLASS_FILE_NAME}" UPPER_CASE_CLASS)
string(REPLACE "CLASS_FILE_NAME" "${CLASS_FILE_NAME}" FINAL_FILE_NAME "${PROCESSED_FILE}")
# the following generates one cpp file for all instantiations and
# enabled configurations
CONFIGURE_FILE(${TEMPLATE_FILE} ${FINAL_FILE_NAME})
#MESSAGE("Configure file ${FINAL_FILE_NAME} using template ${TEMPLATE_FILE}")
SET(SRCS ${SRCS} ${FINAL_FILE_NAME})
ENDFOREACH()
SET(${SOURCES_LIST} ${SRCS} PARENT_SCOPE)
ENDFUNCTION(XPETRA_PROCESS_ETI_TEMPLATE)
##
## XPETRA_ETI_CPP_SOURCES collects all filenames of the Xpetra ETI *.cpp files
## These are later added to the gloabl list of source files (SOURCES)
## These are later added to the global list of source files (SOURCES)
##
SET(SOURCES "")
SET(XPETRA_ETI_CPP_SOURCES "")
......@@ -71,11 +32,14 @@ IF(${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION)
## *.cpp files have to be generated for.
##
# include the function XPETRA_PROCESS_ETI_TEMPLATE
include(Utils/ExplicitInstantiation/xpetra-process-eti-template.cmake)
GLOBAL_SET(XPETRA_LO_GO_NO_ETI_CLASSES )
INCLUDE(Utils/ExplicitInstantiation/ETI_LO_GO_NO_classes.cmake)
XPETRA_PROCESS_ETI_TEMPLATE(
"${XPETRA_LO_GO_NO_ETI_CLASSES}"
Utils/ExplicitInstantiation/Xpetra_ETI_LO_GO_NO.tmpl
${Trilinos_SOURCE_DIR}/packages/xpetra/src/Utils/ExplicitInstantiation/Xpetra_ETI_LO_GO_NO.tmpl
"Utils/ExplicitInstantiation/CLASS_FILE_NAME.cpp"
Xpetra_ETI_LO_GO_NO_SRC)
LIST(APPEND XPETRA_ETI_CPP_SOURCES ${Xpetra_ETI_LO_GO_NO_SRC})
......@@ -85,7 +49,7 @@ IF(${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION)
INCLUDE(Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake)
XPETRA_PROCESS_ETI_TEMPLATE(
"${XPETRA_SC_LO_GO_NO_ETI_CLASSES}"
Utils/ExplicitInstantiation/Xpetra_ETI_SC_LO_GO_NO.tmpl
${Trilinos_SOURCE_DIR}/packages/xpetra/src/Utils/ExplicitInstantiation/Xpetra_ETI_SC_LO_GO_NO.tmpl
"Utils/ExplicitInstantiation/CLASS_FILE_NAME.cpp"
Xpetra_ETI_SC_LO_GO_NO_SRC)
LIST(APPEND XPETRA_ETI_CPP_SOURCES ${Xpetra_ETI_SC_LO_GO_NO_SRC})
......@@ -95,7 +59,7 @@ IF(${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION)
INCLUDE(Utils/ExplicitInstantiation/ETI_MULTIVECTOR_classes.cmake)
XPETRA_PROCESS_ETI_TEMPLATE(
"${XPETRA_MULTIVECTOR_ETI_CLASSES}"
Utils/ExplicitInstantiation/Xpetra_ETI_MULTIVECTOR.tmpl
${Trilinos_SOURCE_DIR}/packages/xpetra/src/Utils/ExplicitInstantiation/Xpetra_ETI_MULTIVECTOR.tmpl
"Utils/ExplicitInstantiation/CLASS_FILE_NAME.cpp"
Xpetra_ETI_MULTIVECTOR_SRC)
LIST(APPEND XPETRA_ETI_CPP_SOURCES ${Xpetra_ETI_MULTIVECTOR_SRC})
......@@ -136,6 +100,7 @@ IF (${PACKAGE_NAME}_ENABLE_Epetra)
)
ENDIF()
# Create the .hpp file in BUILD/packages/xpetra/src
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${CMAKE_CURRENT_SOURCE_DIR}/CrsMatrix NOSIERRABJAM)
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${CMAKE_CURRENT_SOURCE_DIR}/MultiVector NOSIERRABJAM)
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${CMAKE_CURRENT_SOURCE_DIR}/Vector NOSIERRABJAM)
......
FUNCTION(XPETRA_PROCESS_ETI_TEMPLATE ETI_CLASSES TEMPLATE_FILE PROCESSED_FILE SOURCES_LIST)
SET(SRCS "")
FOREACH(CLASS ${ETI_CLASSES})
# find seperator of class name and (optional) conditions
string(FIND ${CLASS} "-" DASHPOS)
IF ('${DASHPOS}' STREQUAL '-1')
string(SUBSTRING ${CLASS} 0 ${DASHPOS} CLASS_NAME)
#MESSAGE("New class name = ${CLASS_NAME}")
set (CONDITION_NAME "")
set (CONDITION_NAME_END "")
ELSE()
string(SUBSTRING ${CLASS} 0 ${DASHPOS} CLASS_NAME)
#MESSAGE("New class name = ${CLASS_NAME}")
string(SUBSTRING ${CLASS} ${DASHPOS} -1 CONDITION_NAME)
string(REPLACE "[" "(" CONDITION_NAME ${CONDITION_NAME})
string(REPLACE "]" ")" CONDITION_NAME ${CONDITION_NAME})
string(REPLACE "." " " CONDITION_NAME ${CONDITION_NAME})
string(REPLACE "-" "" CONDITION_NAME ${CONDITION_NAME})
string(REPLACE "?" "#" CONDITION_NAME ${CONDITION_NAME})
string(STRIP CONDITION_NAME ${CONDITION_NAME})
#MESSAGE("New condition name = ${CONDITION_NAME}")
set (CONDITION_NAME_END "#endif")
ENDIF()
string(REPLACE "::" "_" CLASS_FILE_NAME "${CLASS_NAME}")
string(TOUPPER "${CLASS_FILE_NAME}" UPPER_CASE_CLASS)
string(REPLACE "CLASS_FILE_NAME" "${CLASS_FILE_NAME}" FINAL_FILE_NAME "${PROCESSED_FILE}")
# the following generates one cpp file for all instantiations and
# enabled configurations
CONFIGURE_FILE(${TEMPLATE_FILE} ${FINAL_FILE_NAME})
#MESSAGE("Configure file ${FINAL_FILE_NAME} using template ${TEMPLATE_FILE}")
SET(SRCS ${SRCS} ${FINAL_FILE_NAME})
ENDFOREACH()
SET(${SOURCES_LIST} ${SRCS} PARENT_SCOPE)
ENDFUNCTION(XPETRA_PROCESS_ETI_TEMPLATE)
......@@ -12,11 +12,56 @@ TRIBITS_CONFIGURE_FILE(${PACKAGE_NAME}_config.hpp)
# SRC
#
##
## XPETRA_ETI_CPP_SOURCES collects all filenames of the Xpetra ETI *.cpp files
## These are later added to the global list of source files (SOURCES)
##
SET(SOURCES "")
SET(XPETRA_ETI_CPP_SOURCES "")
##
## only build ETI *.cpp files if ETI is enabled.
##
IF(${PACKAGE_NAME}_ENABLE_EXPLICIT_INSTANTIATION)
##
## XPETRA_SC_LO_GO_NO_ETI_CLASSES is a list of all class names which ETI
## *.cpp files have to be generated for.
##
GLOBAL_SET(XPETRA_SC_LO_GO_NO_ETI_CLASSES )
# include the list of all Xpetra classes that should be ETI'd
INCLUDE(Utils/ExplicitInstantiation/ETI_SC_LO_GO_NO_classes.cmake)
# include the function XPETRA_PROCESS_ETI_TEMPLATE
include(${CMAKE_CURRENT_SOURCE_DIR}/../src/Utils/ExplicitInstantiation/xpetra-process-eti-template.cmake)
# generate the cpp files and record the file names
XPETRA_PROCESS_ETI_TEMPLATE(
"${XPETRA_SC_LO_GO_NO_ETI_CLASSES}"
${Trilinos_SOURCE_DIR}/packages/xpetra/src/Utils/ExplicitInstantiation/Xpetra_ETI_SC_LO_GO_NO.tmpl
"Utils/ExplicitInstantiation/CLASS_FILE_NAME.cpp"
Xpetra_ETI_SC_LO_GO_NO_SRC)
LIST(APPEND XPETRA_ETI_CPP_SOURCES ${Xpetra_ETI_SC_LO_GO_NO_SRC})
# At this point, XPETRA_ETI_CPP_SOURCES contains the Xpetra classes
# that will be ETI'd.
APPEND_GLOB(SOURCES ${XPETRA_ETI_CPP_SOURCES})
SET(SOURCES ${XPETRA_ETI_CPP_SOURCES})
# grab any hand rolled ETI source files
APPEND_GLOB(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Utils/ExplicitInstantiation/*.cpp)
ENDIF() # if XPETRA_ENABLE_EXPLICIT_INSTANTIATION
SET(HEADERS "")
APPEND_GLOB(HEADERS */*.hpp)
APPEND_GLOB(HEADERS */*.cpp)
APPEND_GLOB(SOURCES */*.cpp)
# FIXME JHU is this still needed?
APPEND_GLOB(SOURCES mac.cpp) # Avoid empty library (MacOs 'ar' utility doesn't work on empty library).
SET(SOURCE mac.cpp) # Avoid empty library (MacOs 'ar' utility doesn't work on empty library).
# Create the .hpp file in BUILD/packages/xpetra/sup
TRILINOS_CREATE_CLIENT_TEMPLATE_HEADERS(${CMAKE_CURRENT_SOURCE_DIR}/Matrix NOSIERRABJAM)
#
#
......
This diff is collapsed.
APPEND_SET(XPETRA_SC_LO_GO_NO_ETI_CLASSES Xpetra::CrsMatrixWrap )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment