Skip to content
Commits on Source (187)
......@@ -7,6 +7,7 @@ echo "MSYSTEM: $MSYSTEM"
echo "DUNECONTROL: ${DUNECONTROL}"
echo "DUNE_OPTIONS_FILE: ${DUNE_OPTIONS_FILE}"
cat ${DUNE_OPTIONS_FILE}
echo "PWD: $PWD"
which g++
which python
......
diff --git a/dune/common/std/CMakeLists.txt b/dune/common/std/CMakeLists.txt
index 40004d3c..94a2d7ac 100644
--- a/dune/common/std/CMakeLists.txt
+++ b/dune/common/std/CMakeLists.txt
@@ -1,6 +1,7 @@
install(
FILES
apply.hh
+ functional.hh
make_array.hh
memory.hh
optional.hh
# dependencies setup script for Travis and AppVeyor CI
DUNE_VERSION="master"
DUNE_VERSION="2.7"
# make sure we get the right mingw64 version of g++ on appveyor
PATH=/mingw64/bin:$PATH
......@@ -9,6 +9,7 @@ echo "MSYSTEM: $MSYSTEM"
echo "DUNECONTROL: ${DUNECONTROL}"
echo "DUNE_OPTIONS_FILE: ${DUNE_OPTIONS_FILE}"
cat ${DUNE_OPTIONS_FILE}
echo "PWD: $PWD"
which g++
g++ --version
......@@ -33,13 +34,13 @@ cmake --version
# download Dune dependencies
for repo in dune-common dune-typetree dune-pdelab dune-multidomaingrid
for repo in core/dune-common core/dune-geometry core/dune-grid core/dune-istl core/dune-localfunctions staging/dune-functions staging/dune-uggrid
do
git clone -b support/dune-copasi --depth 1 --recursive https://gitlab.dune-project.org/santiago.ospina/$repo.git
git clone -b releases/$DUNE_VERSION --depth 1 --recursive https://gitlab.dune-project.org/$repo.git
done
for repo in core/dune-geometry core/dune-grid core/dune-istl core/dune-localfunctions staging/dune-functions staging/dune-uggrid staging/dune-logging
for repo in dune-logging dune-typetree dune-pdelab dune-multidomaingrid
do
git clone -b $DUNE_VERSION --depth 1 --recursive https://gitlab.dune-project.org/$repo.git
git clone -b support/dune-copasi --depth 1 --recursive https://gitlab.dune-project.org/copasi/$repo.git
done
# python virtual environment does not work in windows yet
......@@ -76,6 +77,8 @@ cd dune-common
wget https://gist.githubusercontent.com/lkeegan/059984b71f8aeb0bbc062e85ad7ee377/raw/e9c7af42c47fe765547e60833a72b5ff1e78123c/cmake-patch.txt
echo '' >> cmake-patch.txt
git apply cmake-patch.txt
# another patch for missing header in cmake install list
git apply ../dune-copasi/.ci/dune-common.patch
cd ../
cd dune-logging
......
......@@ -7,6 +7,7 @@ echo "MSYSTEM: $MSYSTEM"
echo "DUNECONTROL: ${DUNECONTROL}"
echo "DUNE_OPTIONS_FILE: ${DUNE_OPTIONS_FILE}"
cat ${DUNE_OPTIONS_FILE}
echo "PWD: $PWD"
which g++
which python
......@@ -15,5 +16,5 @@ g++ --version
gcc --version
cmake --version
${DUNECONTROL} --opts=${DUNE_OPTIONS_FILE} --only=dune-copasi bexec make build_system_tests -j4
${DUNECONTROL} --opts=${DUNE_OPTIONS_FILE} --only=dune-copasi make --target build_system_tests
${DUNECONTROL} --opts=${DUNE_OPTIONS_FILE} --only=dune-copasi bexec ctest -j4 -L "DUNE_SYSTEMTEST" --output-on-failure
\ No newline at end of file
......@@ -7,6 +7,7 @@ echo "MSYSTEM: $MSYSTEM"
echo "DUNECONTROL: ${DUNECONTROL}"
echo "DUNE_OPTIONS_FILE: ${DUNE_OPTIONS_FILE}"
cat ${DUNE_OPTIONS_FILE}
echo "PWD: $PWD"
which g++
which python
......
---
BasedOnStyle: Mozilla
\ No newline at end of file
......@@ -76,8 +76,13 @@ stages:
-t ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${DUNECI_TOOLCHAIN} .
- docker push ${CI_REGISTRY}/copasi/dune-copasi/dependencies:${DUNECI_OS}-${DUNECI_TOOLCHAIN}
- docker logout $CI_REGISTRY/copasi/dune-copasi
only:
- master
variables:
# Run job if branch is master, job is scheduled or the variable REBUILD_BASE_IMAGE is defined
- $CI_COMMIT_BRANCH == "master"
- $CI_PIPELINE_SOURCE == "schedule"
- $REBUILD_BASE_IMAGE
.build: &build
stage: build
......@@ -91,9 +96,9 @@ stages:
.unit_tests: &unit_tests
stage: unit_tests
script:
script:
- echo 'CMAKE_FLAGS+=" -DCMAKE_BUILD_TYPE=Debug"' >> /duneci/cmake-flags/dune_copasi.opts
- cd ..
- cd ..
- bash dune-copasi/.ci/unit_tests.sh
artifacts:
paths:
......@@ -102,7 +107,7 @@ stages:
.system_tests: &system_tests
stage: system_tests
script:
script:
- cd ..
- bash dune-copasi/.ci/system_tests.sh
artifacts:
......@@ -114,7 +119,7 @@ stages:
.deploy: &deploy
<<: *docker_variables
stage: deploy
script:
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY/copasi/dune-copasi
- docker build -f docker/dune-copasi.dockerfile
--build-arg BASE_IMAGE=${DUNE_COPASI_BASE_IMAGE}
......@@ -125,7 +130,6 @@ stages:
only:
- master
# debian gcc
setup:debian_gcc:
<<: *debian_gcc
......@@ -158,7 +162,7 @@ deploy:debian_gcc:
# # ubuntu gcc
# setup:ubuntu_gcc:
# <<: *ubuntu_gcc
# <<: *setup
# <<: *setup
# build:ubuntu_gcc:
# <<: *ubuntu_gcc
......@@ -216,7 +220,7 @@ deploy:debian_clang:
# # ubuntu clang
# setup:ubuntu_clang:
# <<: *ubuntu_clang
# <<: *setup
# <<: *setup
# build:ubuntu_clang:
# <<: *ubuntu_clang
......@@ -234,7 +238,7 @@ deploy:debian_clang:
# <<: *ubuntu_clang
# <<: *system_tests
# dependencies:
# - build:ubuntu_clang
# - build:ubuntu_clang
# deploy:ubuntu_clang:
# <<: *ubuntu_clang
......
......@@ -31,22 +31,20 @@ before_install:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100; fi
- gcc --version
- g++ --version
- cd ..
# download muparser, gmp and libtiff as static libraries
- wget "https://github.com/lkeegan/libsbml-static/releases/latest/download/libsbml-static-$TRAVIS_OS_NAME.tgz"
- tar xzvf libsbml-static-$TRAVIS_OS_NAME.tgz
- sudo tar xzvf libsbml-static-$TRAVIS_OS_NAME.tgz -C /
- cd ..
install:
- echo 'CMAKE_FLAGS+=" -G '"'"'Unix Makefiles'"'"' "' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DCMAKE_CXX_STANDARD=17"' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DDUNE_PYTHON_VIRTUALENV_SETUP=1 -DDUNE_PYTHON_ALLOW_GET_PIP=1 "' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DDUNE_PYTHON_VIRTUALENV_PATH='"$PWD"'/dune-python-venv"' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DGMPXX_INCLUDE_DIR:PATH='"$PWD"'/gmp/include -DGMPXX_LIB:FILEPATH='"$PWD"'/gmp/lib/libgmpxx.a -DGMP_LIB:FILEPATH='"$PWD"'/gmp/lib/libgmp.a"' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DDUNE_PYTHON_VIRTUALENV_PATH='"$PWD"'/ext/dune-python-venv"' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DCMAKE_DISABLE_FIND_PACKAGE_QuadMath=TRUE -DBUILD_TESTING=OFF"' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DDUNE_USE_ONLY_STATIC_LIBS=ON -DCMAKE_BUILD_TYPE=Release"' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DCMAKE_PREFIX_PATH='"$PWD"' -DF77=true "' >> dune.opts
- echo 'CMAKE_FLAGS+=" -Dmuparser_ROOT='"$PWD"'/muparser "' >> dune.opts
- echo 'CMAKE_FLAGS+=" -DTIFF_ROOT='"$PWD"'/libtiff "' >> dune.opts
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then echo 'CMAKE_FLAGS+="-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3"' >> dune.opts; fi
- echo 'CMAKE_FLAGS+=" -DF77=true -DCMAKE_PREFIX_PATH=/opt/libs"' >> dune.opts
- echo 'CMAKE_FLAGS+=" -Dmuparser_INCLUDE_DIR:PATH=/opt/libs/include -Dmuparser_LIBRARIES:FILEPATH=opt/libs/lib/libmuparser.a"' >> dune.opts
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then echo 'CMAKE_FLAGS+=" -DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3"' >> dune.opts; fi
- echo 'MAKE_FLAGS="-j2 VERBOSE=1"' >> dune.opts
- export DUNE_OPTIONS_FILE="dune.opts"
- export DUNECONTROL=./dune-common/bin/dunecontrol
......@@ -59,8 +57,8 @@ after_script:
- bash dune-copasi/.ci/unit_tests.sh
- bash dune-copasi/.ci/system_tests.sh
# check dependencies of executable
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then otool -L $TRAVIS_BUILD_DIR/build-cmake/src/dune_copasi; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then ldd $TRAVIS_BUILD_DIR/build-cmake/src/dune_copasi; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then otool -L $TRAVIS_BUILD_DIR/build-cmake/src/dune_copasi_md; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then ldd $TRAVIS_BUILD_DIR/build-cmake/src/dune_copasi_md; fi
notifications:
email: false
\ No newline at end of file
......@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
<!--
<!--
Guiding Principles
Changelogs are for humans, not machines.
......@@ -27,10 +27,34 @@ Types of changes
## [Unreleased]
## [0.2.0] - 2020-02-20
### Added
- Code documentation
- Data Context concept for factories
- Factory concept for arbitrary object instantiation
- Add factories for finite element and finite element mas
- Brief installation instructions
- Models can interpolate grid functions
- Grid utilities to recognize and mark tripes of entities
- A finite volume loca operator
- Grid function getters for external use
- Single domain executable
### Changed
- Move and rename header files
- Multidomain finite element was split into a multidomain and a dynamic power finite element
- Code DUNE dependencies are set to release 2.7 (See README.md)
- Other DUNE dependencies are set to COPASI/support/dune-copasi (See README.md)
- Executable is an optional build
- Library is optional and is split into smaller libraries
- Bump version utility updated to python3
### Fixed
- Dirichlet-Dirichlet condition at interfaces was being computed twice
## [0.1.0] - 2019-10-11
### Added
- [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
- Solver for reaction-diffusion systems in multiple compartments.
[Unreleased]: https://gitlab.dune-project.org/copasi/dune-copasi/compare/v0.1.0...master
[Unreleased]: https://gitlab.dune-project.org/copasi/dune-copasi/compare/v0.2.0...master
[0.2.0]: https://gitlab.dune-project.org/copasi/dune-copasi/compare/v0.1.0...0.2.0
[0.1.0]: https://gitlab.dune-project.org/copasi/dune-copasi/-/tags/v0.1.0
\ No newline at end of file
......@@ -35,4 +35,4 @@ add_subdirectory(test)
add_subdirectory(cmake/modules)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
\ No newline at end of file
......@@ -2,88 +2,239 @@
[![Build Status](https://travis-ci.org/SoilRos/dune-copasi.svg?branch=master)](https://travis-ci.org/SoilRos/dune-copasi)
[![Build status](https://ci.appveyor.com/api/projects/status/6605joy2w17qvca8/branch/master?svg=true)](https://ci.appveyor.com/project/SoilRos/dune-copasi/history)
#### Dependencies
# dune-copasi
| Software | Version/Branch | Comments |
| ---------| -------------- | -------- |
| muParser | - |
| CMake | 3.10.2 |
| C++ compiler | [C++17](https://en.wikipedia.org/wiki/List_of_compilers#C++_compilers) |
| [dune-common](https://gitlab.dune-project.org/santiago.ospina/dune-common) | support/dune-copasi
| [dune-logging](https://gitlab.dune-project.org/staging/dune-logging) | master
| [dune-geometry](https://gitlab.dune-project.org/core/dune-geometry) | master
| [dune-grid](https://gitlab.dune-project.org/core/dune-grid) | master
| [dune-uggrid](https://gitlab.dune-project.org/staging/dune-uggrid) | master
| [dune-istl](https://gitlab.dune-project.org/core/dune-istl) | master
| [dune-localfunctions](https://gitlab.dune-project.org/core/dune-localfunctions) | master
| [dune-functions](https://gitlab.dune-project.org/staging/dune-functions) | master
| [dune-typetree](https://gitlab.dune-project.org/santiago.ospina/dune-typetree) | support/dune-copasi
| [dune-pdelab](https://gitlab.dune-project.org/santiago.ospina/dune-pdelab) | support/dune-copasi
| [dune-multidomaingrid](https://gitlab.dune-project.org/santiago.ospina/dune-multidomaingrid) | support/dune-copasi
<!--
Preparing the Sources
=========================
Additional to the software mentioned in README you'll need the
following programs installed on your system:
Solver for reaction-diffusion systems in multiple compartments
```
cmake >= 2.8.12
```
* Solve a reaction-diffusion system for each comartment
* Each compartment may have different system with different number of variables
* Neumann flux at the interface of compartments for variables with
the same name on the two compartments
* Easy to modify configuration file
* Initial conditions can be a TIFF file or a math expression
* Solved using the finite element or finite volume method
* Output in the VTK format
* Currently it only supports 2D simulations
Getting started
---------------
This project is made under the umbrella of the
[*Distributed and Unified Numerics Environment* `DUNE`](https://www.dune-project.org/) and the
[*Biochemical System Simulator* `COPASI`](http://copasi.org/).
Altought the rationale of the design is always driven by biochemical process (e.g. cell biology),
this software is not limited to this scope and can be used for other processes involving reaction-diffusion systems.
If these preliminaries are met, you should run
## Graphical User Interface for SBML files
```
dunecontrol all
```
For those working in bio-informatics there exist a grafical user interface for [`SBML`](https://en.wikipedia.org/wiki/SBML) files!
The GUI is able to convert non-spatial SBML models of bio-chemical reactions into
2D spatial models, and to simulate them with `dune-copasi`:
which will find all installed dune modules as well as all dune modules
(not installed) which sources reside in a subdirectory of the current
directory. Note that if dune is not installed properly you will either
have to add the directory where the `dunecontrol` script resides (probably
`./dune-common/bin`) to your path or specify the relative path of the script.
https://github.com/lkeegan/spatial-model-editor
Most probably you'll have to provide additional information to `dunecontrol`
(e. g. compilers, configure options) and/or make options.
## Installation
The most convenient way is to use options files in this case. The files
define four variables:
This requires that you have installed the following packages before the actual installation of `dune-copasi`.
```
CMAKE_FLAGS flags passed to cmake (during configure)
| Software | Version/Branch | Comments |
| ---------| -------------- | -------- |
| [CMake](https://cmake.org/) | 3.1 |
| C++ compiler | [C++17](https://en.wikipedia.org/wiki/List_of_compilers#C++_compilers) |
| [libTIFF](http://www.libtiff.org/) | 3.6.1 |
| [muParser](https://beltoforion.de/article.php?a=muparser) | 2.2.5 |
| [dune-common](https://gitlab.dune-project.org/copasi/dune-common) | releases/2.7 | https://gitlab.dune-project.org/core/dune-common
| [dune-geometry](https://gitlab.dune-project.org/core/dune-geometry) | releases/2.7 | https://gitlab.dune-project.org/core/dune-geometry
| [dune-grid](https://gitlab.dune-project.org/core/dune-grid) | releases/2.7 | https://gitlab.dune-project.org/core/dune-grid
| [dune-uggrid](https://gitlab.dune-project.org/staging/dune-uggrid) | releases/2.7 | https://gitlab.dune-project.org/staging/dune-uggrid
| [dune-istl](https://gitlab.dune-project.org/core/dune-istl) | releases/2.7 | https://gitlab.dune-project.org/core/dune-istl
| [dune-localfunctions](https://gitlab.dune-project.org/core/dune-localfunctions) | releases/2.7 | https://gitlab.dune-project.org/core/dune-localfunctions
| [dune-functions](https://gitlab.dune-project.org/staging/dune-functions) | releases/2.7 | https://gitlab.dune-project.org/staging/dune-functions
| [dune-logging](https://gitlab.dune-project.org/staging/dune-logging) | support/dune-copasi (recursive) | https://gitlab.dune-project.org/copasi/dune-logging
| [dune-typetree](https://gitlab.dune-project.org/copasi/dune-typetree) | support/dune-copasi | https://gitlab.dune-project.org/copasi/dune-typetree
| [dune-pdelab](https://gitlab.dune-project.org/copasi/dune-pdelab) | support/dune-copasi | https://gitlab.dune-project.org/copasi/dune-pdelab
| [dune-multidomaingrid](https://gitlab.dune-project.org/copasi/dune-multidomaingrid) | support/dune-copasi | https://gitlab.dune-project.org/copasi/dune-multidomaingrid
The first four can be obtained by your prefered package manager in unix-like operating systems. e.g.
```bash
# if you are in a debian/ubuntu OS
apt update
apt install cmake gcc g++ libtiff-dev libmuparser-dev git
# if you are in a macOS
xcode-select --install # Apple Command Line Tools
brew update
brew install cmake gcc libtiff muparser git
```
An example options file might look like this:
Now, the dune modules (including `dune-copasi`) can be all checkout in a same folder and be installed in one go.
```bash
#use this options to configure and make if no other options are given
CMAKE_FLAGS=" \
-DCMAKE_CXX_COMPILER=g++-5 \
-DCMAKE_CXX_FLAGS='-Wall -pedantic' \
-DCMAKE_INSTALL_PREFIX=/install/path" #Force g++-5 and set compiler flags
# prepare a folder to download and build dune modules
mkdir ~/dune-modules && cd ~/dune-modules
# fetch dependencies & dune-copasi in ~/dune-modules folder
git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-common
git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-geometry
git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-grid
git clone -b releases/2.7 https://gitlab.dune-project.org/staging/dune-uggrid
git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-istl
git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-localfunctions
git clone -b releases/2.7 https://gitlab.dune-project.org/staging/dune-functions
git clone -b support/dune-copasi --recursive https://gitlab.dune-project.org/copasi/dune-logging
git clone -b support/dune-copasi https://gitlab.dune-project.org/copasi/dune-typetree
git clone -b support/dune-copasi https://gitlab.dune-project.org/copasi/dune-pdelab
git clone -b support/dune-copasi https://gitlab.dune-project.org/copasi/dune-multidomaingrid
git clone -b master https://gitlab.dune-project.org/copasi/dune-copasi
# configure and build dune modules
./dune-common/bin/dunecontrol make all
# install dune-copasi (this operation may requiere sudo)
./dune-common/bin/dunecontrol --only=dune-copasi bexec make install
# if you do not want to install dune-copasi system-wide, you can set
# the CMAKE_INSTALL_PREFIX to a non restricted folder
# see https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html
# remove source and build files
cd .. && rm -r ~/dune-modules
```
If you save this information into example.opts you can pass the opts file to
dunecontrol via the `--opts option`, e. g.
For further info on dune module installation process, please check out
the [dune-project web page](https://www.dune-project.org/doc/installation/)
## Usage
If you installed `dune-copasi` system-wide, you should be able to call the program
`dune_copasi_md` from your command line accompained with a configuration file.
```bash
dunecontrol --opts=example.opts all
dune_copasi_md config.ini
```
More info
---------
### Configuration File
See
The configuration file follows [INI file format](https://en.wikipedia.org/wiki/INI_file).
It should contain at least two sections: `grid`, and `model`, whereas a third section
`logging` is optional.
```bash
dunecontrol --help
#### Grid
The grid section is fairly simple as it only contains the path to a [gmsh file](http://gmsh.info/)
and its initial refinement level:
```ini
[grid]
file = my_gmsh_file.msh
initial_level = 1
```
The grid should be formed by 2D traingles and squares where each *physical group* can only
only be formed by one of these type. That is, each *physical group* can have different types of
geometries, but whithin each *physical group* there cannot be more than one type. The GMSH file
should be v2 and it should not contain the *physical group* identifiers at the begining of the file
(this is a bug in the `dune-grid` reader).
#### Model
The model section starts with the definitions of the simulation time interval
and the polynomal order of the local finite element (currently only supports `0`, `1` and `2`),
where `0` refers for finite volume and higher for continuous galerking methods. This order refers
to the domains composed with triangles. Domains compose with squares are always solved with the
finite volume method.
```ini
[model]
begin_time = 0.
end_time = 10
time_step = 0.1
order = 1
```
for further options.
The following is the definition of the compartments of the model.
Each compartment corresponds to a *physical group* in the gmsh jargon.
Although the gmsh format allows you to name such physical groups,
we still need to assign them to a `dune-copasi` compartmet and for that
we use the *physical group* index. Notice that `dune-copasi` uses 0-based
indices while `gmsh` uses 1-based indices. In other words,
`<gmsh_physical_group> = <dune_copasi_compartment> + 1`.
Let's say for example that there is two *physical groups* in our gmsh file
and we are going to use them as `nucleous` and `cytoplasm` compartments:
```ini
[model.compartments]
# nucleous corresponds to the physical group 1 in the gmsh file
nucleous = 0
# cytoplasm corresponds to the physical group 2 in the gmsh file
cytoplasm = 0
```
Now, each of these compartments will define its own initial conditions,
its diffusion-reaction system, and its vtk writter. For that, you have to expand
the `model` section with the defined compartments, e.g. `model.nucleous` or `model.cytoplasm`.
The subsection `initial`, `reaction`, `diffusion` and `operator` define the system variables
and its properties. You can put as many variables as desired as long as they are the same
in this three subsections. Notice that each variable defines a new diffusion-reaction partial
differential equation associated with it.
* The `initial` subsection allow the initialization of each of the variables.
* The `diffusion` subsection defines the diffusion coefficient math
expression associated with each variable. It may only depend on the grid coordinates `x` and `y`.
* The `reaction` subsection defines the reaction part of each equation in the PDE.
Since this is the souce of non-linearities, it allows to be dependent on other defined variables
within the compartment. This section has to include yet another subsection called `jacobian`.
* The `reaction.jacobian` subsection must describe the
[jacobian matrix](https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant)
of the `reaction` part. It must follow the syntax of `d<var_i>_d<var_j>`, which
reads as the *partial derivate of `<var_i>` with respect to `<var_j>`*.
* The `operator` subsection is an experimental feature and we recommend to set all variables to the
same index, e.g. 0.
* Finally, the subsection `writer` will define the file name for the vtk output.
For example, the following `mode.nucleous` section defines a [Gray-Scott
model with `F=0.0420` and `k=0.0610`](http://mrob.com/pub/comp/xmorphia/F420/F420-k610.html):
```ini
[model.nucleous.initial]
u = 0.5
v = (x>0) && (x<0.5) && (y>0.) && (y<0.5) ? 1 : 0
[model.nucleous.diffusion]
u = 2e-5
v = 2e-5/2
[model.nucleous.reaction]
u = -u*v^2+0.0420*(1-u)
v = u*v^2-(0.0420+0.0610)*v
[model.nucleous.reaction.jacobian]
du_du = -v^2-0.0420
du_dv = -2*u*v
dv_du = v^2
dv_dv = 2*u*v-(0.0420+0.0610)
[model.nucleous.operator]
u = 0
v = 0
[model.nucleous.writer]
file_name = nucleous_output
```
The `model.cytoplasm` would have to be defined in similar way. An important aspect when working
with different compartments is the interface fluxes. In `dune-copasi` thex fluxes are set
automatically to [dirichlet-dirichlet](https://en.wikipedia.org/wiki/Dirichlet_boundary_condition)
boundary conditions iff the variable is shared between the two intersecting domains. Further
improvements will come for interface treatment.
#### Logging
The logging settings are directly forwarded to the `dune-logging` module. Please check
its doxygen documentation for detailed information. A simple configuration is the following:
```ini
[logging]
# possible levels: off, critical, error, waring, notice, info, debug, trace, all
default.level = trace
The full build system is described in the `dune-common/doc/buildsystem` (Git version) or under `share/doc/dune-common/buildsystem` if you installed DUNE! -->
\ No newline at end of file
[logging.sinks.stdout]
pattern = [{reldays:0>2}-{reltime:8%T}] [{backend}] {msg}
```
\ No newline at end of file
0.1.0
\ No newline at end of file
0.2.0
\ No newline at end of file
......@@ -6,23 +6,28 @@ clone_folder: C:\msys64\home\appveyor\dune-copasi
install:
- set PATH=C:\msys64\usr\bin;%PATH%
# download muparser, gmp and libtiff as static libraries
# download muparser, gmp and libtiff as static libraries: install to C:\libs
- mkdir temp
- cd temp
- appveyor DownloadFile "https://github.com/lkeegan/libsbml-static/releases/latest/download/libsbml-static-windows.zip"
- 7z x libsbml-static-windows.zip
- mv muparser C:\msys64\home\appveyor\.
- mv gmp C:\msys64\home\appveyor\.
- mv libtiff C:\msys64\home\appveyor\.
- mkdir C:\libs
- mv include C:\libs\.
- mv lib C:\libs\.
- dir "C:\libs"
- cd C:\msys64\home\appveyor
before_build:
- set DEPS_DIR=/home/appveyor
- echo CMAKE_FLAGS="-G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=1 " > C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DDUNE_PYTHON_VIRTUALENV_SETUP=0 -DDUNE_PYTHON_ALLOW_GET_PIP=0" >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DDUNE_PYTHON_VIRTUALENV_PATH=%DEPS_DIR%/dune-python-venv" >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DGMPXX_INCLUDE_DIR:PATH=%DEPS_DIR%/gmp/include -DGMPXX_LIB:FILEPATH=%DEPS_DIR%/gmp/lib/libgmpxx.a" >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DGMP_LIB:FILEPATH=%DEPS_DIR%/gmp/lib/libgmp.a -DCMAKE_DISABLE_FIND_PACKAGE_QuadMath=TRUE" >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DBUILD_TESTING=OFF -DDUNE_USE_ONLY_STATIC_LIBS=ON" >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DCMAKE_PREFIX_PATH=%DEPS_DIR% -Dmuparser_ROOT=%DEPS_DIR%/muparser -DTIFF_ROOT=%DEPS_DIR%/libtiff " >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DCMAKE_DISABLE_FIND_PACKAGE_QuadMath=TRUE" >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DBUILD_TESTING=OFF -DDUNE_USE_ONLY_STATIC_LIBS=ON " >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DF77=true -DCMAKE_CXX_FLAGS='-Wa,-mbig-obj -static -static-libgcc -static-libstdc++' " >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DGMPXX_INCLUDE_DIR:PATH=C:/libs/include " >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DGMPXX_LIB:FILEPATH=C:/libs/lib/libgmpxx.a " >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DGMP_LIB:FILEPATH=C:/libs/lib/libgmp.a " >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -DCMAKE_PREFIX_PATH=C:/libs " >> C:\msys64\home\appveyor\dune.txt
- echo CMAKE_FLAGS+=" -Dfmt_ROOT=C:/libs " >> C:\msys64\home\appveyor\dune.txt
- echo MAKE_FLAGS="-j2 VERBOSE=1" >> C:\msys64\home\appveyor\dune.txt
- type C:\msys64\home\appveyor\dune.txt
- set DUNE_OPTIONS_FILE=dune.txt
......
......@@ -7,15 +7,15 @@ RUN ln -s /duneci/toolchains/${TOOLCHAIN} /duneci/toolchain
RUN echo 'CMAKE_FLAGS+=" -DDUNE_PYTHON_VIRTUALENV_SETUP=1 -DDUNE_PYTHON_VIRTUALENV_PATH=/duneci/modules/dune-python-venv"' >> /duneci/cmake-flags/enable_virtualenv
RUN echo 'CMAKE_FLAGS+=" -DCMAKE_GENERATOR="Ninja' >> /duneci/cmake-flags/cmake_generator
RUN duneci-install-module -b support/dune-copasi https://gitlab.dune-project.org/santiago.ospina/dune-common.git \
&& duneci-install-module --recursive https://gitlab.dune-project.org/staging/dune-logging.git \
&& duneci-install-module -b feature/allow-multidomain-vtk-compare-to-have-same-thresholds https://gitlab.dune-project.org/quality/dune-testtools.git \
&& duneci-install-module https://gitlab.dune-project.org/core/dune-geometry.git \
&& duneci-install-module https://gitlab.dune-project.org/staging/dune-uggrid.git \
&& duneci-install-module https://gitlab.dune-project.org/core/dune-grid.git \
&& duneci-install-module https://gitlab.dune-project.org/core/dune-istl.git \
&& duneci-install-module https://gitlab.dune-project.org/core/dune-localfunctions.git \
&& duneci-install-module -b support/dune-copasi https://gitlab.dune-project.org/santiago.ospina/dune-typetree.git \
&& duneci-install-module https://gitlab.dune-project.org/staging/dune-functions.git \
&& duneci-install-module -b support/dune-copasi https://gitlab.dune-project.org/santiago.ospina/dune-pdelab.git \
&& duneci-install-module -b support/dune-copasi https://gitlab.dune-project.org/santiago.ospina/dune-multidomaingrid.git
\ No newline at end of file
RUN duneci-install-module -b releases/2.7 https://gitlab.dune-project.org/core/dune-common.git \
&& duneci-install-module -b releases/2.7 https://gitlab.dune-project.org/core/dune-geometry.git \
&& duneci-install-module -b releases/2.7 https://gitlab.dune-project.org/staging/dune-uggrid.git \
&& duneci-install-module -b releases/2.7 https://gitlab.dune-project.org/core/dune-grid.git \
&& duneci-install-module -b releases/2.7 https://gitlab.dune-project.org/core/dune-istl.git \
&& duneci-install-module -b releases/2.7 https://gitlab.dune-project.org/core/dune-localfunctions.git \
&& duneci-install-module -b releases/2.7 https://gitlab.dune-project.org/quality/dune-testtools.git \
&& duneci-install-module -b support/dune-copasi https://gitlab.dune-project.org/copasi/dune-typetree.git \
&& duneci-install-module -b releases/2.7 https://gitlab.dune-project.org/staging/dune-functions.git \
&& duneci-install-module -b support/dune-copasi --recursive https://gitlab.dune-project.org/copasi/dune-logging.git \
&& duneci-install-module -b support/dune-copasi https://gitlab.dune-project.org/copasi/dune-pdelab.git \
&& duneci-install-module -b support/dune-copasi https://gitlab.dune-project.org/copasi/dune-multidomaingrid.git
\ No newline at end of file
......@@ -4,7 +4,7 @@
#Name of the module
Module: dune-copasi
Version: 0.1.0
Version: 0.2.0
Maintainer: santiago.ospina@iwr.uni-heidelberg.de
#depending on
Depends: dune-logging dune-uggrid (>= 2.6) dune-pdelab (>= 2.6) dune-multidomaingrid (>= 2.6)
......
add_subdirectory(common)
add_subdirectory(concepts)
install(FILES coefficient_mapper.hh
dynamic_local_basis.hh
dynamic_local_coefficients.hh
dynamic_local_finite_element.hh
dynamic_local_interpolation.hh
enum.hh
gmsh_reader.hh
grid_function_writer.hh
local_operator_multidomain.hh
local_operator.hh
model_base.hh
model_diffusion_reaction.cc
model_diffusion_reaction.hh
model_multidomain_diffusion_reaction.cc
model_multidomain_diffusion_reaction.hh
model_state.hh
multidomain_entity_transformation.hh
multidomain_local_finite_element_map.hh
muparser_data_handler.hh
pdelab_callable_adapter.hh
pdelab_expression_adapter.hh
tiff_grayscale.hh
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dune/copasi")
add_subdirectory(finite_element)
add_subdirectory(finite_element_map)
add_subdirectory(local_operator)
add_subdirectory(grid)
add_subdirectory(model)
install(FILES coefficient_mapper.hh
data_context.hh
enum.hh
muparser_data_handler.hh
pdelab_expression_adapter.hh
factory.hh
tiff_grayscale.hh
COMPONENT Development
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/dune/copasi/common")
......@@ -14,12 +14,38 @@
namespace Dune::Copasi {
/**
* @brief Default coefficinet mapper
* @details Does nothing but evaluate the second an the third arguments of
* the parenthesis call into the first one. Useful to keep code
* compatible with other coefficient mappers
*/
struct DefaultCoefficientMapper
{
/**
* @brief Constructor. Arguments in this class do nothimg.
*
* @param[in] operator_config The operator configuration file
* @param[in] this_op The operator for local coefficients
*/
DefaultCoefficientMapper(const ParameterTree& operator_config,
std::size_t this_op)
{}
/**
* @brief Evaluates the coefficents for a give component and a degree of
* freedom. Either from a local vector x_view_local, or by other
* stored coefficients vector.
*
* @param[in] x_view_local The view on the local coefficients vector
* @param[in] comp The component
* @param[in] dof The degree of freedom
*
* @tparam XViewLocal The type fo the local coefficient view
*
* @return The coefficient value for the requested component and the
* degree of freedom
*/
template<class XViewLocal>
auto operator()(const XViewLocal& x_view_local,
const std::size_t& comp,
......@@ -28,17 +54,41 @@ struct DefaultCoefficientMapper
return x_view_local(comp, dof);
}
/**
* @brief Bind internal coefficients to an entity
*
* @param[in] <unnamed> The entity
*
* @tparam E The entity
*/
template<class E>
void bind(const E&)
{}
/**
* @brief Unbind this coefficients to an entity
*/
void unbind() {}
/**
* @brief Updates the internal coefficients with a exteral source.
*
* @param[in] <unnamed> Map to the model states
*
* @tparam T Map to the model states
*/
template<class T>
void update(const T&)
{}
};
/**
* @brief Model coefficinet mapper base
* @details Keeps a reference to external coefficients so that they are
* accessible within other local operators.
*
* @tparam ModelState The model state type
*/
template<class ModelState>
struct ModelCoefficientMapperBase
{
......@@ -58,13 +108,27 @@ struct ModelCoefficientMapperBase
std::map<std::size_t, std::shared_ptr<XView>> _x_view;
std::map<std::size_t, std::shared_ptr<SolutionVector>> _x;
/**
* @brief Constructs the model coefficient mapper base
* @details The operator in the argument refers to the index to which the
* coefficient mapper has to use local coefficients (passed as
* argument during evaluation) instead of the external
* coefficients. The index refers to the index to which the model
* states are mapped from.
*
* @param[in] this_op The operator for local coefficients
*/
ModelCoefficientMapperBase(std::size_t this_op)
: _this_op(this_op)
{}
/**
* @brief Updates the given model states.
*
* @param[in] states The model states
*/
void update(const std::map<std::size_t, ModelState>& states)
{
_x.clear();
_x_view.clear();
_lfs_cache.clear();
......@@ -81,6 +145,15 @@ struct ModelCoefficientMapperBase
}
}
/**
* @brief Bind internal coefficients to an entity
* @details This binds the entity to a internal local function space and
* local coefficients to the internal coefficients
*
* @param[in] entity The entity
*
* @tparam E The entity
*/
template<class E>
void bind(const E& entity)
{
......@@ -95,6 +168,9 @@ struct ModelCoefficientMapperBase
}
}
/**
* @brief Unbind this coefficients to an entity
*/
void unbind()
{
for (auto& [op, x_view] : _x_view)
......@@ -102,6 +178,14 @@ struct ModelCoefficientMapperBase
}
};
/**
* @brief Constructs the model coefficient mapper
* @details This coefficient mapper is designed to one domain local
* operators. That is, when the PDELab local function tree only
* has depth equal to 1
*
* @tparam ModelState The model state type
*/
template<class ModelState>
struct ModelCoefficientMapper : public ModelCoefficientMapperBase<ModelState>
{
......@@ -113,10 +197,21 @@ struct ModelCoefficientMapper : public ModelCoefficientMapperBase<ModelState>
// component -> (operator,child)
std::unordered_map<std::size_t, std::array<std::size_t, 2>> _comp_mapper;
/**
* @brief Constructor of the coefficient mapper
*
* @param[in] this_op The operator for local coefficients
*/
ModelCoefficientMapper(std::size_t this_op = 0)
: Base(this_op)
{}
/**
* @brief Constructor of the coefficient mapper
*
* @param[in] map_operator A vector mapping components to operators
* @param[in] this_op The operator for local coefficients
*/
ModelCoefficientMapper(const std::vector<std::size_t>& map_operator,
std::size_t this_op)
: Base(this_op)
......@@ -124,6 +219,12 @@ struct ModelCoefficientMapper : public ModelCoefficientMapperBase<ModelState>
set_mapper(map_operator);
}
/**
* @brief Constructor of the coefficient mapper
*
* @param[in] operator_config The operator configuration
* @param[in] this_op The operator for local coefficients
*/
ModelCoefficientMapper(const ParameterTree& operator_config,
std::size_t this_op)
: Base(this_op)
......@@ -141,6 +242,12 @@ struct ModelCoefficientMapper : public ModelCoefficientMapperBase<ModelState>
set_mapper(map_op);
}
/**
* @brief Sets a map from component to operator and child in the PDELab
* tree
*
* @param[in] map_op A vector mapping components to operators
*/
void set_mapper(const std::vector<std::size_t>& map_op)
{
std::size_t max_op = *std::max_element(map_op.begin(), map_op.end());
......@@ -151,6 +258,20 @@ struct ModelCoefficientMapper : public ModelCoefficientMapperBase<ModelState>
std::array<std::size_t, 2>{ map_op[i], comp_child[map_op[i]]++ };
}
/**
* @brief Evaluates the coefficents for a give component and a degree of
* freedom. Either from a local vector x_view_local, or by other
* stored coefficients vector.
*
* @param[in] x_view_local The view on the local coefficients vector
* @param[in] comp The component
* @param[in] dof The degree of freedom
*
* @tparam XViewLocal The type fo the local coefficient view
*
* @return The coefficient value for the requested component and the
* degree of freedom
*/
template<class XViewLocal>
auto operator()(const XViewLocal& x_view_local,
const std::size_t& comp,
......@@ -167,6 +288,14 @@ struct ModelCoefficientMapper : public ModelCoefficientMapperBase<ModelState>
}
};
/**
* @brief Constructs the coefficient mapper for multidomain models
* @details This coefficient mapper is designed to multidomain domain local
* operators. That is, when the PDELab local function tree has
* depth equal to 2
*
* @tparam ModelState The model state type
*/
template<class ModelState>
struct MultiDomainModelCoefficientMapper
: public ModelCoefficientMapper<ModelState>
......@@ -179,6 +308,20 @@ struct MultiDomainModelCoefficientMapper
using Base::Base;
std::size_t _domain;
/**
* @brief Evaluates the coefficents for a give component and a degree of
* freedom. Either from a local vector x_view_local, or by other
* stored coefficients vector.
*
* @param[in] x_view_local The view on the local coefficients vector
* @param[in] comp The component
* @param[in] dof The degree of freedom
*
* @tparam XViewLocal The type fo the local coefficient view
*
* @return The coefficient value for the requested component and the
* degree of freedom
*/
template<class XViewLocal>
auto operator()(const XViewLocal& x_view_local,
const std::size_t& comp,
......@@ -195,6 +338,16 @@ struct MultiDomainModelCoefficientMapper
}
}
/**
* @brief Bind internal coefficients to an entity
* @details This procedure sets the first child in the PDELab tree by
* finding the domain the entity belongs to, plus further bindings
* for the other coefficients
*
* @param[in] entity The entity
*
* @tparam E The entity
*/
template<class E>
void bind(const E& entity)
{
......
#ifndef DUNE_COPASI_CONTEXT_BASE_HH
#define DUNE_COPASI_CONTEXT_BASE_HH
#include <type_traits>
/**
@defgroup DataContext Data Context
@{
@brief Generalized and extensible static polymorphic data holder.
A data context is a generic form to pass around arbitrary unique amount of data following
a defined interface. Moreover, a data context is always extensible to hold more data
at compile time. It has a very similar concept and use cases as `**kwargs` in python.
It is called context because the content of the object depends on the context where it was called.
A data context knows at comile-time whether it contains a type identified
with certain signature.
@code{.cpp}
template<class Ctx>
void foo(Ctx&& ctx)
{
using GV = ...;
// check whether context contains the type GV
constexpr bool result = Ctx::has( Context::Tag<GV>{} );
// Get a view on the value GV contained in the context
const auto& view = ctx.view( Context::Tag<GV>{} );
// Create a new context containing a value 10 for the type `int`
// Notice that the old context can be moved into the new one if possible
auto new_ctx = Context::DataContext<Ctx,int>{10,std::forward<Ctx>(ctx))};
// move the value contained in `int` outside of the context
auto value = new_ctx.get( Context::Tag<int>{} );
// If not sure what types a data context contain, one can print them with
// Notice that it does not give information whether the data is valid or not
std::cout << "Output: " << new_ctx << std::endl
// Output: <data contained in ctx>, int;
}
@endcode
It's important to notice that this is also possible with variadic templates or
tuples, however, they usually involve a lot of template metaprogramming to identify
types and to add more types to it.
An easy way to create a data context with different values is using the method Context::data_context
@code{.cpp}
auto ctx = Context::data_context(int(1), double(2.0), std::string("I'm stored in a context"));
@endcode
@}
*/
namespace Dune::Copasi::Context {
/**
* @brief Tags any type with a unique default constructible struct
* @ingroup DataContext
*/
template<class T>
struct Tag {};
/**
* @brief Base data context context
* @ingroup DataContext
*/
struct DataContextBase
{
//! Default constructor
DataContextBase()
{}
/**
* @brief Method to check if context contains a type
*
* @param[in] <unnamed> Tagged version of the type to check
*
* @tparam T The type to check
*/
template<class T>
static bool constexpr has(Tag<T>)
{
return false;
}
/**
* @brief Gets a view on the stored value for type T
*
* @param[in] <unnamed> Tagged version of the type to view
*
* @tparam T The type to view
*
* @return A const reference to the stored value
*/
template<class T>
const T& view(Tag<T>) const
{
static_error(Dune::AlwaysFalse<T>::value, "Data context does not contain type T");
}
/**
* @brief Gets the ownership of the stored value for type T
*
* @param[in] <unnamed> Tagged version of the type to get
*
* @tparam T The type to get
*
* @return A rvalue to the stored value
*/
template<class T>
T&& get(Tag<T>)
{
static_error(Dune::AlwaysFalse<T>::value, "Data context does not contain type T");
}
/**
* @brief Writes type names to the output stream
*
* @param os The output stream
* @param[in] ctx The context to print
*
* @return The output stream with the type names
*/
friend std::ostream& operator<<(std::ostream& os, const DataContextBase& ctx)
{
return os;
}
};
/**
* @brief This class describes a data context.
* @ingroup DataContext
*
* @tparam T Type to store in the data context
* @tparam Ctx Context to be extended
*/
template<class T, class Ctx = DataContextBase>
class DataContext : public Ctx
{
// ensure that we have means to store T
static_assert(std::is_copy_constructible_v<T> or std::is_move_constructible_v<T>);
// ensure that each type is associated with a value only once
static_assert(not Ctx::has( Tag<T>{} ), "Data context already contains type T");
// helper function to assert a universal reference of T
template<class _T>
static constexpr bool is_valid_t = std::is_same_v<std::decay_t<T>,std::decay_t<_T>>;
// helper function to assert a universal reference of Ctx
template<class _Ctx>
static constexpr bool is_valid_ctx = std::is_same_v<std::decay_t<Ctx>,std::decay_t<_Ctx>>;
public:
// Inherit methods from the base context
using Ctx::get;
using Ctx::has;
using Ctx::view;
/**
* @brief Constructs a new instance
*
* @param value The value
* @param ctx The base context
*
* @tparam _T Universal reference of T
* @tparam _Ctx Universal reference of Ctx
* @tparam <unnamed> Helper SFINAE to disable constructor when _T and _Ctx are not valid
*/
template<class _T, class _Ctx,
class = std::enable_if_t<is_valid_t<_T> and is_valid_ctx<_Ctx>>>
DataContext(_T&& value, _Ctx&& ctx)
: Ctx(std::forward<_Ctx>(ctx))
, _value(std::forward<_T>(value))
{}
/**
* @brief Constructs a new instance.
*
* @param value The value
*
* @tparam _T Universal reference of T
* @tparam is_ctx_default_ctble Helper SFINAE bool for default constructible base context
* @tparam <unnamed> Helper SFINAE to disable constructor when _T is not valid and Ctx is not default construcible
*/
template<class _T,
bool is_ctx_default_ctble = std::is_default_constructible_v<Ctx>,
class = std::enable_if_t<is_valid_t<_T> and is_ctx_default_ctble>>
DataContext(_T&& value)
: _value(std::forward<_T>(value))
{}
/**
* @brief Method to check if context contains a type
*
* @tparam T The type to check
*/
static bool constexpr has(Tag<T>)
{
return true;
}
/**
* @brief Gets a view on the stored value for type T
*
* @tparam T The type to view
*
* @return A const reference to the stored value
*/
const T& view(Tag<T>) const
{
return _value;
}
/**
* @brief Gets the ownership of the stored value for type T
*
* @tparam T The type to get
*
* @return A rvalue to the stored value
*/
T&& get(Tag<T>)
{
return std::move(_value);
}
/**
* @brief Writes type names to the output stream
*
* @param os The output stream
* @param[in] ctx The context to print
*
* @return The output stream with the type names
*/
friend std::ostream& operator<<(std::ostream& os, const DataContext<T,Ctx>& ctx)
{
std::string ending = std::is_same_v<Ctx,DataContextBase> ? ";" : ", ";
os << "\t" << Dune::className<T>() << ending;
os << *static_cast<const Ctx *>(&ctx);
return os;
}
private:
//! Actual storage data of type T
T _value;
};
/**
* @brief Create a data context for one value
*
* @param value The value to store in the data context
*
* @tparam T Universal reference of the value to store
*
* @return A context storing the value
*/
template<class T>
auto data_context(T&& value)
{
return Context::DataContext<std::decay_t<T>>(std::forward<T>(value));
}
/**
* @brief Create a data context for several values
*
* @param arg The first argument in the data context
* @param args The rest of arguments in the data context
*
* @tparam Arg0 Universal reference of the first value to store
* @tparam Args Universal references of the rest of values to store
*
* @return A context storing all the values
*/
template<class Arg0, class... Args>
auto data_context(Arg0&& arg, Args&&... args)
{
auto base_ctx = data_context(std::forward<Args>(args)...);
return Context::DataContext<std::decay_t<Arg0>, decltype(base_ctx)>(arg, std::move(base_ctx));
}
} // namespace Dune::Copasi::Context
#endif // DUNE_COPASI_CONTEXT_BASE_HH
......@@ -3,6 +3,9 @@
namespace Dune::Copasi {
/**
* @brief This class describes a model setup policy.
*/
enum class ModelSetupPolicy
{
None,
......@@ -16,11 +19,17 @@ enum class ModelSetupPolicy
All
};
/**
* @brief This class describes an adaptivity policy.
*/
enum class AdaptivityPolicy
{
None
};
/**
* @brief This class describes a jacobian method.
*/
enum class JacobianMethod
{
Analytical,
......