]> SALOME platform Git repositories - plugins/hybridplugin.git/commitdiff
Salome HOME
select faces group for layer ok
authorChristian Van Wambeke <christian.van-wambeke@cea.fr>
Thu, 3 Jul 2014 06:51:34 +0000 (08:51 +0200)
committerChristian Van Wambeke <christian.van-wambeke@cea.fr>
Thu, 3 Jul 2014 06:51:34 +0000 (08:51 +0200)
src/GUI/HYBRIDPluginGUI_HypothesisCreator.cxx
src/GUI/HYBRIDPlugin_msg_en.ts
src/HYBRIDPlugin/HYBRIDPlugin_HYBRID.cxx
src/HYBRIDPlugin/HYBRIDPlugin_Hypothesis.cxx

index 36643b82fab53b9ca387d22e314ec272568e6ce0..a0ab956e238cfe36a694286b3614e689ba80d009 100644 (file)
@@ -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 );
 
index 08d3254b48a552349bb7de62df0e8f1cca957340..520200a290bcc5a185e13d5078aaa42b8174be39 100644 (file)
     </message>
     <message>
         <source>HYBRID_ENFORCED_MESHES</source>
-        <translation>Enforced meshes</translation>
+        <translation>Layers meshes</translation>
     </message>
     <message>
         <source>HYBRID_ENF_NAME_COLUMN</source>
index da2e0ab342381bfb1c9edf07a93df6c23e388144..bcdcbc844ea45376c40a51d46574c724f4b88f87 100644 (file)
@@ -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<double> 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("<<i<<"): " << enfVertexSizes.at(i) << std::endl;
 #endif
       double solTab[] = {enfVertexSizes.at(i)};
-      GmfSetLin(idxRequired, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint);
+      GmfSetLin(idxRequired, GmfVertices, ReqVerTab[i][0], ReqVerTab[i][1], ReqVerTab[i][2], dummyint3);
       GmfSetLin(idxSol, GmfSolAtVertices, solTab);
       aNodeGroupByHybridId[usedEnforcedNodes] = enfVerticesWithGroup.find(ReqVerTab[i])->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;
index 8fb9b6347b61ba33c7e7294af79bbbd7acb37109..3f9f83b802699af7fdde45d421c256192b5ff845 100644 (file)
@@ -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" };