Debian Codegraph @

src/adios4dolfinx/structures.py

raw
1 # Copyright (C) 2024 Jørgen Schartum Dokken
2 #
3 # This file is part of adios4dolfinx
4 #
5 # SPDX-License-Identifier: MIT
6
7 from __future__ import annotations
8
9 import typing
10 from dataclasses import dataclass
11
12 import numpy as np
13 import numpy.typing as npt
14
15 """Internal library classes for storing mesh and function data"""
16 __all__ = ["MeshData", "FunctionData"]
17
18
19 @dataclass
20 class MeshData:
21 # 2 dimensional array of node coordinates
22 local_geometry: typing.Union[npt.NDArray[np.float32], npt.NDArray[np.float64]]
23 local_geometry_pos: tuple[int, int] # Insert range on current process for geometry nodes
24 num_nodes_global: int # Number of nodes in global geometry array
25
26 local_topology: npt.NDArray[np.int64] # 2 dimensional connecitivty array for mesh topology
27 # Insert range on current process for topology
28 local_topology_pos: tuple[int, int]
29 num_cells_global: int # NUmber of cells in global topology
30
31 cell_type: str
32 degree: int
33 lagrange_variant: int
34
35 # Partitioning_information
36 store_partition: bool
37 partition_processes: typing.Optional[int] # Number of processes in partition
38 ownership_array: typing.Optional[npt.NDArray[np.int32]] # Ownership array for cells
39 ownership_offset: typing.Optional[npt.NDArray[np.int32]] # Ownership offset for cells
40 partition_range: typing.Optional[
41 tuple[int, int]
42 ] # Local insert position for partitioning information
43 partition_global: typing.Optional[int]
44
45
46 @dataclass
47 class FunctionData:
48 cell_permutations: npt.NDArray[np.uint32] # Cell permutations for dofmap
49 local_cell_range: tuple[int, int] # Range of cells on current process
50 num_cells_global: int # Number of cells in global topology
51 dofmap_array: npt.NDArray[np.int64] # Local function dofmap (using global indices)
52 dofmap_offsets: npt.NDArray[np.int64] # Global dofmap offsets
53 dofmap_range: tuple[int, int] # Range of dofmap on current process
54 global_dofs_in_dofmap: int # Number of entries in global dofmap
55 values: npt.NDArray[np.floating] # Local function values
56 dof_range: tuple[int, int] # Range of local function values
57 num_dofs_global: int # Number of global function values
58 name: str # Name of function