-
Notifications
You must be signed in to change notification settings - Fork 236
/
execution_policy.py
46 lines (35 loc) · 1.17 KB
/
execution_policy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from abc import ABC, abstractmethod
import KratosMultiphysics as Kratos
class ExecutionPolicy(ABC):
"""Base class for execution policy
This represents the base class for the execution policy which
can be used to execute primal analysis to obtain response function
values and their gradients.
"""
def __init__(self, execution_policy_name: str) -> None:
self.__name = execution_policy_name
def GetName(self) -> str:
return self.__name
@abstractmethod
def Initialize(self) -> None:
pass
@abstractmethod
def Check(self) -> None:
pass
@abstractmethod
def Finalize(self) -> None:
pass
@abstractmethod
def GetAnalysisModelPart(self) -> Kratos.ModelPart:
"""Returns the analysis model part.
Each execution policy will be using a domain to compute the primal model part.
This method should return that domain as a Kratos::ModelPart.
Returns:
Kratos.ModelPart: Domain used to compute the primal solution.
"""
pass
@abstractmethod
def Execute(self) -> None:
"""Solves the associated primal problem.
"""
pass