Skip to content

Commit

Permalink
first push by sway
Browse files Browse the repository at this point in the history
  • Loading branch information
SwaySZ committed Mar 1, 2020
1 parent 6a0ac48 commit d21767f
Show file tree
Hide file tree
Showing 1,233 changed files with 430,156 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file added SudoDEM2D/.DS_Store
Binary file not shown.
440 changes: 440 additions & 0 deletions SudoDEM2D/CMakeLists.txt

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions SudoDEM2D/cMake/CombineSources.cmake
@@ -0,0 +1,32 @@
# include several source files (in SRCS) in one or more
# combined files; each combined file holds maximally
# MAXNUM files.
# BASE gives basename for created files;
# files corresponding to the pattern are deleted
# first, so that there are no relicts from previous runs
# with possibly different MAXNUM
MACRO(COMBINE_SOURCES BASE SRCS MAXNUM)
LIST(LENGTH SRCS SRCS_LENGTH)
SET(COMB_COUNTER 0)
FILE(GLOB EXISTING "${BASE}.*.cpp")
IF("$EXISTING")
FILE(REMOVE ${EXISTING})
ENDIF()
SET(OUT "${BASE}.${COMB_COUNTER}.cpp")
FILE(WRITE ${OUT})
SET(COUNTER 0)
FOREACH(SRC ${SRCS})
if(${SRC} MATCHES "^/.*$") # absolute filename
FILE(APPEND ${OUT} "#include<${SRC}>\n")
else()
FILE(APPEND ${OUT} "#include<${CMAKE_SOURCE_DIR}/${SRC}>\n")
endif()
MATH(EXPR COUNTER "${COUNTER}+1")
IF(${COUNTER} EQUAL ${MAXNUM})
SET(COUNTER 0)
MATH(EXPR COMB_COUNTER ${COMB_COUNTER}+1)
SET(OUT "${BASE}.${COMB_COUNTER}.cpp")
FILE(WRITE ${OUT})
ENDIF()
ENDFOREACH()
ENDMACRO()
31 changes: 31 additions & 0 deletions SudoDEM2D/cMake/FindCholmod.cmake
@@ -0,0 +1,31 @@
# - Try to find CHOLMOD
# This will define
#
# CHOLMOD_FOUND - system has CHOLMOD
# CHOLMOD_LIBRARIES - library to link against to use Cholmod
# CHOLMOD_INCLUDE_DIR - where to find cholmod.h, etc.
# AMD_LIBRARY - needed by CHOLMOD
# COLAMD_LIBRARY - needed by CHOLMOD
# CCOLAMD_LIBRARY - needed by CHOLMOD
# CAMD_LIBRARY - needed by CHOLMOD

FIND_LIBRARY(CHOLMOD_LIBRARIES NAMES cholmod libcholmod
PATHS
/usr/lib
/usr/local/lib
/usr/lib/CGAL
/usr/lib64
/usr/local/lib64
/usr/lib64/CGAL
)

FIND_LIBRARY(AMD_LIBRARY NAMES amd PATHS /usr/lib /usr/local/lib /usr/lib/CGAL /usr/lib64 /usr/local/lib64 /usr/lib64/CGAL)
FIND_LIBRARY(CAMD_LIBRARY NAMES camd PATHS /usr/lib /usr/local/lib /usr/lib/CGAL /usr/lib64 /usr/local/lib64 /usr/lib64/CGAL)
FIND_LIBRARY(COLAMD_LIBRARY NAMES colamd PATHS /usr/lib /usr/local/lib /usr/lib/CGAL /usr/lib64 /usr/local/lib64 /usr/lib64/CGAL)
FIND_LIBRARY(CCOLAMD_LIBRARY NAMES ccolamd PATHS /usr/lib /usr/local/lib /usr/lib/CGAL /usr/lib64 /usr/local/lib64 /usr/lib64/CGAL)

FIND_PATH(CHOLMOD_INCLUDE_DIR cholmod.h PATH /usr/include /usr/include/suitesparse)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cholmod DEFAULT_MSG CHOLMOD_LIBRARIES CHOLMOD_INCLUDE_DIR AMD_LIBRARY CAMD_LIBRARY COLAMD_LIBRARY CCOLAMD_LIBRARY)
MARK_AS_ADVANCED(CHOLMOD_LIBRARIES CHOLMOD_INCLUDE_DIR AMD_LIBRARY CAMD_LIBRARY COLAMD_LIBRARY CCOLAMD_LIBRARY)
16 changes: 16 additions & 0 deletions SudoDEM2D/cMake/FindMetis.cmake
@@ -0,0 +1,16 @@
# - Find Metis library
#
# This module defines
# METIS_INCLUDE_DIR, where to find loki/Typelist.h, etc.
# METIS_LIBRARY, libraries to link against to use GL2PS.
# METIS_FOUND, If false, do not try to use GL2PS.

FIND_PATH(METIS_INCLUDE_DIR metis.h PATHS /usr/include/metis)
FIND_LIBRARY(METIS_LIBRARY NAMES metis parmetis PATHS /usr/lib)

# handle the QUIETLY and REQUIRED arguments and set LOKI_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Metis DEFAULT_MSG METIS_INCLUDE_DIR METIS_LIBRARY)

MARK_AS_ADVANCED(METIS_INCLUDE_DIR METIS_LIBRARY)
93 changes: 93 additions & 0 deletions SudoDEM2D/cMake/FindNumPy.cmake
@@ -0,0 +1,93 @@
# https://github.com/ContinuumIO/dynd-python/blob/master/FindNumPy.cmake

# - Find the NumPy libraries
# This module finds if NumPy is installed, and sets the following variables
# indicating where it is.
#
# TODO: Update to provide the libraries and paths for linking npymath lib.
#
# NUMPY_FOUND - was NumPy found
# NUMPY_VERSION - the version of NumPy found as a string
# NUMPY_VERSION_MAJOR - the major version number of NumPy
# NUMPY_VERSION_MINOR - the minor version number of NumPy
# NUMPY_VERSION_PATCH - the patch version number of NumPy
# NUMPY_VERSION_DECIMAL - e.g. version 1.6.1 is 10601
# NUMPY_INCLUDE_DIRS - path to the NumPy include files

#============================================================================
# Copyright 2012 Continuum Analytics, Inc.
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
#============================================================================

# Finding NumPy involves calling the Python interpreter
if(NumPy_FIND_REQUIRED)
find_package(PythonInterp REQUIRED)
else()
find_package(PythonInterp)
endif()

if(NOT PYTHONINTERP_FOUND)
set(NUMPY_FOUND FALSE)
return()
endif()
set(DPDIR "${CMAKE_CURRENT_SOURCE_DIR}/../dem2dinstall/SudoDEM/lib/3rdlibs/py/")
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
"import sys;sys.path.insert(0,'${DPDIR}');import numpy as n; print(n.__version__); print(n.get_include());"
RESULT_VARIABLE _NUMPY_SEARCH_SUCCESS
OUTPUT_VARIABLE _NUMPY_VALUES
ERROR_VARIABLE _NUMPY_ERROR_VALUE
OUTPUT_STRIP_TRAILING_WHITESPACE)

if(NOT _NUMPY_SEARCH_SUCCESS MATCHES 0)
if(NumPy_FIND_REQUIRED)
message(FATAL_ERROR
"NumPy import failure:\n${_NUMPY_ERROR_VALUE}")
endif()
set(NUMPY_FOUND FALSE)
return()
endif()

# Convert the process output into a list
string(REGEX REPLACE ";" "\\\\;" _NUMPY_VALUES ${_NUMPY_VALUES})
string(REGEX REPLACE "\n" ";" _NUMPY_VALUES ${_NUMPY_VALUES})
list(GET _NUMPY_VALUES 0 NUMPY_VERSION)
list(GET _NUMPY_VALUES 1 NUMPY_INCLUDE_DIRS)

# Make sure all directory separators are '/'
string(REGEX REPLACE "\\\\" "/" NUMPY_INCLUDE_DIRS ${NUMPY_INCLUDE_DIRS})

# Get the major and minor version numbers
string(REGEX REPLACE "\\." ";" _NUMPY_VERSION_LIST ${NUMPY_VERSION})
list(GET _NUMPY_VERSION_LIST 0 NUMPY_VERSION_MAJOR)
list(GET _NUMPY_VERSION_LIST 1 NUMPY_VERSION_MINOR)
list(GET _NUMPY_VERSION_LIST 2 NUMPY_VERSION_PATCH)
string(REGEX MATCH "[0-9]*" NUMPY_VERSION_PATCH ${NUMPY_VERSION_PATCH})
math(EXPR NUMPY_VERSION_DECIMAL
"(${NUMPY_VERSION_MAJOR} * 10000) + (${NUMPY_VERSION_MINOR} * 100) + ${NUMPY_VERSION_PATCH}")

find_package_message(NUMPY
"Found NumPy: version \"${NUMPY_VERSION}\" ${NUMPY_INCLUDE_DIRS}"
"${NUMPY_INCLUDE_DIRS}${NUMPY_VERSION}")

set(NUMPY_FOUND TRUE)
23 changes: 23 additions & 0 deletions SudoDEM2D/cMake/FindPythonModule.cmake
@@ -0,0 +1,23 @@
# http://www.cmake.org/pipermail/cmake/2011-January/041666.html
#
# - Find Python Module

FUNCTION(find_python_module module)
STRING(TOUPPER ${module} module_upper)

IF(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")
SET(${module}_FIND_REQUIRED TRUE)
ENDIF(ARGC GREATER 1 AND ARGV1 STREQUAL "REQUIRED")

EXECUTE_PROCESS(COMMAND "${PYTHON_EXECUTABLE}" "-c"
"import re, ${module}; print re.compile('/__init__.py.*').sub('',${module}.__file__)"
RESULT_VARIABLE _${module}_status
OUTPUT_VARIABLE _${module}_location
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

IF(_${module}_status MATCHES 0)
SET(PY_${module} ${_${module}_location} CACHE STRING "Location of Python module ${module}")
ENDIF(_${module}_status MATCHES 0)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(${module} DEFAULT_MSG PY_${module})
ENDFUNCTION(find_python_module)

0 comments on commit d21767f

Please sign in to comment.