const int *FEM_Partition::getPartition(FEM_Mesh *src,int nChunks) const { if (!elem2chunk) { /* Create elem2chunk based on Metis partitioning: */ int *e=new int[src->nElems()]; FEM_Mesh_partition(src,nChunks,e); ((FEM_Partition *)this)->elem2chunk=e; } return elem2chunk; }
int main (int argc, char* argv[]) { LOGOG_INITIALIZE(); logog::Cout* logog_cout (new logog::Cout); BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter); logog_cout->SetFormatter(*custom_format); TCLAP::CmdLine cmd( "Creates a new file for material properties and sets the material ids in the msh-file to 0", ' ', "0.1"); TCLAP::ValueArg<std::string> mesh_arg("m", "mesh", "the mesh to open from a file", false, "", "filename for mesh input"); cmd.add( mesh_arg ); cmd.parse( argc, argv ); // read mesh MeshLib::Mesh* mesh(FileIO::readMeshFromFile(mesh_arg.getValue())); std::vector<MeshLib::Element*> &elems = *(const_cast<std::vector<MeshLib::Element*>*>(&(mesh->getElements()))); std::size_t nElems(elems.size()); std::string name = BaseLib::extractBaseNameWithoutExtension(mesh_arg.getValue()); // create file std::string new_matname(name + "_prop"); std::ofstream out_prop( new_matname.c_str(), std::ios::out ); if (out_prop.is_open()) { for (std::size_t i=0; i<nElems; i++) out_prop << i << "\t" << elems[i]->getValue() << "\n"; out_prop.close(); } else { ERR("Could not create property \"%s\" file.", new_matname.c_str()); return -1; } // set mat ids to 0 and write new msh file for (std::size_t i=0; i<nElems; i++) elems[i]->setValue(0); std::string new_mshname(name + "_new.vtu"); INFO("Writing mesh to file \"%s\".", new_mshname.c_str()); FileIO::VtuInterface mesh_io(mesh); mesh_io.writeToFile (new_mshname); INFO("New files \"%s\" and \"%s\" written.", new_mshname.c_str(), new_matname.c_str()); std::cout << "Conversion finished." << std::endl; return 1; }
def(bool, Run) { unsigned int *ptr[2048]; for (size_t i = 1; i < nElems(ptr); i++) { ptr[i] = Memory_New(i * sizeof(unsigned int)); fwd(j, i) { ptr[i][j] = i + j; } }
LocationID *connectedLocations(GameView g, int *numLocations, LocationID from, PlayerID player, Round round, int road, int rail, int sea) { // Quick validity checks if (from < MIN_MAP_LOCATION || from > MAX_MAP_LOCATION) { return NULL; } if (player < 0 || player > 5) { return NULL; } if (player == PLAYER_DRACULA) { rail = 0; } // Create set to keep track of connected locations Set canVisit = newLocSet(); int railDistance = (round + player) % 4; /* Loop through each location connected to the starting place and add them to the canVisit list if the relevant transport type is legal */ VList currLoc = g->map->connections[from]; insertInto(canVisit, from); //insertInto(canVisit, currLoc->v); while(currLoc != NULL) { if (currLoc->type[ROAD-1] && road) { insertInto(canVisit, currLoc->v); } if (currLoc->type[RAIL-1] && rail && railDistance) { railTravel(g, railDistance, canVisit, currLoc->v); insertInto(canVisit, currLoc->v); } if (currLoc->type[BOAT-1] && sea) { insertInto(canVisit, currLoc->v); } currLoc = currLoc->next; } // Dracula can't visit the hospital if (player == PLAYER_DRACULA) { dropFrom(canVisit, ST_JOSEPH_AND_ST_MARYS); } showSet(canVisit); *numLocations = nElems(canVisit); return condensedSet(canVisit); }
{ $("rpm"), $("audio/x-pn-realaudio-plugin") }, { $("rtf"), $("application/rtf") }, { $("sgml"), $("text/x-sgml") }, { $("sh"), $("application/x-sh") }, { $("snd"), $("audio/basic") }, { $("svg"), $("image/svg+xml") }, { $("swf"), $("application/x-shockwave-flash") }, { $("tar"), $("application/x-tar") }, { $("tar.gz"), $("application/x-compressed") }, { $("taz"), $("application/x-tar") }, { $("tcl"), $("application/x-tcl") }, { $("tex"), $("application/x-tex") }, { $("tgz"), $("application/x-compressed") }, { $("tif"), $("image/tiff") }, { $("tiff"), $("image/tiff") }, { $("torrent"), $("application/x-bittorrent") }, { $("txt"), $("text/plain") }, { $("vrml"), $("x-world/x-vrml") }, { $("wav"), $("audio/x-wav") }, { $("xbel"), $("text/xml") }, { $("xbm"), $("image/x-xbitmap") }, { $("xls"), $("application/excel") }, { $("xml"), $("text/xml") }, { $("xpm"), $("image/x-xpixmap") }, { $("xsl"), $("text/xml") }, { $("xslt"), $("application/xml") }, { $("zip"), $("application/zip") } }; size_t MimeTypes_Length = nElems(MimeTypes);