myMaximumMemory(-1),
myInitialMemory(-1),
myOptimizationLevel(DefaultOptimizationLevel()),
- myBoundaryLayersInward(DefaultBoundaryLayersInward()),
- myElemGenTetraDominant(DefaultElemGenTetraDominant()),
+ myCollisionMode(DefaultCollisionMode()),
+ myBoundaryLayersGrowth(DefaultBoundaryLayersGrowth()),
+ myElementGeneration(DefaultElementGeneration()),
myAddMultinormals(DefaultAddMultinormals()),
mySmoothNormals(DefaultSmoothNormals()),
myHeightFirstLayer(DefaultHeightFirstLayer()),
//=======================================================================
//function : GetOptimizationLevel
//=======================================================================
-
HYBRIDPlugin_Hypothesis::OptimizationLevel HYBRIDPlugin_Hypothesis::GetOptimizationLevel() const
{
return (OptimizationLevel) myOptimizationLevel;
}
-
//=======================================================================
-//function : SetBoundaryLayersInward
+//function : SetCollisionMode
//=======================================================================
-
-void HYBRIDPlugin_Hypothesis::SetBoundaryLayersInward(bool toBoundaryLayersInward)
+void HYBRIDPlugin_Hypothesis::SetCollisionMode(CollisionMode mode)
{
- if ( myBoundaryLayersInward != toBoundaryLayersInward ) {
- myBoundaryLayersInward = toBoundaryLayersInward;
+ if ( myCollisionMode != mode ) {
+ myCollisionMode = mode;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
-//function : GetBoundaryLayersInward
+//function : GetCollisionMode
//=======================================================================
+HYBRIDPlugin_Hypothesis::CollisionMode HYBRIDPlugin_Hypothesis::GetCollisionMode() const
+{
+ return (CollisionMode) myCollisionMode;
+}
-bool HYBRIDPlugin_Hypothesis::GetBoundaryLayersInward() const
+//=======================================================================
+//function : SetBoundaryLayersGrowth
+//=======================================================================
+void HYBRIDPlugin_Hypothesis::SetBoundaryLayersGrowth(BoundaryLayersGrowth mode)
{
- return myBoundaryLayersInward;
+ if ( myBoundaryLayersGrowth != mode ) {
+ myBoundaryLayersGrowth = mode;
+ NotifySubMeshesHypothesisModification();
+ }
}
//=======================================================================
-//function : SetElemGenTetraDominant
+//function : GetBoundaryLayersGrowth
//=======================================================================
+HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth HYBRIDPlugin_Hypothesis::GetBoundaryLayersGrowth() const
+{
+ return (BoundaryLayersGrowth) myBoundaryLayersGrowth;
+}
-void HYBRIDPlugin_Hypothesis::SetElemGenTetraDominant(bool toElemGenTetraDominant)
+//=======================================================================
+//function : SetElementGeneration
+//=======================================================================
+void HYBRIDPlugin_Hypothesis::SetElementGeneration(ElementGeneration mode)
{
- if ( myElemGenTetraDominant != toElemGenTetraDominant ) {
- myElemGenTetraDominant = toElemGenTetraDominant;
+ if ( myElementGeneration != mode ) {
+ myElementGeneration = mode;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
-//function : GetElemGenTetraDominant
+//function : GetElementGeneration
//=======================================================================
-
-bool HYBRIDPlugin_Hypothesis::GetElemGenTetraDominant() const
+HYBRIDPlugin_Hypothesis::ElementGeneration HYBRIDPlugin_Hypothesis::GetElementGeneration() const
{
- return myElemGenTetraDominant;
+ return (ElementGeneration) myElementGeneration;
}
//=======================================================================
//function : SetAddMultinormals
//=======================================================================
-
void HYBRIDPlugin_Hypothesis::SetAddMultinormals(bool toAddMultinormals)
{
if ( myAddMultinormals != toAddMultinormals ) {
}
//=======================================================================
-//function : DefaultOptimizationLevel
+//function : DefaultCollisionMode
//=======================================================================
+short HYBRIDPlugin_Hypothesis::DefaultCollisionMode()
+{
+ return Decrease;
+}
+//=======================================================================
+//function : DefaultBoundaryLayersGrowth
+//=======================================================================
+short HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersGrowth()
+{
+ return Layer_Growth_Inward;
+}
+
+//=======================================================================
+//function : DefaultElementGeneration
+//=======================================================================
+short HYBRIDPlugin_Hypothesis::DefaultElementGeneration()
+{
+ return Generation_Tetra_Dominant;
+}
+
+//=======================================================================
+//function : DefaultOptimizationLevel
+//=======================================================================
short HYBRIDPlugin_Hypothesis::DefaultOptimizationLevel()
{
return Medium;
// return HYBRIDPlugin_Hypothesis::TID2SizeMap();
// }
-//=======================================================================
-//function : DefaultBoundaryLayersInward
-//=======================================================================
-bool HYBRIDPlugin_Hypothesis::DefaultBoundaryLayersInward()
-{
- return true;
-}
-
-//=======================================================================
-//function : DefaultElemGenTetraDominant
-//=======================================================================
-bool HYBRIDPlugin_Hypothesis::DefaultElemGenTetraDominant()
-{
- return true;
-}
-
//=======================================================================
//function : DefaultAddMultinormals
//=======================================================================
std::ostream & HYBRIDPlugin_Hypothesis::SaveTo(std::ostream & save)
{
- save << (int) myBoundaryLayersInward << " ";
- save << (int) myElemGenTetraDominant << " ";
+ save << (int) myBoundaryLayersGrowth << " ";
+ save << (int) myElementGeneration << " ";
save << (int) myAddMultinormals << " ";
save << (int) mySmoothNormals << " ";
isOK = (load >> i);
if (isOK)
- myBoundaryLayersInward = (bool) i;
+ myBoundaryLayersGrowth = (short) i;
else
load.clear(ios::badbit | load.rdstate());
isOK = (load >> i);
if (isOK)
- myElemGenTetraDominant = (bool) i;
+ myElementGeneration = (short) i;
else
load.clear(ios::badbit | load.rdstate());
//================================================================================
std::string HYBRIDPlugin_Hypothesis::CommandToRun(const HYBRIDPlugin_Hypothesis* hyp,
- const bool hasShapeToMesh)
+ const bool hasShapeToMesh)
{
TCollection_AsciiString cmd = GetExeName().c_str();
// check if any option is overridden by hyp->myTextOption
- bool p_v = hyp ? ( hyp->myTextOption.find("-v") == std::string::npos ) : true;
- //bool p_i = hyp ? ( hyp->myTextOption.find("-i") == std::string::npos ) : true;
- bool p_o = hyp ? ( hyp->myTextOption.find("-o") == std::string::npos ) : true;
- bool p_blsi = hyp ? ( hyp->myTextOption.find("-blsi") == std::string::npos ) : true;
- bool p_blsd = hyp ? ( hyp->myTextOption.find("-blsd") == std::string::npos ) : true;
- bool p_hotfl = hyp ? ( hyp->myTextOption.find("-hotfl") == std::string::npos ) : true;
- bool p_nobl = hyp ? ( hyp->myTextOption.find("-nobl") == std::string::npos ) : true;
- bool p_blgp = hyp ? ( hyp->myTextOption.find("-blgp") == std::string::npos ) : true;
- bool p_eg = hyp ? ( hyp->myTextOption.find("-eg") == std::string::npos ) : true;
- bool p_am = hyp ? ( hyp->myTextOption.find("-am") == std::string::npos ) : true;
- bool p_mat = hyp ? ( hyp->myTextOption.find("-mat") == std::string::npos ) : true;
- bool p_sn = hyp ? ( hyp->myTextOption.find("-sn") == std::string::npos ) : true;
-
- // verbose mode
- if ( p_v && hyp ) {
- cmd += " -v ";
+ bool p_h = ( hyp->myTextOption.find("-h") != std::string::npos );
+ bool p_v = ( hyp->myTextOption.find("-v ") != std::string::npos );
+ //bool p_i = ( hyp->myTextOption.find("-i") != std::string::npos );
+ //bool p_o = ( hyp->myTextOption.find("-o") != std::string::npos );
+ bool p_mnot = ( hyp->myTextOption.find("--max_number_of_threads ") != std::string::npos );
+ bool p_blsi = ( hyp->myTextOption.find("--boundary_layers_surface_ids ") != std::string::npos );
+ bool p_blii = ( hyp->myTextOption.find("--boundary_layers_imprint_ids ") != std::string::npos );
+ bool p_blsd = ( hyp->myTextOption.find("--boundary_layers_subdomain_direction ") != std::string::npos );
+ bool p_hotfl = ( hyp->myTextOption.find("--height_of_the_first_layer ") != std::string::npos );
+ bool p_nobl = ( hyp->myTextOption.find("--number_of_boundary_layers ") != std::string::npos );
+ bool p_blgp = ( hyp->myTextOption.find("--boundary_layers_geometric_progression ") != std::string::npos );
+ bool p_eg = ( hyp->myTextOption.find("--element_generation ") != std::string::npos );
+ bool p_cm = ( hyp->myTextOption.find("--collision_mode ") != std::string::npos );
+ bool p_am = ( hyp->myTextOption.find("--add_multinormals ") != std::string::npos );
+ bool p_mat = ( hyp->myTextOption.find("--multinormals_angle_threshold ") != std::string::npos );
+ bool p_sn = ( hyp->myTextOption.find("--smooth_normals ") != std::string::npos );
+
+ //help mode
+ if ( p_h ) {
+ cmd += " --help ";
+#ifdef WIN32
+ cmd += " < NUL";
+#endif
+ std::cout << "!!!!! CommandToRun help only !!!! " << cmd.ToCString() << std::endl;
+ return cmd.ToCString();
+ }
+
+ if ( !p_v && hyp ) {
+ cmd += " --verbose ";
cmd += hyp->myVerboseLevel;
}
- // options as text
- if ( hyp && !hyp->myTextOption.empty() ) {
- cmd += " ";
- cmd += (char*) hyp->myTextOption.c_str();
+ if ( !p_mnot && hyp ) {
+ cmd += " --max_number_of_threads ";
+ cmd += 8; //TODO getenv NB CPU
}
-
+
+ //if ( !p_blsi && hyp ) {
+ // cmd += " --boundary_layers_surface_ids ";
+ // cmd += 0; //TODO hyp->my;
+ //}
+
+ //if ( !p_blii && hyp ) {
+ // cmd += " --boundary_layers_imprint_ids ";
+ // cmd += 0; //TODO hyp->my;
+ //}
+
+ if ( !p_blsd && hyp ) {
+ if ( hyp->myBoundaryLayersGrowth >= 0 && hyp->myBoundaryLayersGrowth <= 1 ) {
+ const char* value[] = { "1" , "-1" };
+ cmd += " --boundary_layers_subdomain_direction ";
+ cmd += value[ hyp->myBoundaryLayersGrowth ];
+ }
+ }
+
+ if ( !p_hotfl && hyp ) {
+ cmd += " --height_of_the_first_layer ";
+ cmd += hyp->myHeightFirstLayer;
+ }
+
+ if ( !p_nobl && hyp ) {
+ cmd += " --number_of_boundary_layers ";
+ cmd += hyp->myNbOfBoundaryLayers;
+ }
+
+ if ( !p_blgp && hyp ) {
+ cmd += " --boundary_layers_geometric_progression ";
+ cmd += hyp->myBoundaryLayersProgression;
+ }
+
+ if ( !p_eg && hyp ) {
+ if ( hyp->myElementGeneration >= 0 && hyp->myElementGeneration <= 1 ) {
+ const char* value[] = { "tetra-dominant" , "hexa-dominant" };
+ cmd += " --element_generation ";
+ cmd += value[ hyp->myElementGeneration ];
+ }
+ }
+
+ if ( !p_cm && hyp ) {
+ if ( hyp->myCollisionMode >= 0 && hyp->myCollisionMode <= 1 ) {
+ const char* value[] = { "decrease" , "stop" };
+ cmd += " --collision_mode ";
+ cmd += value[ hyp->myCollisionMode ];
+ }
+ }
+
+ if ( !p_am && hyp ) {
+ int res = hyp->myAddMultinormals ? 0 : 1 ;
+ const char* value[] = { "yes" , "no" };
+ cmd += " --add_multinormals ";
+ cmd += value[ res ];
+ }
+
+ if ( !p_mat && hyp ) {
+ cmd += " --multinormals_angle_threshold ";
+ cmd += hyp->myMultinormalsAngle;
+ }
+
+ if ( !p_sn && hyp ) {
+ int res = hyp->mySmoothNormals ? 0 : 1 ;
+ const char* value[] = { "yes" , "no" };
+ cmd += " --smooth_normals ";
+ cmd += value[ res ];
+ }
+
#ifdef WIN32
cmd += " < NUL";
#endif
-
+ //std::cout << "!!!!!CommandToRun end " << cmd.ToCString() << std::endl;
+
return cmd.ToCString();
}