Create a mesh of a unit square. Args: comm: MPI communicator. nx: Number of cells in the "x" direction. ny: Number of cells in the "y" direction. cell_type: Mesh cell type. dtype: Float type for the mesh geometry(``numpy.float32`` or ``numpy.f
(
comm: _MPI.Comm,
nx: int,
ny: int,
cell_type=CellType.triangle,
dtype: npt.DTypeLike = default_real_type,
ghost_mode=GhostMode.shared_facet,
partitioner=None,
diagonal: DiagonalType = DiagonalType.right,
gdim: int = 2,
)
| 1111 | |
| 1112 | |
| 1113 | def create_unit_square( |
| 1114 | comm: _MPI.Comm, |
| 1115 | nx: int, |
| 1116 | ny: int, |
| 1117 | cell_type=CellType.triangle, |
| 1118 | dtype: npt.DTypeLike = default_real_type, |
| 1119 | ghost_mode=GhostMode.shared_facet, |
| 1120 | partitioner=None, |
| 1121 | diagonal: DiagonalType = DiagonalType.right, |
| 1122 | gdim: int = 2, |
| 1123 | ) -> Mesh: |
| 1124 | """Create a mesh of a unit square. |
| 1125 | |
| 1126 | Args: |
| 1127 | comm: MPI communicator. |
| 1128 | nx: Number of cells in the "x" direction. |
| 1129 | ny: Number of cells in the "y" direction. |
| 1130 | cell_type: Mesh cell type. |
| 1131 | dtype: Float type for the mesh geometry(``numpy.float32`` |
| 1132 | or ``numpy.float64``). |
| 1133 | ghost_mode: Ghost mode used in the mesh partitioning. |
| 1134 | partitioner: Function that computes the parallel distribution of |
| 1135 | cells across MPI ranks. |
| 1136 | diagonal: |
| 1137 | Direction of diagonal. See :class:`DiagonalType` for |
| 1138 | available options. |
| 1139 | gdim: Geometric dimension. The square lies in the first 2 |
| 1140 | coordinate axes; remaining components are zero. |
| 1141 | |
| 1142 | Returns: |
| 1143 | A mesh of a square with corners at ``(0, 0)`` and ``(1, 1)``. |
| 1144 | """ |
| 1145 | return create_rectangle( |
| 1146 | comm, |
| 1147 | [np.array([0.0, 0.0]), np.array([1.0, 1.0])], |
| 1148 | (nx, ny), |
| 1149 | cell_type, |
| 1150 | dtype=dtype, |
| 1151 | ghost_mode=ghost_mode, |
| 1152 | partitioner=partitioner, |
| 1153 | diagonal=diagonal, |
| 1154 | gdim=gdim, |
| 1155 | ) |
| 1156 | |
| 1157 | |
| 1158 | def create_box( |