1 // Copyright (C) 2004-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //=============================================================================
21 // File : GHS3DPlugin_Hypothesis.cxx
22 // Created : Wed Apr 2 12:36:29 2008
23 // Author : Edward AGAPOV (eap)
24 //=============================================================================
26 #include "GHS3DPlugin_Hypothesis.hxx"
28 #include <SMESHDS_Mesh.hxx>
30 #include <TCollection_AsciiString.hxx>
34 #define getpid _getpid
39 //=======================================================================
40 //function : GHS3DPlugin_Hypothesis
41 //=======================================================================
43 GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen)
44 : SMESH_Hypothesis(hypId, studyId, gen),
45 myToMeshHoles(DefaultMeshHoles()),
46 myToMakeGroupsOfDomains(DefaultToMakeGroupsOfDomains()),
49 myOptimizationLevel(DefaultOptimizationLevel()),
50 myKeepFiles(DefaultKeepFiles()),
51 myWorkingDirectory(DefaultWorkingDirectory()),
52 myVerboseLevel(DefaultVerboseLevel()),
53 myToCreateNewNodes(DefaultToCreateNewNodes()),
54 myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()),
55 myToUseFemCorrection(DefaultToUseFEMCorrection()),
56 myToRemoveCentralPoint(DefaultToRemoveCentralPoint()),
57 myLogInStandardOutput(DefaultStandardOutputLog()),
58 myRemoveLogOnSuccess( DefaultRemoveLogOnSuccess() ),
59 myGradation(DefaultGradation()),
60 _enfVertexList(DefaultGHS3DEnforcedVertexList()),
61 _enfVertexCoordsSizeList(DefaultGHS3DEnforcedVertexCoordsValues()),
62 _enfVertexEntrySizeList(DefaultGHS3DEnforcedVertexEntryValues()),
63 _coordsEnfVertexMap(DefaultCoordsGHS3DEnforcedVertexMap()),
64 _geomEntryEnfVertexMap(DefaultGeomEntryGHS3DEnforcedVertexMap()),
65 _enfMeshList(DefaultGHS3DEnforcedMeshList()),
66 _entryEnfMeshMap(DefaultEntryGHS3DEnforcedMeshListMap()),
67 _enfNodes(TIDSortedNodeGroupMap()),
68 _enfEdges(TIDSortedElemGroupMap()),
69 _enfTriangles(TIDSortedElemGroupMap()),
70 _nodeIDToSizeMap(DefaultID2SizeMap()),
71 _groupsToRemove(DefaultGroupsToRemove())
77 //=======================================================================
78 //function : SetToMeshHoles
79 //=======================================================================
81 void GHS3DPlugin_Hypothesis::SetToMeshHoles(bool toMesh)
83 if ( myToMeshHoles != toMesh ) {
84 myToMeshHoles = toMesh;
85 NotifySubMeshesHypothesisModification();
89 //=======================================================================
90 //function : GetToMeshHoles
91 //=======================================================================
93 bool GHS3DPlugin_Hypothesis::GetToMeshHoles(bool checkFreeOption) const
95 if (checkFreeOption && !myTextOption.empty()) {
96 if ( myTextOption.find("--components all"))
98 if ( myTextOption.find("--components outside_components"))
101 return myToMeshHoles;
104 //=======================================================================
105 //function : SetToMakeGroupsOfDomains
106 //=======================================================================
108 void GHS3DPlugin_Hypothesis::SetToMakeGroupsOfDomains(bool toMakeGroups)
110 if ( myToMakeGroupsOfDomains != toMakeGroups ) {
111 myToMakeGroupsOfDomains = toMakeGroups;
112 NotifySubMeshesHypothesisModification();
116 //=======================================================================
117 //function : GetToMakeGroupsOfDomains
118 //=======================================================================
120 bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains() const
122 return myToMakeGroupsOfDomains;
125 //=======================================================================
126 //function : GetToMakeGroupsOfDomains
127 //=======================================================================
129 bool GHS3DPlugin_Hypothesis::GetToMakeGroupsOfDomains(const GHS3DPlugin_Hypothesis* hyp)
132 if ( hyp ) res = /*hyp->GetToMeshHoles(true) &&*/ hyp->GetToMakeGroupsOfDomains();
133 else res = /*DefaultMeshHoles() &&*/ DefaultToMakeGroupsOfDomains();
137 //=======================================================================
138 //function : SetMaximumMemory
139 //=======================================================================
141 void GHS3DPlugin_Hypothesis::SetMaximumMemory(float MB)
143 if ( myMaximumMemory != MB ) {
144 myMaximumMemory = MB;
145 NotifySubMeshesHypothesisModification();
149 //=======================================================================
150 //function : GetMaximumMemory
151 // * automatic memory adjustment mode. Default is zero
152 //=======================================================================
154 float GHS3DPlugin_Hypothesis::GetMaximumMemory() const
156 return myMaximumMemory;
159 //=======================================================================
160 //function : SetInitialMemory
161 //=======================================================================
163 void GHS3DPlugin_Hypothesis::SetInitialMemory(float MB)
165 if ( myInitialMemory != MB ) {
166 myInitialMemory = MB;
167 NotifySubMeshesHypothesisModification();
171 //=======================================================================
172 //function : GetInitialMemory
173 //=======================================================================
175 float GHS3DPlugin_Hypothesis::GetInitialMemory() const
177 return myInitialMemory;
180 //=======================================================================
181 //function : SetOptimizationLevel
182 //=======================================================================
184 void GHS3DPlugin_Hypothesis::SetOptimizationLevel(OptimizationLevel level)
186 if ( myOptimizationLevel != level ) {
187 myOptimizationLevel = level;
188 NotifySubMeshesHypothesisModification();
192 //=======================================================================
193 //function : GetOptimizationLevel
194 //=======================================================================
196 GHS3DPlugin_Hypothesis::OptimizationLevel GHS3DPlugin_Hypothesis::GetOptimizationLevel() const
198 return (OptimizationLevel) myOptimizationLevel;
201 //=======================================================================
202 //function : SetWorkingDirectory
203 //=======================================================================
205 void GHS3DPlugin_Hypothesis::SetWorkingDirectory(const std::string& path)
207 if ( myWorkingDirectory != path ) {
208 myWorkingDirectory = path;
209 NotifySubMeshesHypothesisModification();
213 //=======================================================================
214 //function : GetWorkingDirectory
215 //=======================================================================
217 std::string GHS3DPlugin_Hypothesis::GetWorkingDirectory() const
219 return myWorkingDirectory;
222 //=======================================================================
223 //function : SetKeepFiles
224 //=======================================================================
226 void GHS3DPlugin_Hypothesis::SetKeepFiles(bool toKeep)
228 if ( myKeepFiles != toKeep ) {
229 myKeepFiles = toKeep;
230 NotifySubMeshesHypothesisModification();
234 //=======================================================================
235 //function : GetKeepFiles
236 //=======================================================================
238 bool GHS3DPlugin_Hypothesis::GetKeepFiles() const
243 //=======================================================================
244 //function : SetVerboseLevel
245 //=======================================================================
247 void GHS3DPlugin_Hypothesis::SetVerboseLevel(short level)
249 if ( myVerboseLevel != level ) {
250 myVerboseLevel = level;
251 NotifySubMeshesHypothesisModification();
255 //=======================================================================
256 //function : GetVerboseLevel
257 //=======================================================================
259 short GHS3DPlugin_Hypothesis::GetVerboseLevel() const
261 return myVerboseLevel;
264 //=======================================================================
265 //function : SetToCreateNewNodes
266 //=======================================================================
268 void GHS3DPlugin_Hypothesis::SetToCreateNewNodes(bool toCreate)
270 if ( myToCreateNewNodes != toCreate ) {
271 myToCreateNewNodes = toCreate;
272 NotifySubMeshesHypothesisModification();
276 //=======================================================================
277 //function : GetToCreateNewNodes
278 //=======================================================================
280 bool GHS3DPlugin_Hypothesis::GetToCreateNewNodes() const
282 return myToCreateNewNodes;
285 //=======================================================================
286 //function : SetToUseBoundaryRecoveryVersion
287 //=======================================================================
289 void GHS3DPlugin_Hypothesis::SetToUseBoundaryRecoveryVersion(bool toUse)
291 if ( myToUseBoundaryRecoveryVersion != toUse ) {
292 myToUseBoundaryRecoveryVersion = toUse;
293 NotifySubMeshesHypothesisModification();
297 //=======================================================================
298 //function : GetToUseBoundaryRecoveryVersion
299 //=======================================================================
301 bool GHS3DPlugin_Hypothesis::GetToUseBoundaryRecoveryVersion() const
303 return myToUseBoundaryRecoveryVersion;
306 //=======================================================================
307 //function : SetFEMCorrection
308 //=======================================================================
310 void GHS3DPlugin_Hypothesis::SetFEMCorrection(bool toUseFem)
312 if ( myToUseFemCorrection != toUseFem ) {
313 myToUseFemCorrection = toUseFem;
314 NotifySubMeshesHypothesisModification();
318 //=======================================================================
319 //function : GetFEMCorrection
320 //=======================================================================
322 bool GHS3DPlugin_Hypothesis::GetFEMCorrection() const
324 return myToUseFemCorrection;
327 //=======================================================================
328 //function : SetToRemoveCentralPoint
329 //=======================================================================
331 void GHS3DPlugin_Hypothesis::SetToRemoveCentralPoint(bool toRemove)
333 if ( myToRemoveCentralPoint != toRemove ) {
334 myToRemoveCentralPoint = toRemove;
335 NotifySubMeshesHypothesisModification();
339 //=======================================================================
340 //function : GetToRemoveCentralPoint
341 //=======================================================================
343 bool GHS3DPlugin_Hypothesis::GetToRemoveCentralPoint() const
345 return myToRemoveCentralPoint;
348 //=======================================================================
349 //function : SetAdvancedOption
350 //=======================================================================
352 void GHS3DPlugin_Hypothesis::SetAdvancedOption(const std::string& option)
354 if ( myTextOption != option ) {
355 myTextOption = option;
356 NotifySubMeshesHypothesisModification();
360 //=======================================================================
361 //function : GetAdvancedOption
362 //=======================================================================
364 std::string GHS3DPlugin_Hypothesis::GetAdvancedOption() const
369 //=======================================================================
370 //function : SetGradation
371 //=======================================================================
373 void GHS3DPlugin_Hypothesis::SetGradation(double gradation)
375 if ( myGradation != gradation ) {
376 myGradation = gradation;
377 NotifySubMeshesHypothesisModification();
381 //=======================================================================
382 //function : GetGradation
383 //=======================================================================
385 double GHS3DPlugin_Hypothesis::GetGradation() const
390 //=======================================================================
391 //function : SetStandardOutputLog
392 //=======================================================================
394 void GHS3DPlugin_Hypothesis::SetStandardOutputLog(bool logInStandardOutput)
396 if ( myLogInStandardOutput != logInStandardOutput ) {
397 myLogInStandardOutput = logInStandardOutput;
398 NotifySubMeshesHypothesisModification();
402 //=======================================================================
403 //function : GetStandardOutputLog
404 //=======================================================================
406 bool GHS3DPlugin_Hypothesis::GetStandardOutputLog() const
408 return myLogInStandardOutput;
411 //=======================================================================
412 //function : SetRemoveLogOnSuccess
413 //=======================================================================
415 void GHS3DPlugin_Hypothesis::SetRemoveLogOnSuccess(bool removeLogOnSuccess)
417 if ( myRemoveLogOnSuccess != removeLogOnSuccess ) {
418 myRemoveLogOnSuccess = removeLogOnSuccess;
419 NotifySubMeshesHypothesisModification();
423 //=======================================================================
424 //function : GetRemoveLogOnSuccess
425 //=======================================================================
427 bool GHS3DPlugin_Hypothesis::GetRemoveLogOnSuccess() const
429 return myRemoveLogOnSuccess;
432 //=======================================================================
433 //function : SetEnforcedVertex
434 //=======================================================================
436 bool GHS3DPlugin_Hypothesis::SetEnforcedVertex(std::string theName,
437 std::string theEntry,
438 std::string theGroupName,
440 double x, double y, double z,
443 MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedVertex(\""<< theName << "\", \""<< theEntry << "\", \"" << theGroupName << "\", "
444 << size << ", " << x << ", " << y << ", " << z << ", "<< isCompound << ")");
446 bool toNotify = false;
447 bool toCreate = true;
449 TGHS3DEnforcedVertex *oldEnVertex;
450 TGHS3DEnforcedVertex *newEnfVertex = new TGHS3DEnforcedVertex();
451 newEnfVertex->name = theName;
452 newEnfVertex->geomEntry = theEntry;
453 newEnfVertex->coords.clear();
455 newEnfVertex->coords.push_back(x);
456 newEnfVertex->coords.push_back(y);
457 newEnfVertex->coords.push_back(z);
459 newEnfVertex->groupName = theGroupName;
460 newEnfVertex->size = size;
461 newEnfVertex->isCompound = isCompound;
464 // update _enfVertexList
465 TGHS3DEnforcedVertexList::iterator it = _enfVertexList.find(newEnfVertex);
466 if (it != _enfVertexList.end()) {
469 MESSAGE("Enforced Vertex was found => Update");
470 if (oldEnVertex->name != theName) {
471 MESSAGE("Update name from \"" << oldEnVertex->name << "\" to \"" << theName << "\"");
472 oldEnVertex->name = theName;
475 if (oldEnVertex->groupName != theGroupName) {
476 MESSAGE("Update group name from \"" << oldEnVertex->groupName << "\" to \"" << theGroupName << "\"");
477 oldEnVertex->groupName = theGroupName;
480 if (oldEnVertex->size != size) {
481 MESSAGE("Update size from \"" << oldEnVertex->size << "\" to \"" << size << "\"");
482 oldEnVertex->size = size;
486 // update map coords / enf vertex if needed
487 if (oldEnVertex->coords.size()) {
488 _coordsEnfVertexMap[oldEnVertex->coords] = oldEnVertex;
489 _enfVertexCoordsSizeList[oldEnVertex->coords] = size;
492 // update map geom entry / enf vertex if needed
493 if (oldEnVertex->geomEntry != "") {
494 _geomEntryEnfVertexMap[oldEnVertex->geomEntry] = oldEnVertex;
495 _enfVertexEntrySizeList[oldEnVertex->geomEntry] = size;
500 // //////// CREATE ////////////
503 MESSAGE("Creating new enforced vertex");
504 _enfVertexList.insert(newEnfVertex);
505 if (theEntry == "") {
506 _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex;
507 _enfVertexCoordsSizeList[newEnfVertex->coords] = size;
510 _geomEntryEnfVertexMap[newEnfVertex->geomEntry] = newEnfVertex;
511 _enfVertexEntrySizeList[newEnfVertex->geomEntry] = size;
516 NotifySubMeshesHypothesisModification();
518 MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedVertex END");
523 //=======================================================================
524 //function : SetEnforcedMesh
525 //=======================================================================
526 bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
528 TIDSortedElemSet theElemSet;
529 SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
530 while ( eIt->more() )
531 theElemSet.insert( eIt->next() );
532 MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source mesh");
533 bool added = SetEnforcedElements( theElemSet, elementType, groupName);
535 TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
536 newEnfMesh->persistID = theMesh.GetMeshDS()->GetPersistentId();
537 newEnfMesh->name = name;
538 newEnfMesh->entry = entry;
539 newEnfMesh->elementType = elementType;
540 newEnfMesh->groupName = groupName;
542 TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
543 if (it == _enfMeshList.end()) {
544 _entryEnfMeshMap[entry].insert(newEnfMesh);
545 _enfMeshList.insert(newEnfMesh);
554 //=======================================================================
555 //function : SetEnforcedGroup
556 //=======================================================================
557 bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
559 MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedGroup");
560 TIDSortedElemSet theElemSet;
561 if ( theIDs->length() == 0 ){MESSAGE("The source group is empty");}
562 for ( CORBA::ULong i=0; i < theIDs->length(); i++) {
563 CORBA::Long ind = theIDs[i];
564 if (elementType == SMESH::NODE)
566 const SMDS_MeshNode * node = theMeshDS->FindNode(ind);
568 theElemSet.insert( node );
572 const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
574 theElemSet.insert( elem );
578 // SMDS_ElemIteratorPtr it = theGroup->GetGroupDS()->GetElements();
579 // while ( it->more() )
580 // theElemSet.insert( it->next() );
582 MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source group ");
583 bool added = SetEnforcedElements( theElemSet, elementType, groupName);
585 TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
586 newEnfMesh->name = name;
587 newEnfMesh->entry = entry;
588 newEnfMesh->elementType = elementType;
589 newEnfMesh->groupName = groupName;
591 TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
592 if (it == _enfMeshList.end()) {
593 _entryEnfMeshMap[entry].insert(newEnfMesh);
594 _enfMeshList.insert(newEnfMesh);
600 //=======================================================================
601 //function : SetEnforcedElements
602 //=======================================================================
603 bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName)
605 MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedElements");
606 TIDSortedElemSet::const_iterator it = theElemSet.begin();
607 const SMDS_MeshElement* elem;
608 const SMDS_MeshNode* node;
610 pair<TIDSortedNodeGroupMap::iterator,bool> nodeRet;
611 pair<TIDSortedElemGroupMap::iterator,bool> elemRet;
613 for (;it != theElemSet.end();++it)
616 switch (elementType) {
618 node = dynamic_cast<const SMDS_MeshNode*>(elem);
620 nodeRet = _enfNodes.insert(make_pair(node,groupName));
621 added = added && nodeRet.second;
622 string msg = added ? "yes":"no";
623 MESSAGE( "Node (" <<node->X()<<","<<node->Y()<<","<<node->Z()<< ") with ID " << node->GetID() <<" added ? " << msg);
626 SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
627 for (;nodeIt->more();) {
628 node = dynamic_cast<const SMDS_MeshNode*>(nodeIt->next());
629 nodeRet = _enfNodes.insert(make_pair(node,groupName));
630 added = added && nodeRet.second;
636 if (elem->GetType() == SMDSAbs_Edge) {
637 elemRet = _enfEdges.insert(make_pair(elem,groupName));
638 added = added && elemRet.second;
640 else if (elem->GetType() > SMDSAbs_Edge) {
641 SMDS_ElemIteratorPtr it = elem->edgesIterator();
643 const SMDS_MeshElement* anEdge = it->next();
644 elemRet = _enfEdges.insert(make_pair(anEdge,groupName));
645 added = added && elemRet.second;
650 if (elem->GetType() == SMDSAbs_Face)
652 if (elem->NbCornerNodes() == 3) {
653 elemRet = _enfTriangles.insert(make_pair(elem,groupName));
654 added = added && elemRet.second;
657 else if (elem->GetType() > SMDSAbs_Face) { // Group of faces
658 SMDS_ElemIteratorPtr it = elem->facesIterator();
660 const SMDS_MeshElement* aFace = it->next();
661 if (aFace->NbCornerNodes() == 3) {
662 elemRet = _enfTriangles.insert(make_pair(aFace,groupName));
663 added = added && elemRet.second;
673 NotifySubMeshesHypothesisModification();
678 //=======================================================================
679 //function : GetEnforcedVertex
680 //=======================================================================
682 GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* GHS3DPlugin_Hypothesis::GetEnforcedVertex(double x, double y, double z)
683 throw (std::invalid_argument)
685 std::vector<double> coord(3);
689 if (_coordsEnfVertexMap.count(coord)>0)
690 return _coordsEnfVertexMap[coord];
691 std::ostringstream msg ;
692 msg << "No enforced vertex at " << x << ", " << y << ", " << z;
693 throw std::invalid_argument(msg.str());
696 GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* GHS3DPlugin_Hypothesis::GetEnforcedVertex(const std::string theEntry)
697 throw (std::invalid_argument)
699 if (_geomEntryEnfVertexMap.count(theEntry)>0)
700 return _geomEntryEnfVertexMap[theEntry];
702 std::ostringstream msg ;
703 msg << "No enforced vertex with entry " << theEntry;
704 throw std::invalid_argument(msg.str());
707 //=======================================================================
708 //function : RemoveEnforcedVertex
709 //=======================================================================
711 bool GHS3DPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z, const std::string theEntry)
712 throw (std::invalid_argument)
714 bool toNotify = false;
715 std::ostringstream msg;
716 TGHS3DEnforcedVertex *oldEnfVertex;
717 std::vector<double> coords(3);
722 // check that enf vertex with given enf vertex entry exists
723 TGeomEntryGHS3DEnforcedVertexMap::iterator it_enfVertexEntry = _geomEntryEnfVertexMap.find(theEntry);
724 if (it_enfVertexEntry != _geomEntryEnfVertexMap.end()) {
726 MESSAGE("Found enforced vertex with geom entry " << theEntry);
727 oldEnfVertex = it_enfVertexEntry->second;
728 _geomEntryEnfVertexMap.erase(it_enfVertexEntry);
731 MESSAGE("Enforced vertex with geom entry " << theEntry << " not found");
732 // check that enf vertex with given coords exists
733 TCoordsGHS3DEnforcedVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
734 if (it_coords_enf != _coordsEnfVertexMap.end()) {
736 MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z);
737 oldEnfVertex = it_coords_enf->second;
738 _coordsEnfVertexMap.erase(it_coords_enf);
739 _enfVertexCoordsSizeList.erase(_enfVertexCoordsSizeList.find(coords));
742 MESSAGE("Enforced vertex with coords " << x << ", " << y << ", " << z << " not found");
743 throw std::invalid_argument(msg.str());
747 MESSAGE("Remove enf vertex from _enfVertexList");
749 // update _enfVertexList
750 TGHS3DEnforcedVertexList::iterator it = _enfVertexList.find(oldEnfVertex);
751 if (it != _enfVertexList.end()) {
752 if ((*it)->groupName != "")
753 _groupsToRemove.insert((*it)->groupName);
754 _enfVertexList.erase(it);
760 NotifySubMeshesHypothesisModification();
765 //=======================================================================
766 //function : ClearEnforcedVertices
767 //=======================================================================
768 void GHS3DPlugin_Hypothesis::ClearEnforcedVertices()
770 TGHS3DEnforcedVertexList::const_iterator it = _enfVertexList.begin();
771 for(;it != _enfVertexList.end();++it) {
772 if ((*it)->groupName != "")
773 _groupsToRemove.insert((*it)->groupName);
775 _enfVertexList.clear();
776 _coordsEnfVertexMap.clear();
777 _geomEntryEnfVertexMap.clear();
778 _enfVertexCoordsSizeList.clear();
779 _enfVertexEntrySizeList.clear();
780 NotifySubMeshesHypothesisModification();
783 //=======================================================================
784 //function : ClearEnforcedMeshes
785 //=======================================================================
786 void GHS3DPlugin_Hypothesis::ClearEnforcedMeshes()
788 TGHS3DEnforcedMeshList::const_iterator it = _enfMeshList.begin();
789 for(;it != _enfMeshList.end();++it) {
790 if ((*it)->groupName != "")
791 _groupsToRemove.insert((*it)->groupName);
795 _enfTriangles.clear();
796 _nodeIDToSizeMap.clear();
797 _enfMeshList.clear();
798 _entryEnfMeshMap.clear();
799 NotifySubMeshesHypothesisModification();
802 //================================================================================
804 * \brief At mesh loading, restore enforced elements by just loaded enforced meshes
806 //================================================================================
808 void GHS3DPlugin_Hypothesis::RestoreEnfElemsByMeshes()
810 TGHS3DEnforcedMeshList::const_iterator it = _enfMeshList.begin();
811 for(;it != _enfMeshList.end();++it) {
812 TGHS3DEnforcedMesh* enfMesh = *it;
813 if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
814 SetEnforcedMesh( *mesh,
815 enfMesh->elementType,
818 enfMesh->groupName );
819 enfMesh->persistID = -1; // not to restore again
823 //=======================================================================
824 //function : SetGroupsToRemove
825 //=======================================================================
827 void GHS3DPlugin_Hypothesis::ClearGroupsToRemove()
829 _groupsToRemove.clear();
833 //=======================================================================
834 //function : DefaultMeshHoles
835 //=======================================================================
837 bool GHS3DPlugin_Hypothesis::DefaultMeshHoles()
839 return false; // PAL19680
842 //=======================================================================
843 //function : DefaultToMakeGroupsOfDomains
844 //=======================================================================
846 bool GHS3DPlugin_Hypothesis::DefaultToMakeGroupsOfDomains()
848 return false; // issue 0022172
851 //=======================================================================
852 //function : DefaultMaximumMemory
853 //=======================================================================
857 #elif !defined(__APPLE__)
858 #include <sys/sysinfo.h>
861 float GHS3DPlugin_Hypothesis::DefaultMaximumMemory()
864 // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
865 MEMORYSTATUSEX statex;
866 statex.dwLength = sizeof (statex);
867 long err = GlobalMemoryStatusEx (&statex);
869 double totMB = (double)statex.ullAvailPhys / 1024. / 1024.;
870 return (float)( 0.7 * totMB );
872 #elif !defined(__APPLE__)
874 long err = sysinfo( &si );
876 long ramMB = si.totalram * si.mem_unit / 1024 / 1024;
877 return ( 0.7 * ramMB );
883 //=======================================================================
884 //function : DefaultInitialMemory
885 //=======================================================================
887 float GHS3DPlugin_Hypothesis::DefaultInitialMemory()
889 return DefaultMaximumMemory();
892 //=======================================================================
893 //function : DefaultOptimizationLevel
894 //=======================================================================
896 short GHS3DPlugin_Hypothesis::DefaultOptimizationLevel()
901 //=======================================================================
902 //function : DefaultWorkingDirectory
903 //=======================================================================
905 std::string GHS3DPlugin_Hypothesis::DefaultWorkingDirectory()
907 TCollection_AsciiString aTmpDir;
909 char *Tmp_dir = getenv("SALOME_TMP_DIR");
910 if(Tmp_dir != NULL) {
915 aTmpDir = TCollection_AsciiString("C:\\");
917 aTmpDir = TCollection_AsciiString("/tmp/");
920 return aTmpDir.ToCString();
923 //=======================================================================
924 //function : DefaultKeepFiles
925 //=======================================================================
927 bool GHS3DPlugin_Hypothesis::DefaultKeepFiles()
932 //=======================================================================
933 //function : DefaultRemoveLogOnSuccess
934 //=======================================================================
936 bool GHS3DPlugin_Hypothesis::DefaultRemoveLogOnSuccess()
942 //=======================================================================
943 //function : DefaultVerboseLevel
944 //=======================================================================
946 short GHS3DPlugin_Hypothesis::DefaultVerboseLevel()
951 //=======================================================================
952 //function : DefaultToCreateNewNodes
953 //=======================================================================
955 bool GHS3DPlugin_Hypothesis::DefaultToCreateNewNodes()
960 //=======================================================================
961 //function : DefaultToUseBoundaryRecoveryVersion
962 //=======================================================================
964 bool GHS3DPlugin_Hypothesis::DefaultToUseBoundaryRecoveryVersion()
969 //=======================================================================
970 //function : DefaultToUseFEMCorrection
971 //=======================================================================
973 bool GHS3DPlugin_Hypothesis::DefaultToUseFEMCorrection()
978 //=======================================================================
979 //function : DefaultToRemoveCentralPoint
980 //=======================================================================
982 bool GHS3DPlugin_Hypothesis::DefaultToRemoveCentralPoint()
987 //=======================================================================
988 //function : DefaultGradation
989 //=======================================================================
991 double GHS3DPlugin_Hypothesis::DefaultGradation()
996 //=======================================================================
997 //function : DefaultStandardOutputLog
998 //=======================================================================
1000 bool GHS3DPlugin_Hypothesis::DefaultStandardOutputLog()
1005 // //=======================================================================
1006 // //function : DefaultID2SizeMap
1007 // //=======================================================================
1009 // GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::DefaultID2SizeMap()
1011 // return GHS3DPlugin_Hypothesis::TID2SizeMap();
1015 //=======================================================================
1017 //=======================================================================
1019 std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save)
1021 save << (int) myToMeshHoles << " ";
1022 save << myMaximumMemory << " ";
1023 save << myInitialMemory << " ";
1024 save << myOptimizationLevel << " ";
1025 save << myWorkingDirectory << " ";
1026 save << (int)myKeepFiles << " ";
1027 save << myVerboseLevel << " ";
1028 save << (int)myToCreateNewNodes << " ";
1029 save << (int)myToUseBoundaryRecoveryVersion << " ";
1030 save << (int)myToUseFemCorrection << " ";
1031 save << (int)myToRemoveCentralPoint << " ";
1032 save << myGradation << " ";
1033 save << myToMakeGroupsOfDomains << " ";
1034 if (!myTextOption.empty()) {
1035 save << "__OPTIONS_BEGIN__ ";
1036 save << myTextOption << " ";
1037 save << "__OPTIONS_END__ ";
1041 TGHS3DEnforcedVertexList::iterator it = _enfVertexList.begin();
1042 if (it != _enfVertexList.end()) {
1043 save << " " << "__ENFORCED_VERTICES_BEGIN__ ";
1044 for ( ; it != _enfVertexList.end(); ++it ) {
1045 TGHS3DEnforcedVertex *enfVertex = (*it);
1046 save << " " << "__BEGIN_VERTEX__";
1047 if (!enfVertex->name.empty()) {
1048 save << " " << "__BEGIN_NAME__";
1049 save << " " << enfVertex->name;
1050 save << " " << "__END_NAME__";
1052 if (!enfVertex->geomEntry.empty()) {
1053 save << " " << "__BEGIN_ENTRY__";
1054 save << " " << enfVertex->geomEntry;
1055 save << " " << enfVertex->isCompound;
1056 save << " " << "__END_ENTRY__";
1058 if (!enfVertex->groupName.empty()) {
1059 save << " " << "__BEGIN_GROUP__";
1060 save << " " << enfVertex->groupName;
1061 save << " " << "__END_GROUP__";
1063 if (enfVertex->coords.size()) {
1064 save << " " << "__BEGIN_COORDS__";
1065 for ( size_t i = 0; i < enfVertex->coords.size(); i++ )
1066 save << " " << enfVertex->coords[i];
1067 save << " " << "__END_COORDS__";
1069 save << " " << "__BEGIN_SIZE__";
1070 save << " " << enfVertex->size;
1071 save << " " << "__END_SIZE__";
1072 save << " " << "__END_VERTEX__";
1074 save << " " << "__ENFORCED_VERTICES_END__ ";
1077 TGHS3DEnforcedMeshList::iterator it_mesh = _enfMeshList.begin();
1078 if (it_mesh != _enfMeshList.end()) {
1079 save << " " << "__ENFORCED_MESHES_BEGIN__ ";
1080 for ( ; it_mesh != _enfMeshList.end(); ++it_mesh ) {
1081 TGHS3DEnforcedMesh *enfMesh = (*it_mesh);
1082 save << " " << "__BEGIN_ENF_MESH__";
1084 save << " " << "__BEGIN_NAME__";
1085 save << " " << enfMesh->name;
1086 save << " " << "__END_NAME__";
1088 save << " " << "__BEGIN_ENTRY__";
1089 save << " " << enfMesh->entry;
1090 save << " " << "__END_ENTRY__";
1092 save << " " << "__BEGIN_ELEM_TYPE__";
1093 save << " " << (int)enfMesh->elementType;
1094 save << " " << "__END_ELEM_TYPE__";
1096 if (!enfMesh->groupName.empty()) {
1097 save << " " << "__BEGIN_GROUP__";
1098 save << " " << enfMesh->groupName;
1099 save << " " << "__END_GROUP__";
1101 save << " " << "__PERSIST_ID__";
1102 save << " " << enfMesh->persistID;
1103 save << " " << "__END_ENF_MESH__";
1104 std::cout << "Saving of enforced mesh " << enfMesh->name.c_str() << " done" << std::endl;
1106 save << " " << "__ENFORCED_MESHES_END__ ";
1111 //=======================================================================
1112 //function : LoadFrom
1113 //=======================================================================
1115 std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
1121 isOK = static_cast<bool>(load >> i);
1125 load.clear(ios::badbit | load.rdstate());
1127 isOK = static_cast<bool>(load >> d);
1129 myMaximumMemory = d;
1131 load.clear(ios::badbit | load.rdstate());
1133 isOK = static_cast<bool>(load >> d);
1135 myInitialMemory = d;
1137 load.clear(ios::badbit | load.rdstate());
1139 isOK = static_cast<bool>(load >> i);
1141 myOptimizationLevel = i;
1143 load.clear(ios::badbit | load.rdstate());
1145 isOK = static_cast<bool>(load >> myWorkingDirectory);
1147 if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
1148 myKeepFiles = false;
1149 myWorkingDirectory.clear();
1151 else if ( myWorkingDirectory == "1" ) {
1153 myWorkingDirectory.clear();
1157 load.clear(ios::badbit | load.rdstate());
1159 if ( !myWorkingDirectory.empty() ) {
1160 isOK = static_cast<bool>(load >> i);
1164 load.clear(ios::badbit | load.rdstate());
1167 isOK = static_cast<bool>(load >> i);
1169 myVerboseLevel = (short) i;
1171 load.clear(ios::badbit | load.rdstate());
1173 isOK = static_cast<bool>(load >> i);
1175 myToCreateNewNodes = (bool) i;
1177 load.clear(ios::badbit | load.rdstate());
1179 isOK = static_cast<bool>(load >> i);
1181 myToUseBoundaryRecoveryVersion = (bool) i;
1183 load.clear(ios::badbit | load.rdstate());
1185 isOK = static_cast<bool>(load >> i);
1187 myToUseFemCorrection = (bool) i;
1189 load.clear(ios::badbit | load.rdstate());
1191 isOK = static_cast<bool>(load >> i);
1193 myToRemoveCentralPoint = (bool) i;
1195 load.clear(ios::badbit | load.rdstate());
1197 isOK = static_cast<bool>(load >> d);
1201 load.clear(ios::badbit | load.rdstate());
1203 std::string separator;
1204 bool hasOptions = false;
1205 bool hasEnforcedVertices = false;
1206 bool hasEnforcedMeshes = false;
1207 isOK = static_cast<bool>(load >> separator);
1209 if ( isOK && ( separator == "0" || separator == "1" ))
1211 myToMakeGroupsOfDomains = ( separator == "1" );
1212 isOK = static_cast<bool>(load >> separator);
1216 if (separator == "__OPTIONS_BEGIN__")
1218 else if (separator == "__ENFORCED_VERTICES_BEGIN__")
1219 hasEnforcedVertices = true;
1220 else if (separator == "__ENFORCED_MESHES_BEGIN__")
1221 hasEnforcedMeshes = true;
1227 isOK = static_cast<bool>(load >> txt);
1229 if (txt == "__OPTIONS_END__") {
1230 if (!myTextOption.empty()) {
1231 // Remove last space
1232 myTextOption.erase(myTextOption.end()-1);
1237 myTextOption += txt;
1238 myTextOption += " ";
1244 isOK = static_cast<bool>(load >> separator);
1245 if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
1246 hasEnforcedVertices = true;
1247 if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
1248 hasEnforcedMeshes = true;
1251 if (hasEnforcedVertices) {
1252 std::string txt, name, entry, groupName;
1253 double size, coords[3];
1255 bool hasCoords = false;
1256 isOK = static_cast<bool>(load >> txt); // __BEGIN_VERTEX__
1258 if (txt == "__ENFORCED_VERTICES_END__") {
1263 TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
1265 isOK = static_cast<bool>(load >> txt);
1266 if (txt == "__END_VERTEX__") {
1267 enfVertex->name = name;
1268 enfVertex->geomEntry = entry;
1269 enfVertex->isCompound = isCompound;
1270 enfVertex->groupName = groupName;
1271 enfVertex->coords.clear();
1273 enfVertex->coords.assign(coords,coords+3);
1275 _enfVertexList.insert(enfVertex);
1277 if (enfVertex->coords.size())
1278 _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
1279 if (!enfVertex->geomEntry.empty())
1280 _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
1289 if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
1290 while (isOK && (txt != "__END_NAME__")) {
1291 isOK = static_cast<bool>(load >> txt);
1292 if (txt != "__END_NAME__") {
1298 MESSAGE("name: " <<name);
1301 if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
1302 isOK = static_cast<bool>(load >> entry);
1303 isOK = static_cast<bool>(load >> isCompound);
1304 isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1305 if (txt != "__END_ENTRY__")
1306 throw std::exception();
1307 MESSAGE("entry: " << entry);
1310 if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
1311 while (isOK && (txt != "__END_GROUP__")) {
1312 isOK = static_cast<bool>(load >> txt);
1313 if (txt != "__END_GROUP__") {
1314 if (!groupName.empty())
1319 MESSAGE("groupName: " << groupName);
1322 if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
1324 isOK = static_cast<bool>(load >> coords[0] >> coords[1] >> coords[2]);
1325 isOK = static_cast<bool>(load >> txt); // __END_COORDS__
1326 if (txt != "__END_COORDS__")
1327 throw std::exception();
1328 MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
1331 if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__
1332 isOK = static_cast<bool>(load >> size);
1333 isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1334 if (txt != "__END_SIZE__") {
1335 throw std::exception();
1337 MESSAGE("size: " << size);
1340 isOK = static_cast<bool>(load >> txt); // __BEGIN_VERTEX__
1344 if (hasEnforcedVertices) {
1345 isOK = static_cast<bool>(load >> separator);
1346 if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
1347 hasEnforcedMeshes = true;
1350 if (hasEnforcedMeshes) {
1351 std::string txt, name, entry, groupName;
1352 int elementType = -1, persistID = -1;
1353 isOK = static_cast<bool>(load >> txt); // __BEGIN_ENF_MESH__
1356 if (txt == "__ENFORCED_MESHES_END__")
1359 TGHS3DEnforcedMesh *enfMesh = new TGHS3DEnforcedMesh();
1361 isOK = static_cast<bool>(load >> txt);
1362 if (txt == "__END_ENF_MESH__") {
1363 enfMesh->name = name;
1364 enfMesh->entry = entry;
1365 enfMesh->elementType = (SMESH::ElementType)elementType;
1366 enfMesh->groupName = groupName;
1367 enfMesh->persistID = persistID;
1369 _enfMeshList.insert(enfMesh);
1370 //std::cout << "Restoring of enforced mesh " <<name << " done" << std::endl;
1380 if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
1381 while (isOK && (txt != "__END_NAME__")) {
1382 isOK = static_cast<bool>(load >> txt);
1383 if (txt != "__END_NAME__") {
1389 MESSAGE("name: " <<name);
1392 if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
1393 isOK = static_cast<bool>(load >> entry);
1394 isOK = static_cast<bool>(load >> txt); // __END_ENTRY__
1395 if (txt != "__END_ENTRY__")
1396 throw std::exception();
1397 MESSAGE("entry: " << entry);
1400 if (txt == "__BEGIN_ELEM_TYPE__") { // __BEGIN_ELEM_TYPE__
1401 isOK = static_cast<bool>(load >> elementType);
1402 isOK = static_cast<bool>(load >> txt); // __END_ELEM_TYPE__
1403 if (txt != "__END_ELEM_TYPE__")
1404 throw std::exception();
1405 MESSAGE("elementType: " << elementType);
1408 if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
1409 while (isOK && (txt != "__END_GROUP__")) {
1410 isOK = static_cast<bool>(load >> txt);
1411 if (txt != "__END_GROUP__") {
1412 if (!groupName.empty())
1417 MESSAGE("groupName: " << groupName);
1420 if (txt == "__PERSIST_ID__") {
1421 isOK = static_cast<bool>(load >> persistID);
1422 MESSAGE("persistID: " << persistID);
1424 //std::cout << "isOK: " << isOK << std::endl;
1427 isOK = static_cast<bool>(load >> txt); // __BEGIN_ENF_MESH__
1434 //=======================================================================
1435 //function : SetParametersByMesh
1436 //=======================================================================
1438 bool GHS3DPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* ,const TopoDS_Shape&)
1444 //================================================================================
1446 * \brief Sets myToMakeGroupsOfDomains depending on whether theMesh is on shape or not
1448 //================================================================================
1450 bool GHS3DPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& dflts,
1451 const SMESH_Mesh* /*theMesh*/)
1453 myToMakeGroupsOfDomains = ( !dflts._shape || dflts._shape->IsNull() );
1457 //================================================================================
1459 * \brief Return command to run MG-Tetra mesher excluding file prefix (-f)
1461 //================================================================================
1463 std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
1464 const bool hasShapeToMesh,
1465 const bool forExecutable)
1467 std::string cmd = GetExeName();
1468 // check if any option is overridden by hyp->myTextOption
1469 bool max_memory = hyp ? ( hyp->myTextOption.find("--max_memory") == std::string::npos ) : true;
1470 bool auto_memory = hyp ? ( hyp->myTextOption.find("--automatic_memory") == std::string::npos ) : true;
1471 bool comp = hyp ? ( hyp->myTextOption.find("--components") == std::string::npos ) : true;
1472 bool optim_level = hyp ? ( hyp->myTextOption.find("--optimisation_level") == std::string::npos ) : true;
1473 bool no_int_points = hyp ? ( hyp->myTextOption.find("--no_internal_points") == std::string::npos ) : true;
1474 bool C = hyp ? ( hyp->myTextOption.find("-C") == std::string::npos ) : true;
1475 bool verbose = hyp ? ( hyp->myTextOption.find("--verbose") == std::string::npos ) : true;
1476 bool fem = hyp ? ( hyp->myTextOption.find("-FEM")== std::string::npos ) : true;
1477 bool rem = hyp ? ( hyp->myTextOption.find("--no_initial_central_point")== std::string::npos ) : true;
1478 bool gra = hyp ? ( hyp->myTextOption.find("-Dcpropa")== std::string::npos ) : true;
1480 // if use boundary recovery version, few options are allowed
1481 bool useBndRecovery = !C;
1482 if ( !useBndRecovery && hyp )
1483 useBndRecovery = hyp->myToUseBoundaryRecoveryVersion;
1485 // MG-Tetra needs to know amount of memory it may use (MB).
1486 // Default memory is defined at MG-Tetra installation but it may be not enough,
1487 // so allow to use about all available memory
1489 float aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
1490 cmd += " --max_memory ";
1491 if ( aMaximumMemory < 0 ) cmd += SMESH_Comment( DefaultMaximumMemory() );
1492 else cmd += SMESH_Comment( aMaximumMemory );
1494 if ( auto_memory && !useBndRecovery ) {
1495 float aInitialMemory = hyp ? hyp->myInitialMemory : -1;
1496 cmd += " --automatic_memory ";
1497 if ( aInitialMemory > 0 ) cmd += SMESH_Comment( aInitialMemory );
1500 // component to mesh
1501 if ( comp && !useBndRecovery ) {
1502 // We always run MG-Tetra with "to mesh holes'==TRUE (see PAL19680)
1503 if ( hasShapeToMesh )
1504 cmd += " --components all";
1506 bool aToMeshHoles = hyp ? hyp->myToMeshHoles : DefaultMeshHoles();
1507 if ( aToMeshHoles ) cmd += " --components all";
1508 else cmd += " --components outside_components";
1511 const bool toCreateNewNodes = ( no_int_points && ( !hyp || hyp->myToCreateNewNodes ));
1513 // optimization level
1514 if ( !toCreateNewNodes ) {
1515 cmd += " --optimisation_level none"; // issue 22608
1517 else if ( optim_level && hyp && !useBndRecovery ) {
1518 if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 5 ) {
1519 const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
1520 cmd += " --optimisation_level ";
1521 cmd += level[ hyp->myOptimizationLevel ];
1525 // to create internal nodes
1526 if ( no_int_points && !toCreateNewNodes ) {
1527 if ( forExecutable )
1528 cmd += " --no_internal_points";
1530 cmd += " --internalpoints no";
1534 if ( verbose && hyp ) {
1535 cmd += " --verbose " + SMESH_Comment( hyp->myVerboseLevel );
1538 // boundary recovery version
1539 if ( useBndRecovery ) {
1543 // to use FEM correction
1544 if ( fem && hyp && hyp->myToUseFemCorrection) {
1548 // to remove initial central point.
1549 if ( rem && hyp && hyp->myToRemoveCentralPoint) {
1550 if ( forExecutable )
1551 cmd += " --no_initial_central_point";
1553 cmd += " --centralpoint no";
1557 if ( hyp && !hyp->myTextOption.empty() ) {
1558 cmd += " " + hyp->myTextOption;
1561 // to define volumic gradation.
1563 if ( forExecutable )
1564 cmd += " -Dcpropa=" + SMESH_Comment( hyp->myGradation );
1566 cmd += " --gradation " + SMESH_Comment( hyp->myGradation );
1576 //================================================================================
1578 * \brief Return a unique file name
1580 //================================================================================
1582 std::string GHS3DPlugin_Hypothesis::GetFileName(const GHS3DPlugin_Hypothesis* hyp)
1584 std::string aTmpDir = hyp ? hyp->GetWorkingDirectory() : DefaultWorkingDirectory();
1585 const char lastChar = *aTmpDir.rbegin();
1587 if(lastChar != '\\') aTmpDir+='\\';
1589 if(lastChar != '/') aTmpDir+='/';
1592 TCollection_AsciiString aGenericName = (char*)aTmpDir.c_str();
1593 aGenericName += "GHS3D_";
1594 aGenericName += getpid();
1595 aGenericName += "_";
1596 aGenericName += Abs((Standard_Integer)(long) aGenericName.ToCString());
1598 return aGenericName.ToCString();
1601 //================================================================================
1603 * Return the name of executable
1605 //================================================================================
1607 std::string GHS3DPlugin_Hypothesis::GetExeName()
1609 return "mg-tetra.exe";
1612 //================================================================================
1614 * \brief Return the enforced vertices
1616 //================================================================================
1618 GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList GHS3DPlugin_Hypothesis::GetEnforcedVertices(const GHS3DPlugin_Hypothesis* hyp)
1620 return hyp ? hyp->_GetEnforcedVertices():DefaultGHS3DEnforcedVertexList();
1623 GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexCoordsValues GHS3DPlugin_Hypothesis::GetEnforcedVerticesCoordsSize (const GHS3DPlugin_Hypothesis* hyp)
1625 return hyp ? hyp->_GetEnforcedVerticesCoordsSize(): DefaultGHS3DEnforcedVertexCoordsValues();
1628 GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexEntryValues GHS3DPlugin_Hypothesis::GetEnforcedVerticesEntrySize (const GHS3DPlugin_Hypothesis* hyp)
1630 return hyp ? hyp->_GetEnforcedVerticesEntrySize(): DefaultGHS3DEnforcedVertexEntryValues();
1633 GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap GHS3DPlugin_Hypothesis::GetEnforcedVerticesByCoords (const GHS3DPlugin_Hypothesis* hyp)
1635 return hyp ? hyp->_GetEnforcedVerticesByCoords(): DefaultCoordsGHS3DEnforcedVertexMap();
1638 GHS3DPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap GHS3DPlugin_Hypothesis::GetEnforcedVerticesByEntry (const GHS3DPlugin_Hypothesis* hyp)
1640 return hyp ? hyp->_GetEnforcedVerticesByEntry(): DefaultGeomEntryGHS3DEnforcedVertexMap();
1643 GHS3DPlugin_Hypothesis::TIDSortedNodeGroupMap GHS3DPlugin_Hypothesis::GetEnforcedNodes(const GHS3DPlugin_Hypothesis* hyp)
1645 return hyp ? hyp->_GetEnforcedNodes():DefaultIDSortedNodeGroupMap();
1648 GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap GHS3DPlugin_Hypothesis::GetEnforcedEdges(const GHS3DPlugin_Hypothesis* hyp)
1650 return hyp ? hyp->_GetEnforcedEdges():DefaultIDSortedElemGroupMap();
1653 GHS3DPlugin_Hypothesis::TIDSortedElemGroupMap GHS3DPlugin_Hypothesis::GetEnforcedTriangles(const GHS3DPlugin_Hypothesis* hyp)
1655 return hyp ? hyp->_GetEnforcedTriangles():DefaultIDSortedElemGroupMap();
1658 GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp)
1660 return hyp ? hyp->_GetNodeIDToSizeMap(): DefaultID2SizeMap();
1663 GHS3DPlugin_Hypothesis::TSetStrings GHS3DPlugin_Hypothesis::GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp)
1665 return hyp ? hyp->_GetGroupsToRemove(): DefaultGroupsToRemove();