|
Peano
|
Functions | |
| round_sig (x, sig) | |
| Round a number to a specified number of significant figures. | |
| read_patches (file_path, size_group, dimensions) | |
| Parse a single Peano grid patch file and extract spatial information. | |
| GridPatchFileReader (name=None, file_path=None, dimensions=None) | |
| Main function to read Peano grid patch files and convert to Tree structure. | |
| GridPatchFileReader.GridPatchFileReader | ( | name = None, |
|
file_path = None, |
|||
dimensions = None |
|||
| ) |
Main function to read Peano grid patch files and convert to Tree structure.
This function processes a directory of Peano grid patch files and constructs a Tree object suitable for load balancing analysis. It handles multiple subtrees, determines domain boundaries, and creates the hierarchical array structure.
Each 'grid-' file represents a different subtree in the domain decomposition. The function automatically:
Args: name (str, optional): Descriptive name for the resulting tree. If not provided, a deterministic default name is generated. file_path (str): Path to directory containing grid patch files dimensions (int): Spatial dimensions count (2 for 2D, 3 for 3D)
Returns: Tree: Tree object with complete spatial structure and subtree assignments
Example: ```python
tree = GridPatchFileReader( name="CCZ4_Simulation_T100", file_path="/path/to/checkpoint/grid/files", dimensions=3 )
print(f"Loaded tree with {tree._leaf_count} leaves") print(f"Domain: {tree._domain_offset} to {tree._domain_size}") print(f"Subtrees: {tree._subtree_count}") ```
Definition at line 141 of file GridPatchFileReader.py.
References read_patches(), and round_sig().

| GridPatchFileReader.read_patches | ( | file_path, | |
| size_group, | |||
| dimensions | |||
| ) |
Parse a single Peano grid patch file and extract spatial information.
This function reads a grid patch file and extracts offset and size information for each patch using regular expressions. Patches are grouped by size to determine refinement levels.
Args: file_path (str): Path to the grid patch file size_group (defaultdict): Dictionary to store {size: [offsets]} mapping dimensions (int): Spatial dimensions count (2 or 3)
Returns: defaultdict: Updated size_group with patch information
Note: The regular expression patterns match the standard Peano patch format:
Definition at line 93 of file GridPatchFileReader.py.
Referenced by GridPatchFileReader().

| GridPatchFileReader.round_sig | ( | x, | |
| sig | |||
| ) |
Round a number to a specified number of significant figures.
Args: x (float): Number to round sig (int): Number of significant figures
Returns: float: Rounded number
Definition at line 80 of file GridPatchFileReader.py.
Referenced by GridPatchFileReader().
