std::list<Mesh*> Primitives::LoadModel(std::string const& path) { std::list<Mesh*> meshes; Assimp::Importer importer; aiScene const* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_FlipUVs); if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) { LOG_VIDEO->Error("ERROR importing {} mesh : {}", path.c_str(), importer.GetErrorString()); return meshes; } std::string const dir = path.substr(0, path.find_last_of('/')); ProcessNodes(scene->mRootNode, scene, dir, meshes); return meshes; }
int main(int argc,char **argv ){ int my_rank,comm_size; int i; DGraph *dg=NULL; int verified=0, featnum=0; double bytes_sent=2.0,tot_time=0.0; MPI_Init( &argc, &argv ); MPI_Comm_rank( MPI_COMM_WORLD, &my_rank ); MPI_Comm_size( MPI_COMM_WORLD, &comm_size ); TRACE_smpi_set_category ("begin"); if(argc!=2|| ( strncmp(argv[1],"BH",2)!=0 &&strncmp(argv[1],"WH",2)!=0 &&strncmp(argv[1],"SH",2)!=0 ) ){ if(my_rank==0){ fprintf(stderr,"** Usage: mpirun -np N ../bin/dt.S GraphName\n"); fprintf(stderr,"** Where \n - N is integer number of MPI processes\n"); fprintf(stderr," - S is the class S, W, or A \n"); fprintf(stderr," - GraphName is the communication graph name BH, WH, or SH.\n"); fprintf(stderr," - the number of MPI processes N should not be be less than \n"); fprintf(stderr," the number of nodes in the graph\n"); } MPI_Finalize(); exit(0); } if(strncmp(argv[1],"BH",2)==0){ dg=buildBH(CLASS); }else if(strncmp(argv[1],"WH",2)==0){ dg=buildWH(CLASS); }else if(strncmp(argv[1],"SH",2)==0){ dg=buildSH(CLASS); } if(timer_on&&dg->numNodes+1>timers_tot){ timer_on=0; if(my_rank==0) fprintf(stderr,"Not enough timers. Node timeing is off. \n"); } if(dg->numNodes>comm_size){ if(my_rank==0){ fprintf(stderr,"** The number of MPI processes should not be less than \n"); fprintf(stderr,"** the number of nodes in the graph\n"); fprintf(stderr,"** Number of MPI processes = %d\n",comm_size); fprintf(stderr,"** Number nodes in the graph = %d\n",dg->numNodes); } MPI_Finalize(); exit(0); } for(i=0;i<dg->numNodes;i++){ dg->node[i]->address=i; } if( my_rank == 0 ){ printf( "\n\n NAS Parallel Benchmarks 3.3 -- DT Benchmark\n\n" ); graphShow(dg,0); timer_clear(0); timer_start(0); } verified=ProcessNodes(dg,my_rank); TRACE_smpi_set_category ("end"); featnum=NUM_SAMPLES*fielddim; bytes_sent=featnum*dg->numArcs; bytes_sent/=1048576; if(my_rank==0){ timer_stop(0); tot_time=timer_read(0); c_print_results( dg->name, CLASS, featnum, 0, 0, dg->numNodes, 0, comm_size, tot_time, bytes_sent/tot_time, "bytes transmitted", verified, NPBVERSION, COMPILETIME, MPICC, CLINK, CMPI_LIB, CMPI_INC, CFLAGS, CLINKFLAGS ); } MPI_Finalize(); return 1; }
bool Board::InitFromXMLFile(const char * fileName) { bool toReturn = false; xmlDocPtr doc; xmlXPathContextPtr xpathCtx; xmlXPathObjectPtr xpathObj; int ret; // Init libxml xmlInitParser(); LIBXML_TEST_VERSION assert(fileName); assert(XPathExpression); // Load XML document doc = xmlParseFile(fileName); if (doc == NULL) { cout << "Error: unable to parse file " << fileName << endl; return false; } // Create xpath evaluation context xpathCtx = xmlXPathNewContext(doc); if(xpathCtx == NULL) { cout << "Error: unable to create new XPath context" << endl; xmlFreeDoc(doc); return false; } // Evaluate xpath expression xpathObj = xmlXPathEvalExpression(BAD_CAST XPathExpression, xpathCtx); if(xpathObj == NULL) { cout << "Error: unable to evaluate xpath expression " << XPathExpression << endl; xmlXPathFreeContext(xpathCtx); xmlFreeDoc(doc); return false; } // Process the nodes in the file toReturn = ProcessNodes(xpathObj->nodesetval, stdout); // Cleanup xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); xmlFreeDoc(doc); // Shutdown libxml xmlCleanupParser(); // This is to debug memory for regression tests xmlMemoryDump(); // Build the UI table with the squares we have BuildTable(); return toReturn; }