Update of LabelTensor class and fix Simplex domain (#362)

*Implement new methods in LabelTensor and fix operators
This commit is contained in:
Filippo Olivo
2024-10-10 18:26:52 +02:00
committed by Nicola Demo
parent fdb8f65143
commit 7528f6ef74
19 changed files with 551 additions and 217 deletions

View File

@@ -27,4 +27,6 @@ class DataConditionInterface(ConditionInterface):
def __setattr__(self, key, value):
if (key == 'data') or (key == 'conditionalvariable'):
check_consistency(value, (LabelTensor, Graph, torch.Tensor))
DataConditionInterface.__dict__[key].__set__(self, value)
DataConditionInterface.__dict__[key].__set__(self, value)
elif key in ('_condition_type', '_problem', 'problem', 'condition_type'):
super().__setattr__(key, value)

View File

@@ -28,4 +28,6 @@ class DomainEquationCondition(ConditionInterface):
DomainEquationCondition.__dict__[key].__set__(self, value)
elif key == 'equation':
check_consistency(value, (EquationInterface))
DomainEquationCondition.__dict__[key].__set__(self, value)
DomainEquationCondition.__dict__[key].__set__(self, value)
elif key in ('_condition_type', '_problem', 'problem', 'condition_type'):
super().__setattr__(key, value)

View File

@@ -21,7 +21,7 @@ class InputPointsEquationCondition(ConditionInterface):
super().__init__()
self.input_points = input_points
self.equation = equation
self.condition_type = 'physics'
self._condition_type = 'physics'
def __setattr__(self, key, value):
if key == 'input_points':
@@ -29,4 +29,6 @@ class InputPointsEquationCondition(ConditionInterface):
InputPointsEquationCondition.__dict__[key].__set__(self, value)
elif key == 'equation':
check_consistency(value, (EquationInterface))
InputPointsEquationCondition.__dict__[key].__set__(self, value)
InputPointsEquationCondition.__dict__[key].__set__(self, value)
elif key in ('_condition_type', '_problem', 'problem', 'condition_type'):
super().__setattr__(key, value)

View File

@@ -26,4 +26,6 @@ class InputOutputPointsCondition(ConditionInterface):
def __setattr__(self, key, value):
if (key == 'input_points') or (key == 'output_points'):
check_consistency(value, (LabelTensor, Graph, torch.Tensor))
InputOutputPointsCondition.__dict__[key].__set__(self, value)
InputOutputPointsCondition.__dict__[key].__set__(self, value)
elif key in ('_condition_type', '_problem', 'problem', 'condition_type'):
super().__setattr__(key, value)