-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015 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
_preCadFacesPeriodicityVector(GetDefaultPreCadFacesPeriodicityVector()),
_preCadEdgesPeriodicityVector(GetDefaultPreCadEdgesPeriodicityVector())
{
- _name = "BLSURF_Parameters";
+ _name = GetHypType();
_param_algo_dim = 2;
// _GMFFileMode = false; // GMF ascii mode
"proximity", // default = 0
"rectify_jacobian", // default = 1
"respect_geometry", // default = 1
+ "optimise_tiny_edges", // default = 0
+ "remove_duplicate_cad_faces", // default = 1
+ "tiny_edge_avoid_surface_intersections", // default = 1
+ "tiny_edge_respect_geometry", // default = 0
"" // mark of end
};
const char* doubleOptionNames[] = { "surface_intersections_processing_max_cost",// default = 15
"periodic_tolerance", // default = diag/100
"prox_ratio",
+ "volume_gradation",
+ "tiny_edge_optimisation_length", // default = diag * 1e-6
"" // mark of end
};
const char* charOptionNames[] = { "required_entities", // default = "respect"
throw (std::invalid_argument) {
TOptionValues::iterator op_val = _option2value.find(optionName);
if (op_val == _option2value.end()) {
- std::string msg = "Unknown BLSURF option: '" + optionName + "'";
+ std::string msg = "Unknown MG-CADSurf option: '" + optionName + "'";
throw std::invalid_argument(msg);
}
if (op_val->second != optionValue) {
throw (std::invalid_argument) {
TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
if (op_val == _preCADoption2value.end()) {
- std::string msg = "Unknown BLSURF option: '" + optionName + "'";
+ std::string msg = "Unknown MG-CADSurf option: '" + optionName + "'";
throw std::invalid_argument(msg);
}
if (op_val->second != optionValue) {
std::string BLSURFPlugin_Hypothesis::GetOptionValue(const std::string& optionName) throw (std::invalid_argument) {
TOptionValues::iterator op_val = _option2value.find(optionName);
if (op_val == _option2value.end()) {
- std::string msg = "Unknown BLSURF option: <";
+ std::string msg = "Unknown MG-CADSurf option: <";
msg += optionName + ">";
throw std::invalid_argument(msg);
}
//=============================================================================
void BLSURFPlugin_Hypothesis::ClearOption(const std::string& optionName) {
- TOptionValues::iterator op_val = _option2value.find(optionName);
- if (op_val != _option2value.end())
- op_val->second.clear();
+ TOptionValues::iterator op_val = _customOption2value.find(optionName);
+ if (op_val != _customOption2value.end())
+ _customOption2value.erase(op_val);
+ else {
+ op_val = _option2value.find(optionName);
+ if (op_val != _option2value.end())
+ op_val->second.clear();
+ }
}
//=============================================================================
void BLSURFPlugin_Hypothesis::ClearPreCADOption(const std::string& optionName) {
+ TOptionValues::iterator op_val = _customPreCADOption2value.find(optionName);
+ if (op_val != _customPreCADOption2value.end())
+ _customPreCADOption2value.erase(op_val);
+ else {
+ op_val = _preCADoption2value.find(optionName);
+ if (op_val != _preCADoption2value.end())
+ op_val->second.clear();
+ }
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::AddOption(const std::string& optionName, const std::string& optionValue)
+{
+ TOptionValues::iterator op_val = _option2value.find(optionName);
+ if (op_val != _option2value.end()) {
+ if (op_val->second != optionValue)
+ op_val->second = optionValue;
+ }
+ else {
+ op_val = _customOption2value.find(optionName);
+ if (op_val == _customOption2value.end())
+ _customOption2value[optionName] = optionValue;
+ else if (op_val->second != optionValue)
+ op_val->second = optionValue;
+ }
+ NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::AddPreCADOption(const std::string& optionName, const std::string& optionValue)
+{
TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
- if (op_val != _preCADoption2value.end())
- op_val->second.clear();
+ if (op_val != _preCADoption2value.end()) {
+ if (op_val->second != optionValue)
+ op_val->second = optionValue;
+ }
+ else {
+ op_val = _customPreCADOption2value.find(optionName);
+ if (op_val == _customPreCADOption2value.end())
+ _customPreCADOption2value[optionName] = optionValue;
+ else if (op_val->second != optionValue)
+ op_val->second = optionValue;
+ }
+ NotifySubMeshesHypothesisModification();
+}
+
+//=============================================================================
+std::string BLSURFPlugin_Hypothesis::GetOption(const std::string& optionName)
+{
+ TOptionValues::iterator op_val = _customOption2value.find(optionName);
+ if (op_val != _customOption2value.end())
+ return op_val->second;
+ else
+ return "";
+}
+
+//=============================================================================
+std::string BLSURFPlugin_Hypothesis::GetPreCADOption(const std::string& optionName)
+{
+ TOptionValues::iterator op_val = _customPreCADOption2value.find(optionName);
+ if (op_val != _customPreCADOption2value.end())
+ return op_val->second;
+ else
+ return "";
}
//=======================================================================
//=============================================================================
std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
// We must keep at least the same number of arguments when increasing the SALOME version
- // When BLSURF becomes CADMESH, some parameters were fused into a single one. Thus the same
+ // When MG-CADSurf becomes CADMESH, some parameters were fused into a single one. Thus the same
// parameter can be written several times to keep the old global number of parameters.
// Treat old options which are now in the advanced options
save << " " << "__OPTIONS_END__";
}
+ op_val = _customOption2value.begin();
+ if (op_val != _customOption2value.end()) {
+ save << " " << "__CUSTOM_OPTIONS_BEGIN__";
+ for (; op_val != _customOption2value.end(); ++op_val) {
+ if (!op_val->second.empty())
+ save << " " << op_val->first << " " << op_val->second << "%#"; // "%#" is a mark of value end
+ }
+ save << " " << "__CUSTOM_OPTIONS_END__";
+ }
+
op_val = _preCADoption2value.begin();
if (op_val != _preCADoption2value.end()) {
save << " " << "__PRECAD_OPTIONS_BEGIN__";
save << " " << "__PRECAD_OPTIONS_END__";
}
+ op_val = _customPreCADOption2value.begin();
+ if (op_val != _customPreCADOption2value.end()) {
+ save << " " << "__CUSTOM_PRECAD_OPTIONS_BEGIN__";
+ for (; op_val != _customPreCADOption2value.end(); ++op_val) {
+ if (!op_val->second.empty())
+ save << " " << op_val->first << " " << op_val->second << "%#"; // "%#" is a mark of value end
+ }
+ save << " " << "__CUSTOM_PRECAD_OPTIONS_END__";
+ }
+
TSizeMap::iterator it_sm = _sizeMap.begin();
if (it_sm != _sizeMap.end()) {
save << " " << "__SIZEMAP_BEGIN__";
bool hasCADSurfOptions = false;
bool hasOptions = false;
+ bool hasCustomOptions = false;
bool hasPreCADOptions = false;
+ bool hasCustomPreCADOptions = false;
bool hasSizeMap = false;
bool hasAttractor = false;
bool hasNewAttractor = false;
}
if (option_or_sm == "__OPTIONS_BEGIN__")
hasOptions = true;
+ else if (option_or_sm == "__CUSTOM_OPTIONS_BEGIN__")
+ hasCustomOptions = true;
else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
hasPreCADOptions = true;
+ else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+ hasCustomPreCADOptions = true;
else if (option_or_sm == "__SIZEMAP_BEGIN__")
hasSizeMap = true;
else if (option_or_sm == "__ATTRACTORS_BEGIN__")
if (isOK)
if (option_or_sm == "__OPTIONS_BEGIN__")
hasOptions = true;
+ else if (option_or_sm == "__CUSTOM_OPTIONS_BEGIN__")
+ hasCustomOptions = true;
else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
hasPreCADOptions = true;
+ else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+ hasCustomPreCADOptions = true;
else if (option_or_sm == "__SIZEMAP_BEGIN__")
hasSizeMap = true;
else if (option_or_sm == "__ATTRACTORS_BEGIN__")
}
if (hasOptions) {
+ isOK = (load >> option_or_sm);
+ if (isOK)
+ if (option_or_sm == "__CUSTOM_OPTIONS_BEGIN__")
+ hasCustomOptions = true;
+ else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
+ hasPreCADOptions = true;
+ else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+ hasCustomPreCADOptions = true;
+ else if (option_or_sm == "__SIZEMAP_BEGIN__")
+ hasSizeMap = true;
+ else if (option_or_sm == "__ATTRACTORS_BEGIN__")
+ hasAttractor = true;
+ else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+ hasNewAttractor = true;
+ else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
+ }
+
+ while (isOK && hasCustomOptions) {
+ isOK = (load >> optName);
+ if (isOK) {
+ if (optName == "__CUSTOM_OPTIONS_END__")
+ break;
+ isOK = (load >> optValue);
+ }
+ if (isOK) {
+ std::string& value = optValue;
+ int len = value.size();
+ // continue reading until "%#" encountered
+ while (value[len - 1] != '#' || value[len - 2] != '%') {
+ isOK = (load >> optValue);
+ if (isOK) {
+ value += " ";
+ value += optValue;
+ len = value.size();
+ } else {
+ break;
+ }
+ }
+ _customOption2value[optName] = value.substr(0,len-2);
+ value[len - 2] = '\0'; //cut off "%#"
+ }
+ }
+
+ if (hasCustomOptions) {
isOK = (load >> option_or_sm);
if (isOK)
if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
hasPreCADOptions = true;
+ else if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+ hasCustomPreCADOptions = true;
else if (option_or_sm == "__SIZEMAP_BEGIN__")
hasSizeMap = true;
else if (option_or_sm == "__ATTRACTORS_BEGIN__")
}
if (hasPreCADOptions) {
+ isOK = (load >> option_or_sm);
+ if (isOK)
+ if (option_or_sm == "__CUSTOM_PRECAD_OPTIONS_BEGIN__")
+ hasCustomPreCADOptions = true;
+ else if (option_or_sm == "__SIZEMAP_BEGIN__")
+ hasSizeMap = true;
+ else if (option_or_sm == "__ATTRACTORS_BEGIN__")
+ hasAttractor = true;
+ else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+ hasNewAttractor = true;
+ else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertex = true;
+ else if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+ hasPreCADFacesPeriodicity = true;
+ else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+ hasPreCADEdgesPeriodicity = true;
+ else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+ hasFacesPeriodicity = true;
+ else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+ hasEdgesPeriodicity = true;
+ else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+ hasVerticesPeriodicity = true;
+ }
+
+ while (isOK && hasCustomPreCADOptions) {
+ isOK = (load >> optName);
+ if (isOK) {
+ if (optName == "__CUSTOM_PRECAD_OPTIONS_END__")
+ break;
+ isOK = (load >> optValue);
+ }
+ if (isOK) {
+ std::string& value = optValue;
+ int len = value.size();
+ // continue reading until "%#" encountered
+ while (value[len - 1] != '#' || value[len - 2] != '%') {
+ isOK = (load >> optValue);
+ if (isOK) {
+ value += " ";
+ value += optValue;
+ len = value.size();
+ } else {
+ break;
+ }
+ }
+ _customPreCADOption2value[optName] = value.substr(0,len-2);
+ value[len - 2] = '\0'; //cut off "%#"
+ }
+ }
+
+ if (hasCustomPreCADOptions) {
isOK = (load >> option_or_sm);
if (isOK)
if (option_or_sm == "__SIZEMAP_BEGIN__")