From b077570663aa3304749df2f9463dcd3bfc7ac7d1 Mon Sep 17 00:00:00 2001 From: Christophe Bourcier Date: Thu, 3 Mar 2016 11:52:26 +0100 Subject: [PATCH] Fix [CEA 1770]: Compute ends in Error "No mesh on sub-shape" since Hybrid does not deal with multi-domains --- src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx | 51 ++++-------------------- 1 file changed, 7 insertions(+), 44 deletions(-) diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx index ab23bb4..70c49aa 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx @@ -118,7 +118,7 @@ HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID(int hypId, int studyId, SMESH_Gen* gen) MESSAGE("HYBRIDPlugin_HYBRID::HYBRIDPlugin_HYBRID"); _name = Name(); _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type - _onlyUnaryInput = false; // Compute() will be called on a compound of solids + _onlyUnaryInput = true; // Compute() will be called on each solid _iShape=0; _nbShape=0; _compatibleHypothesis.push_back( HYBRIDPlugin_Hypothesis::GetHypType()); @@ -677,50 +677,16 @@ static bool readGMFFile(const char* theFile, return false; MESSAGE("Done "); - // Read ids of domains - std::vector< int > solidIDByDomain; + // Hybrid is not multi-domain => We can't (and don't need to) read ids of domains in ouput file like in GHS3DPlugin + // We just need to get the id of the one and only solid + int solidID = 1; if ( hasGeom ) { - int solid1; // id used in case of 1 domain or some reading failure if ( theHelper->GetSubShape().ShapeType() == TopAbs_SOLID ) - solid1 = theHelper->GetSubShapeID(); + solidID = theHelper->GetSubShapeID(); else - solid1 = theMeshDS->ShapeToIndex + solidID = theMeshDS->ShapeToIndex ( TopExp_Explorer( theHelper->GetSubShape(), TopAbs_SOLID ).Current() ); - - int nbDomains = GmfStatKwd( InpMsh, GmfSubDomainFromGeom ); - if ( nbDomains > 1 ) - { - solidIDByDomain.resize( nbDomains+1, theHelper->GetSubShapeID() ); - int faceNbNodes, faceIndex, orientation, domainNb; - GmfGotoKwd( InpMsh, GmfSubDomainFromGeom ); - for ( int i = 0; i < nbDomains; ++i ) - { - faceIndex = 0; - GmfGetLin( InpMsh, GmfSubDomainFromGeom, - &faceNbNodes, &faceIndex, &orientation, &domainNb); - solidIDByDomain[ domainNb ] = 1; - if ( 0 < faceIndex && faceIndex-1 < (int)theFaceByHybridId.size() ) - { - const SMDS_MeshElement* face = theFaceByHybridId[ faceIndex-1 ]; - const SMDS_MeshNode* nn[3] = { face->GetNode(0), - face->GetNode(1), - face->GetNode(2) }; - if ( orientation < 0 ) - std::swap( nn[1], nn[2] ); - solidIDByDomain[ domainNb ] = - findShapeID( *theHelper->GetMesh(), nn[0], nn[1], nn[2], toMeshHoles ); - if ( solidIDByDomain[ domainNb ] > 0 ) - { - const TopoDS_Shape& foundShape = theMeshDS->IndexToShape( solidIDByDomain[ domainNb ] ); - if ( ! theHelper->IsSubShape( foundShape, theHelper->GetSubShape() )) - solidIDByDomain[ domainNb ] = HOLE_ID; - } - } - } - } - if ( solidIDByDomain.size() < 2 ) - solidIDByDomain.resize( 2, solid1 ); } // Issue 0020682. Avoid creating nodes and tetras at place where @@ -745,7 +711,7 @@ static bool readGMFFile(const char* theFile, delete [] GMFNode; return false; } - int dummy, solidID; + int dummy; GmfKwdCod token = it->first; nbRef = it->second; @@ -927,7 +893,6 @@ static bool readGMFFile(const char* theFile, case GmfTetrahedra: if ( hasGeom ) { - solidID = solidIDByDomain[ domainID[iElem]]; if ( solidID != HOLE_ID ) { aCreatedElem = theHelper->AddVolume( node[1], node[0], node[2], node[3], @@ -959,7 +924,6 @@ static bool readGMFFile(const char* theFile, case GmfPrisms: if ( hasGeom ) { - solidID = solidIDByDomain[ domainID[iElem]]; if ( solidID != HOLE_ID ) { aCreatedElem = theHelper->AddVolume( node[0], node[2], node[1], @@ -995,7 +959,6 @@ static bool readGMFFile(const char* theFile, case GmfHexahedra: if ( hasGeom ) { - solidID = solidIDByDomain[ domainID[iElem]]; if ( solidID != HOLE_ID ) { aCreatedElem = theHelper->AddVolume( node[0], node[3], node[2], node[1], -- 2.39.2