MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / create_unit_square

Function create_unit_square

python/dolfinx/mesh.py:1113–1155  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

1111
1112
1113def 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
1158def create_box(

Callers 15

test_linear_pdeMethod · 0.90
test_nonlinear_pdeMethod · 0.90
meshFunction · 0.90
test_block_sizeFunction · 0.90
test_P_simplex_built_inFunction · 0.90
test_P_tp_built_in_meshFunction · 0.90
test_S_tp_built_in_meshFunction · 0.90
test_mixed_elementFunction · 0.90
test_vector_elementFunction · 0.90
test_element_productFunction · 0.90

Calls 2

create_rectangleFunction · 0.70
arrayMethod · 0.45

Tested by 15

test_linear_pdeMethod · 0.72
test_nonlinear_pdeMethod · 0.72
meshFunction · 0.72
test_block_sizeFunction · 0.72
test_P_simplex_built_inFunction · 0.72
test_P_tp_built_in_meshFunction · 0.72
test_S_tp_built_in_meshFunction · 0.72
test_mixed_elementFunction · 0.72
test_vector_elementFunction · 0.72
test_element_productFunction · 0.72