define the current behavior for matrix creations and retrievals on this graph
| 281 | |
| 282 | // define the current behavior for matrix creations and retrievals on this graph |
| 283 | MATRIX_POLICY Graph_SetMatrixPolicy |
| 284 | ( |
| 285 | Graph *g, |
| 286 | MATRIX_POLICY policy |
| 287 | ) { |
| 288 | MATRIX_POLICY prev_policy = Graph_GetMatrixPolicy(g); |
| 289 | |
| 290 | switch(policy) { |
| 291 | case SYNC_POLICY_FLUSH_RESIZE: |
| 292 | // Default behavior; forces execution of pending GraphBLAS operations |
| 293 | // when appropriate and sizes matrices to the current node count. |
| 294 | g->SynchronizeMatrix = _MatrixSynchronize; |
| 295 | break; |
| 296 | case SYNC_POLICY_RESIZE: |
| 297 | // Bulk insertion and creation behavior; does not force pending operations |
| 298 | // and resizes matrices to the graph's current node capacity. |
| 299 | g->SynchronizeMatrix = _MatrixResizeToCapacity; |
| 300 | break; |
| 301 | case SYNC_POLICY_NOP: |
| 302 | // Used when deleting or freeing a graph; forces no matrix updates or resizes. |
| 303 | g->SynchronizeMatrix = _MatrixNOP; |
| 304 | break; |
| 305 | default: |
| 306 | ASSERT(false); |
| 307 | } |
| 308 | |
| 309 | return prev_policy; |
| 310 | } |
| 311 | |
| 312 | // synchronize and resize all matrices in graph |
| 313 | void Graph_ApplyAllPending |
no test coverage detected