Datasets:

License:
File size: 804 Bytes
76cb30c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import numpy as np
def rectangular_quads(x_count, y_count, x_origin, y_origin, width, height):
    nodes = np.zeros((x_count * y_count, 2), dtype=np.float64)
    elements = np.zeros(((x_count - 1) * (y_count - 1), 4), dtype=np.int32)
    points_x = np.linspace(x_origin, x_origin + width, num=x_count)
    points_y = np.linspace(y_origin, y_origin + height, num=y_count)
    for i in range(x_count):
        for j in range(y_count):
            nodes[i * y_count + j, 0] = points_x[i]
            nodes[i * y_count + j, 1] = points_y[j]
    for i in range(x_count - 1):
        for j in range(y_count - 1):
            elem_idx = i * (y_count - 1) + j
            elements[elem_idx] = [i * y_count + j, (i + 1) * y_count + j, (i + 1) * y_count + (j + 1), i * y_count + (j + 1)]
    return nodes, elements