3
0
mirror of https://github.com/triqs/dft_tools synced 2024-10-31 11:13:46 +01:00

Squash app4triqs/3.3.x to reduce skeleton history when tracking

Co-authored-by: Dylan Simon <dylan@dylex.net>
Co-authored-by: Alexander Hampel <ahampel@flatironinstitute.org>
This commit is contained in:
Nils Wentzell 2022-02-17 16:58:35 -05:00
commit 79789512bf
89 changed files with 3948 additions and 0 deletions

45
.clang-format Normal file
View File

@ -0,0 +1,45 @@
BasedOnStyle: LLVM
AccessModifierOffset: 0
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakStringLiterals: false
ColumnLimit: 150
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 3
ContinuationIndentWidth: 3
Cpp11BracedListStyle: true
DerivePointerBinding : false
IndentCaseLabels: true
IndentWidth: 2
Language: Cpp
MaxEmptyLinesToKeep: 1
NamespaceIndentation : All
PointerAlignment: Right
ReflowComments: false
SortIncludes: false
SpaceAfterControlStatementKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceInEmptyParentheses: false
SpacesInParentheses: false
Standard: Cpp11
TabWidth: 2
UseTab: Never

2
.clang-tidy Normal file
View File

@ -0,0 +1,2 @@
Checks: '-*,modernize-*,cppcoreguidelines-*,bugprone-*,-modernize-use-trailing-return-type,-cppcoreguidelines-special-member-functions,-cppcoreguidelines-macro-usage,-cppcoreguidelines-no-malloc,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-avoid-magic-numbers, -cppcoreguidelines-non-private-member-variables-in-classes, -bugprone-easily-swappable-parameters'
HeaderFilterRegex: 'app4triqs'

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
.travis.yml
Dockerfile
Jenkinsfile
.git/objects/pack
build*

45
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@ -0,0 +1,45 @@
---
name: Bug report
about: Create a report to help us improve
title: Bug report
labels: bug
---
### Prerequisites
* Please check that a similar issue isn't already filed: https://github.com/issues?q=is%3Aissue+user%3Atriqs
### Description
[Description of the issue]
### Steps to Reproduce
1. [First Step]
2. [Second Step]
3. [and so on...]
or paste a minimal code example to reproduce the issue.
**Expected behavior:** [What you expect to happen]
**Actual behavior:** [What actually happens]
### Versions
Please provide the application version that you used.
You can get this information from copy and pasting the output of
```bash
python -c "from app4triqs.version import *; show_version(); show_git_hash();"
```
from the command line. Also, please include the OS you are running and its version.
### Formatting
Please use markdown in your issue message. A useful summary of commands can be found [here](https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf).
### Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.

23
.github/ISSUE_TEMPLATE/feature.md vendored Normal file
View File

@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: Feature request
labels: feature
---
### Summary
One paragraph explanation of the feature.
### Motivation
Why is this feature of general interest?
### Implementation
What user interface do you suggest?
### Formatting
Please use markdown in your issue message. A useful summary of commands can be found [here](https://guides.github.com/pdfs/markdown-cheatsheet-online.pdf).

140
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,140 @@
name: build
on:
push:
branches: [ unstable, '[0-9]+.[0-9]+.x' ]
pull_request:
branches: [ unstable, '[0-9]+.[0-9]+.x' ]
workflow_call:
workflow_dispatch:
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
CCACHE_COMPILERCHECK: content
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
CCACHE_SLOPPINESS: pch_defines,time_macros,include_file_mtime,include_file_ctime
CCACHE_COMPRESS: "1"
CCACHE_COMPRESSLEVEL: "1"
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-22.04, cc: gcc-12, cxx: g++-12}
- {os: ubuntu-22.04, cc: clang-15, cxx: clang++-15}
- {os: macos-12, cc: gcc-12, cxx: g++-12}
- {os: macos-12, cc: clang, cxx: clang++}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.os }}-${{ matrix.cc }}-${{ github.run_id }}
restore-keys:
ccache-${{ matrix.os }}-${{ matrix.cc }}-
- name: Install ubuntu dependencies
if: matrix.os == 'ubuntu-22.04'
run: >
sudo apt-get update &&
sudo apt-get install lsb-release wget software-properties-common &&
wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh && sudo chmod +x /tmp/llvm.sh && sudo /tmp/llvm.sh 15 &&
sudo apt-get install
ccache
clang-15
g++-12
gfortran
hdf5-tools
libblas-dev
libboost-dev
libclang-15-dev
libc++-15-dev
libc++abi-15-dev
libomp-15-dev
libfftw3-dev
libgfortran5
libgmp-dev
libhdf5-dev
liblapack-dev
libopenmpi-dev
openmpi-bin
openmpi-common
openmpi-doc
python3-clang-15
python3-dev
python3-mako
python3-matplotlib
python3-mpi4py
python3-numpy
python3-pip
python3-scipy
python3-sphinx
python3-nbsphinx
- name: Install homebrew dependencies
if: matrix.os == 'macos-12'
run: |
brew install ccache gcc@12 llvm boost fftw hdf5 open-mpi openblas
mkdir $HOME/.venv
python3 -m venv $HOME/.venv/my_python
source $HOME/.venv/my_python/bin/activate
pip install mako numpy scipy mpi4py
pip install -r requirements.txt
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
echo "PATH=$PATH" >> $GITHUB_ENV
- name: add clang cxxflags
if: ${{ contains(matrix.cxx, 'clang') }}
run: |
echo "PATH=/usr/local/opt/llvm/bin:$PATH" >> $GITHUB_ENV
echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV
- name: Build & Install TRIQS
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |
git clone https://github.com/TRIQS/triqs --branch unstable
mkdir triqs/build && cd triqs/build
cmake .. -DBuild_Tests=OFF -DCMAKE_INSTALL_PREFIX=$HOME/install
make -j1 install VERBOSE=1
cd ../
- name: Build app4triqs
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
LIBRARY_PATH: /usr/local/opt/llvm/lib
run: |
source $HOME/install/share/triqs/triqsvars.sh
mkdir build && cd build && cmake ..
make -j2 || make -j1 VERBOSE=1
- name: Test app4triqs
env:
DYLD_FALLBACK_LIBRARY_PATH: /usr/local/opt/llvm/lib
OPENBLAS_NUM_THREADS: "1"
run: |
source $HOME/install/share/triqs/triqsvars.sh
cd build
ctest -j2 --output-on-failure
- name: ccache statistics
if: always()
run: ccache -sv
- uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.os }}-${{ matrix.cc }}-${{ github.run_id }}

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
compile_commands.json
doc/_autosummary
doc/cpp2rst_generated

178
CMakeLists.txt Normal file
View File

@ -0,0 +1,178 @@
# ##############################################################################
#
# app4triqs - An example application using triqs and cpp2py
#
# Copyright (C) ...
#
# app4triqs is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# app4triqs 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# app4triqs (in the file COPYING.txt in this directory). If not, see
# <http://www.gnu.org/licenses/>.
#
# ##############################################################################
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
cmake_policy(VERSION 3.20)
if(POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif()
# ############
# Define Project
project(app4triqs VERSION 3.3.0 LANGUAGES CXX)
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)
# ############
# Load TRIQS and CPP2PY
find_package(TRIQS 3.3 REQUIRED)
# Get the git hash & print status
triqs_get_git_hash_of_source_dir(PROJECT_GIT_HASH)
message(STATUS "${PROJECT_NAME} version : ${PROJECT_VERSION}")
message(STATUS "${PROJECT_NAME} Git hash: ${PROJECT_GIT_HASH}")
# Enforce Consistent Versioning
if(NOT ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} VERSION_EQUAL ${TRIQS_VERSION_MAJOR}.${TRIQS_VERSION_MINOR})
message(FATAL_ERROR "The ${PROJECT_NAME} version ${PROJECT_VERSION} is not compatible with TRIQS version ${TRIQS_VERSION}.")
endif()
# Default Install directory to TRIQS_ROOT if not given or when provided as relative path.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR (NOT IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX}))
message(STATUS "No install prefix given (or invalid). Defaulting to TRIQS_ROOT")
set(CMAKE_INSTALL_PREFIX ${TRIQS_ROOT} CACHE PATH "default install path" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
endif()
if(NOT IS_SUBPROJECT)
message(STATUS "-------- CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX} --------")
endif()
set(${PROJECT_NAME}_BINARY_DIR ${PROJECT_BINARY_DIR} CACHE STRING "Binary directory of the ${PROJECT_NAME} Project")
# Make additional Find Modules available
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/share/cmake/Modules)
# ############
# CMake Options
# Default to Release build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Type of build" FORCE)
endif()
if(NOT IS_SUBPROJECT)
message(STATUS "-------- BUILD-TYPE: ${CMAKE_BUILD_TYPE} --------")
endif()
# Python Support
option(PythonSupport "Build with Python support" ON)
if(PythonSupport AND NOT TRIQS_WITH_PYTHON_SUPPORT)
message(FATAL_ERROR "TRIQS was installed without Python support. Cannot build the Python Interface. Disable the build with -DPythonSupport=OFF")
endif()
# Documentation
option(Build_Documentation "Build documentation" OFF)
if(NOT IS_SUBPROJECT AND (Build_Documentation AND NOT PythonSupport))
message(FATAL_ERROR "Build_Documentation=ON requires PythonSupport to be enabled")
endif()
# Testing
option(Build_Tests "Build tests" ON)
if(Build_Tests)
enable_testing()
endif()
# ############
# Global Compilation Settings
# Build static libraries by default
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
# Export the list of compile-commands into compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Disable compiler extensions
set(CMAKE_CXX_EXTENSIONS OFF)
# Provide additional debugging information for Debug builds
add_compile_options($<$<CONFIG:Debug>:-ggdb3>)
# Create an Interface target for compiler warnings
add_library(${PROJECT_NAME}_warnings INTERFACE)
target_compile_options(${PROJECT_NAME}_warnings
INTERFACE
-Wall
-Wextra
-Wfloat-conversion
-Wpedantic
-Wno-sign-compare
$<$<CXX_COMPILER_ID:GNU>:-Wno-comma-subscript>
$<$<CXX_COMPILER_ID:GNU>:-Wno-psabi> # Disable notes about ABI changes
$<$<CXX_COMPILER_ID:GNU>:-Wshadow=local>
$<$<CXX_COMPILER_ID:GNU>:-Wno-attributes>
$<$<CXX_COMPILER_ID:GNU>:-Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-deprecated-comma-subscript>
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-unknown-warning-option>
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wshadow>
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-gcc-compat>
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-c++20-extensions>
$<$<CXX_COMPILER_ID:AppleClang,Clang,IntelLLVM>:-Wno-c++20-compat>
$<$<CXX_COMPILER_ID:IntelLLVM>:-Wno-tautological-constant-compare>
)
# Provide GNU Installation directories
include(GNUInstallDirs)
# #############
# Build Project
# Find / Build dependencies
add_subdirectory(deps)
# Build and install the library
add_subdirectory(c++/${PROJECT_NAME})
# Tests
if(Build_Tests)
add_subdirectory(test)
endif()
# Python
if(PythonSupport)
add_subdirectory(python/${PROJECT_NAME})
endif()
# Docs
if(NOT IS_SUBPROJECT AND Build_Documentation)
add_subdirectory(doc)
endif()
# Additional configuration files
add_subdirectory(share)
# add packaging for automatic Versioning
add_subdirectory(packaging)
# #############
# Debian Package
option(BUILD_DEBIAN_PACKAGE "Build a deb package" OFF)
if(BUILD_DEBIAN_PACKAGE AND NOT IS_SUBPROJECT)
if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be /usr for packaging")
endif()
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_CONTACT "https://github.com/TRIQS/${PROJECT_NAME}")
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CMAKE_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "triqs (>= 3.3)")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON)
include(CPack)
endif()

674
COPYING.txt Normal file
View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

1
ChangeLog.md Symbolic link
View File

@ -0,0 +1 @@
doc/ChangeLog.md

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
# See ../triqs/packaging for other options
FROM flatironinstitute/triqs:unstable-ubuntu-clang
ARG APPNAME=app4triqs
# Install here missing dependencies, e.g.
# RUN apt-get install -y python3-skimage
COPY --chown=build . $SRC/$APPNAME
WORKDIR $BUILD/$APPNAME
RUN chown build .
USER build
ARG BUILD_ID
ARG CMAKE_ARGS
RUN cmake $SRC/$APPNAME -DTRIQS_ROOT=${INSTALL} $CMAKE_ARGS && make -j4 || make -j1 VERBOSE=1
USER root
RUN make install

186
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,186 @@
def projectName = "app4triqs" /* set to app/repo name */
def dockerName = projectName.toLowerCase();
/* which platform to build documentation on */
def documentationPlatform = "ubuntu-clang"
/* depend on triqs upstream branch/project */
def triqsBranch = env.CHANGE_TARGET ?: env.BRANCH_NAME
def triqsProject = '/TRIQS/triqs/' + triqsBranch.replaceAll('/', '%2F')
/* whether to keep and publish the results */
def keepInstall = !env.BRANCH_NAME.startsWith("PR-")
properties([
disableConcurrentBuilds(),
buildDiscarder(logRotator(numToKeepStr: '10', daysToKeepStr: '30')),
pipelineTriggers(keepInstall ? [
upstream(
threshold: 'SUCCESS',
upstreamProjects: triqsProject
)
] : [])
])
/* map of all builds to run, populated below */
def platforms = [:]
/****************** linux builds (in docker) */
/* Each platform must have a corresponding Dockerfile.PLATFORM in triqs/packaging */
def dockerPlatforms = ["ubuntu-clang", "ubuntu-gcc", "ubuntu-intel", "sanitize"]
/* .each is currently broken in jenkins */
for (int i = 0; i < dockerPlatforms.size(); i++) {
def platform = dockerPlatforms[i]
platforms[platform] = { -> node('linux && docker && triqs') {
stage(platform) { timeout(time: 1, unit: 'HOURS') { ansiColor('xterm') {
checkout scm
/* construct a Dockerfile for this base */
sh """
( echo "FROM flatironinstitute/triqs:${triqsBranch}-${env.STAGE_NAME}" ; sed '0,/^FROM /d' Dockerfile ) > Dockerfile.jenkins
mv -f Dockerfile.jenkins Dockerfile
"""
/* build and tag */
def args = ''
if (platform == documentationPlatform)
args = '-DBuild_Documentation=1'
else if (platform == "sanitize")
args = '-DASAN=ON -DUBSAN=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo'
def img = docker.build("flatironinstitute/${dockerName}:${env.BRANCH_NAME}-${env.STAGE_NAME}", "--build-arg APPNAME=${projectName} --build-arg BUILD_ID=${env.BUILD_TAG} --build-arg CMAKE_ARGS='${args}' .")
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
img.inside("--shm-size=4gb") {
sh "make -C \$BUILD/${projectName} test CTEST_OUTPUT_ON_FAILURE=1"
}
}
if (!keepInstall) {
sh "docker rmi --no-prune ${img.imageName()}"
}
} } }
} }
}
/****************** osx builds (on host) */
def osxPlatforms = [
["gcc", ['CC=gcc-13', 'CXX=g++-13', 'FC=gfortran-13']],
["clang", ['CC=$BREW/opt/llvm/bin/clang', 'CXX=$BREW/opt/llvm/bin/clang++', 'FC=gfortran-13', 'CXXFLAGS=-I$BREW/opt/llvm/include', 'LDFLAGS=-L$BREW/opt/llvm/lib']]
]
for (int i = 0; i < osxPlatforms.size(); i++) {
def platformEnv = osxPlatforms[i]
def platform = platformEnv[0]
platforms["osx-$platform"] = { -> node('osx && triqs') {
stage("osx-$platform") { timeout(time: 1, unit: 'HOURS') { ansiColor('xterm') {
def srcDir = pwd()
def tmpDir = pwd(tmp:true)
def buildDir = "$tmpDir/build"
/* install real branches in a fixed predictable place so apps can find them */
def installDir = keepInstall ? "${env.HOME}/install/${projectName}/${env.BRANCH_NAME}/${platform}" : "$tmpDir/install"
def triqsDir = "${env.HOME}/install/triqs/${triqsBranch}/${platform}"
def venv = triqsDir
dir(installDir) {
deleteDir()
}
checkout scm
def hdf5 = "${env.BREW}/opt/hdf5@1.10"
dir(buildDir) { withEnv(platformEnv[1].collect { it.replace('\$BREW', env.BREW) } + [
"PATH=$venv/bin:${env.BREW}/bin:/usr/bin:/bin:/usr/sbin",
"HDF5_ROOT=$hdf5",
"C_INCLUDE_PATH=$hdf5/include:${env.BREW}/include",
"CPLUS_INCLUDE_PATH=$venv/include:$hdf5/include:${env.BREW}/include",
"LIBRARY_PATH=$venv/lib:$hdf5/lib:${env.BREW}/lib",
"LD_LIBRARY_PATH=$hdf5/lib",
"PYTHONPATH=$installDir/lib/python3.9/site-packages",
"CMAKE_PREFIX_PATH=$venv/lib/cmake/triqs",
"VIRTUAL_ENV=$venv",
"OMP_NUM_THREADS=2"]) {
deleteDir()
/* note: this is installing into the parent (triqs) venv (install dir), which is thus shared among apps and so not be completely safe */
sh "pip3 install -U -r $srcDir/requirements.txt"
sh "cmake $srcDir -DCMAKE_INSTALL_PREFIX=$installDir -DTRIQS_ROOT=$triqsDir"
sh "make -j2 || make -j1 VERBOSE=1"
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { try {
sh "make test CTEST_OUTPUT_ON_FAILURE=1"
} catch (exc) {
archiveArtifacts(artifacts: 'Testing/Temporary/LastTest.log')
throw exc
} }
sh "make install"
} }
} } }
} }
}
/****************** wrap-up */
def error = null
try {
parallel platforms
if (keepInstall) { node('linux && docker && triqs') {
/* Publish results */
stage("publish") { timeout(time: 5, unit: 'MINUTES') {
def commit = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
def release = env.BRANCH_NAME == "master" || env.BRANCH_NAME == "unstable" || sh(returnStdout: true, script: "git describe --exact-match HEAD || true").trim()
def workDir = pwd(tmp:true)
lock('triqs_publish') {
/* Update documention on gh-pages branch */
dir("$workDir/gh-pages") {
def subdir = "${projectName}/${env.BRANCH_NAME}"
git(url: "ssh://git@github.com/TRIQS/TRIQS.github.io.git", branch: "master", credentialsId: "ssh", changelog: false)
sh "rm -rf ${subdir}"
docker.image("flatironinstitute/${dockerName}:${env.BRANCH_NAME}-${documentationPlatform}").inside() {
sh """#!/bin/bash -ex
base=\$INSTALL/share/doc
dir="${projectName}"
[[ -d \$base/triqs_\$dir ]] && dir=triqs_\$dir || [[ -d \$base/\$dir ]]
cp -rp \$base/\$dir ${subdir}
"""
}
sh "git add -A ${subdir}"
sh """
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' --allow-empty -m 'Generated documentation for ${subdir}' -m '${env.BUILD_TAG} ${commit}'
"""
// note: credentials used above don't work (need JENKINS-28335)
sh "git push origin master"
}
/* Update packaging repo submodule */
if (release) { dir("$workDir/packaging") { try {
git(url: "ssh://git@github.com/TRIQS/packaging.git", branch: env.BRANCH_NAME, credentialsId: "ssh", changelog: false)
// note: credentials used above don't work (need JENKINS-28335)
sh """#!/bin/bash -ex
dir="${projectName}"
[[ -d triqs_\$dir ]] && dir=triqs_\$dir || [[ -d \$dir ]]
echo "160000 commit ${commit}\t\$dir" | git update-index --index-info
git commit --author='Flatiron Jenkins <jenkins@flatironinstitute.org>' -m 'Autoupdate ${projectName}' -m '${env.BUILD_TAG}'
git push origin ${env.BRANCH_NAME}
"""
} catch (err) {
/* Ignore, non-critical -- might not exist on this branch */
echo "Failed to update packaging repo"
} } }
}
} }
} }
} catch (err) {
error = err
} finally {
/* send email on build failure (declarative pipeline's post section would work better) */
if ((error != null || currentBuild.currentResult != 'SUCCESS') && env.BRANCH_NAME != "jenkins") emailext(
subject: "\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED",
body: """\$PROJECT_NAME - Build # \$BUILD_NUMBER - FAILED
Check console output at \$BUILD_URL to view full results.
Building \$BRANCH_NAME for \$CAUSE
\$JOB_DESCRIPTION
Changes:
\$CHANGES
End of build log:
\${BUILD_LOG,maxLines=60}
""",
to: 'nwentzell@flatironinstitute.org',
recipientProviders: [
[$class: 'DevelopersRecipientProvider'],
],
replyTo: '$DEFAULT_REPLYTO'
)
if (error != null) throw error
}

18
LICENSE.txt Normal file
View File

@ -0,0 +1,18 @@
app4triqs - An example application using triqs and cpp2py
Copyright (C) 2017-2018, N. Wentzell, O. Parcollet
Copyright (C) 2018-2019, The Simons Foundation
authors: N. Wentzell, D. Simons, H. Strand, O. Parcollet
app4triqs is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
app4triqs 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 General Public License for more details.
You should have received a copy of the GNU General Public License along with
app4triqs (in the file COPYING.txt in this directory). If not, see
<http://www.gnu.org/licenses/>.

84
README.md Normal file
View File

@ -0,0 +1,84 @@
[![build](https://github.com/TRIQS/app4triqs/workflows/build/badge.svg)](https://github.com/TRIQS/app4triqs/actions?query=workflow%3Abuild)
# app4triqs - A skeleton for a TRIQS application
Initial Setup
-------------
To adapt this skeleton for a new TRIQS application, the following steps are necessary:
* Create a repository, e.g. https://github.com/username/appname
* Run the following commands in order after replacing **appname** accordingly
```bash
git clone https://github.com/triqs/app4triqs --branch unstable appname
cd appname
./share/squash_history.sh
./share/replace_and_rename.py appname
git add -A && git commit -m "Adjust app4triqs skeleton for appname"
```
You can now add your github repository and push to it
```bash
git remote add origin https://github.com/username/appname
git remote update
git push origin unstable
```
If you prefer to use the [SSH interface](https://help.github.com/en/articles/connecting-to-github-with-ssh)
to the remote repository, replace the http link with e.g. `git@github.com:username/appname`.
### Merging app4triqs skeleton updates ###
You can merge future changes to the app4triqs skeleton into your project with the following commands
```bash
git remote update
git merge app4triqs_remote/unstable -X ours -m "Merge latest app4triqs skeleton changes"
```
If you should encounter any conflicts resolve them and `git commit`.
Finally we repeat the replace and rename command from the initial setup.
```bash
./share/replace_and_rename.py appname
git commit --amend
```
Now you can compare against the previous commit with:
```bash
git diff prev_git_hash
````
Getting Started
---------------
After setting up your application as described above you should customize the following files and directories
according to your needs (replace app4triqs in the following by the name of your application)
* Adjust or remove the `README.md` and `doc/ChangeLog.md` file
* In the `c++/app4triqs` subdirectory adjust the example files `app4triqs.hpp` and `app4triqs.cpp` or add your own source files.
* In the `test/c++` subdirectory adjust the example test `basic.cpp` or add your own tests.
* In the `python/app4triqs` subdirectory add your Python source files.
Be sure to remove the `app4triqs_module_desc.py` file unless you want to generate a Python module from your C++ source code.
* In the `test/python` subdirectory adjust the example test `Basic.py` or add your own tests.
* Adjust any documentation examples given as `*.rst` files in the doc directory.
* Adjust the sphinx configuration in `doc/conf.py.in` as necessary.
* The build and install process is identical to the one outline [here](https://triqs.github.io/app4triqs/unstable/install.html).
### Optional ###
----------------
* If you want to wrap C++ classes and/or functions provided in the `c++/app4triqs/app4triqs.hpp` rerun the `c++2py` tool with
```bash
c++2py -r app4triqs_module_desc.py
```
* Add your email address to the bottom section of `Jenkinsfile` for Jenkins CI notification emails
```
End of build log:
\${BUILD_LOG,maxLines=60}
""",
to: 'user@domain.org',
```

View File

@ -0,0 +1,99 @@
file(GLOB_RECURSE sources *.cpp)
add_library(${PROJECT_NAME}_c ${sources})
add_library(${PROJECT_NAME}::${PROJECT_NAME}_c ALIAS ${PROJECT_NAME}_c)
# Link against triqs and enable warnings
target_link_libraries(${PROJECT_NAME}_c PUBLIC triqs PRIVATE $<BUILD_INTERFACE:${PROJECT_NAME}_warnings>)
# Configure target and compilation
set_target_properties(${PROJECT_NAME}_c PROPERTIES
POSITION_INDEPENDENT_CODE ON
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
target_include_directories(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/c++>)
target_include_directories(${PROJECT_NAME}_c SYSTEM INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>)
target_compile_definitions(${PROJECT_NAME}_c PUBLIC
APP4TRIQS_GIT_HASH=${PROJECT_GIT_HASH}
TRIQS_GIT_HASH=${TRIQS_GIT_HASH}
$<$<CONFIG:Debug>:APP4TRIQS_DEBUG>
$<$<CONFIG:Debug>:TRIQS_DEBUG>
$<$<CONFIG:Debug>:TRIQS_ARRAYS_ENFORCE_BOUNDCHECK>
)
# Install library and headers
install(TARGETS ${PROJECT_NAME}_c EXPORT ${PROJECT_NAME}-targets DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h")
# ========= Static Analyzer Checks ==========
option(ANALYZE_SOURCES OFF "Run static analyzer checks if found (clang-tidy, cppcheck)")
if(ANALYZE_SOURCES)
# Locate static analyzer tools
find_program(CPPCHECK_EXECUTABLE NAMES "cppcheck" PATHS ENV PATH)
find_program(CLANG_TIDY_EXECUTABLE NAMES "clang-tidy" PATHS ENV PATH)
# Run clang-tidy if found
if(CLANG_TIDY_EXECUTABLE)
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXECUTABLE}")
set_target_properties(${PROJECT_NAME}_c PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
else()
message(STATUS "clang-tidy not found in $PATH. Please consider installing clang-tidy for additional checks!")
endif()
# Run cppcheck if found
if(CPPCHECK_EXECUTABLE)
message(STATUS "cppcheck found: ${CPPCHECK_EXECUTABLE}")
add_custom_command(
TARGET ${PROJECT_NAME}_c
COMMAND ${CPPCHECK_EXECUTABLE}
--enable=warning,style,performance,portability
--std=c++23
--template=gcc
--verbose
--force
--quiet
${sources}
WORKING_DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}
)
else()
message(STATUS "cppcheck not found in $PATH. Please consider installing cppcheck for additional checks!")
endif()
endif()
# ========= Dynamic Analyzer Checks ==========
option(ASAN OFF "Compile library and executables with LLVM Address Sanitizer")
if(ASAN)
if(NOT TARGET asan)
find_package(sanitizer REQUIRED COMPONENTS asan)
endif()
target_link_libraries(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:asan>)
endif()
option(UBSAN OFF "Compile library and executables with LLVM Undefined Behavior Sanitizer")
if(UBSAN)
if(NOT TARGET ubsan)
find_package(sanitizer REQUIRED COMPONENTS ubsan)
endif()
target_link_libraries(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:ubsan>)
endif()
option(MSAN OFF "Compile library and executables with LLVM Memory Sanitizer")
if(MSAN)
if(NOT TARGET msan)
find_package(sanitizer REQUIRED COMPONENTS msan)
endif()
target_link_libraries(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:msan>)
endif()
option(TSAN OFF "Compile library and executables with LLVM Thread Sanitizer")
if(TSAN)
if(NOT TARGET tsan)
find_package(sanitizer REQUIRED COMPONENTS tsan)
endif()
target_link_libraries(${PROJECT_NAME}_c PUBLIC $<BUILD_INTERFACE:tsan>)
endif()

View File

@ -0,0 +1,37 @@
#include <cmath>
#include "./app4triqs.hpp"
namespace app4triqs {
toto &toto::operator+=(toto const &b) {
this->i += b.i;
return *this;
}
toto toto::operator+(toto const &b) const {
auto res = *this;
res += b;
return res;
}
bool toto::operator==(toto const &b) const { return (this->i == b.i); }
void h5_write(h5::group grp, std::string subgroup_name, toto const &m) {
grp = subgroup_name.empty() ? grp : grp.create_group(subgroup_name);
h5_write(grp, "i", m.i);
h5_write_attribute(grp, "Format", toto::hdf5_format());
}
void h5_read(h5::group grp, std::string subgroup_name, toto &m) {
grp = subgroup_name.empty() ? grp : grp.open_group(subgroup_name);
int i;
h5_read(grp, "i", i);
m = toto(i);
}
int chain(int i, int j) {
int n_digits_j = j > 0 ? (int)log10(j) + 1 : 1;
return i * int(pow(10, n_digits_j)) + j;
}
} // namespace app4triqs

View File

@ -0,0 +1,79 @@
#pragma once
#include <triqs/gfs.hpp>
#include <triqs/mesh.hpp>
#include <h5/h5.hpp>
namespace app4triqs {
/**
* A very useful and important class
*
* @note A Useful note
* @include app4triqs/app4triqs.hpp
*/
class toto {
int i = 0;
public:
toto() = default;
/**
* Construct from integer
*
* @param i_ a scalar :math:`G(\tau)`
*/
explicit toto(int i_) : i(i_) {}
~toto() = default;
// Copy/Move construction
toto(toto const &) = default;
toto(toto &&) = default;
/// Copy/Move assignment
toto &operator=(toto const &) = default;
toto &operator=(toto &&) = default;
/// Simple accessor
[[nodiscard]] int get_i() const { return i; }
/**
* A simple function with :math:`G(\tau)`
*
* @param u Nothing useful
*/
int f(int u) { return u; }
/// Arithmetic operations
toto operator+(toto const &b) const;
toto &operator+=(toto const &b);
/// Comparison
bool operator==(toto const &b) const;
/// HDF5
static std::string hdf5_format() { return "Toto"; }
friend void h5_write(h5::group grp, std::string subgroup_name, toto const &m);
friend void h5_read(h5::group grp, std::string subgroup_name, toto &m);
/// Serialization
template <class Archive> void serialize(Archive &ar, const unsigned int) { ar &i; }
};
/**
* Chain digits of two integers
*
* @head A set of functions that implement chaining
*
* @tail Do I really need to explain more ?
*
* @param i The first integer
* @param j The second integer
* @return An integer containing the digits of both i and j
*
*/
int chain(int i, int j);
} // namespace app4triqs

1
deps/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*

67
deps/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,67 @@
include(external_dependency.cmake)
# Add your dependencies with the function
#
# external_dependency(name
# [VERSION <version-number>]
# [GIT_REPO <url>]
# [GIT_TAG <tag>]
# [BUILD_ALWAYS]
# [EXCLUDE_FROM_ALL]
# )
#
# Resolve the dependency using the following steps in order.
# If a step was successful, skip the remaining ones.
#
# 1. Use find_package(name [<version-number>])
# to locate the package in the system.
# Skip this step if Build_Deps option is set.
# 2. Try to find a directory containing the sources
# at ${CMAKE_CURRENT_SOURCE_DIR}/name and
# ${CMAKE_SOURCE_DIR}/deps/name. If found
# build it as a cmake sub-project.
# 3. If GIT_REPO is provided, git clone the sources,
# and build them as a cmake sub-project.
#
# Addtional options:
#
# GIT_TAG - Use this keyword to specify the git-tag, branch or commit hash
#
# BUILD_ALWAYS - If set, this dependency will always be built from source
# and will never be searched in the system.
#
# EXCLUDE_FROM_ALL - If set, targets of the dependency cmake subproject
# will not be included in the ALL target of the project.
# In particular the dependency will not be installed.
if(NOT DEFINED Build_Deps)
set(Build_Deps "Always" CACHE STRING "Do we build dependencies from source? [Never/Always/IfNotFound]")
else()
set(Build_Deps_Opts "Never" "Always" "IfNotFound")
if(NOT ${Build_Deps} IN_LIST Build_Deps_Opts)
message(FATAL_ERROR "Build_Deps option should be either 'Never', 'Always' or 'IfNotFound'")
endif()
set(Build_Deps ${Build_Deps} CACHE STRING "Do we build dependencies from source? [Never/Always/IfNotFound]")
if(NOT IS_SUBPROJECT AND NOT Build_Deps STREQUAL "Always" AND (ASAN OR UBSAN))
message(WARNING "For builds with llvm sanitizers (ASAN/UBSAN) it is recommended to use -DBuild_Deps=Always to avoid false positives.")
endif()
endif()
# -- Cpp2Py --
if(PythonSupport OR (NOT IS_SUBPROJECT AND Build_Documentation))
external_dependency(Cpp2Py
GIT_REPO https://github.com/TRIQS/cpp2py
VERSION 2.0
GIT_TAG unstable
BUILD_ALWAYS
EXCLUDE_FROM_ALL
)
endif()
# -- GTest --
external_dependency(GTest
GIT_REPO https://github.com/google/googletest
GIT_TAG main
BUILD_ALWAYS
EXCLUDE_FROM_ALL
)

95
deps/external_dependency.cmake vendored Normal file
View File

@ -0,0 +1,95 @@
# Copyright (c) 2020 Simons Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You may obtain a copy of the License at
# https://www.gnu.org/licenses/gpl-3.0.txt
# Consider ROOT env variables in find_package
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
# Make sure that imported targets are always global
get_property(IMPORTED_ALWAYS_GLOBAL GLOBAL PROPERTY IMPORTED_ALWAYS_GLOBAL)
if(NOT IMPORTED_ALWAYS_GLOBAL)
function(add_library)
set(_args ${ARGN})
if ("${_args}" MATCHES ";IMPORTED")
list(APPEND _args GLOBAL)
endif()
_add_library(${_args})
endfunction()
set_property(GLOBAL PROPERTY IMPORTED_ALWAYS_GLOBAL TRUE)
endif()
# Define External Dependency Function
function(external_dependency)
cmake_parse_arguments(ARG "EXCLUDE_FROM_ALL;BUILD_ALWAYS" "VERSION;GIT_REPO;GIT_TAG" "" ${ARGN})
# -- Was dependency already found?
get_property(${ARGV0}_FOUND GLOBAL PROPERTY ${ARGV0}_FOUND)
if(${ARGV0}_FOUND)
message(STATUS "Dependency ${ARGV0} was already resolved.")
return()
endif()
# -- Try to find package in system.
if(NOT ARG_BUILD_ALWAYS AND NOT Build_Deps STREQUAL "Always")
find_package(${ARGV0} ${ARG_VERSION} QUIET HINTS ${CMAKE_INSTALL_PREFIX})
if(${ARGV0}_FOUND)
message(STATUS "Found dependency ${ARGV0} in system ${${ARGV0}_ROOT}")
return()
elseif(Build_Deps STREQUAL "Never")
message(FATAL_ERROR "Could not find dependency ${ARGV0} in system. Please install the dependency manually or use -DBuild_Deps=IfNotFound during cmake configuration to automatically build all dependencies that are not found.")
endif()
endif()
# -- Build package from source
message(STATUS " =============== Configuring Dependency ${ARGV0} =============== ")
if(ARG_EXCLUDE_FROM_ALL)
set(subdir_opts EXCLUDE_FROM_ALL)
set(Build_Tests OFF)
set(Build_Documentation OFF)
endif()
if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0})
message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_CURRENT_SOURCE_DIR}/${ARGV0}")
add_subdirectory(${ARGV0} ${subdir_opts})
elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/deps/${ARGV0})
message(STATUS "Found sources for dependency ${ARGV0} at ${CMAKE_SOURCE_DIR}/deps/${ARGV0}")
add_subdirectory(${ARGV0} ${subdir_opts})
elseif(ARG_GIT_REPO)
set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${ARGV0})
set(src_dir ${bin_dir}_src)
if(NOT IS_DIRECTORY ${src_dir})
if(ARG_GIT_TAG)
set(clone_opts --branch ${ARG_GIT_TAG} -c advice.detachedHead=false)
endif()
if(NOT GIT_EXECUTABLE)
find_package(Git REQUIRED)
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} clone ${ARG_GIT_REPO} --depth 1 ${clone_opts} ${src_dir}
RESULT_VARIABLE clone_failed
ERROR_VARIABLE clone_error
)
if(clone_failed)
message(FATAL_ERROR "Failed to clone sources for dependency ${ARGV0}.\n ${clone_error}")
endif()
endif()
add_subdirectory(${src_dir} ${bin_dir} ${subdir_opts})
else()
message(FATAL_ERROR "Could not find or build dependency ${ARGV0}")
endif()
message(STATUS " =============== End ${ARGV0} Configuration =============== ")
set_property(GLOBAL PROPERTY ${ARGV0}_FOUND TRUE)
endfunction()

81
doc/CMakeLists.txt Normal file
View File

@ -0,0 +1,81 @@
# Generate the sphinx config file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in ${CMAKE_CURRENT_BINARY_DIR}/conf.py @ONLY)
# -----------------------------------------------------------------------------
# Create an optional target that allows us to regenerate the C++ doc with c++2rst
# -----------------------------------------------------------------------------
add_custom_target(${PROJECT_NAME}_docs_cpp2rst)
include(${PROJECT_SOURCE_DIR}/share/cmake/extract_flags.cmake)
extract_flags(${PROJECT_NAME}_c BUILD_INTERFACE)
separate_arguments(${PROJECT_NAME}_c_CXXFLAGS)
macro(generate_docs header_file)
add_custom_command(
TARGET ${PROJECT_NAME}_docs_cpp2rst
COMMAND rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated
COMMAND
PYTHONPATH=${CPP2PY_BINARY_DIR}:$ENV{PYTHONPATH}
PATH=${CPP2PY_BINARY_DIR}/bin:${CPP2PY_ROOT}/bin:$ENV{PATH}
c++2rst
${header_file}
-N ${PROJECT_NAME}
--output_directory ${CMAKE_CURRENT_SOURCE_DIR}/cpp2rst_generated
-I${PROJECT_SOURCE_DIR}/c++
--cxxflags="${${PROJECT_NAME}_c_CXXFLAGS}"
)
endmacro(generate_docs)
generate_docs(${PROJECT_SOURCE_DIR}/c++/${PROJECT_NAME}/${PROJECT_NAME}.hpp)
# --------------------------------------------------------
# Build & Run the C++ doc examples and capture the output
# --------------------------------------------------------
add_custom_target(${PROJECT_NAME}_docs_example_output)
file(GLOB_RECURSE ExampleList RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(example ${ExampleList})
get_filename_component(f ${example} NAME_WE)
get_filename_component(d ${example} DIRECTORY)
add_executable(${PROJECT_NAME}_doc_${f} EXCLUDE_FROM_ALL ${example})
set_property(TARGET ${PROJECT_NAME}_doc_${f} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${d})
target_link_libraries(${PROJECT_NAME}_doc_${f} triqs)
add_custom_command(TARGET ${PROJECT_NAME}_doc_${f}
COMMAND ${PROJECT_NAME}_doc_${f} > ${CMAKE_CURRENT_SOURCE_DIR}/${d}/${f}.output 2>/dev/null
WORKING_DIRECTORY ${d}
)
add_dependencies(${PROJECT_NAME}_docs_example_output ${PROJECT_NAME}_doc_${f})
endforeach()
# ---------------------------------
# Top Sphinx target
# ---------------------------------
if(NOT DEFINED SPHINXBUILD_EXECUTABLE)
find_package(Sphinx)
endif()
# Sphinx has internal caching, always run it
add_custom_target(${PROJECT_NAME}_docs_sphinx ALL)
add_custom_command(
TARGET ${PROJECT_NAME}_docs_sphinx
COMMAND PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SPHINXBUILD_EXECUTABLE} -j auto -c . -b html ${CMAKE_CURRENT_SOURCE_DIR} html
)
option(Sphinx_Only "When building the documentation, skip the Python Modules and the generation of C++ Api and example outputs" OFF)
if(NOT Sphinx_Only)
# Autodoc usage requires the python modules to be built first
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
if(CPP2PY_MODULES_LIST)
add_dependencies(${PROJECT_NAME}_docs_sphinx ${CPP2PY_MODULES_LIST})
endif()
# Generation of C++ Api and Example Outputs
add_dependencies(${PROJECT_NAME}_docs_sphinx ${PROJECT_NAME}_docs_cpp2rst ${PROJECT_NAME}_docs_example_output)
endif()
# ---------------------------------
# Install
# ---------------------------------
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ COMPONENT documentation DESTINATION share/doc/${PROJECT_NAME}
FILES_MATCHING
REGEX "\\.(html|pdf|png|gif|jpg|svg|ico|js|xsl|css|py|txt|inv|bib|ttf|woff2|eot|sh)$"
PATTERN "_*"
)

35
doc/ChangeLog.md Normal file
View File

@ -0,0 +1,35 @@
(changelog)=
# Changelog
## Version 3.1.0
app4triqs version 3.1.0 is a compatibility
release for TRIQS version 3.1.0 that
* moves to cmake 3.12.4 and c++20
* improves ghactions and jenkins configuration
* switches documentation to read-the-docs theme
* uses googletest main branch
* fixes several skeleton issues
We thank all contributors: Alexander Hampel, Dylan Simon, Nils Wentzell
## Version 3.0.0
app4triqs version 3.0.0 is a compatibility
release for TRIQS version 3.0.0 that
* introduces compatibility with Python 3 (Python 2 no longer supported)
* adds a cmake-based dependency management
* fixes several application issues
## Version 2.2.0
app4triqs Version 2.2.0 provides a project
skeleton for TRIQS applications based on
the TRIQS Library Version 2.2.0.
It is intended for applications with both
Python and C++ components.
This is the initial release for this project.

5
doc/_static/css/custom.css vendored Normal file
View File

@ -0,0 +1,5 @@
@import url("theme.css");
.wy-nav-content {
max-width: 70em;
}

BIN
doc/_static/logo_cea.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
doc/_static/logo_cnrs.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

BIN
doc/_static/logo_erc.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

BIN
doc/_static/logo_flatiron.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
doc/_static/logo_github.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
doc/_static/logo_simons.jpg vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

BIN
doc/_static/logo_x.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 114.29 131.6"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path d="M113.3,53.21c-1.32-2.35-3.75-3.73-6.91-4.38,6-7.34,7.9-13.46,5.45-17.8C108.91,25.8,100.9,24.94,90.53,27a47.56,47.56,0,0,0-57.08-9.73L23.83,1.28A2.67,2.67,0,0,0,19.27,4L28.87,20A47.76,47.76,0,0,0,9.36,48.11l-.63.61C1.09,56.34-1.55,62.39.87,66.68c1.29,2.31,3.82,3.64,7.52,4h.24a2.56,2.56,0,0,0,.68-.13c.18.74.36,1.49.57,2.22C3.38,80.2.39,87.1,3.2,92.11c2.14,3.81,8.14,5.34,14.34,5.34a39.63,39.63,0,0,0,4.89-.31l3.44-.5a47.59,47.59,0,0,0,52.19,4.88l3.73,6.19L76.25,111l11.34,10.32L98.92,131.6l-3.54-14.91-3.55-14.91L86.37,105l-3.76-6.24A47.86,47.86,0,0,0,99.36,78.5a2.75,2.75,0,0,0,.56-.35l6.76-6.38C115.34,62.11,115.06,56.35,113.3,53.21ZM51.92,47.86c14.44-8,27.1-12.77,36.69-15a42.26,42.26,0,0,1,8,16C86.39,50.2,73.11,55.26,60.47,62ZM13.28,59.42a42.64,42.64,0,0,1,.86-8.51A129.15,129.15,0,0,1,37.46,34.19l7.08,11.75C32.88,52.77,22,60.63,14.22,68.24A42.1,42.1,0,0,1,13.28,59.42ZM107.2,33.64c1,1.82,0,6.1-5.7,12.72a47.38,47.38,0,0,0-7.06-14.64C101.43,30.72,106,31.46,107.2,33.64ZM55.66,17A42.21,42.21,0,0,1,84.42,28.38C73.62,31.33,61.1,36.72,49.17,43.3l-7-11.67c1-.55,2.06-1.13,3.07-1.64a2.66,2.66,0,1,0-2.41-4.75c-1.12.57-2.27,1.21-3.41,1.82l-3.17-5.25A42.06,42.06,0,0,1,55.66,17Zm-24,7.5,3.07,5.09A151.53,151.53,0,0,0,17.53,41.05,42.57,42.57,0,0,1,31.64,24.54ZM5.51,64.07c-.41-.73-.12-2.87,2.54-6.5C8,58.19,8,58.79,8,59.42a49.12,49.12,0,0,0,.39,5.85C6.89,65.08,5.83,64.65,5.51,64.07ZM7.84,89.51c-1.14-2,.29-5.92,4.17-10.9A47.81,47.81,0,0,0,20.84,92C13.67,92.68,8.71,91.05,7.84,89.51Zm47.82,12.28A42.39,42.39,0,0,1,16,74.09c6.64-7,17.15-15.31,31.33-23.59l8.52,14.13a154.61,154.61,0,0,0-17.08,11.3,2.65,2.65,0,0,0-.49,3.73,2.66,2.66,0,0,0,3.73.49,149.51,149.51,0,0,1,16.59-11L75.29,96.94A42.15,42.15,0,0,1,55.66,101.79Zm24.18-7.62L63.22,66.6C77.41,59,89.47,55.1,97.65,54A41.86,41.86,0,0,1,79.84,94.17Zm23-26.12-.4.37a47.6,47.6,0,0,0,.88-9,46.66,46.66,0,0,0-.38-5.71c3,.12,5,.85,5.68,2.11C109.63,57.53,108.57,61.69,102.88,68.05Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 114.29 131.6"><defs><style>.cls-1{fill:#1067bf;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M113.3,53.21c-1.32-2.35-3.75-3.73-6.91-4.38,6-7.34,7.9-13.46,5.45-17.8C108.91,25.8,100.9,24.94,90.53,27a47.56,47.56,0,0,0-57.08-9.73L23.83,1.28A2.67,2.67,0,0,0,19.27,4L28.87,20A47.76,47.76,0,0,0,9.36,48.11l-.63.61C1.09,56.34-1.55,62.39.87,66.68c1.29,2.31,3.82,3.64,7.52,4h.24a2.56,2.56,0,0,0,.68-.13c.18.74.36,1.49.57,2.22C3.38,80.2.39,87.1,3.2,92.11c2.14,3.81,8.14,5.34,14.34,5.34a39.63,39.63,0,0,0,4.89-.31l3.44-.5a47.59,47.59,0,0,0,52.19,4.88l3.73,6.19L76.25,111l11.34,10.32L98.92,131.6l-3.54-14.91-3.55-14.91L86.37,105l-3.76-6.24A47.86,47.86,0,0,0,99.36,78.5a2.75,2.75,0,0,0,.56-.35l6.76-6.38C115.34,62.11,115.06,56.35,113.3,53.21ZM51.92,47.86c14.44-8,27.1-12.77,36.69-15a42.26,42.26,0,0,1,8,16C86.39,50.2,73.11,55.26,60.47,62ZM13.28,59.42a42.64,42.64,0,0,1,.86-8.51A129.15,129.15,0,0,1,37.46,34.19l7.08,11.75C32.88,52.77,22,60.63,14.22,68.24A42.1,42.1,0,0,1,13.28,59.42ZM107.2,33.64c1,1.82,0,6.1-5.7,12.72a47.38,47.38,0,0,0-7.06-14.64C101.43,30.72,106,31.46,107.2,33.64ZM55.66,17A42.21,42.21,0,0,1,84.42,28.38C73.62,31.33,61.1,36.72,49.17,43.3l-7-11.67c1-.55,2.06-1.13,3.07-1.64a2.66,2.66,0,1,0-2.41-4.75c-1.12.57-2.27,1.21-3.41,1.82l-3.17-5.25A42.06,42.06,0,0,1,55.66,17Zm-24,7.5,3.07,5.09A151.53,151.53,0,0,0,17.53,41.05,42.57,42.57,0,0,1,31.64,24.54ZM5.51,64.07c-.41-.73-.12-2.87,2.54-6.5C8,58.19,8,58.79,8,59.42a49.12,49.12,0,0,0,.39,5.85C6.89,65.08,5.83,64.65,5.51,64.07ZM7.84,89.51c-1.14-2,.29-5.92,4.17-10.9A47.81,47.81,0,0,0,20.84,92C13.67,92.68,8.71,91.05,7.84,89.51Zm47.82,12.28A42.39,42.39,0,0,1,16,74.09c6.64-7,17.15-15.31,31.33-23.59l8.52,14.13a154.61,154.61,0,0,0-17.08,11.3,2.65,2.65,0,0,0-.49,3.73,2.66,2.66,0,0,0,3.73.49,149.51,149.51,0,0,1,16.59-11L75.29,96.94A42.15,42.15,0,0,1,55.66,101.79Zm24.18-7.62L63.22,66.6C77.41,59,89.47,55.1,97.65,54A41.86,41.86,0,0,1,79.84,94.17Zm23-26.12-.4.37a47.6,47.6,0,0,0,.88-9,46.66,46.66,0,0,0-.38-5.71c3,.12,5,.85,5.68,2.11C109.63,57.53,108.57,61.69,102.88,68.05Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 114.29 131.6"><defs><style>.cls-1{fill:#fff;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M113.3,53.21c-1.32-2.35-3.75-3.73-6.91-4.38,6-7.34,7.9-13.46,5.45-17.8C108.91,25.8,100.9,24.94,90.53,27a47.56,47.56,0,0,0-57.08-9.73L23.83,1.28A2.67,2.67,0,0,0,19.27,4L28.87,20A47.76,47.76,0,0,0,9.36,48.11l-.63.61C1.09,56.34-1.55,62.39.87,66.68c1.29,2.31,3.82,3.64,7.52,4h.24a2.56,2.56,0,0,0,.68-.13c.18.74.36,1.49.57,2.22C3.38,80.2.39,87.1,3.2,92.11c2.14,3.81,8.14,5.34,14.34,5.34a39.63,39.63,0,0,0,4.89-.31l3.44-.5a47.59,47.59,0,0,0,52.19,4.88l3.73,6.19L76.25,111l11.34,10.32L98.92,131.6l-3.54-14.91-3.55-14.91L86.37,105l-3.76-6.24A47.86,47.86,0,0,0,99.36,78.5a2.75,2.75,0,0,0,.56-.35l6.76-6.38C115.34,62.11,115.06,56.35,113.3,53.21ZM51.92,47.86c14.44-8,27.1-12.77,36.69-15a42.26,42.26,0,0,1,8,16C86.39,50.2,73.11,55.26,60.47,62ZM13.28,59.42a42.64,42.64,0,0,1,.86-8.51A129.15,129.15,0,0,1,37.46,34.19l7.08,11.75C32.88,52.77,22,60.63,14.22,68.24A42.1,42.1,0,0,1,13.28,59.42ZM107.2,33.64c1,1.82,0,6.1-5.7,12.72a47.38,47.38,0,0,0-7.06-14.64C101.43,30.72,106,31.46,107.2,33.64ZM55.66,17A42.21,42.21,0,0,1,84.42,28.38C73.62,31.33,61.1,36.72,49.17,43.3l-7-11.67c1-.55,2.06-1.13,3.07-1.64a2.66,2.66,0,1,0-2.41-4.75c-1.12.57-2.27,1.21-3.41,1.82l-3.17-5.25A42.06,42.06,0,0,1,55.66,17Zm-24,7.5,3.07,5.09A151.53,151.53,0,0,0,17.53,41.05,42.57,42.57,0,0,1,31.64,24.54ZM5.51,64.07c-.41-.73-.12-2.87,2.54-6.5C8,58.19,8,58.79,8,59.42a49.12,49.12,0,0,0,.39,5.85C6.89,65.08,5.83,64.65,5.51,64.07ZM7.84,89.51c-1.14-2,.29-5.92,4.17-10.9A47.81,47.81,0,0,0,20.84,92C13.67,92.68,8.71,91.05,7.84,89.51Zm47.82,12.28A42.39,42.39,0,0,1,16,74.09c6.64-7,17.15-15.31,31.33-23.59l8.52,14.13a154.61,154.61,0,0,0-17.08,11.3,2.65,2.65,0,0,0-.49,3.73,2.66,2.66,0,0,0,3.73.49,149.51,149.51,0,0,1,16.59-11L75.29,96.94A42.15,42.15,0,0,1,55.66,101.79Zm24.18-7.62L63.22,66.6C77.41,59,89.47,55.1,97.65,54A41.86,41.86,0,0,1,79.84,94.17Zm23-26.12-.4.37a47.6,47.6,0,0,0,.88-9,46.66,46.66,0,0,0-.38-5.71c3,.12,5,.85,5.68,2.11C109.63,57.53,108.57,61.69,102.88,68.05Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 363.76 83.19"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path d="M126.74,64.13h-9V16.62H101.46V8.87H143v7.75H126.74Z"/><path d="M172.1,42.06V64.13h-9V8.87h15.61q10.69,0,15.83,4T199.65,25q0,10.32-10.73,14.71l15.61,24.45H194.25L181,42.06Zm0-7.49h6.27q6.31,0,9.15-2.34t2.83-6.95q0-4.7-3.06-6.73t-9.22-2h-6Z"/><path d="M224.15,64.13V8.87h9V64.13Z"/><path d="M308.43,36.42q0,10.06-3.84,16.94A21,21,0,0,1,293.43,63l13.22,14.25H294.48l-10.43-12.4h-1.47q-12.51,0-19.22-7.42t-6.71-21.11q0-13.68,6.75-21T282.66,8q12.31,0,19,7.44T308.43,36.42Zm-42.18,0q0,10.21,4.12,15.48t12.21,5.27q8.06,0,12.15-5.21t4.1-15.54q0-10.16-4.06-15.41t-12.11-5.26q-8.13,0-12.27,5.26T266.25,36.42Z"/><path d="M363.76,49.12a13.89,13.89,0,0,1-5.33,11.57q-5.32,4.19-14.7,4.19T328.39,62V53.43a41.41,41.41,0,0,0,8,2.8,34.08,34.08,0,0,0,7.92,1c3.58,0,6.21-.68,7.92-2a6.66,6.66,0,0,0,2.55-5.48,6.86,6.86,0,0,0-2.35-5.26q-2.34-2.14-9.67-5.1-7.56-3.06-10.66-7a14.83,14.83,0,0,1-3.1-9.45A13.22,13.22,0,0,1,334,12.05q4.91-4,13.18-4a38.7,38.7,0,0,1,15.8,3.48l-2.87,7.37a34.44,34.44,0,0,0-13.15-3.1c-2.93,0-5.14.64-6.65,1.91a6.23,6.23,0,0,0-2.27,5,7.06,7.06,0,0,0,.91,3.69,9.28,9.28,0,0,0,3,2.89A51.93,51.93,0,0,0,349.36,33a41,41,0,0,1,8.92,4.72,13.86,13.86,0,0,1,4.16,4.95A14.93,14.93,0,0,1,363.76,49.12Z"/><path d="M71.62,33.64a6.07,6.07,0,0,0-4.37-2.77c3.79-4.65,5-8.51,3.45-11.26-1.86-3.3-6.92-3.85-13.48-2.58a30.06,30.06,0,0,0-36.08-6.14L15.07.81a1.69,1.69,0,0,0-2.89,1.74l6.07,10.06A30.19,30.19,0,0,0,5.92,30.41c-.13.13-.28.26-.4.39C.69,35.61-1,39.44.55,42.15c.82,1.46,2.42,2.3,4.75,2.51h.15a1.63,1.63,0,0,0,.44-.08c.11.47.22,1,.36,1.41C2.13,50.7.24,55.06,2,58.23c1.34,2.4,5.14,3.37,9.06,3.37a26.42,26.42,0,0,0,3.09-.19l2.18-.32a30.1,30.1,0,0,0,33,3.09l2.36,3.9-3.5,2.07,7.17,6.52,7.16,6.52-2.24-9.43-2.24-9.42-3.45,2-2.38-3.94A30.23,30.23,0,0,0,62.81,49.62a1.59,1.59,0,0,0,.35-.22l4.28-4C72.91,39.26,72.74,35.62,71.62,33.64Zm-38.8-3.38C42,25.23,50,22.18,56,20.75a26.7,26.7,0,0,1,5.07,10.09c-6.47.89-14.86,4.09-22.86,8.37ZM8.4,37.56a26.54,26.54,0,0,1,.54-5.38A82,82,0,0,1,23.68,21.61L28.16,29A102.18,102.18,0,0,0,9,43.14,27,27,0,0,1,8.4,37.56Zm59.37-16.3c.65,1.16,0,3.86-3.61,8a30.24,30.24,0,0,0-4.46-9.25C64.12,19.42,67,19.89,67.77,21.26ZM35.18,10.77a26.67,26.67,0,0,1,18.18,7.17,106.81,106.81,0,0,0-22.28,9.43L26.63,20c.65-.34,1.3-.71,1.94-1a1.69,1.69,0,0,0-1.52-3c-.71.36-1.44.77-2.16,1.16l-2-3.32A26.53,26.53,0,0,1,35.18,10.77ZM20,15.52l1.94,3.21A97,97,0,0,0,11.08,26,26.9,26.9,0,0,1,20,15.52ZM3.48,40.5c-.26-.46-.07-1.81,1.61-4.11,0,.39-.06.78-.06,1.17a30.12,30.12,0,0,0,.25,3.7A2.5,2.5,0,0,1,3.48,40.5ZM5,56.58c-.73-1.29.18-3.74,2.63-6.89a30.18,30.18,0,0,0,5.58,8.43C8.64,58.58,5.51,57.56,5,56.58Zm30.22,7.77A26.8,26.8,0,0,1,10.09,46.84c4.19-4.41,10.84-9.68,19.8-14.92l5.39,8.93A98.15,98.15,0,0,0,24.48,48a1.68,1.68,0,0,0,1,3,1.71,1.71,0,0,0,1-.34A94,94,0,0,1,37,43.73L47.59,61.28A26.6,26.6,0,0,1,35.18,64.35Zm15.29-4.82L40,42.1c9-4.8,16.6-7.27,21.77-8A27.66,27.66,0,0,1,62,37.56,26.77,26.77,0,0,1,50.47,59.53ZM65,43l-.25.23a30.41,30.41,0,0,0,.55-5.69A30.82,30.82,0,0,0,65.1,34c1.88.08,3.14.54,3.59,1.34C69.3,36.37,68.63,39,65,43Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 363.76 83.19"><defs><style>.cls-1{fill:#1067bf;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path d="M126.74,64.13h-9V16.62H101.46V8.87H143v7.75H126.74Z"/><path d="M172.1,42.06V64.13h-9V8.87h15.61q10.69,0,15.83,4T199.65,25q0,10.32-10.73,14.71l15.61,24.45H194.25L181,42.06Zm0-7.49h6.27q6.31,0,9.15-2.34t2.83-6.95q0-4.7-3.06-6.73t-9.22-2h-6Z"/><path d="M224.15,64.13V8.87h9V64.13Z"/><path d="M308.43,36.42q0,10.06-3.84,16.94A21,21,0,0,1,293.43,63l13.22,14.25H294.48l-10.43-12.4h-1.47q-12.51,0-19.22-7.42t-6.71-21.11q0-13.68,6.75-21T282.66,8q12.31,0,19,7.44T308.43,36.42Zm-42.18,0q0,10.21,4.12,15.48t12.21,5.27q8.06,0,12.15-5.21t4.1-15.54q0-10.16-4.06-15.41t-12.11-5.26q-8.13,0-12.27,5.26T266.25,36.42Z"/><path d="M363.76,49.12a13.89,13.89,0,0,1-5.33,11.57q-5.32,4.19-14.7,4.19T328.39,62V53.43a41.41,41.41,0,0,0,8,2.8,34.08,34.08,0,0,0,7.92,1c3.58,0,6.21-.68,7.92-2a6.66,6.66,0,0,0,2.55-5.48,6.86,6.86,0,0,0-2.35-5.26q-2.34-2.14-9.67-5.1-7.56-3.06-10.66-7a14.83,14.83,0,0,1-3.1-9.45A13.22,13.22,0,0,1,334,12.05q4.91-4,13.18-4a38.7,38.7,0,0,1,15.8,3.48l-2.87,7.37a34.44,34.44,0,0,0-13.15-3.1c-2.93,0-5.14.64-6.65,1.91a6.23,6.23,0,0,0-2.27,5,7.06,7.06,0,0,0,.91,3.69,9.28,9.28,0,0,0,3,2.89A51.93,51.93,0,0,0,349.36,33a41,41,0,0,1,8.92,4.72,13.86,13.86,0,0,1,4.16,4.95A14.93,14.93,0,0,1,363.76,49.12Z"/><path class="cls-1" d="M71.62,33.64a6.07,6.07,0,0,0-4.37-2.77c3.79-4.65,5-8.51,3.45-11.26-1.86-3.3-6.92-3.85-13.48-2.58a30.06,30.06,0,0,0-36.08-6.14L15.07.81a1.69,1.69,0,0,0-2.89,1.74l6.07,10.06A30.19,30.19,0,0,0,5.92,30.41c-.13.13-.28.26-.4.39C.69,35.61-1,39.44.55,42.15c.82,1.46,2.42,2.3,4.75,2.51h.15a1.63,1.63,0,0,0,.44-.08c.11.47.22,1,.36,1.41C2.13,50.7.24,55.06,2,58.23c1.34,2.4,5.14,3.37,9.06,3.37a26.42,26.42,0,0,0,3.09-.19l2.18-.32a30.1,30.1,0,0,0,33,3.09l2.36,3.9-3.5,2.07,7.17,6.52,7.16,6.52-2.24-9.43-2.24-9.42-3.45,2-2.38-3.94A30.23,30.23,0,0,0,62.81,49.62a1.59,1.59,0,0,0,.35-.22l4.28-4C72.91,39.26,72.74,35.62,71.62,33.64Zm-38.8-3.38C42,25.23,50,22.18,56,20.75a26.7,26.7,0,0,1,5.07,10.09c-6.47.89-14.86,4.09-22.86,8.37ZM8.4,37.56a26.54,26.54,0,0,1,.54-5.38A82,82,0,0,1,23.68,21.61L28.16,29A102.18,102.18,0,0,0,9,43.14,27,27,0,0,1,8.4,37.56Zm59.37-16.3c.65,1.16,0,3.86-3.61,8a30.24,30.24,0,0,0-4.46-9.25C64.12,19.42,67,19.89,67.77,21.26ZM35.18,10.77a26.67,26.67,0,0,1,18.18,7.17,106.81,106.81,0,0,0-22.28,9.43L26.63,20c.65-.34,1.3-.71,1.94-1a1.69,1.69,0,0,0-1.52-3c-.71.36-1.44.77-2.16,1.16l-2-3.32A26.53,26.53,0,0,1,35.18,10.77ZM20,15.52l1.94,3.21A97,97,0,0,0,11.08,26,26.9,26.9,0,0,1,20,15.52ZM3.48,40.5c-.26-.46-.07-1.81,1.61-4.11,0,.39-.06.78-.06,1.17a30.12,30.12,0,0,0,.25,3.7A2.5,2.5,0,0,1,3.48,40.5ZM5,56.58c-.73-1.29.18-3.74,2.63-6.89a30.18,30.18,0,0,0,5.58,8.43C8.64,58.58,5.51,57.56,5,56.58Zm30.22,7.77A26.8,26.8,0,0,1,10.09,46.84c4.19-4.41,10.84-9.68,19.8-14.92l5.39,8.93A98.15,98.15,0,0,0,24.48,48a1.68,1.68,0,0,0,1,3,1.71,1.71,0,0,0,1-.34A94,94,0,0,1,37,43.73L47.59,61.28A26.6,26.6,0,0,1,35.18,64.35Zm15.29-4.82L40,42.1c9-4.8,16.6-7.27,21.77-8A27.66,27.66,0,0,1,62,37.56,26.77,26.77,0,0,1,50.47,59.53ZM65,43l-.25.23a30.41,30.41,0,0,0,.55-5.69A30.82,30.82,0,0,0,65.1,34c1.88.08,3.14.54,3.59,1.34C69.3,36.37,68.63,39,65,43Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 363.76 83.19"><defs><style>.cls-1{fill:#fff;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M126.74,64.13h-9V16.62H101.46V8.87H143v7.75H126.74Z"/><path class="cls-1" d="M172.1,42.06V64.13h-9V8.87h15.61q10.69,0,15.83,4T199.65,25q0,10.32-10.73,14.71l15.61,24.45H194.25L181,42.06Zm0-7.49h6.27q6.31,0,9.15-2.34t2.83-6.95q0-4.7-3.06-6.73t-9.22-2h-6Z"/><path class="cls-1" d="M224.15,64.13V8.87h9V64.13Z"/><path class="cls-1" d="M308.43,36.42q0,10.06-3.84,16.94A21,21,0,0,1,293.43,63l13.22,14.25H294.48l-10.43-12.4h-1.47q-12.51,0-19.22-7.42t-6.71-21.11q0-13.68,6.75-21T282.66,8q12.31,0,19,7.44T308.43,36.42Zm-42.18,0q0,10.21,4.12,15.48t12.21,5.27q8.06,0,12.15-5.21t4.1-15.54q0-10.16-4.06-15.41t-12.11-5.26q-8.13,0-12.27,5.26T266.25,36.42Z"/><path class="cls-1" d="M363.76,49.12a13.89,13.89,0,0,1-5.33,11.57q-5.32,4.19-14.7,4.19T328.39,62V53.43a41.41,41.41,0,0,0,8,2.8,34.08,34.08,0,0,0,7.92,1c3.58,0,6.21-.68,7.92-2a6.66,6.66,0,0,0,2.55-5.48,6.86,6.86,0,0,0-2.35-5.26q-2.34-2.14-9.67-5.1-7.56-3.06-10.66-7a14.83,14.83,0,0,1-3.1-9.45A13.22,13.22,0,0,1,334,12.05q4.91-4,13.18-4a38.7,38.7,0,0,1,15.8,3.48l-2.87,7.37a34.44,34.44,0,0,0-13.15-3.1c-2.93,0-5.14.64-6.65,1.91a6.23,6.23,0,0,0-2.27,5,7.06,7.06,0,0,0,.91,3.69,9.28,9.28,0,0,0,3,2.89A51.93,51.93,0,0,0,349.36,33a41,41,0,0,1,8.92,4.72,13.86,13.86,0,0,1,4.16,4.95A14.93,14.93,0,0,1,363.76,49.12Z"/><path class="cls-1" d="M71.62,33.64a6.07,6.07,0,0,0-4.37-2.77c3.79-4.65,5-8.51,3.45-11.26-1.86-3.3-6.92-3.85-13.48-2.58a30.06,30.06,0,0,0-36.08-6.14L15.07.81a1.69,1.69,0,0,0-2.89,1.74l6.07,10.06A30.19,30.19,0,0,0,5.92,30.41c-.13.13-.28.26-.4.39C.69,35.61-1,39.44.55,42.15c.82,1.46,2.42,2.3,4.75,2.51h.15a1.63,1.63,0,0,0,.44-.08c.11.47.22,1,.36,1.41C2.13,50.7.24,55.06,2,58.23c1.34,2.4,5.14,3.37,9.06,3.37a26.42,26.42,0,0,0,3.09-.19l2.18-.32a30.1,30.1,0,0,0,33,3.09l2.36,3.9-3.5,2.07,7.17,6.52,7.16,6.52-2.24-9.43-2.24-9.42-3.45,2-2.38-3.94A30.23,30.23,0,0,0,62.81,49.62a1.59,1.59,0,0,0,.35-.22l4.28-4C72.91,39.26,72.74,35.62,71.62,33.64Zm-38.8-3.38C42,25.23,50,22.18,56,20.75a26.7,26.7,0,0,1,5.07,10.09c-6.47.89-14.86,4.09-22.86,8.37ZM8.4,37.56a26.54,26.54,0,0,1,.54-5.38A82,82,0,0,1,23.68,21.61L28.16,29A102.18,102.18,0,0,0,9,43.14,27,27,0,0,1,8.4,37.56Zm59.37-16.3c.65,1.16,0,3.86-3.61,8a30.24,30.24,0,0,0-4.46-9.25C64.12,19.42,67,19.89,67.77,21.26ZM35.18,10.77a26.67,26.67,0,0,1,18.18,7.17,106.81,106.81,0,0,0-22.28,9.43L26.63,20c.65-.34,1.3-.71,1.94-1a1.69,1.69,0,0,0-1.52-3c-.71.36-1.44.77-2.16,1.16l-2-3.32A26.53,26.53,0,0,1,35.18,10.77ZM20,15.52l1.94,3.21A97,97,0,0,0,11.08,26,26.9,26.9,0,0,1,20,15.52ZM3.48,40.5c-.26-.46-.07-1.81,1.61-4.11,0,.39-.06.78-.06,1.17a30.12,30.12,0,0,0,.25,3.7A2.5,2.5,0,0,1,3.48,40.5ZM5,56.58c-.73-1.29.18-3.74,2.63-6.89a30.18,30.18,0,0,0,5.58,8.43C8.64,58.58,5.51,57.56,5,56.58Zm30.22,7.77A26.8,26.8,0,0,1,10.09,46.84c4.19-4.41,10.84-9.68,19.8-14.92l5.39,8.93A98.15,98.15,0,0,0,24.48,48a1.68,1.68,0,0,0,1,3,1.71,1.71,0,0,0,1-.34A94,94,0,0,1,37,43.73L47.59,61.28A26.6,26.6,0,0,1,35.18,64.35Zm15.29-4.82L40,42.1c9-4.8,16.6-7.27,21.77-8A27.66,27.66,0,0,1,62,37.56,26.77,26.77,0,0,1,50.47,59.53ZM65,43l-.25.23a30.41,30.41,0,0,0,.55-5.69A30.82,30.82,0,0,0,65.1,34c1.88.08,3.14.54,3.59,1.34C69.3,36.37,68.63,39,65,43Z"/></g></g></svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
doc/_static/triqs_logo/triqs_favicon.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,29 @@
{{ fullname | escape | underline }}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}
.. autosummary::
:toctree:
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}
.. autosummary::
:toctree:
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,68 @@
{{ fullname | escape | underline}}
.. automodule:: {{ fullname }}
{% block functions %}
{% if functions %}
.. rubric:: Functions
.. autosummary::
:toctree:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block attributes %}
{% if attributes %}
.. rubric:: Module Attributes
.. autosummary::
:toctree:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}
.. autosummary::
:toctree:
:template: autosummary_class_template.rst
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}
.. autosummary::
:toctree:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% block modules %}
{% if modules %}
.. rubric:: Modules
.. autosummary::
:toctree:
:template: autosummary_module_template.rst
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

14
doc/_templates/sideb.html vendored Normal file
View File

@ -0,0 +1,14 @@
<p style="background-color:white;">
<a href="http://ipht.cea.fr"> <img style="width: 80px; margin: 10px 5px 0 0" src='_static/logo_cea.png' alt="CEA"/> </a>
<a href="http://www.cpht.polytechnique.fr"> <img style="width: 80px; margin: 10px 5px 0 5px" src='_static/logo_x.png' alt="Ecole Polytechnique"/> </a>
<br>
<a href="http://www.cnrs.fr"> <img style="width: 80px; margin: 10px 0 0 5px" src='_static/logo_cnrs.png' alt="CNRS"/> </a>
<img style="width: 80px; margin: 10px 0 0 5px" src='_static/logo_erc.jpg' alt="ERC"/>
<a href="https://www.simonsfoundation.org/flatiron"> <img style="width: 200px; margin: 10px 0 0 5px" src='http://itensor.org/flatiron_logo.png' alt="Flatiron Institute"/> </a>
<br>
<a href="https://www.simonsfoundation.org"> <img style="width: 200px; margin: 10px 0 0 5px" src='http://itensor.org/simons_found_logo.jpg' alt="Simons Foundation"/> </a>
</p>
<hr>
<p>
<a href="https://github.com/triqs/app4triqs"> <img style="width: 200px; margin: 10px 0 0 5px" src='_static/logo_github.png' alt="Visit the project on GitHub"/> </a>
</p>

8
doc/about.rst Normal file
View File

@ -0,0 +1,8 @@
.. _about:
About app4triqs
***************
An example application using ``cpp2py`` and TRIQS.
Written and maintained by N. Wentzell with contributions from H. U.R. Strand.

144
doc/conf.py.in Normal file
View File

@ -0,0 +1,144 @@
# -*- coding: utf-8 -*-
#
# TRIQS documentation build configuration file
import sys
sys.path.insert(0, "@CMAKE_CURRENT_SOURCE_DIR@/sphinxext")
# exclude these folders from scanning by sphinx
exclude_patterns = ['_templates']
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.mathjax',
'sphinx.ext.intersphinx',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx.ext.autosummary',
'sphinx.ext.githubpages',
'sphinx_autorun',
'nbsphinx',
'myst_parser',
'matplotlib.sphinxext.plot_directive',
'numpydoc']
myst_enable_extensions = [
"amsmath",
"colon_fence",
"deflist",
"dollarmath",
"html_admonition",
"html_image",
"linkify",
"replacements",
"smartquotes",
"substitution",
"tasklist",
]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
source_suffix = '.rst'
# Turn on sphinx.ext.autosummary
autosummary_generate = True
autosummary_imported_members=False
project = '@PROJECT_NAME@'
version = '@PROJECT_VERSION@'
# this makes the current project version available as var in every rst file
rst_epilog = """
.. |PROJECT_VERSION| replace:: {version}
""".format(
version = version,
)
copyright = '2018-2021 The Simons Foundation, authors: A. Hampel, O. Parcollet, D. Simons, H. Strand, N. Wentzell'
mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=default"
templates_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_templates']
# this requires the sphinx_rtd_theme to be installed via pip
html_theme = 'sphinx_rtd_theme'
# this loads the custom css file to change the page width
html_style = 'css/custom.css'
html_favicon = '@CMAKE_CURRENT_SOURCE_DIR@/_static/triqs_logo/triqs_favicon.ico'
#html_logo = '@CMAKE_CURRENT_SOURCE_DIR@/logos/logo.png'
# options for the the rtd theme
html_theme_options = {
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
'vcs_pageview_mode': '',
'style_nav_header_background': '#7E588A',
# Toc options
'collapse_navigation': False,
'sticky_navigation': True,
'navigation_depth': 5,
'includehidden': True,
'titles_only': False
}
html_show_sphinx = False
html_context = {'header_title': '@PROJECT_NAME@'}
html_static_path = ['@CMAKE_CURRENT_SOURCE_DIR@/_static']
html_sidebars = {'index': ['sideb.html', 'searchbox.html']}
htmlhelp_basename = '@PROJECT_NAME@doc'
# Plot options
plot_include_source = True
plot_html_show_source_link = False
plot_html_show_formats = False
intersphinx_mapping = {'python': ('https://docs.python.org/3.11', None), 'triqslibs': ('https://triqs.github.io/triqs/latest', None)}
# open links in new tab instead of same window
from sphinx.writers.html import HTMLTranslator
from docutils import nodes
from docutils.nodes import Element
class PatchedHTMLTranslator(HTMLTranslator):
def visit_reference(self, node: Element) -> None:
atts = {'class': 'reference'}
if node.get('internal') or 'refuri' not in node:
atts['class'] += ' internal'
else:
atts['class'] += ' external'
# ---------------------------------------------------------
# Customize behavior (open in new tab, secure linking site)
atts['target'] = '_blank'
atts['rel'] = 'noopener noreferrer'
# ---------------------------------------------------------
if 'refuri' in node:
atts['href'] = node['refuri'] or '#'
if self.settings.cloak_email_addresses and atts['href'].startswith('mailto:'):
atts['href'] = self.cloak_mailto(atts['href'])
self.in_mailto = True
else:
assert 'refid' in node, \
'References must have "refuri" or "refid" attribute.'
atts['href'] = '#' + node['refid']
if not isinstance(node.parent, nodes.TextElement):
assert len(node) == 1 and isinstance(node[0], nodes.image)
atts['class'] += ' image-reference'
if 'reftitle' in node:
atts['title'] = node['reftitle']
if 'target' in node:
atts['target'] = node['target']
self.body.append(self.starttag(node, 'a', '', **atts))
if node.get('secnumber'):
self.body.append(('%s' + self.secnumber_suffix) %
'.'.join(map(str, node['secnumber'])))
def setup(app):
app.set_translator('html', PatchedHTMLTranslator)

29
doc/documentation.rst Normal file
View File

@ -0,0 +1,29 @@
.. _documentation:
Documentation
*************
.. math::
(a + b)^2 &= (a + b)(a + b) \\
&= a^2 + 2ab + b^2
C++ reference manual
====================
.. toctree::
:maxdepth: 5
cpp2rst_generated/contents
Python reference manual
=======================
.. autosummary::
:toctree: _autosummary
:template: autosummary_module_template.rst
:recursive:
app4triqs

33
doc/index.rst Normal file
View File

@ -0,0 +1,33 @@
.. _welcome:
app4triqs
*********
.. sidebar:: app4triqs |PROJECT_VERSION|
This is the homepage of app4triqs |PROJECT_VERSION|.
For changes see the :ref:`changelog page <changelog>`.
.. image:: _static/logo_github.png
:width: 75%
:align: center
:target: https://github.com/triqs/app4triqs
An example application using cpp2py and :ref:`TRIQS <triqslibs:welcome>`.
This documentation is generated based on `rst <https://de.wikipedia.org/wiki/ReStructuredText>`_ files
and the comments in the sources and headers.
Learn how to use app4triqs in the :ref:`documentation`.
.. toctree::
:maxdepth: 2
:hidden:
install
documentation
issues
ChangeLog.md
about

77
doc/install.rst Normal file
View File

@ -0,0 +1,77 @@
.. highlight:: bash
.. _install:
Install app4triqs
*******************
Compiling app4triqs from source
===============================
.. note:: To guarantee reproducibility in scientific calculations we strongly recommend the use of a stable `release <https://github.com/TRIQS/triqs/releases>`_ of both TRIQS and its applications.
Prerequisites
-------------
#. The :ref:`TRIQS <triqslibs:welcome>` library, see :ref:`TRIQS installation instruction <triqslibs:installation>`.
In the following, we assume that TRIQS is installed in the directory ``path_to_triqs``.
Installation steps
------------------
#. Download the source code of the latest stable version by cloning the ``TRIQS/app4triqs`` repository from GitHub::
$ git clone https://github.com/TRIQS/app4triqs app4triqs.src
#. Create and move to a new directory where you will compile the code::
$ mkdir app4triqs.build && cd app4triqs.build
#. Ensure that your shell contains the TRIQS environment variables by sourcing the ``triqsvars.sh`` file from your TRIQS installation::
$ source path_to_triqs/share/triqs/triqsvars.sh
#. In the build directory call cmake, including any additional custom CMake options, see below::
$ cmake ../app4triqs.src
#. Compile the code, run the tests and install the application::
$ make
$ make test
$ make install
Version compatibility
---------------------
Keep in mind that the version of ``app4triqs`` must be compatible with your TRIQS library version,
see :ref:`TRIQS website <triqslibs:versions>`.
In particular the Major and Minor Version numbers have to be the same.
To use a particular version, go into the directory with the sources, and look at all available versions::
$ cd app4triqs.src && git tag
Checkout the version of the code that you want::
$ git checkout 2.1.0
and follow steps 2 to 4 above to compile the code.
Custom CMake options
--------------------
The compilation of ``app4triqs`` can be configured using CMake-options::
cmake ../app4triqs.src -DOPTION1=value1 -DOPTION2=value2 ...
+-----------------------------------------------------------------+-----------------------------------------------+
| Options | Syntax |
+=================================================================+===============================================+
| Specify an installation path other than path_to_triqs | -DCMAKE_INSTALL_PREFIX=path_to_app4triqs |
+-----------------------------------------------------------------+-----------------------------------------------+
| Build in Debugging Mode | -DCMAKE_BUILD_TYPE=Debug |
+-----------------------------------------------------------------+-----------------------------------------------+
| Disable testing (not recommended) | -DBuild_Tests=OFF |
+-----------------------------------------------------------------+-----------------------------------------------+
| Build the documentation | -DBuild_Documentation=ON |
+-----------------------------------------------------------------+-----------------------------------------------+

23
doc/issues.rst Normal file
View File

@ -0,0 +1,23 @@
.. _issues:
Reporting issues
****************
Please report all problems and bugs directly at the github issue page
`<https://github.com/TRIQS/app4triqs/issues>`_. In order to make it easier for us
to solve the issue please follow these guidelines:
#. In all cases specify which version of the application you are using. You can
find the version number in the file :file:`CMakeLists.txt` at the root of the
application sources.
#. If you have a problem during the installation, give us information about
your operating system and the compiler you are using. Include the outputs of
the ``cmake`` and ``make`` commands as well as the ``CMakeCache.txt`` file
which is in the build directory. Please include these outputs in a
`gist <http://gist.github.com/>`_ file referenced in the issue.
#. If you are experiencing a problem during the execution of the application, provide
a script which allows to quickly reproduce the problem.
Thanks!

View File

@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-
"""
sphinxcontirb.autorun
~~~~~~~~~~~~~~~~~~~~~~
Run the code and insert stdout after the code block.
"""
import os
from subprocess import PIPE, Popen
from docutils import nodes
from docutils.parsers.rst import Directive, directives
from sphinx.errors import SphinxError
from sphinx_autorun import version
__version__ = version.version
class RunBlockError(SphinxError):
category = 'runblock error'
class AutoRun(object):
here = os.path.abspath(__file__)
pycon = os.path.join(os.path.dirname(here), 'pycon.py')
config = {
'pycon': 'python ' + pycon,
'pycon_prefix_chars': 4,
'pycon_show_source': False,
'console': 'bash',
'console_prefix_chars': 1,
}
@classmethod
def builder_init(cls, app):
cls.config.update(app.builder.config.autorun_languages)
class RunBlock(Directive):
has_content = True
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = False
option_spec = {
'linenos': directives.flag,
}
def run(self):
config = AutoRun.config
language = self.arguments[0]
if language not in config:
raise RunBlockError('Unknown language %s' % language)
# Get configuration values for the language
args = config[language].split()
input_encoding = config.get(language+'_input_encoding', 'utf8')
output_encoding = config.get(language+'_output_encoding', 'utf8')
prefix_chars = config.get(language+'_prefix_chars', 0)
show_source = config.get(language+'_show_source', True)
# Build the code text
proc = Popen(args, bufsize=1, stdin=PIPE, stdout=PIPE, stderr=PIPE)
codelines = (line[prefix_chars:] for line in self.content)
code = u'\n'.join(codelines).encode(input_encoding)
# Run the code
stdout, stderr = proc.communicate(code)
# Process output
if stdout:
out = stdout.decode(output_encoding)
if stderr:
out = stderr.decode(output_encoding)
# Get the original code with prefixes
if show_source:
code = u'\n'.join(self.content)
code_out = u'\n'.join((code, out))
else:
code_out = out
literal = nodes.literal_block(code_out, code_out)
literal['language'] = language
literal['linenos'] = 'linenos' in self.options
return [literal]
def setup(app):
app.add_directive('runblock', RunBlock)
app.connect('builder-inited', AutoRun.builder_init)
app.add_config_value('autorun_languages', AutoRun.config, 'env')

View File

@ -0,0 +1,31 @@
import sys
from code import InteractiveInterpreter
def main():
"""
Print lines of input along with output.
"""
source_lines = (line.rstrip() for line in sys.stdin)
console = InteractiveInterpreter()
source = ''
try:
while True:
source = next(source_lines)
# Allow the user to ignore specific lines of output.
if not source.endswith('# ignore'):
print('>>>', source)
more = console.runsource(source)
while more:
next_line = next(source_lines)
print('...', next_line)
source += '\n' + next_line
more = console.runsource(source)
except StopIteration:
if more:
print('... ')
more = console.runsource(source + '\n')
if __name__ == '__main__':
main()

View File

@ -0,0 +1,4 @@
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
version = '1.1.1'

View File

@ -0,0 +1,123 @@
import tempfile
# -*- coding: utf-8 -*-
# seems to be executed at the level of the conf.py
# so we need to link the lib at that place...
"""
"""
import os
import codecs
from os import path
from subprocess import Popen,PIPE
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
from sphinx.errors import SphinxError
class TriqsExampleError(SphinxError):
category = 'triqs_example error'
class TriqsExampleRun:
#here = os.path.abspath(__file__)
#pycon = os.path.join(os.path.dirname(here),'pycon.py')
config = dict(
)
@classmethod
def builder_init(cls,app):
#cls.config.update(app.builder.config.autorun_languages)
#cls.config.update(app.builder.config.autocompile_opts)
pass
class TriqsExample(Directive):
has_content = True
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = False
option_spec = {
'linenos': directives.flag,
}
def run(self):
document = self.state.document
filename = self.arguments[0]
if not document.settings.file_insertion_enabled:
return [document.reporter.warning('File insertion disabled',
line=self.lineno)]
env = document.settings.env
if filename.startswith('/') or filename.startswith(os.sep):
rel_fn = filename[1:]
else:
docdir = path.dirname(env.doc2path(env.docname, base=None))
rel_fn = path.normpath(path.join(docdir, filename))
try:
fn = path.join(env.srcdir, rel_fn)
except UnicodeDecodeError:
# the source directory is a bytestring with non-ASCII characters;
# let's try to encode the rel_fn in the file system encoding
rel_fn = rel_fn.encode(sys.getfilesystemencoding())
fn = path.join(env.srcdir, rel_fn)
encoding = self.options.get('encoding', env.config.source_encoding)
try:
f = codecs.open(fn, 'rU', encoding)
lines = f.readlines()
f.close()
except (IOError, OSError):
return [document.reporter.warning(
'Include file %r not found or reading it failed' % filename,
line=self.lineno)]
except UnicodeError:
return [document.reporter.warning(
'Encoding %r used for reading included file %r seems to '
'be wrong, try giving an :encoding: option' %
(encoding, filename))]
config = TriqsExampleRun.config
# Get configuration values for the language
input_encoding = 'utf8' #config.get(language+'_input_encoding','ascii')
output_encoding = 'utf8' #config.get(language+'_output_encoding','ascii')
show_source = True
# Build the code text
code = ''.join(lines).strip()
filename_clean = filename.rsplit('.',1)[0]
if filename_clean.startswith('./') : filename_clean = filename_clean[2:]
#print "Running the example ....",filename_clean
#print "Root ?", env.doc2path(env.docname, base=None)
import subprocess as S
error = True
try :
stdout =''
#resout = S.check_output("./example_bin/doc_%s"%(filename_clean) ,stderr=S.STDOUT,shell=True)
resout = S.check_output("./%s/doc_%s"%(docdir,filename_clean) ,stderr=S.STDOUT,shell=True)
if resout :
stdout = '---------- Result is -------\n' + resout.strip()
error = False
except S.CalledProcessError as E :
stdout ='---------- RunTime error -------\n'
stdout += E.output
# Process output
if stdout:
stdout = stdout.decode(output_encoding,'ignore')
out = ''.join(stdout).decode(output_encoding)
else:
out = '' #.join(stderr).decode(output_encoding)
# Get the original code with prefixes
code_out = '\n'.join((code,out))
if error : # report on console
print(" Error in processing ")
print(code_out)
literal = nodes.literal_block(code_out,code_out)
literal['language'] = 'c'
literal['linenos'] = 'linenos' in self.options
return [literal]
def setup(app):
app.add_directive('triqs_example', TriqsExample)
app.connect('builder-inited',TriqsExampleRun.builder_init)

52
doc/themes/triqs/layout.html vendored Normal file
View File

@ -0,0 +1,52 @@
{#
layout.html
~~~~~~~~~~~
TRIQS layout template heavily based on the sphinxdoc theme.
:copyright: Copyright 2013 by the TRIQS team.
:copyright: Copyright 2007-2013 by the Sphinx team.
:license: BSD, see LICENSE for details.
#}
{%- extends "basic/layout.html" %}
{# put the sidebar before the body #}
{% block sidebar1 %}{{ sidebar() }}{% endblock %}
{% block sidebar2 %}{% endblock %}
{% block extrahead %}
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,700' rel='stylesheet' type='text/css'>
<script src="{{ pathto('_static/cufon-yui.js',1) }}" type="text/javascript"></script>
<script src="{{ pathto('_static/spaceman.cufonfonts.js',1) }}" type="text/javascript"></script>
<script type="text/javascript">
Cufon.replace('.triqs', { fontFamily: 'spaceman', hover: true });
</script>
{{ super() }}
{%- if not embedded %}
<style type="text/css">
table.right { float: right; margin-left: 20px; }
table.right td { border: 1px solid #ccc; }
{% if pagename == 'index' %}
.related { display: none; }
{% endif %}
</style>
{%- endif %}
{% endblock %}
{% block rootrellink %}
<li><a href="{{ pathto('index') }}">Home</a> &raquo;</li>
{% endblock %}
{% block header %}
<div class="pageheader">
<ul>
{% for header_link in header_links %}
<li><a href="{{ pathto(header_link[1]) }}">{{ header_link[0] }}</a></li>
{% endfor %}
</ul>
<div>
<h1 style="padding:0; margin: 10px 0 0 0;"><a class="triqs" href="{{ pathto('index') }}">{{ header_title }}</a></h1>
<span style="font-size: 14px; margin: 0px; padding: 0px;">{{ header_subtitle }}</span>
</div>
</div>
{% endblock %}

BIN
doc/themes/triqs/static/bodybg.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

7
doc/themes/triqs/static/cufon-yui.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
doc/themes/triqs/static/footerbg.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

BIN
doc/themes/triqs/static/headerbg.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

BIN
doc/themes/triqs/static/listitem.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

BIN
doc/themes/triqs/static/relbg.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

File diff suppressed because one or more lines are too long

449
doc/themes/triqs/static/triqs.css vendored Normal file
View File

@ -0,0 +1,449 @@
/*
* sphinx13.css
* ~~~~~~~~~~~~
*
* Sphinx stylesheet -- sphinx13 theme.
*
* :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: 'Open Sans', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
'Verdana', sans-serif;
font-size: 14px;
text-align: center;
background-image: url(bodybg.png);
color: black;
padding: 0;
border-right: 1px solid #0a507a;
border-left: 1px solid #0a507a;
margin: 0 auto;
min-width: 780px;
max-width: 1080px;
}
.red{
color: red
}
.blue{
color: blue
}
.green{
color: green
}
.param{
color: blue
}
a.triqs {
color: #073958;
text-decoration: none;
}
a.triqs:hover {
color: #0a527f;
text-decoration: none;
}
.pageheader {
background-color: #dcdcdc;
text-align: left;
padding: 10px 15px;
color: #073958;
border: none;
}
.pageheader ul {
float: right;
color: #073958;
list-style-type: none;
padding-left: 0;
margin-top: 22px;
margin-right: 10px;
}
.pageheader li {
float: left;
margin: 0 0 0 10px;
}
.pageheader li a {
padding: 8px 12px;
color: #073958;
text-shadow: none;
}
.pageheader li a:hover {
background-color: #f9f9f0;
color: #0a507a;
text-shadow: none;
}
div.document {
background-color: white;
text-align: left;
}
div.bodywrapper {
margin: 0 240px 0 0;
border-right: 1px solid #0a507a;
}
div.body {
margin: 0;
padding: 0.5em 20px 20px 20px;
}
div.related {
font-size: 1em;
color: white;
}
div.related ul {
background-image: url(relbg.png);
height: 1.9em;
border-top: 1px solid #002e50;
border-bottom: 1px solid #002e50;
}
div.related ul li {
margin: 0 5px 0 0;
padding: 0;
float: left;
}
div.related ul li.right {
float: right;
margin-right: 5px;
}
div.related ul li a {
margin: 0;
padding: 0 5px 0 5px;
line-height: 1.75em;
color: #f9f9f0;
text-shadow: 0px 0px 1px rgba(0, 0, 0, 0.5);
}
div.related ul li a:hover {
color: white;
/*text-decoration: underline;*/
text-shadow: 0px 0px 1px rgba(255, 255, 255, 0.5);
}
div.sphinxsidebarwrapper {
position: relative;
top: 0px;
padding: 0;
}
div.sphinxsidebar {
margin: 0;
padding: 0 15px 15px 0;
width: 210px;
float: right;
font-size: 1em;
text-align: left;
}
div.sphinxsidebar .logo {
font-size: 1.8em;
color: #0A507A;
font-weight: 300;
text-align: center;
}
div.sphinxsidebar .logo img {
vertical-align: middle;
}
div.sphinxsidebar input {
border: 1px solid #aaa;
font-family: 'Open Sans', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
'Verdana', sans-serif;
font-size: 1em;
}
div.sphinxsidebar h3 {
font-size: 1.5em;
border-top: 1px solid #0a507a;
margin-top: 1em;
margin-bottom: 0.5em;
padding-top: 0.5em;
}
div.sphinxsidebar h4 {
font-size: 1.2em;
margin-bottom: 0;
}
div.sphinxsidebar h3, div.sphinxsidebar h4 {
margin-right: -15px;
margin-left: -15px;
padding-right: 14px;
padding-left: 14px;
color: #333;
font-weight: 300;
/*text-shadow: 0px 0px 0.5px rgba(0, 0, 0, 0.4);*/
}
div.sphinxsidebarwrapper > h3:first-child {
margin-top: 0.5em;
border: none;
}
div.sphinxsidebar h3 a {
color: #333;
}
div.sphinxsidebar ul {
color: #444;
margin-top: 7px;
padding: 0;
line-height: 130%;
}
div.sphinxsidebar ul ul {
margin-left: 20px;
list-style-image: url(listitem.png);
}
div.footer {
background-image: url(footerbg.png);
color: #ccc;
text-shadow: 0 0 .2px rgba(255, 255, 255, 0.8);
padding: 3px 8px 3px 0;
clear: both;
font-size: 0.8em;
text-align: right;
}
/* no need to make a visible link to Sphinx on the Sphinx page */
div.footer a {
color: #ccc;
}
/* -- body styles ----------------------------------------------------------- */
p {
margin: 0.8em 0 0.5em 0;
}
a {
color: #A2881D;
text-decoration: none;
}
a:hover {
color: #E1C13F;
}
div.body a {
text-decoration: underline;
}
h1 {
margin: 10px 0 0 0;
font-size: 2.4em;
color: #0A507A;
font-weight: 300;
}
h2 {
margin: 1.em 0 0.2em 0;
font-size: 1.5em;
font-weight: 300;
padding: 0;
color: #174967;
}
h3 {
margin: 1em 0 -0.3em 0;
font-size: 1.3em;
font-weight: 300;
}
div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a {
text-decoration: none;
}
div.body h1 a tt, div.body h2 a tt, div.body h3 a tt, div.body h4 a tt, div.body h5 a tt, div.body h6 a tt {
color: #0A507A !important;
font-size: inherit !important;
}
a.headerlink {
color: #0A507A !important;
font-size: 12px;
margin-left: 6px;
padding: 0 4px 0 4px;
text-decoration: none !important;
float: right;
}
a.headerlink:hover {
background-color: #ccc;
color: white!important;
}
cite, code, tt {
font-family: 'Consolas', 'DejaVu Sans Mono',
'Bitstream Vera Sans Mono', monospace;
font-size: 14px;
letter-spacing: -0.02em;
}
tt {
background-color: #f2f2f2;
border: 1px solid #ddd;
border-radius: 2px;
color: #333;
padding: 1px;
}
tt.descname, tt.descclassname, tt.xref {
border: 0;
}
hr {
border: 1px solid #abc;
margin: 2em;
}
a tt {
border: 0;
color: #a2881d;
}
a tt:hover {
color: #e1c13f;
}
pre {
font-family: 'Consolas', 'DejaVu Sans Mono',
'Bitstream Vera Sans Mono', monospace;
font-size: 13px;
letter-spacing: 0.015em;
line-height: 120%;
padding: 0.5em;
border: 1px solid #ccc;
border-radius: 2px;
background-color: #f8f8f8;
}
pre a {
color: inherit;
text-decoration: underline;
}
td.linenos pre {
padding: 0.5em 0;
}
div.quotebar {
background-color: #f8f8f8;
max-width: 250px;
float: right;
padding: 0px 7px;
border: 1px solid #ccc;
margin-left: 1em;
}
div.topic {
background-color: #f8f8f8;
}
table {
border-collapse: collapse;
margin: 0 -0.5em 0 -0.5em;
}
table td, table th {
padding: 0.2em 0.5em 0.2em 0.5em;
}
div.admonition, div.warning {
font-size: 0.9em;
margin: 1em 0 1em 0;
border: 1px solid #86989B;
border-radius: 2px;
background-color: #f7f7f7;
padding: 0;
}
div.admonition p, div.warning p {
margin: 0.5em 1em 0.5em 1em;
padding: 0;
}
div.admonition pre, div.warning pre {
margin: 0.4em 1em 0.4em 1em;
}
div.admonition p.admonition-title,
div.warning p.admonition-title {
margin-top: 1em;
padding-top: 0.5em;
font-weight: bold;
}
div.warning {
border: 1px solid #940000;
/* background-color: #FFCCCF;*/
}
div.warning p.admonition-title {
}
div.admonition ul, div.admonition ol,
div.warning ul, div.warning ol {
margin: 0.1em 0.5em 0.5em 3em;
padding: 0;
}
div.admonition .highlight, div.warning .highlight {
background-color: #f7f7f7;
}
.viewcode-back {
font-family: 'Open Sans', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
'Verdana', sans-serif;
}
div.viewcode-block:target {
background-color: #f4debf;
border-top: 1px solid #ac9;
border-bottom: 1px solid #ac9;
}
.my-code-block.std-ref {
color : red;
}
.cppbrief {
color: #C6792C;
font-style: oblique;
}
.cppsynopsis {
background-color: #E7EDF9;
/*font-family: 'Open Sans', 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif;*/
/*font-family: monospace; */
font-family: Verdana, Arial, Lucida Console;
font-size=80%;
/*font-style: oblique;*/
/* white-space: pre;*/
}

4
doc/themes/triqs/theme.conf vendored Normal file
View File

@ -0,0 +1,4 @@
[theme]
inherit = basic
stylesheet = triqs.css
pygments_style = sphinx

7
packaging/CMakeLists.txt Normal file
View File

@ -0,0 +1,7 @@
# Configure the version of packaging files
configure_file(conda/meta.yaml.in conda/meta.yaml)
configure_file(conda/build.sh conda/build.sh COPYONLY)
configure_file(conda/conda_build_config.yaml conda/conda_build_config.yaml COPYONLY)
configure_file(TRIQS-app4triqs-foss-2021b.eb.in TRIQS-app4triqs-foss-2021b.eb)

View File

@ -0,0 +1,60 @@
easyblock = 'CMakeMake'
name = 'TRIQS-app4triqs'
version = '@PROJECT_VERSION@'
homepage = 'https://triqs.github.io/app4triqs/'
description = """
PROVIDE HERE A DESCRIPTION OF YOUR APPLICATION
"""
docurls = ['https://triqs.github.io/app4triqs/%(version_major_minor)s.x/']
software_license = 'LicenseGPLv3'
toolchain = {'name': 'foss', 'version': '2021b'}
toolchainopts = {'pic': True, 'usempi': True}
source_urls = ['https://github.com/TRIQS/app4triqs/releases/download/%(version)s/']
sources = ['app4triqs-%(version)s.tar.gz']
checksums = ['PUT HERE THE SHA256 OF THE RELEASE TARBALL']
dependencies = [
('Python', '3.9.6'),
('SciPy-bundle', '2021.10'),
('Boost', '1.77.0'),
('Clang', '13.0.1'),
('Clang-Python-bindings', '13.0.1'),
('GMP', '6.2.1'),
('HDF5', '1.10.7'),
('Mako', '1.1.4'),
('TRIQS', '3.3.0'),
('NFFT', '3.5.2')
]
builddependencies = [
('CMake', '3.22.1')
]
separate_build_dir = True
runtest = 'test'
sanity_check_paths = {
'files': ['lib/libapp4triqs_c.a'],
'dirs': ['include/app4triqs', 'lib', 'share',
'lib/python%(pyshortver)s/site-packages/app4triqs'],
}
sanity_check_commands = ["python -c 'import app4triqs'"]
modextrapaths = {
'CPLUS_INCLUDE_PATH': 'include',
'PYTHONPATH': 'lib/python%(pyshortver)s/site-packages',
'CMAKE_PREFIX_PATH': 'lib/cmake/app4triqs',
}
modextravars = {
'APP4TRIQS_ROOT': '%(installdir)s',
'APP4TRIQS_VERSION': '%(version)s',
}
moduleclass = 'phys'

22
packaging/conda/build.sh Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
mkdir build
cd build
# Openmpi Specific environment setup - Cf. https://github.com/conda-forge/libnetcdf-feedstock/pull/80
export OMPI_MCA_btl=self,tcp
export OMPI_MCA_plm=isolated
export OMPI_MCA_rmaps_base_oversubscribe=yes
export OMPI_MCA_btl_vader_single_copy_mechanism=none
mpiexec="mpiexec --allow-run-as-root"
source $PREFIX/share/triqs/triqsvars.sh
cmake \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_BUILD_TYPE=Release \
..
make -j${CPU_COUNT} VERBOSE=1
CTEST_OUTPUT_ON_FAILURE=1 ctest
make install

View File

@ -0,0 +1,3 @@
mpi:
- mpich
- openmpi

View File

@ -0,0 +1,57 @@
{% set version = "@PROJECT_VERSION@" %}
package:
name: app4triqs
version: {{ version }}
source:
url: https://github.com/TRIQS/app4triqs/releases/download/{{ version }}/app4triqs-{{ version }}.tar.gz
sha256: PUT HERE THE SHA256 OF YOUR RELEASE TARBALL
build:
number: 0
skip: True # [win or py<30]
requirements:
build:
- cmake
- make
- {{ compiler('c') }}
- {{ compiler('cxx') }}
host:
- triqs {{ '.'.join(version.split('.')[:2]) }}
- boost-cpp
- hdf5
- {{ mpi }}
- libblas
- liblapack
- python
run:
- {{ pin_compatible("triqs", max_pin="x.x") }}
- boost-cpp
- hdf5
- {{ mpi }}
- libblas
- liblapack
- python
test:
commands:
- export OMPI_MCA_btl=self,tcp
- export OMPI_MCA_plm=isolated
- export OMPI_MCA_rmaps_base_oversubscribe=yes
- export OMPI_MCA_btl_vader_single_copy_mechanism=none
- export mpiexec="mpiexec --allow-run-as-root"
- python -c "import app4triqs"
about:
home: https://triqs.github.io/app4triqs
license: GPL-3.0-or-later
license_family: GPL
license_file: LICENSE.txt
summary: 'An application based on the TRIQS library'
extra:
recipe-maintainers:
- wentzell
- pgunn

View File

@ -0,0 +1,26 @@
# Configure the version
configure_file(version.py.in version.py)
# All Python files. Copy them in the build dir to have a complete package for the tests.
file(GLOB_RECURSE python_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
file(GLOB_RECURSE wrap_generators RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *_desc.py)
list(REMOVE_ITEM python_sources "${wrap_generators}")
foreach(file ${python_sources})
configure_file(${file} ${file} COPYONLY)
endforeach()
# Install python files to proper location
set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST})
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${TRIQS_PYTHON_LIB_DEST_ROOT} FILES_MATCHING PATTERN "*.py" PATTERN "*_desc.py" EXCLUDE)
# Build and install any python modules
foreach(gen ${wrap_generators})
string(REPLACE "_desc.py" "" gen ${gen})
get_filename_component(module_name ${gen} NAME_WE)
get_filename_component(module_dir ${gen} DIRECTORY)
add_cpp2py_module(NAME ${module_name} DIRECTORY ${module_dir})
add_library(${PROJECT_NAME}::${module_name} ALIAS ${module_name})
target_link_libraries(${module_name} ${PROJECT_NAME}_c triqs_py)
install(TARGETS ${module_name} DESTINATION ${PYTHON_LIB_DEST}/${module_dir})
endforeach()

View File

@ -0,0 +1,30 @@
################################################################################
#
# TRIQS: a Toolbox for Research in Interacting Quantum Systems
#
# Copyright (C) 2016-2018, N. Wentzell
# Copyright (C) 2018-2019, The Simons Foundation
# author: N. Wentzell
#
# TRIQS is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# TRIQS 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
r"""
DOC
"""
from .app4triqs_module import Toto, chain
__all__ = ['Toto', 'chain']

View File

@ -0,0 +1,76 @@
# Generated automatically using the command :
# c++2py ../../c++/app4triqs/app4triqs.hpp -p --members_read_only -N app4triqs -a app4triqs -m app4triqs_module -o app4triqs_module --moduledoc="The app4triqs python module" -C triqs --cxxflags="-std=c++17" --target_file_only
from cpp2py.wrap_generator import *
# The module
module = module_(full_name = "app4triqs_module", doc = r"The app4triqs python module", app_name = "app4triqs")
# Imports
# Add here all includes
module.add_include("app4triqs/app4triqs.hpp")
# Add here anything to add in the C++ code at the start, e.g. namespace using
module.add_preamble("""
#include <cpp2py/converters/string.hpp>
using namespace app4triqs;
""")
# The class toto
c = class_(
py_type = "Toto", # name of the python class
c_type = "app4triqs::toto", # name of the C++ class
doc = r"""A very useful and important class""", # doc of the C++ class
hdf5 = True,
arithmetic = ("add_only"),
comparisons = "==",
serializable = "tuple"
)
c.add_constructor("""()""", doc = r"""""")
c.add_constructor("""(int i_)""", doc = r"""Construct from integer
Parameters
----------
i_
a scalar :math:`G(\tau)`""")
c.add_method("""int f (int u)""",
doc = r"""A simple function with :math:`G(\tau)`
Parameters
----------
u
Nothing useful""")
c.add_method("""std::string hdf5_format ()""",
is_static = True,
doc = r"""HDF5""")
c.add_property(name = "i",
getter = cfunction("int get_i ()"),
doc = r"""Simple accessor""")
module.add_class(c)
module.add_function ("int app4triqs::chain (int i, int j)", doc = r"""Chain digits of two integers
Parameters
----------
i
The first integer
j
The second integer
Returns
-------
out
An integer containing the digits of both i and j""")
module.generate_code()

View File

@ -0,0 +1,32 @@
################################################################################
#
# TRIQS: a Toolbox for Research in Interacting Quantum Systems
#
# Copyright (C) 2016-2018, N. Wentzell
# Copyright (C) 2018-2019, Simons Foundation
# author: N. Wentzell
#
# TRIQS is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# TRIQS 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 General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# TRIQS. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
version = "@PROJECT_VERSION@"
triqs_hash = "@TRIQS_GIT_HASH@"
@PROJECT_NAME@_hash = "@PROJECT_GIT_HASH@"
def show_version():
print("\nYou are using @PROJECT_NAME@ version %s\n"%version)
def show_git_hash():
print("\nYou are using @PROJECT_NAME@ git hash %s based on triqs git hash %s\n"%("@PROJECT_GIT_HASH@", triqs_hash))

11
requirements.txt Normal file
View File

@ -0,0 +1,11 @@
# Required python packages for this application (these should also be added to Dockerfile for Jenkins)
mako
numpy
scipy
# For documentation builds we additionaly require
#sphinx
#numpydoc
#nbsphinx
#sphinx_rtd_theme
#myst_parser
#linkify-it-py

37
share/CMakeLists.txt Normal file
View File

@ -0,0 +1,37 @@
add_subdirectory(cmake)
if(NOT IS_SUBPROJECT
AND NOT CMAKE_INSTALL_PREFIX STREQUAL TRIQS_ROOT
AND NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr"
AND NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr/local"
)
if(PythonSupport)
set(EXPORT_PYTHON_PATH "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CPP2PY_PYTHON_LIB_DEST_ROOT}:$PYTHONPATH")
set(MODFILE_PYTHON_PATH "prepend-path PYTHONPATH $root/${CPP2PY_PYTHON_LIB_DEST_ROOT}")
endif()
configure_file(${PROJECT_NAME}.modulefile.in ${PROJECT_NAME}.modulefile @ONLY)
configure_file(${PROJECT_NAME}vars.sh.in ${PROJECT_NAME}vars.sh @ONLY)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.modulefile
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}vars.sh
DESTINATION share/${PROJECT_NAME}
)
message(STATUS "*********************************************************************************")
message(STATUS "* Custom install Location. Use: ")
message(STATUS "* ")
message(STATUS "* source ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/${PROJECT_NAME}vars.sh ")
message(STATUS "* ")
message(STATUS "* to set up the environment variables ")
if(DEFINED ENV{MODULEPATH})
message(STATUS "* ")
message(STATUS "* Consider copying ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.modulefile ")
message(STATUS "* into your environment module directories ")
endif()
message(STATUS "*********************************************************************************")
endif()

View File

@ -0,0 +1,39 @@
#%Module1.0
#
# To be installed as ${MODULEPATH}/@PROJECT_NAME@/@PROJECT_VERSION@
set name @PROJECT_NAME@
set version @PROJECT_VERSION@
set root @CMAKE_INSTALL_PREFIX@
set git_hash @PROJECT_GIT_HASH@
set url "https://github.com/TRIQS/@PROJECT_NAME@"
set description "An example application using cpp2py and triqs."
module-whatis "$description"
proc ModulesHelp { } {
global description url version git_hash
puts stderr "Description: $description"
puts stderr "URL: $url"
puts stderr "Version: $version"
puts stderr "Git hash: $git_hash"
}
# You may need to edit the next line if the triqs module
# is installed under a different name in your setup.
prereq triqs/@TRIQS_VERSION@
# Only one version of @PROJECT_NAME@ can be loaded at a time
conflict $name
setenv @PROJECT_NAME@_ROOT $root
setenv @PROJECT_NAME@_VERSION $version
setenv @PROJECT_NAME@_GIT_HASH $git_hash
prepend-path PATH $root/bin
prepend-path CPLUS_INCLUDE_PATH $root/include
prepend-path LIBRARY_PATH $root/lib
prepend-path LD_LIBRARY_PATH $root/lib
prepend-path CMAKE_PREFIX_PATH $root
@MODFILE_PYTHON_PATH@

10
share/app4triqsvars.sh.in Normal file
View File

@ -0,0 +1,10 @@
# Source this in your environment.
export @PROJECT_NAME@_ROOT=@CMAKE_INSTALL_PREFIX@
export CPLUS_INCLUDE_PATH=@CMAKE_INSTALL_PREFIX@/include:$CPLUS_INCLUDE_PATH
export PATH=@CMAKE_INSTALL_PREFIX@/bin:$PATH
export LIBRARY_PATH=@CMAKE_INSTALL_FULL_LIBDIR@:$LIBRARY_PATH
export LD_LIBRARY_PATH=@CMAKE_INSTALL_FULL_LIBDIR@:$LD_LIBRARY_PATH
export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@:$CMAKE_PREFIX_PATH
@EXPORT_PYTHON_PATH@

View File

@ -0,0 +1,10 @@
configure_file(${PROJECT_NAME}-config.cmake.in ${PROJECT_NAME}-config.cmake @ONLY)
configure_file(${PROJECT_NAME}-config-version.cmake.in ${PROJECT_NAME}-config-version.cmake @ONLY)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
install(EXPORT ${PROJECT_NAME}-targets NAMESPACE ${PROJECT_NAME}:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})

View File

@ -0,0 +1,37 @@
# Copyright Olivier Parcollet 2017.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# This module looks for sphinx documentation tool
# and define a function that prepares the Makefile for sphinx-build
find_program(SPHINXBUILD_EXECUTABLE
NAMES sphinx-build
PATHS /usr/bin /opt/local/bin /usr/local/bin #opt/sphinx-doc/bin
PATH_SUFFIXES bin
)
if (NOT SPHINXBUILD_EXECUTABLE)
message(FATAL_ERROR "I cannot find sphinx to build the triqs documentation")
endif()
execute_process(
COMMAND "${SPHINXBUILD_EXECUTABLE}" --version
OUTPUT_VARIABLE SPHINXBUILD_VERSION
ERROR_VARIABLE SPHINXBUILD_VERSION
)
if (SPHINXBUILD_VERSION MATCHES "[Ss]phinx.* ([0-9]+\\.[0-9]+(\\.|b)[0-9]+)")
set (SPHINXBUILD_VERSION "${CMAKE_MATCH_1}")
endif()
if (SPHINXBUILD_VERSION VERSION_EQUAL 1.6.3)
message(FATAL_ERROR "sphinx-build found at ${SPHINXBUILD_EXECUTABLE} but version 1.6.3 has a bug. Upgrade sphinx.")
else()
message(STATUS "sphinx-build program found at ${SPHINXBUILD_EXECUTABLE} with version ${SPHINXBUILD_VERSION}")
endif ()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx DEFAULT_MSG SPHINXBUILD_EXECUTABLE)
mark_as_advanced( SPHINXBUILD_EXECUTABLE )

View File

@ -0,0 +1,13 @@
set(PACKAGE_VERSION @PROJECT_VERSION@)
if (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
if (PACKAGE_FIND_VERSION VERSION_LESS PACKAGE_VERSION)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
endif()
if (PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()

View File

@ -0,0 +1,40 @@
# This file allows other CMake Projects to find us
# We provide general project information
# and reestablish the exported CMake Targets
# Multiple inclusion guard
if(NOT @PROJECT_NAME@_FOUND)
set(@PROJECT_NAME@_FOUND TRUE)
set_property(GLOBAL PROPERTY @PROJECT_NAME@_FOUND TRUE)
# version
set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@ CACHE STRING "@PROJECT_NAME@ version")
set(@PROJECT_NAME@_GIT_HASH @PROJECT_GIT_HASH@ CACHE STRING "@PROJECT_NAME@ git hash")
# Root of the installation
set(@PROJECT_NAME@_ROOT @CMAKE_INSTALL_PREFIX@ CACHE STRING "@PROJECT_NAME@ root directory")
## Find the target dependencies
#function(find_dep)
# get_property(${ARGV0}_FOUND GLOBAL PROPERTY ${ARGV0}_FOUND)
# if(NOT ${ARGV0}_FOUND)
# find_package(${ARGN} REQUIRED HINTS @CMAKE_INSTALL_PREFIX@)
# endif()
#endfunction()
#find_dep(depname 1.0)
# Include the exported targets of this project
include(@CMAKE_INSTALL_FULL_LIBDIR@/cmake/@PROJECT_NAME@/@PROJECT_NAME@-targets.cmake)
message(STATUS "Found @PROJECT_NAME@-config.cmake with version @PROJECT_VERSION@, hash = @PROJECT_GIT_HASH@, root = @CMAKE_INSTALL_PREFIX@")
# Was the Project built with Documentation?
set(@PROJECT_NAME@_WITH_DOCUMENTATION @Build_Documentation@ CACHE BOOL "Was @PROJECT_NAME@ build with documentation?")
# Was the Project built with PythonSupport?
set(@PROJECT_NAME@_WITH_PYTHON_SUPPORT @PythonSupport@ CACHE BOOL "Was @PROJECT_NAME@ build with python support?")
if(@PythonSupport@)
set(@PROJECT_NAME@_MODULE_DIR @CMAKE_INSTALL_PREFIX@/@CPP2PY_PYTHON_LIB_DEST_ROOT@ CACHE BOOL "The @PROJECT_NAME@ python module directory")
endif()
endif()

View File

@ -0,0 +1,125 @@
# Copyright (c) 2019-2020 Simons Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You may obtain a copy of the License at
# https://www.gnu.org/licenses/gpl-3.0.txt
# Author: Nils Wentzell
# Recursively fetch all targets that the interface of a target depends upon
macro(get_all_interface_targets name target)
get_property(TARGET_LINK_LIBRARIES TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES)
foreach(lib IN LISTS TARGET_LINK_LIBRARIES)
if(TARGET ${lib})
# Append to list
list(APPEND ${name}_INTERFACE_TARGETS ${lib})
# Recure into target dependencies
get_all_interface_targets(${name} ${lib})
endif()
endforeach()
endmacro()
# Extract the property from the target and recursively from all targets it depends upon
macro(get_property_recursive)
cmake_parse_arguments(get_property_recursive "" "TARGET" "PROPERTY" ${ARGN})
set(target ${get_property_recursive_TARGET})
set(property ${get_property_recursive_PROPERTY})
get_all_interface_targets(${target} ${target})
foreach(t IN LISTS ${target}_INTERFACE_TARGETS ITEMS ${target})
get_property(p TARGET ${t} PROPERTY ${property})
list(APPEND ${ARGV0} ${p})
endforeach()
# Clean duplicates and any occurance of '/usr/include' dirs
if(${ARGV0})
list(REMOVE_DUPLICATES ${ARGV0})
list(REMOVE_ITEM ${ARGV0} /usr/include)
endif()
endmacro()
# Recursively fetch all compiler flags attached to the interface of a target
macro(extract_flags)
cmake_parse_arguments(ARG "BUILD_INTERFACE" "" "" ${ARGN})
set(target ${ARGV0})
unset(${target}_CXXFLAGS)
unset(${target}_LDFLAGS)
get_property_recursive(opts TARGET ${target} PROPERTY INTERFACE_COMPILE_OPTIONS)
foreach(opt ${opts})
set(${target}_LDFLAGS "${${target}_LDFLAGS} ${opt}")
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} ${opt}")
endforeach()
get_property_recursive(cxx_features TARGET ${target} PROPERTY INTERFACE_COMPILE_FEATURES)
if(cxx_std_23 IN_LIST cxx_features)
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -std=c++2b")
elseif(cxx_std_20 IN_LIST cxx_features)
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -std=c++20")
elseif(cxx_std_17 IN_LIST cxx_features)
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -std=c++17")
endif()
get_property_recursive(defs TARGET ${target} PROPERTY INTERFACE_COMPILE_DEFINITIONS)
foreach(def ${defs})
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -D${def}")
endforeach()
get_property_recursive(inc_dirs TARGET ${target} PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property_recursive(sys_inc_dirs TARGET ${target} PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
if(inc_dirs)
list(REMOVE_ITEM sys_inc_dirs ${inc_dirs})
endif()
foreach(dir ${inc_dirs})
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -I${dir}")
endforeach()
foreach(dir ${sys_inc_dirs})
set(${target}_CXXFLAGS "${${target}_CXXFLAGS} -isystem${dir}")
endforeach()
get_property_recursive(libs TARGET ${target} PROPERTY INTERFACE_LINK_LIBRARIES)
foreach(lib ${libs})
if(NOT TARGET ${lib} AND NOT IS_DIRECTORY ${lib})
set(${target}_LDFLAGS "${${target}_LDFLAGS} ${lib}")
endif()
endforeach()
# ==== We have to replace generator expressions explicitly ====
if(ARG_BUILD_INTERFACE)
string(REGEX REPLACE "\\$<BUILD_INTERFACE:([^ ]*)>" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}")
string(REGEX REPLACE "\\$<BUILD_INTERFACE:([^ ]*)>" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}")
else()
string(REGEX REPLACE "\\$<INSTALL_INTERFACE:([^ ]*)>" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}")
string(REGEX REPLACE "\\$<INSTALL_INTERFACE:([^ ]*)>" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
string(REGEX REPLACE "\\$<\\$<CXX_COMPILER_ID:GNU>:([^ ]*)>" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}")
string(REGEX REPLACE "\\$<\\$<CXX_COMPILER_ID:GNU>:([^ ]*)>" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
string(REGEX REPLACE "\\$<\\$<CXX_COMPILER_ID:Clang>:([^ ]*)>" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}")
string(REGEX REPLACE "\\$<\\$<CXX_COMPILER_ID:Clang>:([^ ]*)>" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
string(REGEX REPLACE "\\$<\\$<CXX_COMPILER_ID:AppleClang>:([^ ]*)>" "\\1" ${target}_LDFLAGS "${${target}_LDFLAGS}")
string(REGEX REPLACE "\\$<\\$<CXX_COMPILER_ID:AppleClang>:([^ ]*)>" "\\1" ${target}_CXXFLAGS "${${target}_CXXFLAGS}")
endif()
# Remove all remaining generator expressions
string(REGEX REPLACE " [^ ]*\\$<[^ ]*:[^>]*>" "" ${target}_LDFLAGS "${${target}_LDFLAGS}")
string(REGEX REPLACE " [^ ]*\\$<[^ ]*:[^>]*>" "" ${target}_CXXFLAGS "${${target}_CXXFLAGS}")
# Filter out system directories from LDFLAGS and CXXFLAGS
string(REGEX REPLACE " -L/usr/lib " " " ${target}_LDFLAGS "${${target}_LDFLAGS}")
string(REGEX REPLACE " -I/usr/include " " " ${target}_CXXFLAGS "${${target}_CXXFLAGS}")
string(REGEX REPLACE " -isystem/usr/include " " " ${target}_CXXFLAGS "${${target}_CXXFLAGS}")
endmacro()

51
share/replace_and_rename.py Executable file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env python3
import sys
import os
import glob
if len(sys.argv) != 2:
print("Please pass the application name")
sys.exit()
app_name = str(sys.argv[1]).lower()
capital_name = app_name.upper()
# Move app4triqs directories if necessary
if os.path.isdir("c++/app4triqs"): os.rename("c++/app4triqs", "c++/" + app_name)
if os.path.isdir("python/app4triqs"): os.rename("python/app4triqs", "python/" + app_name)
# Ignore these files
ignore_lst = [".git/", "replace_and_rename.py", "squash_history.sh"]
# Find the root directory of app4triqs
app4triqs_root = os.path.abspath(os.path.dirname(__file__) + "/..")
# Blacklisted file-formats
fmt_blacklist = ['.png', '.h5', '.jpg', '.ico']
# Recurse over all subdirectories and files
for root, dirs, files in os.walk(app4triqs_root):
for fname in files:
fpath = os.path.join(root, fname)
if os.path.splitext(fname)[1] in fmt_blacklist:
continue
# Ignore certain files / directories
if any(it in fpath for it in ignore_lst): continue
if os.path.isfile(fpath):
# Rename files containing app4triqs in their filename
if "app4triqs" in fname:
new_fpath = os.path.join(root, fname.replace("app4triqs", app_name))
os.rename(fpath, new_fpath)
fpath = new_fpath
# Replace app4triqs and APP4TRIQS in all files
with open(fpath, 'r') as f:
s = f.read()
if "app4triqs" in s or "APP4TRIQS" in s:
with open(fpath, 'w') as f:
f.write(s.replace("app4triqs", app_name).replace("APP4TRIQS", capital_name))

6
share/squash_history.sh Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
git reset $(git commit-tree HEAD\^{tree} -m "Initialize project from github.com/triqs/app4triqs@$(git rev-parse --short HEAD)")
git merge --allow-unrelated-histories -s ours HEAD@{1} -m "Track app4triqs skeleton"
git remote rm origin
git remote add app4triqs_remote https://github.com/triqs/app4triqs

5
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
add_subdirectory(c++)
if(PythonSupport)
add_subdirectory(python)
endif()

35
test/c++/CMakeLists.txt Normal file
View File

@ -0,0 +1,35 @@
# Copy h5 files to binary dir
file(GLOB_RECURSE all_h5_ref_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ref.h5)
foreach(file ${all_h5_ref_files})
configure_file(${file} ${file} COPYONLY)
endforeach()
# List of all tests
file(GLOB_RECURSE all_tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(test ${all_tests})
get_filename_component(test_name ${test} NAME_WE)
get_filename_component(test_dir ${test} DIRECTORY)
add_executable(${test_name} ${test})
target_link_libraries(${test_name} ${PROJECT_NAME}::${PROJECT_NAME}_c ${PROJECT_NAME}_warnings gtest_main)
set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
# Run clang-tidy if found
if(CLANG_TIDY_EXECUTABLE)
set_target_properties(${test_name} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
endif()
# Run cppcheck if found
if(CPPCHECK_EXECUTABLE)
add_custom_command(
TARGET ${test_name}
COMMAND ${CPPCHECK_EXECUTABLE}
--enable=warning,style,performance,portability
--std=c++20
--template=gcc
--verbose
--force
--quiet
${CMAKE_CURRENT_SOURCE_DIR}/${test}
)
endif()
endforeach()

30
test/c++/basic.cpp Normal file
View File

@ -0,0 +1,30 @@
#include <triqs/test_tools/gfs.hpp>
#include <app4triqs/app4triqs.hpp>
using namespace app4triqs;
TEST(Toto, Add) { // NOLINT
toto a(0);
toto b(2);
auto c = a + b;
EXPECT_EQ(c, b); // NOLINT
}
TEST(Toto, H5) { // NOLINT
toto a(0);
{ // Local scope for file
h5::file f("f.h5", 'w');
h5_write(f, "a", a);
}
toto a2;
{
h5::file f("f.h5", 'a');
h5_read(f, "a", a2);
}
EXPECT_EQ(a, a2); // NOLINT
}

50
test/python/Basic.py Normal file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env python
import unittest
from app4triqs import Toto, chain
from h5 import *
from triqs.utility import mpi
class test_toto(unittest.TestCase):
def test_add(self):
a=Toto(0)
b=Toto(2)
c=a+b
self.assertEqual(c, b)
def test_h5(self):
a=Toto(0)
with HDFArchive("f.h5",'w') as A:
A["a"] = a
with HDFArchive("f.h5",'r') as A:
a_read = A["a"]
self.assertEqual(a, a_read)
def test_mpi(self):
a=Toto(0)
if mpi.is_master_node():
a=Toto(1)
mpi.bcast(a)
self.assertEqual(a, Toto(1))
class test_chain(unittest.TestCase):
def test_chain(self):
i = 111
j = 222
ij = chain(i,j)
self.assertEqual(ij, 111222)
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,15 @@
# Copy h5 files to binary dir
file(GLOB_RECURSE all_h5_ref_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ref.h5)
foreach(file ${all_h5_ref_files})
configure_file(${file} ${file} COPYONLY)
endforeach()
# List of all tests
set(all_tests Basic)
foreach(test ${all_tests})
get_filename_component(test_name ${test} NAME_WE)
get_filename_component(test_dir ${test} DIRECTORY)
add_test(NAME Py_${test_name} COMMAND ${TRIQS_PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${test_dir}/${test_name}.py WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
set_property(TEST Py_${test_name} APPEND PROPERTY ENVIRONMENT PYTHONPATH=${PROJECT_BINARY_DIR}/python:$ENV{PYTHONPATH} ${SANITIZER_RT_PRELOAD})
endforeach()