void icetDestroyContext(IceTContext context) { IceTContext saved_current_context; saved_current_context = icetGetContext(); if (context == saved_current_context) { icetRaiseDebug("Destroying current context."); saved_current_context = NULL; } /* Temporarily make the context to be destroyed current. */ icetSetContext(context); /* Call destructors for other dependent units. */ callDestructor(ICET_RENDER_LAYER_DESTRUCTOR); /* From here on out be careful. We are invalidating the context. */ context->magic_number = 0; icetStateDestroy(context->state); context->state = NULL; context->communicator->Destroy(context->communicator); /* The context is now completely destroyed and now null. Restore saved context. */ icetSetContext(saved_current_context); }
IceTContext icetCreateContext(IceTCommunicator comm) { int idx; for (idx = 0; idx < num_contexts; idx++) { if (context_list[idx].state == NULL) { break; } } if (idx >= num_contexts) { num_contexts += 4; context_list = realloc(context_list, num_contexts*sizeof(struct IceTContext)); memset(context_list + idx, 0, 4 * sizeof(struct IceTContext)); } context_list[idx].communicator = comm->Duplicate(comm); context_list[idx].buffer = NULL; context_list[idx].buffer_size = 0; context_list[idx].buffer_offset = 0; context_list[idx].display_inflate_texture = 0; context_list[idx].state = icetStateCreate(); icetSetContext(idx); icetStateSetDefaults(); return idx; }
IceTContext icetCreateContext(IceTCommunicator comm) { IceTContext context = malloc(sizeof(struct IceTContextStruct)); context->magic_number = CONTEXT_MAGIC_NUMBER; context->communicator = comm->Duplicate(comm); context->state = icetStateCreate(); icetSetContext(context); icetStateSetDefaults(); return context; }
// **************************************************************************** // Method: IceTNetworkManager default constructor // // Programmer: Tom Fogal // Creation: June 17, 2008 // // Modifications: // // Tom Fogal, Wed May 18 11:57:34 MDT 2011 // Initialize 'renderings'. // // **************************************************************************** IceTNetworkManager::IceTNetworkManager(void): NetworkManager(), renderings(0) { this->comm = icetCreateMPICommunicator(VISIT_MPI_COMM); DEBUG_ONLY(ICET_CHECK_ERROR); this->context = icetCreateContext(comm); DEBUG_ONLY(ICET_CHECK_ERROR); ICET(icetSetContext(this->context)); DEBUG_ONLY(ICET(icetDiagnostics(ICET_DIAG_FULL))); ICET(icetStrategy(ICET_STRATEGY_REDUCE)); ICET(icetDrawFunc(render)); ICET(icetDisable(ICET_DISPLAY)); ICET(icetInputOutputBuffers( ICET_COLOR_BUFFER_BIT | ICET_DEPTH_BUFFER_BIT, /* inputs */ ICET_COLOR_BUFFER_BIT | ICET_DEPTH_BUFFER_BIT /* outputs */ )); DEBUG_ONLY(PR_ICET_MPI); }