diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp index 743ab8e73194dddb430d4fa89d5b7172030f4a1c..26f053ae173dd2582d97407f04d04442cf87a79c 100644 --- a/Geo/GModel.cpp +++ b/Geo/GModel.cpp @@ -1687,6 +1687,7 @@ void GModel::_storePhysicalTagsInEntities(int dim, case 2: ge = getFaceByTag(it->first); break; case 3: ge = getRegionByTag(it->first); break; } + if(ge){ std::map<int, std::string>::const_iterator it2 = it->second.begin(); for(; it2 != it->second.end(); ++it2){ @@ -1696,6 +1697,11 @@ void GModel::_storePhysicalTagsInEntities(int dim, } } } + + else { + std::cout << "Could not find entity " << std::endl; + } + } } diff --git a/Geo/GModelCreateTopologyFromMesh.cpp b/Geo/GModelCreateTopologyFromMesh.cpp index 63f40a10f7ea259be0cbb6e2ef7d887f301f5001..ab4b0ed6439757a0b7b69ac5a328d1f50c45f06f 100644 --- a/Geo/GModelCreateTopologyFromMesh.cpp +++ b/Geo/GModelCreateTopologyFromMesh.cpp @@ -252,21 +252,9 @@ void createTopologyFromMesh1D(GModel *gm, int &num) if (gEdges.size() > 1) { - - if (gEdges.size() > 3) { - std::cout << "Vertex " << mv->getNum() - << " is connected to " << gEdges.size() - << " geometric edges " << std::endl; - } - + if (gEdgesToGVertex.find(gEdges) == gEdgesToGVertex.end()) { num++; - std::cout << "Creating a vertex " << gm->getMaxElementaryNumber(0) + 1 - << " for connection of edges "; - for (std::set<GEdge*>::iterator gg = gEdges.begin();gg!=gEdges.end();++gg) { - std::cout << " " << (*gg)->tag(); - } - std::cout << std::endl; discreteVertex *dv = new discreteVertex(gm, gm->getMaxElementaryNumber(0) + 1); gm->add(dv); @@ -630,10 +618,12 @@ void createTopologyFromMesh3D(GModel *gm, int &num) if (!r1) { const std::set<int>& vtx = it->first.getVertices(); - std::cout << "Could not find pair of regions for face "; - for (std::set<int>::const_iterator vIter=vtx.begin();vIter!=vtx.end();++vIter) { - std::cout << " " << *vIter; - } + std::ostringstream faceVtcs; + std::set<int>::const_iterator vIt=vtx.begin(); + for (;vIt!=vtx.end();++vIt) faceVtcs << " " << *vIt; + Msg::Error("Could not find pair of regions for face %s", + faceVtcs.str().c_str()); + } else if (r1 != r2) { diff --git a/Geo/GModelIO_CGNS.cpp b/Geo/GModelIO_CGNS.cpp index 2c9896754b7d347bcc1d730422a8d0864140e71e..1fa7a1efcad4a2f79b0ef35844a9f1e48698a34e 100644 --- a/Geo/GModelIO_CGNS.cpp +++ b/Geo/GModelIO_CGNS.cpp @@ -419,7 +419,6 @@ createElementMSH(GModel *m, int num, switch(e->getType()){ case TYPE_PNT : - std::cout << "Adding a point " << std::endl; elements[0][reg].push_back(e); break; case TYPE_LIN : elements[1][reg].push_back(e); break; @@ -1555,6 +1554,11 @@ int GModel::readCGNSUnstructured(const std::string& fileName) std::map<std::string,int> zoneIndices; std::map<std::string,int> zoneOffsets; + // retain boundary conditions + + std::map<int,std::string> bcToName; + std::map<int,std::string> zoneToName; + int classIndex = nbZones + 1; for (int zoneIndex=1;zoneIndex<=nbZones;zoneIndex++) { @@ -1589,6 +1593,7 @@ int GModel::readCGNSUnstructured(const std::string& fileName) return 0; } + zoneToName[zoneIndex] = zoneName; zoneIndices[zoneName] = zoneIndex; zoneOffsets[zoneName] = vtxOffset; @@ -1643,7 +1648,6 @@ int GModel::readCGNSUnstructured(const std::string& fileName) // --- provide a finer classification based on boundary conditions std::map<int,int> eltToBC; - std::map<int,std::string> bcToName; bool topologyDefined = readCGNSBoundaryConditions(fileIndex,baseIndex, zoneIndex,classIndex, @@ -1762,7 +1766,6 @@ int GModel::readCGNSUnstructured(const std::string& fileName) delete [] elts; } - // readCGNSPeriodicConnections(fileIndex,baseIndex,zoneIndex,zoneName,zoneType,periodic); @@ -1782,11 +1785,32 @@ int GModel::readCGNSUnstructured(const std::string& fileName) _associateEntityWithMeshVertices(); _storeVerticesInEntities(vertices); + // add physical entities corresponding to the bc and zones + std::map<int,std::map<int,std::string> > physicalSurfaces; + + std::map<int,std::string>::iterator bIter = bcToName.begin(); + for (;bIter!=bcToName.end();bIter++) { + int tag = bIter->first; + std::string name = bIter->second; + physicalSurfaces[tag][tag] = name; + } - + _storePhysicalTagsInEntities(meshDim-1,physicalSurfaces); + std::map<int,std::map<int,std::string> > physicalZones; + std::map<int,std::string>::iterator zIter = zoneToName.begin(); + for (;zIter!=zoneToName.end();zIter++) { + int tag = zIter->first; + std::string name = zIter->second; + physicalZones[tag][tag] = name; + } + + _storePhysicalTagsInEntities(meshDim,physicalZones); + + //_createGeometryOfDiscreteEntities(); + return 1; }