AlgPuLP(const RCP<const Environment> &env__, const RCP<const Comm<int> > &problemComm__, const RCP<const MeshAdapter<user_t> > &adapter__) : env(env__), problemComm(problemComm__), adapter(adapter__) { modelFlag_t flags; flags.reset(); const ParameterList &pl = env->getParameters(); const Teuchos::ParameterEntry *pe; std::string defString("default"); std::string objectOfInterest(defString); pe = pl.getEntryPtr("objects_to_partition"); if (pe) objectOfInterest = pe->getValue<std::string>(&objectOfInterest); if (objectOfInterest == defString || objectOfInterest == std::string("mesh_nodes") ) flags.set(VERTICES_ARE_MESH_NODES); else if (objectOfInterest == std::string("mesh_elements")) flags.set(VERTICES_ARE_MESH_ELEMENTS); buildModel(flags); }
void AlgPuLP<Adapter>::buildModel(modelFlag_t &flags) { const ParameterList &pl = env->getParameters(); const Teuchos::ParameterEntry *pe; std::string defString("default"); std::string symParameter(defString); pe = pl.getEntryPtr("symmetrize_graph"); if (pe){ symParameter = pe->getValue<std::string>(&symParameter); if (symParameter == std::string("transpose")) flags.set(SYMMETRIZE_INPUT_TRANSPOSE); else if (symParameter == std::string("bipartite")) flags.set(SYMMETRIZE_INPUT_BIPARTITE); } int sgParameter = 0; pe = pl.getEntryPtr("subset_graph"); if (pe) sgParameter = pe->getValue<int>(&sgParameter); if (sgParameter == 1) flags.set(BUILD_SUBSET_GRAPH); flags.set(REMOVE_SELF_EDGES); flags.set(GENERATE_CONSECUTIVE_IDS); flags.set(BUILD_LOCAL_GRAPH); this->env->debug(DETAILED_STATUS, " building graph model"); this->model = rcp(new GraphModel<base_adapter_t>(this->adapter, this->env, this->problemComm, flags)); this->env->debug(DETAILED_STATUS, " graph model built"); }
AlgPuLP(const RCP<const Environment> &env__, const RCP<const Comm<int> > &problemComm__, const RCP<const MatrixAdapter<user_t,userCoord_t> > &adapter__) : env(env__), problemComm(problemComm__), adapter(adapter__) { modelFlag_t flags; flags.reset(); const ParameterList &pl = env->getParameters(); const Teuchos::ParameterEntry *pe; std::string defString("default"); std::string objectOfInterest(defString); pe = pl.getEntryPtr("objects_to_partition"); if (pe) objectOfInterest = pe->getValue<std::string>(&objectOfInterest); if (objectOfInterest == defString || objectOfInterest == std::string("matrix_rows") ) flags.set(VERTICES_ARE_MATRIX_ROWS); else if (objectOfInterest == std::string("matrix_columns")) flags.set(VERTICES_ARE_MATRIX_COLUMNS); else if (objectOfInterest == std::string("matrix_nonzeros")) flags.set(VERTICES_ARE_MATRIX_NONZEROS); buildModel(flags); }
/** Sets up the region description for this inode using the available information e.g. labelimage */ void INode::setGeoRegion(float gW, float gN, float gE, float gS, INode* parent) { #define defFloat(name) float name=0.0; MLParser::setFloat(name,&attribList_,#name); #define defInt(name) int name=0; MLParser::setInt(name,&attribList_,#name); #define defString(name) QString name; MLParser::setString(name,&attribList_,#name); defFloat(geoNorth); defFloat(geoSouth); defFloat(geoWest); defFloat(geoEast); defFloat(scale_x); defFloat(scale_y); defInt(offset_x); defInt(offset_y); defInt(urx); defInt(ury); defInt(llx); defInt(lly); defString(file); defString(name); if ((gN == gS) && (gW == gE)) { qDebug("INode::setRegion: gN=gS && gW==gE"); gN = geoNorth; gS = geoSouth; gW = geoWest; gE = geoEast; } //! Dealing with the case "geocoordinates AND bounding box are given" is missing //! Geocoordinates of the labelimage must be calculated in this case. labelImage_ = labelImageList_.loadLabelImage(file, sNode()->GNode::name(), gW, gN, gE, gS); #define TRY_TO_CORRECT_SCALING_ERRORS #ifdef TRY_TO_CORRECT_SCALING_ERRORS // Correct errors in geocoordinates cause by scaling if (parent && scale_x && scale_y && parent->labelImage() && (scale_x!=1.0 || scale_y!=1.0)) { qDebug("INode::setRegion: correct geocoordinates:"); qDebug(" old: gW=%f, gN=%f, gE=%f, gS=%f",gW,gN,gE,gS); GeoImage* labelImage=parent->labelImage(); int pllx=int(offset_x/scale_x); int pury=int(offset_y/scale_y); int purx=int((offset_x+labelImage_->cols())/scale_x); int plly=int((offset_y+labelImage_->rows())/scale_y); qDebug(" scale_x=%f, scale_y=%f, offset_x=%d offset_y=%d", scale_x, scale_y, offset_x, offset_y); qDebug(" pllx=%d, plly=%d, purx=%d, pury=%d", pllx, plly, purx, pury); labelImage->geoBBox(pllx,plly,purx,pury,gN,gS,gW,gE); qDebug(" new: gW=%f, gN=%f, gE=%f, gS=%f",gW,gN,gE,gS); labelImage_->geoWest(gW); labelImage_->geoNorth(gN); labelImage_->geoEast(gE); labelImage_->geoSouth(gS); } #endif assert(labelImage_); labelImage_->load(); if (!attribList_["geoNorth"] || attribList_["geoNorth"]->isEmpty()) { // geo coordinates are not set qDebug("INode::setRegion: geo ausrechnen"); labelImage_->geoBBox(llx, lly, urx, ury, geoWest, geoNorth, geoEast, geoSouth); } else if (!attribList_["llx"]) { // boundingbox not set, but geo coordinates are set qDebug("INode::setRegion: bbox ausrechnen"); // if file geocoordinates describe a smaller area than the inode geocoordinates, // adjust the inode geocoordinates if (geoWest<gW) geoWest=gW; if (geoNorth>gN) geoNorth=gN; if (geoEast>gE) geoEast=gE; if (geoSouth<gS) geoSouth=gS; labelImage_->picBBox(geoWest, geoNorth, geoEast, geoSouth, llx, lly, urx, ury); #ifdef WIN32 //c:\eigenedateien\cpptest\geoaida\gda\gda\core\inode.cpp(739) : error C2664: 'replace' : Konvertierung des Parameters 2 von 'class QString' in 'const class QString *' nicht moeglich // Kein benutzerdefinierter Konvertierungsoperator verfuegbar, der diese Konvertierung durchfuehren kann, oder der Operator kann nicht aufgerufen werden attribList_.replace("llx",&QString().sprintf("%d", llx)); attribList_.replace("lly",&QString().sprintf("%d", lly)); attribList_.replace("urx",&QString().sprintf("%d", urx)); attribList_.replace("ury",&QString().sprintf("%d", ury)); #else attribList_.replace("llx",QString().sprintf("%d", llx)); attribList_.replace("lly",QString().sprintf("%d", lly)); attribList_.replace("urx",QString().sprintf("%d", urx)); attribList_.replace("ury",QString().sprintf("%d", ury)); #endif } else { //! Todo: calculate the labelimage geo coordinates from the given geo coordinates // and label boundingbox } #ifdef WIN32 attribList_.replace("geoNorth",&QString().sprintf("%f", geoNorth)); attribList_.replace("geoSouth",&QString().sprintf("%f", geoSouth)); attribList_.replace("geoWest", &QString().sprintf("%f", geoWest)); attribList_.replace("geoEast", &QString().sprintf("%f", geoEast)); #else attribList_.replace("geoNorth",QString().sprintf("%f", geoNorth)); attribList_.replace("geoSouth",QString().sprintf("%f", geoSouth)); attribList_.replace("geoWest", QString().sprintf("%f", geoWest)); attribList_.replace("geoEast", QString().sprintf("%f", geoEast)); #endif qDebug("INode::setGeoRegion: %s file=%s(%f,%f,%f,%f) bbox=(%5d, %5d, %5d %5d) geo=(%f, %f, %f, %f) res=(%f, %f)", name.latin1(), file.latin1(), gW, gN, gE, gS, llx, lly, urx, ury, geoWest, geoNorth, geoEast, geoSouth, labelImage_->resolutionX(), labelImage_->resolutionY()); #undef defFloat #undef defInt }