MCPcopy
hub / github.com/tum-pbs/PhiFlow / graph

Function graph

phi/geom/_graph.py:145–165  ·  view source on GitHub ↗

Construct a `Graph`. Args: nodes: Location `Tensor` or `Geometry` objects representing the nodes. edges: Connectivity and edge value `Tensor`. boundary: Named boundary sets. Returns: `Graph`

(nodes: Union[Geometry, Tensor],
          edges: Tensor,
          boundary: Dict[str, Dict[str, slice]] = None,
          build_distances=True,  # remaining for legacy reasons. Now evaluated on demand.
          build_bounding_distance=False)

Source from the content-addressed store, hash-verified

143
144
145def graph(nodes: Union[Geometry, Tensor],
146 edges: Tensor,
147 boundary: Dict[str, Dict[str, slice]] = None,
148 build_distances=True, # remaining for legacy reasons. Now evaluated on demand.
149 build_bounding_distance=False) -> Graph:
150 """
151 Construct a `Graph`.
152
153 Args:
154 nodes: Location `Tensor` or `Geometry` objects representing the nodes.
155 edges: Connectivity and edge value `Tensor`.
156 boundary: Named boundary sets.
157
158 Returns:
159 `Graph`
160 """
161 if isinstance(nodes, Tensor):
162 assert 'vector' in channel(nodes) and channel(nodes).get_item_names('vector') is not None, f"nodes must have a 'vector' dim listing the physical dimensions but got {shape(nodes)}"
163 nodes = Point(nodes)
164 boundary = {} if boundary is None else boundary
165 return Graph(nodes, edges, boundary)

Callers 3

test_sliceMethod · 0.90
test_batch_sliceMethod · 0.90
vertex_graphMethod · 0.85

Calls 2

PointClass · 0.85
GraphClass · 0.85

Tested by 2

test_sliceMethod · 0.72
test_batch_sliceMethod · 0.72