void InspectorClientImpl::remoteObjectUpdated(modb::class_id_t class_id, const modb::URI& uri) { if (!followRefs) return; try { StoreClient& client = db.getReadOnlyStoreClient(); boost::shared_ptr<const ObjectInstance> oi = client.get(class_id, uri); const ClassInfo& ci = db.getClassInfo(class_id); BOOST_FOREACH(const ClassInfo::property_map_t::value_type& p, ci.getProperties()) { if (p.second.getType() == PropertyInfo::REFERENCE) { if (p.second.getCardinality() == PropertyInfo::SCALAR) { if (oi->isSet(p.first, PropertyInfo::REFERENCE, PropertyInfo::SCALAR)) { modb::reference_t ref = oi->getReference(p.first); addQuery(getRefSubj(db, ref), ref.second); } } else { size_t c = oi->getReferenceSize(p.first); for (size_t i = 0; i < c; ++i) { modb::reference_t ref = oi->getReference(p.first, i); addQuery(getRefSubj(db, ref), ref.second); } } } } executeCommands(); } catch (std::out_of_range e) {} }
unsigned int assertTimers(void *handle) { unsigned short commandCount = 2; redisReply *reply; void *rulesBinding; unsigned int result = peekTimers(handle, &rulesBinding, &reply); if (result != RULES_OK) { return result; } result = prepareCommands(rulesBinding); if (result != RULES_OK) { freeReplyObject(reply); return result; } for (unsigned long i = 0; i < reply->elements; ++i) { result = removeTimer(rulesBinding, reply->element[i]->str); if (result != RULES_OK) { freeReplyObject(reply); return result; } ++commandCount; result = handleEvent(handle, reply->element[i]->str, &rulesBinding, ACTION_ASSERT_TIMER, &commandCount); if (result != RULES_OK && result != ERR_EVENT_NOT_HANDLED) { freeReplyObject(reply); return result; } } result = executeCommands(rulesBinding, commandCount); freeReplyObject(reply); return result; }
void Manager::submitState(const LedState &_state) { m_state = _state; m_commands.clear(); m_commands << SetLedState << SetLedColor << SetLedRate; executeCommands(); }
// sqlci run with input coming in as a parameter. void SqlciEnv::runWithInputString(char * input_string) { // This function is called during the initialization phase of MXCI // (SqlciEnv_prologue_to_run). Use specialERROR_ as a flag indicating that // the querry being executed is invoke during MXCI's initialization phase and // that any errors will be fatal. Should an error occur, exit MXCI. SqlciEnv_prologue_to_run(this); SqlCmd::executeQuery("SET SESSION DEFAULT SQL_SESSION 'BEGIN';", this); // Initialize lifetime objects InputStmt * input_stmt; Int32 retval; void (*intHandler_addr) (Int32); intHandler_addr = interruptHandler; InputStmt dummyIS(this); input_stmt = new InputStmt(&dummyIS, input_string); retval = executeCommands(input_stmt); if (retval == 0) { } DeleteCriticalSection(&g_CriticalSection); DeleteCriticalSection(&g_InterruptCriticalSection); cleanupSockets(); }
// sqlci run with input coming in at SQLCI prompt void SqlciEnv::run() { // This function is called during the initialization phase of MXCI // (SqlciEnv_prologue_to_run). Use specialERROR_ as a flag indicating that // the querry being executed is invoke during MXCI's initialization phase and // that any errors will be fatal. Should an error occur, exit MXCI. SqlciEnv_prologue_to_run(this); // tell CLI that this user session has started. SqlCmd::executeQuery("SET SESSION DEFAULT SQL_SESSION 'BEGIN';", this); // Initialize lifetime objects InputStmt * input_stmt = NULL; Int32 retval; void (*intHandler_addr) (Int32); intHandler_addr = interruptHandler; do { retval = executeCommands(input_stmt); } while (retval != 0); DeleteCriticalSection(&g_CriticalSection); DeleteCriticalSection(&g_InterruptCriticalSection); cleanupSockets(); }
void gep::Renderer::render() { m_pFontBuffer->getData().resize(0); m_pFontBuffer->getIndices().resize(0); m_pLinesBuffer->getData().resize(0); m_pLines2DBuffer->getData().resize(0); { auto& extractor = *static_cast<RendererExtractor*>(g_globalManager.getRendererExtractor()); CommandBase* firstCommand = extractor.startReadCommands(); SCOPE_EXIT { extractor.endReadCommands(); }); prepareCommands(extractor, firstCommand); m_pFontBuffer->upload(m_pDeviceContext); m_pLinesBuffer->upload(m_pDeviceContext); m_pLines2DBuffer->upload(m_pDeviceContext); m_fontScreenSize.set(vec2((float)m_settings.screenResolution.x, (float)m_settings.screenResolution.y)); m_textBillboardScreenSize.set(vec2((float)m_settings.screenResolution.x, (float)m_settings.screenResolution.y)); m_lines2DScreenSize.set(vec2((float)m_settings.screenResolution.x, (float)m_settings.screenResolution.y)); // Just clear the backbuffer auto clearColor = m_settings.clearColor; m_pDeviceContext->ClearRenderTargetView( m_pRenderTargetView, clearColor.data ); m_pDeviceContext->ClearDepthStencilView( m_pDepthStencilView, D3D11_CLEAR_DEPTH, 1.0, 0 ); executeCommands(extractor, firstCommand); execute2DCommands(extractor, firstCommand); }
void CommandQueue::waitCycle() { if (lockQueue()) { executeCommands(); unlockQueue(); } }
// main function int main(int argc, char* argv[]) { // read lines from standard input char** lines = readLines(); // execute each command on the command line executeCommands(lines, map, argv+1); // exit with "success" return EXIT_SUCCESS; }
unsigned int completeAction(void *handle, void *actionHandle, char *session) { unsigned short commandCount = 4; actionContext *context = (actionContext*)actionHandle; redisReply *reply = context->reply; void *rulesBinding = context->rulesBinding; unsigned int result = prepareCommands(rulesBinding); if (result != RULES_OK) { freeReplyObject(reply); free(actionHandle); return result; } result = removeAction(rulesBinding, reply->element[0]->str); if (result != RULES_OK) { freeReplyObject(reply); free(actionHandle); return result; } if (reply->element[2]->type != REDIS_REPLY_NIL) { result = handleSession(handle, reply->element[2]->str, rulesBinding, ACTION_NEGATE_SESSION, &commandCount, 0); if (result != RULES_OK && result != ERR_EVENT_NOT_HANDLED) { freeReplyObject(reply); free(actionHandle); return result; } } for (unsigned long i = 4; i < reply->elements; i = i + 2) { if (strcmp(reply->element[i]->str, "null") != 0) { result = handleEvent(handle, reply->element[i]->str, &rulesBinding, ACTION_NEGATE_MESSAGE, &commandCount); if (result != RULES_OK) { freeReplyObject(reply); free(actionHandle); return result; } } } result = handleSession(handle, session, rulesBinding, ACTION_ASSERT_SESSION, &commandCount, 1); if (result != RULES_OK && result != ERR_EVENT_NOT_HANDLED) { freeReplyObject(reply); free(actionHandle); return result; } result = executeCommands(rulesBinding, commandCount); freeReplyObject(reply); free(actionHandle); return result; }
void Manager::readFromSocket() { QDataStream in(m_tcpSocket); in.setVersion(QDataStream::Qt_4_0); QString response; in >> response; Q_EMIT message(tr("Response received: ") + response); Protocol protocol; bool ok = false; bool result = protocol.str2Response(response, m_currentCommand, &ok); if(!ok) { Q_EMIT message("Failed to parse response."); } else if(!result) { Q_EMIT message("Device cannot execute request."); } else { switch(m_currentCommand) { case SetLedState: case SetLedColor: case SetLedRate: { Q_EMIT message("Device has changed it's state successful."); break; } case GetLedState: { Q_EMIT message("Device state received successful."); m_state.on = protocol.on(); Q_EMIT stateChanged(); break; } case GetLedColor: { Q_EMIT message("Device color received successful."); m_state.color = protocol.color(); Q_EMIT stateChanged(); break; } case GetLedRate: { Q_EMIT message("Device rate received successful."); m_state.rate = protocol.rate(); Q_EMIT stateChanged(); break; } default: { break; } } } executeCommands(); }
VMRequest * VMGahp::preExecuteCommand(const char* cmd, Gahp_Args *args) { char *command = args->argv[0]; vmprintf(D_FULLDEBUG, "Command: %s\n", command); // Special commands first if(strcasecmp(command, VMGAHP_COMMAND_ASYNC_MODE_ON) == 0 ) { m_async_mode = true; m_new_results_signaled = false; returnOutputSuccess(); } else if(strcasecmp(command, VMGAHP_COMMAND_ASYNC_MODE_OFF) == 0 ) { m_async_mode = false; returnOutputSuccess(); } else if(strcasecmp(command, VMGAHP_COMMAND_QUIT) == 0 ) { executeQuit(); } else if(strcasecmp(command, VMGAHP_COMMAND_VERSION) == 0 ) { executeVersion(); } else if(strcasecmp(command, VMGAHP_COMMAND_COMMANDS) == 0 ) { executeCommands(); } else if(strcasecmp(command, VMGAHP_COMMAND_SUPPORT_VMS) == 0 ) { executeSupportVMS(); } else if(strcasecmp(command, VMGAHP_COMMAND_RESULTS) == 0 ) { executeResults(); } else if(strcasecmp(command, VMGAHP_COMMAND_CLASSAD) == 0 ) { if( m_jobAd != NULL ) { delete m_jobAd; m_jobAd = NULL; } m_jobAd = new ClassAd; ASSERT(m_jobAd); m_inClassAd = true; returnOutputSuccess(); } else if(strcasecmp(command, VMGAHP_COMMAND_CLASSAD_END) == 0 ) { if( m_jobAd != NULL ) { delete m_jobAd; m_jobAd = NULL; } m_inClassAd = false; returnOutputSuccess(); } else { VMRequest *new_req; new_req = addNewRequest(cmd); returnOutputSuccess(); return new_req; } return NULL; }
bool executeExternalCommand(char * firstArg) { LinkedList<char *> * tokens = new LinkedList<char *>(firstArg); tokenizeString(tokens); if(!validateCommand(tokens)) return false; LinkedList<Command *> * commands = new LinkedList<Command *>(); if(!buildCommands(tokens, commands)) return false; if(!executeCommands(commands)) return false; delete tokens; return true; }
int main(int argc, char *argv[]) { int largc; char **largv; osInit(); subsumeImplicitArgs(argc, argv, &largc, &largv); initState(argv[0]); uclSysName = getCfgName(largc, largv); uclOptFile = getCfgFile(largc, largv); if (!uclOptFile) exit(2); loadConfiguration(); handleOptions(largc, largv); if (!setupState()) exit(2); if (dbgLevel > 2) { int i; printf("Command:"); for (i=0; i<largc; i++) { printf(" %s", largv[i]); } printf("\n"); } generateCommands(); if (!executeCommands()) exit(1); exit(0); /* gack */ return 0; }
bool ScriptParser::executeCommand(QString command) { // if empty if(command.isEmpty()) return true; // if several commands QStringList commands = command.split(";",QString::SkipEmptyParts); if(commands.size()>1) return executeCommands(commands); // apply one command QRegExp regExp("([\\S]+)\\((.*)\\)"); command.indexOf(regExp); if(regExp.capturedTexts().size()!=3) { InfoSender::instance()->sendWarning("Unable to parse command: "+command); return false; } QString function = regExp.cap(1); QString arg = regExp.cap(2); QStringList args = arg.split(",",QString::SkipEmptyParts); bool foundFunction; InfoSender::instance()->send(Info(command,ListInfo::SCRIPT)); bool result = launchFunction(function,args,foundFunction); if(result) InfoSender::instance()->send(Info("Ok",ListInfo::SCRIPT)); else InfoSender::instance()->send(Info("Error",ListInfo::SCRIPT)); return result; }
void PlayDrillCommandClass::execute() { if (IsExecuting()) { LOGF("SKIPPING PlayDrill command"); return; } parse(); LogSteps(); StopCommandClass::reset(); PauseCommandClass::reset(); resetInterruptCounter(); LOGF("=========== Initializing Bumper =========="); bumperOn(true/*resetCounter*/); LOGF("=========== Play Drill =========="); s_pExecutedDrill = this; bool bContinue= true; char pref[10]; while (true) { // handle incoming commands executeCommands(); if (StopCommandClass::IsStopped()) { m_execData.error= false; m_execData.feedData.result=MotorHelperClass::FR_NONE; break; } else if (PauseCommandClass::IsPaused()) { static unsigned long s_LedSetTime= 0; static bool s_yellowLed= false; unsigned long currentTime= millis(); if (currentTime - s_LedSetTime >= 250) { if (s_yellowLed) { Helper::setLedColor(0,0,255); // turn the RGB LED blue } else { Helper::setLedColor(255,215,0); // turn the RGB LED yellow } s_LedSetTime= currentTime; s_yellowLed= !s_yellowLed; } g_motorHelper.stopMotorsIfIdle(); } else { Step* pStep= NULL; for (int stepIndex= 0; stepIndex < m_Steps.getUsedElems(); ++stepIndex) { if (m_execData.nextStepIndex > 0) { // goto stepIndex= m_execData.nextStepIndex - 1; // 1-based m_execData.nextStepIndex= -1; } pStep= m_Steps[stepIndex]; LOGF3("============ Executing Step [", stepIndex+1, F("] ============")); bContinue= pStep->execute(m_execData); // handle incoming commands executeCommands(); if (StopCommandClass::IsStopped()) { m_execData.error= false; m_execData.feedData.result=MotorHelperClass::FR_NONE; bContinue= false; } else if (PauseCommandClass::IsPaused()) { g_motorHelper.stopMotorsIfIdle(); break; } if (!bContinue) break; g_TaskQueue.executeReadyTasks(); } if (!bContinue) break; } } // EOF while(true) g_motorHelper.stopMotors(); s_pExecutedDrill = NULL; bumperOff(); g_serialCom.fireEvent(EVENT_EXECUTE_STOPPED); // in case of error no sound if (!m_execData.error) { Helper::playSound(Helper::SND_FINISHED); } }
void Manager::updateState() { m_commands.clear(); m_commands << GetLedState << GetLedColor << GetLedRate; executeCommands(); }
int main(/*int argc, char** argv*/) { int argc = 4; char** argv = new char*[argc]; argv[1] = "--comments"; argv[2] = "Practice.cpp"; argv[3] = "--format"; size_t commandsSize = 0, filesSizes = 0; adjustSizes(argv, argc, commandsSize, filesSizes); Command** commands = new Command*[commandsSize]; File* files = new File [filesSizes]; size_t filePos = 0, commandPos = 0; for (int pos = 1; pos < argc; ++pos) { if (isPath(argv[pos])) { try { File currFile(argv[pos]); files[filePos++] = currFile; } catch (std::exception& e) { std::cerr << e.what() << std::endl; } } else if (isCommand(argv[pos])) { try { commands[commandPos++] = createCommand(argv[pos]); } catch (std::invalid_argument& i) { std::cerr << i.what() << std::endl; } } else std::cerr << "\n The " << pos << " command is invalid! \n"; } try { for (filePos = 0; filePos < filesSizes; ++filePos) executeCommands(files[filePos], commands, commandsSize); } catch (std::invalid_argument& i) { std::cerr << i.what() << std::endl; } catch (std::exception& e) { std::cerr << e.what() << std::endl; } clear(commands, commandsSize, files); delete[] argv; return 0; }
int Fenfloss::compute(const char *) { dprintf(1, "Fenfloss::compute\n"); int reattach = !strcmp(s_ConnectionMethod[p_ConnectionMethod->getValue()], "reattach"); if (reattach) { p_ConnectionMethod->setValue(0); stepNo = -1; } // Start: gettime int numElem; if (stepNo==0) { stepNo=1; return STOP_PIPELINE; } // Find out, whether we have to re-start sim use_boco2 = 0; coDoSet *grid = (coDoSet*) p_grid->getCurrentObject(); coDoSet *boco = (coDoSet*) p_boco->getCurrentObject(); coDoSet *boco2 = (coDoSet*) p_boco2->getCurrentObject(); if (reattach) d_distGridName = strdup(grid->getName()); // fl: debug grid->getAllElements(&numProc); dprintf(4, " Fenfloss::compute(const char *): grid: %s, %d\n", grid->getName(), numProc); if (grid) { dprintf(1, "Fenfloss::compute reset\n"); // we have a new grid input object const char *gridName = grid->getName(); if (strcmp(gridName,d_distGridName)!=0) { // sim currently running if (stepNo>=0) { #ifndef WIN32 //system("killall -KILL p_flow_4.8.2"); sleep(5); #endif resetSimLib(); stepNo=-1; } delete [] d_distGridName; d_distGridName = strcpy ( new char[strlen(gridName)+1] , gridName ); } } if ( (boco) && (!boco2) ) { // first run! using boco bc object sendInfo("no boco2 object, using boco object"); } if ( (boco) && (boco2) ) { // data on both boco-ports! const char *bocoName = boco->getName(); // check if there is new data from domain decomposition if ( strcmp(bocoName,d_distBocoName)!=0 ) { // no new data from domain decomposition sendInfo("simulation coupling! using boco2 bc object"); use_boco2 = 1; } else { // new data from domain decomposition sendInfo("new data from domain decomposition ..."); } } coDoPolygons *poly_in, *poly_out = NULL; int NumberOfPoints; int NumberOfVertices, NumberOfPolygons; float *inx_coord, *iny_coord, *inz_coord; int *invertices, *inpolygons; static int grid_size; // correct size of data arrays for visualization const coDistributedObject *const *gridArr = grid->getAllElements(&numProc); const coDistributedObject *const *bocoArr; const coDistributedObject *const **procGrid; const coDistributedObject *const **procBoco = 0; const coDoIntArr *gridDim; const coDoIntArr *bocoDim; if (stepNo<0) { //const char *dir; printf("Fenfloss::compute stepno < 0\n"); // get target directory //dir = p_dir->getValue(); // CHECK TYPES .. later if (!grid || !boco) { sendError("Data not received"); return FAIL; } if (!boco2) bocoArr = boco->getAllElements(&numProc); else bocoArr = boco2->getAllElements(&numProc); #ifndef DUMMY /////////////////////////////////////////////////////////////////////// // start simulation dprintf(0, "------------------starting simulation-------------------\n"); PrepareSimStart(numProc); if (startSim(reattach)) return -1; stepNo=0; #endif if (!reattach) { dprintf(2,"sending parameters ...\n"); int32 command; do { recvBS_Data(&command, sizeof(command)); char name[128]; dprintf(4,"command: %d\n",command); switch (command) { case GET_SC_PARA_FLO: case GET_V3_PARA_FLO: case GET_SC_PARA_INT: case GET_BOOL_PARA: case GET_TEXT_PARA: if (recvData((void*) name, 64) != 64) dprintf(0, "error in initial parameters\n"); break; case GET_INITIAL_PARA_DONE: break; default: dprintf(0, "error: unsupported parameter in initialization\n"); break; } switch (command) { case GET_SC_PARA_FLO: { coFloatParam *param = dynamic_cast<coFloatParam *>(findElem(name)); struct { float val ; int32 error; } ret = {0.0,0}; if (param) ret.val = param->getValue(); else if (!findAttribute(grid, name, "%f", (void *) &ret.val)) ret.error = -1; dprintf(4, "sending %f %d\n", ret.val, ret.error); sendBS_Data((void*) &ret, sizeof(ret)); break; } case GET_V3_PARA_FLO: { coFloatVectorParam *param = dynamic_cast<coFloatVectorParam *>(findElem(name)); struct { float val[3] ; int32 error; } ret; ret.error = 0; if (param) for(int i=0; i<3; i++) { ret.val[i] = param->getValue(i); dprintf(4,"param[%d]=%f\n",i,ret.val[i]); } else ret.error = -1; dprintf(4, "sending %f %d\n", ret.val[0], ret.error); sendBS_Data((void*) &ret, sizeof(ret)); break; } case GET_SC_PARA_INT: case GET_BOOL_PARA: { int val = 0; int error = 0; if (command == GET_SC_PARA_INT) { coIntScalarParam *param = dynamic_cast<coIntScalarParam *>(findElem(name)); if (param) val = param->getValue(); else if (!findAttribute(grid, name, "%d", (void *) &val)) error = -1; } else if (command == GET_BOOL_PARA) { coBooleanParam *param = dynamic_cast<coBooleanParam *>(findElem(name)); if (param) val = param->getValue(); else if (!findAttribute(grid, name, "%d", (void *) &val)) error = -1; } struct { int val; int32 error; } ret; ret.val = val; ret.error = error; dprintf(4, "sending int para %d %d\n", ret.val, ret.error); sendBS_Data((void*) &ret, sizeof(ret)); break; } case GET_TEXT_PARA: { coStringParam *param = dynamic_cast<coStringParam *>(findElem(name)); char res[256]; memset(res, 0, 256); if (param) { const char *val = param->getValue(); if (val) strncpy(res, val, 255); } else findAttribute(grid, name, "%s", (void *) res); sendData(res, 256); break; } default: break; } } while (command != GET_INITIAL_PARA_DONE); dprintf(2,"sending parameters ... done!\n"); } /////////////////////////////////////////////////////////////////////// // send dimensions int *idata,size=0; int i,j; procGrid = new const coDistributedObject *const*[numProc]; procBoco = new const coDistributedObject *const*[numProc]; for (i = 0; i < numProc; i++) { procGrid[i] = ((const coDoSet*)gridArr[i])->getAllElements(&numElem); gridDim = (coDoIntArr *) procGrid[i][0]; idata = gridDim->getAddress(); size = gridDim->getDimension(0) * sizeof(int); dprintf(1, "Fenfloss-Mod(%d): Compute(): Sending grid %d \n", __LINE__, size); dprintf(1, " sending %d %d %d %d\n", idata[0], idata[1], idata[2], idata[3]); if (!reattach) { struct commandMsg data = { GEO_DIM, size }; sendBS_Data(&data, sizeof(data)); if (size) sendBS_Data(idata,size); } } for (i = 0; i < numProc; i++) { procBoco[i] = ((const coDoSet*)bocoArr[i])->getAllElements(&numElem); bocoDim = (const coDoIntArr *) procBoco[i][0]; idata = bocoDim->getAddress(); size = bocoDim->getDimension(0) * sizeof(int); dprintf(2, "Fenfloss-Mod(%d): Compute(): Sending bc %d \n", __LINE__, size); if (!reattach) { struct commandMsg data = { BOCO_DIM, size }; sendBS_Data(&data, sizeof(data)); if (size) sendBS_Data(idata,size); } } /////////////////////////////////////////////////////////////////////// // send grids float *fdata; for (i = 0; i < numProc; i++) { coDoFloat *floatArr = (coDoFloat *) procGrid[i][1]; floatArr->getAddress(&fdata); size = floatArr->getNumPoints() * sizeof(float); if (size) { dprintf(1, "FenFloss-Mod(%d) GRID: Sending (cpu=%d), size = %d Bytes\n", __LINE__, i, size); if (!reattach) { struct { int command; int size; } data = { SEND_GEO, size }; sendBS_Data(&data, sizeof(data)); sendBS_Data(fdata,size); } } #ifdef DUMMY else testfile << " --- ignored one field" << endl; #endif // M. Becker: flow generates additional nodes // if we want to be sure that data and grid-arrays have the same length, // we have to shorten the data arrays (at the end of ::compute)! if (i == 0) { coDoIntArr *intArr = (coDoIntArr *) procGrid[i][0]; idata = intArr->getAddress(); grid_size = idata[1]; dprintf(1, "*************************** grid_size: %d\n", grid_size); } for (j = 2; j < 11; j++) { coDoIntArr *intArr = (coDoIntArr *) procGrid[i][j]; idata = intArr->getAddress(); size = intArr->getDimension(0) * sizeof(int); if (size) { dprintf(1, "FenFloss-Mod(%d) GRID: Sending (cpu=%d, j=%d), size = %d Bytes\n", __LINE__, i, j, size); dprintf(4," idata[0] = %d, idata[1] = %d, idata[2] = %d\n", idata[0], idata[1], idata[2]); if (!reattach) { sendBS_Data(idata,size); } } #ifdef DUMMY else testfile << " --- ignored one field" << endl; #endif } } /////////////////////////////////////////////////////////////////////// // send boco for (i = 0; i < numProc; i++) { if (!reattach) { struct { int command; int size; } data = { SEND_BOCO, size }; sendBS_Data(&data, sizeof(data)); } for (j = 1; j < 12; j++) { coDoIntArr *intArr = (coDoIntArr *) procBoco[i][j]; idata = intArr->getAddress(); size = intArr->getDimension(0) * sizeof(int); if (size) { // debug, fl: for(int k = 0; k < size/4; k++) { dprintf(3,"send boco(%2d,%2d): %8d\n",i,j,idata[k]); } dprintf(2, "FenFloss-Mod(%d) BC: Sending (cpu=%d, j=%d), size = %d Bytes\n", __LINE__, i, j, size); if (!reattach) { sendBS_Data(idata,size); } } #ifdef DUMMY else testfile << " --- ignored one field" << endl; #endif } for (j = 12; j < 13; j++) // displ_wert { sendInfo("Sending RB-Data ..."); coDoFloat *floatArr = (coDoFloat *) procBoco[i][j]; floatArr->getAddress(&fdata); size = floatArr->getNumPoints() * sizeof(float); if (size) { dprintf(2, "FenFloss-Mod(%d) BC: Sending (cpu=%d, j=%d), size = %d Bytes\n", __LINE__, i, j, size); if (!reattach) { sendBS_Data(fdata,size); } /*<tmp> if(j == 13) { sendInfo("Writing Diplacement-Data to file ..."); ofstream ofs("displwerte.debug"); for(int ji(0); ji<size; ji+=6) { ofs << fdata[ji] << " " << fdata[ji+1] << " " << fdata[ji+2] << " " << fdata[ji+3] << " " << fdata[ji+4] << " " << fdata[ji+5] << endl; } ofs.close(); } </tmp>*/ } #ifdef DUMMY else testfile << "--- ignored one field" << endl; #endif } } } /* endif(stepno < 0) */ #ifndef YAC executeCommands(); #endif numbc = 0; for (int j = 0; j < numbc && bcrad; j++) dprintf(4, "j=%d: bcrad=%f, bcvu=%f, bcvm=%f\n", j, bcrad[j], bcvu[j], bcvm[j]); if (use_boco2) { // use boco2 object (from Flowmid module)! bocoArr = boco2->getAllElements(&numProc); if (!boco2_num_int) { boco2_num_int = new int[numProc]; boco2_idata = new int*[numProc]; } // size for (int i = 0; i < numProc; i++) { if (boco2_idata[i]) delete [] boco2_idata[i]; procBoco[i] = ((coDoSet*)bocoArr[i])->getAllElements(&numElem); bocoDim = (coDoIntArr *) procBoco[i][0]; boco2_num_int[i] = bocoDim->getDimension(0); boco2_idata[i] = new int[boco2_num_int[i]]; memcpy(boco2_idata[i], bocoDim->getAddress(), boco2_num_int[i] * sizeof(int)); } if (!boco2_num_float) { boco2_num_float = new int[numProc]; boco2_fdata = new float*[numProc]; } ofstream debugfile; debugfile.open("boco2_bcin_data.txt"); // data for (int i=0;i<numProc;i++) { float *address; procBoco[i] = ((coDoSet*)bocoArr[i])->getAllElements(&numElem); coDoFloat *floatArr = (coDoFloat *) procBoco[i][13]; // displ_wert if (boco2_fdata[i]) delete [] boco2_fdata[i]; boco2_num_float[i] = floatArr->getNumPoints(); boco2_fdata[i] = new float[2 * boco2_num_float[i]]; // |displ_wert| == |pres_wert| ? floatArr->getAddress(&address); memcpy(boco2_fdata[i], address, boco2_num_float[i] * sizeof(float)); floatArr = (coDoFloat *) procBoco[i][14]; // pres_wert floatArr->getAddress(&address); memcpy(boco2_fdata[i] + boco2_num_float[i], address, boco2_num_float[i] * sizeof(float)); } /* for (int j=13;j<15;j++) // displ_wert, pres_wert { coDoFloat *floatArr = (coDoFloat *) procBoco[i][j]; floatArr->getAddress(&fdata); size = floatArr->getNumPoints() * sizeof(float); if (size) { printf("FenFloss-Mod(%d) BC: Sending (cpu=%d, j=%d), size = %d Bytes\n", __LINE__, i, j, size); sendBS_Data(fdata,size); } if (j==13) for (int k=0; k<size/4; k+=6) { debugfile << k/6 << " " << fdata[k] << " " << fdata[k+1] << " " << fdata[k+2] << " " << fdata[k+3] << " " << fdata[k+4] << " " << fdata[k+5] << endl; } debugfile.close(); #ifdef DUMMY else testfile << " --- ignored one field" << endl; #endif } } */ } ////////////////////////////// // we had to add to the spot point data, the description for // CollectTimeSteps and the Plot module // the output port for the VR Plugin poly_in = (coDoPolygons *)p_in_bcin->getCurrentObject(); if (poly_in) { NumberOfPoints = poly_in->getNumPoints(); NumberOfVertices = poly_in->getNumVertices(); NumberOfPolygons = poly_in->getNumPolygons(); poly_in->getAddresses(&inx_coord, &iny_coord, &inz_coord, &invertices, &inpolygons); poly_out = new coDoPolygons(p_out_bcin->getObjName(), NumberOfPoints, inx_coord, iny_coord, inz_coord, NumberOfVertices, invertices, NumberOfPolygons, inpolygons); poly_out->addAttribute("vertexOrder","1"); poly_out->addAttribute("COLOR","red"); p_out_bcin->setCurrentObject(poly_out); } #ifndef YAC coFeedback feedback("FenflossPlugin"); feedback.addPara(p_updateInterval); feedback.addPara(p_pauseSim); feedback.addPara(p_GetSimData); feedback.addPara(p_detachSim); feedback.addPara(p_useInitial); feedback.addPara(p_stopSim); if (poly_in) feedback.apply(poly_out); #endif // Flow knows now, that it has to send new simulation data if (p_GetSimData->getValue()) p_GetSimData->setValue(0); // push off button /* if (p_stopSim->getValue()) p_stopSim->setValue(0); // push off button */ // M. Becker 17.6.2002 // resize data arrays to fit with original created grid for visualization if (p_velocity->getCurrentObject()) // do this only if there is an object! { coDoVec3 *velo = (coDoVec3 *)p_velocity->getCurrentObject(); velo->setSize(grid_size); coDoFloat *press = (coDoFloat *)p_press->getCurrentObject(); press->setSize(grid_size); if (p_turb->getCurrentObject()) { coDoFloat *turb = (coDoFloat *)p_turb->getCurrentObject(); turb->setSize(grid_size); } } if (!p_velocity->getCurrentObject()) return STOP_PIPELINE; else return CONTINUE_PIPELINE; }