Lines Matching refs:mesh

177 	 * mesh errors
185 * per fabric mesh info
191 int dimension; /* mesh dimension */
192 int *size; /* an array to hold size of mesh */
198 mesh_t *mesh;
674 static void classify_switch(lash_t *p_lash, mesh_t *mesh, int sw)
686 for (i = 0; i < mesh->num_class; i++) {
687 s1 = p_lash->switches[mesh->class_type[i]];
692 mesh->class_count[i]++;
696 mesh->class_type[mesh->num_class] = sw;
697 mesh->class_count[mesh->num_class] = 1;
698 mesh->num_class++;
778 static int get_local_geometry(lash_t *p_lash, mesh_t *mesh)
806 classify_switch(p_lash, mesh, sw);
833 * assumes switch is of type cartesian mesh
966 * only process 'mesh' switches
1134 static int reorder_node_links(lash_t *p_lash, mesh_t *mesh, int sw)
1145 int dimension = mesh->dimension;
1164 j = mesh->dim_order[i];
1211 static int make_coord(lash_t *p_lash, mesh_t *mesh, int seed)
1218 unsigned int dimension = mesh->dimension;
1286 static int measure_geometry(lash_t *p_lash, mesh_t *mesh)
1292 int dimension = mesh->dimension;
1302 mesh->size = calloc(dimension, sizeof(int));
1303 if (!mesh->size) {
1329 mesh->size[i] = size[i] = max[i] - min[i] + 1;
1346 mesh->dim_order[j] = max_index;
1357 static int reorder_links(lash_t *p_lash, mesh_t *mesh)
1366 if (reorder_node_links(p_lash, mesh, sw)) {
1388 for (i = 0; i < ctx->mesh->dimension; i++) {
1389 j = ctx->mesh->dim_order[i];
1401 static void sort_switches(lash_t *p_lash, mesh_t *mesh)
1421 comp[i].ctx.mesh = mesh;
1452 * osm_mesh_delete - free per mesh resources
1454 static void mesh_delete(mesh_t *mesh)
1456 if (mesh) {
1457 if (mesh->class_type)
1458 free(mesh->class_type);
1460 if (mesh->class_count)
1461 free(mesh->class_count);
1463 if (mesh->size)
1464 free(mesh->size);
1466 free(mesh);
1471 * osm_mesh_create - allocate per mesh resources
1476 mesh_t *mesh;
1478 if(!(mesh = calloc(1, sizeof(mesh_t))))
1481 if (!(mesh->class_type = calloc(p_lash->num_switches, sizeof(int))))
1484 if (!(mesh->class_count = calloc(p_lash->num_switches, sizeof(int))))
1487 return mesh;
1490 mesh_delete(mesh);
1492 "Failed allocating mesh - out of memory\n");
1570 "Failed allocating mesh node - out of memory\n");
1638 mesh_t *mesh;
1647 mesh = mesh_create(p_lash);
1648 if (!mesh)
1651 if (get_local_geometry(p_lash, mesh))
1654 if (mesh->num_class == 0) {
1656 "found no likely mesh nodes - done\n");
1664 mesh->num_class, (mesh->num_class == 1) ? "" : "es");
1665 for (i = 0; i < mesh->num_class; i++) {
1668 i, mesh->class_count[i],
1669 p_lash->switches[mesh->class_type[i]]->node->type);
1670 if (mesh->class_count[i] > max_class_num) {
1671 max_class_num = mesh->class_count[i];
1672 max_class_type = mesh->class_type[i];
1680 (mesh->num_class == 1) ? "" : "most common ");
1689 p += sprintf(p, " mesh\n");
1691 mesh->dimension = t->dimension;
1704 if (make_coord(p_lash, mesh, max_class_type))
1707 if (measure_geometry(p_lash, mesh))
1710 if (reorder_links(p_lash, mesh))
1713 sort_switches(p_lash, mesh);
1717 for (i = 0; i < mesh->dimension; i++)
1718 p += sprintf(p, "%s%d", i? " x " : "", mesh->size[i]);
1719 p += sprintf(p, " mesh\n");
1728 mesh_delete(mesh);
1733 mesh_delete(mesh);