void recv_create_face(void) { int i = recv_index(); int j = recv_index(); create_face(i, j); }
void faceinit ( void ) { face = create_face ( "index.dat", "faceline.dat") ; read_muscles ("muscle.dat", face ) ; read_expression_vectors ("expression-vectors.dat", face ) ; data_struct ( face ) ; }
int send_create_face(int i, int j) { send_event(EVENT_CREATE_FACE); send_index(i); send_index(j); return create_face(i, j); }
static void * create_font (void) { hb_face_t *face = (hb_face_t *) create_face (); hb_font_t *font = hb_font_create (face); hb_face_destroy (face); return font; }
static int add_delete_ccn_face(struct ccn *h, const char *uri, const char *address, const unsigned int p, int operation) { struct ccn_charbuf *prefix; char port[6]; struct ccn_charbuf *local_scope_template = ccn_charbuf_create(); struct ccn_charbuf *no_name = ccn_charbuf_create(); unsigned char ccndid_storage[32] = {0}; unsigned char *ccndid = ccndid_storage; size_t ccndid_size = 0; struct ccn_face_instance *fi; struct ccn_face_instance *nfi; int res; prefix = ccn_charbuf_create(); res = ccn_name_from_uri(prefix, uri); ON_ERROR_CLEANUP(res); memset(port, 0, 6); sprintf(port, "%d", p); init_data(local_scope_template, no_name); ccndid_size = get_ccndid(h, local_scope_template, ccndid); if (ccndid_size != sizeof(ccndid_storage)) { fprintf(stderr, "Incorrect size for ccnd id in response\n"); ON_ERROR_CLEANUP(-1); } /* construct a face instance for new face request */ fi = construct_face(ccndid, ccndid_size, address, port); ON_NULL_CLEANUP(fi); /* send new face request to actually create a new face */ nfi = create_face(h, local_scope_template, no_name, fi); ON_NULL_CLEANUP(nfi); res = register_unregister_prefix(h, local_scope_template, no_name, prefix, nfi, operation); ON_ERROR_CLEANUP(res); ccn_charbuf_destroy(&local_scope_template); ccn_charbuf_destroy(&no_name); ccn_face_instance_destroy(&fi); ccn_face_instance_destroy(&nfi); ccn_charbuf_destroy(&prefix); return 0; cleanup: ccn_charbuf_destroy(&prefix); ccn_charbuf_destroy(&local_scope_template); ccn_charbuf_destroy(&no_name); ccn_face_instance_destroy(&fi); ccn_face_instance_destroy(&nfi); return -1; }
/* * Create a newface on the given address and port, bind the prefix to the face */ int add_new_face(struct ccn *h, struct ccn_charbuf *prefix, const char *address, const char *port) { struct ccn_charbuf *local_scope_template = ccn_charbuf_create(); struct ccn_charbuf *no_name = ccn_charbuf_create(); unsigned char ccndid_storage[32] = {0}; const unsigned char *ccndid = ccndid_storage; size_t ccndid_size = 0; struct ccn_face_instance *fi; struct ccn_face_instance *nfi; int res; init_data(local_scope_template, no_name); ccndid_size = get_ccndid(h, local_scope_template, ccndid); if (ccndid_size != sizeof(ccndid_storage)) { fprintf(stderr, "Incorrect size for ccnd id in response\n"); ON_ERROR_CLEANUP(-1); } /* construct a face instance for new face request */ fi = construct_face(ccndid, ccndid_size, address, port); ON_NULL_CLEANUP(fi); /* send new face request to actually create a new face */ nfi = create_face(h, local_scope_template, no_name, fi); ON_NULL_CLEANUP(nfi); /* bind prefix to the new face */ res = register_prefix(h, local_scope_template, no_name, prefix, nfi); ON_ERROR_CLEANUP(res); ccn_charbuf_destroy(&local_scope_template); ccn_charbuf_destroy(&no_name); ccn_face_instance_destroy(&fi); ccn_face_instance_destroy(&nfi); return 0; cleanup: ccn_charbuf_destroy(&local_scope_template); ccn_charbuf_destroy(&no_name); ccn_face_instance_destroy(&fi); ccn_face_instance_destroy(&nfi); return -1; }
template <typename INT> void FaceGenerator::generate_faces(INT /*dummy*/) { Ioss::NodeBlock *nb = region_.get_node_blocks()[0]; std::vector<INT> ids; nb->get_field_data("ids", ids); // Convert ids into hashed-ids auto starth = std::chrono::high_resolution_clock::now(); std::vector<size_t> hash_ids; hash_ids.reserve(ids.size()); for (auto id : ids) { hash_ids.push_back(id_hash(id)); } auto endh = std::chrono::high_resolution_clock::now(); size_t numel = region_.get_property("element_count").get_int(); faces_.reserve(3.3 * numel); Ioss::ElementBlockContainer ebs = region_.get_element_blocks(); for (auto eb : ebs) { const Ioss::ElementTopology *topo = eb->topology(); // Only handle continuum elements at this time... if (topo->parametric_dimension() != 3) { continue; } std::vector<INT> connectivity; eb->get_field_data("connectivity_raw", connectivity); std::vector<INT> elem_ids; eb->get_field_data("ids", elem_ids); int num_face_per_elem = topo->number_faces(); assert(num_face_per_elem <= 6); std::array<Ioss::IntVector, 6> face_conn; std::array<int, 6> face_count; for (int face = 0; face < num_face_per_elem; face++) { face_conn[face] = topo->face_connectivity(face + 1); face_count[face] = topo->face_type(face + 1)->number_corner_nodes(); } int num_node_per_elem = topo->number_nodes(); size_t num_elem = eb->get_property("entity_count").get_int(); for (size_t elem = 0, offset = 0; elem < num_elem; elem++, offset += num_node_per_elem) { for (int face = 0; face < num_face_per_elem; face++) { size_t id = 0; assert(face_count[face] <= 4); std::array<size_t, 4> conn = {{0, 0, 0, 0}}; for (int j = 0; j < face_count[face]; j++) { size_t fnode = offset + face_conn[face][j]; size_t gnode = connectivity[fnode]; conn[j] = ids[gnode - 1]; id += hash_ids[gnode - 1]; } create_face(faces_, id, conn, elem_ids[elem]); } } } auto endf = std::chrono::high_resolution_clock::now(); resolve_parallel_faces(region_, faces_, hash_ids, (INT)0); auto endp = std::chrono::high_resolution_clock::now(); auto diffh = endh - starth; auto difff = endf - endh; auto diffp = endp - endf; std::cout << "Node ID hash time: \t" << std::chrono::duration<double, std::milli>(diffh).count() << " ms\t" << hash_ids.size() / std::chrono::duration<double>(diffh).count() << " nodes/second\n"; std::cout << "Face generation time:\t" << std::chrono::duration<double, std::milli>(difff).count() << " ms\t" << faces_.size() / std::chrono::duration<double>(difff).count() << " faces/second.\n"; #ifdef HAVE_MPI size_t proc_count = region_.get_database()->util().parallel_size(); if (proc_count > 1) { std::cout << "Parallel time: \t" << std::chrono::duration<double, std::milli>(diffp).count() << " ms\t" << faces_.size() / std::chrono::duration<double>(diffp).count() << " faces/second.\n"; } #endif std::cout << "Total time: \t" << std::chrono::duration<double, std::milli>(endp - starth).count() << " ms\n\n"; }