Skip to content

Commit edfd0a0

Browse files
rename AbstractProblem as BaseProblem
1 parent 9985e15 commit edfd0a0

40 files changed

+102
-88
lines changed

docs/source/_rst/_code.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ Problems
209209
:titlesonly:
210210

211211
ProblemInterface <problem/problem_interface.rst>
212-
AbstractProblem <problem/abstract_problem.rst>
212+
BaseProblem <problem/base_problem.rst>
213213
InverseProblem <problem/inverse_problem.rst>
214214
ParametricProblem <problem/parametric_problem.rst>
215215
SpatialProblem <problem/spatial_problem.rst>

docs/source/_rst/problem/abstract_problem.rst

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Base Problem
2+
===============
3+
.. currentmodule:: pina.problem.base_problem
4+
5+
.. automodule:: pina._src.problem.base_problem
6+
7+
.. autoclass:: pina._src.problem.base_problem.BaseProblem
8+
:members:
9+
:show-inheritance:

pina/_src/condition/condition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Condition:
1212
"""
1313
The :class:`Condition` class is a core component of the PINA framework that
1414
provides a unified interface to define heterogeneous constraints that must
15-
be satisfied by a :class:`~pina.problem.abstract_problem.AbstractProblem`.
15+
be satisfied by a :class:`~pina.problem.base_problem.BaseProblem`.
1616
1717
It encapsulates all types of constraints - physical, boundary, initial, or
1818
data-driven - that the solver must satisfy during training. The specific

pina/_src/condition/condition_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def problem(self):
4242
Return the problem associated with this condition.
4343
4444
:return: Problem associated with this condition.
45-
:rtype: ~pina.problem.abstract_problem.AbstractProblem
45+
:rtype: ~pina.problem.base_problem.BaseProblem
4646
"""
4747
return self._problem
4848

@@ -51,8 +51,8 @@ def problem(self, value):
5151
"""
5252
Set the problem associated with this condition.
5353
54-
:param pina.problem.abstract_problem.AbstractProblem value: The problem
55-
to associate with this condition
54+
:param pina.problem.base_problem.BaseProblem value: The problem to
55+
associate with this condition.
5656
"""
5757
self._problem = value
5858

pina/_src/condition/condition_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def problem(self):
2525
Return the problem associated with this condition.
2626
2727
:return: Problem associated with this condition.
28-
:rtype: ~pina.problem.abstract_problem.AbstractProblem
28+
:rtype: ~pina.problem.base_problem.BaseProblem
2929
"""
3030

3131
@problem.setter
@@ -34,7 +34,7 @@ def problem(self, value):
3434
"""
3535
Set the problem associated with this condition.
3636
37-
:param pina.problem.abstract_problem.AbstractProblem value: The problem
37+
:param pina.problem.base_problem.BaseProblem value: The problem
3838
to associate with this condition
3939
"""
4040

pina/_src/core/trainer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(
4848
4949
:param SolverInterface solver: A
5050
:class:`~pina.solver.solver.SolverInterface` solver used to solve a
51-
:class:`~pina.problem.abstract_problem.AbstractProblem`.
51+
:class:`~pina.problem.base_problem.BaseProblem`.
5252
:param int batch_size: The number of samples per batch to load.
5353
If ``None``, all samples are loaded and data is not batched.
5454
Default is ``None``.
@@ -184,7 +184,7 @@ def __init__(
184184
def _move_to_device(self):
185185
"""
186186
Moves the ``unknown_parameters`` of an instance of
187-
:class:`~pina.problem.abstract_problem.AbstractProblem` to the
187+
:class:`~pina.problem.base_problem.BaseProblem` to the
188188
:class:`Trainer` device.
189189
"""
190190
device = self._accelerator_connector._parallel_devices[0]

pina/_src/core/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ def labelize_forward(forward, input_variables, output_variables):
9393
9494
:param Callable forward: The forward function of a :class:`torch.nn.Module`.
9595
:param list[str] input_variables: The names of the input variables of a
96-
:class:`~pina.problem.abstract_problem.AbstractProblem`.
96+
:class:`~pina.problem.base_problem.BaseProblem`.
9797
:param list[str] output_variables: The names of the output variables of a
98-
:class:`~pina.problem.abstract_problem.AbstractProblem`.
98+
:class:`~pina.problem.base_problem.BaseProblem`.
9999
:return: The decorated forward function.
100100
:rtype: Callable
101101
"""

pina/_src/data/data_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__(
8484
"""
8585
Initialize the object and creating datasets based on the input problem.
8686
87-
:param AbstractProblem problem: The problem containing the data on which
87+
:param BaseProblem problem: The problem containing the data on which
8888
to create the datasets and dataloaders.
8989
:param float train_size: Fraction of elements in the training split. It
9090
must be in the range [0, 1].
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
"""Module for the AbstractProblem class."""
1+
"""Module for the BaseProblem class."""
22

3+
import warnings
34
from copy import deepcopy
45
from pina._src.problem.problem_interface import ProblemInterface
56
from pina._src.domain.domain_interface import DomainInterface
@@ -15,7 +16,7 @@
1516
)
1617

1718

18-
class AbstractProblem(ProblemInterface):
19+
class BaseProblem(ProblemInterface):
1920
"""
2021
Base class for all problems, implementing common functionality.
2122
@@ -31,7 +32,7 @@ class AbstractProblem(ProblemInterface):
3132

3233
def __init__(self):
3334
"""
34-
Initialization of the :class:`AbstractProblem` class.
35+
Initialization of the :class:`BaseProblem` class.
3536
"""
3637
self._discretised_domains = {}
3738

@@ -294,3 +295,14 @@ def are_all_domains_discretised(self):
294295
:rtype: bool
295296
"""
296297
return all(d in self.discretised_domains for d in self.domains)
298+
299+
300+
# Back-compatibility with version 0.2, to be removed soon
301+
class AbstractProblem(BaseProblem):
302+
def __init__(self, *args, **kwargs):
303+
warnings.warn(
304+
"AbstractProblem is deprecated, use BaseProblem instead",
305+
DeprecationWarning,
306+
stacklevel=2,
307+
)
308+
super().__init__(*args, **kwargs)

0 commit comments

Comments
 (0)