Download 19.py from TestCaseGeneration/NumFEM_Eval: direct link, hf CLI and curl.
- Browser
- Download file 804 Bytes
-
https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/19.py
- Command line
-
hf download hf://datasets/TestCaseGeneration/NumFEM_Eval/19.py
-
curl -L -o 19.py https://huggingface.co/datasets/TestCaseGeneration/NumFEM_Eval/resolve/main/19.py
804 Bytes
| 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 |