1 // Copyright (C) 2007-2022 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)
269 TOptionValues::iterator op_val = _option2value.find(optionName);
270 if (op_val == _option2value.end())
272 op_val = _customOption2value.find( optionName );
273 if ( op_val != _customOption2value.end() && op_val->second != optionValue )
274 NotifySubMeshesHypothesisModification();
275 _customOption2value[ optionName ] = optionValue;
279 if (op_val->second != optionValue)
281 const char* ptr = optionValue.c_str();
282 // strip white spaces
283 while (ptr[0] == ' ')
286 while (i != 0 && ptr[i - 1] == ' ')
290 std::string typeName;
293 } else if (_charOptions.count(optionName)) {
294 // do not check strings
295 } else if (_doubleOptions.count(optionName)) {
296 // check if value is double
299 } else if (_boolOptions.count(optionName)) {
300 // check if value is bool
301 ToBool(ptr, &typeOk);
304 // check if value is int
306 typeName = "integer";
308 if ( typeOk ) // check some specific values ?
313 std::string msg = "Advanced option '" + optionName + "' = '" + optionValue + "' but must be " + typeName;
314 throw std::invalid_argument(msg);
316 std::string value( ptr, i );
317 if ( _defaultOptionValues[ optionName ] == value )
320 op_val->second = value;
322 NotifySubMeshesHypothesisModification();
326 //=============================================================================
327 //! Return option value. If isDefault provided, it can be a default value,
328 // then *isDefault == true. If isDefault is not provided, the value will be
329 // empty if it equals a default one.
330 std::string HexoticPlugin_Hypothesis::GetOptionValue(const std::string& optionName,
331 bool* isDefault) const
333 TOptionValues::const_iterator op_val = _option2value.find(optionName);
334 if (op_val == _option2value.end())
336 op_val = _customOption2value.find(optionName);
337 if (op_val == _customOption2value.end())
339 std::string msg = "Unknown MG-Tetra option: <" + optionName + ">";
340 throw std::invalid_argument(msg);
343 std::string val = op_val->second;
344 if ( isDefault ) *isDefault = ( val.empty() );
346 if ( val.empty() && isDefault )
348 op_val = _defaultOptionValues.find( optionName );
349 if (op_val != _defaultOptionValues.end())
350 val = op_val->second;
356 //=============================================================================
357 bool HexoticPlugin_Hypothesis::HasOptionDefined( const std::string& optionName ) const
359 bool isDefault = false;
362 GetOptionValue( optionName, &isDefault );
364 catch ( std::invalid_argument& )
371 //=============================================================================
372 void HexoticPlugin_Hypothesis::ClearOption(const std::string& optionName)
374 TOptionValues::iterator op_val = _customOption2value.find(optionName);
375 if (op_val != _customOption2value.end())
376 _customOption2value.erase(op_val);
378 op_val = _option2value.find(optionName);
379 if (op_val != _option2value.end())
380 op_val->second.clear();
384 //=============================================================================
385 HexoticPlugin_Hypothesis::TOptionValues HexoticPlugin_Hypothesis::GetOptionValues() const
388 TOptionValues::const_iterator op_val = _option2value.begin();
389 for ( ; op_val != _option2value.end(); ++op_val )
390 vals.insert( make_pair( op_val->first, GetOptionValue( op_val->first, GET_DEFAULT() )));
395 //================================================================================
397 * \brief Converts a string to a bool
399 //================================================================================
401 bool HexoticPlugin_Hypothesis::ToBool(const std::string& str, bool* isOk )
404 if ( isOk ) *isOk = true;
406 for ( size_t i = 0; i <= s.size(); ++i )
407 s[i] = tolower( s[i] );
409 if ( s == "1" || s == "true" || s == "active" || s == "yes" )
412 if ( s == "0" || s == "false" || s == "inactive" || s == "no" )
418 std::string msg = "Not a Boolean value:'" + str + "'";
419 throw std::invalid_argument(msg);
424 //================================================================================
426 * \brief Converts a string to a real value
428 //================================================================================
430 double HexoticPlugin_Hypothesis::ToDbl(const std::string& str, bool* isOk )
432 if ( str.empty() ) throw std::invalid_argument("Empty value provided");
435 double val = strtod(&str[0], &endPtr);
436 bool ok = (&str[0] != endPtr);
438 if ( isOk ) *isOk = ok;
442 std::string msg = "Not a real value:'" + str + "'";
443 throw std::invalid_argument(msg);
448 //================================================================================
450 * \brief Converts a string to a integer value
452 //================================================================================
454 int HexoticPlugin_Hypothesis::ToInt(const std::string& str, bool* isOk )
456 if ( str.empty() ) throw std::invalid_argument("Empty value provided");
459 int val = (int)strtol( &str[0], &endPtr, 10);
460 bool ok = (&str[0] != endPtr);
462 if ( isOk ) *isOk = ok;
466 std::string msg = "Not an integer value:'" + str + "'";
467 throw std::invalid_argument(msg);
472 void HexoticPlugin_Hypothesis::SetAdvancedOption(const std::string& option)
474 size_t wsPos = option.find(' ');
475 if ( wsPos == std::string::npos )
477 SetOptionValue( option, "" );
481 std::string opt( option, 0, wsPos );
482 std::string val( option, wsPos + 1 );
483 SetOptionValue( opt, val );
487 //=======================================================================
488 //function : GetAdvancedOption
489 //purpose : Return only options having NO corresponding member fields
490 //=======================================================================
492 std::string HexoticPlugin_Hypothesis::GetAdvancedOption( bool customOnly ) const
494 // options having corresponding member fields
495 static std::set< std::string > toSkip = {
499 "allow_invalid_elements",
501 "max_number_of_threads",
505 // Return only options having NO corresponding member fields
509 TOptionValues::const_iterator o2v = _option2value.begin();
512 for ( ; o2v != _option2value.end(); ++o2v )
513 if ( !o2v->second.empty() && !toSkip.count( o2v->first ))
517 txt << "--" << o2v->first << " " << o2v->second;
520 for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
524 // if ( o2v->first[0] != '-' )
526 txt << o2v->first << " " << o2v->second;
531 bool HexoticPlugin_Hypothesis::AddSizeMap(std::string theEntry, double theSize)
533 THexoticSizeMaps::iterator it;
534 it=_sizeMaps.find(theEntry);
539 if( it == _sizeMaps.end() ) // If no size map is defined on the given object
541 _sizeMaps[theEntry] = theSize;
542 MESSAGE("NEW size map, entry :"<<theEntry<<", size : "<<theSize);
543 NotifySubMeshesHypothesisModification();
546 else if( it->second != theSize ) // If a size map exists with a different size value
548 it->second = theSize;
549 MESSAGE("MODIFIED size map, entry :"<<theEntry<<"with size : "<<theSize);
550 NotifySubMeshesHypothesisModification();
555 MESSAGE("NO size map added");
556 return false; // No size map added
560 bool HexoticPlugin_Hypothesis::UnsetSizeMap(std::string theEntry) {
561 THexoticSizeMaps::iterator it;
562 it=_sizeMaps.find(theEntry);
563 if( it != _sizeMaps.end() )
572 void HexoticPlugin_Hypothesis::SetNbLayers(int theVal) {
573 if (theVal != _nbLayers) {
575 NotifySubMeshesHypothesisModification();
579 void HexoticPlugin_Hypothesis::SetFirstLayerSize(double theVal) {
580 if (theVal != _firstLayerSize) {
581 _firstLayerSize = theVal;
582 NotifySubMeshesHypothesisModification();
586 void HexoticPlugin_Hypothesis::SetDirection(bool theVal) {
587 if (theVal != _direction) {
589 NotifySubMeshesHypothesisModification();
593 void HexoticPlugin_Hypothesis::SetGrowth(double theVal) {
594 if (theVal != _growth) {
596 NotifySubMeshesHypothesisModification();
600 bool HexoticPlugin_Hypothesis::SetFacesWithLayers(const std::vector<int>& theVal) {
601 if ( _facesWithLayers != theVal ) {
602 _facesWithLayers = theVal;
603 NotifySubMeshesHypothesisModification();
609 bool HexoticPlugin_Hypothesis::SetImprintedFaces(const std::vector<int>& theVal) {
610 if ( _imprintedFaces != theVal ) {
611 _imprintedFaces = theVal;
612 NotifySubMeshesHypothesisModification();
618 //=============================================================================
622 //=============================================================================
623 std::ostream& HexoticPlugin_Hypothesis::SaveTo(std::ostream& save)
625 //explicit outputs for future code compatibility of saved .hdf
626 //save without any whitespaces!
628 save<<"hexesMinLevel="<<_hexesMinLevel<<";";
629 save<<"hexesMaxLevel="<<_hexesMaxLevel<<";";
630 save<<"hexoticIgnoreRidges="<<(int)_hexoticIgnoreRidges<<";";
631 save<<"hexoticInvalidElements="<<(int)_hexoticInvalidElements<<";";
632 save<<"hexoticSharpAngleThreshold="<<_hexoticSharpAngleThreshold<<";";
633 save<<"hexoticNbProc="<<_hexoticNbProc<<";";
634 save<<"hexoticWorkingDirectory="<<_hexoticWorkingDirectory<<";";
635 save<<"minSize="<<_minSize<<";";
636 save<<"maxSize="<<_maxSize<<";";
637 save<<"hexoticSdMode="<<_hexoticSdMode<<";";
638 save<<"hexoticVerbosity="<<_hexoticVerbosity<<";";
639 save<<"hexoticMaxMemory="<<_hexoticMaxMemory<<";";
640 std::string textOptions;// = _textOptions;
641 replace(textOptions.begin(), textOptions.end(), ' ', '*');
642 save<<"textOptions="<<textOptions<<";";
643 THexoticSizeMaps::iterator it = _sizeMaps.begin();
644 if ( it != _sizeMaps.end() )
647 for ( ; it!=_sizeMaps.end() ; it++ )
649 save<< it->first << "/" << it->second << "#" ;
653 save<<"nbLayers="<<_nbLayers<<";";
654 save<<"firstLayerSize="<<_firstLayerSize<<";";
655 save<<"direction="<<_direction<<";";
656 save<<"growth="<<_growth<<";";
657 if ( !_facesWithLayers.empty() )
659 save<<"facesWithLayers=";
660 for ( size_t i = 0; i < _facesWithLayers.size(); i++ )
662 save<< _facesWithLayers.at(i) << "#" ;
666 if ( !_imprintedFaces.empty() )
668 save<<"imprintedFaces=";
669 for ( size_t i = 0; i < _imprintedFaces.size(); i++ )
671 save<< _imprintedFaces.at(i) << "#" ;
676 // New options in 2.9.6 (issue #17784)
678 save << " " << _approxAngle;
679 save << " " << _logInStandardOutput;
680 save << " " << _removeLogOnSuccess;
681 save << " " << _keepFiles;
683 save << " " << _option2value.size();
684 TOptionValues::iterator o2v = _option2value.begin();
685 for ( ; o2v != _option2value.end(); ++o2v )
686 save << " -" << o2v->first << " -" << o2v->second;
688 save << " " << _customOption2value.size();
689 for ( o2v = _customOption2value.begin(); o2v != _customOption2value.end(); ++o2v )
690 save << " -" << o2v->first << " -" << o2v->second;
695 //=============================================================================
699 //=============================================================================
700 std::istream& HexoticPlugin_Hypothesis::LoadFrom(std::istream& load)
702 //explicit inputs for future code compatibility of saved .hdf
704 std::string str1,str2,str3,str4;
706 //save without any whitespaces!
707 isOK = static_cast<bool>(load >> str1);
709 //defaults values assumed
710 load.clear(std::ios::badbit | load.rdstate());
714 int len = str1.length();
716 int found = str1.find(';',pos);
717 str2 = str1.substr(pos,found-pos);
718 int eqpos = str2.find('=',0);
719 str3 = str2.substr(0,eqpos);
720 str4 = str2.substr(eqpos+1);
723 if (str3=="hexesMinLevel") _hexesMinLevel = atoi(str4.c_str());
724 if (str3=="hexesMaxLevel") _hexesMaxLevel = atoi(str4.c_str());
725 if (str3=="hexoticQuadrangles") {}
726 if (str3=="hexoticIgnoreRidges") _hexoticIgnoreRidges = (bool) atoi(str4.c_str());
727 if (str3=="hexoticInvalidElements") _hexoticInvalidElements = (bool) atoi(str4.c_str());
728 if (str3=="hexoticSharpAngleThreshold") _hexoticSharpAngleThreshold = atof(str4.c_str());
729 if (str3=="hexoticNbProc") _hexoticNbProc = atoi(str4.c_str());
730 if (str3=="hexoticWorkingDirectory") _hexoticWorkingDirectory = str4;
731 if (str3=="minSize") _minSize = atof(str4.c_str());
732 if (str3=="maxSize") _maxSize = atof(str4.c_str());
733 if (str3=="hexoticSdMode") _hexoticSdMode = atoi(str4.c_str());
734 if (str3=="hexoticVerbosity") _hexoticVerbosity = atoi(str4.c_str());
735 if (str3=="hexoticMaxMemory") _hexoticMaxMemory = atoi(str4.c_str());
736 if (str3=="textOptions")
738 replace(str4.begin(), str4.end(), '*', ' ');
739 //_textOptions = str4;
741 if (str3=="sizeMaps")
743 std::string sm_substr, sm_substr1, sm_substr2;
745 int sm_len = str4.length();
746 while ( sm_pos < sm_len )
748 int sm_found = str4.find('#',sm_pos);
749 sm_substr = str4.substr(sm_pos,sm_found-sm_pos);
750 int sm_slashpos = sm_substr.find('/',0);
751 sm_substr1 = sm_substr.substr(0,sm_slashpos);
752 sm_substr2 = sm_substr.substr(sm_slashpos+1);
753 _sizeMaps[sm_substr1] = atof(sm_substr2.c_str());
754 sm_pos = sm_found + 1;
757 if (str3 == "nbLayers") _nbLayers = atoi(str4.c_str());
758 if (str3 == "firstLayerSize") _firstLayerSize = atof(str4.c_str());
759 if (str3 == "direction") _direction = atoi(str4.c_str());
760 if (str3 == "growth") _growth = atof(str4.c_str());
761 if (str3 == "facesWithLayers")
765 while ( pos < str4.length() )
767 int found = str4.find('#',pos);
768 id = str4.substr(pos, found-pos);
769 _facesWithLayers.push_back(atoi(id.c_str()));
773 if (str3 == "imprintedFaces")
777 while ( pos < str4.length() )
779 int found = str4.find('#',pos);
780 id = str4.substr(pos, found-pos);
781 _imprintedFaces.push_back(atoi(id.c_str()));
787 // New options in 2.9.6 (issue #17784)
789 if ( static_cast<bool>( load >> _approxAngle ))
792 load >> i; _logInStandardOutput = (bool)i;
793 load >> i; _removeLogOnSuccess = (bool)i;
794 load >> i; _keepFiles = (bool)i;
796 std::string option, value;
797 if ( static_cast<bool>( load >> i ) && i >= 0 )
799 for ( int nbRead = 0; nbRead < i; ++nbRead )
801 load >> option >> value;
802 _option2value[ std::string( option, 1 )] = std::string( value, 1 );
805 if ( static_cast<bool>( load >> i ) && i >= 0 )
807 for ( int nbRead = 0; nbRead < i; ++nbRead )
809 load >> option >> value;
810 _customOption2value[ std::string( option, 1 )] = std::string( value, 1 );
814 else // pass old basic parameters to new advanced ones
816 SetHexesMinLevel ( _hexesMinLevel );
817 SetHexesMaxLevel ( _hexesMaxLevel );
818 SetHexoticIgnoreRidges ( _hexoticIgnoreRidges );
819 SetHexoticInvalidElements ( _hexoticInvalidElements );
820 SetHexoticSharpAngleThreshold( _hexoticSharpAngleThreshold );
821 SetHexoticNbProc ( _hexoticNbProc );
822 SetHexoticMaxMemory ( _hexoticMaxMemory );
828 //=============================================================================
832 //=============================================================================
833 std::ostream& operator <<(std::ostream& save, HexoticPlugin_Hypothesis& hyp)
835 return hyp.SaveTo( save );
838 //=============================================================================
842 //=============================================================================
843 std::istream& operator >>(std::istream& load, HexoticPlugin_Hypothesis& hyp)
845 return hyp.LoadFrom( load );
849 //================================================================================
851 * \brief Does nothing
852 * \param theMesh - the built mesh
853 * \param theShape - the geometry of interest
854 * \retval bool - always false
856 //================================================================================
857 bool HexoticPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/,
858 const TopoDS_Shape& /*theShape*/)
862 //================================================================================
864 * \brief Initialize my parameter values by default parameters.
865 * \retval bool - true if parameter values have been successfully defined
867 //================================================================================
869 bool HexoticPlugin_Hypothesis::SetParametersByDefaults(const TDefaults& /*dflts*/,
870 const SMESH_Mesh* /*theMesh*/)
875 //=============================================================================
876 int HexoticPlugin_Hypothesis::GetDefaultHexesMinLevel()
881 int HexoticPlugin_Hypothesis::GetDefaultHexesMaxLevel()
886 double HexoticPlugin_Hypothesis::GetDefaultMinSize()
891 double HexoticPlugin_Hypothesis::GetDefaultMaxSize()
896 bool HexoticPlugin_Hypothesis::GetDefaultHexoticIgnoreRidges()
901 bool HexoticPlugin_Hypothesis::GetDefaultHexoticInvalidElements()
906 double HexoticPlugin_Hypothesis::GetDefaultHexoticSharpAngleThreshold()
911 int HexoticPlugin_Hypothesis::GetDefaultHexoticNbProc()
916 std::string HexoticPlugin_Hypothesis::GetDefaultHexoticWorkingDirectory()
920 char *Tmp_dir = getenv("SALOME_TMP_DIR");
922 if(Tmp_dir == NULL) {
923 Tmp_dir = getenv("TEMP");
925 Tmp_dir = getenv("TMP");
928 if( Tmp_dir != NULL ) {
929 aTmpDir = std::string(Tmp_dir);
931 if(aTmpDir[aTmpDir.size()-1] != '\\') aTmpDir+='\\';
933 if(aTmpDir[aTmpDir.size()-1] != '/') aTmpDir+='/';
946 int HexoticPlugin_Hypothesis::GetDefaultHexoticSdMode()
951 int HexoticPlugin_Hypothesis::GetDefaultHexoticVerbosity()
956 int HexoticPlugin_Hypothesis::GetDefaultHexoticMaxMemory()
961 std::string HexoticPlugin_Hypothesis::GetDefaultTextOptions()
966 HexoticPlugin_Hypothesis::THexoticSizeMaps HexoticPlugin_Hypothesis::GetDefaultHexoticSizeMaps()
968 return THexoticSizeMaps();
971 int HexoticPlugin_Hypothesis::GetDefaultNbLayers()
976 double HexoticPlugin_Hypothesis::GetDefaultFirstLayerSize()
981 bool HexoticPlugin_Hypothesis::GetDefaultDirection()
986 double HexoticPlugin_Hypothesis::GetDefaultGrowth()
991 std::vector<int> HexoticPlugin_Hypothesis::GetDefaultFacesWithLayers()
993 return std::vector<int>();
996 std::vector<int> HexoticPlugin_Hypothesis::GetDefaultImprintedFaces()
998 return std::vector<int>();