diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..10b3840
--- /dev/null
+++ b/.clang-format
@@ -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
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..1c458b7
--- /dev/null
+++ b/.clang-tidy
@@ -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'
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..ab7e50d
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,5 @@
+.travis.yml
+Dockerfile
+Jenkinsfile
+.git/objects/pack
+build*
diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md
new file mode 100644
index 0000000..79dfa30
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug.md
@@ -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.
diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md
new file mode 100644
index 0000000..0ca4d25
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature.md
@@ -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).
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..890c702
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -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 }}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d38f325
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+compile_commands.json
+doc/_autosummary
+doc/cpp2rst_generated
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..dca0f45
--- /dev/null
+++ b/CMakeLists.txt
@@ -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
+# .
+#
+# ##############################################################################
+
+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($<$:-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
+ $<$:-Wno-comma-subscript>
+ $<$:-Wno-psabi> # Disable notes about ABI changes
+ $<$:-Wshadow=local>
+ $<$:-Wno-attributes>
+ $<$:-Wno-deprecated-declarations>
+ $<$:-Wno-deprecated-comma-subscript>
+ $<$:-Wno-unknown-warning-option>
+ $<$:-Wshadow>
+ $<$:-Wno-gcc-compat>
+ $<$:-Wno-c++20-extensions>
+ $<$:-Wno-c++20-compat>
+ $<$:-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()
diff --git a/COPYING.txt b/COPYING.txt
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING.txt
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ 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.
+
+
+ Copyright (C)
+
+ 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 .
+
+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:
+
+ Copyright (C)
+ 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
+.
+
+ 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
+.
diff --git a/ChangeLog.md b/ChangeLog.md
new file mode 120000
index 0000000..9e080e2
--- /dev/null
+++ b/ChangeLog.md
@@ -0,0 +1 @@
+doc/ChangeLog.md
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..1ae1711
--- /dev/null
+++ b/Dockerfile
@@ -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
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..ff81d63
--- /dev/null
+++ b/Jenkinsfile
@@ -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 ' --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 ' -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
+}
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..4b35411
--- /dev/null
+++ b/LICENSE.txt
@@ -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
+.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1657290
--- /dev/null
+++ b/README.md
@@ -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',
+```
diff --git a/c++/app4triqs/CMakeLists.txt b/c++/app4triqs/CMakeLists.txt
new file mode 100644
index 0000000..5f51a38
--- /dev/null
+++ b/c++/app4triqs/CMakeLists.txt
@@ -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 $)
+
+# 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 $)
+target_include_directories(${PROJECT_NAME}_c SYSTEM INTERFACE $)
+target_compile_definitions(${PROJECT_NAME}_c PUBLIC
+ APP4TRIQS_GIT_HASH=${PROJECT_GIT_HASH}
+ TRIQS_GIT_HASH=${TRIQS_GIT_HASH}
+ $<$:APP4TRIQS_DEBUG>
+ $<$:TRIQS_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 $)
+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 $)
+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 $)
+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 $)
+endif()
diff --git a/c++/app4triqs/app4triqs.cpp b/c++/app4triqs/app4triqs.cpp
new file mode 100644
index 0000000..a16840c
--- /dev/null
+++ b/c++/app4triqs/app4triqs.cpp
@@ -0,0 +1,37 @@
+#include
+#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
diff --git a/c++/app4triqs/app4triqs.hpp b/c++/app4triqs/app4triqs.hpp
new file mode 100644
index 0000000..b92d513
--- /dev/null
+++ b/c++/app4triqs/app4triqs.hpp
@@ -0,0 +1,79 @@
+#pragma once
+#include
+#include
+#include
+
+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 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
diff --git a/deps/.gitignore b/deps/.gitignore
new file mode 100644
index 0000000..72e8ffc
--- /dev/null
+++ b/deps/.gitignore
@@ -0,0 +1 @@
+*
diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt
new file mode 100644
index 0000000..e26dfba
--- /dev/null
+++ b/deps/CMakeLists.txt
@@ -0,0 +1,67 @@
+include(external_dependency.cmake)
+
+# Add your dependencies with the function
+#
+# external_dependency(name
+# [VERSION ]
+# [GIT_REPO ]
+# [GIT_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 [])
+# 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
+)
diff --git a/deps/external_dependency.cmake b/deps/external_dependency.cmake
new file mode 100644
index 0000000..252cead
--- /dev/null
+++ b/deps/external_dependency.cmake
@@ -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()
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 0000000..40eb49c
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -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 "_*"
+)
diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md
new file mode 100644
index 0000000..8d708da
--- /dev/null
+++ b/doc/ChangeLog.md
@@ -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.
diff --git a/doc/_static/css/custom.css b/doc/_static/css/custom.css
new file mode 100644
index 0000000..a8c2f1b
--- /dev/null
+++ b/doc/_static/css/custom.css
@@ -0,0 +1,5 @@
+@import url("theme.css");
+
+.wy-nav-content {
+ max-width: 70em;
+}
diff --git a/doc/_static/logo_cea.png b/doc/_static/logo_cea.png
new file mode 100644
index 0000000..1a28b43
Binary files /dev/null and b/doc/_static/logo_cea.png differ
diff --git a/doc/_static/logo_cnrs.png b/doc/_static/logo_cnrs.png
new file mode 100644
index 0000000..53c7af0
Binary files /dev/null and b/doc/_static/logo_cnrs.png differ
diff --git a/doc/_static/logo_erc.jpg b/doc/_static/logo_erc.jpg
new file mode 100644
index 0000000..b7181ee
Binary files /dev/null and b/doc/_static/logo_erc.jpg differ
diff --git a/doc/_static/logo_flatiron.png b/doc/_static/logo_flatiron.png
new file mode 100644
index 0000000..9c97b4b
Binary files /dev/null and b/doc/_static/logo_flatiron.png differ
diff --git a/doc/_static/logo_github.png b/doc/_static/logo_github.png
new file mode 100644
index 0000000..54bca71
Binary files /dev/null and b/doc/_static/logo_github.png differ
diff --git a/doc/_static/logo_simons.jpg b/doc/_static/logo_simons.jpg
new file mode 100644
index 0000000..8843123
Binary files /dev/null and b/doc/_static/logo_simons.jpg differ
diff --git a/doc/_static/logo_x.png b/doc/_static/logo_x.png
new file mode 100644
index 0000000..18aba0b
Binary files /dev/null and b/doc/_static/logo_x.png differ
diff --git a/doc/_static/triqs_logo/Icon/JPG/Triqs_Icon_RGB_Black.jpg b/doc/_static/triqs_logo/Icon/JPG/Triqs_Icon_RGB_Black.jpg
new file mode 100755
index 0000000..a25819a
Binary files /dev/null and b/doc/_static/triqs_logo/Icon/JPG/Triqs_Icon_RGB_Black.jpg differ
diff --git a/doc/_static/triqs_logo/Icon/JPG/Triqs_Icon_RGB_Full.jpg b/doc/_static/triqs_logo/Icon/JPG/Triqs_Icon_RGB_Full.jpg
new file mode 100755
index 0000000..8fac42a
Binary files /dev/null and b/doc/_static/triqs_logo/Icon/JPG/Triqs_Icon_RGB_Full.jpg differ
diff --git a/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_Black.svg b/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_Black.svg
new file mode 100755
index 0000000..ff59848
--- /dev/null
+++ b/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_Black.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_Full.svg b/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_Full.svg
new file mode 100755
index 0000000..76d6707
--- /dev/null
+++ b/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_Full.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_White.svg b/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_White.svg
new file mode 100755
index 0000000..4fbd963
--- /dev/null
+++ b/doc/_static/triqs_logo/Icon/SVG/Triqs_Icon_RGB_White.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/doc/_static/triqs_logo/Logo/JPG/Triqs_Logo_RGB_Black.jpg b/doc/_static/triqs_logo/Logo/JPG/Triqs_Logo_RGB_Black.jpg
new file mode 100755
index 0000000..a9206e0
Binary files /dev/null and b/doc/_static/triqs_logo/Logo/JPG/Triqs_Logo_RGB_Black.jpg differ
diff --git a/doc/_static/triqs_logo/Logo/JPG/Triqs_Logo_RGB_Full.jpg b/doc/_static/triqs_logo/Logo/JPG/Triqs_Logo_RGB_Full.jpg
new file mode 100755
index 0000000..58e6a81
Binary files /dev/null and b/doc/_static/triqs_logo/Logo/JPG/Triqs_Logo_RGB_Full.jpg differ
diff --git a/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_Black.svg b/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_Black.svg
new file mode 100755
index 0000000..27ff0f4
--- /dev/null
+++ b/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_Black.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_Full.svg b/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_Full.svg
new file mode 100755
index 0000000..149bdb6
--- /dev/null
+++ b/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_Full.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_White.svg b/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_White.svg
new file mode 100755
index 0000000..eb273f9
--- /dev/null
+++ b/doc/_static/triqs_logo/Logo/SVG/Triqs_Logo_RGB_White.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/doc/_static/triqs_logo/triqs_favicon.ico b/doc/_static/triqs_logo/triqs_favicon.ico
new file mode 100644
index 0000000..9e20d73
Binary files /dev/null and b/doc/_static/triqs_logo/triqs_favicon.ico differ
diff --git a/doc/_templates/autosummary_class_template.rst b/doc/_templates/autosummary_class_template.rst
new file mode 100644
index 0000000..49fc678
--- /dev/null
+++ b/doc/_templates/autosummary_class_template.rst
@@ -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 %}
diff --git a/doc/_templates/autosummary_module_template.rst b/doc/_templates/autosummary_module_template.rst
new file mode 100644
index 0000000..737206f
--- /dev/null
+++ b/doc/_templates/autosummary_module_template.rst
@@ -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 %}
+
diff --git a/doc/_templates/sideb.html b/doc/_templates/sideb.html
new file mode 100644
index 0000000..b4cc0b1
--- /dev/null
+++ b/doc/_templates/sideb.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/about.rst b/doc/about.rst
new file mode 100644
index 0000000..c91ecb8
--- /dev/null
+++ b/doc/about.rst
@@ -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.
diff --git a/doc/conf.py.in b/doc/conf.py.in
new file mode 100644
index 0000000..3eb0de9
--- /dev/null
+++ b/doc/conf.py.in
@@ -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)
diff --git a/doc/documentation.rst b/doc/documentation.rst
new file mode 100644
index 0000000..a05d717
--- /dev/null
+++ b/doc/documentation.rst
@@ -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
diff --git a/doc/index.rst b/doc/index.rst
new file mode 100644
index 0000000..94054b8
--- /dev/null
+++ b/doc/index.rst
@@ -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 `.
+
+ .. image:: _static/logo_github.png
+ :width: 75%
+ :align: center
+ :target: https://github.com/triqs/app4triqs
+
+
+An example application using cpp2py and :ref:`TRIQS `.
+
+This documentation is generated based on `rst `_ 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
diff --git a/doc/install.rst b/doc/install.rst
new file mode 100644
index 0000000..1c7766b
--- /dev/null
+++ b/doc/install.rst
@@ -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 `_ of both TRIQS and its applications.
+
+Prerequisites
+-------------
+
+#. The :ref:`TRIQS ` library, see :ref:`TRIQS installation instruction `.
+ 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 `.
+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 |
++-----------------------------------------------------------------+-----------------------------------------------+
diff --git a/doc/issues.rst b/doc/issues.rst
new file mode 100644
index 0000000..bdd0d5c
--- /dev/null
+++ b/doc/issues.rst
@@ -0,0 +1,23 @@
+.. _issues:
+
+Reporting issues
+****************
+
+Please report all problems and bugs directly at the github issue page
+``_. 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 `_ 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!
diff --git a/doc/sphinxext/sphinx_autorun/__init__.py b/doc/sphinxext/sphinx_autorun/__init__.py
new file mode 100644
index 0000000..1afa037
--- /dev/null
+++ b/doc/sphinxext/sphinx_autorun/__init__.py
@@ -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')
diff --git a/doc/sphinxext/sphinx_autorun/pycon.py b/doc/sphinxext/sphinx_autorun/pycon.py
new file mode 100644
index 0000000..c0edf86
--- /dev/null
+++ b/doc/sphinxext/sphinx_autorun/pycon.py
@@ -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()
diff --git a/doc/sphinxext/sphinx_autorun/version.py b/doc/sphinxext/sphinx_autorun/version.py
new file mode 100644
index 0000000..433d173
--- /dev/null
+++ b/doc/sphinxext/sphinx_autorun/version.py
@@ -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'
diff --git a/doc/sphinxext/triqs_example/triqs_example.py b/doc/sphinxext/triqs_example/triqs_example.py
new file mode 100644
index 0000000..2c90ac4
--- /dev/null
+++ b/doc/sphinxext/triqs_example/triqs_example.py
@@ -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)
+
diff --git a/doc/themes/triqs/layout.html b/doc/themes/triqs/layout.html
new file mode 100644
index 0000000..0275e11
--- /dev/null
+++ b/doc/themes/triqs/layout.html
@@ -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 %}
+
+
+
+
+{{ super() }}
+{%- if not embedded %}
+
+{%- endif %}
+{% endblock %}
+
+{% block rootrellink %}
+