optymus.benchmark.TopologicalDomain¶
- class optymus.benchmark.TopologicalDomain(name, domain_bounding_box, signed_distance_function, domain_boundary_conditions=None, domain_fixed_points=[])[source]¶
Represents a mathematically defined domain for polygonal mesh.
This class defines a mathematically defined domain based on its name, bounding box, signed distance function (signed_distance_function), boundary conditions (domain_boundary_conditions), and fixed points (domain_fixed_points).
- name¶
The name of the mathematically defined domain.
- Type:
str
- domain_bounding_box¶
The bounding box of the domain, defined as [xmin, xmax, ymin, ymax].
- Type:
list
- signed_distance_function¶
The signed distance function that provides the distance values.
- Type:
callable
- domain_boundary_conditions¶
The function for setting boundary conditions. Default is None.
- Type:
callable, optional
- domain_fixed_points¶
List of fixed points within the domain. Default is an empty list.
- Type:
list, optional
- signed_distance(P)[source]¶
Computes the distance value for a point P using the signed distance function.
- boundary_conditions(Node)[source]¶
Determines the boundary conditions for a given node within the domain.
- compute_area(n=1_000_000)[source]¶
Calculates the approximate area of the domain using the Monte Carlo method
- __init__(name, domain_bounding_box, signed_distance_function, domain_boundary_conditions=None, domain_fixed_points=[])[source]¶
Initializes a Domain object with the provided attributes.
- Parameters:
name (str) – The name of the computational domain.
domain_bounding_box (list) – The bounding box of the domain, defined as [xmin, xmax, ymin, ymax].
signed_distance_function (callable) – The signed distance function that provides the distance values.
domain_boundary_conditions (callable, optional) – The function for setting boundary conditions. Default is None.
domain_fixed_points (list, optional) – List of fixed points within the domain. Default is an empty list.
Methods
__init__(name, domain_bounding_box, ...[, ...])Initializes a Domain object with the provided attributes.
boundary_conditions(Node)Determines the boundary conditions for a given node within the domain.
compute_area([n])Calculates the approximate area of the domain using the Monte Carlo method.
Computes the distance value for a point P using the signed distance function.
- boundary_conditions(Node)[source]¶
Determines the boundary conditions for a given node within the domain.
- Parameters:
Node (tuple) – The coordinates of a node (x, y).
- Returns:
A list containing boundary conditions for the node. It may include None values.
- Return type:
list
- compute_area(n=1000000)[source]¶
Calculates the approximate area of the domain using the Monte Carlo method.
- Parameters:
n (int, optional) – The number of random points to use. Default is 1,000,000.
- Returns:
The calculated approximate area of the domain.
- Return type:
float
- signed_distance(P)[source]¶
Computes the distance value for a point P using the signed distance function.
- Parameters:
P (numpy.ndarray) – A point or an array of points for which the distance is to be calculated.
- Returns:
An array of distance values corresponding to the input points.
- Return type:
numpy.ndarray