Skip to content

Commit

Permalink
write doc about :
Browse files Browse the repository at this point in the history
- parameters
- petsc vectors
- petsc matrix
Write documentation on python x feel++ modules #151
[ci skip]
  • Loading branch information
thomas-saigre committed Jun 23, 2021
1 parent 5926664 commit c8b4d4b
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/user/modules/python/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
*** xref:pyfeelpptoolboxes/electric.adoc[Electrostatic]
*** xref:pyfeelpptoolboxes/fluid.adoc[Fluid Mechanics]
*** xref:pyfeelpptoolboxes/solid.adoc[Solid Mechanics]
** xref:pyfeelppmor/index.adoc[{pyfeelppmor}]
*** xref:pyfeelppmor/parameters.adoc[Parameters]
*** xref:pyfeelppmor/petscDouble.adoc[PETSc vector and matrix]
5 changes: 5 additions & 0 deletions docs/user/modules/python/pages/pyfeelppmor/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= {feelpp} model order reduction in Python
include::{partialsdir}/header-macros.adoc[]

This sections present the modules developped and the function implemented to handle {fpp} MOR objects in Python. The script link:https://github.com/feelpp/feelpp/blob/develop/mor/pyfeelpp-mor/feelpp/mor/toolboxmor.py[toolboxmor.py] presents the main features, on the case opus-heat.

33 changes: 33 additions & 0 deletions docs/user/modules/python/pages/pyfeelppmor/parameters.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
= Parameters

Class `ParameterSpaceElement` (more precisely `feelpp.mor._mor.ParameterSpaceElement`). Contains the parameters of the problem.

.Get a parameter from the model
[source,python]
----
Dmu = model.parameterSpace()
mu = Dmu.element(True, False)
----


== Methods

* `__call__(i: int)` -> `float` : return the _i_-th parameter

* `__str__()` :

[source,python]
----
>>> print("mu =", mu)
mu = [4.37e+00,2.92e+00,1.17e+00,8.75e+05,5.28e+05,2.83e+01]
----

* `parameterName(i: int)` -> `str` : return the named of the _i_-th parameter

* `parameterNamed(name: str)` -> `float` : return the parameter named `str`

* `setParameter(i: int, value: float)` : set the _i_-th to `value`

* `setParameterNamed(name: str, value: float)` : set the parameter `name` to `value`

* `size()` -> `int` : return the size of the parameter
38 changes: 38 additions & 0 deletions docs/user/modules/python/pages/pyfeelppmor/petscDouble.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
== Vector PETSc Double

Class `VectorPetscDouble` (`feelpp._alg.VectorPetscDouble`)


=== Methods

* `__init__(*args, **kwargs)` : Overloaded function.

1. `__init__()`. The vector created is empty.
2. `__init__(arg0: int, arg1: feelpp._core.WorldComm)`. The vector created has a size `arg0`.
3. `__init__(arg0: int, arg1: int, arg2: feelpp._core.WorldComm)`. The vector created has a global size `arg0`, and a local size `arg1`.
4. `__init__(arg0: feelpp._alg.DataMap, arg1: bool)`
* `clear()` : clear PETSc vector
* `size()` -> `int` : return PETSc Vector size
* `vec()` -> `vec` : return a PETSc Vector that can be manipulated with funciton of the module https://pypi.org/project/petsc4py/[petsc4py]. The functions of this class can be found on the https://www.mcs.anl.gov/petsc/petsc4py-current/docs/apiref/petsc4py.PETSc.Vec-class.html[documentation of PETSc4py].
* `zero()` : zero PETSc vector


== Matrix PETSc Double

Class `MatrixPetscDouble` (`feelpp._alg.MatrixPetscDouble`). The methods of this class are similar to the previous class, the apply on matrices insted of vectors.


=== Methods

* `__init__(*args, **kwargs)` : Overloaded function.
1. `__init__(arg0: feelpp._core.WorldComm)`
2. `__init__(arg0: feelpp._alg.DataMap, arg1: feelpp._alg.DataMap)`
3. `__init__(arg1: feelpp._alg.DataMap, arg2: feelpp._core.WorldComm)`
* `clear()` : clear PETSc matrix
* `mat(...)` -> `mat` : return a PETSc sparse matrix. See https://www.mcs.anl.gov/petsc/petsc4py-current/docs/apiref/petsc4py.PETSc.Mat-class.html[the documentation].
* `rowStart()` -> `int` : return PETSc Matrix row start. This method is usefull is the matrix is shared with many processors, as the following.
* `rowStop()` -> `int` : return PETSc Matrix row stop
* `size1()` -> `int` : return PETSc Matrix row size
* `size2()` -> `int` : return PETSc Matrix column size
* `shape()` -> `Tuple[int,int]` : return PETSc Matrix shape (`(row size, column size)`)
* `zero()` : zero PETSc matrix

0 comments on commit c8b4d4b

Please sign in to comment.