License¶
+License#
The MIT License (MIT)
Copyright (c) 2021-current PINA contributors
Permission is hereby granted, free of charge, to any person obtaining a copy @@ -109,39 +484,85 @@
diff --git a/.buildinfo b/.buildinfo index 31e8e274..ac20601e 100644 --- a/.buildinfo +++ b/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: d4a3d79d798cc056ca1d07299713b106 +config: 164316e6c6e9cd74c0f230f8bf4852d6 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/_LICENSE.html b/_LICENSE.html index b40d0649..2e9dcfa7 100644 --- a/_LICENSE.html +++ b/_LICENSE.html @@ -1,97 +1,472 @@ + - -
- - -© Copyright 2021-2024, PINA Contributors. - Last updated on Jul 01, 2024. -
-If PINA has been significant in your research, and you would like to acknowledge the project in your academic publication, we suggest citing the following paper:
Coscia, D., Ivagnes, A., Demo, N., & Rozza, G. (2023). Physics-Informed Neural networks for Advanced modeling. Journal of Open Source Software, 8(87), 5352.
Or in BibTex format
@article{coscia2023physics,
- title={Physics-Informed Neural networks for Advanced modeling},
- author={Coscia, Dario and Ivagnes, Anna and Demo, Nicola and Rozza, Gianluigi},
- journal={Journal of Open Source Software},
- volume={8},
- number={87},
- pages={5352},
- year={2023}
- }
+ title={Physics-Informed Neural networks for Advanced modeling},
+ author={Coscia, Dario and Ivagnes, Anna and Demo, Nicola and Rozza, Gianluigi},
+ journal={Journal of Open Source Software},
+ volume={8},
+ number={87},
+ pages={5352},
+ year={2023}
+ }
© Copyright 2021-2024, PINA Contributors. - Last updated on Jul 01, 2024. -
-
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+ Built with the PyData Sphinx Theme 0.15.4. +
""" Module for adaptive functions. """
@@ -96,8 +462,10 @@ Source code for pina.adaptive_functions.adaptive_func
from .adaptive_func_interface import AdaptiveActivationFunctionInterface
-[docs]class AdaptiveReLU(AdaptiveActivationFunctionInterface):
- r"""
+
+[docs]
+class AdaptiveReLU(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.ReLU` activation function.
Given the function :math:`\text{ReLU}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -137,8 +505,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.ReLU()
-[docs]class AdaptiveSigmoid(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveSigmoid(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.Sigmoid` activation function.
Given the function :math:`\text{Sigmoid}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -178,8 +549,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.Sigmoid()
-[docs]class AdaptiveTanh(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveTanh(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.Tanh` activation function.
Given the function :math:`\text{Tanh}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -219,8 +593,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.Tanh()
-[docs]class AdaptiveSiLU(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveSiLU(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.SiLU` activation function.
Given the function :math:`\text{SiLU}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -261,8 +638,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.SiLU()
-[docs]class AdaptiveMish(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveMish(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.Mish` activation function.
Given the function :math:`\text{Mish}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -302,8 +682,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.Mish()
-[docs]class AdaptiveELU(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveELU(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.ELU` activation function.
Given the function :math:`\text{ELU}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -346,8 +729,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.ELU()
-[docs]class AdaptiveCELU(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveCELU(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.CELU` activation function.
Given the function :math:`\text{CELU}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -387,8 +773,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.CELU()
-[docs]class AdaptiveGELU(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveGELU(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.GELU` activation function.
Given the function :math:`\text{GELU}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -429,8 +818,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.GELU()
-[docs]class AdaptiveSoftmin(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveSoftmin(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.Softmin` activation function.
Given the function :math:`\text{Softmin}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -470,8 +862,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.Softmin()
-[docs]class AdaptiveSoftmax(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveSoftmax(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :class:`~torch.nn.Softmax` activation function.
Given the function :math:`\text{Softmax}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -511,8 +906,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.nn.Softmax()
-[docs]class AdaptiveSIREN(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveSIREN(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :obj:`~torch.sin` function.
Given the function :math:`\text{sin}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -548,8 +946,11 @@ Source code for pina.adaptive_functions.adaptive_func
self._func = torch.sin
-[docs]class AdaptiveExp(AdaptiveActivationFunctionInterface):
- r"""
+
+
+[docs]
+class AdaptiveExp(AdaptiveActivationFunctionInterface):
+ r"""
Adaptive trainable :obj:`~torch.exp` function.
Given the function :math:`\text{exp}:\mathbb{R}^n\rightarrow\mathbb{R}^n`,
@@ -592,35 +993,71 @@ Source code for pina.adaptive_functions.adaptive_func
# calling super
super().__init__(alpha, beta, 0.0, fixed)
self._func = torch.exp
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
+
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
-
-
-
-
-
-
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/adaptive_functions/adaptive_func_interface.html b/_modules/pina/adaptive_functions/adaptive_func_interface.html
index e4e651ad..4ff3d42c 100644
--- a/_modules/pina/adaptive_functions/adaptive_func_interface.html
+++ b/_modules/pina/adaptive_functions/adaptive_func_interface.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.adaptive_functions.adaptive_func_interface — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.adaptive_functions.adaptive_func_interface — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.adaptive_functions.adaptive_func_interface
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.adaptiv...
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
Source code for pina.adaptive_functions.adaptive_func_interface
""" Module for adaptive functions. """
@@ -97,8 +463,10 @@ Source code for pina.adaptive_functions.adaptive_func_interface
from abc import ABCMeta
-[docs]class AdaptiveActivationFunctionInterface(torch.nn.Module, metaclass=ABCMeta):
- r"""
+
+[docs]
+class AdaptiveActivationFunctionInterface(torch.nn.Module, metaclass=ABCMeta):
+ r"""
The
:class:`~pina.adaptive_functions.adaptive_func_interface.AdaptiveActivationFunctionInterface`
class makes a :class:`torch.nn.Module` activation function into an adaptive
@@ -133,7 +501,7 @@ Source code for pina.adaptive_functions.adaptive_func_interface
"""
def __init__(self, alpha=None, beta=None, gamma=None, fixed=None):
- """
+ """
Initializes the Adaptive Function.
:param float | complex alpha: Scaling parameter alpha.
@@ -198,8 +566,10 @@ Source code for pina.adaptive_functions.adaptive_func_interface
# storing the activation
self._func = None
-[docs] def forward(self, x):
- """
+
+[docs]
+ def forward(self, x):
+ """
Define the computation performed at every call.
The function to the input elementwise.
@@ -208,62 +578,99 @@ Source code for pina.adaptive_functions.adaptive_func_interface
"""
return self.alpha * (self._func(self.beta * x + self.gamma))
+
@property
def alpha(self):
- """
+ """
The alpha variable.
"""
return self._alpha
@property
def beta(self):
- """
+ """
The beta variable.
"""
return self._beta
@property
def gamma(self):
- """
+ """
The gamma variable.
"""
return self._gamma
@property
def func(self):
- """
+ """
The callable activation function.
"""
return self._func
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
+
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
-
-
-
-
-
-
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/callbacks/adaptive_refinment_callbacks.html b/_modules/pina/callbacks/adaptive_refinment_callbacks.html
index 471a6bcb..226e2ba1 100644
--- a/_modules/pina/callbacks/adaptive_refinment_callbacks.html
+++ b/_modules/pina/callbacks/adaptive_refinment_callbacks.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.callbacks.adaptive_refinment_callbacks — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.callbacks.adaptive_refinment_callbacks — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.callbacks.adaptive_refinment_callbacks
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.callbac...
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
Source code for pina.callbacks.adaptive_refinment_callbacks
"""PINA Callbacks Implementations"""
@@ -97,10 +463,12 @@ Source code for pina.callbacks.adaptive_refinment_callbacks
from ..utils import check_consistency
-[docs]class R3Refinement(Callback):
+
+[docs]
+class R3Refinement(Callback):
def __init__(self, sample_every):
- """
+ """
PINA Implementation of an R3 Refinement Callback.
This callback implements the R3 (Retain-Resample-Release) routine for
@@ -132,7 +500,7 @@ Source code for pina.callbacks.adaptive_refinment_callbacks
self._const_pts = None
def _compute_residual(self, trainer):
- """
+ """
Computes the residuals for a PINN object.
:return: the total loss, and pointwise loss.
@@ -173,7 +541,7 @@ Source code for pina.callbacks.adaptive_refinment_callbacks
return torch.vstack(tot_loss), res_loss
def _r3_routine(self, trainer):
- """
+ """
R3 refinement main routine.
:param Trainer trainer: PINA Trainer.
@@ -215,8 +583,10 @@ Source code for pina.callbacks.adaptive_refinment_callbacks
# update dataloader
trainer._create_or_update_loader()
-[docs] def on_train_start(self, trainer, _):
- """
+
+[docs]
+ def on_train_start(self, trainer, _):
+ """
Callback function called at the start of training.
This method extracts the locations for sampling from the problem
@@ -245,8 +615,11 @@ Source code for pina.callbacks.adaptive_refinment_callbacks
const_pts[location] = len(pts)
self._const_pts = const_pts
-[docs] def on_train_epoch_end(self, trainer, __):
- """
+
+
+[docs]
+ def on_train_epoch_end(self, trainer, __):
+ """
Callback function called at the end of each training epoch.
This method triggers the R3 routine for refinement if the current
@@ -260,36 +633,73 @@ Source code for pina.callbacks.adaptive_refinment_callbacks
:rtype: None
"""
if trainer.current_epoch % self._sample_every == 0:
- self._r3_routine(trainer)
+ self._r3_routine(trainer)
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
+
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
-
-
-
-
-
-
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/callbacks/optimizer_callbacks.html b/_modules/pina/callbacks/optimizer_callbacks.html
index 4052550e..8d67e334 100644
--- a/_modules/pina/callbacks/optimizer_callbacks.html
+++ b/_modules/pina/callbacks/optimizer_callbacks.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.callbacks.optimizer_callbacks — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.callbacks.optimizer_callbacks — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
-
-
-
-
-
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.callbacks.optimizer_callbacks
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.callbac...
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
Source code for pina.callbacks.optimizer_callbacks
"""PINA Callbacks Implementations"""
@@ -96,10 +462,12 @@ Source code for pina.callbacks.optimizer_callbacks
from ..utils import check_consistency
-[docs]class SwitchOptimizer(Callback):
+
+[docs]
+class SwitchOptimizer(Callback):
def __init__(self, new_optimizers, new_optimizers_kwargs, epoch_switch):
- """
+ """
PINA Implementation of a Lightning Callback to switch optimizer during training.
This callback allows for switching between different optimizers during training, enabling
@@ -142,8 +510,8 @@ Source code for pina.callbacks.optimizer_callbacks
raise ValueError(
"You must define one dictionary of keyword"
" arguments for each optimizers."
- f" Got {len_optimizer} optimizers, and"
- f" {len_optimizer_kwargs} dicitionaries"
+ f" Got {len_optimizer} optimizers, and"
+ f" {len_optimizer_kwargs} dicitionaries"
)
# save new optimizers
@@ -151,8 +519,10 @@ Source code for pina.callbacks.optimizer_callbacks
self._new_optimizers_kwargs = new_optimizers_kwargs
self._epoch_switch = epoch_switch
-[docs] def on_train_epoch_start(self, trainer, __):
- """
+
+[docs]
+ def on_train_epoch_start(self, trainer, __):
+ """
Callback function to switch optimizer at the start of each training epoch.
:param trainer: The trainer object managing the training process.
@@ -173,36 +543,73 @@ Source code for pina.callbacks.optimizer_callbacks
)
)
- trainer.optimizers = optims
+ trainer.optimizers = optims
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/callbacks/processing_callbacks.html b/_modules/pina/callbacks/processing_callbacks.html
index a90207ef..f53085dc 100644
--- a/_modules/pina/callbacks/processing_callbacks.html
+++ b/_modules/pina/callbacks/processing_callbacks.html
@@ -1,110 +1,487 @@
+
-
-
-
-
- pina.callbacks.processing_callbacks — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.callbacks.processing_callbacks — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.callbacks.processing_callbacks
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.callbac...
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
Source code for pina.callbacks.processing_callbacks
"""PINA Callbacks Implementations"""
-from pytorch_lightning.callbacks import Callback
+from pytorch_lightning.core.module import LightningModule
+from pytorch_lightning.trainer.trainer import Trainer
import torch
import copy
+from pytorch_lightning.callbacks import Callback, TQDMProgressBar
+from lightning.pytorch.callbacks.progress.progress_bar import (
+ get_standard_metrics,
+)
+from pina.utils import check_consistency
-[docs]class MetricTracker(Callback):
+
+
+[docs]
+class MetricTracker(Callback):
def __init__(self):
- """
+ """
PINA Implementation of a Lightning Callback for Metric Tracking.
- This class provides functionality to track relevant metrics during the training process.
+ This class provides functionality to track relevant metrics during
+ the training process.
- :ivar _collection: A list to store collected metrics after each training epoch.
+ :ivar _collection: A list to store collected metrics after each
+ training epoch.
:param trainer: The trainer object managing the training process.
:type trainer: pytorch_lightning.Trainer
@@ -117,26 +494,29 @@ Source code for pina.callbacks.processing_callbacks
>>> # ... Perform training ...
>>> metrics = tracker.metrics
"""
+ super().__init__()
self._collection = []
-[docs] def on_train_epoch_end(self, trainer, __):
- """
+
+[docs]
+ def on_train_epoch_end(self, trainer, pl_module):
+ """
Collect and track metrics at the end of each training epoch.
:param trainer: The trainer object managing the training process.
:type trainer: pytorch_lightning.Trainer
- :param _: Placeholder argument.
-
- :return: None
- :rtype: None
+ :param pl_module: Placeholder argument.
"""
- self._collection.append(
- copy.deepcopy(trainer.logged_metrics)
- ) # track them
+ super().on_train_epoch_end(trainer, pl_module)
+ if trainer.current_epoch > 0:
+ self._collection.append(
+ copy.deepcopy(trainer.logged_metrics)
+ ) # track them
+
@property
def metrics(self):
- """
+ """
Aggregate collected metrics during training.
:return: A dictionary containing aggregated metric values.
@@ -148,35 +528,173 @@ Source code for pina.callbacks.processing_callbacks
for k in common_keys
}
return v
-
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
-
+
+[docs]
+class PINAProgressBar(TQDMProgressBar):
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+ BAR_FORMAT = "{l_bar}{bar}| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, {rate_noinv_fmt}{postfix}]"
-
-
-
-
+ def __init__(self, metrics="mean", **kwargs):
+ """
+ PINA Implementation of a Lightning Callback for enriching the progress
+ bar.
+
+ This class provides functionality to display only relevant metrics
+ during the training process.
+
+ :param metrics: Logged metrics to display during the training. It should
+ be a subset of the conditions keys defined in
+ :obj:`pina.condition.Condition`.
+ :type metrics: str | list(str) | tuple(str)
+
+ :Keyword Arguments:
+ The additional keyword arguments specify the progress bar
+ and can be choosen from the `pytorch-lightning
+ TQDMProgressBar API <https://lightning.ai/docs/pytorch/stable/_modules/lightning/pytorch/callbacks/progress/tqdm_progress.html#TQDMProgressBar>`_
+
+ Example:
+ >>> pbar = PINAProgressBar(['mean'])
+ >>> # ... Perform training ...
+ >>> trainer = Trainer(solver, callbacks=[pbar])
+ """
+ super().__init__(**kwargs)
+ # check consistency
+ if not isinstance(metrics, (list, tuple)):
+ metrics = [metrics]
+ check_consistency(metrics, str)
+ self._sorted_metrics = metrics
+
+
+[docs]
+ def get_metrics(self, trainer, pl_module):
+ r"""Combines progress bar metrics collected from the trainer with
+ standard metrics from get_standard_metrics.
+ Implement this to override the items displayed in the progress bar.
+ The progress bar metrics are sorted according to ``metrics``.
+
+ Here is an example of how to override the defaults:
+
+ .. code-block:: python
+
+ def get_metrics(self, trainer, model):
+ # don't show the version number
+ items = super().get_metrics(trainer, model)
+ items.pop("v_num", None)
+ return items
+
+ :return: Dictionary with the items to be displayed in the progress bar.
+ :rtype: tuple(dict)
+
+ """
+ standard_metrics = get_standard_metrics(trainer)
+ pbar_metrics = trainer.progress_bar_metrics
+ if pbar_metrics:
+ pbar_metrics = {
+ key: pbar_metrics[key] for key in self._sorted_metrics
+ }
+ duplicates = list(standard_metrics.keys() & pbar_metrics.keys())
+ if duplicates:
+ rank_zero_warn(
+ f"The progress bar already tracks a metric with the name(s) '{', '.join(duplicates)}' and"
+ f" `self.log('{duplicates[0]}', ..., prog_bar=True)` will overwrite this value. "
+ " If this is undesired, change the name or override `get_metrics()` in the progress bar callback.",
+ )
+
+ return {**standard_metrics, **pbar_metrics}
+
+
+
+[docs]
+ def on_fit_start(self, trainer, pl_module):
+ """
+ Check that the metrics defined in the initialization are available,
+ i.e. are correctly logged.
+
+ :param trainer: The trainer object managing the training process.
+ :type trainer: pytorch_lightning.Trainer
+ :param pl_module: Placeholder argument.
+ """
+ # Check if all keys in sort_keys are present in the dictionary
+ for key in self._sorted_metrics:
+ if (
+ key not in trainer.solver.problem.conditions.keys()
+ and key != "mean"
+ ):
+ raise KeyError(f"Key '{key}' is not present in the dictionary")
+ # add the loss pedix
+ self._sorted_metrics = [
+ metric + "_loss" for metric in self._sorted_metrics
+ ]
+ return super().on_fit_start(trainer, pl_module)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/condition.html b/_modules/pina/condition.html
index 3385ce77..bac5bc60 100644
--- a/_modules/pina/condition.html
+++ b/_modules/pina/condition.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.condition — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.condition — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
-
-
-
-
-
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.condition
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.condition
-
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
Source code for pina.condition
""" Condition module. """
@@ -97,12 +463,14 @@ Source code for pina.condition
def dummy(a):
- """Dummy function for testing purposes."""
+ """Dummy function for testing purposes."""
return None
-[docs]class Condition:
- """
+
+[docs]
+class Condition:
+ """
The class ``Condition`` is used to represent the constraints (physical
equations, boundary conditions, etc.) that should be satisfied in the
problem at hand. Condition objects are used to formulate the PINA :obj:`pina.problem.abstract_problem.AbstractProblem` object.
@@ -151,21 +519,21 @@ Source code for pina.condition
]
def _dictvalue_isinstance(self, dict_, key_, class_):
- """Check if the value of a dictionary corresponding to `key` is an instance of `class_`."""
+ """Check if the value of a dictionary corresponding to `key` is an instance of `class_`."""
if key_ not in dict_.keys():
return True
return isinstance(dict_[key_], class_)
def __init__(self, *args, **kwargs):
- """
+ """
Constructor for the `Condition` class.
"""
self.data_weight = kwargs.pop("data_weight", 1.0)
if len(args) != 0:
raise ValueError(
- f"Condition takes only the following keyword arguments: {Condition.__slots__}."
+ f"Condition takes only the following keyword arguments: {Condition.__slots__}."
)
if (
@@ -173,7 +541,7 @@ Source code for pina.condition
and sorted(kwargs.keys()) != sorted(["location", "equation"])
and sorted(kwargs.keys()) != sorted(["input_points", "equation"])
):
- raise ValueError(f"Invalid keyword arguments {kwargs.keys()}.")
+ raise ValueError(f"Invalid keyword arguments {kwargs.keys()}.")
if not self._dictvalue_isinstance(kwargs, "input_points", LabelTensor):
raise TypeError("`input_points` must be a torch.Tensor.")
@@ -186,35 +554,71 @@ Source code for pina.condition
for key, value in kwargs.items():
setattr(self, key, value)
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/equation/equation.html b/_modules/pina/equation/equation.html
index 7ff53d21..d7a5c291 100644
--- a/_modules/pina/equation/equation.html
+++ b/_modules/pina/equation/equation.html
@@ -1,103 +1,471 @@
+
-
-
-
-
- pina.equation.equation — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.equation.equation — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
-
-
-
-
-
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.equation.equation
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.equatio...
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
Source code for pina.equation.equation
""" Module for Equation. """
from .equation_interface import EquationInterface
-[docs]class Equation(EquationInterface):
+
+[docs]
+class Equation(EquationInterface):
def __init__(self, equation):
- """
+ """
Equation class for specifing any equation in PINA.
Each ``equation`` passed to a ``Condition`` object
must be an ``Equation`` or ``SystemEquation``.
@@ -106,16 +474,18 @@ Source code for pina.equation.equation
evaluate the residual.
:type equation: Callable
"""
- if not callable(equation):
+ if not callable(equation):
raise ValueError(
"equation must be a callable function."
"Expected a callable function, got "
- f"{equation}"
+ f"{equation}"
)
self.__equation = equation
-[docs] def residual(self, input_, output_, params_=None):
- """
+
+[docs]
+ def residual(self, input_, output_, params_=None):
+ """
Residual computation of the equation.
:param LabelTensor input_: Input points to evaluate the equation.
@@ -136,36 +506,73 @@ Source code for pina.equation.equation
result = self.__equation(input_, output_)
else:
result = self.__equation(input_, output_, params_)
- return result
+ return result
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/equation/equation_factory.html b/_modules/pina/equation/equation_factory.html
index c5f90210..fe881c9b 100644
--- a/_modules/pina/equation/equation_factory.html
+++ b/_modules/pina/equation/equation_factory.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.equation.equation_factory — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.equation.equation_factory — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.equation.equation_factory
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.equatio...
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
Source code for pina.equation.equation_factory
""" Module """
@@ -95,10 +461,12 @@ Source code for pina.equation.equation_factory
from ..operators import grad, div, laplacian
-
[docs]class FixedValue(Equation):
+
+[docs]
+class FixedValue(Equation):
def __init__(self, value, components=None):
- """
+ """
Fixed Value Equation class. This class can be
used to enforced a fixed value for a specific
condition, e.g. Dirichlet Boundary conditions.
@@ -119,10 +487,13 @@ Source code for pina.equation.equation_factory
super().__init__(equation)
-[docs]class FixedGradient(Equation):
+
+
+[docs]
+class FixedGradient(Equation):
def __init__(self, value, components=None, d=None):
- """
+ """
Fixed Gradient Equation class. This class can be
used to enforced a fixed gradient for a specific
condition.
@@ -145,10 +516,13 @@ Source code for pina.equation.equation_factory
super().__init__(equation)
-[docs]class FixedFlux(Equation):
+
+
+[docs]
+class FixedFlux(Equation):
def __init__(self, value, components=None, d=None):
- """
+ """
Fixed Flux Equation class. This class can be
used to enforced a fixed flux for a specific
condition.
@@ -171,10 +545,13 @@ Source code for pina.equation.equation_factory
super().__init__(equation)
-[docs]class Laplace(Equation):
+
+
+[docs]
+class Laplace(Equation):
def __init__(self, components=None, d=None):
- """
+ """
Laplace Equation class. This class can be
used to enforced a Laplace equation for a specific
condition (force term set to zero).
@@ -194,35 +571,71 @@ Source code for pina.equation.equation_factory
return laplacian(output_, input_, components=components, d=d)
super().__init__(equation)
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
+
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
-
-
-
-
-
-
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/equation/equation_interface.html b/_modules/pina/equation/equation_interface.html
index 59a5e531..6ab7debd 100644
--- a/_modules/pina/equation/equation_interface.html
+++ b/_modules/pina/equation/equation_interface.html
@@ -1,101 +1,469 @@
+
-
-
-
-
- pina.equation.equation_interface — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.equation.equation_interface — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
-
-
-
-
-
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.equation.equation_interface
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.equatio...
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
Source code for pina.equation.equation_interface
""" Module for EquationInterface class """
from abc import ABCMeta, abstractmethod
-[docs]class EquationInterface(metaclass=ABCMeta):
- """
+
+[docs]
+class EquationInterface(metaclass=ABCMeta):
+ """
The abstract `AbstractProblem` class. All the class defining a PINA Problem
should be inheritied from this class.
@@ -104,9 +472,11 @@ Source code for pina.equation.equation_interface
conditions are applied.
"""
-[docs] @abstractmethod
+
+[docs]
+ @abstractmethod
def residual(self, input_, output_, params_):
- """
+ """
Residual computation of the equation.
:param LabelTensor input_: Input points to evaluate the equation.
@@ -116,36 +486,73 @@ Source code for pina.equation.equation_interface
:return: The residual evaluation of the specified equation.
:rtype: LabelTensor
"""
- pass
+ pass
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/equation/system_equation.html b/_modules/pina/equation/system_equation.html
index 02afed78..7bcd08a3 100644
--- a/_modules/pina/equation/system_equation.html
+++ b/_modules/pina/equation/system_equation.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.equation.system_equation — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.equation.system_equation — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
-
-
-
-
-
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.equation.system_equation
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.equatio...
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
Source code for pina.equation.system_equation
""" Module for SystemEquation. """
@@ -96,10 +462,12 @@ Source code for pina.equation.system_equation
from ..utils import check_consistency
-[docs]class SystemEquation(Equation):
+
+[docs]
+class SystemEquation(Equation):
- def __init__(self, list_equation, reduction="mean"):
- """
+ def __init__(self, list_equation, reduction=None):
+ """
System of Equation class for specifing any system
of equations in PINA.
Each ``equation`` passed to a ``Condition`` object
@@ -110,14 +478,13 @@ Source code for pina.equation.system_equation
:param Callable equation: A ``torch`` callable equation to
evaluate the residual
:param str reduction: Specifies the reduction to apply to the output:
- ``none`` | ``mean`` | ``sum`` | ``callable``. ``none``: no reduction
- will be applied, ``mean``: the sum of the output will be divided
+ None | ``mean`` | ``sum`` | callable. None: no reduction
+ will be applied, ``mean``: the output sum will be divided
by the number of elements in the output, ``sum``: the output will
- be summed. ``callable`` a callable function to perform reduction,
- no checks guaranteed. Default: ``mean``.
+ be summed. *callable* is a callable function to perform reduction,
+ no checks guaranteed. Default: None.
"""
check_consistency([list_equation], list)
- check_consistency(reduction, str)
# equations definition
self.equations = []
@@ -129,15 +496,17 @@ Source code for pina.equation.system_equation
self.reduction = torch.mean
elif reduction == "sum":
self.reduction = torch.sum
- elif (reduction == "none") or callable(reduction):
+ elif (reduction == None) or callable(reduction):
self.reduction = reduction
else:
raise NotImplementedError(
"Only mean and sum reductions implemented."
)
-[docs] def residual(self, input_, output_, params_=None):
- """
+
+[docs]
+ def residual(self, input_, output_, params_=None):
+ """
Residual computation for the equations of the system.
:param LabelTensor input_: Input points to evaluate the system of
@@ -163,39 +532,76 @@ Source code for pina.equation.system_equation
]
)
- if self.reduction == "none":
+ if self.reduction is None:
return residual
- return self.reduction(residual, dim=-1)
+ return self.reduction(residual, dim=-1)
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/geometry/cartesian.html b/_modules/pina/geometry/cartesian.html
index 51f208c7..681c76b7 100644
--- a/_modules/pina/geometry/cartesian.html
+++ b/_modules/pina/geometry/cartesian.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.geometry.cartesian — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.geometry.cartesian — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.geometry.cartesian
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.geometr...
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
Source code for pina.geometry.cartesian
import torch
@@ -96,11 +462,13 @@ Source code for pina.geometry.cartesian
from ..utils import torch_lhs, chebyshev_roots
-[docs]class CartesianDomain(Location):
- """PINA implementation of Hypercube domain."""
+
+[docs]
+class CartesianDomain(Location):
+ """PINA implementation of Hypercube domain."""
def __init__(self, cartesian_dict):
- """
+ """
:param cartesian_dict: A dictionary with dict-key a string representing
the input variables for the pinn, and dict-value a list with
the domain extrema.
@@ -122,15 +490,17 @@ Source code for pina.geometry.cartesian
@property
def variables(self):
- """Spatial variables.
+ """Spatial variables.
:return: Spatial variables defined in ``__init__()``
:rtype: list[str]
"""
return sorted(list(self.fixed_.keys()) + list(self.range_.keys()))
-[docs] def update(self, new_domain):
- """Adding new dimensions on the ``CartesianDomain``
+
+[docs]
+ def update(self, new_domain):
+ """Adding new dimensions on the ``CartesianDomain``
:param CartesianDomain new_domain: A new ``CartesianDomain`` object to merge
@@ -146,8 +516,9 @@ Source code for pina.geometry.cartesian
self.fixed_.update(new_domain.fixed_)
self.range_.update(new_domain.range_)
+
def _sample_range(self, n, mode, bounds):
- """Rescale the samples to the correct bounds
+ """Rescale the samples to the correct bounds
:param n: Number of points to sample, see Note below
for reference.
@@ -181,8 +552,10 @@ Source code for pina.geometry.cartesian
return pts
-[docs] def sample(self, n, mode="random", variables="all"):
- """Sample routine.
+
+[docs]
+ def sample(self, n, mode="random", variables="all"):
+ """Sample routine.
:param n: Number of points to sample, see Note below
for reference.
@@ -236,7 +609,7 @@ Source code for pina.geometry.cartesian
"""
def _1d_sampler(n, mode, variables):
- """Sample independentely the variables and cross the results"""
+ """Sample independentely the variables and cross the results"""
tmp = []
for variable in variables:
if variable in self.range_.keys():
@@ -265,7 +638,7 @@ Source code for pina.geometry.cartesian
return result
def _Nd_sampler(n, mode, variables):
- """Sample all the variables together
+ """Sample all the variables together
:param n: Number of points to sample.
:type n: int
@@ -299,7 +672,7 @@ Source code for pina.geometry.cartesian
return result
def _single_points_sample(n, variables):
- """Sample a single point in one dimension.
+ """Sample a single point in one dimension.
:param n: Number of points to sample.
:type n: int
@@ -334,10 +707,13 @@ Source code for pina.geometry.cartesian
elif mode in ["random", "lh", "latin"]:
return _Nd_sampler(n, mode, variables)
else:
- raise ValueError(f"mode={mode} is not valid.")
+ raise ValueError(f"mode={mode} is not valid.")
-[docs] def is_inside(self, point, check_border=False):
- """Check if a point is inside the ellipsoid.
+
+
+[docs]
+ def is_inside(self, point, check_border=False):
+ """Check if a point is inside the ellipsoid.
:param point: Point to be checked
:type point: LabelTensor
@@ -365,36 +741,73 @@ Source code for pina.geometry.cartesian
is_inside.append(check)
- return all(is_inside)
+ return all(is_inside)
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
+
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
-
-
-
-
-
-
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/geometry/difference_domain.html b/_modules/pina/geometry/difference_domain.html
index 1b376a24..63687ff2 100644
--- a/_modules/pina/geometry/difference_domain.html
+++ b/_modules/pina/geometry/difference_domain.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.geometry.difference_domain — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.geometry.difference_domain — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
-
-
-
-
-
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.geometry.difference_domain
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.geometr...
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
Source code for pina.geometry.difference_domain
"""Module for Difference class."""
@@ -96,10 +462,12 @@ Source code for pina.geometry.difference_domain
<
from ..label_tensor import LabelTensor
-[docs]class Difference(OperationInterface):
+
+[docs]
+class Difference(OperationInterface):
def __init__(self, geometries):
- r"""
+ r"""
PINA implementation of Difference of Domains.
Given two sets :math:`A` and :math:`B` then the
domain difference is defined as:
@@ -125,8 +493,10 @@ Source code for pina.geometry.difference_domain
<
"""
super().__init__(geometries)
-[docs] def is_inside(self, point, check_border=False):
- """
+
+[docs]
+ def is_inside(self, point, check_border=False):
+ """
Check if a point is inside the ``Difference`` domain.
:param point: Point to be checked.
@@ -140,8 +510,11 @@ Source code for pina.geometry.difference_domain
<
return False
return self.geometries[0].is_inside(point, check_border)
-[docs] def sample(self, n, mode="random", variables="all"):
- """
+
+
+[docs]
+ def sample(self, n, mode="random", variables="all"):
+ """
Sample routine for ``Difference`` domain.
:param int n: Number of points to sample in the shape.
@@ -170,7 +543,7 @@ Source code for pina.geometry.difference_domain
<
"""
if mode != "random":
raise NotImplementedError(
- f"{mode} is not a valid mode for sampling."
+ f"{mode} is not a valid mode for sampling."
)
sampled = []
@@ -191,36 +564,73 @@ Source code for pina.geometry.difference_domain
<
if not is_inside:
sampled.append(point)
- return LabelTensor(torch.cat(sampled), labels=self.variables)
+ return LabelTensor(torch.cat(sampled), labels=self.variables)
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/geometry/ellipsoid.html b/_modules/pina/geometry/ellipsoid.html
index 86386599..ca6a9ea1 100644
--- a/_modules/pina/geometry/ellipsoid.html
+++ b/_modules/pina/geometry/ellipsoid.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.geometry.ellipsoid — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.geometry.ellipsoid — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.geometry.ellipsoid
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.geometr...
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
Source code for pina.geometry.ellipsoid
import torch
@@ -96,11 +462,13 @@ Source code for pina.geometry.ellipsoid
from ..utils import check_consistency
-[docs]class EllipsoidDomain(Location):
- """PINA implementation of Ellipsoid domain."""
+
+[docs]
+class EllipsoidDomain(Location):
+ """PINA implementation of Ellipsoid domain."""
def __init__(self, ellipsoid_dict, sample_surface=False):
- """PINA implementation of Ellipsoid domain.
+ """PINA implementation of Ellipsoid domain.
:param ellipsoid_dict: A dictionary with dict-key a string representing
the input variables for the pinn, and dict-value a list with
@@ -164,15 +532,17 @@ Source code for pina.geometry.ellipsoid
@property
def variables(self):
- """Spatial variables.
+ """Spatial variables.
:return: Spatial variables defined in '__init__()'
:rtype: list[str]
"""
return sorted(list(self.fixed_.keys()) + list(self.range_.keys()))
-[docs] def is_inside(self, point, check_border=False):
- """Check if a point is inside the ellipsoid domain.
+
+[docs]
+ def is_inside(self, point, check_border=False):
+ """Check if a point is inside the ellipsoid domain.
.. note::
When ``sample_surface`` in the ``__init()__``
@@ -204,8 +574,8 @@ Source code for pina.geometry.ellipsoid
if not all([i in ax_sq.labels for i in point.labels]):
raise ValueError(
"point labels different from constructor"
- f" dictionary labels. Got {point.labels},"
- f" expected {ax_sq.labels}."
+ f" dictionary labels. Got {point.labels},"
+ f" expected {ax_sq.labels}."
)
# point square + shift center
@@ -226,8 +596,9 @@ Source code for pina.geometry.ellipsoid
return bool(eqn < 0)
+
def _sample_range(self, n, mode, variables):
- """Rescale the samples to the correct bounds.
+ """Rescale the samples to the correct bounds.
:param n: Number of points to sample in the ellipsoid.
:type n: int
@@ -286,8 +657,10 @@ Source code for pina.geometry.ellipsoid
return pts
-[docs] def sample(self, n, mode="random", variables="all"):
- """Sample routine.
+
+[docs]
+ def sample(self, n, mode="random", variables="all"):
+ """Sample routine.
:param int n: Number of points to sample in the shape.
:param str mode: Mode for sampling, defaults to ``random``. Available modes include: ``random``.
@@ -308,7 +681,7 @@ Source code for pina.geometry.ellipsoid
"""
def _Nd_sampler(n, mode, variables):
- """Sample all the variables together
+ """Sample all the variables together
:param n: Number of points to sample.
:type n: int
@@ -342,7 +715,7 @@ Source code for pina.geometry.ellipsoid
return result
def _single_points_sample(n, variables):
- """Sample a single point in one dimension.
+ """Sample a single point in one dimension.
:param n: Number of points to sample.
:type n: int
@@ -375,36 +748,73 @@ Source code for pina.geometry.ellipsoid
if mode in ["random"]:
return _Nd_sampler(n, mode, variables)
else:
- raise NotImplementedError(f"mode={mode} is not implemented.")
+ raise NotImplementedError(f"mode={mode} is not implemented.")
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
+
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
-
-
-
-
-
-
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/geometry/exclusion_domain.html b/_modules/pina/geometry/exclusion_domain.html
index 7e2adff0..55de739e 100644
--- a/_modules/pina/geometry/exclusion_domain.html
+++ b/_modules/pina/geometry/exclusion_domain.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.geometry.exclusion_domain — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.geometry.exclusion_domain — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
-
-
-
-
-
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
+
+
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
-
-
-
-
- PINA
-
-
-
-
-
-
-
- - Module code
- - pina.geometry.exclusion_domain
- -
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+ - Module code
+
+ - pina.geometr...
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
Source code for pina.geometry.exclusion_domain
"""Module for Exclusion class. """
@@ -97,10 +463,12 @@ Source code for pina.geometry.exclusion_domain
from .operation_interface import OperationInterface
-
[docs]class Exclusion(OperationInterface):
+
+[docs]
+class Exclusion(OperationInterface):
def __init__(self, geometries):
- r"""
+ r"""
PINA implementation of Exclusion of Domains.
Given two sets :math:`A` and :math:`B` then the
domain difference is defined as:
@@ -123,8 +491,10 @@ Source code for pina.geometry.exclusion_domain
"""
super().__init__(geometries)
-
[docs] def is_inside(self, point, check_border=False):
- """
+
+[docs]
+ def is_inside(self, point, check_border=False):
+ """
Check if a point is inside the ``Exclusion`` domain.
:param point: Point to be checked.
@@ -139,8 +509,11 @@ Source code for pina.geometry.exclusion_domain
flag += 1
return flag == 1
-[docs] def sample(self, n, mode="random", variables="all"):
- """
+
+
+[docs]
+ def sample(self, n, mode="random", variables="all"):
+ """
Sample routine for ``Exclusion`` domain.
:param int n: Number of points to sample in the shape.
@@ -169,7 +542,7 @@ Source code for pina.geometry.exclusion_domain
"""
if mode != "random":
raise NotImplementedError(
- f"{mode} is not a valid mode for sampling."
+ f"{mode} is not a valid mode for sampling."
)
sampled = []
@@ -196,36 +569,73 @@
Source code for pina.geometry.exclusion_domain
sampled_points.append(sample)
sampled += sampled_points
- return LabelTensor(torch.cat(sampled), labels=self.variables)
+ return LabelTensor(torch.cat(sampled), labels=self.variables)
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- © Copyright 2021-2024, PINA Contributors.
- Last updated on Jul 01, 2024.
-
+
+
+
+
+
+
+
+
+
+
- Built with Sphinx using a
- theme
- provided by Read the Docs.
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+ © Copyright 2021-2024, PINA Contributors.
+
+
+
+
+
+
+
+
+ Created using Sphinx 7.4.7.
+
+
+
+
+
+
+
+
+
+
+
+
+ Built with the PyData Sphinx Theme 0.15.4.
+
+
+
+
+
-
+
+
\ No newline at end of file
diff --git a/_modules/pina/geometry/intersection_domain.html b/_modules/pina/geometry/intersection_domain.html
index 854b6a25..c337e105 100644
--- a/_modules/pina/geometry/intersection_domain.html
+++ b/_modules/pina/geometry/intersection_domain.html
@@ -1,93 +1,459 @@
+
-
-
-
-
- pina.geometry.intersection_domain — PINA 0.1.1.post2407 documentation
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ pina.geometry.intersection_domain — PINA 0.1.2 documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+-
+
+ Installing
+
+
-
-
-
-
-
+-
+
+ Tutorial
+
+
+
+
+-
+
+ API
+
+
+
+
+-
+
+ Team & Foundings
+
+
+
+
+-
+
+ Contributing
+
+
+
+
+-
+
+ License
+
+
+
+
+-
+
+ Cite PINA
+
+
+
+
+
+
+
+
+
+