Documentation for v0.1 version (#199)
* Adding Equations, solving typos * improve _code.rst * the team rst and restuctore index.rst * fixing errors --------- Co-authored-by: Dario Coscia <dariocoscia@dhcp-015.eduroam.sissa.it>
This commit is contained in:
committed by
Nicola Demo
parent
3f9305d475
commit
8b7b61b3bd
@@ -3,15 +3,17 @@ from .label_tensor import LabelTensor
|
||||
from .geometry import Location
|
||||
from .equation.equation import Equation
|
||||
|
||||
|
||||
def dummy(a):
|
||||
"""Dummy function for testing purposes."""
|
||||
return None
|
||||
|
||||
|
||||
class Condition:
|
||||
"""
|
||||
The class `Condition` is used to represent the constraints (physical
|
||||
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.Abstract_Problem` object.
|
||||
problem at hand. Condition objects are used to formulate the PINA :obj:`pina.problem.abstract_problem.AbstractProblem` object.
|
||||
Conditions can be specified in three ways:
|
||||
|
||||
1. By specifying the input and output points of the condition; in such a
|
||||
@@ -49,8 +51,7 @@ class Condition:
|
||||
"""
|
||||
|
||||
__slots__ = [
|
||||
'input_points', 'output_points', 'location', 'equation',
|
||||
'data_weight'
|
||||
'input_points', 'output_points', 'location', 'equation', 'data_weight'
|
||||
]
|
||||
|
||||
def _dictvalue_isinstance(self, dict_, key_, class_):
|
||||
@@ -67,13 +68,14 @@ class Condition:
|
||||
self.data_weight = kwargs.pop('data_weight', 1.0)
|
||||
|
||||
if len(args) != 0:
|
||||
raise ValueError('Condition takes only the following keyword arguments: {`input_points`, `output_points`, `location`, `function`, `data_weight`}.')
|
||||
raise ValueError(
|
||||
'Condition takes only the following keyword arguments: {`input_points`, `output_points`, `location`, `function`, `data_weight`}.'
|
||||
)
|
||||
|
||||
if (
|
||||
sorted(kwargs.keys()) != sorted(['input_points', 'output_points']) and
|
||||
sorted(kwargs.keys()) != sorted(['location', 'equation']) and
|
||||
sorted(kwargs.keys()) != sorted(['input_points', 'equation'])
|
||||
):
|
||||
if (sorted(kwargs.keys()) != sorted(['input_points', 'output_points'])
|
||||
and sorted(kwargs.keys()) != sorted(['location', 'equation'])
|
||||
and sorted(kwargs.keys()) != sorted(
|
||||
['input_points', 'equation'])):
|
||||
raise ValueError(f'Invalid keyword arguments {kwargs.keys()}.')
|
||||
|
||||
if not self._dictvalue_isinstance(kwargs, 'input_points', LabelTensor):
|
||||
|
||||
Reference in New Issue
Block a user