Operation docs update (#154)
* Operation Interface Enhancement + Clarification - added set notation to all the geometry operations - added a warning to say sample_surface=True doesn't work * minor fix docs * fix operation_interface.py doc --------- Co-authored-by: Dario Coscia <dariocoscia@Dario-Coscia.local> Co-authored-by: Dario Coscia <93731561+dario-coscia@users.noreply.github.com>
This commit is contained in:
@@ -9,7 +9,16 @@ class Difference(OperationInterface):
|
|||||||
""" PINA implementation of Difference of Domains."""
|
""" PINA implementation of Difference of Domains."""
|
||||||
|
|
||||||
def __init__(self, geometries):
|
def __init__(self, geometries):
|
||||||
""" PINA implementation of Difference of Domains.
|
"""
|
||||||
|
PINA implementation of Difference of Domains.
|
||||||
|
Given two sets :math:`A` and :math:`B` then the
|
||||||
|
domain difference is defined as:
|
||||||
|
|
||||||
|
..:math:
|
||||||
|
A \setminus B = \{x \mid x \in A \text{ and } x \not\in B\},
|
||||||
|
|
||||||
|
with :math:`x` a point in :math:`\mathbb{R}^N` and :math:`N`
|
||||||
|
the dimension of the geometry space.
|
||||||
|
|
||||||
:param list geometries: A list of geometries from 'pina.geometry'
|
:param list geometries: A list of geometries from 'pina.geometry'
|
||||||
such as 'EllipsoidDomain' or 'CartesianDomain'. The first
|
such as 'EllipsoidDomain' or 'CartesianDomain'. The first
|
||||||
|
|||||||
@@ -11,7 +11,16 @@ class Exclusion(OperationInterface):
|
|||||||
""" PINA implementation of Exclusion of Domains."""
|
""" PINA implementation of Exclusion of Domains."""
|
||||||
|
|
||||||
def __init__(self, geometries):
|
def __init__(self, geometries):
|
||||||
""" PINA implementation of Exclusion of Domains.
|
"""
|
||||||
|
PINA implementation of Exclusion of Domains.
|
||||||
|
Given two sets :math:`A` and :math:`B` then the
|
||||||
|
domain difference is defined as:
|
||||||
|
|
||||||
|
..:math:
|
||||||
|
A \setminus B = \{x \mid x \in A \text{ and } x \in B\ \text{ and } x \not\in (A \text{ or } B)},
|
||||||
|
|
||||||
|
with :math:`x` a point in :math:`\mathbb{R}^N` and :math:`N`
|
||||||
|
the dimension of the geometry space.
|
||||||
|
|
||||||
:param list geometries: A list of geometries from 'pina.geometry'
|
:param list geometries: A list of geometries from 'pina.geometry'
|
||||||
such as 'EllipsoidDomain' or 'CartesianDomain'.
|
such as 'EllipsoidDomain' or 'CartesianDomain'.
|
||||||
|
|||||||
@@ -10,7 +10,16 @@ class Intersection(OperationInterface):
|
|||||||
""" PINA implementation of Intersection of Domains."""
|
""" PINA implementation of Intersection of Domains."""
|
||||||
|
|
||||||
def __init__(self, geometries):
|
def __init__(self, geometries):
|
||||||
""" PINA implementation of Intersection of Domains.
|
"""
|
||||||
|
PINA implementation of Intersection of Domains.
|
||||||
|
Given two sets :math:`A` and :math:`B` then the
|
||||||
|
domain difference is defined as:
|
||||||
|
|
||||||
|
..:math:
|
||||||
|
A \cap B = \{x \mid x \in A \text{ and } x \in B\},
|
||||||
|
|
||||||
|
with :math:`x` a point in :math:`\mathbb{R}^N` and :math:`N`
|
||||||
|
the dimension of the geometry space.
|
||||||
|
|
||||||
:param list geometries: A list of geometries from 'pina.geometry'
|
:param list geometries: A list of geometries from 'pina.geometry'
|
||||||
such as 'EllipsoidDomain' or 'CartesianDomain'. The intersection
|
such as 'EllipsoidDomain' or 'CartesianDomain'. The intersection
|
||||||
|
|||||||
@@ -7,11 +7,18 @@ import random
|
|||||||
|
|
||||||
|
|
||||||
class OperationInterface(Location, metaclass=ABCMeta):
|
class OperationInterface(Location, metaclass=ABCMeta):
|
||||||
|
"""PINA Operation Interface"""
|
||||||
|
|
||||||
def __init__(self, geometries):
|
def __init__(self, geometries):
|
||||||
"""
|
"""
|
||||||
Abstract Operation class.
|
Abstract Operation class.
|
||||||
Any geometry operation entity must inherit from this class.
|
Any geometry operation entity must inherit from this class.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
The ``sample_surface=True`` option is not implemented yet
|
||||||
|
for Difference, Intersection, and Exclusion. The usage will
|
||||||
|
result in unwanted behaviour.
|
||||||
|
|
||||||
:param list geometries: A list of geometries from 'pina.geometry'
|
:param list geometries: A list of geometries from 'pina.geometry'
|
||||||
such as 'EllipsoidDomain' or 'CartesianDomain'.
|
such as 'EllipsoidDomain' or 'CartesianDomain'.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -10,7 +10,16 @@ class Union(OperationInterface):
|
|||||||
""" PINA implementation of Unions of Domains."""
|
""" PINA implementation of Unions of Domains."""
|
||||||
|
|
||||||
def __init__(self, geometries):
|
def __init__(self, geometries):
|
||||||
""" PINA implementation of Unions of Domains.
|
"""
|
||||||
|
PINA implementation of Unions of Domains.
|
||||||
|
Given two sets :math:`A` and :math:`B` then the
|
||||||
|
domain difference is defined as:
|
||||||
|
|
||||||
|
..:math:
|
||||||
|
A \cup B = \{x \mid x \in A \text{ or } x \in B\},
|
||||||
|
|
||||||
|
with :math:`x` a point in :math:`\mathbb{R}^N` and :math:`N`
|
||||||
|
the dimension of the geometry space.
|
||||||
|
|
||||||
:param list geometries: A list of geometries from 'pina.geometry'
|
:param list geometries: A list of geometries from 'pina.geometry'
|
||||||
such as 'EllipsoidDomain' or 'CartesianDomain'.
|
such as 'EllipsoidDomain' or 'CartesianDomain'.
|
||||||
@@ -86,7 +95,8 @@ class Union(OperationInterface):
|
|||||||
# int(i < remainder) is one only if we have a remainder
|
# int(i < remainder) is one only if we have a remainder
|
||||||
# different than zero. Notice that len(geometries) is
|
# different than zero. Notice that len(geometries) is
|
||||||
# always smaller than remaider.
|
# always smaller than remaider.
|
||||||
sampled_points.append(geometry.sample(num_points + int(i < remainder), mode, variables))
|
sampled_points.append(geometry.sample(
|
||||||
|
num_points + int(i < remainder), mode, variables))
|
||||||
# in case number of sampled points is smaller than the number of geometries
|
# in case number of sampled points is smaller than the number of geometries
|
||||||
if len(sampled_points) >= n:
|
if len(sampled_points) >= n:
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user