version 0.0.1
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
__all__ = [
|
||||
'AbstractProblem',
|
||||
'SpatialProblem',
|
||||
'TimeDependentProblem',
|
||||
'ParametricProblem',
|
||||
]
|
||||
|
||||
from .abstract_problem import AbstractProblem
|
||||
from .problem2d import Problem2D
|
||||
from .problem1d import Problem1D
|
||||
from .spatial_problem import SpatialProblem
|
||||
from .timedep_problem import TimeDependentProblem
|
||||
from .parametric_problem import ParametricProblem
|
||||
|
||||
@@ -4,9 +4,23 @@ from abc import ABCMeta, abstractmethod
|
||||
class AbstractProblem(metaclass=ABCMeta):
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def input_variables(self):
|
||||
pass
|
||||
variables = []
|
||||
|
||||
if hasattr(self, 'spatial_variables'):
|
||||
variables += self.spatial_variables
|
||||
if hasattr(self, 'temporal_variable'):
|
||||
variables += self.temporal_variable
|
||||
if hasattr(self, 'parameters'):
|
||||
variables += self.parameters
|
||||
if hasattr(self, 'custom_variables'):
|
||||
variables += self.custom_variables
|
||||
|
||||
return variables
|
||||
|
||||
@input_variables.setter
|
||||
def input_variables(self, variables):
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
|
||||
11
pina/problem/parametric_problem.py
Normal file
11
pina/problem/parametric_problem.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from abc import abstractmethod
|
||||
|
||||
from .abstract_problem import AbstractProblem
|
||||
|
||||
|
||||
class ParametricProblem(AbstractProblem):
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def parameters(self):
|
||||
pass
|
||||
@@ -1,6 +0,0 @@
|
||||
from .abstract_problem import AbstractProblem
|
||||
|
||||
|
||||
class Problem1D(AbstractProblem):
|
||||
|
||||
spatial_dimensions = 1
|
||||
@@ -1,6 +0,0 @@
|
||||
from .abstract_problem import AbstractProblem
|
||||
|
||||
|
||||
class Problem2D(AbstractProblem):
|
||||
|
||||
spatial_dimensions = 2
|
||||
10
pina/problem/spatial_problem.py
Normal file
10
pina/problem/spatial_problem.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from abc import abstractmethod
|
||||
|
||||
from .abstract_problem import AbstractProblem
|
||||
|
||||
|
||||
class SpatialProblem(AbstractProblem):
|
||||
|
||||
@abstractmethod
|
||||
def spatial_variables(self):
|
||||
pass
|
||||
@@ -1,6 +1,11 @@
|
||||
from abc import abstractmethod
|
||||
|
||||
from .abstract_problem import AbstractProblem
|
||||
|
||||
|
||||
class TimeDependentProblem(AbstractProblem):
|
||||
|
||||
pass
|
||||
@property
|
||||
@abstractmethod
|
||||
def temporal_variable(self):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user