1 // Copyright (C) 2007-2020 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
21 // File : HexoticPlugin_Hypothesis.cxx
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
25 #include "HexoticPlugin_Hypothesis.hxx"
26 #include <utilities.h>
28 #include <TCollection_AsciiString.hxx>
29 #include <SMESH_Comment.hxx>
33 struct GET_DEFAULT // struct used to get default value from GetOptionValue()
36 operator bool* () { return &isDefault; }
40 //=============================================================================
44 //=============================================================================
45 HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, SMESH_Gen* gen)
46 : SMESH_Hypothesis(hypId, gen),
47 _hexesMinLevel( GetDefaultHexesMinLevel() ),
48 _hexesMaxLevel( GetDefaultHexesMaxLevel() ),
49 _minSize( GetDefaultMinSize() ),
50 _maxSize( GetDefaultMaxSize() ),
51 _approxAngle( GetDefaultGeomApproxAngle() ),
52 _hexoticIgnoreRidges( GetDefaultHexoticIgnoreRidges() ),
53 _hexoticInvalidElements( GetDefaultHexoticInvalidElements() ),
54 _hexoticSharpAngleThreshold( GetDefaultHexoticSharpAngleThreshold() ),
55 _hexoticNbProc( GetDefaultHexoticNbProc() ),
56 _hexoticSdMode(GetDefaultHexoticSdMode()),
57 _hexoticVerbosity(GetDefaultHexoticVerbosity()),
58 _hexoticMaxMemory(GetDefaultHexoticMaxMemory()),
59 _hexoticWorkingDirectory( GetDefaultHexoticWorkingDirectory() ),
60 _logInStandardOutput( GetDefaultStandardOutputLog() ),
61 _removeLogOnSuccess( GetDefaultRemoveLogOnSuccess() ),
62 _keepFiles( GetDefaultKeepFiles() ),
63 _nbLayers(GetDefaultNbLayers()),
64 _firstLayerSize(GetDefaultFirstLayerSize()),
65 _direction(GetDefaultDirection()),
66 _growth(GetDefaultGrowth()),
67 _facesWithLayers(GetDefaultFacesWithLayers()),
68 _imprintedFaces(GetDefaultImprintedFaces())
70 MESSAGE("HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis");
74 const char* boolOptionNames[] = { "allow_invalid_elements",
75 "enforce_constant_layer_size",
78 "recover_sharp_angles",
81 const char* intOptionNames[] = { "max_memory", // 2048
82 "max_number_of_threads", // 4
85 "sizemap_level", // 10
88 const char* doubleOptionNames[] = { "ridge_angle", // 60
91 const char* charOptionNames[] = { "element_order", // linear
97 while (boolOptionNames[i][0])
99 _boolOptions.insert( boolOptionNames[i] );
100 _option2value[boolOptionNames[i++]].clear();
103 while (intOptionNames[i][0])
104 _option2value[intOptionNames[i++]].clear();
107 while (doubleOptionNames[i][0]) {
108 _doubleOptions.insert(doubleOptionNames[i]);
109 _option2value[doubleOptionNames[i++]].clear();
112 while (charOptionNames[i][0]) {
113 _charOptions.insert(charOptionNames[i]);
114 _option2value[charOptionNames[i++]].clear();
117 // default values to be used while MG meshing
119 _defaultOptionValues["allow_invalid_elements" ] = "no";
120 _defaultOptionValues["enforce_constant_layer_size"] = "no";
121 _defaultOptionValues["compute_ridges" ] = "yes";
122 _defaultOptionValues["flatten_hexa_sides" ] = "no";
123 _defaultOptionValues["recover_sharp_angles" ] = "yes";
124 _defaultOptionValues["max_memory" ] = "2048";
125 _defaultOptionValues["max_number_of_threads" ] = "4";
126 _defaultOptionValues["min_level" ] = "6";
127 _defaultOptionValues["max_level" ] = "10";
128 _defaultOptionValues["sizemap_level" ] = "10";
129 _defaultOptionValues["ridge_angle" ] = "60";
130 _defaultOptionValues["element_order" ] = "linear";
131 _defaultOptionValues["tags" ] = "respect";
134 // check validity of option names of _defaultOptionValues
135 TOptionValues::iterator n2v = _defaultOptionValues.begin();
136 for ( ; n2v != _defaultOptionValues.end(); ++n2v )
137 ASSERT( _option2value.count( n2v->first ));
138 ASSERT( _option2value.size() == _defaultOptionValues.size() );
142 //=============================================================================
146 //=============================================================================
148 void HexoticPlugin_Hypothesis::SetHexesMinLevel(int theVal)
150 SetOptionValue( "min_level", SMESH_Comment( theVal ));
151 _hexesMinLevel = theVal;
154 void HexoticPlugin_Hypothesis::SetHexesMaxLevel(int theVal)
156 SetOptionValue( "max_level", SMESH_Comment( theVal ));
157 _hexesMaxLevel = theVal;
160 void HexoticPlugin_Hypothesis::SetMinSize(double theVal) {
161 if (theVal != _minSize) {
163 NotifySubMeshesHypothesisModification();
167 void HexoticPlugin_Hypothesis::SetMaxSize(double theVal) {
168 if (theVal != _maxSize) {
170 NotifySubMeshesHypothesisModification();
174 void HexoticPlugin_Hypothesis::SetGeomApproxAngle(double theVal) {
175 if (theVal != _approxAngle) {
176 _approxAngle = theVal;
177 NotifySubMeshesHypothesisModification();
181 void HexoticPlugin_Hypothesis::SetHexoticIgnoreRidges(bool theVal) {
182 SetOptionValue( "compute_ridges", theVal ? "no" : "yes" );
183 _hexoticIgnoreRidges = theVal;
186 void HexoticPlugin_Hypothesis::SetHexoticInvalidElements(bool theVal)
188 SetOptionValue( "allow_invalid_elements", theVal ? "yes" : "no" );
189 _hexoticInvalidElements = theVal;
192 void HexoticPlugin_Hypothesis::SetHexoticSharpAngleThreshold(double theVal)
194 SetOptionValue( "ridge_angle", SMESH_Comment( theVal ));
195 _hexoticSharpAngleThreshold = theVal;
198 void HexoticPlugin_Hypothesis::SetHexoticNbProc(int theVal)
200 SetOptionValue( "max_number_of_threads", SMESH_Comment( theVal ));
201 _hexoticNbProc = theVal;
204 void HexoticPlugin_Hypothesis::SetHexoticWorkingDirectory(const std::string& path)
206 if ( _hexoticWorkingDirectory != path ) {
207 _hexoticWorkingDirectory = path;
211 if( path[ path.size()-1 ] != '\\')
212 _hexoticWorkingDirectory += '\\';
214 if( path[ path.size()-1 ] != '/')
215 _hexoticWorkingDirectory += '/';
218 NotifySubMeshesHypothesisModification();
222 void HexoticPlugin_Hypothesis::SetHexoticSdMode(int theVal) {
223 if (theVal != _hexoticSdMode) {
224 _hexoticSdMode = theVal;
225 NotifySubMeshesHypothesisModification();
229 void HexoticPlugin_Hypothesis::SetHexoticVerbosity(int theVal) {
230 if (theVal != _hexoticVerbosity) {
231 _hexoticVerbosity = theVal;
232 NotifySubMeshesHypothesisModification();
236 void HexoticPlugin_Hypothesis::SetHexoticMaxMemory(int theVal)
238 SetOptionValue( "max_memory", SMESH_Comment( theVal ));
239 _hexoticMaxMemory = theVal;
242 void HexoticPlugin_Hypothesis::SetKeepFiles(bool toKeep)
244 if ( _keepFiles != toKeep ) {
246 NotifySubMeshesHypothesisModification();
250 void HexoticPlugin_Hypothesis::SetStandardOutputLog(bool logInStandardOutput)
252 if ( _logInStandardOutput != logInStandardOutput ) {
253 _logInStandardOutput = logInStandardOutput;
254 NotifySubMeshesHypothesisModification();
258 void HexoticPlugin_Hypothesis::SetRemoveLogOnSuccess(bool removeLogOnSuccess)
260 if ( _removeLogOnSuccess != removeLogOnSuccess ) {
261 _removeLogOnSuccess = removeLogOnSuccess;
262 NotifySubMeshesHypothesisModification();
266 void HexoticPlugin_Hypothesis::SetOptionValue(const std::string& optionName,
267 const std::string& optionValue)
268 throw (std::invalid_argument)
270 TOptionValues::iterator op_val = _option2value.find(optionName);
271 if (op_val == _option2value.end())
273 op_val = _customOption2value.find( optionName );
274 if ( op_val != _customOption2value.end() && op_val->second != optionValue )
275 NotifySubMeshesHypothesisModification();
276 _customOption2value[ optionName ] = optionValue;
280 if (op_val->second != optionValue)
282 const char* ptr = optionValue.c_str();
283 // strip white spaces
284 while (ptr[0] == ' ')
287 while (i != 0 && ptr[i - 1] == ' ')
291 std::string typeName;
294 } else if (_charOptions.count(optionName)) {
295 // do not check strings
296 } else if (_doubleOptions.count(optionName)) {
297 // check if value is double
300 } else if (_boolOptions.count(optionName)) {
301 // check if value is bool
302 ToBool(ptr, &typeOk);
305 // check if value is int
307 typeName = "integer";
309 if ( typeOk ) // check some specific values ?
314 std::string msg = "Advanced option '" + optionName + "' = '" + optionValue + "' but must be " + typeName;
315 throw std::invalid_argument(msg);
317 std::string value( ptr, i );
318 if ( _defaultOptionValues[ optionName ] == value )
321 op_val->second = value;
323 NotifySubMeshesHypothesisModification();
327 //=============================================================================
328 //! Return option value. If isDefault provided, it can be a default value,
329 // then *isDefault == true. If isDefault is not provided, the value will be
330 // empty if it equals a default one.
331 std::string HexoticPlugin_Hypothesis::GetOptionValue(const std::string& optionName,
332 bool* isDefault) const
333 throw (std::invalid_argument)
335 TOptionValues::const_iterator op_val = _option2value.find(optionName);
336 if (op_val == _option2value.end())
338 op_val = _customOption2value.find(optionName);
339 if (op_val == _customOption2value.end())
341 std::string msg = "Unknown MG-Tetra option: <" + optionName + ">";
342 throw std::invalid_argument(msg);
345 std::string val = op_val->second;
346 if ( isDefault ) *isDefault = ( val.empty() );
348 if ( val.empty() && isDefault )
350 op_val = _defaultOptionValues.find( optionName );
351 if (op_val != _defaultOptionValues.end())
352 val = op_val->second;
358 //=============================================================================
359 bool HexoticPlugin_Hypothesis::HasOptionDefined( const std::string& optionName ) const
361 bool isDefault = false;
364 GetOptionValue( optionName, &isDefault );
366 catch ( std::invalid_argument )
373 //=============================================================================
374 void HexoticPlugin_Hypothesis::ClearOption(const std::string& optionName)
376 TOptionValues::iterator op_val = _customOption2value.find(optionName);
377 if (op_val != _customOption2value.end())
378 _customOption2value.erase(op_val);
380 op_val = _option2value.find(optionName);
381 if (op_val != _option2value.end())
382 op_val->second.clear();
386 //=============================================================================
387 HexoticPlugin_Hypothesis::TOptionValues HexoticPlugin_Hypothesis::GetOptionValues() const
390 TOptionValues::const_iterator op_val = _option2value.begin();
391 for ( ; op_val != _option2value.end(); ++op_val )
392 vals.insert( make_pair( op_val->first, GetOptionValue( op_val->first, GET_DEFAULT() )));
397 //================================================================================
399 * \brief Converts a string to a bool
401 //================================================================================
403 bool HexoticPlugin_Hypothesis::ToBool(const std::string& str, bool* isOk )
404 throw (std::invalid_argument)
407 if ( isOk ) *isOk = true;
409 for ( size_t i = 0; i <= s.size(); ++i )
410 s[i] = tolower( s[i] );
412 if ( s == "1" || s == "true" || s == "active" || s == "yes" )
415 if ( s == "0" || s == "false" || s == "inactive" || s == "no" )
421 std::string msg = "Not a Boolean value:'" + str + "'";
422 throw std::invalid_argument(msg);
427 //================================================================================
429 * \brief Converts a string to a real value
431 //================================================================================
433 double HexoticPlugin_Hypothesis::ToDbl(const std::string& str, bool* isOk )
434 throw (std::invalid_argument)
436 if ( str.empty() ) throw std::invalid_argument("Empty value provided");
439 double val = strtod(&str[0], &endPtr);
440 bool ok = (&str[0] != endPtr);
442 if ( isOk ) *isOk = ok;
446 std::string msg = "Not a real value:'" + str + "'";
447 throw std::invalid_argument(msg);
452 //================================================================================
454 * \brief Converts a string to a integer value
456 //================================================================================
458 int HexoticPlugin_Hypothesis::ToInt(const std::string& str, bool* isOk )
459 throw (std::invalid_argument)
461 if ( str.empty() ) throw std::invalid_argument("Empty value provided");
464 int val = (int)strtol( &str[0], &endPtr, 10);
465 bool ok = (&str[0] != endPtr);
467 if ( isOk ) *isOk = ok;
471 std::string msg = "Not an integer value:'" + str + "'";
472 throw std::invalid_argument(msg);
477 void HexoticPlugin_Hypothesis::SetAdvancedOption(const std::string& option)
479 size_t wsPos = option.find(' ');
480 if ( wsPos == std::string::npos )
482 SetOptionValue( option, "" );
486 std::string opt( option, 0, wsPos );
487 std::string val( option, wsPos + 1 );
488 SetOptionValue( opt, val );
492 //=======================================================================
493 //function : GetAdvancedOption
494 //purpose : Return only options having NO corresponding member fields
495 //=======================================================================
497 std::string HexoticPlugin_Hypothesis::GetAdvancedOption( bool customOnly ) const
499 // options having corresponding member fields
500 static std::set< std::string > toSkip = {
504 "allow_invalid_elements",
506 "max_number_of_threads",
510 // Return only options having NO corresponding member fields
514 TOptionValues::const_iterator o2v = _option2value.begin();
517 for ( ; o2v != _option2value.end(); ++o2v )
518 if ( !o2v->second.empty() && !toSkip.count( o2v->first ))
522 txt << "--" << o2v->first << " " << o2v->second;
525 for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
529 // if ( o2v->first[0] != '-' )
531 txt << o2v->first << " " << o2v->second;
536 bool HexoticPlugin_Hypothesis::AddSizeMap(std::string theEntry, double theSize)
538 THexoticSizeMaps::iterator it;
539 it=_sizeMaps.find(theEntry);
544 if( it == _sizeMaps.end() ) // If no size map is defined on the given object
546 _sizeMaps[theEntry] = theSize;
547 MESSAGE("NEW size map, entry :"<<theEntry<<", size : "<<theSize);
548 NotifySubMeshesHypothesisModification();
551 else if( it->second != theSize ) // If a size map exists with a different size value
553 it->second = theSize;
554 MESSAGE("MODIFIED size map, entry :"<<theEntry<<"with size : "<<theSize);
555 NotifySubMeshesHypothesisModification();
560 MESSAGE("NO size map added");
561 return false; // No size map added
565 bool HexoticPlugin_Hypothesis::UnsetSizeMap(std::string theEntry) {
566 THexoticSizeMaps::iterator it;
567 it=_sizeMaps.find(theEntry);
568 if( it != _sizeMaps.end() )
577 void HexoticPlugin_Hypothesis::SetNbLayers(int theVal) {
578 if (theVal != _nbLayers) {
580 NotifySubMeshesHypothesisModification();
584 void HexoticPlugin_Hypothesis::SetFirstLayerSize(double theVal) {
585 if (theVal != _firstLayerSize) {
586 _firstLayerSize = theVal;
587 NotifySubMeshesHypothesisModification();
591 void HexoticPlugin_Hypothesis::SetDirection(bool theVal) {
592 if (theVal != _direction) {
594 NotifySubMeshesHypothesisModification();
598 void HexoticPlugin_Hypothesis::SetGrowth(double theVal) {
599 if (theVal != _growth) {
601 NotifySubMeshesHypothesisModification();
605 bool HexoticPlugin_Hypothesis::SetFacesWithLayers(const std::vector<int>& theVal) {
606 if ( _facesWithLayers != theVal ) {
607 _facesWithLayers = theVal;
608 NotifySubMeshesHypothesisModification();
614 bool HexoticPlugin_Hypothesis::SetImprintedFaces(const std::vector<int>& theVal) {
615 if ( _imprintedFaces != theVal ) {
616 _imprintedFaces = theVal;
617 NotifySubMeshesHypothesisModification();
623 //=============================================================================
627 //=============================================================================
628 std::ostream& HexoticPlugin_Hypothesis::SaveTo(std::ostream& save)
630 //explicit outputs for future code compatibility of saved .hdf
631 //save without any whitespaces!
633 save<<"hexesMinLevel="<<_hexesMinLevel<<";";
634 save<<"hexesMaxLevel="<<_hexesMaxLevel<<";";
635 save<<"hexoticIgnoreRidges="<<(int)_hexoticIgnoreRidges<<";";
636 save<<"hexoticInvalidElements="<<(int)_hexoticInvalidElements<<";";
637 save<<"hexoticSharpAngleThreshold="<<_hexoticSharpAngleThreshold<<";";
638 save<<"hexoticNbProc="<<_hexoticNbProc<<";";
639 save<<"hexoticWorkingDirectory="<<_hexoticWorkingDirectory<<";";
640 save<<"minSize="<<_minSize<<";";
641 save<<"maxSize="<<_maxSize<<";";
642 save<<"hexoticSdMode="<<_hexoticSdMode<<";";
643 save<<"hexoticVerbosity="<<_hexoticVerbosity<<";";
644 save<<"hexoticMaxMemory="<<_hexoticMaxMemory<<";";
645 std::string textOptions;// = _textOptions;
646 replace(textOptions.begin(), textOptions.end(), ' ', '*');
647 save<<"textOptions="<<textOptions<<";";
648 THexoticSizeMaps::iterator it = _sizeMaps.begin();
649 if ( it != _sizeMaps.end() )
652 for ( ; it!=_sizeMaps.end() ; it++ )
654 save<< it->first << "/" << it->second << "#" ;
658 save<<"nbLayers="<<_nbLayers<<";";
659 save<<"firstLayerSize="<<_firstLayerSize<<";";
660 save<<"direction="<<_direction<<";";
661 save<<"growth="<<_growth<<";";
662 if ( !_facesWithLayers.empty() )
664 save<<"facesWithLayers=";
665 for ( size_t i = 0; i < _facesWithLayers.size(); i++ )
667 save<< _facesWithLayers.at(i) << "#" ;
671 if ( !_imprintedFaces.empty() )
673 save<<"imprintedFaces=";
674 for ( size_t i = 0; i < _imprintedFaces.size(); i++ )
676 save<< _imprintedFaces.at(i) << "#" ;
681 // New options in 2.9.6 (issue #17784)
683 save << " " << _approxAngle;
684 save << " " << _logInStandardOutput;
685 save << " " << _removeLogOnSuccess;
686 save << " " << _keepFiles;
688 save << " " << _option2value.size();
689 TOptionValues::iterator o2v = _option2value.begin();
690 for ( ; o2v != _option2value.end(); ++o2v )
691 save << " -" << o2v->first << " -" << o2v->second;
693 save << " " << _customOption2value.size();
694 for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
695 save << " -" << o2v->first << " -" << o2v->second;
700 //=============================================================================
704 //=============================================================================
705 std::istream& HexoticPlugin_Hypothesis::LoadFrom(std::istream& load)
707 //explicit inputs for future code compatibility of saved .hdf
709 std::string str1,str2,str3,str4;
711 //save without any whitespaces!
712 isOK = static_cast<bool>(load >> str1);
714 //defaults values assumed
715 load.clear(std::ios::badbit | load.rdstate());
719 int len = str1.length();
721 int found = str1.find(';',pos);
722 str2 = str1.substr(pos,found-pos);
723 int eqpos = str2.find('=',0);
724 str3 = str2.substr(0,eqpos);
725 str4 = str2.substr(eqpos+1);
728 if (str3=="hexesMinLevel") _hexesMinLevel = atoi(str4.c_str());
729 if (str3=="hexesMaxLevel") _hexesMaxLevel = atoi(str4.c_str());
730 if (str3=="hexoticQuadrangles") {}
731 if (str3=="hexoticIgnoreRidges") _hexoticIgnoreRidges = (bool) atoi(str4.c_str());
732 if (str3=="hexoticInvalidElements") _hexoticInvalidElements = (bool) atoi(str4.c_str());
733 if (str3=="hexoticSharpAngleThreshold") _hexoticSharpAngleThreshold = atof(str4.c_str());
734 if (str3=="hexoticNbProc") _hexoticNbProc = atoi(str4.c_str());
735 if (str3=="hexoticWorkingDirectory") _hexoticWorkingDirectory = str4;
736 if (str3=="minSize") _minSize = atof(str4.c_str());
737 if (str3=="maxSize") _maxSize = atof(str4.c_str());
738 if (str3=="hexoticSdMode") _hexoticSdMode = atoi(str4.c_str());
739 if (str3=="hexoticVerbosity") _hexoticVerbosity = atoi(str4.c_str());
740 if (str3=="hexoticMaxMemory") _hexoticMaxMemory = atoi(str4.c_str());
741 if (str3=="textOptions")
743 replace(str4.begin(), str4.end(), '*', ' ');
744 //_textOptions = str4;
746 if (str3=="sizeMaps")
748 std::string sm_substr, sm_substr1, sm_substr2;
750 int sm_len = str4.length();
751 while ( sm_pos < sm_len )
753 int sm_found = str4.find('#',sm_pos);
754 sm_substr = str4.substr(sm_pos,sm_found-sm_pos);
755 int sm_slashpos = sm_substr.find('/',0);
756 sm_substr1 = sm_substr.substr(0,sm_slashpos);
757 sm_substr2 = sm_substr.substr(sm_slashpos+1);
758 _sizeMaps[sm_substr1] = atof(sm_substr2.c_str());
759 sm_pos = sm_found + 1;
762 if (str3 == "nbLayers") _nbLayers = atoi(str4.c_str());
763 if (str3 == "firstLayerSize") _firstLayerSize = atof(str4.c_str());
764 if (str3 == "direction") _direction = atoi(str4.c_str());
765 if (str3 == "growth") _growth = atof(str4.c_str());
766 if (str3 == "facesWithLayers")
770 while ( pos < str4.length() )
772 int found = str4.find('#',pos);
773 id = str4.substr(pos, found-pos);
774 _facesWithLayers.push_back(atoi(id.c_str()));
778 if (str3 == "imprintedFaces")
782 while ( pos < str4.length() )
784 int found = str4.find('#',pos);
785 id = str4.substr(pos, found-pos);
786 _imprintedFaces.push_back(atoi(id.c_str()));
792 // New options in 2.9.6 (issue #17784)
794 if ( static_cast<bool>( load >> _approxAngle ))
797 load >> i; _logInStandardOutput = (bool)i;
798 load >> i; _removeLogOnSuccess = (bool)i;
799 load >> i; _keepFiles = (bool)i;
801 std::string option, value;
802 if ( static_cast<bool>( load >> i ) && i >= 0 )
804 for ( int nbRead = 0; nbRead < i; ++nbRead )
806 load >> option >> value;
807 _option2value[ std::string( option, 1 )] = std::string( value, 1 );
810 if ( static_cast<bool>( load >> i ) && i >= 0 )
812 for ( int nbRead = 0; nbRead < i; ++nbRead )
814 load >> option >> value;
815 _customOption2value[ std::string( option, 1 )] = std::string( value, 1 );
819 else // pass old basic parameters to new advanced ones
821 SetHexesMinLevel ( _hexesMinLevel );
822 SetHexesMaxLevel ( _hexesMaxLevel );
823 SetHexoticIgnoreRidges ( _hexoticIgnoreRidges );
824 SetHexoticInvalidElements ( _hexoticInvalidElements );
825 SetHexoticSharpAngleThreshold( _hexoticSharpAngleThreshold );
826 SetHexoticNbProc ( _hexoticNbProc );
827 SetHexoticMaxMemory ( _hexoticMaxMemory );
833 //=============================================================================
837 //=============================================================================
838 std::ostream& operator <<(std::ostream& save, HexoticPlugin_Hypothesis& hyp)
840 return hyp.SaveTo( save );
843 //=============================================================================
847 //=============================================================================
848 std::istream& operator >>(std::istream& load, HexoticPlugin_Hypothesis& hyp)
850 return hyp.LoadFrom( load );
854 //================================================================================
856 * \brief Does nothing
857 * \param theMesh - the built mesh
858 * \param theShape - the geometry of interest
859 * \retval bool - always false
861 //================================================================================
862 bool HexoticPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh,
863 const TopoDS_Shape& theShape)
867 //================================================================================
869 * \brief Initialize my parameter values by default parameters.
870 * \retval bool - true if parameter values have been successfully defined
872 //================================================================================
874 bool HexoticPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& /*dflts*/,
875 const SMESH_Mesh* /*theMesh*/)
880 //=============================================================================
881 int HexoticPlugin_Hypothesis::GetDefaultHexesMinLevel()
886 int HexoticPlugin_Hypothesis::GetDefaultHexesMaxLevel()
891 double HexoticPlugin_Hypothesis::GetDefaultMinSize()
896 double HexoticPlugin_Hypothesis::GetDefaultMaxSize()
901 bool HexoticPlugin_Hypothesis::GetDefaultHexoticIgnoreRidges()
906 bool HexoticPlugin_Hypothesis::GetDefaultHexoticInvalidElements()
911 double HexoticPlugin_Hypothesis::GetDefaultHexoticSharpAngleThreshold()
916 int HexoticPlugin_Hypothesis::GetDefaultHexoticNbProc()
921 std::string HexoticPlugin_Hypothesis::GetDefaultHexoticWorkingDirectory()
925 char *Tmp_dir = getenv("SALOME_TMP_DIR");
927 if(Tmp_dir == NULL) {
928 Tmp_dir = getenv("TEMP");
930 Tmp_dir = getenv("TMP");
933 if( Tmp_dir != NULL ) {
934 aTmpDir = std::string(Tmp_dir);
936 if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
938 if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
951 int HexoticPlugin_Hypothesis::GetDefaultHexoticSdMode()
956 int HexoticPlugin_Hypothesis::GetDefaultHexoticVerbosity()
961 int HexoticPlugin_Hypothesis::GetDefaultHexoticMaxMemory()
966 std::string HexoticPlugin_Hypothesis::GetDefaultTextOptions()
971 HexoticPlugin_Hypothesis::THexoticSizeMaps HexoticPlugin_Hypothesis::GetDefaultHexoticSizeMaps()
973 return THexoticSizeMaps();
976 int HexoticPlugin_Hypothesis::GetDefaultNbLayers()
981 double HexoticPlugin_Hypothesis::GetDefaultFirstLayerSize()
986 bool HexoticPlugin_Hypothesis::GetDefaultDirection()
991 double HexoticPlugin_Hypothesis::GetDefaultGrowth()
996 std::vector<int> HexoticPlugin_Hypothesis::GetDefaultFacesWithLayers()
998 return std::vector<int>();
1001 std::vector<int> HexoticPlugin_Hypothesis::GetDefaultImprintedFaces()
1003 return std::vector<int>();