From: Christian Van Wambeke Date: Thu, 3 Jul 2014 06:51:34 +0000 (+0200) Subject: select faces group for layer ok X-Git-Tag: CASSIS_V1.0~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ac0491644e08e0f52ca0d8c7fb279cf8e10293fd;p=plugins%2Fhybridplugin.git select faces group for layer ok --- diff --git a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx index 36643b8..a0ab956 100644 --- a/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx @@ -592,7 +592,6 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame() anEnfLayout->addLayout(anEnfLayout2, ENF_VER_VERTEX, 1,ENF_VER_NB_LINES, 1); anEnfLayout->setRowStretch(ENF_VER_VERTEX, 10); - // Enforced meshes parameters myEnfMeshGroup = new QWidget(); @@ -631,7 +630,7 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame() myEnfMeshConstraint = new QComboBox(myEnfMeshGroup); myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels); myEnfMeshConstraint->setEditable(false); - myEnfMeshConstraint->setCurrentIndex(0); + myEnfMeshConstraint->setCurrentIndex(2); //EZ: use mesh group of faces for a layer QLabel* myMeshGroupNameLabel = new QLabel( tr( "HYBRID_ENF_GROUP_LABEL" ), myEnfMeshGroup ); myMeshGroupName = new QLineEdit(myEnfMeshGroup); @@ -654,21 +653,24 @@ QFrame* HYBRIDPluginGUI_HypothesisCreator::buildFrame() QGridLayout* anEnfMeshLayout2 = new QGridLayout(myEnfMeshGroup); anEnfMeshLayout2->addWidget(myEnfMeshWdg, ENF_MESH_MESH, 0, 1, 2); - anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1); - anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1); - anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1); - anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1); + //TODO remove or er usmay be lateful to select layers... + //anEnfMeshLayout2->addWidget(myMeshConstraintLabel, ENF_MESH_CONSTRAINT, 0, 1, 1); + //anEnfMeshLayout2->addWidget(myEnfMeshConstraint, ENF_MESH_CONSTRAINT, 1, 1, 1); + //anEnfMeshLayout2->addWidget(myMeshGroupNameLabel, ENF_MESH_GROUP, 0, 1, 1); + //anEnfMeshLayout2->addWidget(myMeshGroupName, ENF_MESH_GROUP, 1, 1, 1); anEnfMeshLayout2->addWidget(addEnfMeshButton, ENF_MESH_BTN, 0, 1, 1); anEnfMeshLayout2->addWidget(removeEnfMeshButton, ENF_MESH_BTN, 1, 1, 1); anEnfMeshLayout2->setRowStretch(ENF_MESH_NB_LINES, 1); anEnfMeshLayout->addLayout(anEnfMeshLayout2, ENF_MESH_MESH, 1, ENF_MESH_NB_LINES, 1); anEnfMeshLayout->setRowStretch(ENF_MESH_MESH, 10); + // add tabs tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) ); tab->insertTab( ADV_TAB, myAdvGroup, tr( "HYBRID_ADV_ARGS" ) ); - tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "HYBRID_ENFORCED_VERTICES" ) ); + //TODO remove or er usmay be lateful to select layers... + //tab->insertTab( ENF_VER_TAB, myEnfGroup, tr( "HYBRID_ENFORCED_VERTICES" ) ); tab->insertTab( ENF_MESH_TAB, myEnfMeshGroup, tr( "HYBRID_ENFORCED_MESHES" ) ); tab->setCurrentIndex( STD_TAB ); diff --git a/src/GUI/HYBRIDPlugin_msg_en.ts b/src/GUI/HYBRIDPlugin_msg_en.ts index 08d3254..520200a 100644 --- a/src/GUI/HYBRIDPlugin_msg_en.ts +++ b/src/GUI/HYBRIDPlugin_msg_en.ts @@ -193,7 +193,7 @@ HYBRID_ENFORCED_MESHES - Enforced meshes + Layers meshes HYBRID_ENF_NAME_COLUMN diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx index da2e0ab..bcdcbc8 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx @@ -669,6 +669,7 @@ static bool readGMFFile(const char* theFile, tabRef[GmfTriangles] = 3; // for enforced faces tabRef[GmfQuadrilaterals] = 4; tabRef[GmfTetrahedra] = 4; // for new tetras + tabRef[GmfPrisms] = 6; // for new prisms tabRef[GmfHexahedra] = 8; int ver, dim; @@ -848,6 +849,12 @@ static bool readGMFFile(const char* theFile, #endif } } + else if (token == GmfPrisms && nbElem > 0) { + (nbElem <= 1) ? tmpStr = " Prism" : tmpStr = " Prisms"; + for ( int iElem = 0; iElem < nbElem; iElem++ ) + GmfGetLin(InpMsh, token, &id[iElem*tabRef[token]], &id[iElem*tabRef[token]+1], &id[iElem*tabRef[token]+2], &id[iElem*tabRef[token]+3], + &id[iElem*tabRef[token]+4], &id[iElem*tabRef[token]+5], &domainID[iElem]); + } else if (token == GmfHexahedra && nbElem > 0) { (nbElem <= 1) ? tmpStr = " Hexahedron" : tmpStr = " Hexahedra"; for ( int iElem = 0; iElem < nbElem; iElem++ ) @@ -864,6 +871,7 @@ static bool readGMFFile(const char* theFile, case GmfTriangles: case GmfQuadrilaterals: case GmfTetrahedra: + case GmfPrisms: case GmfHexahedra: { std::vector< const SMDS_MeshNode* > node( nbRef ); @@ -950,6 +958,42 @@ static bool readGMFFile(const char* theFile, noID, force3d ); } break; + case GmfPrisms: + if ( hasGeom ) + { + solidID = solidIDByDomain[ domainID[iElem]]; + if ( solidID != HOLE_ID ) + { + aCreatedElem = theHelper->AddVolume( node[0], node[2], node[1], + node[3], node[5], node[4], + noID, force3d ); + theMeshDS->SetMeshElementOnShape( aCreatedElem, solidID ); + for ( int iN = 0; iN < 6; ++iN ) + if ( node[iN]->getshapeId() < 1 ) + theMeshDS->SetNodeInVolume( node[iN], solidID ); + } + } + else + { + if ( elemSearcher ) { + // Issue 0020682. Avoid creating nodes and tetras at place where + // volumic elements already exist + if ( !node[1] || !node[0] || !node[2] || !node[3] || !node[4] || !node[5] ) + continue; + if ( elemSearcher->FindElementsByPoint((SMESH_TNodeXYZ(node[0]) + + SMESH_TNodeXYZ(node[1]) + + SMESH_TNodeXYZ(node[2]) + + SMESH_TNodeXYZ(node[3]) + + SMESH_TNodeXYZ(node[4]) + + SMESH_TNodeXYZ(node[5])) / 6., + SMDSAbs_Volume, foundVolumes )) + break; + } + aCreatedElem = theHelper->AddVolume( node[0], node[2], node[1], + node[3], node[5], node[4], + noID, force3d ); + } + break; case GmfHexahedra: if ( hasGeom ) { @@ -1062,9 +1106,17 @@ static bool writeGMFFile(const char* theMesh HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues & theEnforcedVertices) { MESSAGE("writeGMFFile w/o geometry"); + std::cout << "!!!!!!!!!!!writeGMFFile w/o geometry..." << std::endl; std::string tmpStr; int idx, idxRequired = 0, idxSol = 0; + //tabg each dummyint const int dummyint = 0; + const int dummyint1 = 1; + const int dummyint2 = 2; + const int dummyint3 = 3; + const int dummyint4 = 4; + const int dummyint5 = 5; + const int dummyint6 = 6; //are interesting for layers HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexCoordsValues::const_iterator vertexIt; std::vector enfVertexSizes; const SMDS_MeshElement* elem; @@ -1441,7 +1493,7 @@ static bool writeGMFFile(const char* theMesh std::cout << "Nb vertices: " << theOrderedNodes.size() << std::endl; GmfSetKwd(idx, GmfVertices, theOrderedNodes.size()); //theOrderedNodes.size()+solSize) for (hybridNodeIt = theOrderedNodes.begin();hybridNodeIt != theOrderedNodes.end();++hybridNodeIt) { - GmfSetLin(idx, GmfVertices, (*hybridNodeIt)->X(), (*hybridNodeIt)->Y(), (*hybridNodeIt)->Z(), dummyint); + GmfSetLin(idx, GmfVertices, (*hybridNodeIt)->X(), (*hybridNodeIt)->Y(), (*hybridNodeIt)->Z(), dummyint1); } std::cout << "End writting required nodes in GmfVertices" << std::endl; @@ -1468,7 +1520,7 @@ static bool writeGMFFile(const char* theMesh // int usedEnforcedNodes = 0; // std::string gn = ""; for (hybridNodeIt = theRequiredNodes.begin();hybridNodeIt != theRequiredNodes.end();++hybridNodeIt) { - GmfSetLin(idxRequired, GmfVertices, (*hybridNodeIt)->X(), (*hybridNodeIt)->Y(), (*hybridNodeIt)->Z(), dummyint); + GmfSetLin(idxRequired, GmfVertices, (*hybridNodeIt)->X(), (*hybridNodeIt)->Y(), (*hybridNodeIt)->Z(), dummyint2); GmfSetLin(idxSol, GmfSolAtVertices, ValTab); if (theEnforcedNodes.find((*hybridNodeIt)) != theEnforcedNodes.end()) gn = theEnforcedNodes.find((*hybridNodeIt))->second; @@ -1482,7 +1534,7 @@ static bool writeGMFFile(const char* theMesh std::cout << "enfVertexSizes.at("<second; #ifdef _DEBUG_ @@ -1520,7 +1572,7 @@ static bool writeGMFFile(const char* theMesh nedge[index] = it->second; index++; } - GmfSetLin(idx, GmfEdges, nedge[0], nedge[1], dummyint); + GmfSetLin(idx, GmfEdges, nedge[0], nedge[1], dummyint4); anEdgeGroupByHybridId[usedEnforcedEdges] = theEnforcedEdges.find(elem)->second; // GmfSetLin(idxRequired, GmfEdges, nedge[0], nedge[1], dummyint); usedEnforcedEdges++; @@ -1556,7 +1608,7 @@ static bool writeGMFFile(const char* theMesh ntri[index] = it->second; index++; } - GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint); + GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint5); aFaceGroupByHybridId[k] = ""; } if ( !theHelper.GetMesh()->HasShapeToMesh() ) @@ -1578,7 +1630,7 @@ static bool writeGMFFile(const char* theMesh ntri[index] = it->second; index++; } - GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint); + GmfSetLin(idx, GmfTriangles, ntri[0], ntri[1], ntri[2], dummyint6); aFaceGroupByHybridId[k] = theEnforcedTriangles.find(elem)->second; usedEnforcedTriangles++; } @@ -3036,14 +3088,14 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, TCollection_AsciiString cmd( (char*)HYBRIDPlugin_Hypothesis::CommandToRun( _hyp ).c_str() ); cmd += TCollection_AsciiString(" --in ") + aGMFFileName; - if ( nbEnforcedVertices + nbEnforcedNodes) - cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired; + //if ( nbEnforcedVertices + nbEnforcedNodes) + // cmd += TCollection_AsciiString(" --required_vertices ") + aGenericNameRequired; cmd += TCollection_AsciiString(" --out ") + aResultFileName; if ( !_logInStandardOutput ) cmd += TCollection_AsciiString(" 1>" ) + aLogFileName; // dump into file std::cout << std::endl; - std::cout << "Hybrid execution..." << std::endl; + std::cout << "Hybrid execution with geometry..." << std::endl; std::cout << cmd << std::endl; _compute_canceled = false; @@ -3310,7 +3362,7 @@ bool HYBRIDPlugin_HYBRID::Compute(SMESH_Mesh& theMesh, cmd += TCollection_AsciiString(" 1>" ) + aLogFileName; // dump into file std::cout << std::endl; - std::cout << "Hybrid execution..." << std::endl; + std::cout << "Hybrid execution w/o geometry..." << std::endl; std::cout << cmd << std::endl; _compute_canceled = false; diff --git a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx index 8fb9b63..3f9f83b 100644 --- a/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx +++ b/src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx @@ -1772,6 +1772,8 @@ std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* // cmd += 0; //TODO hyp->my; //} + cmd += " --boundary_layers_surface_ids 6 "; //as triangles of enforced mesh + if ( !p_blsd && hyp ) { if ( hyp->myBoundaryLayersGrowth >= 0 && hyp->myBoundaryLayersGrowth <= 1 ) { const char* value[] = { "1" , "-1" };