CubitStatus CAUniqueId::actuate() { if (hasActuated == CUBIT_TRUE) return CUBIT_SUCCESS; // create a TDUniqueId for the entity, if it doesn't already // exist TDUniqueId *uid = (TDUniqueId *) attrib_owner()->get_TD(&TDUniqueId::is_unique_id); if (uid != NULL) { // check to make sure it's the same unique id if (uid->unique_id() != uniqueId) { PRINT_ERROR("Different unique id found for %s %d.\n", attrib_owner()->class_name(), attrib_owner()->id()); return CUBIT_FAILURE; } } else { // else make a new one uid = new TDUniqueId(attrib_owner(), uniqueId); } delete_attrib(CUBIT_TRUE); hasActuated = CUBIT_TRUE; return CUBIT_SUCCESS; }
CubitStatus CABodies::update() { if (hasUpdated) return CUBIT_SUCCESS; if (DEBUG_FLAG(138)) { PRINT_DEBUG_138( "Updating BODIES attribute for %s %d\n", attribOwnerEntity->class_name(), attribOwnerEntity->id()); } // set the updated flag hasUpdated = CUBIT_TRUE; // if the owner has a body list, save it, otherwise delete this one TDParallel *td_par = (TDParallel *) attrib_owner()->get_TD(&TDParallel::is_parallel); if (td_par == NULL) { delete_attrib(CUBIT_TRUE); } else { m_interface = td_par->is_interface(); m_uniqueID = td_par->get_unique_id(); int size = td_par->get_shared_body_list()->size(); td_par->get_shared_body_list()->reset(); m_sharedBodies.clean_out(); for (int i = 0; i < size; i++) { m_sharedBodies.append(td_par->get_shared_body_list()->get_and_step()); } size = td_par->get_shared_proc_list()->size(); td_par->get_shared_proc_list()->reset(); m_sharedProcs.clean_out(); for (int i = 0; i < size; i++) { m_sharedProcs.append(td_par->get_shared_proc_list()->get_and_step()); } size = td_par->get_ghost_proc_list()->size(); td_par->get_ghost_proc_list()->reset(); m_ghostProcs.clean_out(); for (int i = 0; i < size; i++) { m_ghostProcs.append(td_par->get_ghost_proc_list()->get_and_step()); } if (delete_attrib() == CUBIT_TRUE) delete_attrib(CUBIT_FALSE); } return CUBIT_SUCCESS; }
CubitStatus CAUniqueId::update() { if (hasUpdated) return CUBIT_SUCCESS; // set the updated flag hasUpdated = CUBIT_TRUE; // if the owner has a unique id, save it, otherwise delete this one TDUniqueId *td_uid = (TDUniqueId *) attrib_owner()->get_TD(&TDUniqueId::is_unique_id); if (NULL == td_uid && autoUniqueId) td_uid = new TDUniqueId(attrib_owner()); if (td_uid == NULL) { delete_attrib(CUBIT_TRUE); } else { uniqueId = td_uid->unique_id(); if (delete_attrib() == CUBIT_TRUE) delete_attrib(CUBIT_FALSE); } return CUBIT_SUCCESS; }
CubitStatus CABodies::actuate() { CubitStatus status = CUBIT_SUCCESS; if (hasActuated == CUBIT_TRUE) return CUBIT_SUCCESS; if (DEBUG_FLAG(138)) { PRINT_DEBUG_138( "Actuating BODIES attribute for %s %d\n", attribOwnerEntity->class_name(), attribOwnerEntity->id()); } // create a TDParallel for the entity, if it doesn't already exist TDParallel *par = (TDParallel *) attrib_owner()->get_TD(&TDParallel::is_parallel); if (par != NULL) { if (par->is_interface() != m_interface) { PRINT_ERROR("TDParallel interface check is failed for %s %d.\n", attrib_owner()->class_name(), attrib_owner()->id()); return CUBIT_FAILURE; } // check to make sure it's the same body list par->get_shared_body_list()->reset(); m_sharedBodies.reset(); int size = par->get_shared_body_list()->size(); for (int i = 0; i < size; i++) { if (par->get_shared_body_list()->get_and_step() != m_sharedBodies.get_and_step()) { PRINT_ERROR("Different body found for %s %d.\n", attrib_owner()->class_name(), attrib_owner()->id()); return CUBIT_FAILURE; } } par->get_shared_proc_list()->reset(); m_sharedProcs.reset(); size = par->get_shared_proc_list()->size(); for (int i = 0; i < size; i++) { if (par->get_shared_proc_list()->get_and_step() != m_sharedProcs.get_and_step()) { PRINT_ERROR("Different processor found for %s %d.\n", attrib_owner()->class_name(), attrib_owner()->id()); return CUBIT_FAILURE; } } par->get_ghost_proc_list()->reset(); m_ghostProcs.reset(); size = par->get_ghost_proc_list()->size(); for (int i = 0; i < size; i++) { if (par->get_ghost_proc_list()->get_and_step() != m_ghostProcs.get_and_step()) { PRINT_ERROR("Different ghost processor found for %s %d.\n", attrib_owner()->class_name(), attrib_owner()->id()); return CUBIT_FAILURE; } } if ((int)par->get_unique_id() != m_uniqueID) { PRINT_ERROR("Different unique ID found for %s %d.\n", attrib_owner()->class_name(), attrib_owner()->id()); return CUBIT_FAILURE; } } else { // else make a new one par = new TDParallel(attrib_owner(), &m_sharedBodies, &m_sharedProcs, &m_ghostProcs, m_uniqueID, m_interface); } delete_attrib(CUBIT_TRUE); hasActuated = CUBIT_TRUE; return status; }