-// Copyright (C) 2004-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2004-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//=============================================================================
//
#include "GHS3DPlugin_Hypothesis.hxx"
-#include <SMESH_ProxyMesh.hxx>
-#include <SMESH_Group.hxx>
-#include <StdMeshers_QuadToTriaAdaptor.hxx>
+
+#include <SMESHDS_Mesh.hxx>
#include <TCollection_AsciiString.hxx>
}
//=======================================================================
-//function : SetTextOption
+//function : SetAdvancedOption
//=======================================================================
-void GHS3DPlugin_Hypothesis::SetTextOption(const std::string& option)
+void GHS3DPlugin_Hypothesis::SetAdvancedOption(const std::string& option)
{
if ( myTextOption != option ) {
myTextOption = option;
}
//=======================================================================
-//function : GetTextOption
+//function : GetAdvancedOption
//=======================================================================
-std::string GHS3DPlugin_Hypothesis::GetTextOption() const
+std::string GHS3DPlugin_Hypothesis::GetAdvancedOption() const
{
return myTextOption;
}
//function : SetEnforcedVertex
//=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string theEntry, std::string theGroupName,
- double size, double x, double y, double z, bool isCompound)
+bool GHS3DPlugin_Hypothesis::SetEnforcedVertex(std::string theName,
+ std::string theEntry,
+ std::string theGroupName,
+ double size,
+ double x, double y, double z,
+ bool isCompound)
{
MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedVertex(\""<< theName << "\", \""<< theEntry << "\", \"" << theGroupName << "\", "
<< size << ", " << x << ", " << y << ", " << z << ", "<< isCompound << ")");
statex.dwLength = sizeof (statex);
long err = GlobalMemoryStatusEx (&statex);
if (err != 0) {
- long totMB =
- statex.ullTotalPhys / 1024 / 1024 +
- statex.ullTotalPageFile / 1024 / 1024 +
- statex.ullTotalVirtual / 1024 / 1024;
- return ( 0.7 * totMB );
+ double totMB = (double)statex.ullAvailPhys / 1024. / 1024.;
+ return (long)( 0.7 * totMB );
}
#endif
return 1024;
//================================================================================
std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp,
- const bool hasShapeToMesh)
+ const bool hasShapeToMesh,
+ const bool forExecutable)
{
- TCollection_AsciiString cmd = GetExeName().c_str();
+ std::string cmd = GetExeName();
// check if any option is overridden by hyp->myTextOption
bool max_memory = hyp ? ( hyp->myTextOption.find("--max_memory") == std::string::npos ) : true;
bool auto_memory = hyp ? ( hyp->myTextOption.find("--automatic_memory") == std::string::npos ) : true;
// so allow to use about all available memory
if ( max_memory ) {
long aMaximumMemory = hyp ? hyp->myMaximumMemory : -1;
- ostringstream tmpMaximumMemory;
cmd += " --max_memory ";
- if ( aMaximumMemory < 0 )
- tmpMaximumMemory << DefaultMaximumMemory();
- else
- tmpMaximumMemory << aMaximumMemory;
- cmd += tmpMaximumMemory.str().c_str();
+ if ( aMaximumMemory < 0 ) cmd += SMESH_Comment( DefaultMaximumMemory() );
+ else cmd += SMESH_Comment( aMaximumMemory );
}
if ( auto_memory && !useBndRecovery ) {
long aInitialMemory = hyp ? hyp->myInitialMemory : -1;
cmd += " --automatic_memory ";
- if ( aInitialMemory > 0 )
- cmd += (int)aInitialMemory;
- else
- cmd += "100";
+ if ( aInitialMemory > 0 ) cmd += SMESH_Comment( aInitialMemory );
+ else cmd += "100";
}
// component to mesh
if ( comp && !useBndRecovery ) {
cmd += " --components all";
else {
bool aToMeshHoles = hyp ? hyp->myToMeshHoles : DefaultMeshHoles();
- if ( aToMeshHoles )
- cmd += " --components all";
- else
- cmd += " --components outside_components";
+ if ( aToMeshHoles ) cmd += " --components all";
+ else cmd += " --components outside_components";
}
}
const bool toCreateNewNodes = ( no_int_points && ( !hyp || hyp->myToCreateNewNodes ));
// optimization level
- // This option need to be improved concerning new mg-tetra version
- if ( optim_level && hyp && !useBndRecovery && toCreateNewNodes ) {
+ if ( !toCreateNewNodes ) {
+ cmd += " --optimisation_level none"; // issue 22608
+ }
+ else if ( optim_level && hyp && !useBndRecovery ) {
if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 5 ) {
const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
cmd += " --optimisation_level ";
cmd += level[ hyp->myOptimizationLevel ];
}
}
- if ( !toCreateNewNodes ) {
- cmd += " --optimisation_level none"; // issue 22608
- }
// to create internal nodes
if ( no_int_points && !toCreateNewNodes ) {
- cmd += " --no_internal_points";
+ if ( forExecutable )
+ cmd += " --no_internal_points";
+ else
+ cmd += " --internalpoints no";
}
// verbose mode
if ( verbose && hyp ) {
- cmd += " --verbose ";
- cmd += hyp->myVerboseLevel;
+ cmd += " --verbose " + SMESH_Comment( hyp->myVerboseLevel );
}
// boundary recovery version
// to remove initial central point.
if ( rem && hyp && hyp->myToRemoveCentralPoint) {
- cmd += " --no_initial_central_point";
+ if ( forExecutable )
+ cmd += " --no_initial_central_point";
+ else
+ cmd += " --centralpoint no";
}
// options as text
if ( hyp && !hyp->myTextOption.empty() ) {
- cmd += " ";
- cmd += (char*) hyp->myTextOption.c_str();
+ cmd += " " + hyp->myTextOption;
}
// to define volumic gradation.
- if ( gra && hyp) {
- cmd += " -Dcpropa=";
- cmd += hyp->myGradation;
+ if ( gra && hyp ) {
+ if ( forExecutable )
+ cmd += " -Dcpropa=" + SMESH_Comment( hyp->myGradation );
+ else
+ cmd += " --gradation " + SMESH_Comment( hyp->myGradation );
}
#ifdef WIN32
cmd += " < NUL";
#endif
- return cmd.ToCString();
+ return cmd;
}
//================================================================================