diff --git a/SConstruct b/SConstruct
index a0dc6b9..038586a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,473 +1,474 @@
# -*- mode:python; coding: utf-8 -*-
# vim: set ft=python:
# @file
# LICENSE
#
# Copyright (©) 2016-2021 EPFL (École Polytechnique Fédérale de Lausanne),
# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
# ------------------------------------------------------------------------------
# Imports
# ------------------------------------------------------------------------------
from __future__ import print_function
import sys
import os
from subprocess import check_output
# Import below not strictly necessary, but good for pep8
from SCons.Script import (
EnsurePythonVersion,
EnsureSConsVersion,
Help,
Environment,
Variables,
EnumVariable,
PathVariable,
BoolVariable,
ListVariable,
Split,
Export,
Dir,
)
from SCons.Errors import StopError
from SCons import __version__ as scons_version
from version import get_git_subst
from detect import (
FindFFTW,
FindBoost,
FindThrust,
FindCuda,
FindExpolit,
FindPybind11
)
from INFOS import TAMAAS_INFOS
# ------------------------------------------------------------------------------
EnsurePythonVersion(2, 7)
EnsureSConsVersion(2, 4)
# ------------------------------------------------------------------------------
def detect_dependencies(env):
"Detect all dependencies"
fftw_comp = {
'omp': ['omp'],
'threads': ['threads'],
'none': [],
}
fftw_components = fftw_comp[env['fftw_threads']]
if main_env['use_mpi']:
fftw_components.append('mpi')
FindFFTW(env, fftw_components, precision=env['real_type'])
FindBoost(env, ['boost/preprocessor/seq.hpp'])
FindExpolit(env)
thrust_var = 'THRUST_ROOT'
# Take cuda version of thrust if available
if 'CUDA_ROOT' in env['ENV']:
thrust_var = 'CUDA_ROOT'
FindThrust(env, env['backend'], thrust_var)
# Activate cuda if needed
if env['backend'] == 'cuda':
FindCuda(env)
if env['build_python']:
FindPybind11(env)
def subdir(env, dir):
"Building a sub-directory"
return env.SConscript(env.File('SConscript', dir),
variant_dir=env.Dir(dir, env['build_dir']),
duplicate=True)
# ------------------------------------------------------------------------------
# Main compilation
# ------------------------------------------------------------------------------
# Compilation colors
colors = {
'cyan': '\033[96m',
'purple': '\033[95m',
'blue': '\033[94m',
'green': '\033[92m',
'yellow': '\033[93m',
'gray': '\033[38;5;8m',
'orange': '\033[38;5;208m',
'red': '\033[91m',
'end': '\033[0m'
}
# Inherit all environment variables (for CXX detection, etc.)
main_env = Environment(
ENV=os.environ,
)
# Set tamaas information
for k, v in TAMAAS_INFOS.items():
main_env[k] = v
main_env['COLOR_DICT'] = colors
main_env.AddMethod(subdir, 'SubDirectory')
# Build variables
vars = Variables('build-setup.conf')
vars.AddVariables(
EnumVariable('build_type', 'Build type', 'release',
allowed_values=('release', 'profiling', 'debug'),
ignorecase=2),
EnumVariable('backend', 'Thrust backend', 'omp',
allowed_values=('cpp', 'omp', 'tbb'),
ignorecase=2),
EnumVariable('fftw_threads', 'Threads FFTW library preference', 'omp',
allowed_values=('omp', 'threads', 'none'),
ignorecase=2),
EnumVariable('sanitizer', 'Sanitizer type', 'none',
allowed_values=('none', 'memory', 'leaks', 'address'),
ignorecase=2),
PathVariable('prefix',
'Prefix where to install', '/usr/local'),
# Dependencies paths
PathVariable('FFTW_ROOT',
'FFTW custom path', os.getenv('FFTW_ROOT', ''),
PathVariable.PathAccept),
PathVariable('THRUST_ROOT',
'Thrust custom path', os.getenv('THRUST_ROOT', ''),
PathVariable.PathAccept),
PathVariable('BOOST_ROOT',
'Boost custom path', os.getenv('BOOST_ROOT', ''),
PathVariable.PathAccept),
PathVariable('CUDA_ROOT',
'Cuda custom path', os.getenv('CUDA_ROOT', ''),
PathVariable.PathAccept),
# Dependencies provided as submodule get different default
PathVariable('GTEST_ROOT',
'Googletest custom path',
os.getenv('GTEST_ROOT', '#third-party/googletest/googletest'),
PathVariable.PathAccept),
PathVariable('PYBIND11_ROOT',
'Pybind11 custom path',
os.getenv('PYBIND11_ROOT', '#third-party/pybind11/include'),
PathVariable.PathAccept),
PathVariable('EXPOLIT_ROOT',
'Expolit custom path',
os.getenv('EXPOLIT_ROOT', '#third-party/expolit/include'),
PathVariable.PathAccept),
# Executables
('CXX', 'Compiler', os.getenv('CXX', 'g++')),
('MPICXX', 'MPI Compiler wrapper', os.getenv('MPICXX', 'mpicxx')),
('py_exec', 'Python executable', 'python3'),
# Compiler flags
('CXXFLAGS', 'C++ compiler flags', os.getenv('CXXFLAGS', "")),
# Cosmetic
BoolVariable('verbose', 'Activate verbosity', False),
BoolVariable('color', 'Color the non-verbose compilation output', False),
# Tamaas components
BoolVariable('build_doc', 'Build documentation', False),
BoolVariable('build_tests', 'Build test suite', False),
BoolVariable('build_python', 'Build python wrapper', True),
# Documentation
ListVariable('doc_builders', 'Generated documentation formats',
default='html', names=Split("html man")), # TODO include latex
# Dependencies
BoolVariable('use_googletest', 'Build tests using GTest', False),
BoolVariable('use_mpi', 'Builds multi-process parallelism', False),
# Distribution options
BoolVariable('strip_info', 'Strip binary of added information', False),
BoolVariable('build_static_lib', "Build a static libTamaas", False),
# Type variables
EnumVariable('real_type', 'Type for real precision variables', 'double',
allowed_values=('double', 'long double')),
EnumVariable('integer_type', 'Type for integer variables', 'int',
allowed_values=('int', 'long')),
)
# Set variables of environment
vars.Update(main_env)
help_text = vars.GenerateHelpText(main_env)
help_text += """
Commands:
scons [build] [options]... Compile Tamaas (and additional modules/tests)
scons install [prefix=/your/prefix] [options]... Install Tamaas to prefix
scons dev Install symlink to Tamaas python module (useful to development purposes)
scons test Run tests with pytest
scons doc Compile documentation with Doxygen and Sphinx+Breathe
scons archive Create a gzipped archive from source
""" # noqa
Help(help_text)
# Save all options, not just those that differ from default
with open('build-setup.conf', 'w') as setup:
for option in vars.options:
setup.write("# " + option.help.replace('\n', '\n# ') + "\n")
setup.write("{} = '{}'\n".format(option.key, main_env[option.key]))
main_env['should_configure'] = \
not main_env.GetOption('clean') and not main_env.GetOption('help')
build_type = main_env['build_type']
build_dir = 'build-${build_type}'
main_env['build_dir'] = main_env.Dir(build_dir)
+
+# Setting up the python name with version
+if main_env['build_python']:
+ args = (main_env.subst("${py_exec} -c").split()
+ + ["from distutils.sysconfig import get_python_version;"
+ "print(get_python_version())"])
+ main_env['py_version'] = bytes(check_output(args)).decode()
+
# Printing some build infos
if main_env['should_configure']:
print('-- SCons {} (Python {}.{})'.format(scons_version,
sys.version_info.major,
sys.version_info.minor))
print(main_env.subst("-- Build type: ${build_type}\n"
"-- Thrust backend: ${backend}\n"
"-- FFTW threads: ${fftw_threads}\n"
"-- MPI: ${use_mpi}\n"
- "-- Build directory: ${build_dir}"))
-
-# Setting up the python name with version
-if main_env['build_python']:
- args = (main_env.subst("${py_exec} -c").split()
- + ["from distutils.sysconfig import get_python_version;"
- "print(get_python_version())"])
- main_env['py_version'] = bytes(check_output(args)).decode()
- print(main_env.subst('-- Python version (bindings): $py_version'))
+ "-- Build directory: ${build_dir}\n"
+ "-- Python version (bindings): $py_version"))
verbose = main_env['verbose']
# Remove colors if not set
if not main_env['color']:
for key in colors:
colors[key] = ''
if not verbose:
main_env['CXXCOMSTR'] = main_env['SHCXXCOMSTR'] = \
u'{0}[Compiling ($SHCXX)] {1}$SOURCE'.format(colors['green'],
colors['end'])
main_env['LINKCOMSTR'] = main_env['SHLINKCOMSTR'] = \
u'{0}[Linking] {1}$TARGET'.format(colors['purple'],
colors['end'])
main_env['ARCOMSTR'] = u'{}[Ar]{} $TARGET'.format(colors['purple'],
colors['end'])
main_env['RANLIBCOMSTR'] = \
u'{}[Randlib]{} $TARGET'.format(colors['purple'],
colors['end'])
main_env['PRINT_CMD_LINE_FUNC'] = pretty_cmd_print
# Include paths
main_env.AppendUnique(CPPPATH=['#/src',
'#/src/core',
'#/src/mpi',
'#/src/bem',
'#/src/surface',
'#/src/python',
'#/src/percolation',
'#/src/model',
'#/src/model/elasto_plastic',
'#/src/solvers',
'#/src/gpu',
'#/python'])
# Changing the shared object extension
main_env['SHOBJSUFFIX'] = '.o'
# Back to gcc if cuda is activated
if main_env['backend'] == "cuda" and "g++" not in main_env['CXX']:
raise StopError('GCC should be used when compiling with CUDA')
# OpenMP flags - compiler dependent
omp_flags = {
"g++": ["-fopenmp"],
"clang++": ["-fopenmp"],
"icpc": ["-qopenmp"]
}
def cxx_alias(cxx):
for k in omp_flags.keys():
if k in cxx:
return k
raise StopError('Unsupported compiler: ' + cxx)
cxx = cxx_alias(main_env['CXX'])
# Setting main compilation flags
main_env['CXXFLAGS'] = Split(main_env['CXXFLAGS'])
main_env['LINKFLAGS'] = main_env['CXXFLAGS']
main_env.AppendUnique(
CXXFLAGS=Split('-std=c++14 -Wall -Wextra -pedantic'),
CPPDEFINES={
'TAMAAS_LOOP_BACKEND': 'TAMAAS_LOOP_BACKEND_${backend.upper()}',
'TAMAAS_FFTW_BACKEND': 'TAMAAS_FFTW_BACKEND_${fftw_threads.upper()}'
},
)
# Adding OpenMP flags
if main_env['backend'] == 'omp':
main_env.AppendUnique(CXXFLAGS=omp_flags[cxx])
main_env.AppendUnique(LINKFLAGS=omp_flags[cxx])
else:
main_env.AppendUnique(CXXFLAGS=['-Wno-unknown-pragmas'])
# Correct bug in clang?
if main_env['backend'] == 'omp' and cxx == "clang++":
main_env.AppendUnique(LIBS=["atomic"])
elif main_env['backend'] == 'tbb':
main_env.AppendUnique(LIBS=['tbb'])
# Manage MPI compiler
if main_env['use_mpi']:
main_env['CXX'] = '$MPICXX'
main_env.AppendUnique(CPPDEFINES=['TAMAAS_USE_MPI'])
main_env.AppendUnique(CXXFLAGS=['-Wno-cast-function-type'])
# Flags and options
if main_env['build_type'] == 'debug':
main_env.AppendUnique(CPPDEFINES=['TAMAAS_DEBUG'])
# Define the scalar types
main_env.AppendUnique(CPPDEFINES={'TAMAAS_REAL_TYPE': '${real_type}',
'TAMAAS_INT_TYPE': '${integer_type}'})
# Compilation flags
cxxflags_dict = {
"debug": Split("-g -O0"),
"profiling": Split("-g -O3 -fno-omit-frame-pointer"),
"release": Split("-O3")
}
if main_env['sanitizer'] != 'none':
if main_env['backend'] == 'cuda':
raise StopError(
"Sanitizers with cuda are not yet supported!")
cxxflags_dict[build_type].append('-fsanitize=${sanitizer}')
main_env.AppendUnique(CXXFLAGS=cxxflags_dict[build_type])
main_env.AppendUnique(SHLINKFLAGS=cxxflags_dict[build_type])
main_env.AppendUnique(LINKFLAGS=cxxflags_dict[build_type])
if main_env['should_configure']:
basic_checks(main_env)
detect_dependencies(main_env)
# Writing information file
main_env.Tool('textfile')
main_env['SUBST_DICT'] = get_git_subst()
# Empty values if requested
if main_env['strip_info']:
for k in main_env['SUBST_DICT']:
main_env['SUBST_DICT'][k] = ""
# Substitution of environment file
main_env['SUBST_DICT'].update({
'@build_type@': '$build_type',
'@build_dir@': '${build_dir.abspath}',
'@build_version@': '$version',
})
# Environment file content
env_content = """export PYTHONPATH=@build_dir@/python:$$PYTHONPATH
export LD_LIBRARY_PATH=@build_dir@/src:$$LD_LIBRARY_PATH
"""
# Writing environment file
env_file = main_env.Textfile(
main_env.File('tamaas_environment.sh', main_env['build_dir']),
env_content)
# Default targets
build_targets = ['build-cpp', env_file]
install_targets = ['install-lib']
if main_env._get_major_minor_revision(scons_version)[0] >= 4:
main_env.Tool('compilation_db')
main_env.CompilationDatabase(PRINT_CMD_LINE_FUNC=pretty_cmd_print)
# Building Tamaas library
Export('main_env')
main_env.SubDirectory('src')
# Building Tamaas extra components
for dir in ['python', 'tests']:
if main_env['build_{}'.format(dir)] and not main_env.GetOption('help'):
main_env.SubDirectory(dir)
build_targets.append('build-{}'.format(dir))
# Building API + Sphinx documentation if requested
if main_env['build_doc']:
main_env.SubDirectory('doc')
main_env.Alias('doc', 'build-doc')
install_targets.append('install-doc')
else:
dummy_command(main_env, 'doc', 'Command "doc" does not do anything'
' without documentation activated ("build_doc=True")')
# Define dummy dev command when python is deactivated
if not main_env['build_python']:
dummy_command(main_env, 'dev', 'Command "dev" does not do anything'
+ ' without python activated ("build_python=True")')
else:
install_targets.append('install-python')
# Define dummy test command when tests are deactivated
if not main_env['build_tests']:
dummy_command(main_env, 'test', 'Command "test" does not do anything'
+ ' without tests activated ("build_tests=True")')
# Definition of target aliases, a.k.a. sub-commands
main_env.Alias('build', build_targets)
# Define proper install targets
main_env.Alias('install', install_targets)
# Default target is to build stuff
main_env.Default('build')
# Building a tar archive
archive = main_env.Command(
'tamaas-${version}.tar.gz',
'',
('tar --exclude-vcs --exclude-vcs-ignores '
'--exclude=third-party/googletest '
'--exclude=third-party/pybind11 '
'--exclude=joss '
'--exclude=".*" '
'-czf $TARGET {}'.format(Dir('.').name)),
chdir='..',
)
main_env.Alias('archive', archive)
diff --git a/doc/SConscript b/doc/SConscript
index c8b3aec..5add850 100644
--- a/doc/SConscript
+++ b/doc/SConscript
@@ -1,94 +1,96 @@
# -*- mode:python; coding: utf-8 -*-
# vim: set ft=python:
# @file
# LICENSE
#
# Copyright (©) 2016-2021 EPFL (École Polytechnique Fédérale de Lausanne),
# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
from __future__ import print_function
from SCons.Script import Import, Glob, Dir, File
def add_sources(source_list, dirname, fnames):
source_list += Dir(dirname).glob('*.hh')
source_list += Dir(dirname).glob('*.cpp')
Import('main_env')
Import('libTamaas')
doc_env = main_env.Clone()
+doc_env['man_section'] = 7
# Generating Doxyfile
doxygen_verbose = {True: "NO", False: "YES"}
doxyfile_target = doc_env.Substfile('doxygen/Doxyfile', 'doxygen/Doxyfile.in',
SUBST_DICT={
'@version@': '$version',
'@build_dir@': Dir('doxygen').path,
'@logo@': File('icon.svg').path,
'@src_dir@': Dir('#src').abspath,
'@verbose@':
doxygen_verbose[doc_env["verbose"]],
})
# Generate Doxygen API documentation
doc_env.Tool('doxygen')
doxygen_target = doc_env.Doxygen('doxygen/xml/index.xml',
[doxyfile_target, 'icon.svg'])
# Adding all source files as dependencies
sources = []
Dir('#src').walk(add_sources, sources)
doc_env.Depends(doxygen_target, sources)
# Generate Sphinx User documentation
sphinx_targets_map = {
"html": "sphinx/html/index.html",
- "man": "sphinx/tamaas.1",
+ "man": "sphinx/tamaas.${man_section}",
"latex": "sphinx/latex/Tamaas.tex"
}
doc_env.Tool('sphinx')
doc_env['IMPLICIT_COMMAND_DEPENDENCIES'] = 0
sphinx_sources = [Glob('sphinx/source/*'), Glob('sphinx/source/figures/*')]
sphinx_targets = {
builder: doc_env.Sphinx(sphinx_targets_map[builder], sphinx_sources)
for builder in doc_env['doc_builders']
}
doc_env.Depends(sphinx_targets.values(), doxygen_target)
# Alias for both docs
doc_targets = [doxygen_target] + sphinx_targets.values()
main_env.Alias('build-doc', doc_targets)
# Install target for documentation
share = Dir('share', doc_env['prefix'])
doc_install = []
sphinx_prefix_map = {}
if "html" in doc_env['doc_builders']:
doc_install.append(doc_env.Install(target=share.Dir('doc').Dir('tamaas'),
source=sphinx_targets['html'][0].dir))
if "man" in doc_env['doc_builders']:
- doc_install.append(doc_env.Install(target=share.Dir('man').Dir('man1'),
- source=sphinx_targets['man']))
+ doc_install.append(doc_env.Install(
+ target=share.Dir('man') .Dir(doc_env.subst('man${man_section}')),
+ source=sphinx_targets['man']))
main_env.Alias('install-doc', doc_install)
diff --git a/doc/sphinx/source/conf.py b/doc/sphinx/source/conf.py
index df5fbc7..89713fa 100644
--- a/doc/sphinx/source/conf.py
+++ b/doc/sphinx/source/conf.py
@@ -1,243 +1,243 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import subprocess
import warnings
warnings.filterwarnings("ignore")
# -- Project information -----------------------------------------------------
project = 'Tamaas'
copyright = "2019-2021, EPFL (École Polytechnique Fédérale de Lausanne)," \
+ " Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)"
author = 'Lucas Frérot'
# Looking for SConstruct file
def find_root(limit):
path = '..'
for i in range(limit):
dir_entries = os.listdir(path)
if 'INFOS.py' in dir_entries:
return path
else:
path = os.path.join('..', path)
raise RuntimeError('Could not find INFOS.py '
'in the {} parent directories'.format(limit))
root = find_root(4)
sys.path.insert(0, os.path.abspath(root))
from INFOS import TAMAAS_INFOS # noqa
# The short X.Y version
version = '.'.join(TAMAAS_INFOS['version'].split('.')[:2])
# The full version, including alpha/beta/rc tags
release = TAMAAS_INFOS['version']
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
'sphinx.ext.imgconverter',
'breathe',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['.templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
html_logo = '../../icon.svg'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'Tamaasdoc'
# -- Options for LaTeX output ------------------------------------------------
latex_engine = 'lualatex'
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Tamaas.tex', 'Tamaas Documentation',
author, 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'tamaas', 'a library for fast periodic rough contact',
- [author], 1)
+ [author], 7)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'Tamaas', 'Tamaas Documentation',
author, 'Tamaas', 'One line description of project.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
# If on RTD build, run doxygen
on_read_the_docs = os.environ.get('READTHEDOCS') == 'True'
if on_read_the_docs:
SUBST_DICT = {
'@version@': TAMAAS_INFOS['version'],
'@build_dir@': 'doxygen',
'@logo@': 'icon.svg',
'@src_dir@': '../src/',
'@verbose@': "YES",
}
current_dir = os.getcwd()
os.chdir('../..')
with open('doxygen/Doxyfile.in', 'r') as doxyfile:
contents = doxyfile.read()
for k, v in SUBST_DICT.items():
contents = contents.replace(k, v)
with open('doxygen/Doxyfile', 'w') as doxyfile:
doxyfile.write(contents)
subprocess.call('doxygen doxygen/Doxyfile', shell=True)
os.chdir(current_dir)
breathe_projects = {
'tamaas': '../../doxygen/xml'
}
breathe_default_project = 'tamaas'
intersphinx_mapping = {
'numpy': ('https://numpy.org/doc/stable/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
}
diff --git a/python/setup.py.in b/python/setup.py.in
index 2c4ab58..a8c25dd 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -1,111 +1,112 @@
# -*- mode:python; coding: utf-8 -*-
import setuptools
import shutil
import sysconfig
import os
long_description = """
# Tamaas - A high-performance library for periodic rough surface contact
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3479236.svg)](https://doi.org/10.5281/zenodo.3479236)
[![status](https://joss.theoj.org/papers/86903c51f3c66964eef7776d8aeaf17d/status.svg)](https://joss.theoj.org/papers/86903c51f3c66964eef7776d8aeaf17d)
[![Documentation Status](https://readthedocs.org/projects/tamaas/badge/?version=latest)](https://tamaas.readthedocs.io/en/latest/?badge=latest)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fc4science.ch%2Fsource%2Ftamaas_tutorials.git/HEAD?filepath=elastic_contact.ipynb)
-Tamaas (from تماس meaning “contact” in Arabic and Farsi) is a
-high-performance rough-surface periodic contact code based on boundary and
-volume integral equations. The clever mathematical formulation of the underlying
-numerical methods allows the use of the fast-Fourier Transform, a great help in
-achieving peak performance: Tamaas is consistently two orders of magnitude
-faster (and lighter) than traditional FEM! Tamaas is aimed at researchers and
-practitioners wishing to compute realistic contact solutions for the study of
-interface phenomena.
+Tamaas (from تماس meaning “contact” in Arabic and Farsi) is a high-performance
+rough-surface periodic contact code based on boundary and volume integral
+equations. The clever mathematical formulation of the underlying numerical
+methods allows the use of the fast-Fourier Transform, a great help in achieving
+peak performance: Tamaas is consistently two orders of magnitude faster (and
+lighter) than traditional FEM! Tamaas is aimed at researchers and practitioners
+wishing to compute realistic contact solutions for the study of interface
+phenomena.
## Disclaimer
This package is intended for ease of installation for Linux platforms, but comes
with NO WARRANTY of compatibility (although it is manylinux2010_x86_64
compliant). If you experience any issue, please install Tamaas from
[source](https://c4science.ch/source/tamaas/). We provide a Docker image for
-non-Linux systems. Note that to satisfy the manylinux2010 requirements, the
-version of Tamaas provided by this package is not parallel.
+non-Linux systems. Note that the version of Tamaas provided by this package is
+not parallel.
This version of Tamaas is statically linked to [FFTW3](http://fftw.org/)
developed by Matteo Frigo and Steven G. Johnson, released under the terms of the
GPL public license ([source code](https://github.com/FFTW/fftw3)).
Tamaas is the result of a science research project. To give proper credit to
Tamaas and the researchers who have developed the numerical methods that it
implements, please cite the [JOSS
paper](https://joss.theoj.org/papers/86903c51f3c66964eef7776d8aeaf17d) and the
appropriate references therein.
## Dependencies
Essentials:
- Numpy
Optional:
- Scipy (for non-linear solvers)
- UVW (for dumpers)
- h5py (for dumpers)
- netCDF4 (for dumpers)
-To install with all dependencies, run ``pip install
-tamaas[solvers,dumpers]``.
+To install with all dependencies, run ``pip install tamaas[all]``.
## Documentation
-Documentation can be found on [tamaas.readthedocs.io](https://tamaas.readthedocs.io/en/latest/).
+Documentation can be found on
+[tamaas.readthedocs.io](https://tamaas.readthedocs.io/en/latest/).
## Changelog
-The changelog can be consulted [here](https://c4science.ch/source/tamaas/browse/master/CHANGELOG.md?as=remarkup).
+The changelog can be consulted
+[here](https://c4science.ch/source/tamaas/browse/master/CHANGELOG.md?as=remarkup).
"""
try:
shutil.copyfile('../../README.md', 'README.md')
except FileNotFoundError:
pass
setuptools.setup(
name="tamaas",
version="@version@",
packages=setuptools.find_packages(),
include_package_data=True,
author=', '.join(@authors@),
author_email="@email@",
description='A high-performance library for periodic rough surface contact',
long_description=long_description,
long_description_content_type="text/markdown",
url="https://c4science.ch/tag/tamaas/",
project_urls={
"Bug Tracker": "https://c4science.ch/maniphest/query/1jDBkIDDxCAP/",
"Documentation": "https://tamaas.readthedocs.io/en/latest/",
"Source Code": "https://c4science.ch/source/tamaas/",
},
platforms=['Linux'],
install_requires=['numpy'],
entry_points={
"console_scripts": ['tamaas = tamaas.__main__:main'],
},
extras_require={
"all": ['uvw', 'h5py', 'netCDF4', 'scipy', 'mpi4py'],
"dumpers": ['uvw', 'h5py', 'netCDF4'],
"solvers": ['scipy'],
"mpi": ['mpi4py'],
},
classifiers=[
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
"Intended Audience :: Science/Research",
"Operating System :: POSIX :: Linux",
]
)
diff --git a/site_scons/site_tools/sphinx.py b/site_scons/site_tools/sphinx.py
index 436c951..de207fc 100644
--- a/site_scons/site_tools/sphinx.py
+++ b/site_scons/site_tools/sphinx.py
@@ -1,64 +1,64 @@
# -*- coding: utf-8 -*-
# @file
# LICENSE
#
# Copyright (©) 2016-2021 EPFL (École Polytechnique Fédérale de Lausanne),
# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
"""
SCons tool to generate Sphinx documentation
"""
from __future__ import print_function
from SCons.Script import Builder, Action
def generate(env):
def sphinx_action(source, target, env, for_signature):
args = {
'verbose': "" if env['verbose'] else '-Q',
}
if 'html' in target[0].path:
args['builder'] = 'html'
- elif '.1' in target[0].path:
+ elif env.subst('.${man_section}') in target[0].path:
args['builder'] = 'man'
elif '.tex' in target[0].path:
args['builder'] = 'latex'
action = ('sphinx-build {verbose} -b {builder}'.format(**args)
+ ' -- ${SOURCE.dir} ${TARGET.dir}')
if env['verbose']:
return Action(action)
return Action(action,
cmdstr='{}[Sphinx/{}] {}${{TARGET}}'.format(
env['COLOR_DICT']['orange'],
args['builder'],
env['COLOR_DICT']['end']
))
sphinx_build = Builder(generator=sphinx_action,
emitter=None)
env['BUILDERS']['Sphinx'] = sphinx_build
def exists(env):
return env.Detect('sphinx-build')