Skip to content

Commit

Permalink
Merge pull request #120 from Pressio/version_0130
Browse files Browse the repository at this point in the history
version 0.13.0
  • Loading branch information
fnrizzi authored Oct 18, 2022
2 parents 69d9eb5 + d3e859f commit 312033a
Show file tree
Hide file tree
Showing 1,508 changed files with 34,811 additions and 215,468 deletions.
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,11 @@ else()

if(PRESSIODEMOAPPS_ENABLE_TESTS)
enable_testing()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/tpls/eigen/eigen3
${CMAKE_CURRENT_SOURCE_DIR}/tpls/pressio/include)
add_subdirectory(tests_mesh)
add_subdirectory(tests_cpp)
endif()

if(PRESSIODEMOAPPS_ENABLE_PERF)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/tpls/eigen/eigen3
${CMAKE_CURRENT_SOURCE_DIR}/tpls/pressio/include)
add_subdirectory(tests_perf)
endif()

Expand Down
242 changes: 0 additions & 242 deletions README.md

Large diffs are not rendered by default.

36 changes: 17 additions & 19 deletions docs/source/apicpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,23 @@ A *pressio-demoapps* C++ problem class meets the following API

The scalar type: this is by default ``double``.

.. cpp:type:: independent_variable_type

This represents "time" and is the same as the ``scalar_type``.

.. cpp:type:: state_type

Data structure type storing the state: this depends on which specific implementation
you use when you instantiate the problem using the ``create_problem_<>`` API
(see `Supported Backends And Types`_ for more details about backends and corresponding types).
For example, if you use ``create_problem_eigen``, the ``state_type`` will be an Eigen vector.

.. cpp:type:: velocity_type
.. cpp:type:: right_hand_side_type

Data structure type to store the velocity (or RHS): this depends on which specific implementation
Data structure type to store the RHS: this depends on which specific implementation
you use when you instantiate the problem using the ``create_problem_<>`` API
(see `Supported Backends And Types`_ for more details about backends and corresponding types).
For example, if you use ``create_problem_eigen``, the ``velocity_type`` will be an Eigen vector.
For example, if you use ``create_problem_eigen``, the ``right_hand_side_type`` will be an Eigen vector.

.. cpp:type:: jacobian_type

Expand All @@ -45,31 +49,25 @@ A *pressio-demoapps* C++ problem class meets the following API

Constructs and returns an instance of the initial condition for the target problem.

.. cpp:function:: velocity_type createVelocity()
.. cpp:function:: right_hand_side_type createRightHandSide()

Constructs and returns an instance of the velocity.
Constructs and returns an instance of the right hand side.

.. cpp:function:: jacobian_type createJacobian()

Constructs and returns an instance of the jacobian.

.. cpp:function:: void velocity(const state_type & y, scalar_type time, velocity_type & v)

Given a state :math:`y` and time :math:`time`,
evaluates the RHS of the system and overwrites :math:`v`.

.. cpp:function:: void jacobian(const state_type & y, scalar_type time, jacobian_type & J)
.. cpp:function:: void operator()(const state_type & y, scalar_type time, right_hand_side_type & v)

Given a state :math:`y` and time :math:`time`,
evaluates the Jacobian of the RHS and stores it into :math:`J`.
evaluates the RHS of the system overwriting :math:`v`.

.. cpp:function:: void velocityAndJacobian(const state_type & y, \
scalar_type time, \
velocity_type & v, \
jacobian_type & J)
.. cpp:function:: void operator()(const state_type & y, scalar_type time,\
right_hand_side_type & v, jacobian_type & J, bool computeJac)

Given a state :math:`y` and time :math:`time`,
evaluates the RHS and its Jacobian.
evaluates the RHS of the system overwriting :math:`v` and if ``computeJac == true``,
its Jacobian and stores it into :math:`J`.

.. cpp:function:: auto totalDofSampleMesh()

Expand Down Expand Up @@ -100,7 +98,7 @@ C++ Backends and Corresponding Types
- Type alias

* - Eigen
- ``using state_type = Eigen::Matrix<scalar_type, Eigen::Dynamic, 1>`` :raw-html-m2r:`<br/>` :raw-html-m2r:`<br/>` ``using velocity_type = Eigen::Matrix<scalar_type, Eigen::Dynamic, 1>`` :raw-html-m2r:`<br/>` :raw-html-m2r:`<br/>` ``using jacobian_type = Eigen::SparseMatrix<scalar_type, Eigen::RowMajor, int32_t>;``
- ``using state_type = Eigen::Matrix<scalar_type, Eigen::Dynamic, 1>`` :raw-html-m2r:`<br/>` :raw-html-m2r:`<br/>` ``using right_hand_side_type = Eigen::Matrix<scalar_type, Eigen::Dynamic, 1>`` :raw-html-m2r:`<br/>` :raw-html-m2r:`<br/>` ``using jacobian_type = Eigen::SparseMatrix<scalar_type, Eigen::RowMajor, int32_t>;``


.. _cpp-mesh-api:
Expand Down Expand Up @@ -137,7 +135,7 @@ A *pressio-demoapps* C++ cell-centered mesh class meets the following API
.. cpp:function:: index_type sampleMeshSize() const

Returns the number of *sample* cells in the mesh.
This corresponds to all cells where the velocity (or RHS) is defined.
This corresponds to all cells where the RHS is defined.

.. cpp:function:: scalar_type dx() const

Expand Down
10 changes: 5 additions & 5 deletions docs/source/apipy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Problem Class

:rtype: numpy array

.. py:method:: createVelocity()
.. py:method:: createRightHandSide()
Constructs and returns an instance of the velocity.
Constructs and returns an instance of the rhs.

:rtype: numpy array

Expand All @@ -33,14 +33,14 @@ Problem Class
:rtype: numpy array


.. py:method:: velocity(y, time, v)
.. py:method:: rightHandSide(y, time, rhs)
Given a state :math:`y` and time :math:`time`,
evaluates the RHS of the system and stores it into :math:`v`.

:param numpy array y: state vector
:param float time: evaluation time
:param numpy array v: velocity to overwrite
:param numpy array rhs: rhs to overwrite

.. py:method:: applyJacobian(y, operand, time, result)
Expand Down Expand Up @@ -107,7 +107,7 @@ A *pressio-demoapps* Python cell-centered mesh class meets the following API
.. py:method:: sampleMeshSize()
Returns the number of *sample* cells in the mesh.
This corresponds to all cells where the velocity (or RHS) is defined.
This corresponds to all cells where the RHS is defined.

:rtype: int

Expand Down
6 changes: 3 additions & 3 deletions docs/source/howtouse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ Here we show some things you can do using the C++ as an example:
auto state = problem.initialCondition();

// having the problem and initial condition, create instance of the RHS
auto rhs = problem.createVelocity()
auto rhs = problem.createRightHandSide()
// compute the rhs of the discrete system at time=0.0
problem.velocity(state, 0.0, rhs);
problem.rightHandSide(state, 0.0, rhs);

// create the Jacobian
auto J = problem.createJacobian()
// compute J at time=0.0
problem.velocityAndJacobian(state, 0.0, rhs, J);
problem.rightHandSideAndJacobian(state, 0.0, rhs, J);
// or we can compute just the Jacobian
problem.jacobian(state, 0.0, J);

Expand Down
16 changes: 1 addition & 15 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ To use it, you need a C++14 compiler and you have to:

2. include the Eigen library (whose headers you can find inside ``pressiodemoapps/tpls``).

3. specify the CMake option ``-DPRESSIODEMOAPPS_ENABLE_TPL_EIGEN=ON`` while building your code.

Building the test suite
~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -25,7 +23,7 @@ If you want to build the C++ tests, you need CMake > 3.18.0 and then do::
git clone --recursive [email protected]:Pressio/pressio-demoapps.git
export CXX=<path-to-your-CXX-compiler> #must support C++14
cd pressio-demoapps && mkdir build && cd build
cmake -DPRESSIODEMOAPPS_ENABLE_TESTS=On -DPRESSIODEMOAPPS_ENABLE_TPL_EIGEN=ON ..
cmake -DPRESSIODEMOAPPS_ENABLE_TESTS=On ..
make -j4
ctest -j4

Expand Down Expand Up @@ -54,18 +52,6 @@ Then, you can do:
This builds/installs pressiodemoapps with default options (build_mode=Release).



..
To build/install pressiodemoapps with OpenMP and Release mode:
git clone --recursive [email protected]:Pressio/pressio-demoapps.git
export CXX=<path-to-your-CXX-compiler> #must support C++14
python3 cmake_build.py --openmp
pip3 install .
# to just build do
python -m build

You can run the tests to verify things::

cd pressio-demoapps
Expand Down
6 changes: 3 additions & 3 deletions docs/source/meshsample.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ What is a sample mesh and why?

.. Important::
In practice, a sample mesh is a disjoint collection
of cells where one computes the velocity (or RHS or residual) vector
of cells where one computes the RHS (or residual) vector
and Jacobian matrix of the target system.

The sample mesh is critical, for example, for projection-based ROMs of nonlinear systems.
Expand All @@ -26,9 +26,9 @@ and the `discrete empirical interpolation method (DEIM) <https://doi.org/10.1137
While the sample mesh strictly speaking refers to the collection of cells
where we compute the residual and Jacobian, a related concept is what we refer to as **stencil mesh**.
We refer to **stencil mesh** the collection of cells that are needed to compute
the velocity or residual vector on the *sample mesh*.
the RHS or residual vector on the *sample mesh*.
Note that, in general, the sample mesh is a subset of the stencil mesh,
because to compute the velocity or residual at a given cell, one also needs
because to compute the RHS or residual at a given cell, one also needs
the cell-centered values at that target cell.

For more discussion on this, see `this page <https://pressio.github.io/proms/hyper/>`_.
Expand Down
Loading

0 comments on commit 312033a

Please sign in to comment.