-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
#include "BLSURFPlugin_Hypothesis.hxx"
#include "BLSURFPlugin_Attractor.hxx"
-#include "SMESH_Gen_i.hxx"
-#include <utilities.h>
-#include <cstring>
-#include <iostream>
-#include <sstream>
+
+#include <SMESHDS_Group.hxx>
+#include <SMESHDS_Mesh.hxx>
+#include <SMESH_BoostTxtArchive.hxx>
+#include <SMESH_Gen_i.hxx>
+#include <SMESH_Group.hxx>
+#include <SMESH_TryCatch.hxx>
#include <Basics_Utils.hxx>
+#include <utilities.h>
// cascade include
-#include "ShapeAnalysis.hxx"
+#include <ShapeAnalysis.hxx>
// CORBA includes
#include CORBA_CLIENT_HEADER(SALOMEDS)
#define MESHGEMS_VERSION_HEX (MESHGEMS_VERSION_MAJOR << 16 | MESHGEMS_VERSION_MINOR << 8 | MESHGEMS_VERSION_PATCH)
#include <boost/archive/text_oarchive.hpp>
-#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/set.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/string.hpp>
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetPhysicalMesh(PhysicalMesh thePhysicalMesh) {
+void BLSURFPlugin_Hypothesis::SetPhysicalMesh(PhysicalMesh thePhysicalMesh)
+{
if (thePhysicalMesh != _physicalMesh) {
_physicalMesh = thePhysicalMesh;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetGeometricMesh(GeometricMesh theGeometricMesh) {
+void BLSURFPlugin_Hypothesis::SetGeometricMesh(GeometricMesh theGeometricMesh)
+{
if (theGeometricMesh != _geometricMesh) {
_geometricMesh = theGeometricMesh;
// switch (_geometricMesh) {
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetPhySize(double theVal, bool isRelative) {
+void BLSURFPlugin_Hypothesis::SetPhySize(double theVal, bool isRelative)
+{
if ((theVal != _phySize) || (isRelative != _phySizeRel)) {
_phySizeRel = isRelative;
if (theVal == 0) {
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetMinSize(double theMinSize, bool isRelative) {
+void BLSURFPlugin_Hypothesis::SetMinSize(double theMinSize, bool isRelative)
+{
if ((theMinSize != _minSize) || (isRelative != _minSizeRel)) {
_minSizeRel = isRelative;
_minSize = theMinSize;
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetMaxSize(double theMaxSize, bool isRelative) {
+void BLSURFPlugin_Hypothesis::SetMaxSize(double theMaxSize, bool isRelative)
+{
if ((theMaxSize != _maxSize) || (isRelative != _maxSizeRel)) {
_maxSizeRel = isRelative;
_maxSize = theMaxSize;
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetUseGradation(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetUseGradation(bool theVal)
+{
if (theVal != _useGradation) {
_useGradation = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetGradation(double theVal) {
+void BLSURFPlugin_Hypothesis::SetGradation(double theVal)
+{
_useGradation = ( theVal > 0 );
if (theVal != _gradation) {
_gradation = theVal;
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetUseVolumeGradation(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetUseVolumeGradation(bool theVal)
+{
if (theVal != _useVolumeGradation) {
_useVolumeGradation = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetVolumeGradation(double theVal) {
+void BLSURFPlugin_Hypothesis::SetVolumeGradation(double theVal)
+{
_useVolumeGradation = ( theVal > 0 );
if (theVal != _volumeGradation) {
_volumeGradation = theVal;
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetElementType(ElementType theElementType) {
+void BLSURFPlugin_Hypothesis::SetElementType(ElementType theElementType)
+{
if (theElementType != _elementType) {
_elementType = theElementType;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetAngleMesh(double theVal) {
+void BLSURFPlugin_Hypothesis::SetAngleMesh(double theVal)
+{
if (theVal != _angleMesh) {
_angleMesh = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetChordalError(double theDistance) {
+void BLSURFPlugin_Hypothesis::SetChordalError(double theDistance)
+{
if (theDistance != _chordalError) {
_chordalError = theDistance;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetAnisotropic(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetAnisotropic(bool theVal)
+{
if (theVal != _anisotropic) {
_anisotropic = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetAnisotropicRatio(double theVal) {
+void BLSURFPlugin_Hypothesis::SetAnisotropicRatio(double theVal)
+{
if (theVal != _anisotropicRatio) {
_anisotropicRatio = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetRemoveTinyEdges(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetRemoveTinyEdges(bool theVal)
+{
if (theVal != _removeTinyEdges) {
_removeTinyEdges = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetTinyEdgeLength(double theVal) {
+void BLSURFPlugin_Hypothesis::SetTinyEdgeLength(double theVal)
+{
if (theVal != _tinyEdgeLength) {
_tinyEdgeLength = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetOptimiseTinyEdges(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetOptimiseTinyEdges(bool theVal)
+{
if (theVal != _optimiseTinyEdges) {
_optimiseTinyEdges = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetTinyEdgeOptimisationLength(double theVal) {
+void BLSURFPlugin_Hypothesis::SetTinyEdgeOptimisationLength(double theVal)
+{
if (theVal != _tinyEdgeOptimisationLength) {
_tinyEdgeOptimisationLength = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetCorrectSurfaceIntersection(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetCorrectSurfaceIntersection(bool theVal)
+{
if (theVal != _correctSurfaceIntersec) {
_correctSurfaceIntersec = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetCorrectSurfaceIntersectionMaxCost(double theVal) {
+void BLSURFPlugin_Hypothesis::SetCorrectSurfaceIntersectionMaxCost(double theVal)
+{
if (theVal != _corrSurfaceIntersCost) {
_corrSurfaceIntersCost = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetBadElementRemoval(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetBadElementRemoval(bool theVal)
+{
if (theVal != _badElementRemoval) {
_badElementRemoval = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetBadElementAspectRatio(double theVal) {
+void BLSURFPlugin_Hypothesis::SetBadElementAspectRatio(double theVal)
+{
if (theVal != _badElementAspectRatio) {
_badElementAspectRatio = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetOptimizeMesh(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetOptimizeMesh(bool theVal)
+{
if (theVal != _optimizeMesh) {
_optimizeMesh = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetQuadraticMesh(bool theVal) {
+void BLSURFPlugin_Hypothesis::SetQuadraticMesh(bool theVal)
+{
if (theVal != _quadraticMesh) {
_quadraticMesh = theVal;
NotifySubMeshesHypothesisModification();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetTopology(Topology theTopology) {
+void BLSURFPlugin_Hypothesis::SetTopology(Topology theTopology)
+{
if (theTopology != _topology) {
_topology = theTopology;
NotifySubMeshesHypothesisModification();
_hyperPatchList[ *iPatch ].clear();
}
if ( iPatches.size() > 1 )
- for ( int j = _hyperPatchList.size()-1; j > 0; --j )
+ for ( int j = (int) _hyperPatchList.size()-1; j > 0; --j )
if ( _hyperPatchList[j].empty() )
_hyperPatchList.erase( _hyperPatchList.begin() + j );
}
for ( size_t i = 0; i < hpl.size(); ++i )
if ( hpl[i].count( faceTag ))
{
- if ( iPatch ) *iPatch = i;
+ if ( iPatch ) *iPatch = (int) i;
return *( hpl[i].begin() );
}
}
return faceTag;
}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetEnforcedMeshes( std::vector< EnforcedMesh > & enforcedMeshes )
+{
+ if ( _enforcedMeshes != enforcedMeshes )
+ {
+ _enforcedMeshes.swap( enforcedMeshes );
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Return elements of 1D enforced mesh. Result can be NULL
+ */
+//================================================================================
+
+SMDS_ElemIteratorPtr
+BLSURFPlugin_Hypothesis::GetEnforcedSegments( const EnforcedMesh& enfMesh,
+ SMESH_Mesh* & mesh ) const
+{
+ SMDS_ElemIteratorPtr it;
+ if (( mesh = SMESH_Hypothesis::GetMeshByPersistentID( enfMesh._meshID )))
+ {
+ mesh->Load();
+ if ( mesh->NbEdges() == 0 )
+ GetGen()->Compute( *mesh, mesh->GetShapeToMesh(), /*flags=*/0 );
+
+ switch( enfMesh._type )
+ {
+ case ENFORCED_MESH:
+ it = mesh->GetMeshDS()->elementsIterator( SMDSAbs_Edge );
+ break;
+
+ case ENFORCED_GROUP:
+ if ( SMESH_Group* grp = mesh->GetGroup( enfMesh._subID ))
+ {
+ if ( grp->GetGroupDS()->GetType() == SMDSAbs_Edge )
+ it = grp->GetGroupDS()->GetElements();
+ }
+ break;
+
+ case ENFORCED_SUBMESH:
+ if ( SMESH_subMesh* sm = mesh->GetSubMeshContaining( enfMesh._subID ))
+ if ( SMESHDS_SubMesh * smDS = sm->GetSubMeshDS() )
+ {
+ it = smDS->GetElements();
+ if ( it->more() && it->next()->GetType() != SMDSAbs_Edge )
+ it = SMDS_ElemIteratorPtr();
+ else
+ it = smDS->GetElements();
+ }
+ break;
+ }
+ }
+ return it;
+}
+
+
//=============================================================================
void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal)
{
// strip white spaces
while (ptr[0] == ' ')
ptr++;
- int i = strlen(ptr);
+ size_t i = strlen(ptr);
while (i != 0 && ptr[i - 1] == ' ')
i--;
// check value type
// strip white spaces
while (ptr[0] == ' ')
ptr++;
- int i = strlen(ptr);
+ size_t i = strlen(ptr);
while (i != 0 && ptr[i - 1] == ' ')
i--;
// check value type
if ( val.empty() && isDefault )
{
op_val = _defaultOptionValues.find( optionName );
- if (op_val != _option2value.end())
+ if (op_val != _defaultOptionValues.end())
val = op_val->second;
}
return val;
BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap BLSURFPlugin_Hypothesis::GetAllEnforcedVerticesByFace(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetAllEnforcedVerticesByFace() : GetDefaultFaceEntryEnfVertexListMap();
}
}
BLSURFPlugin_Hypothesis::TEnfVertexList BLSURFPlugin_Hypothesis::GetAllEnforcedVertices(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetAllEnforcedVertices() : GetDefaultEnfVertexList();
}
BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap BLSURFPlugin_Hypothesis::GetAllCoordsByFace(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetAllCoordsByFace() : GetDefaultFaceEntryCoordsListMap();
}
BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap BLSURFPlugin_Hypothesis::GetAllEnforcedVerticesByCoords(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetAllEnforcedVerticesByCoords() : GetDefaultCoordsEnfVertexMap();
}
BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap BLSURFPlugin_Hypothesis::GetAllEnfVertexEntriesByFace(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetAllEnfVertexEntriesByFace() : GetDefaultFaceEntryEnfVertexEntryListMap();
}
BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap BLSURFPlugin_Hypothesis::GetAllEnforcedVerticesByEnfVertexEntry(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetAllEnforcedVerticesByEnfVertexEntry() : GetDefaultEnfVertexEntryEnfVertexMap();
}
-std::set<int> BLSURFPlugin_Hypothesis::GetEnfVertexNodeIDs(TEnfGroupName theGroupName)
+std::set<smIdType> BLSURFPlugin_Hypothesis::GetEnfVertexNodeIDs(TEnfGroupName theGroupName)
{
TGroupNameNodeIDMap::const_iterator it = _groupNameNodeIDMap.find(theGroupName);
if (it != _groupNameNodeIDMap.end()) {
throw std::invalid_argument(msg.str());
}
-void BLSURFPlugin_Hypothesis::AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID)
+void BLSURFPlugin_Hypothesis::AddEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID)
{
_groupNameNodeIDMap[theGroupName].insert(theNodeID);
}
-void BLSURFPlugin_Hypothesis::RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID)
+void BLSURFPlugin_Hypothesis::RemoveEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID)
{
TGroupNameNodeIDMap::iterator it = _groupNameNodeIDMap.find(theGroupName);
if (it != _groupNameNodeIDMap.end()) {
- std::set<int>::iterator IDit = it->second.find(theNodeID);
+ std::set<smIdType>::iterator IDit = it->second.find(theNodeID);
if (IDit != it->second.end())
it->second.erase(IDit);
std::ostringstream msg;
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices) {
+void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices)
+{
if (toEnforceInternalVertices != _enforcedInternalVerticesAllFaces) {
_enforcedInternalVerticesAllFaces = toEnforceInternalVertices;
if (toEnforceInternalVertices)
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFacesGroup(BLSURFPlugin_Hypothesis::TEnfGroupName theGroupName) {
+void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFacesGroup(BLSURFPlugin_Hypothesis::TEnfGroupName theGroupName)
+{
if (std::string(theGroupName) != std::string(_enforcedInternalVerticesAllFacesGroup)) {
_enforcedInternalVerticesAllFacesGroup = theGroupName;
NotifySubMeshesHypothesisModification();
//=============================================================================
BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector BLSURFPlugin_Hypothesis::GetPreCadFacesPeriodicityVector(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetPreCadFacesPeriodicityVector() : GetDefaultPreCadFacesPeriodicityVector();
}
//=============================================================================
BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector BLSURFPlugin_Hypothesis::GetPreCadEdgesPeriodicityVector(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetPreCadEdgesPeriodicityVector() : GetDefaultPreCadEdgesPeriodicityVector();
}
//=============================================================================
BLSURFPlugin_Hypothesis::TFacesPeriodicityVector BLSURFPlugin_Hypothesis::GetFacesPeriodicityVector(
- const BLSURFPlugin_Hypothesis* hyp) {
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetFacesPeriodicityVector() : GetDefaultFacesPeriodicityVector();
}
//=============================================================================
BLSURFPlugin_Hypothesis::TEdgesPeriodicityVector BLSURFPlugin_Hypothesis::GetEdgesPeriodicityVector(
- const BLSURFPlugin_Hypothesis* hyp){
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetEdgesPeriodicityVector() : GetDefaultEdgesPeriodicityVector();
}
//=============================================================================
BLSURFPlugin_Hypothesis::TVerticesPeriodicityVector BLSURFPlugin_Hypothesis::GetVerticesPeriodicityVector(
- const BLSURFPlugin_Hypothesis* hyp){
+ const BLSURFPlugin_Hypothesis* hyp)
+{
return hyp ? hyp->_GetVerticesPeriodicityVector() : GetDefaultVerticesPeriodicityVector();
}
//=======================================================================
//function : ClearAllEnforcedVertices
//=======================================================================
-void BLSURFPlugin_Hypothesis::ClearPreCadPeriodicityVectors() {
+void BLSURFPlugin_Hypothesis::ClearPreCadPeriodicityVectors()
+{
_preCadFacesPeriodicityVector.clear();
_preCadEdgesPeriodicityVector.clear();
NotifySubMeshesHypothesisModification();
//function : AddPreCadFacesPeriodicity
//=======================================================================
void BLSURFPlugin_Hypothesis::AddPreCadFacesPeriodicity(TEntry theFace1Entry, TEntry theFace2Entry,
- std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries) {
+ std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries)
+{
TPreCadPeriodicity preCadFacesPeriodicity;
preCadFacesPeriodicity.shape1Entry = theFace1Entry;
//function : AddPreCadEdgesPeriodicity
//=======================================================================
void BLSURFPlugin_Hypothesis::AddPreCadEdgesPeriodicity(TEntry theEdge1Entry, TEntry theEdge2Entry,
- std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries) {
-
+ std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries)
+{
TPreCadPeriodicity preCadEdgesPeriodicity;
preCadEdgesPeriodicity.shape1Entry = theEdge1Entry;
preCadEdgesPeriodicity.shape2Entry = theEdge2Entry;
std::ostringstream hpStream;
boost::archive::text_oarchive( hpStream ) << _hyperPatchEntriesList;
std::string hpString = hpStream.str();
- save << " " << hpString.size() << " " << hpString;
+ SMESHDS_Hypothesis::SaveStringToStream( save, hpString );
+ // Enforced meshes
+ std::ostringstream enfMStream;
+ boost::archive::text_oarchive( enfMStream ) << _enforcedMeshes;
+ std::string enfMString = enfMStream.str();
+ SMESHDS_Hypothesis::SaveStringToStream( save, enfMString );
return save;
}
-void BLSURFPlugin_Hypothesis::SaveFacesPeriodicity(std::ostream & save){
-
+void BLSURFPlugin_Hypothesis::SaveFacesPeriodicity(std::ostream & save)
+{
TFacesPeriodicityVector::const_iterator it_faces_periodicity = _facesPeriodicityVector.begin();
if (it_faces_periodicity != _facesPeriodicityVector.end()) {
save << " " << "__FACES_PERIODICITY_BEGIN__";
}
}
-void BLSURFPlugin_Hypothesis::SaveEdgesPeriodicity(std::ostream & save){
-
+void BLSURFPlugin_Hypothesis::SaveEdgesPeriodicity(std::ostream & save)
+{
TEdgesPeriodicityVector::const_iterator it_edges_periodicity = _edgesPeriodicityVector.begin();
if (it_edges_periodicity != _edgesPeriodicityVector.end()) {
save << " " << "__EDGES_PERIODICITY_BEGIN__";
}
}
-void BLSURFPlugin_Hypothesis::SaveVerticesPeriodicity(std::ostream & save){
-
+void BLSURFPlugin_Hypothesis::SaveVerticesPeriodicity(std::ostream & save)
+{
TVerticesPeriodicityVector::const_iterator it_vertices_periodicity = _verticesPeriodicityVector.begin();
if (it_vertices_periodicity != _verticesPeriodicityVector.end()) {
save << " " << "__VERTICES_PERIODICITY_BEGIN__";
}
}
-void BLSURFPlugin_Hypothesis::SavePreCADPeriodicity(std::ostream & save, const char* shapeType) {
+void BLSURFPlugin_Hypothesis::SavePreCADPeriodicity(std::ostream & save, const char* shapeType)
+{
TPreCadPeriodicityVector precad_periodicity;
if ( shapeType && strcmp( shapeType, "FACES" ) == 0 )
precad_periodicity = _preCadFacesPeriodicityVector;
) {
std::string & value = _option2value[optName];
value = optValue;
- int len = value.size();
+ int len = (int) value.size();
// continue reading until "%#" encountered
while (value[len - 1] != '#' || value[len - 2] != '%') {
isOK = static_cast<bool>(load >> optValue);
if (isOK) {
value += " ";
value += optValue;
- len = value.size();
+ len = (int) value.size();
} else {
break;
}
}
if (isOK) {
std::string& value = optValue;
- int len = value.size();
+ int len = (int) value.size();
// continue reading until "%#" encountered
while (value[len - 1] != '#' || value[len - 2] != '%') {
isOK = static_cast<bool>(load >> optValue);
if (isOK) {
value += " ";
value += optValue;
- len = value.size();
+ len = (int) value.size();
} else {
break;
}
if (isOK) {
std::string & value = _preCADoption2value[optName];
value = optValue;
- int len = value.size();
+ int len = (int) value.size();
// continue reading until "%#" encountered
while (value[len - 1] != '#' || value[len - 2] != '%') {
isOK = static_cast<bool>(load >> optValue);
if (isOK) {
value += " ";
value += optValue;
- len = value.size();
+ len = (int) value.size();
} else {
break;
}
if (isOK) {
std::string & value2 = _sizeMap[smEntry];
value2 = smValue;
- int len2 = value2.size();
+ int len2 = (int) value2.size();
// continue reading until "%#" encountered
while (value2[len2 - 1] != '#' || value2[len2 - 2] != '%') {
isOK = static_cast<bool>(load >> smValue);
if (isOK) {
value2 += " ";
value2 += smValue;
- len2 = value2.size();
+ len2 = (int) value2.size();
} else {
break;
}
if (isOK) {
std::string & value3 = _attractors[atEntry];
value3 = atValue;
- int len3 = value3.size();
+ int len3 = (int) value3.size();
// continue reading until "%#" encountered
while (value3[len3 - 1] != '#' || value3[len3 - 2] != '%') {
isOK = static_cast<bool>(load >> atValue);
if (isOK) {
value3 += " ";
value3 += atValue;
- len3 = value3.size();
+ len3 = (int) value3.size();
} else {
break;
}
}
// hyper-patches as entries (issue bos #20543)
- if ( static_cast<bool>( load >> i ) && i > 0 )
+ std::string buffer;
+ if ( SMESHDS_Hypothesis::LoadStringFromStream( load, buffer ))
{
- std::string buffer( i, '\0' );
- load.get( buffer[0] ); // remove a white-space
- load.get( & buffer[0], i + 1 );
+ SMESH_TRY;
+ SMESHUtils::BoostTxtArchive( buffer ) >> _hyperPatchEntriesList;
+ SMESH_CATCH( SMESH::printErrorInDebugMode );
+ }
- std::istringstream istream( buffer.data() );
- boost::archive::text_iarchive archive( istream );
- try {
- archive >> _hyperPatchEntriesList;
- }
- catch (...) {}
+ // Enforced meshes (issue bos $16292)
+ buffer.clear();
+ if ( SMESHDS_Hypothesis::LoadStringFromStream( load, buffer ))
+ {
+ SMESH_TRY;
+ SMESHUtils::BoostTxtArchive( buffer ) >> _enforcedMeshes;
+ SMESH_CATCH( SMESH::printErrorInDebugMode );
}
return load;
}
-void BLSURFPlugin_Hypothesis::LoadFacesPeriodicity(std::istream & load){
+namespace boost {
+ namespace serialization {
+
+ //=======================================================================
+ //function : serialize
+ //purpose : serialize EnforcedMesh
+ //=======================================================================
+
+ template<class Archive>
+ void serialize(Archive & ar, BLSURFPlugin_Hypothesis::EnforcedMesh & enfM,
+ const unsigned int /*version*/)
+ {
+ ar & enfM._meshID;
+ ar & enfM._subID;
+ ar & enfM._type;
+ ar & enfM._groupName;
+ }
+
+ } // namespace serialization
+} // namespace boost
+
+void BLSURFPlugin_Hypothesis::LoadFacesPeriodicity(std::istream & load)
+{
bool isOK = true;
std::string periodicitySeparator;
}
-void BLSURFPlugin_Hypothesis::LoadEdgesPeriodicity(std::istream & load){
-
+void BLSURFPlugin_Hypothesis::LoadEdgesPeriodicity(std::istream & load)
+{
bool isOK = true;
std::string periodicitySeparator;
}
}
-void BLSURFPlugin_Hypothesis::LoadPreCADPeriodicity(std::istream & load, const char* shapeType) {
-
+void BLSURFPlugin_Hypothesis::LoadPreCADPeriodicity(std::istream & load, const char* shapeType)
+{
bool isOK = true;
std::string periodicitySeparator;
*/
//================================================================================
-bool BLSURFPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/, const TopoDS_Shape& /*theShape*/) {
+bool BLSURFPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* /*theMesh*/, const TopoDS_Shape& /*theShape*/)
+{
return false;
}
*/
//================================================================================
-double BLSURFPlugin_Hypothesis::GetDefaultPhySize(double diagonal, double bbSegmentation) {
+double BLSURFPlugin_Hypothesis::GetDefaultPhySize(double diagonal, double bbSegmentation)
+{
if (bbSegmentation != 0 && diagonal != 0)
return diagonal / bbSegmentation ;
return 10;
*/
//================================================================================
-double BLSURFPlugin_Hypothesis::GetDefaultMinSize(double diagonal) {
+double BLSURFPlugin_Hypothesis::GetDefaultMinSize(double diagonal)
+{
if (diagonal != 0)
return diagonal / 1000.0 ;
return undefinedDouble();
*/
//================================================================================
-double BLSURFPlugin_Hypothesis::GetDefaultMaxSize(double diagonal) {
+double BLSURFPlugin_Hypothesis::GetDefaultMaxSize(double diagonal)
+{
if (diagonal != 0)
return diagonal / 5.0 ;
return undefinedDouble();
*/
//================================================================================
-double BLSURFPlugin_Hypothesis::GetDefaultChordalError(double diagonal) {
+double BLSURFPlugin_Hypothesis::GetDefaultChordalError(double diagonal)
+{
if (diagonal != 0)
return diagonal;
return undefinedDouble();
*/
//================================================================================
-double BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeLength(double diagonal) {
+double BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeLength(double diagonal)
+{
if (diagonal != 0)
return diagonal * 1e-6 ;
return undefinedDouble();
*/
//================================================================================
-double BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeOptimisationLength(double diagonal) {
+double BLSURFPlugin_Hypothesis::GetDefaultTinyEdgeOptimisationLength(double diagonal)
+{
if (diagonal != 0)
return diagonal * 1e-6 ;
return undefinedDouble();
if ( isOk ) *isOk = true;
for ( size_t i = 0; i <= s.size(); ++i )
- s[i] = tolower( s[i] );
+ s[i] = (char) tolower( s[i] );
if ( s == "1" || s == "true" || s == "active" || s == "yes" )
return true;