fix doc domain

This commit is contained in:
giovanni
2025-03-12 15:27:06 +01:00
committed by Nicola Demo
parent dc5c5c2187
commit ce35af6397
10 changed files with 329 additions and 325 deletions

View File

@@ -1,4 +1,4 @@
"""Module for OperationInterface class."""
"""Module for the Operation Interface."""
from abc import ABCMeta, abstractmethod
from .domain_interface import DomainInterface
@@ -7,15 +7,16 @@ from ..utils import check_consistency
class OperationInterface(DomainInterface, metaclass=ABCMeta):
"""
Abstract class for set domains operations.
Abstract class for set operations defined on geometric domains.
"""
def __init__(self, geometries):
"""
Any geometry operation entity must inherit from this class.
Initialization of the :class:`OperationInterface` class.
:param list geometries: A list of geometries from ``pina.geometry``
such as ``EllipsoidDomain`` or ``CartesianDomain``.
:param list[DomainInterface] geometries: A list of instances of the
:class:`~pina.domain.DomainInterface` class on which the set
operation is performed.
"""
# check consistency geometries
check_consistency(geometries, DomainInterface)
@@ -29,21 +30,30 @@ class OperationInterface(DomainInterface, metaclass=ABCMeta):
@property
def sample_modes(self):
"""
List of available sampling modes.
:return: List of available sampling modes.
:rtype: list[str]
"""
return ["random"]
@property
def geometries(self):
"""
The geometries to perform set operation.
The domains on which to perform the set operation.
:return: The domains on which to perform the set operation.
:rtype: list[DomainInterface]
"""
return self._geometries
@property
def variables(self):
"""
Spatial variables of the domain.
List of variables of the domain.
:return: All the variables defined in ``__init__`` in order.
:return: List of variables of the domain.
:rtype: list[str]
"""
variables = []
@@ -54,22 +64,23 @@ class OperationInterface(DomainInterface, metaclass=ABCMeta):
@abstractmethod
def is_inside(self, point, check_border=False):
"""
Check if a point is inside the resulting domain after
a set operation is applied.
Abstract method to check if a point lies inside the resulting domain
after performing the set operation.
:param point: Point to be checked.
:type point: torch.Tensor
:param bool check_border: If ``True``, the border is considered inside.
:return: ``True`` if the point is inside the Intersection domain,
``False`` otherwise.
:param LabelTensor point: Point to be checked.
:param bool check_border: If ``True``, the border is considered inside
the resulting domain. Default is ``False``.
:return: ``True`` if the point is inside the domain, ``False`` otherwise.
:rtype: bool
"""
def _check_dimensions(self, geometries):
"""Check if the dimensions of the geometries are consistent.
"""
Check if the dimensions of the geometries are consistent.
:param geometries: Geometries to be checked.
:type geometries: list[Location]
:param list[DomainInterface] geometries: Domains to be checked.
:raises NotImplementedError: If the dimensions of the geometries are not
consistent.
"""
for geometry in geometries:
if geometry.variables != geometries[0].variables: