void HeightmapDialog::compile() { QString working_directory = QDir::currentPath(); QProcess process(this); QStringList args; generateInputFile(); args << "--compile-heightmap" << inputFilename() << outputFilename(); process.setWorkingDirectory(working_directory); #ifdef _WIN32 QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert("Path", "..\\Panda3D-1.9.0\\bin;" + env.value("Path")); process.setProcessEnvironment(env); process.start("./game.exe", args); #else process.start("./game", args); #endif if (process.waitForFinished()) { if (process.exitCode() == 0) emit heightmapCreated(outputFilename()); else QMessageBox::warning(this, "Error", "The heightmap compiling failed."); } else QMessageBox::warning(this, "Error", "The heightmap compiling failed to start."); }
std::string FileHandler::getOutputFilename(const std::string& inputFilename) { std::string outputFilename(inputFilename); replaceSubstring(outputFilename, m_inputPrefix, m_outputPrefix); replaceSubstring(outputFilename, m_inputSuffix, m_outputSuffix); return outputFilename; }
//----------------------------------------------------------------------------- // Function : TimeTecplot::doOutputTime // Purpose : // Special Notes : // Scope : // Creator : David Baur, Raytheon // Creation Date : //----------------------------------------------------------------------------- void TimeTecplot::doOutputTime( Parallel::Machine comm, const N_LAS_Vector & solnVecPtr, const N_LAS_Vector & stateVecPtr, const N_LAS_Vector & storeVecPtr) { if (Parallel::rank(comm) == 0 && !os_) { outFilename_ = outputFilename(printParameters_.filename_, printParameters_.defaultExtension_, printParameters_.suffix_, outputManager_.getNetListFilename()); os_ = outputManager_.openFile(outFilename_); os_->setf(std::ios::scientific); os_->precision(printParameters_.streamPrecision_); os_->setf(std::ios::left, std::ios::adjustfield); } if (os_ && index_ == 0) tecplotTimeHeader(*os_, currentStep_ == 0, outputManager_.getNetListFilename() + " - " + outputManager_.getTitle(), opList_, outputManager_); for (Util::Op::OpList::const_iterator it = opList_.begin() ; it != opList_.end(); ++it) { double result = getValue(comm, *(*it), Util::Op::OpData(0, &solnVecPtr, 0, &stateVecPtr, &storeVecPtr, 0)).real(); result = filter(result, printParameters_.filter_); if ((*it)->id() == Util::Op::identifier<OutputMgrTimeOp>()) result *= printParameters_.outputTimeScaleFactor_; if (os_) (*os_) << std::setw(printParameters_.streamWidth_) << result << " "; } if (os_) (*os_) << std::endl; ++index_; }
int main(int argc, char *argv[]) { QApplication app(argc, argv); qDebug( " Syntax: pntdel [-i pnt-sourcefile -o pnt-targetfile -id idNumber] " ); QString inputFilename("PDIFFBORDERS.PNT"); int inputIndex = app.arguments().indexOf("-i"); if (inputIndex > 0 && inputIndex + 1 < argc ) inputFilename = app.arguments().at( inputIndex + 1 ); QString outputFilename("NEW.PNT"); int outputIndex = app.arguments().indexOf("-o"); if (outputIndex > 0 && outputIndex + 1 < argc ) outputFilename = app.arguments().at( outputIndex + 1 ); int delIndex = -1; int idIndex = app.arguments().indexOf("-id"); if (idIndex > 0 && idIndex + 1 < argc ) delIndex = app.arguments().at( idIndex + 1 ).toInt(); qDebug() << "input filename:" << inputFilename; qDebug() << "output filename:" << outputFilename; qDebug() << "remove index:" << delIndex; // INPUT QFile file( inputFilename ); if ( file.open( QIODevice::ReadOnly ) ) { QDataStream stream( &file ); // read the data serialized from the file stream.setByteOrder( QDataStream::LittleEndian ); // OUTPUT QFile data(outputFilename); if (data.open(QFile::WriteOnly | QFile::Truncate)) { QDataStream out(&data); out.setByteOrder( QDataStream::LittleEndian ); short header; short iLat; short iLon; bool skip = false; while( !stream.atEnd() ){ stream >> header >> iLat >> iLon; if ( header == delIndex ) { skip = true; } else if ( header > 5 ) skip = false; if ( !skip ) out << header << iLat << iLon; } data.close(); }
void MyFrame::InterpolateMatrix(wxString dataDescription, ModalMatrix * inputModalMatrix) { wxFileDialog *dlg = new wxFileDialog(this, _T("Interpolate ") + dataDescription + _T(" to triangle mesh"), uiState.currentWorkingDirectory, _T(""), _T("Modal Matrix Files(*.U)|*.U|All files(*.*)|*.*"), wxFD_SAVE /*| wxHIDE_READONLY*/, wxDefaultPosition); if ( dlg->ShowModal() == wxID_OK ) { wxString outputFilename( dlg->GetPath() ); SaveCurrentWorkingDirectory(outputFilename); if( !outputFilename.empty() ) { SetCursor(*wxHOURGLASS_CURSOR); if (!precomputationState.interpolationDataAvailable) BuildInterpolant(); // interpolate printf("Interpolating data...\n"); double * inputMatrix = inputModalMatrix->GetMatrix(); int nTarget = (int)(precomputationState.renderingMesh->getNumVertices()); double * outputMatrix = (double*) malloc (sizeof(double) * 3 * nTarget * inputModalMatrix->Getr()); for(int i=0; i<inputModalMatrix->Getr(); i++) { precomputationState.simulationMesh->interpolate( &inputMatrix[ELT(3*precomputationState.simulationMesh->getNumVertices(),0,i)], &outputMatrix[ELT(3*nTarget,0,i)], nTarget, precomputationState.simulationMesh->getNumElementVertices(), precomputationState.interpolationData_vertices, precomputationState.interpolationData_weights); } // save file to disk const char * filename = outputFilename.mb_str(); printf("Saving output to %s.\n", (char*)filename); int code = WriteMatrixToDisk((char*)filename, 3 * nTarget, inputModalMatrix->Getr(), outputMatrix); free(outputMatrix); SetCursor(*wxSTANDARD_CURSOR); if (code != 0) { this->errMsg( _T("Saving error"), _T("Unable to save interpolated data to ") + outputFilename ); dlg->Destroy(); return; } } } dlg->Destroy(); }
//----------------------------------------------------------------------------- // Function : SensitivityTecPlot::doOutputSensitivity // Purpose : // Special Notes : // Scope : // Creator : Eric Keiter // Creation Date : //----------------------------------------------------------------------------- void SensitivityTecPlot::doOutputSensitivity( Parallel::Machine comm, const std::vector<double> & objective_values, const std::vector<double> & direct_values, const std::vector<double> & adjoint_values, const std::vector<double> & scaled_direct_values, const std::vector<double> & scaled_adjoint_values, const N_LAS_Vector & solution_vector, const N_LAS_Vector & state_vector, const N_LAS_Vector & store_vector) { double tmpTime = outputManager_.getCircuitTime(); // outputManager_.getAnaIntPtr()->getTime(); if (Parallel::rank(comm) == 0 && !os_) { outFilename_ = outputFilename(printParameters_.filename_, printParameters_.defaultExtension_, printParameters_.suffix_, outputManager_.getNetListFilename()); os_ = outputManager_.openFile(outFilename_); (*os_).setf(std::ios::left, std::ios::adjustfield); } if (os_ && index_ == 0) tecplotTimeHeader(*os_, currentStep_ == 0, outputManager_.getNetListFilename() + " - " + outputManager_.getTitle(), opList_, outputManager_); int column_index = 0; for (Util::Op::OpList::const_iterator it = opList_.begin(); it != opList_.end(); ++it, ++column_index) { double result = getValue(comm, *(*it), Util::Op::OpData(index_, &solution_vector, 0, &state_vector, &store_vector, 0, &objective_values, &direct_values, &scaled_direct_values, &adjoint_values, &scaled_adjoint_values)) .real(); result = filter(result, printParameters_.filter_); if ((*it)->id() == Util::Op::identifier<OutputMgrTimeOp>()) result *= printParameters_.outputTimeScaleFactor_; if (Parallel::rank(comm) == 0) printValue(*os_, printParameters_.table_.columnList_[column_index], printParameters_.delimiter_, column_index, result); } if (os_) { *os_ << std::endl; } ++index_; }
void Model::initItemStatus(ModelItem *item) { const QFileInfo fi(outputFilename(outputDir, item->id)); if (fi.exists()) { item->status = ModelItem::Finished; return; } if (item->vod_path.isEmpty()) { item->status = ModelItem::Error; return; } item->status = ModelItem::Ready; }
void MyFrame::OnSaveInterpolant(wxCommandEvent& event) { wxFileDialog * dlg = new wxFileDialog(this, _T("Save interpolant to file"), uiState.currentWorkingDirectory, _T(""), _T("Interpolant Text Files(*.interp)|*.interp|All files(*.*)|*.*"), wxFD_SAVE /*| wxHIDE_READONLY*/, wxDefaultPosition); if ( dlg->ShowModal() == wxID_OK ) { wxString outputFilename( dlg->GetPath() ); SaveCurrentWorkingDirectory(outputFilename); if( !outputFilename.empty() ) { SetCursor(*wxHOURGLASS_CURSOR); if (!precomputationState.interpolationDataAvailable) BuildInterpolant(); int nTarget = (int)(precomputationState.renderingMesh->getNumVertices()); const char * filename = outputFilename.mb_str(); int code = precomputationState.simulationMesh->saveInterpolationWeights ((char*)filename, nTarget, precomputationState.simulationMesh->getNumElementVertices(), precomputationState.interpolationData_vertices, precomputationState.interpolationData_weights); SetCursor(*wxSTANDARD_CURSOR); if (code != 0) { this->errMsg( _T("Saving error"), _T("Unable to save interpolated data to ") + outputFilename ); dlg->Destroy(); return; } } } dlg->Destroy(); }
void Model::startItemDownloading() { QVector<ModelItem>::iterator it = items.begin(); do { if (it == items.end()) { qDebug() << "FINISHED"; emit errorMessage("Finished"); return; } if ((it->status == ModelItem::Ready) ||(it->status == ModelItem::AuthFailed)) break; ++it; } while(true); qDebug() << "===== new reply"; if (reply) reply->deleteLater(); networkManager->clearAccessCache(); reply = networkManager->get(QNetworkRequest(QUrl(it->vod_path))); connect(reply, &QNetworkReply::downloadProgress, this, &Model::onDownloadProgress); connect(reply, &QNetworkReply::readyRead, this, &Model::onReadyRead); connect(reply, &QNetworkReply::finished, this, &Model::onReplyFinished); connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &Model::slotError); connect(reply, &QNetworkReply::sslErrors, this, &Model::slotSslErrors); outfile.setFileName(outputFilename(outputDir, it->id)); outfile.open(QIODevice::WriteOnly|QIODevice::Truncate); it->status = ModelItem::InProgress; emit dataChanged(index(itemsIndex,0), index(itemsIndex, columnCount() - 1)); }
int main(int argc, char* argv[]){ /* **************************************************************** * the first part looks exactly like in the last example. * ***************************************************************/ //first set up the random number generator RandomNumberGenerators randomNumbers; randomNumbers.seedAll(); //now set up the system typedef LOKI_TYPELIST_3(FeatureMoleculesIO,FeatureBox,FeatureBondset<>) Features; typedef ConfigureSystem<VectorInt3,Features> Config; typedef Ingredients<Config> MyIngredients; MyIngredients mySystem; mySystem.setBoxX(64); mySystem.setBoxY(64); mySystem.setBoxZ(64); mySystem.setPeriodicX(true); mySystem.setPeriodicY(true); mySystem.setPeriodicZ(true); mySystem.modifyBondset().addBFMclassicBondset(); mySystem.synchronize(mySystem); /* **************************************************************** * as compared to the previous example, we now don't create the * particles by hand, but we use an updater for this in the * task manager. the advantage of this approach is that you can * reuse this updater in different programs, so you don't have to * write the code for creating particles every time. * * we want the particles to be created once before the simulation. * so we have to tell the task manager this when adding the * updater. this is done by giving the number 0 as execution * frequency, as shown below. * the largest part of the code below is exactly the same as in the * previous example. * ***************************************************************/ //create the task manager TaskManager taskmanager; //add the ex5updater, which creates the particles //again, the addUpdater function takes two arguments. The first one //is a pointer to the updater, and the second one is the execution //frequency. here we use 0 as frequency, because we want the updater //to be executed only once at the beginning. //what would happen, if you set a number different from 0? uint32_t numberOfParticles=100; taskmanager.addUpdater(new Ex5Updater<MyIngredients>(mySystem,numberOfParticles),0); //add the simulator //here we set the frequency to one, because we want to execute it in every //circle taskmanager.addUpdater(new UpdaterSimpleSimulator<MyIngredients,MoveLocalSc>(mySystem,1000),1); //the following two analyzers are the same as in the last example: //on top of this, we add a third one, which is the ex5analyzer //written for this example. //add the file output, the trajectory file name will be "polymer.bfm" taskmanager.addAnalyzer(new AnalyzerWriteBfmFile<MyIngredients>("polymer.bfm",mySystem),1); //add the radius of gyration calculation. we execute this only //every 10th time taskmanager.addAnalyzer(new AnalyzerRadiusOfGyration<MyIngredients>(mySystem,"polymer"),10); //now add the ex5analyzer. execute it every second circle std::string outputFilename("ex5output.dat"); taskmanager.addAnalyzer(new Ex5Analyzer<MyIngredients>(mySystem,outputFilename),2); //as before, we initialize and run the task manager, and cleanup afterwards taskmanager.initialize(); taskmanager.run(10000); taskmanager.cleanup(); return 0; }
int main(int argc, const char * argv[]) { try { setlocale(LC_ALL, ""); std::locale loc; wordMap words; // Define vars std::string filename = "Erlrouter.txt"; char tempChar(0); std::string tempWord(""); int lineCounter(1); // Open file std::ifstream book(filename.c_str()); if(!book.is_open()) throw std::runtime_error("Die Datei \"" + filename + "\" konnte nicht geöffnet werden!"); /* Get line || get word std::string line(""); std::istream_iterator<std::string> iiter(book); std::istream_iterator<std::string> eos; for(int i = 0;i<=2;++i) std::cout << *iiter++ << std::endl; // Read word getline(book, line); std::cout << line << std::endl; */ // Go through file and read in char-by-char do { tempChar = book.get(); if(tempChar == '\n') lineCounter++; if(isspace(tempChar, loc)) { // Write word if(tempWord.length() > 0) { if(isNomen(tempWord)) { // We have a nomen! addWordToMap(words, *new Nomen(tempWord, lineCounter)); } else if(isAkronym(tempWord)) { // We have an acronym! addWordToMap(words, *new Akronym(tempWord, lineCounter)); } } tempWord = ""; } else if(isalpha(tempChar, loc)) { tempWord = tempWord + tempChar; } } while(book.good()); book.close(); // Close file printMap(words); // Write to Index.txt std::string outputFilename("Index.txt"); std::ofstream index(outputFilename.c_str()); writeMap(words, index); return 0; } catch(std::exception &e) { std::cerr << e.what() << std::endl; } catch(...) { std::cerr << "Ein unbekannter Fehler trat auf." << std::endl; } }
/** * Render the SKP file(s) within inputPath. * * @param inputPath path to an individual SKP file, or a directory of SKP files * @param writePath if not NULL, write all image(s) generated into this directory * @param mismatchPath if not NULL, write any image(s) not matching expectations into this directory * @param renderer PictureRenderer to use to render the SKPs * @param jsonSummaryPtr if not NULL, add the image(s) generated to this summary */ static bool render_picture(const SkString& inputPath, const SkString* writePath, const SkString* mismatchPath, sk_tools::PictureRenderer& renderer, sk_tools::ImageResultsAndExpectations *jsonSummaryPtr) { int diffs[256] = {0}; SkBitmap* bitmap = NULL; renderer.setJsonSummaryPtr(jsonSummaryPtr); bool success = render_picture_internal(inputPath, FLAGS_writeWholeImage ? NULL : writePath, FLAGS_writeWholeImage ? NULL : mismatchPath, renderer, FLAGS_validate || FLAGS_writeWholeImage ? &bitmap : NULL); if (!success || ((FLAGS_validate || FLAGS_writeWholeImage) && bitmap == NULL)) { SkDebugf("Failed to draw the picture.\n"); delete bitmap; return false; } if (FLAGS_validate) { SkBitmap* referenceBitmap = NULL; sk_tools::PictureRenderer* referenceRenderer; // If the renderer uses a BBoxHierarchy, then the reference renderer // will be the same renderer, without the bbh. AutoRestoreBbhType arbbh; if (sk_tools::PictureRenderer::kNone_BBoxHierarchyType != renderer.getBBoxHierarchyType()) { referenceRenderer = &renderer; referenceRenderer->ref(); // to match auto unref below arbbh.set(referenceRenderer, sk_tools::PictureRenderer::kNone_BBoxHierarchyType); } else { #if SK_SUPPORT_GPU referenceRenderer = new sk_tools::SimplePictureRenderer(renderer.getGrContextOptions()); #else referenceRenderer = new sk_tools::SimplePictureRenderer; #endif } SkAutoTUnref<sk_tools::PictureRenderer> aurReferenceRenderer(referenceRenderer); success = render_picture_internal(inputPath, NULL, NULL, *referenceRenderer, &referenceBitmap); if (!success || NULL == referenceBitmap || NULL == referenceBitmap->getPixels()) { SkDebugf("Failed to draw the reference picture.\n"); delete bitmap; delete referenceBitmap; return false; } if (success && (bitmap->width() != referenceBitmap->width())) { SkDebugf("Expected image width: %i, actual image width %i.\n", referenceBitmap->width(), bitmap->width()); delete bitmap; delete referenceBitmap; return false; } if (success && (bitmap->height() != referenceBitmap->height())) { SkDebugf("Expected image height: %i, actual image height %i", referenceBitmap->height(), bitmap->height()); delete bitmap; delete referenceBitmap; return false; } for (int y = 0; success && y < bitmap->height(); y++) { for (int x = 0; success && x < bitmap->width(); x++) { int diff = MaxByteDiff(*referenceBitmap->getAddr32(x, y), *bitmap->getAddr32(x, y)); SkASSERT(diff >= 0 && diff <= 255); diffs[diff]++; if (diff > FLAGS_maxComponentDiff) { SkDebugf("Expected pixel at (%i %i) exceedds maximum " "component diff of %i: 0x%x, actual 0x%x\n", x, y, FLAGS_maxComponentDiff, *referenceBitmap->getAddr32(x, y), *bitmap->getAddr32(x, y)); delete bitmap; delete referenceBitmap; return false; } } } delete referenceBitmap; for (int i = 1; i <= 255; ++i) { if(diffs[i] > 0) { SkDebugf("Number of pixels with max diff of %i is %i\n", i, diffs[i]); } } } if (FLAGS_writeWholeImage) { sk_tools::force_all_opaque(*bitmap); SkString inputFilename = SkOSPath::Basename(inputPath.c_str()); SkString outputFilename(inputFilename); sk_tools::replace_char(&outputFilename, '.', '_'); outputFilename.append(".png"); if (jsonSummaryPtr) { sk_tools::ImageDigest imageDigest(*bitmap); jsonSummaryPtr->add(inputFilename.c_str(), outputFilename.c_str(), imageDigest); if ((mismatchPath) && !mismatchPath->isEmpty() && !jsonSummaryPtr->getExpectation(inputFilename.c_str()).matches(imageDigest)) { success &= sk_tools::write_bitmap_to_disk(*bitmap, *mismatchPath, NULL, outputFilename); } } if ((writePath) && !writePath->isEmpty()) { success &= sk_tools::write_bitmap_to_disk(*bitmap, *writePath, NULL, outputFilename); } } delete bitmap; return success; }
bool SceneConverter::convert() { // // Construt the scene // FbxNode *node = m_scene->GetRootNode(); std::list<FbxNode *> nodes; std::map<FbxNode *, SceneNode *> fbxNode2SceneNodes; Scene scene; nodes.push_back(node); SceneNode *sceneNode = makeSceneNode(node); scene.addNode(sceneNode); fbxNode2SceneNodes.insert(std::make_pair(node, sceneNode)); while (!nodes.empty()) { FbxNode *ret = nodes.front(); nodes.pop_front(); for (int i = 0; i < ret->GetChildCount(); i++) { FbxNode *child = ret->GetChild(i); // Only output visible nodes. if (child->GetVisibility() && child->Show.Get()) { SceneNode *sceneNode = makeSceneNode(child); if (sceneNode != NULL) { if (sceneNode->type == "camera") { // The first camera will be the main camera of the scene scene.setCamera(sceneNode); } scene.addNode(sceneNode, fbxNode2SceneNodes[ret]); fbxNode2SceneNodes.insert(std::make_pair(child, sceneNode)); } nodes.push_back(child); } } } // Create a camera if it is not included in FBX. The camera is evaluated // using the bounding box of all visible nodes. if (m_numCameras == 0) { FbxVector4 rootBboxMin; FbxVector4 rootBboxMax; FbxVector4 rootBboxCenter; rootBboxMin = FbxVector4(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX); rootBboxMax = FbxVector4(-FLT_MAX, -FLT_MAX, -FLT_MAX, -FLT_MAX); FbxNode *node = m_scene->GetRootNode(); nodes.push_back(node); while (!nodes.empty()) { FbxNode *ret = nodes.front(); nodes.pop_front(); for (int i = 0; i < ret->GetChildCount(); i++) { FbxNode *child = ret->GetChild(i); nodes.push_back(child); } if (ret->GetChildCount() == 0 && ret->GetVisibility() && ret->Show.Get() && ret->GetMesh() != NULL) { FbxVector4 bboxMin; FbxVector4 bboxMax; FbxVector4 bboxCenter; ret->EvaluateGlobalBoundingBoxMinMaxCenter(bboxMin, bboxMax, bboxCenter); rootBboxMin[0] = std::min(rootBboxMin[0], bboxMin[0]); rootBboxMin[1] = std::min(rootBboxMin[1], bboxMin[1]); rootBboxMin[2] = std::min(rootBboxMin[2], bboxMin[2]); rootBboxMax[0] = std::max(rootBboxMax[0], bboxMax[0]); rootBboxMax[1] = std::max(rootBboxMax[1], bboxMax[1]); rootBboxMax[2] = std::max(rootBboxMax[2], bboxMax[2]); } } rootBboxCenter = (rootBboxMin + rootBboxMax) / 2; FbxVector4 rootBboxSize = rootBboxMax - rootBboxMin; SceneNode *sceneNode = new SceneNode(); sceneNode->type = FbxString("camera"); sceneNode->attributes.push_back(std::make_pair(FbxString("name"), FbxString("camera"))); sceneNode->attributes.push_back(std::make_pair(FbxString("fixed"), FbxString("true"))); double diag = sqrt(rootBboxSize[0] * rootBboxSize[0] + rootBboxSize[1] * rootBboxSize[1] + rootBboxSize[2] * rootBboxSize[2]) * 0.5; double eye = diag / tan(15.0 * FBXSDK_PI_DIV_180); double position[3]; double up[3]; double znear; double zfar; znear = eye - diag - 1.0f; zfar = eye + diag + 1.0f; if (rootBboxSize[0] <= rootBboxSize[1] && rootBboxSize[0] <= rootBboxSize[2]) { position[0] = eye + rootBboxCenter[0]; position[1] = rootBboxCenter[1]; position[2] = rootBboxCenter[2]; up[0] = 0; up[1] = 1; up[2] = 0; } else if (rootBboxSize[1] <= rootBboxSize[0] && rootBboxSize[1] <= rootBboxSize[2]) { position[0] = rootBboxCenter[0]; position[1] = eye + rootBboxCenter[1]; position[2] = rootBboxCenter[2]; up[0] = 0; up[1] = 0; up[2] = 1; } else { position[0] = rootBboxCenter[0]; position[1] = rootBboxCenter[1]; position[2] = eye + rootBboxCenter[2]; up[0] = 0; up[1] = 1; up[2] = 0; } char lookat[1024]; char perspective[1024]; FBXSDK_sprintf(lookat, 1024, "eye:%8.5f,%8.5f,%8.5f,center:%8.5f,%8.5f,%8.5f,up:%8.5f,%8.5f,%8.5f", (float)position[0], (float)position[1], (float)position[2], (float)rootBboxCenter[0], (float)rootBboxCenter[1], (float)rootBboxCenter[2], (float)up[0], (float)up[1], (float)up[2]); sceneNode->attributes.push_back(std::make_pair(FbxString("lookat"), FbxString(lookat))); FBXSDK_sprintf(perspective, 1024, "perspective,fov:%8.5f,aspect:-1,znear:%8.5f,zfar:%8.5f", 30.0f, (float)znear, (float)zfar); sceneNode->attributes.push_back(std::make_pair(FbxString("projection"), FbxString(perspective))); scene.setCamera(sceneNode); scene.addNode(sceneNode, scene.root()); } // // Output the file. // //FbxString outputFilename = FbxPathUtils::GetFileName(m_arguments->FBXFileName.Buffer()).Lower(); //outputFilename.FindAndReplace(".fbx", ".psc"); FbxString outputFilename("scene.psc"); FbxString path = FbxPathUtils::Bind(m_arguments->outputFolder, outputFilename.Buffer()); bool ret = scene.output(path.Buffer()); if (!ret) { FBXSDK_printf("Exporting failed!\n\n"); } return ret; }
//----------------------------------------------------------------------------- // Function : HomotopyProbe::doOutputHomotopy // Purpose : // Special Notes : // Scope : // Creator : David Baur, Raytheon // Creation Date : //----------------------------------------------------------------------------- void HomotopyProbe::doOutputHomotopy( Parallel::Machine comm, const std::vector<std::string> & parameter_names, const std::vector<double> & parameter_values, const N_LAS_Vector & solution_vector) { std::ostream &os = *outStreamPtr_; double tmpTime = outputManager_.getCircuitTime(); // outputManager_.getAnaIntPtr()->getTime(); if (Parallel::rank(comm) == 0) { if (firstTimeHomotopy_) //Setup Output Stream and Print Out Header { outFilename_ = outputFilename(printParameters_.filename_, printParameters_.defaultExtension_, printParameters_.suffix_, outputManager_.getNetListFilename()); if (Parallel::rank(comm) == 0 && outStreamPtr_ == 0) { outStreamPtr_ = outputManager_.openFile(outFilename_); } homotopyHeader(parameter_names, parameter_values, solution_vector); firstTimeHomotopy_ = false; } os.width( 0); if (printParameters_.analysisMode_ == Analysis::ANP_MODE_TRANSIENT) { os << "#C " << tmpTime << " "; os << printCount_ << std::endl; } else { os << "#C " << outputManager_.getPRINTDCvalue() << " "; os << printCount_ << std::endl; } //------------------------------------- //HOMOTOPY PARAM VALUE OUTPUT GOES HERE //------------------------------------- for (int iparam=0;iparam < parameter_values.size(); ++iparam) { if (printParameters_.delimiter_ == "") { os.width(printParameters_.streamWidth_); } else { os.width(0); if (printParameters_.delimiter_ != "") os << printParameters_.delimiter_; } os << parameter_values[iparam]; } } // procID Util::Op::OpList::const_iterator iterParam = opList_.begin(); Util::Op::OpList::const_iterator last = opList_.end(); int i; for (i = 1; iterParam != last; ++iterParam, ++i) { double result = getValue(comm, *(*iterParam), Util::Op::OpData(0, &solution_vector, 0, 0, 0, 0)).real(); if (Parallel::rank(comm) == 0) { if (printParameters_.delimiter_ == "") { os.width(printParameters_.streamWidth_); } else { os.width(0); if (printParameters_.delimiter_ != "") os << printParameters_.delimiter_; } os << result; } } if (Parallel::rank(comm) == 0) os << std::endl; }
/* * Main routine: * 1. parsing parameters (replace this with our favorite options parser) * 2. run registration */ int main(int argc, char* argv[]) { std::string referenceFilename(""); std::string targetFilename(""); std::string referenceLandmarkFilename(""); std::string targetLandmarkFilename(""); std::string similarityMetric(""); std::string outputFilename(""); std::string outputDfFilename(""); double gaussianKernelSigma = 70; double gaussianKernelScale = 100; double landmarkUncertainty = 0.1; unsigned numberOfBasisFunctions = 100; unsigned numberOfIterations = 100; // parse command line parameters if (argc != 10 && argc != 13) { std::cout << "***********************************************************" << std::endl; std::cout << "usage\t" << argv[0] << std::endl; std::cout << "referenceFilename:\t\t Filename of reference image." << std::endl; std::cout << "targetFilename:\t\t\t Filename of target image." << std::endl; std::cout << "outputFilename:\t\t\t Filename of the resulting registered image." << std::endl; std::cout << "outputDfFilename:\t\t Filename of the resulting deformation field." << std::endl; std::cout << "similarityMetric:\t\t Similarity metric: MeanSquares and NormalizedCorrelation are supported." << std::endl; std::cout << "gaussianKernelSigma:\t\t Sigma of the Gaussian kernel. (e.g. 70)" << std::endl; std::cout << "gaussianKernelScale:\t\t Scale of the Gaussian kernel. (e.g. 100)" << std::endl; std::cout << "numBasisFunctions:\t\t Number of basis functions to approximate. (e.g. 100)" << std::endl; std::cout << "numIterations:\t\t\t Number of iterations to perform in the optimization. (e.g. 100)" << std::endl << std::endl; std::cout << "or (including landmarks)\t" << argv[0] << std::endl; std::cout << "referenceFilename:\t\t Filename of reference image." << std::endl; std::cout << "referenceLandmarkFilename:\t Filename of reference landmark file." << std::endl; std::cout << "targetFilename:\t\t\t Filename of target image." << std::endl; std::cout << "targetLandmarkFilename:\t\t Filename of target landmark file." << std::endl; std::cout << "outputFilename:\t\t\t Filename of the resulting registered image." << std::endl; std::cout << "outputDfFilename:\t\t Filename of the resulting deformation field." << std::endl; std::cout << "similarityMetric:\t\t Similarity metric: MeanSquares and NormalizedCorrelation are supported." << std::endl; std::cout << "gaussianKernelSigma:\t\t Sigma of the Gaussian kernel. (e.g. 70)" << std::endl; std::cout << "gaussianKernelScale:\t\t Scale of the Gaussian kernel. (e.g. 100)" << std::endl; std::cout << "landmarkUncertainty:\t\t Uncertainty of the landmarks. (e.g. 0.1)" << std::endl; std::cout << "numBasisFunctions:\t\t Number of basis functions to approximate. (e.g. 100)" << std::endl; std::cout << "numIterations:\t\t\t Number of iterations to perform in the optimization. (e.g. 100)" << std::endl; exit(-1); } if(argc == 10){ referenceFilename = argv[1]; targetFilename = argv[2]; outputFilename = argv[3]; outputDfFilename = argv[4]; similarityMetric = argv[5]; std::stringstream ss; ss << argv[6]; ss >> gaussianKernelSigma; ss.str(""); ss.clear(); ss << argv[7]; ss >> gaussianKernelScale; ss.str(""); ss.clear(); ss << argv[8]; ss >> numberOfBasisFunctions; ss.str(""); ss.clear(); ss << argv[9]; ss >> numberOfIterations; }