Skip to content

Commit be7dd77

Browse files
alexfiklinducer
authored andcommitted
docs: add show-inheritence to expressions
1 parent 0079352 commit be7dd77

1 file changed

Lines changed: 101 additions & 13 deletions

File tree

pytential/symbolic/primitives.py

Lines changed: 101 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,30 @@
9090
:class:`~pyopencl.array.Array` is used.
9191
9292
.. autoclass:: Expression
93+
:show-inheritance:
94+
:undoc-members:
95+
:members: mapper_method
9396
9497
Diagnostics
9598
^^^^^^^^^^^
9699
97100
.. autoclass:: ErrorExpression
101+
:show-inheritance:
102+
:undoc-members:
103+
:members: mapper_method
98104
99105
.. _placeholders:
100106
101107
Placeholders
102108
^^^^^^^^^^^^
103109
104110
.. autoclass:: var
111+
105112
.. autoclass:: SpatialConstant
113+
:show-inheritance:
114+
:undoc-members:
115+
:members: mapper_method
116+
106117
.. autofunction:: make_sym_mv
107118
.. autofunction:: make_sym_surface_mv
108119
@@ -139,8 +150,21 @@
139150
Discretization properties
140151
^^^^^^^^^^^^^^^^^^^^^^^^^
141152
153+
.. autoclass:: DiscretizationProperty
154+
:show-inheritance:
155+
:undoc-members:
156+
:members: mapper_method
157+
142158
.. autoclass:: IsShapeClass
159+
:show-inheritance:
160+
:undoc-members:
161+
:members: mapper_method
162+
143163
.. autoclass:: QWeight
164+
:show-inheritance:
165+
:undoc-members:
166+
:members: mapper_method
167+
144168
.. autofunction:: nodes
145169
.. autofunction:: parametrization_derivative
146170
.. autofunction:: parametrization_derivative_matrix
@@ -162,28 +186,66 @@
162186
^^^^^^^^^^^^^^^^^^^
163187
164188
.. autoclass:: NumReferenceDerivative
189+
:show-inheritance:
190+
:undoc-members:
191+
:members: mapper_method
192+
165193
.. autoclass:: NodeSum
194+
:undoc-members:
195+
:members: mapper_method
196+
166197
.. autoclass:: NodeMax
198+
:undoc-members:
199+
:members: mapper_method
200+
167201
.. autoclass:: NodeMin
202+
:undoc-members:
203+
:members: mapper_method
204+
168205
.. autoclass:: ElementwiseSum
206+
:undoc-members:
207+
:members: mapper_method
208+
209+
.. autoclass:: ElementwiseMin
210+
:undoc-members:
211+
:members: mapper_method
212+
169213
.. autoclass:: ElementwiseMax
214+
:undoc-members:
215+
:members: mapper_method
216+
170217
.. autofunction:: integral
218+
171219
.. autoclass:: Ones
220+
:show-inheritance:
221+
:undoc-members:
222+
:members: mapper_method
223+
172224
.. autofunction:: ones_vec
173225
.. autofunction:: area
174226
.. autofunction:: mean
227+
175228
.. autoclass:: IterativeInverse
229+
:show-inheritance:
230+
:undoc-members:
231+
:members: mapper_method
232+
176233
177234
Operators
178235
^^^^^^^^^
179236
180237
.. autoclass:: Interpolation
238+
:show-inheritance:
239+
:undoc-members:
240+
:members: mapper_method
241+
181242
.. autofunction:: interp
182243
183244
Geometric Calculus (based on Geometric/Clifford Algebra)
184245
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
185246
186247
.. autoclass:: Derivative
248+
:undoc-members:
187249
188250
Conventional Calculus
189251
^^^^^^^^^^^^^^^^^^^^^
@@ -200,6 +262,10 @@
200262
^^^^^^^^^^^^^^^^
201263
202264
.. autoclass:: IntG
265+
:show-inheritance:
266+
:undoc-members:
267+
:members: mapper_method
268+
203269
.. autofunction:: int_g_dsource
204270
.. autofunction:: int_g_vec
205271
@@ -310,9 +376,7 @@ def array_to_tuple(ary):
310376

311377
@expr_dataclass()
312378
class Expression(ExpressionBase):
313-
"""Bases: :class:`~pymbolic.primitives.Expression`.
314-
315-
A subclass of :class:`~pymbolic.primitives.Expression` for use with
379+
"""A subclass of :class:`pymbolic.primitives.Expression` for use with
316380
:mod:`pytential` mappers.
317381
"""
318382

@@ -338,16 +402,16 @@ class ErrorExpression(Expression):
338402
"""The error message to raise when this expression is encountered."""
339403

340404

341-
def make_sym_mv(name, num_components):
405+
def make_sym_mv(name: str, num_components: int) -> MultiVector[Expression]:
342406
return MultiVector(make_sym_vector(name, num_components))
343407

344408

345409
def make_sym_surface_mv(name, ambient_dim, dim, dofdesc=None):
346410
par_grad = parametrization_derivative_matrix(ambient_dim, dim, dofdesc)
347411

348412
return sum(
349-
var("%s%d" % (name, i))
350-
* cse(MultiVector(vec), "tangent%d" % i, cse_scope.DISCRETIZATION)
413+
var(f"{name}{i}")
414+
* cse(MultiVector(vec), f"tangent{i}", cse_scope.DISCRETIZATION)
351415
for i, vec in enumerate(par_grad.T))
352416

353417

@@ -1128,17 +1192,26 @@ def make_op(operand_i):
11281192

11291193
@expr_dataclass()
11301194
class NodeSum(SingleScalarOperandExpression):
1131-
"""Implements a global sum over all discretization nodes."""
1195+
"""Bases: :class:`~pytential.symbolic.primitives.Expression`.
1196+
1197+
Implements a global sum over all discretization nodes.
1198+
"""
11321199

11331200

11341201
@expr_dataclass()
11351202
class NodeMax(SingleScalarOperandExpression):
1136-
"""Implements a global maximum over all discretization nodes."""
1203+
"""Bases: :class:`~pytential.symbolic.primitives.Expression`.
1204+
1205+
Implements a global maximum over all discretization nodes.
1206+
"""
11371207

11381208

11391209
@expr_dataclass()
11401210
class NodeMin(SingleScalarOperandExpression):
1141-
"""Implements a global minimum over all discretization nodes."""
1211+
"""Bases: :class:`~pytential.symbolic.primitives.Expression`.
1212+
1213+
Implements a global minimum over all discretization nodes.
1214+
"""
11421215

11431216

11441217
def integral(ambient_dim, dim, operand, dofdesc=None):
@@ -1191,21 +1264,27 @@ def __post_init__(self) -> None:
11911264

11921265
@expr_dataclass()
11931266
class ElementwiseSum(SingleScalarOperandExpressionWithWhere):
1194-
"""Returns a vector of DOFs with all entries on each element set
1267+
"""Bases: :class:`~pytential.symbolic.primitives.Expression`.
1268+
1269+
Returns a vector of DOFs with all entries on each element set
11951270
to the sum of DOFs on that element.
11961271
"""
11971272

11981273

11991274
@expr_dataclass()
12001275
class ElementwiseMin(SingleScalarOperandExpressionWithWhere):
1201-
"""Returns a vector of DOFs with all entries on each element set
1276+
"""Bases: :class:`~pytential.symbolic.primitives.Expression`.
1277+
1278+
Returns a vector of DOFs with all entries on each element set
12021279
to the minimum of DOFs on that element.
12031280
"""
12041281

12051282

12061283
@expr_dataclass()
12071284
class ElementwiseMax(SingleScalarOperandExpressionWithWhere):
1208-
"""Returns a vector of DOFs with all entries on each element set
1285+
"""Bases: :class:`~pytential.symbolic.primitives.Expression`.
1286+
1287+
Returns a vector of DOFs with all entries on each element set
12091288
to the maximum of DOFs on that element.
12101289
"""
12111290

@@ -1281,6 +1360,15 @@ def __post_init__(self) -> None:
12811360

12821361

12831362
class Derivative(DerivativeBase):
1363+
"""A symbolic derivative.
1364+
1365+
This mechanism cannot be used to take more than one derivative at a time.
1366+
1367+
.. automethod:: __call__
1368+
.. automethod:: dnabla
1369+
.. automethod:: resolve
1370+
"""
1371+
12841372
@property
12851373
def nabla(self):
12861374
raise ValueError("Derivative.nabla should not be used"
@@ -1364,7 +1452,7 @@ class IntG(Expression):
13641452
r"""
13651453
.. math::
13661454
1367-
\int_\Gamma T (\sum S_k[G](x-y) \sigma_k(y)) dS_y
1455+
\int_\Gamma T \left[\sum S_k[G](x-y) \sigma_k(y)\right] \,\mathrm{d} S_y
13681456
13691457
where :math:`\sigma_k` is the k-th *density*, :math:`G` is a Green's
13701458
function, :math:`S_k` are source derivative operators and :math:`T` is a

0 commit comments

Comments
 (0)