plot3d 1.6.4__tar.gz → 1.6.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {plot3d-1.6.4 → plot3d-1.6.5}/PKG-INFO +1 -1
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/__init__.py +1 -1
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/block.py +11 -1
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/graph.py +38 -8
- {plot3d-1.6.4 → plot3d-1.6.5}/pyproject.toml +1 -1
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/blockfunctions.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/connectivity.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/differencing.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/face.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/facefunctions.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/listfunctions.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/periodicity.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/point_match.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/read.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/split_block.py +0 -0
- {plot3d-1.6.4 → plot3d-1.6.5}/plot3d/write.py +0 -0
|
@@ -10,4 +10,4 @@ from .periodicity import periodicity, periodicity_fast, create_rotation_matrix,
|
|
|
10
10
|
from .point_match import point_match
|
|
11
11
|
from .split_block import split_blocks, Direction
|
|
12
12
|
from .listfunctions import unique_pairs
|
|
13
|
-
from .graph import block_to_graph,get_face_vertex_indices,get_starting_vertex,add_connectivity_to_graph
|
|
13
|
+
from .graph import block_to_graph,get_face_vertex_indices,get_starting_vertex,add_connectivity_to_graph, block_connectivity_to_graph
|
|
@@ -163,6 +163,15 @@ class Block:
|
|
|
163
163
|
+cf[4+n,l]*a[6+l][i,j,k-1+n])
|
|
164
164
|
v[i,j,k]= vol12/12
|
|
165
165
|
return v
|
|
166
|
+
|
|
167
|
+
@property
|
|
168
|
+
def size(self)->int:
|
|
169
|
+
"""returns the total number of nodes
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
int: number of nodes
|
|
173
|
+
"""
|
|
174
|
+
return self.IMAX*self.JMAX*self.KMAX
|
|
166
175
|
|
|
167
176
|
def checkCollinearity(v1:np.ndarray, v2:np.ndarray):
|
|
168
177
|
# Calculate their cross product
|
|
@@ -251,4 +260,5 @@ def reduce_blocks(blocks:List[Block],factor:int):
|
|
|
251
260
|
blocks[i].Y = blocks[i].Y[::factor,::factor,::factor]
|
|
252
261
|
blocks[i].Z = blocks[i].Z[::factor,::factor,::factor]
|
|
253
262
|
blocks[i].IMAX,blocks[i].JMAX,blocks[i].KMAX = blocks[i].X.shape
|
|
254
|
-
return blocks
|
|
263
|
+
return blocks
|
|
264
|
+
|
|
@@ -3,7 +3,7 @@ import numpy.typing as npt
|
|
|
3
3
|
import networkx as nx
|
|
4
4
|
import itertools as it
|
|
5
5
|
from typing import Dict, Tuple, List
|
|
6
|
-
|
|
6
|
+
import tqdm
|
|
7
7
|
|
|
8
8
|
def block_to_graph(IMAX:int,JMAX:int,KMAX:int,offset:int = 0) -> nx.graph.Graph:
|
|
9
9
|
"""Converts a block to a graph
|
|
@@ -112,16 +112,16 @@ def add_connectivity_to_graph(G:nx.classes.graph.Graph,block_sizes:List[Tuple[in
|
|
|
112
112
|
|
|
113
113
|
Args:
|
|
114
114
|
G (nx.classes.graph.Graph): Giant graph
|
|
115
|
-
block_sizes (List[Tuple[int,int,int]]):
|
|
115
|
+
block_sizes (List[Tuple[int,int,int]]): List of all the [[IMAX,JMAX,KMAX]]
|
|
116
116
|
connectivity (List[Dict[str,int]]): _description_
|
|
117
117
|
|
|
118
118
|
Returns:
|
|
119
119
|
nx.graph.Graph: networkx graph object with added edges
|
|
120
120
|
"""
|
|
121
121
|
|
|
122
|
-
for con in connectivities:
|
|
123
|
-
block1_index = con['block1']['
|
|
124
|
-
block2_index = con['block2']['
|
|
122
|
+
for con in tqdm.tqdm(connectivities,"Adding connectivity to Graph"):
|
|
123
|
+
block1_index = con['block1']['block_index']
|
|
124
|
+
block2_index = con['block2']['block_index']
|
|
125
125
|
IMIN1,IMAX1 = con['block1']['IMIN'], con['block1']['IMAX']
|
|
126
126
|
JMIN1,JMAX1 = con['block1']['JMIN'], con['block1']['JMAX']
|
|
127
127
|
KMIN1,KMAX1 = con['block1']['KMIN'], con['block1']['KMAX']
|
|
@@ -131,13 +131,13 @@ def add_connectivity_to_graph(G:nx.classes.graph.Graph,block_sizes:List[Tuple[in
|
|
|
131
131
|
KMIN2,KMAX2 = con['block2']['KMIN'], con['block2']['KMAX']
|
|
132
132
|
|
|
133
133
|
# Number of connectivities should match
|
|
134
|
-
face1 = get_face_vertex_indices(IMIN1,IMAX1,
|
|
135
|
-
face2 = get_face_vertex_indices(IMIN2,IMAX2,
|
|
134
|
+
face1 = get_face_vertex_indices(IMIN1,JMIN1,KMIN1,IMAX1,JMAX1,KMAX1,block_sizes[block1_index]) + get_starting_vertex(block1_index, block_sizes)
|
|
135
|
+
face2 = get_face_vertex_indices(IMIN2,JMIN2,KMIN2,IMAX2,JMAX2,KMAX2,block_sizes[block2_index]) + get_starting_vertex(block2_index, block_sizes)
|
|
136
136
|
|
|
137
137
|
if block1_index!= block2_index:
|
|
138
138
|
nodes_to_add = face1
|
|
139
139
|
nodes_to_replace = face2
|
|
140
|
-
for node_to_add,node_to_replace in zip(nodes_to_add,nodes_to_replace):
|
|
140
|
+
for node_to_add,node_to_replace in tqdm.tqdm(zip(nodes_to_add,nodes_to_replace)):
|
|
141
141
|
G.add_edges_from(
|
|
142
142
|
it.product(
|
|
143
143
|
G.neighbors(node_to_add),
|
|
@@ -152,3 +152,33 @@ def add_connectivity_to_graph(G:nx.classes.graph.Graph,block_sizes:List[Tuple[in
|
|
|
152
152
|
G.add_edge(face1[i],face2[i])
|
|
153
153
|
|
|
154
154
|
return G
|
|
155
|
+
|
|
156
|
+
def block_connectivity_to_graph(connectivities:List[Dict[str,int]],block_sizes:List[Tuple[int,int,int]]) -> nx.graph.Graph:
|
|
157
|
+
"""Models the blocks at vertices connected to each other
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
connectivities (List[Dict[str,int]]): List of connectivities
|
|
161
|
+
block_sizes (List[Tuple[int,int,int]]): List of all the [[IMAX,JMAX,KMAX]]
|
|
162
|
+
Returns:
|
|
163
|
+
nx.graph.Graph: Graph object
|
|
164
|
+
"""
|
|
165
|
+
block_to_block = list()
|
|
166
|
+
G = nx.Graph()
|
|
167
|
+
for con in tqdm.tqdm(connectivities,"Adding connectivity to Graph"):
|
|
168
|
+
block1_index = con['block1']['block_index']
|
|
169
|
+
block2_index = con['block2']['block_index']
|
|
170
|
+
|
|
171
|
+
block_to_block.append((block1_index,block2_index))
|
|
172
|
+
|
|
173
|
+
# Adds the nodes
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
for i in range(len(block_sizes)):
|
|
177
|
+
G.add_node(i, weight=block_sizes[i])
|
|
178
|
+
|
|
179
|
+
# Adds the connectivity information
|
|
180
|
+
G.add_edges_from(block_to_block)
|
|
181
|
+
|
|
182
|
+
return G
|
|
183
|
+
|
|
184
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|