@@ -20,7 +20,7 @@ def serialize_grid(repo: fesapi.DataObjectRepository):
2020 resqml_points .setitem (i , value )
2121 single_cell_ijk_grid .setGeometryAsCoordinateLineNodes (
2222 fesapi .resqml20__PillarShape_vertical , fesapi .resqml20__KDirection_down , False ,
23- resqml_points )
23+ resqml_points . cast () )
2424
2525 # ONE CONTINUOUS PROPERTY ON A PARTIAL 3 cells I=1 J=1 K=3 GRID
2626 partial_ijk_grid = repo .createPartialIjkGridRepresentation ("bc92a216-aa17-4a1f-9253-8b3ab094bf84" , "partial grid" )
@@ -33,7 +33,48 @@ def serialize_grid(repo: fesapi.DataObjectRepository):
3333 stats = fesapi .FloatArrayStatistics ()
3434 stats .setMaximum (3.3 )
3535 stats .setMinimum (1.1 )
36- continuous_prop .pushBackFloatArray3dOfValuesPlusStatistics (resqml_values , 1 , 1 , 3 , stats )
36+ continuous_prop .pushBackFloatArray3dOfValuesPlusStatistics (resqml_values .cast (), 1 , 1 , 3 , stats )
37+
38+ # unstructured grid example
39+ unstructured_grid = repo .createUnstructuredGridRepresentation (
40+ "9283cd33-5e52-4110-b7b1-616abde2b303" ,
41+ "One tetrahedron + prism grid" ,
42+ 2
43+ )
44+ python_points = [0 , 0 , 300 , 375 , 0 , 300 , 0 , 150 , 300 , # points for shared face between tetra and wedge
45+ 0 , 0 , 500 , # point for tetra
46+ 0 , 0 , 0 , 375 , 0 , 0 , 0 , 150 , 0 ]
47+ resqml_points = fesapi .DoubleArray (21 )
48+ for i , value in enumerate (python_points ):
49+ resqml_points .setitem (i , value )
50+ python_node_indices_per_face = [0 , 1 , 2 , # shared face
51+ 1 , 2 , 3 , 0 , 1 , 3 , 0 , 2 , 3 , # faces for tetra
52+ 0 , 2 , 6 , 4 , 2 , 1 , 5 , 6 , 0 , 1 , 5 , 4 , 4 , 5 , 6 ] # faces for wedge
53+ resqml_node_indices_per_face = fesapi .UInt64Array (27 )
54+ for i , value in enumerate (python_node_indices_per_face ):
55+ resqml_node_indices_per_face .setitem (i , value )
56+ python_node_indices_cumulative_count_per_face = [3 , # shared face
57+ 6 , 9 , 12 , # faces for tetra
58+ 16 , 20 , 24 , 27 ] # faces for wedge
59+ resqml_node_indices_cumulative_count_per_face = fesapi .UInt64Array (8 )
60+ for i , value in enumerate (python_node_indices_cumulative_count_per_face ):
61+ resqml_node_indices_cumulative_count_per_face .setitem (i , value )
62+ python_face_indices_per_cell = [0 , 1 , 2 , 3 , # tetra
63+ 0 , 4 , 5 , 6 , 7 ] # wedge
64+ resqml_face_indices_per_cell = fesapi .UInt64Array (9 )
65+ for i , value in enumerate (python_face_indices_per_cell ):
66+ resqml_face_indices_per_cell .setitem (i , value )
67+ python_face_indices_cumulative_count_per_cell = [ 4 , 9 ];
68+ resqml_face_indices_cumulative_count_per_cell = fesapi .UInt64Array (2 )
69+ for i , value in enumerate (python_face_indices_cumulative_count_per_cell ):
70+ resqml_face_indices_cumulative_count_per_cell .setitem (i , value )
71+ python_face_right_handness = [ 1 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 1 ];
72+ resqml_face_right_handness = fesapi .UInt8Array (9 )
73+ for i , value in enumerate (python_face_right_handness ):
74+ resqml_face_right_handness .setitem (i , value )
75+ unstructured_grid .setGeometry (resqml_face_right_handness .cast (), resqml_points .cast (), 7 , None , resqml_face_indices_per_cell .cast (), resqml_face_indices_cumulative_count_per_cell .cast (), 8 ,
76+ resqml_node_indices_per_face .cast (), resqml_node_indices_cumulative_count_per_face .cast (), fesapi .resqml20__CellShape_prism );
77+
3778
3879def serialize (file_name : str ):
3980 """
@@ -122,15 +163,15 @@ def show_ijk_grid(ijk_grid: fesapi.Resqml2_AbstractIjkGridRepresentation):
122163 for patch_index in range (patch_count ):
123164 nb_xyz_points_in_patch = ijk_grid .getXyzPointCountOfPatch (patch_index )
124165 xyz_points_in_patch = fesapi .DoubleArray (nb_xyz_points_in_patch * 3 )
125- ijk_grid .getXyzPointsOfPatch (patch_index , xyz_points_in_patch )
166+ ijk_grid .getXyzPointsOfPatch (patch_index , xyz_points_in_patch . cast () )
126167 for vertex_index in range (nb_xyz_points_in_patch ):
127168 x = xyz_points_in_patch .getitem (vertex_index * 3 )
128169 y = xyz_points_in_patch .getitem (vertex_index * 3 + 1 )
129170 z = xyz_points_in_patch .getitem (vertex_index * 3 + 2 )
130171 print ("Vertex " , vertex_index , " : " , x , " " , y , " " , z )
131172
132173 xyz_points = fesapi .DoubleArray (nb_xyz_points * 3 )
133- ijk_grid .getXyzPointsOfAllPatches (xyz_points )
174+ ijk_grid .getXyzPointsOfAllPatches (xyz_points . cast () )
134175
135176 ijk_grid .loadSplitInformation ()
136177 for cell_corner in range (8 ):
0 commit comments