-// Copyright (C) 2007-2020 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
#ifndef _BLSURFPlugin_Hypothesis_HXX_
#define _BLSURFPlugin_Hypothesis_HXX_
-#include "SMESH_Hypothesis.hxx"
+#include "BLSURFPlugin_Attractor.hxx"
+
+#include <SMDS_ElemIterator.hxx>
+#include <SMESH_Hypothesis.hxx>
+#include <smIdType.hxx>
+
#include <vector>
#include <map>
#include <set>
-#include <stdexcept>
#include <string>
-#include <cstring>
-#include <sstream>
-#include <utilities.h>
-#include "BLSURFPlugin_Attractor.hxx"
+
+class SMESH_Mesh;
// Parameters for work of MG-CADSurf
+enum EnforcedMeshType { ENFORCED_MESH, ENFORCED_GROUP, ENFORCED_SUBMESH };
+
class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
{
public:
std::string GetTags();
// Hyper-patches
- typedef std::set< int > THyperPatchTags;
- typedef std::vector< THyperPatchTags > THyperPatchList;
-
- void SetHyperPatches(const THyperPatchList& hpl);
- const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
+ typedef std::set< int > THyperPatchTags;
+ typedef std::vector< THyperPatchTags > THyperPatchList;
+ typedef std::set< std::string > THyperPatchEntries;
+ typedef std::vector< THyperPatchEntries > THyperPatchEntriesList;
+
+ void SetHyperPatches(const THyperPatchList& hpl, bool notifyMesh=true);
+ void SetHyperPatches(const THyperPatchEntriesList& hpl);
+ void SetHyperPatchIDsByEntry( const TopoDS_Shape& mainShape,
+ const std::map< std::string, TopoDS_Shape >& entryToShape);
+ const THyperPatchList& GetHyperPatches() const { return _hyperPatchList; }
+ const THyperPatchEntriesList& GetHyperPatchEntries() const { return _hyperPatchEntriesList; }
static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
+ // Enforced mesh
+ struct EnforcedMesh
+ {
+ int _meshID; // persistent mesh ID
+ int _subID; // either persistent group ID or sub-shape ID for sub-mesh
+ EnforcedMeshType _type; /* specify what _subID means:
+ - nothing for ENFORCED_MESH
+ - group ID for ENFORCED_GROUP
+ - sub-shape ID for ENFORCED_SUBMESH */
+ std::string _groupName; // name of a group to add mesh edges to
+
+ bool operator==(const EnforcedMesh& em ) const
+ {
+ return ( _meshID == em._meshID && _subID == em._subID &&
+ _type == em._type && _groupName == em._groupName );
+ }
+ };
+
+ void SetEnforcedMeshes( std::vector< EnforcedMesh > & enforcedMeshes );
+ const std::vector< EnforcedMesh > & GetEnforcedMeshes() const { return _enforcedMeshes; }
+ SMDS_ElemIteratorPtr GetEnforcedSegments( const EnforcedMesh& enfMesh,
+ SMESH_Mesh* & mesh ) const;
+
+
void SetPreCADMergeEdges(bool theVal);
bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
// Map Vertex entry / Enforced vertex
typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
- typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
+ typedef std::map< TEnfGroupName, std::set<smIdType> > TGroupNameNodeIDMap;
/* TODO GROUPS
// Map Group Name / List of enforced vertices
typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry);
TEnfVertex* GetEnfVertex(TEnfVertexCoords coords);
TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry);
- void AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
- std::set<int> GetEnfVertexNodeIDs(TEnfGroupName theGroupName);
- void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
+ void AddEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID);
+ std::set<smIdType> GetEnfVertexNodeIDs(TEnfGroupName theGroupName);
+ void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,smIdType theNodeID);
bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="");
bool ClearEnforcedVertices(const TEntry& theFaceEntry);
TSizeMap _attractors;
TAttractorMap _classAttractors;
- TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
- TEnfVertexList _enfVertexList;
+ TFaceEntryEnfVertexListMap _faceEntryEnfVertexListMap;
+ TEnfVertexList _enfVertexList;
// maps to get "manual" enf vertex (through their coordinates)
- TFaceEntryCoordsListMap _faceEntryCoordsListMap;
- TCoordsEnfVertexMap _coordsEnfVertexMap;
+ TFaceEntryCoordsListMap _faceEntryCoordsListMap;
+ TCoordsEnfVertexMap _coordsEnfVertexMap;
// maps to get "geom" enf vertex (through their geom entries)
- TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
- TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
- TGroupNameNodeIDMap _groupNameNodeIDMap;
+ TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
+ TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
+ TGroupNameNodeIDMap _groupNameNodeIDMap;
// Enable internal enforced vertices on specific face if requested by user
// TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
- bool _enforcedInternalVerticesAllFaces;
- TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
+ bool _enforcedInternalVerticesAllFaces;
+ TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
- TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
- TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
+ TPreCadPeriodicityVector _preCadFacesPeriodicityVector;
+ TPreCadPeriodicityVector _preCadEdgesPeriodicityVector;
+
+ TFacesPeriodicityVector _facesPeriodicityVector;
+ TEdgesPeriodicityVector _edgesPeriodicityVector;
+ TVerticesPeriodicityVector _verticesPeriodicityVector;
- TFacesPeriodicityVector _facesPeriodicityVector;
- TEdgesPeriodicityVector _edgesPeriodicityVector;
- TVerticesPeriodicityVector _verticesPeriodicityVector;
+ THyperPatchList _hyperPatchList;
+ THyperPatchEntriesList _hyperPatchEntriesList;
- THyperPatchList _hyperPatchList;
+ std::vector< EnforcedMesh > _enforcedMeshes; // enforced 1D meshes
// Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);