Skip to content

Commit 999c298

Browse files
committed
This PR fixes the docstrings in cython
1 parent 313441c commit 999c298

1 file changed

Lines changed: 35 additions & 14 deletions

File tree

cyprecice/cyprecice.pyx

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ cdef class Participant:
3939
"""
4040
Main Application Programming Interface of preCICE.
4141
To adapt a solver to preCICE, follow the following main structure:
42-
- Create an object of Participant with Participant()
43-
- Initialize preCICE with Participant::initialize()
44-
- Advance to the next (time)step with Participant::advance()
45-
- Finalize preCICE with Participant::finalize()
46-
- We use solver, simulation code, and participant as synonyms.
47-
- The preferred name in the documentation is participant.
42+
43+
- Create an object of Participant with Participant()
44+
- Initialize preCICE with Participant::initialize()
45+
- Advance to the next (time)step with Participant::advance()
46+
- Finalize preCICE with Participant::finalize()
47+
- We use solver, simulation code, and participant as synonyms.
48+
- The preferred name in the documentation is participant.
4849
"""
4950

5051
# fake __init__ needed to display docstring for __cinit__ (see https://stackoverflow.com/a/42733794/5158031)
@@ -105,10 +106,10 @@ cdef class Participant:
105106
method to finally exchange the data.
106107
107108
This function handles:
108-
- Parallel communication to the coupling partner/s is setup.
109-
- Meshes are exchanged between coupling partners and the parallel partitions are created.
110-
- [Serial Coupling Scheme] If the solver is not starting the simulation, coupling data is received
111-
from the coupling partner's first computation.
109+
110+
- Parallel communication to the coupling partner/s is setup.
111+
- Meshes are exchanged between coupling partners and the parallel partitions are created.
112+
- [Serial Coupling Scheme] If the solver is not starting the simulation, coupling data is received from the coupling partner's first computation.
112113
113114
Returns
114115
-------
@@ -206,8 +207,10 @@ cdef class Participant:
206207
"""
207208
Checks if the coupled simulation is still ongoing.
208209
A coupling is ongoing as long as
209-
- the maximum number of timesteps has not been reached, and
210-
- the final time has not been reached.
210+
211+
- the maximum number of timesteps has not been reached, and
212+
- the final time has not been reached.
213+
211214
The user should call finalize() after this function returns false.
212215
213216
Returns
@@ -227,8 +230,9 @@ cdef class Participant:
227230
"""
228231
Checks if the current coupling timewindow is completed.
229232
The following reasons require several solver time steps per coupling time step:
230-
- A solver chooses to perform subcycling.
231-
- An implicit coupling timestep iteration is not yet converged.
233+
234+
- A solver chooses to perform subcycling.
235+
- An implicit coupling timestep iteration is not yet converged.
232236
233237
Returns
234238
-------
@@ -790,27 +794,31 @@ cdef class Participant:
790794
Examples
791795
--------
792796
Write scalar data for a 2D problem with 5 vertices:
797+
793798
>>> mesh_name = "MeshOne"
794799
>>> data_name = "DataOne"
795800
>>> vertex_ids = [1, 2, 3, 4, 5]
796801
>>> values = np.array([v1, v2, v3, v4, v5])
797802
>>> participant.write_data(mesh_name, data_name, vertex_ids, values)
798803
799804
Write vector data for a 2D problem with 5 vertices:
805+
800806
>>> mesh_name = "MeshOne"
801807
>>> data_name = "DataOne"
802808
>>> vertex_ids = [1, 2, 3, 4, 5]
803809
>>> values = np.array([[v1_x, v1_y], [v2_x, v2_y], [v3_x, v3_y], [v4_x, v4_y], [v5_x, v5_y]])
804810
>>> participant.write_data(mesh_name, data_name, vertex_ids, values)
805811
806812
Write vector data for a 3D (D=3) problem with 5 (N=5) vertices:
813+
807814
>>> mesh_name = "MeshOne"
808815
>>> data_name = "DataOne"
809816
>>> vertex_ids = [1, 2, 3, 4, 5]
810817
>>> values = np.array([[v1_x, v1_y, v1_z], [v2_x, v2_y, v2_z], [v3_x, v3_y, v3_z], [v4_x, v4_y, v4_z], [v5_x, v5_y, v5_z]])
811818
>>> participant.write_data(mesh_name, data_name, vertex_ids, values)
812819
813820
Write vector data for a 3D (D=3) problem with 5 (N=5) vertices, where the values are provided as a list of tuples:
821+
814822
>>> mesh_name = "MeshOne"
815823
>>> data_name = "DataOne"
816824
>>> vertex_ids = [1, 2, 3, 4, 5]
@@ -873,6 +881,7 @@ cdef class Participant:
873881
Examples
874882
--------
875883
Read scalar data for a 2D problem with 5 vertices:
884+
876885
>>> mesh_name = "MeshOne"
877886
>>> data_name = "DataOne"
878887
>>> vertex_ids = [1, 2, 3, 4, 5]
@@ -882,6 +891,7 @@ cdef class Participant:
882891
>>> (5, )
883892
884893
Read vector data for a 2D problem with 5 vertices:
894+
885895
>>> mesh_name = "MeshOne"
886896
>>> data_name = "DataOne"
887897
>>> vertex_ids = [1, 2, 3, 4, 5]
@@ -891,6 +901,7 @@ cdef class Participant:
891901
>>> (5, 2)
892902
893903
Read vector data for a 3D system with 5 vertices:
904+
894905
>>> mesh_name = "MeshOne"
895906
>>> data_name = "DataOne"
896907
>>> vertex_ids = [1, 2, 3, 4, 5]
@@ -951,13 +962,15 @@ cdef class Participant:
951962
Examples
952963
--------
953964
Write scalar data for a 2D problem with 5 vertices:
965+
954966
>>> mesh_name = "MeshOne"
955967
>>> data_name = "DataOne"
956968
>>> coordinates = np.array([[c1_x, c1_y], [c2_x, c2_y], [c3_x, c3_y], [c4_x, c4_y], [c5_x, c5_y]])
957969
>>> values = np.array([v1, v2, v3, v4, v5])
958970
>>> participant.write_and_map_data(mesh_name, data_name, coordinates, values)
959971
960972
Write scalar data for a 2D problem with 5 vertices, where the coordinates are provided as a list of tuples, and the values are provided as a list of scalars:
973+
961974
>>> mesh_name = "MeshOne"
962975
>>> data_name = "DataOne"
963976
>>> coordinates = [(c1_x, c1_y), (c2_x, c2_y), (c3_x, c3_y), (c4_x, c4_y), (c5_x, c5_y)]
@@ -1008,6 +1021,7 @@ cdef class Participant:
10081021
Examples
10091022
--------
10101023
Read scalar data for a 2D problem with 2 vertices:
1024+
10111025
>>> mesh_name = "MeshOne"
10121026
>>> data_name = "DataOne"
10131027
>>> coordinates = np.array([[1.0, 1.0], [2.0, 2.0]])
@@ -1017,6 +1031,7 @@ cdef class Participant:
10171031
>>> (2, )
10181032
10191033
Read scalar data for a 2D problem with 2 vertices, where the coordinates are provided as a list of tuples:
1034+
10201035
>>> mesh_name = "MeshOne"
10211036
>>> data_name = "DataOne"
10221037
>>> coordinates = [(1.0, 1.0), (2.0, 2.0)]
@@ -1075,20 +1090,23 @@ cdef class Participant:
10751090
Examples
10761091
--------
10771092
Write gradient vector data for a 2D problem with 2 vertices:
1093+
10781094
>>> mesh_name = "MeshOne"
10791095
>>> data_name = "DataOne"
10801096
>>> vertex_ids = [1, 2]
10811097
>>> gradients = np.array([[v1x_dx, v1y_dx, v1x_dy, v1y_dy], [v2x_dx, v2y_dx, v2x_dy, v2y_dy]])
10821098
>>> participant.write_gradient_data(mesh_name, data_name, vertex_ids, gradients)
10831099
10841100
Write gradient vector data for a 2D problem with 2 vertices, where the gradients are provided as a list of tuples:
1101+
10851102
>>> mesh_name = "MeshOne"
10861103
>>> data_name = "DataOne"
10871104
>>> vertex_ids = [1, 2]
10881105
>>> gradients = [(v1x_dx, v1y_dx, v1x_dy, v1y_dy), (v2x_dx, v2y_dx, v2x_dy, v2y_dy)]
10891106
>>> participant.write_gradient_data(mesh_name, data_name, vertex_ids, gradients)
10901107
10911108
Write vector data for a 3D problem with 2 vertices:
1109+
10921110
>>> mesh_name = "MeshOne"
10931111
>>> data_name = "DataOne"
10941112
>>> vertex_ids = [1, 2]
@@ -1134,6 +1152,7 @@ cdef class Participant:
11341152
Examples
11351153
--------
11361154
Check if gradient data is required for a data:
1155+
11371156
>>> mesh_name = "MeshOne"
11381157
>>> data_name = "DataOne"
11391158
>>> participant.is_gradient_data_required(mesh_name, data_name)
@@ -1238,6 +1257,7 @@ cdef class Participant:
12381257
Examples
12391258
--------
12401259
Start a profiling section with the event name "EventOne":
1260+
12411261
>>> event_name = "EventOne"
12421262
>>> participant.start_profiling_section(event_name)
12431263
"""
@@ -1250,6 +1270,7 @@ cdef class Participant:
12501270
Examples
12511271
--------
12521272
Stop the last profiling section:
1273+
12531274
>>> participant.stop_last_profiling_section()
12541275
"""
12551276
self.thisptr.stopLastProfilingSection()

0 commit comments

Comments
 (0)