STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 1)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
SET(${PROJECT_NAME_UC}_VERSION
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
deactivated by setting this parameter to 0, giving priority to the tiny edge or bad surface element
removal.
+ - <b>use deprecated patch mesher</b> - This option reproduces the mesher behaviour of previous MG-CADSurf versions
+(MeshGems before 2.3, i.e. before SALOME 8.2). This has proved useful on some particular cases such as very small
+local size on a vertex situated on a border curve.
- <b>CAD preprocessor</b> options. The CAD preprocessor (formerly known as PreCAD) has two main goals:
interpolate two values, a linear interpolation is used by default, but
this can be modified by \ref blsurf_hinterpol_flag "hinterpol flag".
+<b>Note:</b> on some particular configurations, the mesher behaviour is
+not the same as before (SALOME versions before 8.2 i.e. MeshGems before 2.3).
+For a small local size defined on a point situated on a border curve,
+the previous mesher behaviour may be prefered:
+see "use deprecated patch mesher"
+on advanced tag.
+
+
\ref blsurf_local_size "Back to \"Local size\""\n
\ref blsurf_top "Back to top"
\image html blsurf_parameters_enforced_vertices.png
It is possible to define some enforced vertices to MG-CADSurf algorithm.
-An enforced vertex is defined on a Face or a Compound by
+An enforced vertex is defined by
- selecting an existing Vertex or Compound,
-- or creating a new vertex given its coordinates.
+- or by its coordinates.
The enforced vertex is the projection of a point defined by its
-(x,y,z) coordinates on the selected face.
+(x,y,z) coordinates on the closest face found by the application.
-- It is possible to define several enforced vertices on a face or a group of faces.
+- It is possible to define several enforced vertices.
- If the projected point is on the boundary or outside of the face, it will be ignored.
-- If a group name is specified : If the group exists, the enforced nodes will be added in the existing group, if the group does not exist it will be created.
+- If a group name is specified : if the group exists, the enforced nodes will be added in the existing group, if the group does not exist it will be created.
-All the internal vertices of the faces can be considered as enforced vertices if the corresponding checkbox is checked.
+All the internal vertices of faces can be considered as enforced vertices if the corresponding checkbox is checked.
A group can optionnaly be defined on those enforced vertices.
\sa Sample TUI Script of the \ref tui_blsurf "creation of a MG-CADSurf hypothesis", including enforced vertices.
\sa Sample TUI Script of the definition of MG-CADSurf periodicity \ref tui_blsurf_periodicity_preCAD "using preCAD".
+\section blsurf_hyperpatch Hyper-patch
+
+\image html blsurf_parameters_hyperpatch.png
+
+Hyper-patch tab page allows defining faces that will be meshes together as
+ part of a global hyper-patch.
+
+- <b>Hyper-patch IDs</b> table - shows IDs of faces of defined hyper-patches.
+
+- <b>Face selection</b> - activates selection of faces in the VTK Viewer.
+
+- <b>Group selection</b> - activates selection of faces and groups of
+ faces in the Object Browser.
+
+- \b IDs - allows typing IDs of faces composing a hyper-patch and
+ shows IDs of faces selected in the Viewer or the Object Browser.
+
+- \b Add - adds a new row to the table and moves \b IDs there.
+
+- \b Remove - removes selected hyper-patches from the table.
+
\ref blsurf_top "Back to top"
For more information on MeshGems-CADSurf, you can read its documentation at $MESHGEMS_ROOT_DIR/Docs/mg-cadsurf_user_manual.pdf
<ul>
$navpath
<li class="footer">
- Copyright © 2007-2016 CEA/DEN, EDF R&D<br>
+ Copyright © 2007-2017 CEA/DEN, EDF R&D<br>
</li>
</ul>
</div>
<ul>
$navpath
<li class="footer">
- Copyright © 2007-2016 CEA/DEN, EDF R&D<br>
+ Copyright © 2007-2017 CEA/DEN, EDF R&D<br>
</li>
</ul>
</div>
};
typedef sequence<TPreCadPeriodicity> TPeriodicityList;
+
+ // Hyper-patches
+ typedef sequence<long> THyperPatch;
+ typedef sequence<THyperPatch> THyperPatchList;
/*!
* BLSURFPlugin_BLSURF: interface of BLSURF algorithm
void SetJacobianRectification( in boolean allowRectification );
boolean GetJacobianRectification();
+ /*!
+ * Set use_deprecated_patch_mesher parameter (compatibility with older versions of Meshgems)
+ *
+ * the use_deprecated_patch_mesher parameter allows to keep the same behaviour than
+ * in salome < 8.3 (meshgems 2.1.11 instead of meshgems >= 2.4.5)
+ */
+ void SetUseDeprecatedPatchMesher( in boolean useDeprecatedPatchMesher );
+ boolean GetUseDeprecatedPatchMesher();
+
/*!
* Set max_number_of_points_per_patch parameter
*
void SetMaxNumberOfPointsPerPatch( in long nb ) raises (SALOME::SALOME_Exception);
long GetMaxNumberOfPointsPerPatch();
+
+ /*!
+ * Set max_number_of_threads parameter
+ *
+ * Set the maximum of threads to use for multithreading mesh computation.
+ */
+ void SetMaxNumberOfThreads( in long nb ) raises (SALOME::SALOME_Exception);
+ long GetMaxNumberOfThreads();
+
/*!
* Set respect_geometry parameter
*
string GetTags();
/*!
- * To merges edges.
+ * Set hyper-patches
*/
- void SetPreCADMergeEdges(in boolean toMergeEdges);
- boolean GetPreCADMergeEdges();
+ void SetHyperPatches(in THyperPatchList hpl);
+ THyperPatchList GetHyperPatches();
/*!
- * To remove tiny UV edges edges.
+ * To merges edges.
*/
- void SetPreCADRemoveTinyUVEdges(in boolean toRemoveTinyUVEdges);
- boolean GetPreCADRemoveTinyUVEdges();
+ void SetPreCADMergeEdges(in boolean toMergeEdges);
+ boolean GetPreCADMergeEdges();
/*!
* To remove duplicate CAD faces.
/*!
* Set/get/unset an enforced vertex on geom face
*/
+ // OBSOLETE
boolean SetEnforcedVertex(in GEOM::GEOM_Object theFace, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
boolean SetEnforcedVertexNamed(in GEOM::GEOM_Object theFace, in double x, in double y, in double z, in TEnfName theVertexName) raises (SALOME::SALOME_Exception);
boolean SetEnforcedVertexGeom(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
boolean SetEnforcedVertexNamedWithGroup(in GEOM::GEOM_Object theFace, in double x, in double y, in double z, in TEnfName theVertexName, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
boolean SetEnforcedVertexGeomWithGroup(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
-
TEnfVertexList GetEnforcedVertices(in GEOM::GEOM_Object theFace) raises (SALOME::SALOME_Exception);
-
boolean UnsetEnforcedVertex(in GEOM::GEOM_Object theFace, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
boolean UnsetEnforcedVertexGeom(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
boolean UnsetEnforcedVertices(in GEOM::GEOM_Object theFace) raises (SALOME::SALOME_Exception);
- /*!
- * Set/get/unset an enforced vertex on geom face given by entry
- */
- boolean SetEnforcedVertexEntry(in TEntry theFaceEntry, in double x, in double y, in double z,
+ // NEW - no face
+ boolean AddEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexNamed(in double x, in double y, in double z, in TEnfName theVertexName) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexWithGroup(in double x, in double y, in double z, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexNamedWithGroup(in double x, in double y, in double z, in TEnfName theVertexName, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+ boolean AddEnforcedVertexGeomWithGroup(in GEOM::GEOM_Object theVertex, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+
+ boolean RemoveEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+ boolean RemoveEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception);
+ boolean RemoveEnforcedVertices() raises (SALOME::SALOME_Exception);
+
+ /*!
+ * Set/get/unset an enforced vertex on geom face given by entry
+ */
+ boolean SetEnforcedVertexEntry(in TEntry theFaceEntry, in double x, in double y, in double z,
in TEnfName theVertexName, in TEntry theVertexEntry, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
TEnfVertexList GetEnforcedVerticesEntry(in TEntry theFaceEntry) raises (SALOME::SALOME_Exception);
server-lib="BLSURFEngine"
gui-lib="BLSURFPluginGUI">
<hypotheses>
+
<hypothesis type="MG-CADSurf Parameters"
label-id="MG-CADSurf Parameters"
icon-id="mesh_hypo_BLSURF.png"
UnsetEnforcedVertex,
UnsetEnforcedVertexGeom,
UnsetEnforcedVertices,
+ AddEnforcedVertex,
+ AddEnforcedVertexNamed,
+ AddEnforcedVertexGeom,
+ AddEnforcedVertexWithGroup,
+ AddEnforcedVertexNamedWithGroup,
+ AddEnforcedVertexGeomWithGroup,
+ RemoveEnforcedVertex,
+ RemoveEnforcedVertexGeom,
+ RemoveEnforcedVertices,
+ AddPreCadFacesPeriodicity
+ </accumulative-methods>
+ </python-wrap>
+ </hypothesis>
+
+ <hypothesis type="MG-CADSurf Parameters_NOGEOM"
+ label-id="MG-CADSurf Parameters"
+ icon-id="mesh_hypo_BLSURF.png"
+ dim="2">
+ <python-wrap>
+ <accumulative-methods>
+ SetOptionValue,
+ SetPreCADOptionValue,
+ UnsetOption,
+ UnsetPreCADOption,
+ AddOption,
+ AddPreCADOption,
+ SetSizeMap,
+ SetConstantSizeMap,
+ UnsetSizeMap,
+ SetAttractor,
+ UnsetAttractor,
+ SetAttractorGeom,
+ UnsetAttractorGeom,
+ SetEnforcedVertex,
+ SetEnforcedVertexNamed,
+ SetEnforcedVertexGeom,
+ SetEnforcedVertexWithGroup,
+ SetEnforcedVertexNamedWithGroup,
+ SetEnforcedVertexGeomWithGroup,
+ UnsetEnforcedVertex,
+ UnsetEnforcedVertexGeom,
+ UnsetEnforcedVertices,
+ AddEnforcedVertex,
+ AddEnforcedVertexNamed,
+ AddEnforcedVertexGeom,
+ AddEnforcedVertexWithGroup,
+ AddEnforcedVertexNamedWithGroup,
+ AddEnforcedVertexGeomWithGroup,
+ RemoveEnforcedVertex,
+ RemoveEnforcedVertexGeom,
+ RemoveEnforcedVertices,
AddPreCadFacesPeriodicity
</accumulative-methods>
</python-wrap>
</python-wrap>
</algorithm>
+ <algorithm type="MG-CADSurf_NOGEOM"
+ label-id="MG-CADSurf"
+ icon-id="mesh_algo_BLSURF.png"
+ opt-hypos="MG-CADSurf Parameters_NOGEOM"
+ output="TRIA,QUAD"
+ need-geom="never"
+ dim="2">
+ <python-wrap>
+ <algo>MG-CADSurf_NOGEOM=Triangle(algo=smeshBuilder.MG_CADSurf)</algo>
+ <hypo>MG-CADSurf Parameters_NOGEOM=Parameters()</hypo>
+ </python-wrap>
+ </algorithm>
+
</algorithms>
</meshers-group>
# Python API for the MG-CADSurf meshing plug-in module.
from salome.smesh.smesh_algorithm import Mesh_Algorithm
+import GEOM
LIBRARY = "libBLSURFEngine.so"
Mesh_Algorithm.__init__(self)
if noBLSURFPlugin:
print "Warning: BLSURFPlugin module unavailable"
- self.Create(mesh, geom, BLSURF, LIBRARY)
+ if mesh.GetMesh().HasShapeToMesh():
+ self.Create(mesh, geom, self.algoType, LIBRARY)
+ else:
+ self.Create(mesh, geom, self.algoType+"_NOGEOM", LIBRARY)
+ mesh.smeshpyD.SetName( self.algo, self.algoType )
self.params=None
self.geompyD = mesh.geompyD
#self.SetPhysicalMesh() - PAL19680
def SetJacobianRectification( self, allowRectification ):
self.Parameters().SetJacobianRectification( allowRectification )
+ ## Set use_deprecated_patch_mesher parameter (compatibility with older versions of Meshgems)
+ #
+ # the use_deprecated_patch_mesher parameter allows to keep the same behaviour than
+ # in salome < 8.3 (meshgems 2.1.11 instead of meshgems >= 2.4.5)
+ #
+ def SetUseDeprecatedPatchMesher( self, useDeprecatedPatchMesher ):
+ self.Parameters().SetUseDeprecatedPatchMesher( useDeprecatedPatchMesher )
+
## Set respect_geometry parameter
#
# This patch independent option can be deactivated to allow MeshGems-CADSurf
def SetMaxNumberOfPointsPerPatch( self, nb ):
self.Parameters().SetMaxNumberOfPointsPerPatch( nb )
+ ## Set max_number_of_threads parameter
+ #
+ # Set the maximum of threads to use for multithreading mesh computation
+ #
+ def SetMaxNumberOfThreads( self, nb ):
+ self.Parameters().SetMaxNumberOfThreads( nb )
+
## Set respect_geometry parameter
#
# This patch independent option can be deactivated to allow MeshGems-CADSurf
self.Parameters().SetPreCADMergeEdges(toMergeEdges)
pass
- ## To remove tiny UV edges.
- # @param toRemoveTinyUVEdges "remove_tiny_uv_edges" flag value
- def SetPreCADRemoveTinyUVEdges(self, toRemoveTinyUVEdges=False):
- self.Parameters().SetPreCADRemoveTinyUVEdges(toRemoveTinyUVEdges)
- pass
-
## To remove duplicate CAD Faces
# @param toRemoveDuplicateCADFaces "remove_duplicate_cad_faces" flag value
def SetPreCADRemoveDuplicateCADFaces(self, toRemoveDuplicateCADFaces=False):
return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName)
pass
+ ## Set an enforced vertex on a face given the coordinates of a point.
+ # The face if found by the application.
+ # @param x : x coordinate
+ # @param y : y coordinate
+ # @param z : z coordinate
+ # @param vertexName : name of the enforced vertex
+ # @param groupName : name of the group
+ def AddEnforcedVertex(self, x, y, z, vertexName = "", groupName = ""):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
+ if vertexName == "":
+ if groupName == "":
+ return self.Parameters().AddEnforcedVertex(x, y, z)
+ else:
+ return self.Parameters().AddEnforcedVertexWithGroup(x, y, z, groupName)
+ pass
+ else:
+ if groupName == "":
+ return self.Parameters().AddEnforcedVertexNamed(x, y, z, vertexName)
+ else:
+ return self.Parameters().AddEnforcedVertexNamedWithGroup( x, y, z, vertexName, groupName)
+ pass
+ pass
+
+ ## To set an enforced vertex on a face given a GEOM vertex, group or compound.
+ # The face if found by the application.
+ # @param theVertex : GEOM vertex (or group, compound).
+ # @param groupName : name of the group
+ def AddEnforcedVertexGeom(self, theVertex, groupName = ""):
+ from salome.smesh.smeshBuilder import AssureGeomPublished
+ AssureGeomPublished( self.mesh, theVertex )
+ if groupName == "":
+ return self.Parameters().AddEnforcedVertexGeom(theVertex)
+ else:
+ return self.Parameters().AddEnforcedVertexGeomWithGroup(theVertex,groupName)
+ pass
+
## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates.
# @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex
# @param x : x coordinate
# @return hypothesis object
def Parameters(self):
if not self.params:
- self.params = self.Hypothesis("MG-CADSurf Parameters", [],
- LIBRARY, UseExisting=0)
+ hypType = "MG-CADSurf Parameters"
+ hasGeom = self.mesh.GetMesh().HasShapeToMesh()
+ if hasGeom:
+ self.params = self.Hypothesis(hypType, [], LIBRARY, UseExisting=0)
+ else:
+ self.params = self.Hypothesis(hypType + "_NOGEOM", [], LIBRARY, UseExisting=0)
+ self.mesh.smeshpyD.SetName( self.params, hypType )
pass
return self.params
self.Parameters().AddPreCadEdgesPeriodicity(theEdge1, theEdge2)
pass
+ #-----------------------------------------
+ # Hyper-Patches
+ #-----------------------------------------
+
+ ## Defines hyper-patches. A hyper-patch is a set of adjacent faces meshed as a whole,
+ # ignoring edges between them
+ # @param hyperPatchList : list of hyper-patches. A hyper-patch is defined as a list of
+ # faces or groups of faces. A face can be identified either as a GEOM object or
+ # a face ID (returned e.g. by geompy.GetSubShapeID( mainShape, subShape )).
+ #
+ # Example: cadsurf.SetHyperPatches([[ Face_1, Group_2 ],[ 13, 23 ]])
+ def SetHyperPatches(self, hyperPatchList):
+ hpl = []
+ for patch in hyperPatchList:
+ ids = []
+ for face in patch:
+ if isinstance( face, int ):
+ ids.append( face )
+ elif isinstance( face, GEOM._objref_GEOM_Object):
+ faces = self.mesh.geompyD.SubShapeAll( face, self.mesh.geompyD.ShapeType["FACE"] )
+ for f in faces:
+ ids.append( self.mesh.geompyD.GetSubShapeID( self.mesh.geom, f ))
+ else:
+ raise TypeError, \
+ "Face of hyper-patch should be either ID or GEOM_Object, not %s" % type(face)
+ pass
+ hpl.append( ids )
+ pass
+ self.Parameters().SetHyperPatches( hpl )
+ return
+
#=====================
# Obsolete methods
#=====================
// OPENCASCADE includes
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakePolygon.hxx>
-//#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepGProp.hxx>
#include <BRepTools.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <GProp_GProps.hxx>
#include <Geom2d_Curve.hxx>
+#include <Geom2d_Line.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
+#include <NCollection_DataMap.hxx>
#include <NCollection_Map.hxx>
#include <Standard_ErrorHandler.hxx>
#include <TopExp.hxx>
std::map< int, BLSURFPlugin_Hypothesis::TEnfVertexCoordsList > FaceId2EnforcedVertexCoords;
std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexCoords > EnfVertexCoords2ProjVertex;
std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList > EnfVertexCoords2EnfVertexList;
+SMESH_MesherHelper* theHelper;
bool HasSizeMapOnFace=false;
bool HasSizeMapOnEdge=false;
*/
//=============================================================================
-BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen)
+BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId,
+ SMESH_Gen* gen,
+ bool theHasGEOM)
: SMESH_2D_Algo(hypId, gen)
{
- MESSAGE("BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF");
-
- _name = "MG-CADSurf";//"BLSURF";
+ _name = theHasGEOM ? "MG-CADSurf" : "MG-CADSurf_NOGEOM";//"BLSURF";
_shapeType = (1 << TopAbs_FACE); // 1 bit /shape type
- _compatibleHypothesis.push_back(BLSURFPlugin_Hypothesis::GetHypType());
- _compatibleHypothesis.push_back(StdMeshers_ViscousLayers2D::GetHypType());
+ _compatibleHypothesis.push_back(BLSURFPlugin_Hypothesis::GetHypType(theHasGEOM));
+ if ( theHasGEOM )
+ _compatibleHypothesis.push_back(StdMeshers_ViscousLayers2D::GetHypType());
_requireDiscreteBoundary = false;
_onlyUnaryInput = false;
_hypothesis = NULL;
_supportSubmeshes = true;
+ _requireShape = theHasGEOM;
/* Initialize the Python interpreter */
assert(Py_IsInitialized());
BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF()
{
- MESSAGE("BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF");
}
{
theHyp = *itl;
string hypName = theHyp->GetName();
- if ( hypName == BLSURFPlugin_Hypothesis::GetHypType() )
+ if ( hypName == BLSURFPlugin_Hypothesis::GetHypType(true) ||
+ hypName == BLSURFPlugin_Hypothesis::GetHypType(false) )
{
_hypothesis = static_cast<const BLSURFPlugin_Hypothesis*> (theHyp);
ASSERT(_hypothesis);
gp_XY uv;
gp_XYZ xyz;
} projectionPoint;
+
/////////////////////////////////////////////////////////
-projectionPoint getProjectionPoint(const TopoDS_Face& face, const gp_Pnt& point)
+
+projectionPoint getProjectionPoint(TopoDS_Face& theFace, const gp_Pnt& thePoint)
{
projectionPoint myPoint;
- Handle(Geom_Surface) surface = BRep_Tool::Surface(face);
- GeomAPI_ProjectPointOnSurf projector( point, surface );
- if ( !projector.IsDone() || projector.NbPoints()==0 )
- throw "getProjectionPoint: Can't project";
-
- Quantity_Parameter u,v;
- projector.LowerDistanceParameters(u,v);
- myPoint.uv = gp_XY(u,v);
- gp_Pnt aPnt = projector.NearestPoint();
- myPoint.xyz = gp_XYZ(aPnt.X(),aPnt.Y(),aPnt.Z());
- //return gp_XY(u,v);
- return myPoint;
-}
-/////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////
-double getT(const TopoDS_Edge& edge, const gp_Pnt& point)
-{
- Standard_Real f,l;
- Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, f,l);
- GeomAPI_ProjectPointOnCurve projector( point, curve);
- if ( projector.NbPoints() == 0 )
- throw;
- return projector.LowerDistanceParameter();
+ if ( theFace.IsNull() )
+ {
+ TopoDS_Shape foundFace, myShape = theHelper->GetSubShape();
+ TopTools_MapOfShape checkedFaces;
+ std::map< double, std::pair< TopoDS_Face, gp_Pnt2d > > dist2face;
+
+ for ( TopExp_Explorer exp ( myShape, TopAbs_FACE ); exp.More(); exp.Next())
+ {
+ const TopoDS_Face& face = TopoDS::Face( exp.Current() );
+ if ( !checkedFaces.Add( face )) continue;
+
+ // check distance to face
+ Handle(ShapeAnalysis_Surface) surface = theHelper->GetSurface( face );
+ gp_Pnt2d uv = surface->ValueOfUV( thePoint, Precision::Confusion());
+ double distance = surface->Gap();
+ if ( distance > Precision::Confusion() )
+ {
+ // the face is far, store for future analysis
+ dist2face.insert( std::make_pair( distance, std::make_pair( face, uv )));
+ }
+ else
+ {
+ // check location on the face
+ BRepClass_FaceClassifier FC( face, uv, BRep_Tool::Tolerance( face ));
+ if ( FC.State() == TopAbs_IN )
+ {
+ if ( !foundFace.IsNull() )
+ return myPoint; // thePoint seems to be TopAbs_ON
+ foundFace = face;
+ myPoint.uv = uv.XY();
+ myPoint.xyz = surface->Value( uv ).XYZ();
+ // break;
+ }
+ if ( FC.State() == TopAbs_ON )
+ return myPoint;
+ }
+ }
+ if ( foundFace.IsNull() )
+ {
+ // find the closest face
+ std::map< double, std::pair< TopoDS_Face, gp_Pnt2d > >::iterator d2f = dist2face.begin();
+ for ( ; d2f != dist2face.end(); ++d2f )
+ {
+ const TopoDS_Face& face = d2f->second.first;
+ const gp_Pnt2d & uv = d2f->second.second;
+ BRepClass_FaceClassifier FC( face, uv, Precision::Confusion());
+ if ( FC.State() == TopAbs_IN )
+ {
+ foundFace = face;
+ myPoint.uv = uv.XY();
+ myPoint.xyz = theHelper->GetSurface( face )->Value( uv ).XYZ();
+ break;
+ }
+ }
+ }
+ // set the resultShape
+ // if ( foundFace.IsNull() )
+ // throw SMESH_ComputeError(COMPERR_BAD_PARMETERS,
+ // "getProjectionPoint: can't find a face by a vertex");
+ theFace = TopoDS::Face( foundFace );
+ }
+ else
+ {
+ Handle(Geom_Surface) surface = BRep_Tool::Surface( theFace );
+ GeomAPI_ProjectPointOnSurf projector( thePoint, surface );
+ if ( !projector.IsDone() || projector.NbPoints()==0 )
+ throw SMESH_ComputeError(COMPERR_BAD_PARMETERS,
+ "getProjectionPoint: can't project a vertex to a face");
+
+ Quantity_Parameter u,v;
+ projector.LowerDistanceParameters(u,v);
+ myPoint.uv = gp_XY(u,v);
+ gp_Pnt aPnt = projector.NearestPoint();
+ myPoint.xyz = gp_XYZ(aPnt.X(),aPnt.Y(),aPnt.Z());
+
+ BRepClass_FaceClassifier FC( theFace, myPoint.uv, Precision::Confusion());
+ if ( FC.State() != TopAbs_IN )
+ theFace.Nullify();
+ }
+
+ return myPoint;
}
/////////////////////////////////////////////////////////
TopoDS_Shape BLSURFPlugin_BLSURF::entryToShape(std::string entry)
{
- MESSAGE("BLSURFPlugin_BLSURF::entryToShape "<<entry );
GEOM::GEOM_Object_var aGeomObj;
TopoDS_Shape S = TopoDS_Shape();
SALOMEDS::SObject_var aSObj = SMESH_Gen_i::getStudyServant()->FindObjectID( entry.c_str() );
void _createEnforcedVertexOnFace(TopoDS_Face faceShape, gp_Pnt aPnt, BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex)
{
BLSURFPlugin_Hypothesis::TEnfVertexCoords enf_coords, coords, s_coords;
- enf_coords.clear();
- coords.clear();
- s_coords.clear();
- // Get the (u,v) values of the enforced vertex on the face
+ // Find the face and get the (u,v) values of the enforced vertex on the face
projectionPoint myPoint = getProjectionPoint(faceShape,aPnt);
-
- MESSAGE("Enforced Vertex: " << aPnt.X() << ", " << aPnt.Y() << ", " << aPnt.Z());
- MESSAGE("Projected Vertex: " << myPoint.xyz.X() << ", " << myPoint.xyz.Y() << ", " << myPoint.xyz.Z());
- MESSAGE("Parametric coordinates: " << myPoint.uv.X() << ", " << myPoint.uv.Y() );
+ if ( faceShape.IsNull() )
+ return;
enf_coords.push_back(aPnt.X());
enf_coords.push_back(aPnt.Y());
s_coords.push_back(myPoint.xyz.Z());
// Save pair projected vertex / enf vertex
- MESSAGE("Storing pair projected vertex / enf vertex:");
- MESSAGE("("<< myPoint.xyz.X() << ", " << myPoint.xyz.Y() << ", " << myPoint.xyz.Z() <<") / (" << aPnt.X() << ", " << aPnt.Y() << ", " << aPnt.Z()<<")");
EnfVertexCoords2ProjVertex[s_coords] = enf_coords;
- MESSAGE("Group name is: \"" << enfVertex->grpName << "\"");
pair<BLSURFPlugin_Hypothesis::TEnfVertexList::iterator,bool> ret;
BLSURFPlugin_Hypothesis::TEnfVertexList::iterator it;
ret = EnfVertexCoords2EnfVertexList[s_coords].insert(enfVertex);
sameAttractor = true;
if (FaceId2EnforcedVertexCoords.find(key) != FaceId2EnforcedVertexCoords.end()) {
- MESSAGE("Map of enf. vertex has key " << key)
- MESSAGE("Enf. vertex list size is: " << FaceId2EnforcedVertexCoords[key].size())
if (! sameAttractor)
FaceId2EnforcedVertexCoords[key].insert(coords); // there should be no redondant coords here (see std::set management)
- else
- MESSAGE("An attractor node is already defined: I don't add the enforced vertex");
- MESSAGE("New Enf. vertex list size is: " << FaceId2EnforcedVertexCoords[key].size())
}
else {
- MESSAGE("Map of enf. vertex has not key " << key << ": creating it")
if (! sameAttractor) {
BLSURFPlugin_Hypothesis::TEnfVertexCoordsList ens;
ens.insert(coords);
FaceId2EnforcedVertexCoords[key] = ens;
}
- else
- MESSAGE("An attractor node is already defined: I don't add the enforced vertex");
}
}
-
+
/////////////////////////////////////////////////////////
void BLSURFPlugin_BLSURF::createEnforcedVertexOnFace(TopoDS_Shape faceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList)
{
if (enfVertex->geomEntry != "") {
TopoDS_Shape GeomShape = entryToShape(enfVertex->geomEntry);
TopAbs_ShapeEnum GeomType = GeomShape.ShapeType();
- if (GeomType == TopAbs_VERTEX){
- aPnt = BRep_Tool::Pnt(TopoDS::Vertex(GeomShape));
+ if (GeomType == TopAbs_VERTEX)
+ {
+ enfVertex->vertex = TopoDS::Vertex( GeomShape );
+ aPnt = BRep_Tool::Pnt( enfVertex->vertex );
_createEnforcedVertexOnFace( TopoDS::Face(faceShape), aPnt, enfVertex);
}
// Group Management
- if (GeomType == TopAbs_COMPOUND){
- for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
- if (it.Value().ShapeType() == TopAbs_VERTEX){
- aPnt = BRep_Tool::Pnt(TopoDS::Vertex(it.Value()));
+ if (GeomType == TopAbs_COMPOUND)
+ {
+ for (TopoDS_Iterator it (GeomShape); it.More(); it.Next())
+ if (it.Value().ShapeType() == TopAbs_VERTEX)
+ {
+ enfVertex->vertex = TopoDS::Vertex( it.Value() );
+ aPnt = BRep_Tool::Pnt( enfVertex->vertex );
_createEnforcedVertexOnFace( TopoDS::Face(faceShape), aPnt, enfVertex);
}
- }
}
}
}
/////////////////////////////////////////////////////////
void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction, double defaultSize)
{
- MESSAGE("Attractor function: "<< AttractorFunction);
double xa, ya, za; // Coordinates of attractor point
double a, b; // Attractor parameter
double d = 0.;
pos2 = AttractorFunction.find(sep, pos1+1);
if (pos2!=string::npos) {
string createNodeStr = AttractorFunction.substr(pos1+1, pos2-pos1-1);
- MESSAGE("createNode: " << createNodeStr);
createNode = (AttractorFunction.substr(pos1+1, pos2-pos1-1) == "True");
pos1=pos2;
}
// of r-d where r is the distance to (u0,v0)
attractorFunctionStream << "*exp(-(0.5*(sqrt((u-"<<u0<<")**2+(v-"<<v0<<")**2)-"<<d<<"+abs(sqrt((u-"<<u0<<")**2+(v-"<<v0<<")**2)-"<<d<<"))/(" << b << "))**2)";
- MESSAGE("Python function for attractor:" << std::endl << attractorFunctionStream.str());
-
int key;
if (! FacesWithSizeMap.Contains(TopoDS::Face(GeomShape))) {
key = FacesWithSizeMap.Add(TopoDS::Face(GeomShape));
}
FaceId2SizeMap[key] =attractorFunctionStream.str();
if (createNode) {
- MESSAGE("Creating node on ("<<x0<<","<<y0<<","<<z0<<")");
FaceId2AttractorCoords[key] = coords;
}
// // Test for new attractors
// myAttractor.SetType(1);
// FaceId2ClassAttractor[key] = myAttractor;
// if(FaceId2ClassAttractor[key].GetFace().IsNull()){
-// MESSAGE("face nulle ");
-// }
-// else
-// MESSAGE("face OK");
-//
-// if (FaceId2ClassAttractor[key].GetAttractorShape().IsNull()){
-// MESSAGE("pas de point");
// }
-// else
-// MESSAGE("point OK");
}
// One sub-shape to get ids from
-BLSURFPlugin_BLSURF::TListOfIDs _getSubShapeIDsInMainShape(TopoDS_Shape theMainShape, TopoDS_Shape theSubShape,
- TopAbs_ShapeEnum theShapeType)
+BLSURFPlugin_BLSURF::TListOfIDs _getSubShapeIDsInMainShape(const TopoDS_Shape& theMainShape,
+ const TopoDS_Shape& theSubShape,
+ TopAbs_ShapeEnum theShapeType)
{
BLSURFPlugin_BLSURF::TListOfIDs face_ids;
+
+ TopTools_MapOfShape subShapes;
TopTools_IndexedMapOfShape anIndices;
- anIndices.Clear();
TopExp::MapShapes(theMainShape, theShapeType, anIndices);
-// Standard_Boolean result = BRepTools::Write(theMainShape,"main_shape.brep");
-
for (TopExp_Explorer face_iter(theSubShape,theShapeType);face_iter.More();face_iter.Next())
+ {
+ if ( subShapes.Add( face_iter.Current() )) // issue 23416
{
- int face_id = anIndices.FindIndex(face_iter.Current());
- if (face_id == 0)
- throw SALOME_Exception ( SMESH_Comment("Sub_shape not found in main_shape"));
- face_ids.push_back(face_id);
-// std::ostringstream o;
-// o << "face_" << face_id << ".brep";
-// std::string face_name = o.str();
-// const TopoDS_Face& face = TopoDS::Face(face_iter.Current());
-// Standard_Boolean result = BRepTools::Write(face,face_name.c_str());
+ int face_id = anIndices.FindIndex( face_iter.Current() );
+ if ( face_id == 0 )
+ throw SALOME_Exception( "Periodicity: sub_shape not found in main_shape");
+ face_ids.push_back( face_id );
}
-
+ }
return face_ids;
}
{
int face_id = theMesh->GetMeshDS()->ShapeToIndex(face_iter.Current());
if (face_id == 0)
- throw SALOME_Exception ( SMESH_Comment("Sub_shape not found in main_shape"));
+ throw SALOME_Exception ( "Periodicity: sub_shape not found in main_shape");
face_ids.push_back(face_id);
}
void BLSURFPlugin_BLSURF::addCoordsFromVertices(const std::vector<std::string> &theVerticesEntries, std::vector<double> &theVerticesCoords)
{
for (std::vector<std::string>::const_iterator it = theVerticesEntries.begin(); it != theVerticesEntries.end(); it++)
- {
- BLSURFPlugin_Hypothesis::TEntry theVertexEntry = *it;
- MESSAGE("Vertex entry " << theVertexEntry);
- addCoordsFromVertex(theVertexEntry, theVerticesCoords);
- }
+ {
+ BLSURFPlugin_Hypothesis::TEntry theVertexEntry = *it;
+ addCoordsFromVertex(theVertexEntry, theVerticesCoords);
+ }
}
void BLSURFPlugin_BLSURF::addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector<double> &theVerticesCoords)
{
if (theVertexEntry!="")
- {
- TopoDS_Shape aShape = entryToShape(theVertexEntry);
+ {
+ TopoDS_Shape aShape = entryToShape(theVertexEntry);
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
- double theX, theY, theZ;
- theX = aPnt.X();
- theY = aPnt.Y();
- theZ = aPnt.Z();
+ gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+ double theX, theY, theZ;
+ theX = aPnt.X();
+ theY = aPnt.Y();
+ theZ = aPnt.Z();
- theVerticesCoords.push_back(theX);
- theVerticesCoords.push_back(theY);
- theVerticesCoords.push_back(theZ);
- }
+ theVerticesCoords.push_back(theX);
+ theVerticesCoords.push_back(theY);
+ theVerticesCoords.push_back(theZ);
+ }
}
/////////////////////////////////////////////////////////
void BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity)
{
- MESSAGE("BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity");
-
TopoDS_Shape geomShape1 = entryToShape(preCadPeriodicity.shape1Entry);
TopoDS_Shape geomShape2 = entryToShape(preCadPeriodicity.shape2Entry);
preCadFacesPeriodicityIDs.shape1IDs = theFace1_ids;
preCadFacesPeriodicityIDs.shape2IDs = theFace2_ids;
- MESSAGE("preCadPeriodicity.theSourceVerticesEntries.size(): " << preCadPeriodicity.theSourceVerticesEntries.size());
- MESSAGE("preCadPeriodicity.theTargetVerticesEntries.size(): " << preCadPeriodicity.theTargetVerticesEntries.size());
-
addCoordsFromVertices(preCadPeriodicity.theSourceVerticesEntries, preCadFacesPeriodicityIDs.theSourceVerticesCoords);
addCoordsFromVertices(preCadPeriodicity.theTargetVerticesEntries, preCadFacesPeriodicityIDs.theTargetVerticesCoords);
- MESSAGE("preCadFacesPeriodicityIDs.theSourceVerticesCoords.size(): " << preCadFacesPeriodicityIDs.theSourceVerticesCoords.size());
- MESSAGE("preCadFacesPeriodicityIDs.theTargetVerticesCoords.size(): " << preCadFacesPeriodicityIDs.theTargetVerticesCoords.size());
-
_preCadFacesIDsPeriodicityVector.push_back(preCadFacesPeriodicityIDs);
- MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
- MESSAGE("BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity END");
-
}
/////////////////////////////////////////////////////////
void BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity)
{
- MESSAGE("BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity");
-
TopoDS_Shape geomShape1 = entryToShape(preCadPeriodicity.shape1Entry);
TopoDS_Shape geomShape2 = entryToShape(preCadPeriodicity.shape2Entry);
addCoordsFromVertices(preCadPeriodicity.theTargetVerticesEntries, preCadEdgesPeriodicityIDs.theTargetVerticesCoords);
_preCadEdgesIDsPeriodicityVector.push_back(preCadEdgesPeriodicityIDs);
- MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
- MESSAGE("BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity END");
-
}
void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp,
cadsurf_session_t * css,
- const TopoDS_Shape& theGeomShape
- )
+ const TopoDS_Shape& theGeomShape)
{
// rnc : Bug 1457
// Clear map so that it is not stored in the algorithm with old enforced vertices in it
+ FacesWithSizeMap.Clear();
+ FaceId2SizeMap.clear();
+ EdgesWithSizeMap.Clear();
+ EdgeId2SizeMap.clear();
+ VerticesWithSizeMap.Clear();
+ VertexId2SizeMap.clear();
+ FaceId2PythonSmp.clear();
+ EdgeId2PythonSmp.clear();
+ VertexId2PythonSmp.clear();
+ FaceId2AttractorCoords.clear();
+ FaceId2ClassAttractor.clear();
+ FaceIndex2ClassAttractor.clear();
+ FacesWithEnforcedVertices.Clear();
+ FaceId2EnforcedVertexCoords.clear();
+ EnfVertexCoords2ProjVertex.clear();
EnfVertexCoords2EnfVertexList.clear();
double diagonal = SMESH_Mesh::GetShapeDiagonalSize( theGeomShape );
// PreCAD
//int _precadMergeEdges = BLSURFPlugin_Hypothesis::GetDefaultPreCADMergeEdges();
- int _precadRemoveTinyUVEdges = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveTinyUVEdges();
//int _precadRemoveDuplicateCADFaces = BLSURFPlugin_Hypothesis::GetDefaultPreCADRemoveDuplicateCADFaces();
//int _precadProcess3DTopology = BLSURFPlugin_Hypothesis::GetDefaultPreCADProcess3DTopology();
//int _precadDiscardInput = BLSURFPlugin_Hypothesis::GetDefaultPreCADDiscardInput();
+ const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadFacesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadFacesPeriodicityVector(hyp);
if (hyp) {
- MESSAGE("BLSURFPlugin_BLSURF::SetParameters");
_physicalMesh = (int) hyp->GetPhysicalMesh();
_geometricMesh = (int) hyp->GetGeometricMesh();
if (hyp->GetPhySize() > 0) {
//_topology = (int) hyp->GetTopology();
// PreCAD
//_precadMergeEdges = hyp->GetPreCADMergeEdges();
- _precadRemoveTinyUVEdges = hyp->GetPreCADRemoveTinyUVEdges();
//_precadRemoveDuplicateCADFaces = hyp->GetPreCADRemoveDuplicateCADFaces();
//_precadProcess3DTopology = hyp->GetPreCADProcess3DTopology();
//_precadDiscardInput = hyp->GetPreCADDiscardInput();
const BLSURFPlugin_Hypothesis::TOptionValues& opts = hyp->GetOptionValues();
BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt;
- for ( opIt = opts.begin(); opIt != opts.end(); ++opIt )
+ for ( opIt = opts.begin(); opIt != opts.end(); ++opIt ){
+ MESSAGE("OptionValue: " << opIt->first.c_str() << ", value: " << opIt->second.c_str());
if ( !opIt->second.empty() ) {
- MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
- set_param(css, opIt->first.c_str(), opIt->second.c_str());
+ // With MeshGems 2.4-5, there are issues with periodicity and multithread
+ // => As a temporary workaround, we enforce to use only one thread if periodicity is used.
+ if (opIt->first == "max_number_of_threads" && opIt->second != "1" && ! preCadFacesPeriodicityVector.empty()){
+ std::cout << "INFO: Disabling multithread to avoid periodicity issues" << std::endl;
+ set_param(css, opIt->first.c_str(), "1");
+ }
+ else
+ set_param(css, opIt->first.c_str(), opIt->second.c_str());
}
+ }
const BLSURFPlugin_Hypothesis::TOptionValues& custom_opts = hyp->GetCustomOptionValues();
for ( opIt = custom_opts.begin(); opIt != custom_opts.end(); ++opIt )
if ( !opIt->second.empty() ) {
- MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
set_param(css, opIt->first.c_str(), opIt->second.c_str());
}
const BLSURFPlugin_Hypothesis::TOptionValues& preCADopts = hyp->GetPreCADOptionValues();
for ( opIt = preCADopts.begin(); opIt != preCADopts.end(); ++opIt )
if ( !opIt->second.empty() ) {
- MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second);
set_param(css, opIt->first.c_str(), opIt->second.c_str());
}
}
}
// PreProcessor (formerly PreCAD) -- commented params are preCADoptions (since 0023307)
//set_param(css, "merge_edges", _precadMergeEdges ? "yes" : "no");
- set_param(css, "remove_tiny_uv_edges", _precadRemoveTinyUVEdges ? "yes" : "no");
//set_param(css, "remove_duplicate_cad_faces", _precadRemoveDuplicateCADFaces ? "yes" : "no");
//set_param(css, "process_3d_topology", _precadProcess3DTopology ? "1" : "0");
//set_param(css, "discard_input_topology", _precadDiscardInput ? "1" : "0");
if ( _verb > 0 )
std::cout << "_smp_phy_size = " << _smp_phy_size << std::endl;
- if (_physicalMesh == BLSURFPlugin_Hypothesis::PhysicalLocalSize){
+ if (_physicalMesh == BLSURFPlugin_Hypothesis::PhysicalLocalSize)
+ {
TopoDS_Shape GeomShape;
TopoDS_Shape AttShape;
TopAbs_ShapeEnum GeomType;
//
// Standard Size Maps
//
- MESSAGE("Setting a Size Map");
const BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = BLSURFPlugin_Hypothesis::GetSizeMapEntries(hyp);
BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
for ( ; smIt != sizeMaps.end(); ++smIt ) {
if ( !smIt->second.empty() ) {
- MESSAGE("cadsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second);
GeomShape = entryToShape(smIt->first);
GeomType = GeomShape.ShapeType();
- MESSAGE("Geomtype is " << GeomType);
int key = -1;
// Group Management
if (GeomType == TopAbs_COMPOUND) {
}
else {
key = FacesWithSizeMap.FindIndex(TopoDS::Face(it.Value()));
-// MESSAGE("Face with key " << key << " already in map");
}
FaceId2SizeMap[key] = smIt->second;
}
}
else {
key = EdgesWithSizeMap.FindIndex(TopoDS::Edge(it.Value()));
-// MESSAGE("Edge with key " << key << " already in map");
}
EdgeId2SizeMap[key] = smIt->second;
}
}
else {
key = VerticesWithSizeMap.FindIndex(TopoDS::Vertex(it.Value()));
- MESSAGE("Group of vertices with key " << key << " already in map");
}
- MESSAGE("Group of vertices with key " << key << " has a size map: " << smIt->second);
VertexId2SizeMap[key] = smIt->second;
}
}
}
else {
key = FacesWithSizeMap.FindIndex(TopoDS::Face(GeomShape));
-// MESSAGE("Face with key " << key << " already in map");
}
FaceId2SizeMap[key] = smIt->second;
}
}
else {
key = EdgesWithSizeMap.FindIndex(TopoDS::Edge(GeomShape));
-// MESSAGE("Edge with key " << key << " already in map");
}
EdgeId2SizeMap[key] = smIt->second;
}
}
else {
key = VerticesWithSizeMap.FindIndex(TopoDS::Vertex(GeomShape));
- MESSAGE("Vertex with key " << key << " already in map");
}
- MESSAGE("Vertex with key " << key << " has a size map: " << smIt->second);
VertexId2SizeMap[key] = smIt->second;
}
}
// Attractors
//
// TODO appeler le constructeur des attracteurs directement ici
- MESSAGE("Setting Attractors");
// if ( !_phySizeRel ) {
const BLSURFPlugin_Hypothesis::TSizeMap attractors = BLSURFPlugin_Hypothesis::GetAttractorEntries(hyp);
BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
for ( ; atIt != attractors.end(); ++atIt ) {
if ( !atIt->second.empty() ) {
- MESSAGE("cadsurf_set_attractor(): " << atIt->first << " = " << atIt->second);
GeomShape = entryToShape(atIt->first);
GeomType = GeomShape.ShapeType();
// Group Management
}
}
// }
-// else
-// MESSAGE("Impossible to create the attractors when the physical size is relative");
// Class Attractors
// temporary commented out for testing
BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator AtIt = class_attractors.begin();
for ( ; AtIt != class_attractors.end(); ++AtIt ) {
if ( !AtIt->second->Empty() ) {
- // MESSAGE("cadsurf_set_attractor(): " << AtIt->first << " = " << AtIt->second);
GeomShape = entryToShape(AtIt->first);
if ( !SMESH_MesherHelper::IsSubShape( GeomShape, theGeomShape ))
continue;
//
// Enforced Vertices
//
- MESSAGE("Setting Enforced Vertices");
const BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap entryEnfVertexListMap = BLSURFPlugin_Hypothesis::GetAllEnforcedVerticesByFace(hyp);
BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator enfIt = entryEnfVertexListMap.begin();
for ( ; enfIt != entryEnfVertexListMap.end(); ++enfIt ) {
if ( !enfIt->second.empty() ) {
GeomShape = entryToShape(enfIt->first);
- GeomType = GeomShape.ShapeType();
+ if ( GeomShape.IsNull() )
+ {
+ createEnforcedVertexOnFace( GeomShape, enfIt->second );
+ }
// Group Management
- if (GeomType == TopAbs_COMPOUND){
+ else if ( GeomShape.ShapeType() == TopAbs_COMPOUND)
+ {
for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
if (it.Value().ShapeType() == TopAbs_FACE){
HasSizeMapOnFace = true;
}
}
}
-
- if (GeomType == TopAbs_FACE){
+ else if ( GeomShape.ShapeType() == TopAbs_FACE)
+ {
HasSizeMapOnFace = true;
createEnforcedVertexOnFace(GeomShape, enfIt->second);
}
bool useInternalVertexAllFaces = BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFaces(hyp);
if (useInternalVertexAllFaces) {
std::string grpName = BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFacesGroup(hyp);
- MESSAGE("Setting Internal Enforced Vertices");
gp_Pnt aPnt;
TopExp_Explorer exp (theGeomShape, TopAbs_FACE);
for (; exp.More(); exp.Next()){
- MESSAGE("Iterating shapes. Shape type is " << exp.Current().ShapeType());
TopExp_Explorer exp_face (exp.Current(), TopAbs_VERTEX, TopAbs_EDGE);
for (; exp_face.More(); exp_face.Next())
{
// Check if current coords is already in enfVertexList
// If coords not in enfVertexList, add new enfVertex
aPnt = BRep_Tool::Pnt(TopoDS::Vertex(exp_face.Current()));
- MESSAGE("Found vertex on face at " << aPnt.X() <<", "<<aPnt.Y()<<", "<<aPnt.Z());
BLSURFPlugin_Hypothesis::TEnfVertex* enfVertex = new BLSURFPlugin_Hypothesis::TEnfVertex();
enfVertex->coords.push_back(aPnt.X());
enfVertex->coords.push_back(aPnt.Y());
}
}
- MESSAGE("Setting Size Map on FACES ");
cadsurf_set_sizemap_iso_cad_face(css, size_on_surface, &_smp_phy_size);
if (HasSizeMapOnEdge){
- MESSAGE("Setting Size Map on EDGES ");
cadsurf_set_sizemap_iso_cad_edge(css, size_on_edge, &_smp_phy_size);
}
if (HasSizeMapOnVertex){
- MESSAGE("Setting Size Map on VERTICES ");
cadsurf_set_sizemap_iso_cad_point(css, size_on_vertex, &_smp_phy_size);
}
}
_preCadFacesIDsPeriodicityVector.clear();
_preCadEdgesIDsPeriodicityVector.clear();
- MESSAGE("SetParameters preCadFacesPeriodicityVector");
- const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadFacesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadFacesPeriodicityVector(hyp);
-
for (std::size_t i = 0; i<preCadFacesPeriodicityVector.size(); i++){
- MESSAGE("SetParameters preCadFacesPeriodicityVector[" << i << "]");
createPreCadFacesPeriodicity(theGeomShape, preCadFacesPeriodicityVector[i]);
}
- MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
- MESSAGE("SetParameters preCadEdgesPeriodicityVector");
const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadEdgesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadEdgesPeriodicityVector(hyp);
for (std::size_t i = 0; i<preCadEdgesPeriodicityVector.size(); i++){
- MESSAGE("SetParameters preCadEdgesPeriodicityVector[" << i << "]");
createPreCadEdgesPeriodicity(theGeomShape, preCadEdgesPeriodicityVector[i]);
}
- MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
-
}
//================================================================================
/*!
* \brief Class correctly terminating usage of MG-CADSurf library at destruction
*/
- class BLSURF_Cleaner
+ struct BLSURF_Cleaner
{
- context_t * _ctx;
+ context_t * _ctx;
cadsurf_session_t* _css;
- cad_t * _cad;
- dcad_t * _dcad;
- public:
- BLSURF_Cleaner(context_t * ctx,
- cadsurf_session_t* css,
- cad_t * cad,
- dcad_t * dcad)
+ cad_t * _cad;
+ dcad_t * _dcad;
+
+ BLSURF_Cleaner(context_t * ctx,
+ cadsurf_session_t* css=0,
+ cad_t * cad=0,
+ dcad_t * dcad=0)
: _ctx ( ctx ),
_css ( css ),
_cad ( cad ),
const TopoDS_Face& makeProxyFace( SMESH_ProxyMesh::Ptr& viscousMesh,
const TopoDS_Face& origFace)
{
- // get data of nodes on inner boundary of viscous layers
SMESH_Mesh* origMesh = viscousMesh->GetMesh();
+
+ SMESH_MesherHelper helper( *origMesh );
+ helper.SetSubShape( origFace );
+ const bool hasSeam = helper.HasRealSeam();
+
+ // get data of nodes on inner boundary of viscous layers
TError err;
TSideVector wireVec = StdMeshers_FaceSide::GetFaceWires(origFace, *origMesh,
/*skipMediumNodes = */true,
- err, viscousMesh );
+ err, &helper, viscousMesh );
if ( err && err->IsKO() )
throw *err.get(); // it should be caught at SMESH_subMesh
std::vector<TopoDS_Vertex> tmpVertex;
// create a proxy FACE
- TopoDS_Shape origFaceCopy = origFace.EmptyCopied();
- BRepBuilderAPI_MakeFace newFace( TopoDS::Face( origFaceCopy ));
+ TopoDS_Face origFaceCopy = TopoDS::Face( origFace.EmptyCopied() );
+ BRepBuilderAPI_MakeFace newFace( origFaceCopy );
+ bool hasPCurves = false;
for ( size_t iW = 0; iW != wireVec.size(); ++iW )
{
StdMeshers_FaceSidePtr& wireData = wireVec[iW];
- const UVPtStructVec& wirePoints = wireData->GetUVPtStruct();
+ const UVPtStructVec& wirePoints = wireData->GetUVPtStruct();
if ( wirePoints.size() < 3 )
continue;
- BRepBuilderAPI_MakePolygon wire;
+ BRepBuilderAPI_MakePolygon polygon;
const size_t i0 = tmpVertex.size();
for ( size_t iN = 0; iN < wirePoints.size(); ++iN )
{
- wire.Add( SMESH_TNodeXYZ( wirePoints[ iN ].node ));
+ polygon.Add( SMESH_TNodeXYZ( wirePoints[ iN ].node ));
origNodes.push_back( wirePoints[ iN ].node );
- tmpVertex.push_back( wire.LastVertex() );
+ tmpVertex.push_back( polygon.LastVertex() );
+
+ // check presence of a pcurve
+ checkPCurve( polygon, origFaceCopy, hasPCurves, &wirePoints[ iN-1 ] );
}
- tmpVertex[ i0 ] = wire.FirstVertex(); // wire.LastVertex()==NULL for 1 vertex in wire
- wire.Close();
- if ( !wire.IsDone() )
+ tmpVertex[ i0 ] = polygon.FirstVertex(); // polygon.LastVertex()==NULL for 1 vertex in wire
+ polygon.Close();
+ if ( !polygon.IsDone() )
throw SALOME_Exception("BLSURFPlugin_BLSURF: BRepBuilderAPI_MakePolygon failed");
+ TopoDS_Wire wire = polygon;
+ if ( hasSeam )
+ wire = updateSeam( wire, origNodes );
newFace.Add( wire );
}
_proxyFace = newFace;
ShapeToMesh( auxCompoundToMesh );
- //TopExp_Explorer fExp( auxCompoundToMesh, TopAbs_FACE );
- //_proxyFace = TopoDS::Face( fExp.Current() );
-
// Make input mesh for MG-CADSurf: segments on EDGE's of newFace
GetSubMesh( tmpVertex[i] )->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( const SMDS_MeshNode* tmpN = SMESH_Algo::VertexNode( tmpVertex[i], tmpMeshDS ))
_tmp2origNN.insert( _tmp2origNN.end(), make_pair( tmpN, origNodes[i] ));
- else
- throw SALOME_Exception("BLSURFPlugin_BLSURF: a proxy vertex not meshed");
+ // else -- it can be a seam vertex replaced by updateSeam()
+ // throw SALOME_Exception("BLSURFPlugin_BLSURF: a proxy vertex not meshed");
}
// make segments
return _proxyFace;
}
+ //--------------------------------------------------------------------------------
+ /*!
+ * \brief Add pcurve to the last edge of a wire
+ */
+ //--------------------------------------------------------------------------------
+
+ void checkPCurve( BRepBuilderAPI_MakePolygon& wire,
+ const TopoDS_Face& face,
+ bool & hasPCurves,
+ const uvPtStruct * wirePoints )
+ {
+ if ( hasPCurves )
+ return;
+ TopoDS_Edge edge = wire.Edge();
+ if ( edge.IsNull() ) return;
+ double f,l;
+ if ( BRep_Tool::CurveOnSurface(edge, face, f, l))
+ {
+ hasPCurves = true;
+ return;
+ }
+ gp_XY p1 = wirePoints[ 0 ].UV(), p2 = wirePoints[ 1 ].UV();
+ Handle(Geom2d_Line) pcurve = new Geom2d_Line( p1, gp_Dir2d( p2 - p1 ));
+ BRep_Builder().UpdateEdge( edge, Handle(Geom_Curve)(), Precision::Confusion() );
+ BRep_Builder().UpdateEdge( edge, pcurve, face, Precision::Confusion() );
+ BRep_Builder().Range( edge, 0, ( p2 - p1 ).Modulus() );
+ // cout << "n1 = mesh.AddNode( " << p1.X()*10 << ", " << p1.Y() << ", 0 )" << endl
+ // << "n2 = mesh.AddNode( " << p2.X()*10 << ", " << p2.Y() << ", 0 )" << endl
+ // << "mesh.AddEdge( [ n1, n2 ] )" << endl;
+ }
+
+ //--------------------------------------------------------------------------------
+ /*!
+ * \brief Replace coincident EDGEs with reversed copies.
+ */
+ //--------------------------------------------------------------------------------
+
+ TopoDS_Wire updateSeam( const TopoDS_Wire& wire,
+ const std::vector<const SMDS_MeshNode*>& nodesOfVertices )
+ {
+ BRepBuilderAPI_MakeWire newWire;
+
+ typedef NCollection_DataMap<SMESH_TLink, TopoDS_Edge, SMESH_TLink > TSeg2EdgeMap;
+ TSeg2EdgeMap seg2EdgeMap;
+
+ TopoDS_Iterator edgeIt( wire );
+ for ( int iSeg = 1; edgeIt.More(); edgeIt.Next(), ++iSeg )
+ {
+ SMESH_TLink link( nodesOfVertices[ iSeg-1 ], nodesOfVertices[ iSeg ]);
+ TopoDS_Edge edge( TopoDS::Edge( edgeIt.Value() ));
+
+ TopoDS_Edge* edgeInMap = seg2EdgeMap.Bound( link, edge );
+ bool isSeam = ( *edgeInMap != edge );
+ if ( isSeam )
+ {
+ edgeInMap->Reverse();
+ edge = *edgeInMap;
+ }
+ newWire.Add( edge );
+ }
+ return newWire;
+ }
+
//--------------------------------------------------------------------------------
/*!
* \brief Fill in the origMesh with faces computed by MG-CADSurf in this tmp mesh
*/
//=============================================================================
-bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) {
-
- MESSAGE("BLSURFPlugin_BLSURF::Compute");
-
+bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
+{
// Fix problem with locales
Kernel_Utils::Localizer aLocalizer;
/* create a distene context (generic object) */
status_t status = STATUS_ERROR;
- myMesh = &aMesh;
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
- SMESH_MesherHelper helper( aMesh );
+ SMESH_MesherHelper helper( aMesh ), helperWithShape( aMesh );
+ myHelper = theHelper = & helperWithShape;
// do not call helper.IsQuadraticSubMesh() because sub-meshes
// may be cleaned and helper.myTLinkNodeMap gets invalid in such a case
- bool haveQuadraticSubMesh = SMESH_MesherHelper( aMesh ).IsQuadraticSubMesh( aShape );
+ bool haveQuadraticSubMesh = helperWithShape.IsQuadraticSubMesh( aShape );
bool quadraticSubMeshAndViscousLayer = false;
bool needMerge = false;
typedef set< SMESHDS_SubMesh*, ShapeTypeCompare > TSubMeshSet;
TopTools_IndexedMapOfShape pmap, emap, fmap;
+ TopTools_IndexedDataMapOfShapeListOfShape e2ffmap;
+ TopExp::MapShapesAndAncestors( aShape, TopAbs_EDGE, TopAbs_FACE, e2ffmap );
+
// Issue 0019864. On DebianSarge, FE signals do not obey to OSD::SetSignal(false)
#ifndef WIN32
feclearexcept( FE_ALL_EXCEPT );
cad_t *c = cad_new(ctx);
dcad_t *dcad = dcad_new(c);
- FacesWithSizeMap.Clear();
- FaceId2SizeMap.clear();
- FaceId2ClassAttractor.clear();
- FaceIndex2ClassAttractor.clear();
- EdgesWithSizeMap.Clear();
- EdgeId2SizeMap.clear();
- VerticesWithSizeMap.Clear();
- VertexId2SizeMap.clear();
+ // To enable multithreading
+ cad_set_thread_safety(c, 1);
/* Now fill the CAD object with data from your CAD
* environement. This is the most complex part of a successfull
// an object that correctly deletes all cadsurf objects at destruction
BLSURF_Cleaner cleaner( ctx,css,c,dcad );
- MESSAGE("BEGIN SetParameters");
SetParameters(_hypothesis, css, aShape);
- MESSAGE("END SetParameters");
-
- MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
haveQuadraticSubMesh = haveQuadraticSubMesh || (_hypothesis != NULL && _hypothesis->GetQuadraticMesh());
helper.SetIsQuadratic( haveQuadraticSubMesh );
f.Orientation(TopAbs_FORWARD);
iface = fmap.Add(f);
-// std::string aFileName = "fmap_face_";
-// aFileName.append(val_to_string(iface));
-// aFileName.append(".brep");
-// BRepTools::Write(f,aFileName.c_str());
surfaces.push_back(BRep_Tool::Surface(f));
/* by default a face has no tag (color).
The following call sets it to the same value as the Geom module ID : */
- const int faceTag = meshDS->ShapeToIndex(f);
+ int faceTag = meshDS->ShapeToIndex(f);
+ faceTag = BLSURFPlugin_Hypothesis::GetHyperPatchTag( faceTag, _hypothesis );
cad_face_set_tag(fce, faceTag);
/* Set face orientation (optional if you want a well oriented output mesh)*/
faceKey = FacesWithSizeMap.FindIndex(f);
- if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end()) {
- MESSAGE("A size map is defined on face :"<<faceKey);
+ if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end())
+ {
theSizeMapStr = FaceId2SizeMap[faceKey];
// check if function ends with "return"
if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1))
std::map<int,std::vector<double> >::iterator attractor_iter = FaceId2AttractorCoords.begin();
for (; attractor_iter != FaceId2AttractorCoords.end(); ++attractor_iter) {
- if (attractor_iter->first == faceKey) {
- MESSAGE("Face indice: " << iface);
- MESSAGE("Adding attractor");
-
+ if (attractor_iter->first == faceKey)
+ {
double xyzCoords[3] = {attractor_iter->second[2],
attractor_iter->second[3],
attractor_iter->second[4]};
- MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")");
gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]);
BRepClass_FaceClassifier scl(f,P,1e-7);
- // OCC 6.3sp6 : scl.Perform() is bugged. The function was rewritten
- // BRepClass_FaceClassifierPerform(&scl,f,P,1e-7);
- // OCC 6.5.2: scl.Perform() is not bugged anymore
scl.Perform(f, P, 1e-7);
TopAbs_State result = scl.State();
- MESSAGE("Position of point on face: "<<result);
if ( result == TopAbs_OUT )
MESSAGE("Point is out of face: node is not created");
if ( result == TopAbs_UNKNOWN )
if ( result == TopAbs_IN )
{
// Point is inside face and not on border
- MESSAGE("Point is in face: node is created");
double uvCoords[2] = {attractor_iter->second[0],attractor_iter->second[1]};
ienf++;
- MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf);
cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords);
cad_point_set_tag(point_p, ienf);
}
// -----------------
TId2ClsAttractorVec::iterator clAttractor_iter = FaceId2ClassAttractor.find(faceKey);
if (clAttractor_iter != FaceId2ClassAttractor.end()){
- MESSAGE("Face indice: " << iface);
- MESSAGE("Adding attractor");
std::vector< BLSURFPlugin_Attractor* > & attVec = clAttractor_iter->second;
for ( size_t i = 0; i < attVec.size(); ++i )
if ( !attVec[i]->IsMapBuilt() ) {
}
} // if (HasSizeMapOnFace && !use_precad)
- // ------------------
- // Enforced Vertices
- // ------------------
+ // ------------------
+ // Enforced Vertices
+ // ------------------
faceKey = FacesWithEnforcedVertices.FindIndex(f);
std::map<int,BLSURFPlugin_Hypothesis::TEnfVertexCoordsList >::const_iterator evmIt = FaceId2EnforcedVertexCoords.find(faceKey);
- if (evmIt != FaceId2EnforcedVertexCoords.end()) {
- MESSAGE("Some enforced vertices are defined");
- BLSURFPlugin_Hypothesis::TEnfVertexCoordsList evl;
- MESSAGE("Face indice: " << iface);
- MESSAGE("Adding enforced vertices");
- evl = evmIt->second;
- MESSAGE("Number of vertices to add: "<< evl.size());
+ if (evmIt != FaceId2EnforcedVertexCoords.end())
+ {
+ BLSURFPlugin_Hypothesis::TEnfVertexCoordsList evl = evmIt->second;
BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator evlIt = evl.begin();
- for (; evlIt != evl.end(); ++evlIt) {
+ for (; evlIt != evl.end(); ++evlIt)
+ {
+ double uvCoords[2] = { evlIt->at(0), evlIt->at(1) };
+ ienf++;
+ cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords);
+ int tag = 0;
BLSURFPlugin_Hypothesis::TEnfVertexCoords xyzCoords;
xyzCoords.push_back(evlIt->at(2));
xyzCoords.push_back(evlIt->at(3));
xyzCoords.push_back(evlIt->at(4));
- MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")");
- gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]);
- BRepClass_FaceClassifier scl(f,P,1e-7);
- // OCC 6.3sp6 : scl.Perform() is bugged. The function was rewritten
- // BRepClass_FaceClassifierPerform(&scl,f,P,1e-7);
- // OCC 6.5.2: scl.Perform() is not bugged anymore
- scl.Perform(f, P, 1e-7);
- TopAbs_State result = scl.State();
- MESSAGE("Position of point on face: "<<result);
- if ( result == TopAbs_OUT ) {
- MESSAGE("Point is out of face: node is not created");
- if (EnfVertexCoords2ProjVertex.find(xyzCoords) != EnfVertexCoords2ProjVertex.end()) {
- EnfVertexCoords2ProjVertex.erase(xyzCoords);
- // isssue 22783. Do not erase as this point can be IN other face of a group
- //EnfVertexCoords2EnfVertexList.erase(xyzCoords);
- }
- }
- if ( result == TopAbs_UNKNOWN ) {
- MESSAGE("Point position on face is unknown: node is not created");
- if (EnfVertexCoords2ProjVertex.find(xyzCoords) != EnfVertexCoords2ProjVertex.end()) {
- EnfVertexCoords2ProjVertex.erase(xyzCoords);
- //EnfVertexCoords2EnfVertexList.erase(xyzCoords);
- }
- }
- if ( result == TopAbs_ON ) {
- MESSAGE("Point is on border of face: node is not created");
- if (EnfVertexCoords2ProjVertex.find(xyzCoords) != EnfVertexCoords2ProjVertex.end()) {
- EnfVertexCoords2ProjVertex.erase(xyzCoords);
- //EnfVertexCoords2EnfVertexList.erase(xyzCoords);
- }
- }
- if ( result == TopAbs_IN )
+ std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(xyzCoords);
+ if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end() &&
+ !enfCoordsIt->second.empty() )
{
- // Point is inside face and not on border
- MESSAGE("Point is in face: node is created");
- double uvCoords[2] = {evlIt->at(0),evlIt->at(1)};
- ienf++;
- MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf);
- cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords);
- int tag = 0;
- std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(xyzCoords);
- if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end() &&
- !enfCoordsIt->second.empty() )
+ // to merge nodes of an INTERNAL vertex belonging to several faces
+ TopoDS_Vertex v = (*enfCoordsIt->second.begin() )->vertex;
+ if ( v.IsNull() ) v = (*enfCoordsIt->second.rbegin())->vertex;
+ if ( !v.IsNull() && meshDS->ShapeToIndex( v ) > 0 )
{
- // to merge nodes of an INTERNAL vertex belonging to several faces
- TopoDS_Vertex v = (*enfCoordsIt->second.begin())->vertex;
- if ( v.IsNull() ) v = (*enfCoordsIt->second.rbegin())->vertex;
- if ( !v.IsNull() ) {
- tag = pmap.Add( v );
- SMESH_subMesh* vSM = aMesh.GetSubMesh( v );
- vSM->ComputeStateEngine( SMESH_subMesh::COMPUTE );
- mergeSubmeshes.insert( vSM->GetSubMeshDS() );
- // //if ( tag != pmap.Extent() )
- // needMerge = true;
- }
+ tag = pmap.Add( v );
+ SMESH_subMesh* vSM = aMesh.GetSubMesh( v );
+ vSM->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+ mergeSubmeshes.insert( vSM->GetSubMeshDS() );
+ // //if ( tag != pmap.Extent() )
+ // needMerge = true;
}
- if ( tag == 0 ) tag = ienf;
- cad_point_set_tag(point_p, tag);
}
+ if ( tag == 0 ) tag = ienf;
+ cad_point_set_tag(point_p, tag);
}
FaceId2EnforcedVertexCoords.erase(faceKey);
if (ic <= 0)
ic = emap.Add(e);
-// std::string aFileName = "fmap_edge_";
-// aFileName.append(val_to_string(ic));
-// aFileName.append(".brep");
-// BRepTools::Write(e,aFileName.c_str());
-
double tmin,tmax;
curves.push_back(BRep_Tool::CurveOnSurface(e, f, tmin, tmax));
if (HasSizeMapOnEdge){
edgeKey = EdgesWithSizeMap.FindIndex(e);
- if (EdgeId2SizeMap.find(edgeKey)!=EdgeId2SizeMap.end()) {
- MESSAGE("Sizemap defined on edge with index " << edgeKey);
+ if (EdgeId2SizeMap.find(edgeKey)!=EdgeId2SizeMap.end())
+ {
theSizeMapStr = EdgeId2SizeMap[edgeKey];
if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1))
continue;
/* by default an edge has no tag (color).
The following call sets it to the same value as the edge_id : */
- cad_edge_set_tag(edg, ic);
+ // IMP23368. Do not set tag to an EDGE shared by FACEs of a hyper-patch
+ bool isInHyperPatch = false;
+ {
+ std::set< int > faceTags, faceIDs;
+ TopTools_ListIteratorOfListOfShape fIt( e2ffmap.FindFromKey( e ));
+ for ( ; fIt.More(); fIt.Next() )
+ {
+ int faceTag = meshDS->ShapeToIndex( fIt.Value() );
+ if ( !faceIDs.insert( faceTag ).second )
+ continue; // a face encounters twice for a seam edge
+ int hpTag = BLSURFPlugin_Hypothesis::GetHyperPatchTag( faceTag, _hypothesis );
+ if ( !faceTags.insert( hpTag ).second )
+ {
+ isInHyperPatch = true;
+ break;
+ }
+ }
+ }
+ if ( !isInHyperPatch )
+ cad_edge_set_tag(edg, ic);
/* by default, an edge does not necessalry appear in the resulting mesh,
unless the following property is set :
vertexKey = VerticesWithSizeMap.FindIndex(v);
if (VertexId2SizeMap.find(vertexKey)!=VertexId2SizeMap.end()){
theSizeMapStr = VertexId2SizeMap[vertexKey];
- //MESSAGE("VertexId2SizeMap[faceKey]: " << VertexId2SizeMap[vertexKey]);
if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1))
continue;
// Expr To Python function, verification is performed at validation in GUI
// PERIODICITY //
///////////////////////
- MESSAGE("BEFORE PERIODICITY");
- MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size());
- if (! _preCadFacesIDsPeriodicityVector.empty()) {
- MESSAGE("INTO PRECAD FACES PERIODICITY");
+ if (! _preCadFacesIDsPeriodicityVector.empty())
+ {
for (std::size_t i=0; i < _preCadFacesIDsPeriodicityVector.size(); i++){
std::vector<int> theFace1_ids = _preCadFacesIDsPeriodicityVector[i].shape1IDs;
std::vector<int> theFace2_ids = _preCadFacesIDsPeriodicityVector[i].shape2IDs;
for (std::size_t j=0; j < theFace2_ids.size(); j++)
o << theFace2_ids[j] << ", ";
o << "]";
- MESSAGE(o.str());
- MESSAGE("theFace1_ids.size(): " << theFace1_ids.size());
- MESSAGE("theFace2_ids.size(): " << theFace2_ids.size());
+ // if ( _hypothesis->GetVerbosity() > _hypothesis->GetDefaultVerbosity() )
+ // cout << o.str() << endl;
if (_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.empty())
- {
- // If no source points, call peridoicity without transformation function
- MESSAGE("periodicity without transformation function");
- meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
- status = cad_add_face_multiple_periodicity_with_transformation_function(c, theFace1_ids_c, theFace1_ids.size(),
- theFace2_ids_c, theFace2_ids.size(), periodicity_transformation, NULL);
- if(status != STATUS_OK)
- cout << "cad_add_face_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
- }
+ {
+ // If no source points, call periodicity without transformation function
+ meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
+ status = cad_add_face_multiple_periodicity_with_transformation_function(c, theFace1_ids_c, theFace1_ids.size(),
+ theFace2_ids_c, theFace2_ids.size(), periodicity_transformation, NULL);
+ if(status != STATUS_OK)
+ cout << "cad_add_face_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
+ }
else
- {
- // get the transformation vertices
- MESSAGE("periodicity with transformation vertices");
- double* theSourceVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords[0];
- double* theTargetVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords[0];
- int nbSourceVertices = _preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3;
- int nbTargetVertices = _preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3;
-
- MESSAGE("nbSourceVertices: " << nbSourceVertices << ", nbTargetVertices: " << nbTargetVertices);
-
- status = cad_add_face_multiple_periodicity_with_transformation_function_by_points(c, theFace1_ids_c, theFace1_ids.size(),
- theFace2_ids_c, theFace2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices);
- if(status != STATUS_OK)
- cout << "cad_add_face_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n";
- }
+ {
+ // get the transformation vertices
+ double* theSourceVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords[0];
+ double* theTargetVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords[0];
+ int nbSourceVertices = _preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3;
+ int nbTargetVertices = _preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3;
+
+ status = cad_add_face_multiple_periodicity_with_transformation_function_by_points(c, theFace1_ids_c, theFace1_ids.size(),
+ theFace2_ids_c, theFace2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices);
+ if(status != STATUS_OK)
+ cout << "cad_add_face_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n";
+ }
}
-
- MESSAGE("END PRECAD FACES PERIODICITY");
}
- MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size());
- if (! _preCadEdgesIDsPeriodicityVector.empty()) {
- MESSAGE("INTO PRECAD EDGES PERIODICITY");
+ if (! _preCadEdgesIDsPeriodicityVector.empty())
+ {
for (std::size_t i=0; i < _preCadEdgesIDsPeriodicityVector.size(); i++){
std::vector<int> theEdge1_ids = _preCadEdgesIDsPeriodicityVector[i].shape1IDs;
std::vector<int> theEdge2_ids = _preCadEdgesIDsPeriodicityVector[i].shape2IDs;
- // Use the address of the first element of the vector to initialise the array
+ // Use the address of the first element of the vector to initialize the array
int* theEdge1_ids_c = &theEdge1_ids[0];
int* theEdge2_ids_c = &theEdge2_ids[0];
for (std::size_t j=0; j < theEdge2_ids.size(); j++)
o << theEdge2_ids[j] << ", ";
o << "]";
- MESSAGE(o.str());
- MESSAGE("theEdge1_ids.size(): " << theEdge1_ids.size());
- MESSAGE("theEdge2_ids.size(): " << theEdge2_ids.size());
+ // if ( _hypothesis->GetVerbosity() > _hypothesis->GetDefaultVerbosity() )
+ // cout << o.str() << endl;
if (_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.empty())
- {
- // If no source points, call peridoicity without transformation function
- MESSAGE("periodicity without transformation function");
- meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
- status = cad_add_edge_multiple_periodicity_with_transformation_function(c, theEdge1_ids_c, theEdge1_ids.size(),
- theEdge2_ids_c, theEdge2_ids.size(), periodicity_transformation, NULL);
- if(status != STATUS_OK)
- cout << "cad_add_edge_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
- }
+ {
+ // If no source points, call periodicity without transformation function
+ meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL;
+ status = cad_add_edge_multiple_periodicity_with_transformation_function(c, theEdge1_ids_c, theEdge1_ids.size(),
+ theEdge2_ids_c, theEdge2_ids.size(), periodicity_transformation, NULL);
+ if(status != STATUS_OK)
+ cout << "cad_add_edge_multiple_periodicity_with_transformation_function failed with error code " << status << "\n";
+ }
else
- {
- // get the transformation vertices
- MESSAGE("periodicity with transformation vertices");
- double* theSourceVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords[0];
- double* theTargetVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords[0];
- int nbSourceVertices = _preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3;
- int nbTargetVertices = _preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3;
-
- MESSAGE("nbSourceVertices: " << nbSourceVertices << ", nbTargetVertices: " << nbTargetVertices);
-
- status = cad_add_edge_multiple_periodicity_with_transformation_function_by_points(c, theEdge1_ids_c, theEdge1_ids.size(),
- theEdge2_ids_c, theEdge2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices);
- if(status != STATUS_OK)
- cout << "cad_add_edge_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n";
- else
- MESSAGE("cad_add_edge_multiple_periodicity_with_transformation_function_by_points succeeded.\n");
- }
+ {
+ // get the transformation vertices
+ double* theSourceVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords[0];
+ double* theTargetVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords[0];
+ int nbSourceVertices = _preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3;
+ int nbTargetVertices = _preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3;
+
+ status = cad_add_edge_multiple_periodicity_with_transformation_function_by_points(c, theEdge1_ids_c, theEdge1_ids.size(),
+ theEdge2_ids_c, theEdge2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices);
+ if(status != STATUS_OK)
+ cout << "cad_add_edge_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n";
+ }
}
-
- MESSAGE("END PRECAD EDGES PERIODICITY");
}
projVertex.push_back((double)xyz[1]);
projVertex.push_back((double)xyz[2]);
std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(projVertex);
- if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end()) {
- MESSAGE("Found enforced vertex @ " << xyz[0] << ", " << xyz[1] << ", " << xyz[2]);
+ if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end())
+ {
BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfListIt = enfCoordsIt->second.begin();
BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
for (; enfListIt != enfCoordsIt->second.end(); ++enfListIt) {
if (currentEnfVertex->grpName != "") {
bool groupDone = false;
SMESH_Mesh::GroupIteratorPtr grIt = aMesh.GetGroups();
- MESSAGE("currentEnfVertex->grpName: " << currentEnfVertex->grpName);
- MESSAGE("Parsing the groups of the mesh");
while (grIt->more()) {
SMESH_Group * group = grIt->next();
if ( !group ) continue;
- MESSAGE("Group: " << group->GetName());
SMESHDS_GroupBase* groupDS = group->GetGroupDS();
if ( !groupDS ) continue;
- MESSAGE("group->SMDSGroup().GetType(): " << (groupDS->GetType()));
- MESSAGE("group->SMDSGroup().GetType()==SMDSAbs_Node: " << (groupDS->GetType()==SMDSAbs_Node));
- MESSAGE("currentEnfVertex->grpName.compare(group->GetStoreName())==0: " << (currentEnfVertex->grpName.compare(group->GetName())==0));
if ( groupDS->GetType()==SMDSAbs_Node && currentEnfVertex->grpName.compare(group->GetName())==0) {
SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );
aGroupDS->SMDSGroup().Add(nodes[iv]);
- MESSAGE("Node ID: " << nodes[iv]->GetID());
// How can I inform the hypothesis ?
// _hypothesis->AddEnfVertexNodeID(currentEnfVertex->grpName,nodes[iv]->GetID());
groupDone = true;
- MESSAGE("Successfully added enforced vertex to existing group " << currentEnfVertex->grpName);
break;
}
}
aGroup->SetName( currentEnfVertex->grpName.c_str() );
SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
aGroupDS->SMDSGroup().Add(nodes[iv]);
- MESSAGE("Successfully created enforced vertex group " << currentEnfVertex->grpName);
groupDone = true;
}
if (!groupDone)
SMESH_subMesh* sm = aMesh.GetSubMesh( f );
if ( !sm->GetSubMeshDS() || sm->GetSubMeshDS()->NbElements() == 0 )
{
- sm->GetComputeError().reset( new SMESH_ComputeError( err, _comment, this ));
- badFaceFound = true;
+ int faceTag = sm->GetId();
+ if ( faceTag != BLSURFPlugin_Hypothesis::GetHyperPatchTag( faceTag, _hypothesis ))
+ {
+ // triangles are assigned to the first face of hyper-patch
+ sm->SetIsAlwaysComputed( true );
+ }
+ else
+ {
+ sm->GetComputeError().reset( new SMESH_ComputeError( err, _comment, this ));
+ badFaceFound = true;
+ }
}
}
if ( err == COMPERR_WARNING )
FacesWithEnforcedVertices.Statistics(std::cout);
*/
- MESSAGE("END OF BLSURFPlugin_BLSURF::Compute()");
return ( status == STATUS_OK && !quadraticSubMeshAndViscousLayer );
}
+//================================================================================
+/*!
+ * \brief Compute a mesh basing on discrete CAD description
+ */
+//================================================================================
+
+bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper)
+{
+ if ( aMesh.NbFaces() == 0 )
+ return error( COMPERR_BAD_INPUT_MESH, "2D elements are missing" );
+
+ context_t *ctx = context_new();
+ if (!ctx) return error("Pb in context_new()");
+
+ BLSURF_Cleaner cleaner( ctx );
+
+ message_cb_user_data mcud;
+ mcud._error = & this->SMESH_Algo::_comment;
+ mcud._progress = & this->SMESH_Algo::_progress;
+ mcud._verbosity =
+ _hypothesis ? _hypothesis->GetVerbosity() : BLSURFPlugin_Hypothesis::GetDefaultVerbosity();
+ meshgems_status_t ret = context_set_message_callback(ctx, message_cb, &mcud);
+ if (ret != STATUS_OK) return error("Pb. in context_set_message_callback() ");
+
+ cadsurf_session_t * css = cadsurf_session_new(ctx);
+ if(!css) return error( "Pb. in cadsurf_session_new() " );
+ cleaner._css = css;
+
+
+ // Fill an input mesh
+
+ mesh_t * msh = meshgems_mesh_new_in_memory( ctx );
+ if ( !msh ) return error("Pb. in meshgems_mesh_new_in_memory()");
+
+ // mark nodes used by 2D elements
+ SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
+ SMDS_NodeIteratorPtr nodeIt = meshDS->nodesIterator();
+ while ( nodeIt->more() )
+ {
+ const SMDS_MeshNode* n = nodeIt->next();
+ n->setIsMarked( n->NbInverseElements( SMDSAbs_Face ));
+ }
+ meshgems_mesh_set_vertex_count( msh, meshDS->NbNodes() );
+
+ // set node coordinates
+ if ( meshDS->NbNodes() != meshDS->MaxNodeID() )
+ {
+ meshDS->compactMesh();
+ }
+ SMESH_TNodeXYZ nXYZ;
+ nodeIt = meshDS->nodesIterator();
+ meshgems_integer i;
+ for ( i = 1; nodeIt->more(); ++i )
+ {
+ nXYZ.Set( nodeIt->next() );
+ meshgems_mesh_set_vertex_coordinates( msh, i, nXYZ._xyz );
+ }
+
+ // set nodes of faces
+ meshgems_mesh_set_triangle_count ( msh, meshDS->GetMeshInfo().NbTriangles() );
+ meshgems_mesh_set_quadrangle_count( msh, meshDS->GetMeshInfo().NbQuadrangles() );
+ meshgems_integer nodeIDs[4];
+ meshgems_integer iT = 1, iQ = 1;
+ SMDS_FaceIteratorPtr faceIt = meshDS->facesIterator();
+ while ( faceIt->more() )
+ {
+ const SMDS_MeshElement* face = faceIt->next();
+ meshgems_integer nbNodes = face->NbCornerNodes();
+ if ( nbNodes > 4 || face->IsPoly() ) continue;
+
+ for ( i = 0; i < nbNodes; ++i )
+ nodeIDs[i] = face->GetNode( i )->GetID();
+ if ( nbNodes == 3 )
+ meshgems_mesh_set_triangle_vertices ( msh, iT++, nodeIDs );
+ else
+ meshgems_mesh_set_quadrangle_vertices( msh, iQ++, nodeIDs );
+ }
+
+ ret = cadsurf_set_mesh(css, msh);
+ if ( ret != STATUS_OK ) return error("Pb in cadsurf_set_mesh()");
+
+
+ // Compute the mesh
+
+ SetParameters(_hypothesis, css, aMesh.GetShapeToMesh() );
+
+ ret = cadsurf_compute_mesh(css);
+ if ( ret != STATUS_OK ) return false;
+
+ mesh_t *omsh = 0;
+ cadsurf_get_mesh(css, &omsh);
+ if ( !omsh ) return error( "Pb. in cadsurf_get_mesh()" );
+
+
+ // Update SALOME mesh
+
+ // remove quadrangles and triangles
+ for ( faceIt = meshDS->facesIterator(); faceIt->more(); )
+ {
+ const SMDS_MeshElement* face = faceIt->next();
+ if ( !face->IsPoly() )
+ meshDS->RemoveFreeElement( face, /*sm=*/0, /*fromGroups=*/true );
+ }
+ // remove edges that bound the just removed faces
+ for ( SMDS_EdgeIteratorPtr edgeIt = meshDS->edgesIterator(); edgeIt->more(); )
+ {
+ const SMDS_MeshElement* edge = edgeIt->next();
+ const SMDS_MeshNode* n0 = edge->GetNode(0);
+ const SMDS_MeshNode* n1 = edge->GetNode(1);
+ if ( n0->isMarked() &&
+ n1->isMarked() &&
+ n0->NbInverseElements( SMDSAbs_Volume ) == 0 &&
+ n1->NbInverseElements( SMDSAbs_Volume ) == 0 )
+ meshDS->RemoveFreeElement( edge, /*sm=*/0, /*fromGroups=*/true );
+ }
+ // remove nodes that just became free
+ for ( nodeIt = meshDS->nodesIterator(); nodeIt->more(); )
+ {
+ const SMDS_MeshNode* n = nodeIt->next();
+ if ( n->isMarked() && n->NbInverseElements() == 0 )
+ meshDS->RemoveFreeNode( n, /*sm=*/0, /*fromGroups=*/true );
+ }
+
+ // add nodes
+ meshgems_integer nbvtx = 0, nodeID;
+ meshgems_mesh_get_vertex_count( omsh, &nbvtx );
+ meshgems_real xyz[3];
+ for ( i = 1; i <= nbvtx; ++i )
+ {
+ meshgems_mesh_get_vertex_coordinates( omsh, i, xyz );
+ SMDS_MeshNode* n = meshDS->AddNode( xyz[0], xyz[1], xyz[2] );
+ nodeID = n->GetID();
+ meshgems_mesh_set_vertex_tag( omsh, i, &nodeID ); // save mapping of IDs in MG and SALOME meshes
+ }
+
+ // add triangles
+ meshgems_integer nbtri = 0;
+ meshgems_mesh_get_triangle_count( omsh, &nbtri );
+ const SMDS_MeshNode* nodes[3];
+ for ( i = 1; i <= nbtri; ++i )
+ {
+ meshgems_mesh_get_triangle_vertices( omsh, i, nodeIDs );
+ for ( int j = 0; j < 3; ++j )
+ {
+ meshgems_mesh_get_vertex_tag( omsh, nodeIDs[j], &nodeID );
+ nodes[j] = meshDS->FindNode( nodeID );
+ }
+ meshDS->AddFace( nodes[0], nodes[1], nodes[2] );
+ }
+
+ cadsurf_regain_mesh(css, omsh);
+
+ // as we don't assign the new triangles to a shape (the pseudo-shape),
+ // we mark the shape as always computed to avoid the error messages
+ // that no elements assigned to the shape
+ aMesh.GetSubMesh( aHelper->GetSubShape() )->SetIsAlwaysComputed( true );
+
+ return true;
+}
+
//================================================================================
/*!
* \brief Terminates computation
*/
//=============================================================================
-void BLSURFPlugin_BLSURF::Set_NodeOnEdge(SMESHDS_Mesh* meshDS, const SMDS_MeshNode* node, const TopoDS_Shape& ed) {
+void BLSURFPlugin_BLSURF::Set_NodeOnEdge(SMESHDS_Mesh* meshDS,
+ const SMDS_MeshNode* node,
+ const TopoDS_Shape& ed)
+{
const TopoDS_Edge edge = TopoDS::Edge(ed);
gp_Pnt pnt(node->X(), node->Y(), node->Z());
if ( pyresult != NULL) {
result = PyFloat_AsDouble(pyresult);
Py_DECREF(pyresult);
-// *size = result;
+ // *size = result;
}
else{
fflush(stderr);
*size = result;
PyGILState_Release(gstate);
}
- else if (( f2attVec = FaceIndex2ClassAttractor.find(face_id)) != FaceIndex2ClassAttractor.end() && !f2attVec->second.empty()){
-// MESSAGE("attractor used on face :"<<face_id)
- // MESSAGE("List of attractor is not empty")
- // MESSAGE("Attractor empty : "<< FaceIndex2ClassAttractor[face_id]->Empty())
+ else if (( f2attVec = FaceIndex2ClassAttractor.find(face_id)) != FaceIndex2ClassAttractor.end() && !f2attVec->second.empty())
+ {
real result = 0;
result = 1e100;
std::vector< BLSURFPlugin_Attractor* > & attVec = f2attVec->second;
*size = result;
}
else {
- // MESSAGE("List of attractor is empty !!!")
*size = *((real*)user_data);
}
-// std::cout << "Size_on_surface sur la face " << face_id << " donne une size de: " << *size << std::endl;
+ // std::cout << "Size_on_surface sur la face " << face_id << " donne une size de: " << *size << std::endl;
return STATUS_OK;
}
//0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry
// GetDefaultPhySize() sometimes leads to computation failure
_phySize = aMesh.GetShapeDiagonalSize() / _gen->GetBoundaryBoxSegmentation();
- MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults");
}
bool IsQuadratic = _quadraticMesh;
class BLSURFPlugin_BLSURF: public SMESH_2D_Algo {
public:
- BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen);
+ BLSURFPlugin_BLSURF(int hypId, SMESH_Gen* gen, bool theHasGEOM);
virtual ~BLSURFPlugin_BLSURF();
void SetParameters(const BLSURFPlugin_Hypothesis* hyp, cadsurf_session_t *css, const TopoDS_Shape& shape);
virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+ virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper);
virtual void CancelCompute();
bool computeCanceled() { return _compute_canceled; }
private:
PyObject * main_mod;
PyObject * main_dict;
- SMESH_Mesh* myMesh;
+ SMESH_MesherHelper* myHelper;
volatile bool _compute_canceled;
};
//=============================================================================
BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
- ::SMESH_Gen* theGenImpl )
+ ::SMESH_Gen* theGenImpl,
+ bool theHasGEOM )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_Algo_i( thePOA ),
SMESH_2D_Algo_i( thePOA )
{
- MESSAGE( "BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i" );
myBaseImpl = new ::BLSURFPlugin_BLSURF( theGenImpl->GetANewId(),
- theGenImpl );
+ theGenImpl,
+ theHasGEOM);
}
//=============================================================================
BLSURFPlugin_BLSURF_i::~BLSURFPlugin_BLSURF_i()
{
- MESSAGE( "BLSURFPlugin_BLSURF_i::~BLSURFPlugin_BLSURF_i" );
}
//=============================================================================
::BLSURFPlugin_BLSURF* BLSURFPlugin_BLSURF_i::GetImpl()
{
- MESSAGE( "BLSURFPlugin_BLSURF_i::GetImpl" );
return ( ::BLSURFPlugin_BLSURF* )myBaseImpl;
}
public:
// Constructor
BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA,
- ::SMESH_Gen* theGenImpl );
+ ::SMESH_Gen* theGenImpl,
+ bool theHasGEOM);
// Destructor
virtual ~BLSURFPlugin_BLSURF_i();
}
//=============================================================================
-BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen) :
- SMESH_Hypothesis(hypId, gen),
+BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom) :
+ SMESH_Hypothesis(hypId, gen),
_physicalMesh(GetDefaultPhysicalMesh()),
_geometricMesh(GetDefaultGeometricMesh()),
_phySize(GetDefaultPhySize()),
_verb(GetDefaultVerbosity()),
_topology(GetDefaultTopology()),
_preCADMergeEdges(GetDefaultPreCADMergeEdges()),
- _preCADRemoveTinyUVEdges(GetDefaultPreCADRemoveTinyUVEdges()),
_preCADRemoveDuplicateCADFaces(GetDefaultPreCADRemoveDuplicateCADFaces()),
_preCADProcess3DTopology(GetDefaultPreCADProcess3DTopology()),
_preCADDiscardInput(GetDefaultPreCADDiscardInput()),
_preCadEdgesPeriodicityVector(GetDefaultPreCadEdgesPeriodicityVector()),
_GMFFileName(GetDefaultGMFFile())
{
- _name = GetHypType();
+ _name = GetHypType(hasgeom);
_param_algo_dim = 2;
// _GMFFileMode = false; // GMF ascii mode
// "optimise_tiny_edges", // default = 0
// "remove_duplicate_cad_faces", // default = 1
"tiny_edge_avoid_surface_intersections", // default = 1
+ "debug", // default = 0
+ "use_deprecated_patch_mesher", // default 0
// "tiny_edge_respect_geometry", // default = 0
"" // mark of end
};
const char* intOptionNames[] = { "max_number_of_points_per_patch", // default = 100000
+ "max_number_of_threads", // default = 4
"" // mark of end
};
const char* doubleOptionNames[] = { // "surface_intersections_processing_max_cost",// default = 15
"merge_edges", // default = = 1
"remove_duplicate_cad_faces", // default = 1
// "create_tag_on_collision", // default = 1
- "debug", // default = 0
"process_3d_topology", // default = 1
// "remove_tiny_edges", // default = 0
+ // remove_tiny_uv_edges option is not documented
+ // but it is useful that the user can change it to disable all preprocessing options
+ "remove_tiny_uv_edges", // default = 1
"" // mark of end
};
const char* preCADintOptionNames[] = { // "manifold_geometry", // default = 0
_option2value[boolOptionNames[i++]].clear();
}
i = 0;
- while (preCADboolOptionNames[i][0])
+ while (preCADboolOptionNames[i][0] && hasgeom)
{
_boolOptions.insert( preCADboolOptionNames[i] );
_preCADoption2value[preCADboolOptionNames[i++]].clear();
_option2value[intOptionNames[i++]].clear();
i = 0;
- while (preCADintOptionNames[i][0])
+ while (preCADintOptionNames[i][0] && hasgeom)
_preCADoption2value[preCADintOptionNames[i++]].clear();
i = 0;
_option2value[doubleOptionNames[i++]].clear();
}
i = 0;
- while (preCADdoubleOptionNames[i][0]) {
+ while (preCADdoubleOptionNames[i][0] && hasgeom) {
_preCADdoubleOptions.insert(preCADdoubleOptionNames[i]);
_preCADoption2value[preCADdoubleOptionNames[i++]].clear();
}
_option2value[charOptionNames[i++]].clear();
}
i = 0;
- while (preCADcharOptionNames[i][0]) {
+ while (preCADcharOptionNames[i][0] && hasgeom) {
_preCADcharOptions.insert(preCADcharOptionNames[i]);
_preCADoption2value[preCADcharOptionNames[i++]].clear();
}
_defaultOptionValues["enforce_cad_edge_sizes" ] = "no";
_defaultOptionValues["jacobian_rectification_respect_geometry"] = "yes";
_defaultOptionValues["max_number_of_points_per_patch" ] = "0";
+ _defaultOptionValues["max_number_of_threads" ] = "4";
_defaultOptionValues["rectify_jacobian" ] = "yes";
+ _defaultOptionValues["use_deprecated_patch_mesher" ] = "yes";
_defaultOptionValues["respect_geometry" ] = "yes";
_defaultOptionValues["tiny_edge_avoid_surface_intersections" ] = "yes";
- _defaultOptionValues["process_3d_topology" ] = "no";
- _defaultOptionValues["closed_geometry" ] = "no";
+ _defaultOptionValues["use_deprecated_patch_mesher" ] = "no";
_defaultOptionValues["debug" ] = "no";
- _defaultOptionValues["discard_input_topology" ] = "no";
- _defaultOptionValues["merge_edges" ] = "no";
- _defaultOptionValues["periodic_tolerance" ] = "1e-5*D";
- _defaultOptionValues["remove_duplicate_cad_faces" ] = "no";
- _defaultOptionValues["required_entities" ] = "respect";
- _defaultOptionValues["sewing_tolerance" ] = "5e-4*D";
- _defaultOptionValues["tags" ] = "respect";
+ if ( hasgeom )
+ {
+ _defaultOptionValues["closed_geometry" ] = "no";
+ _defaultOptionValues["discard_input_topology" ] = "no";
+ _defaultOptionValues["merge_edges" ] = "no";
+ _defaultOptionValues["periodic_tolerance" ] = "1e-5*D";
+ _defaultOptionValues["process_3d_topology" ] = "no";
+ _defaultOptionValues["remove_duplicate_cad_faces" ] = "no";
+ _defaultOptionValues["remove_tiny_uv_edges" ] = "no";
+ _defaultOptionValues["required_entities" ] = "respect";
+ _defaultOptionValues["sewing_tolerance" ] = "5e-4*D";
+ _defaultOptionValues["tags" ] = "respect";
+ }
#ifdef _DEBUG_
// check validity of option names of _defaultOptionValues
ASSERT( _option2value.count( n2v->first ) || _preCADoption2value.count( n2v->first ));
ASSERT( _option2value.size() + _preCADoption2value.size() == _defaultOptionValues.size() );
#endif
-
+
_sizeMap.clear();
_attractors.clear();
_faceEntryEnfVertexListMap.clear();
TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry)
{
- MESSAGE("BLSURFPlugin_Hypothesis::entryToShape "<<entry );
GEOM::GEOM_Object_var aGeomObj;
TopoDS_Shape S = TopoDS_Shape();
_phySizeRel = isRelative;
if (theVal == 0) {
_phySize = GetMaxSize();
- MESSAGE("Warning: nul physical size is not allowed");
}
else
_phySize = theVal;
}
//=============================================================================
+void BLSURFPlugin_Hypothesis::SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher )
+{
+ if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
+ {
+ SetOptionValue( "use_deprecated_patch_mesher", useDeprecatedPatchMesher ? "yes" : "no" );
+ NotifySubMeshesHypothesisModification();
+ }
+}
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetUseDeprecatedPatchMesher()
+{
+ return ToBool( GetOptionValue("use_deprecated_patch_mesher", GET_DEFAULT()));
+}
+//=============================================================================
+
void BLSURFPlugin_Hypothesis::SetMaxNumberOfPointsPerPatch( int nb )
throw (std::invalid_argument)
{
}
//=============================================================================
+void BLSURFPlugin_Hypothesis::SetMaxNumberOfThreads( int nb )
+ throw (std::invalid_argument)
+{
+ if ( nb < 0 )
+ throw std::invalid_argument( SMESH_Comment("Invalid number of threads: ") << nb );
+
+ if ( GetMaxNumberOfThreads() != nb )
+ {
+ SetOptionValue("max_number_of_threads", SMESH_Comment( nb ));
+ NotifySubMeshesHypothesisModification();
+ }
+}
+//=============================================================================
+int BLSURFPlugin_Hypothesis::GetMaxNumberOfThreads()
+{
+ return ToInt( GetOptionValue("max_number_of_threads", GET_DEFAULT()));
+}
+//=============================================================================
+
void BLSURFPlugin_Hypothesis::SetRespectGeometry( bool toRespect )
{
if ( GetRespectGeometry() != toRespect )
return GetPreCADOptionValue("tags", GET_DEFAULT());
}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal)
+void BLSURFPlugin_Hypothesis::SetHyperPatches(const THyperPatchList& hpl)
{
- if (theVal != ToBool( GetPreCADOptionValue("merge_edges", GET_DEFAULT()))) {
- _preCADMergeEdges = theVal;
- SetPreCADOptionValue("merge_edges", theVal ? "yes" : "no" );
+ if ( hpl != _hyperPatchList )
+ {
+ // join patches sharing tags
+ _hyperPatchList.clear();
+ for ( size_t i = 0; i < hpl.size(); ++i )
+ {
+ const THyperPatchTags& tags = hpl[i];
+ if ( tags.size() < 2 ) continue;
+
+ std::set<int> iPatches;
+ if ( !_hyperPatchList.empty() )
+ {
+ THyperPatchTags::iterator t = tags.begin();
+ for ( ; t != tags.end(); ++t )
+ {
+ int iPatch = -1;
+ GetHyperPatchTag( *t, this, &iPatch );
+ if ( iPatch >= 0 )
+ iPatches.insert( iPatch );
+ }
+ }
+
+ if ( iPatches.empty() )
+ {
+ _hyperPatchList.push_back( tags );
+ }
+ else
+ {
+ std::set<int>::iterator iPatch = iPatches.begin();
+ THyperPatchTags& mainPatch = _hyperPatchList[ *iPatch ];
+ mainPatch.insert( tags.begin(), tags.end() );
+
+ for ( ++iPatch; iPatch != iPatches.end(); ++iPatch )
+ {
+ mainPatch.insert( _hyperPatchList[ *iPatch ].begin(), _hyperPatchList[ *iPatch ].end() );
+ _hyperPatchList[ *iPatch ].clear();
+ }
+ if ( iPatches.size() > 1 )
+ for ( int j = _hyperPatchList.size()-1; j > 0; --j )
+ if ( _hyperPatchList[j].empty() )
+ _hyperPatchList.erase( _hyperPatchList.begin() + j );
+ }
+ }
NotifySubMeshesHypothesisModification();
}
}
+//=============================================================================
+/*!
+ * \brief Return a tag of a face taking into account the hyper-patches. Optionally
+ * return an index of a patch including the face
+ */
+//================================================================================
+int BLSURFPlugin_Hypothesis::GetHyperPatchTag( const int faceTag,
+ const BLSURFPlugin_Hypothesis* hyp,
+ int* iPatch)
+{
+ if ( hyp )
+ {
+ const THyperPatchList& hpl = hyp->_hyperPatchList;
+ for ( size_t i = 0; i < hpl.size(); ++i )
+ if ( hpl[i].count( faceTag ))
+ {
+ if ( iPatch ) *iPatch = i;
+ return *( hpl[i].begin() );
+ }
+ }
+ return faceTag;
+}
//=============================================================================
-void BLSURFPlugin_Hypothesis::SetPreCADRemoveTinyUVEdges(bool theVal)
+void BLSURFPlugin_Hypothesis::SetPreCADMergeEdges(bool theVal)
{
- if (theVal != _preCADRemoveTinyUVEdges) {
- _preCADRemoveTinyUVEdges = theVal;
+ if (theVal != ToBool( GetPreCADOptionValue("merge_edges", GET_DEFAULT()))) {
+ _preCADMergeEdges = theVal;
+ SetPreCADOptionValue("merge_edges", theVal ? "yes" : "no" );
NotifySubMeshesHypothesisModification();
}
}
// Return true if any PreCAD option is activated
bool BLSURFPlugin_Hypothesis::HasPreCADOptions(const BLSURFPlugin_Hypothesis* hyp)
{
- if ( !hyp )
+ if ( !hyp || hyp->_name == GetHypType(/*hasgeom=*/false))
{
return false;
}
!hyp->_facesPeriodicityVector.empty() ||
!hyp->_edgesPeriodicityVector.empty() ||
!hyp->_verticesPeriodicityVector.empty() ||
+ !hyp->GetHyperPatches().empty() ||
hyp->GetTopology() != FromCAD );
}
++it_clAt;
}
while ( it_clAt != _classAttractors.end() );
- MESSAGE("_classAttractors.size() = "<<_classAttractors.size())
NotifySubMeshesHypothesisModification();
}
else
// bool toEnforceInternalVertices,
// TEnfGroupName theGroupName) {
-// MESSAGE("BLSURFPlugin_Hypothesis::SetInternalEnforcedVertex("<< theFaceEntry << ", "
// << toEnforceInternalVertices << ", " << theGroupName << ")");
// TFaceEntryInternalVerticesList::iterator it = _faceEntryInternalVerticesList.find(theFaceEntry);
//=======================================================================
//function : SetEnforcedVertex
//=======================================================================
-bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry,
- TEnfGroupName theGroupName, double x, double y, double z) {
-
- MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex("<< theFaceEntry << ", "
- << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theVertexEntry << ", " << theGroupName << ")");
-
+bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry,
+ TEnfName theVertexName,
+ TEntry theVertexEntry,
+ TEnfGroupName theGroupName,
+ double x, double y, double z)
+{
SetPhysicalMesh(PhysicalLocalSize);
- // TEnfVertexList::iterator it;
bool toNotify = false;
bool toCreate = true;
newEnfVertex->grpName = theGroupName;
newEnfVertex->faceEntries.clear();
newEnfVertex->faceEntries.insert(theFaceEntry);
-
-
+
+
// update _enfVertexList
TEnfVertexList::iterator it = _enfVertexList.find(newEnfVertex);
if (it != _enfVertexList.end()) {
toCreate = false;
oldEnVertex = (*it);
- MESSAGE("Enforced Vertex was found => Update");
if (oldEnVertex->name != theVertexName) {
- MESSAGE("Update name from \"" << oldEnVertex->name << "\" to \"" << theVertexName << "\"");
oldEnVertex->name = theVertexName;
toNotify = true;
}
if (oldEnVertex->grpName != theGroupName) {
- MESSAGE("Update group name from \"" << oldEnVertex->grpName << "\" to \"" << theGroupName << "\"");
oldEnVertex->grpName = theGroupName;
toNotify = true;
}
TEntryList::iterator it_faceEntries = oldEnVertex->faceEntries.find(theFaceEntry);
if (it_faceEntries == oldEnVertex->faceEntries.end()) {
- MESSAGE("Update face list by adding \"" << theFaceEntry << "\"");
oldEnVertex->faceEntries.insert(theFaceEntry);
_faceEntryEnfVertexListMap[theFaceEntry].insert(oldEnVertex);
toNotify = true;
// //////// CREATE ////////////
if (toCreate) {
toNotify = true;
- MESSAGE("Creating new enforced vertex");
_faceEntryEnfVertexListMap[theFaceEntry].insert(newEnfVertex);
_enfVertexList.insert(newEnfVertex);
if (theVertexEntry == "") {
if (toNotify)
NotifySubMeshesHypothesisModification();
- MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex END");
return toNotify;
}
TEnfVertexEntryEnfVertexMap::iterator it_enfVertexEntry = _enfVertexEntryEnfVertexMap.find(theVertexEntry);
if (it_enfVertexEntry != _enfVertexEntryEnfVertexMap.end()) {
// Success
- MESSAGE("Found enforced vertex with geom entry " << theVertexEntry);
oldEnfVertex = it_enfVertexEntry->second;
_enfVertexEntryEnfVertexMap.erase(it_enfVertexEntry);
TCoordsEnfVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
if (it_coords_enf != _coordsEnfVertexMap.end()) {
// Success
- MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z);
oldEnfVertex = it_coords_enf->second;
_coordsEnfVertexMap.erase(it_coords_enf);
}
}
- MESSAGE("Remove enf vertex from _enfVertexList");
-
// update _enfVertexList
TEnfVertexList::iterator it = _enfVertexList.find(oldEnfVertex);
if (it != _enfVertexList.end()) {
_enfVertexList.erase(it);
toNotify = true;
}
- MESSAGE("Done");
}
// update _faceEntryEnfVertexListMap
currentEnfVertexList.erase(oldEnfVertex);
if (currentEnfVertexList.size() == 0) {
- MESSAGE("Remove _faceEntryEnfVertexListMap[" << theFaceEntry <<"]");
_faceEntryEnfVertexListMap.erase(theFaceEntry);
- MESSAGE("Done");
}
if (toNotify)
_enfVertexList.erase(it);
toNotify = true;
}
- MESSAGE("Done");
}
}
_faceEntryCoordsListMap.erase(it_entry_coords);
_enfVertexList.erase(it);
toNotify = true;
}
- MESSAGE("Done");
}
}
_faceEntryEnfVertexEntryListMap.erase(it_entry_entry);
//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;
}
//=============================================================================
-std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
- // We must keep at least the same number of arguments when increasing the SALOME version
- // 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.
+std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save)
+{
+ // We must keep at least the same number of arguments when increasing the SALOME version
+ // 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
+ TOptionValues::iterator op_val;
+ int _decimesh = -1;
+ int _preCADRemoveNanoEdges = -1;
+ double _preCADEpsNano = -1.0;
+ op_val = _option2value.find("respect_geometry");
+ if (op_val != _option2value.end()) {
+ std::string value = op_val->second;
+ if (!value.empty())
+ _decimesh = value.compare("1") == 0 ? 1 : 0;
+ }
+ op_val = _preCADoption2value.find("remove_tiny_edges");
+ if (op_val != _preCADoption2value.end()) {
+ std::string value = op_val->second;
+ if (!value.empty())
+ _preCADRemoveNanoEdges = value.compare("1") == 0 ? 1 : 0;
+ }
+ op_val = _preCADoption2value.find("tiny_edge_length");
+ if (op_val != _preCADoption2value.end()) {
+ std::string value = op_val->second;
+ if (!value.empty())
+ _preCADEpsNano = strtod(value.c_str(), NULL);
+ }
- // Treat old options which are now in the advanced options
- TOptionValues::iterator op_val;
- int _decimesh = -1;
- int _preCADRemoveNanoEdges = -1;
- double _preCADEpsNano = -1.0;
- op_val = _option2value.find("respect_geometry");
- if (op_val != _option2value.end()) {
- std::string value = op_val->second;
- if (!value.empty())
- _decimesh = value.compare("1") == 0 ? 1 : 0;
- }
- op_val = _preCADoption2value.find("remove_tiny_edges");
- if (op_val != _preCADoption2value.end()) {
- std::string value = op_val->second;
- if (!value.empty())
- _preCADRemoveNanoEdges = value.compare("1") == 0 ? 1 : 0;
- }
- op_val = _preCADoption2value.find("tiny_edge_length");
- if (op_val != _preCADoption2value.end()) {
- std::string value = op_val->second;
- if (!value.empty())
- _preCADEpsNano = strtod(value.c_str(), NULL);
- }
-
save << " " << (int) _topology << " " << (int) _physicalMesh << " " << (int) _geometricMesh << " " << _phySize << " "
- << _angleMesh << " " << _gradation << " " << (int) _quadAllowed << " " << _decimesh;
+ << _angleMesh << " " << _gradation << " " << (int) _quadAllowed << " " << _decimesh;
save << " " << _minSize << " " << _maxSize << " " << _angleMesh << " " << _minSize << " " << _maxSize << " " << _verb;
save << " " << (int) _preCADMergeEdges << " " << _preCADRemoveNanoEdges << " " << (int) _preCADDiscardInput << " " << _preCADEpsNano ;
save << " " << (int) _enforcedInternalVerticesAllFaces;
save << " " << (int) _phySizeRel << " " << (int) _minSizeRel << " " << (int) _maxSizeRel << " " << _chordalError ;
save << " " << (int) _anisotropic << " " << _anisotropicRatio << " " << (int) _removeTinyEdges << " " << _tinyEdgeLength ;
save << " " << (int) _badElementRemoval << " " << _badElementAspectRatio << " " << (int) _optimizeMesh << " " << (int) _quadraticMesh ;
- save << " " << (int) _preCADProcess3DTopology << " " << (int) _preCADRemoveDuplicateCADFaces << " " << (int) _preCADRemoveTinyUVEdges;
+ save << " " << (int) _preCADProcess3DTopology << " " << (int) _preCADRemoveDuplicateCADFaces;
save << " " << (int)_optimiseTinyEdges << " " << _tinyEdgeOptimisationLength;
save << " " << (int)_correctSurfaceIntersec << " " << _corrSurfaceIntersCost;
save << " " << (int)_useGradation << " " << (int)_useVolumeGradation << " " << _volumeGradation;
}
save << " " << "__NEW_ATTRACTORS_END__";
test << " " << "__NEW_ATTRACTORS_END__";
- MESSAGE(" Attractor hypothesis saved as "<<test.str())
}
TEnfVertexList::const_iterator it_enf = _enfVertexList.begin();
save << " " << "__BEGIN_FACELIST__";
}
for (; faceEntriesIt != enfVertex->faceEntries.end(); ++faceEntriesIt)
- save << " " << (*faceEntriesIt);
+ if ( faceEntriesIt->empty() )
+ save << " _no_face_";
+ else
+ save << " " << (*faceEntriesIt);
if (hasFaces)
save << " " << "__END_FACELIST__";
save << " " << "__END_VERTEX__";
SaveEdgesPeriodicity(save);
SaveVerticesPeriodicity(save);
+ // HYPER-PATCHES
+ save << " " << _hyperPatchList.size() << " ";
+ for ( size_t i = 0; i < _hyperPatchList.size(); ++i )
+ {
+ THyperPatchTags& patch = _hyperPatchList[i];
+ save << patch.size() << " ";
+ THyperPatchTags::iterator tag = patch.begin();
+ for ( ; tag != patch.end(); ++tag )
+ save << *tag << " ";
+ }
+
return save;
}
TFacesPeriodicityVector::const_iterator it_faces_periodicity = _facesPeriodicityVector.begin();
if (it_faces_periodicity != _facesPeriodicityVector.end()) {
- MESSAGE("__FACES_PERIODICITY_BEGIN__");
save << " " << "__FACES_PERIODICITY_BEGIN__";
for (; it_faces_periodicity != _facesPeriodicityVector.end(); ++it_faces_periodicity) {
TFacesPeriodicity periodicity_i = (*it_faces_periodicity);
save << " " << "__END_PERIODICITY_DESCRIPTION__";
}
save << " " << "__FACES_PERIODICITY_END__";
- MESSAGE("__FACES_PERIODICITY_END__");
}
}
TEdgesPeriodicityVector::const_iterator it_edges_periodicity = _edgesPeriodicityVector.begin();
if (it_edges_periodicity != _edgesPeriodicityVector.end()) {
save << " " << "__EDGES_PERIODICITY_BEGIN__";
- MESSAGE("__EDGES_PERIODICITY_BEGIN__");
for (; it_edges_periodicity != _edgesPeriodicityVector.end(); ++it_edges_periodicity) {
TEdgePeriodicity periodicity_i = (*it_edges_periodicity);
save << " " << "__BEGIN_PERIODICITY_DESCRIPTION__";
save << " " << "__END_PERIODICITY_DESCRIPTION__";
}
save << " " << "__EDGES_PERIODICITY_END__";
- MESSAGE("__EDGES_PERIODICITY_END__");
}
}
TVerticesPeriodicityVector::const_iterator it_vertices_periodicity = _verticesPeriodicityVector.begin();
if (it_vertices_periodicity != _verticesPeriodicityVector.end()) {
- MESSAGE("__VERTICES_PERIODICITY_BEGIN__");
save << " " << "__VERTICES_PERIODICITY_BEGIN__";
for (; it_vertices_periodicity != _verticesPeriodicityVector.end(); ++it_vertices_periodicity) {
TVertexPeriodicity periodicity_i = (*it_vertices_periodicity);
save << " " << "__END_PERIODICITY_DESCRIPTION__";
}
save << " " << "__VERTICES_PERIODICITY_END__";
- MESSAGE("__VERTICES_PERIODICITY_END__");
}
}
}
//=============================================================================
-std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) {
+std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load)
+{
bool isOK = true;
int i;
double val;
else
load.clear(std::ios::badbit | load.rdstate());
- isOK = static_cast<bool>(load >> i);
- if (isOK)
- _preCADRemoveTinyUVEdges = (bool) i;
- else
- load.clear(std::ios::badbit | load.rdstate());
-
isOK = static_cast<bool>(load >> i);
if (isOK)
_optimiseTinyEdges = (bool) i;
isOK = static_cast<bool>(load >> attParams[0]>>attParams[1]>>attParams[2]>>attParams[3]); //>>step);
}
if (isOK) {
- MESSAGE(" LOADING ATTRACTOR HYPOTHESIS ")
const TopoDS_Shape attractorShape = BLSURFPlugin_Hypothesis::entryToShape(newAtShapeEntry);
const TopoDS_Face faceShape = TopoDS::Face(BLSURFPlugin_Hypothesis::entryToShape(newAtFaceEntry));
BLSURFPlugin_Attractor* attractor = new BLSURFPlugin_Attractor(faceShape, attractorShape, newAtShapeEntry);//, step);
// __ENFORCED_VERTICES_BEGIN__
// __BEGIN_VERTEX__ => no name, no entry
// __BEGIN_GROUP__ mon groupe __END_GROUP__
-// __BEGIN_COORDS__ 10 10 10 __END_COORDS__
-// __BEGIN_FACELIST__ 0:1:1:1:1 __END_FACELIST__
-// __END_VERTEX__
+// __BEGIN_COORDS__ 10 10 10 __END_COORDS__
+// __BEGIN_FACELIST__ 0:1:1:1:1 __END_FACELIST__
+// __END_VERTEX__
// __BEGIN_VERTEX__ => no coords
-// __BEGIN_NAME__ mes points __END_NAME__
+// __BEGIN_NAME__ mes points __END_NAME__
// __BEGIN_ENTRY__ 0:1:1:4 __END_ENTRY__
// __BEGIN_GROUP__ mon groupe __END_GROUP__
// __BEGIN_FACELIST__ 0:1:1:1:3 __END_FACELIST__
-// __END_VERTEX__
+// __END_VERTEX__
// __ENFORCED_VERTICES_END__
-//
+//
std::string enfSeparator;
std::string enfName;
TEntryList enfFaceEntryList;
double enfCoords[3];
bool hasCoords = false;
-
+
_faceEntryEnfVertexListMap.clear();
_enfVertexList.clear();
_faceEntryCoordsListMap.clear();
_coordsEnfVertexMap.clear();
_faceEntryEnfVertexEntryListMap.clear();
_enfVertexEntryEnfVertexMap.clear();
-
-
- while (isOK && hasEnforcedVertex) {
+
+
+ while (isOK && hasEnforcedVertex)
+ {
isOK = static_cast<bool>(load >> enfSeparator); // __BEGIN_VERTEX__
TEnfVertex *enfVertex = new TEnfVertex();
-// MESSAGE("enfSeparator: " <<enfSeparator);
if (enfSeparator == "__ENFORCED_VERTICES_END__")
break; // __ENFORCED_VERTICES_END__
if (enfSeparator != "__BEGIN_VERTEX__")
throw std::exception();
-
+
while (isOK) {
isOK = static_cast<bool>(load >> enfSeparator);
- MESSAGE("enfSeparator: " <<enfSeparator);
if (enfSeparator == "__END_VERTEX__") {
-
+
enfVertex->name = enfName;
enfVertex->geomEntry = enfGeomEntry;
enfVertex->grpName = enfGroup;
if (hasCoords)
enfVertex->coords.assign(enfCoords,enfCoords+3);
enfVertex->faceEntries = enfFaceEntryList;
-
+
_enfVertexList.insert(enfVertex);
-
+
if (enfVertex->coords.size()) {
_coordsEnfVertexMap[enfVertex->coords] = enfVertex;
for (TEntryList::const_iterator it = enfVertex->faceEntries.begin() ; it != enfVertex->faceEntries.end(); ++it) {
_faceEntryEnfVertexListMap[(*it)].insert(enfVertex);
}
}
-
+
enfName.clear();
enfGeomEntry.clear();
enfGroup.clear();
hasCoords = false;
break; // __END_VERTEX__
}
-
+
if (enfSeparator == "__BEGIN_NAME__") { // __BEGIN_NAME__
while (isOK && (enfSeparator != "__END_NAME__")) {
isOK = static_cast<bool>(load >> enfSeparator);
enfName += enfSeparator;
}
}
- MESSAGE("enfName: " <<enfName);
}
-
+
if (enfSeparator == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
isOK = static_cast<bool>(load >> enfGeomEntry);
isOK = static_cast<bool>(load >> enfSeparator); // __END_ENTRY__
if (enfSeparator != "__END_ENTRY__")
throw std::exception();
- MESSAGE("enfGeomEntry: " <<enfGeomEntry);
}
-
+
if (enfSeparator == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
while (isOK && (enfSeparator != "__END_GROUP__")) {
isOK = static_cast<bool>(load >> enfSeparator);
enfGroup += enfSeparator;
}
}
- MESSAGE("enfGroup: " <<enfGroup);
}
-
+
if (enfSeparator == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
hasCoords = true;
isOK = static_cast<bool>(load >> enfCoords[0] >> enfCoords[1] >> enfCoords[2]);
isOK = static_cast<bool>(load >> enfSeparator); // __END_COORDS__
if (enfSeparator != "__END_COORDS__")
throw std::exception();
- MESSAGE("enfCoords: " << enfCoords[0] <<","<< enfCoords[1] <<","<< enfCoords[2]);
- }
-
+ }
+
if (enfSeparator == "__BEGIN_FACELIST__") { // __BEGIN_FACELIST__
while (isOK && (enfSeparator != "__END_FACELIST__")) {
isOK = static_cast<bool>(load >> enfSeparator);
if (enfSeparator != "__END_FACELIST__") {
enfFaceEntryList.insert(enfSeparator);
- MESSAGE(enfSeparator << " was inserted into enfFaceEntryList");
}
}
- }
+ }
}
}
// PERIODICITY
- if (hasPreCADFacesPeriodicity){
+ if (hasPreCADFacesPeriodicity)
+ {
LoadPreCADPeriodicity(load, "FACES");
isOK = static_cast<bool>(load >> option_or_sm);
}
}
- if (hasPreCADEdgesPeriodicity){
+ if (hasPreCADEdgesPeriodicity)
+ {
LoadPreCADPeriodicity(load, "EDGES");
isOK = static_cast<bool>(load >> option_or_sm);
}
}
- if (hasFacesPeriodicity){
- LoadFacesPeriodicity(load);
+ if (hasFacesPeriodicity)
+ {
+ LoadFacesPeriodicity(load);
isOK = static_cast<bool>(load >> option_or_sm);
if (isOK) {
}
}
- if (hasEdgesPeriodicity){
- LoadEdgesPeriodicity(load);
+ if (hasEdgesPeriodicity)
+ {
+ LoadEdgesPeriodicity(load);
isOK = static_cast<bool>(load >> option_or_sm);
if (isOK)
}
if (hasVerticesPeriodicity)
- LoadVerticesPeriodicity(load);
+ LoadVerticesPeriodicity(load);
+
+ // HYPER-PATCHES
+ if ( !option_or_sm.empty() && option_or_sm[0] == '_' )
+ isOK = static_cast<bool>(load >> option_or_sm);
+ if ( isOK && !option_or_sm.empty() )
+ {
+ int nbPatches = atoi( option_or_sm.c_str() );
+ if ( nbPatches >= 0 )
+ {
+ _hyperPatchList.resize( nbPatches );
+ for ( int iP = 0; iP < nbPatches && isOK; ++iP )
+ {
+ isOK = static_cast<bool>(load >> i) && i >= 2;
+ if ( !isOK ) break;
+ int nbTags = i;
+ for ( int iT = 0; iT < nbTags; ++iT )
+ {
+ if (( isOK = static_cast<bool>(load >> i)))
+ _hyperPatchList[ iP ].insert( i );
+ else
+ break;
+ }
+ }
+ if ( !isOK ) // remove invalid patches
+ {
+ for ( i = nbPatches - 1; i >= 0; i-- )
+ if ( _hyperPatchList[i].size() < 2 )
+ _hyperPatchList.resize( i );
+ }
+ }
+ }
return load;
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
- MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
TFacesPeriodicity *periodicity_i = new TFacesPeriodicity();
if (periodicitySeparator == "__FACES_PERIODICITY_END__")
break; // __FACES_PERIODICITY_END__
if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator);
- MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
periodicity_i->first = shape1Entry;
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_ENTRY1__
if (periodicitySeparator != "__END_ENTRY1__")
throw std::exception();
- MESSAGE("shape1Entry: " <<shape1Entry);
}
if (periodicitySeparator == "__BEGIN_ENTRY2__") { // __BEGIN_ENTRY2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_ENTRY2__
if (periodicitySeparator != "__END_ENTRY2__")
throw std::exception();
- MESSAGE("shape2Entry: " <<shape2Entry);
}
}
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
- MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
TEdgePeriodicity *periodicity_i = new TEdgePeriodicity();
if (periodicitySeparator == "__EDGES_PERIODICITY_END__")
break; // __EDGES_PERIODICITY_END__
if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator);
- MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
periodicity_i->theFace1Entry = theFace1Entry;
if (periodicitySeparator == "__BEGIN_FACE1__") { // __BEGIN_FACE1__
isOK = static_cast<bool>(load >> theFace1Entry);
- MESSAGE("//" << theFace1Entry << "//");
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_FACE1__
if (periodicitySeparator != "__END_FACE1__"){
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
- MESSAGE("theFace1Entry: " <<theFace1Entry);
}
if (periodicitySeparator == "__BEGIN_EDGE1__") { // __BEGIN_EDGE1__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE1__
if (periodicitySeparator != "__END_EDGE1__")
throw std::exception();
- MESSAGE("theEdge1Entry: " <<theEdge1Entry);
}
if (periodicitySeparator == "__BEGIN_FACE2__") { // __BEGIN_FACE2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_FACE2__
if (periodicitySeparator != "__END_FACE2__")
throw std::exception();
- MESSAGE("theFace2Entry: " <<theFace2Entry);
}
if (periodicitySeparator == "__BEGIN_EDGE2__") { // __BEGIN_EDGE2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE2__
if (periodicitySeparator != "__END_EDGE2__")
throw std::exception();
- MESSAGE("theEdge2Entry: " <<theEdge2Entry);
}
if (periodicitySeparator == "__BEGIN_EDGE_ORIENTATION__") { // __BEGIN_EDGE_ORIENTATION__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE_ORIENTATION__
if (periodicitySeparator != "__END_EDGE_ORIENTATION__")
throw std::exception();
- MESSAGE("edge_orientation: " <<edge_orientation);
}
}
}
}
-void BLSURFPlugin_Hypothesis::LoadVerticesPeriodicity(std::istream & load){
-
+void BLSURFPlugin_Hypothesis::LoadVerticesPeriodicity(std::istream & load)
+{
bool isOK = true;
std::string periodicitySeparator;
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
- MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
TVertexPeriodicity *periodicity_i = new TVertexPeriodicity();
if (periodicitySeparator == "__VERTICES_PERIODICITY_END__")
break; // __VERTICES_PERIODICITY_END__
if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator);
- MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
periodicity_i->theEdge1Entry = theEdge1Entry;
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE1__
if (periodicitySeparator != "__END_EDGE1__")
throw std::exception();
- MESSAGE("theEdge1Entry: " <<theEdge1Entry);
}
if (periodicitySeparator == "__BEGIN_VERTEX1__") { // __BEGIN_VERTEX1__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_VERTEX1__
if (periodicitySeparator != "__END_VERTEX1__")
throw std::exception();
- MESSAGE("theVertex1Entry: " <<theVertex1Entry);
}
if (periodicitySeparator == "__BEGIN_EDGE2__") { // __BEGIN_EDGE2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_EDGE2__
if (periodicitySeparator != "__END_EDGE2__")
throw std::exception();
- MESSAGE("theEdge2Entry: " <<theEdge2Entry);
}
if (periodicitySeparator == "__BEGIN_VERTEX2__") { // __BEGIN_VERTEX2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_VERTEX2__
if (periodicitySeparator != "__END_VERTEX2__")
throw std::exception();
- MESSAGE("theVertex2Entry: " <<theVertex2Entry);
}
}
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__
- MESSAGE("periodicitySeparator 1: " <<periodicitySeparator);
TPreCadPeriodicity *periodicity_i = new TPreCadPeriodicity();
-// MESSAGE("periodicitySeparator: " <<periodicitySeparator);
std::string endSeparator = "__PRECAD_" + std::string(shapeType) + "_PERIODICITY_END__";
if (periodicitySeparator == endSeparator)
break; // __PRECAD_FACES_PERIODICITY_END__
if (periodicitySeparator != "__BEGIN_PERIODICITY_DESCRIPTION__"){
- MESSAGE("//" << endSeparator << "//");
- MESSAGE("//" << periodicitySeparator << "//");
throw std::exception();
}
while (isOK) {
isOK = static_cast<bool>(load >> periodicitySeparator);
- MESSAGE("periodicitySeparator 2: " <<periodicitySeparator);
if (periodicitySeparator == "__END_PERIODICITY_DESCRIPTION__") {
periodicity_i->shape1Entry = shape1Entry;
periodicity_i->shape2Entry = shape2Entry;
- MESSAGE("theSourceVerticesEntries.size(): " << theSourceVerticesEntries.size());
- MESSAGE("theTargetVerticesEntries.size(): " << theTargetVerticesEntries.size());
-
if (hasSourceVertices)
periodicity_i->theSourceVerticesEntries = theSourceVerticesEntries;
if (hasTargetVertices)
periodicity_i->theTargetVerticesEntries = theTargetVerticesEntries;
- if ( shapeType && strcmp( shapeType, "FACES" ))
+ if ( shapeType && strcmp( shapeType, "FACES" ) == 0 )
_preCadFacesPeriodicityVector.push_back(*periodicity_i);
else
_preCadEdgesPeriodicityVector.push_back(*periodicity_i);
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_ENTRY1__
if (periodicitySeparator != "__END_ENTRY1__")
throw std::exception();
- MESSAGE("shape1Entry: " <<shape1Entry);
}
if (periodicitySeparator == "__BEGIN_ENTRY2__") { // __BEGIN_ENTRY2__
isOK = static_cast<bool>(load >> periodicitySeparator); // __END_ENTRY2__
if (periodicitySeparator != "__END_ENTRY2__")
throw std::exception();
- MESSAGE("shape2Entry: " <<shape2Entry);
}
if (periodicitySeparator == "__BEGIN_SOURCE_VERTICES_LIST__") { // __BEGIN_SOURCE_VERTICES_LIST__
isOK = static_cast<bool>(load >> periodicitySeparator);
if (periodicitySeparator != "__END_SOURCE_VERTICES_LIST__") {
theSourceVerticesEntries.push_back(periodicitySeparator);
- MESSAGE("theSourceVerticesEntries: " <<periodicitySeparator);
}
}
}
isOK = static_cast<bool>(load >> periodicitySeparator);
if (periodicitySeparator != "__END_TARGET_VERTICES_LIST__") {
theTargetVerticesEntries.push_back(periodicitySeparator);
- MESSAGE("theTargetVerticesEntries: " <<periodicitySeparator);
}
}
}
class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
{
public:
- BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen);
+ BLSURFPlugin_Hypothesis(int hypId, SMESH_Gen * gen, bool hasgeom);
enum Topology {
FromCAD,
GeometricalLocalSize
};
- static const char* GetHypType() { return "MG-CADSurf Parameters"; }
-
+ static const char* GetHypType(bool hasgeom)
+ { return hasgeom ? "MG-CADSurf Parameters" : "MG-CADSurf Parameters_NOGEOM"; }
+
TopoDS_Shape entryToShape(std::string entry);
void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
void SetJacobianRectificationRespectGeometry( bool allowRectification );
bool GetJacobianRectificationRespectGeometry();
+ void SetUseDeprecatedPatchMesher( bool useDeprecatedPatchMesher );
+ bool GetUseDeprecatedPatchMesher();
+
void SetJacobianRectification( bool allowRectification );
bool GetJacobianRectification();
void SetMaxNumberOfPointsPerPatch( int nb ) throw (std::invalid_argument);
int GetMaxNumberOfPointsPerPatch();
+ void SetMaxNumberOfThreads( int nb ) throw (std::invalid_argument);
+ int GetMaxNumberOfThreads();
+
void SetRespectGeometry( bool toRespect );
bool GetRespectGeometry();
void SetTags( const std::string& howToTreat ) throw (std::invalid_argument);
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; }
+ static int GetHyperPatchTag( int faceTag, const BLSURFPlugin_Hypothesis* hyp, int* iPatch=0 );
+
void SetPreCADMergeEdges(bool theVal);
bool GetPreCADMergeEdges() const { return _preCADMergeEdges; }
- void SetPreCADRemoveTinyUVEdges(bool theVal);
- bool GetPreCADRemoveTinyUVEdges() const { return _preCADRemoveTinyUVEdges; }
-
void SetPreCADRemoveDuplicateCADFaces(bool theVal);
bool GetPreCADRemoveDuplicateCADFaces() const { return _preCADRemoveDuplicateCADFaces; }
*/
typedef std::multimap< std::string, BLSURFPlugin_Attractor* > TAttractorMap;
- typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO à finir
+ typedef std::map< std::string, std::vector<double> > TParamsMap; //TODO ?? finir
void SetClassAttractorEntry(const std::string& entry, const std::string& att_entry, double StartSize, double EndSize, double ActionRadius, double ConstantRadius);
std::string GetClassAttractorEntry(const std::string& entry);
static Topology GetDefaultTopology() { return FromCAD; }
// PreCAD
static bool GetDefaultPreCADMergeEdges() { return false; }
- static bool GetDefaultPreCADRemoveTinyUVEdges() { return false; }
static bool GetDefaultPreCADRemoveDuplicateCADFaces() { return false; }
static bool GetDefaultPreCADProcess3DTopology() { return false; }
static bool GetDefaultPreCADDiscardInput() { return false; }
Topology _topology;
bool _preCADMergeEdges;
- bool _preCADRemoveTinyUVEdges;
bool _preCADRemoveDuplicateCADFaces;
bool _preCADProcess3DTopology;
bool _preCADDiscardInput;
TEdgesPeriodicityVector _edgesPeriodicityVector;
TVerticesPeriodicityVector _verticesPeriodicityVector;
+ THyperPatchList _hyperPatchList;
+
// Called by SaveTo to store content of _preCadFacesPeriodicityVector and _preCadEdgesPeriodicityVector
void SavePreCADPeriodicity(std::ostream & save, const char* shapeType);
*/
//=============================================================================
BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
- ::SMESH_Gen* theGenImpl) :
- SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
- MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
- myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theGenImpl);
+ ::SMESH_Gen* theGenImpl,
+ bool theHasGEOM) :
+ SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA)
+{
+ myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(),
+
+ theGenImpl,
+ theHasGEOM);
}
//=============================================================================
* Destructor
*/
//=============================================================================
-BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
- MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
+BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
+{
}
//=============================================================================
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
+void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue)
+{
ASSERT(myBaseImpl);
this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
* Get PhysicalMesh
*/
//=============================================================================
-CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
+CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
+{
ASSERT(myBaseImpl);
return this->GetImpl()->GetPhysicalMesh();
}
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
+void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue)
+{
ASSERT(myBaseImpl);
this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
* Get GeometricMesh
*/
//=============================================================================
-CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
+CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
+{
ASSERT(myBaseImpl);
return this->GetImpl()->GetGeometricMesh();
}
* Set PhySize
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
-// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
+void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue)
+{
ASSERT(myBaseImpl);
this->GetImpl()->SetPhySize(theValue, false);
SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
* Set Relative PhySize
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
-// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
+void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue)
+{
ASSERT(myBaseImpl);
this->GetImpl()->SetPhySize(theValue, true);
SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
* Get PhySize
*/
//=============================================================================
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
-// MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
+{
ASSERT(myBaseImpl);
return this->GetImpl()->GetPhySize();
}
* Returns True if PhySize is relative
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
-// MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel()
+{
ASSERT(myBaseImpl);
return this->GetImpl()->IsPhySizeRel();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
+{
if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
this->GetImpl()->SetMinSize(theMinSize, false);
SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
}
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize)
+{
if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
this->GetImpl()->SetMinSize(theMinSize, true);
SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
}
//=============================================================================
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
- ASSERT(myBaseImpl);
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize()
+{
return this->GetImpl()->GetMinSize();
}
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
-// MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
- ASSERT(myBaseImpl);
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel()
+{
return this->GetImpl()->IsMinSizeRel();
}
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
+{
if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
this->GetImpl()->SetMaxSize(theMaxSize, false);
SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
}
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize)
+{
if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
this->GetImpl()->SetMaxSize(theMaxSize, true);
SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
}
//=============================================================================
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
- ASSERT(myBaseImpl);
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize()
+{
return this->GetImpl()->GetMaxSize();
}
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
-// MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
- ASSERT(myBaseImpl);
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel()
+{
return this->GetImpl()->IsMaxSizeRel();
}
* Set true or false
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue) {
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseGradation");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue)
+{
if ( GetImpl()->GetUseGradation() != bool( theValue ))
{
this->GetImpl()->SetUseGradation(theValue);
* Get true or false
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation() {
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseGradation");
- ASSERT(myBaseImpl);
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation()
+{
return this->GetImpl()->GetUseGradation();
}
* Set Gradation
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue)
+{
this->GetImpl()->SetGradation(theValue);
if ( theValue < 0 )
* Get Gradation
*/
//=============================================================================
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
- ASSERT(myBaseImpl);
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
+{
return this->GetImpl()->GetGradation();
}
* Set true or false
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue) {
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue)
+{
if ( GetImpl()->GetUseVolumeGradation() != bool( theValue ))
{
this->GetImpl()->SetUseVolumeGradation(theValue);
* Get true or false
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation() {
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation");
- ASSERT(myBaseImpl);
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation()
+{
return this->GetImpl()->GetUseVolumeGradation();
}
* Set VolumeGradation
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetVolumeGradation");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue)
+{
this->GetImpl()->SetVolumeGradation(theValue);
if ( theValue < 0 )
SetUseVolumeGradation( false );
* Get VolumeGradation
*/
//=============================================================================
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetVolumeGradation");
- ASSERT(myBaseImpl);
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation()
+{
return this->GetImpl()->GetVolumeGradation();
}
* Set true or false
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue)
+{
this->GetImpl()->SetQuadAllowed(theValue);
std::string theValueStr = theValue ? "True" : "False";
SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
* Get true or false
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
- ASSERT(myBaseImpl);
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed()
+{
return this->GetImpl()->GetQuadAllowed();
}
* Set AngleMesh
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue)
+{
this->GetImpl()->SetAngleMesh(theValue);
SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
}
* Get AngleMesh
*/
//=============================================================================
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
- ASSERT(myBaseImpl);
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh()
+{
return this->GetImpl()->GetAngleMesh();
}
* Set Chordal Error
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue)
+{
this->GetImpl()->SetChordalError(theValue);
SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
}
* Get Chordal Error
*/
//=============================================================================
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
- ASSERT(myBaseImpl);
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError()
+{
return this->GetImpl()->GetChordalError();
}
* Set true or false
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue)
+{
this->GetImpl()->SetAnisotropic(theValue);
std::string theValueStr = theValue ? "True" : "False";
SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
* Get true or false
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
- ASSERT(myBaseImpl);
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic()
+{
return this->GetImpl()->GetAnisotropic();
}
* Set Anisotropic Ratio
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
- ASSERT(myBaseImpl);
+void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue)
+{
this->GetImpl()->SetAnisotropicRatio(theValue);
SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
}
* Get Anisotropic Ratio
*/
//=============================================================================
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
- ASSERT(myBaseImpl);
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio()
+{
return this->GetImpl()->GetAnisotropicRatio();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
ASSERT(myBaseImpl);
this->GetImpl()->SetRemoveTinyEdges(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
ASSERT(myBaseImpl);
return this->GetImpl()->GetRemoveTinyEdges();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
ASSERT(myBaseImpl);
this->GetImpl()->SetTinyEdgeLength(theValue);
SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
*/
//=============================================================================
CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
ASSERT(myBaseImpl);
return this->GetImpl()->GetTinyEdgeLength();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges");
ASSERT(myBaseImpl);
this->GetImpl()->SetOptimiseTinyEdges(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges");
ASSERT(myBaseImpl);
return this->GetImpl()->GetOptimiseTinyEdges();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength");
ASSERT(myBaseImpl);
this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
*/
//=============================================================================
CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength");
ASSERT(myBaseImpl);
return this->GetImpl()->GetTinyEdgeOptimisationLength();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection");
ASSERT(myBaseImpl);
this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection");
ASSERT(myBaseImpl);
return this->GetImpl()->GetCorrectSurfaceIntersection();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost");
ASSERT(myBaseImpl);
this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
*/
//=============================================================================
CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost");
ASSERT(myBaseImpl);
return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
ASSERT(myBaseImpl);
this->GetImpl()->SetBadElementRemoval(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
ASSERT(myBaseImpl);
return this->GetImpl()->GetBadElementRemoval();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
ASSERT(myBaseImpl);
this->GetImpl()->SetBadElementAspectRatio(theValue);
SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
*/
//=============================================================================
CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
ASSERT(myBaseImpl);
return this->GetImpl()->GetBadElementAspectRatio();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
ASSERT(myBaseImpl);
this->GetImpl()->SetOptimizeMesh(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
ASSERT(myBaseImpl);
return this->GetImpl()->GetOptimizeMesh();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
ASSERT(myBaseImpl);
this->GetImpl()->SetQuadraticMesh(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
ASSERT(myBaseImpl);
return this->GetImpl()->GetQuadraticMesh();
}
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
ASSERT(myBaseImpl);
this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
*/
//=============================================================================
CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
ASSERT(myBaseImpl);
return this->GetImpl()->GetTopology();
}
}
//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher )
+{
+ if ( GetUseDeprecatedPatchMesher() != useDeprecatedPatchMesher )
+ {
+ this->GetImpl()->SetUseDeprecatedPatchMesher(useDeprecatedPatchMesher);
+ SMESH::TPythonDump() << _this() << ".SetUseDeprecatedPatchMesher( " << useDeprecatedPatchMesher << " )";
+ }
+}
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseDeprecatedPatchMesher()
+{
+ return this->GetImpl()->GetUseDeprecatedPatchMesher();
+}
+//=============================================================================
+
void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
{
if ( GetMaxNumberOfPointsPerPatch() != nb )
}
//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
+{
+ if ( GetMaxNumberOfThreads() != nb )
+ {
+ try {
+ this->GetImpl()->SetMaxNumberOfThreads(nb);
+
+ } catch (const std::invalid_argument& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ SMESH::TPythonDump() << _this() << ".SetMaxNumberOfThreads( " << nb << " )";
+ }
+}
+//=============================================================================
+CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfThreads()
+{
+ return this->GetImpl()->GetMaxNumberOfThreads();
+}
+//=============================================================================
+
void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
{
if ( GetRespectGeometry() != toRespect )
return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
}
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl)
+{
+ ::BLSURFPlugin_Hypothesis::THyperPatchList patchList( hpl.length() );
+ SMESH_Comment hplDump;
+ hplDump << "[";
+ for ( size_t i = 0; i < patchList.size(); ++i )
+ {
+ hplDump << "[ ";
+ BLSURFPlugin::THyperPatch tags = hpl[ i ];
+ for ( CORBA::ULong j = 0; j < tags.length(); ++j )
+ {
+ patchList[ i ].insert( tags[ j ]);
+ hplDump << tags[ j ] << ( j+1 < tags.length() ? ", " : " ]" );
+ }
+ hplDump << ( i+1 < patchList.size() ? "," : "]");
+ }
+ if ( GetImpl()->GetHyperPatches() != patchList )
+ {
+ GetImpl()->SetHyperPatches( patchList );
+ SMESH::TPythonDump() << _this() << ".SetHyperPatches( " << hplDump << " )";
+ }
+}
+
+//=============================================================================
+BLSURFPlugin::THyperPatchList* BLSURFPlugin_Hypothesis_i::GetHyperPatches()
+{
+ const ::BLSURFPlugin_Hypothesis::THyperPatchList& hpl = GetImpl()->GetHyperPatches();
+ BLSURFPlugin::THyperPatchList* resHpl = new BLSURFPlugin::THyperPatchList();
+ resHpl->length( hpl.size() );
+
+ ::BLSURFPlugin_Hypothesis::THyperPatchList::const_iterator hpIt = hpl.begin();
+ for ( int i = 0; hpIt != hpl.end(); ++hpIt, ++i )
+ {
+ const ::BLSURFPlugin_Hypothesis::THyperPatchTags& hp = *hpIt;
+ BLSURFPlugin::THyperPatch& resHp = (*resHpl)[ i ];
+ resHp.length( hp.size() );
+
+ ::BLSURFPlugin_Hypothesis::THyperPatchTags::const_iterator tag = hp.begin();
+ for ( int j = 0; tag != hp.end(); ++tag, ++j )
+ resHp[ j ] = *tag;
+ }
+ return resHpl;
+}
+
//=============================================================================
/*!
* BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
ASSERT(myBaseImpl);
this->GetImpl()->SetPreCADMergeEdges(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
ASSERT(myBaseImpl);
return this->GetImpl()->GetPreCADMergeEdges();
}
-//=============================================================================
-/*!
- * BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges
- *
- * Set true or false
- */
-//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges");
- ASSERT(myBaseImpl);
- this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue);
- std::string theValueStr = theValue ? "True" : "False";
- SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )";
-}
-
-//=============================================================================
-/*!
- * BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges
- *
- * Get true or false
- */
-//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges");
- ASSERT(myBaseImpl);
- return this->GetImpl()->GetPreCADRemoveTinyUVEdges();
-}
-
//=============================================================================
/*!
* BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
ASSERT(myBaseImpl);
this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
ASSERT(myBaseImpl);
return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
ASSERT(myBaseImpl);
this->GetImpl()->SetPreCADProcess3DTopology(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
ASSERT(myBaseImpl);
return this->GetImpl()->GetPreCADProcess3DTopology();
}
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
ASSERT(myBaseImpl);
this->GetImpl()->SetPreCADDiscardInput(theValue);
std::string theValueStr = theValue ? "True" : "False";
*/
//=============================================================================
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
ASSERT(myBaseImpl);
return this->GetImpl()->GetPreCADDiscardInput();
}
else if ( name == "max_number_of_points_per_patch" )
SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
+ else if ( name == "max_number_of_threads" )
+ SetMaxNumberOfThreads( GetImpl()->ToInt( optionValue ));
+
else if ( name == "rectify_jacobian" )
SetJacobianRectification( GetImpl()->ToBool( optionValue ));
+ else if ( name == "use_deprecated_patch_mesher" )
+ SetUseDeprecatedPatchMesher( GetImpl()->ToBool( optionValue ));
+
else if ( name == "respect_geometry" )
SetRespectGeometry( GetImpl()->ToBool( optionValue ));
else if ( name == "tiny_edge_optimisation_length" )
SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
- else if ( name == "remove_tiny_uv_edges" )
- SetPreCADRemoveTinyUVEdges( GetImpl()->ToBool( optionValue ));
-
else if ( name == "process_3d_topology" )
SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
- throw (SALOME::SALOME_Exception) {
+ throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
for (CORBA::ULong i = 0; i < options.length(); ++i) {
string name_value_type = options[i].in();
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
- throw (SALOME::SALOME_Exception) {
+ throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
for ( CORBA::ULong i = 0; i < options.length(); ++i) {
string name_value_type = options[i].in();
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
- throw (SALOME::SALOME_Exception) {
+ throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
- MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
if ( !entry || !entry[0] )
THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
bool valueChanged = false;
} catch (SALOME_Exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
if (valueChanged)
SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
}
void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
- MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
bool valueChanged = false;
std::ostringstream sizeMapFunction;
switch (shapeType) {
} catch (SALOME_Exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
if (valueChanged)
SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
}
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
- throw (SALOME::SALOME_Exception) {
+ throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
- MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
bool valueChanged = false;
try {
valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
} catch (SALOME_Exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
if (valueChanged)
SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
}
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO à finir
+void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO ?? finir
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
- MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
//bool valueChanged = false;
try {
this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
} catch (SALOME_Exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
//if ( valueChanged )
SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
<< entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
// //=============================================================================
//
-// // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
+// // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
// // A finir pour le dump
// char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
// throw (SALOME::SALOME_Exception)
double startSize, endSize, infDist, constDist;
if ( !atIt->second->Empty() ) {
attEntry = atIt->second->GetAttractorEntry();
- MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
std::vector<double> params = atIt->second->GetParameters();
startSize = params[0];
endSize = params[1];
result[i].endSize = endSize;
result[i].infDist = infDist;
result[i].constDist = constDist;
- MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
- MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
}
return result._retn();
}
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
- throw (SALOME::SALOME_Exception) {
+ throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
string entry_sizemap = sizeMaps[i].in();
ASSERT(myBaseImpl);
string entry;
entry = GeomObj->GetStudyEntry();
- MESSAGE("IDL : GetName : " << GeomObj->GetName());
- MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
SetSizeMapEntry(entry.c_str(), sizeMap);
}
GEOM::shape_type shapeType = GeomObj->GetShapeType();
if (shapeType == GEOM::COMPOUND)
shapeType = GeomObj->GetMaxShapeType();
- MESSAGE("IDL : GetName : " << GeomObj->GetName());
- MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
}
ASSERT(myBaseImpl);
string entry;
entry = GeomObj->GetStudyEntry();
- MESSAGE("IDL : GetName : " << GeomObj->GetName());
- MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
UnsetEntry(entry.c_str());
SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
}
ASSERT(myBaseImpl);
string entry;
entry = GeomObj->GetStudyEntry();
- MESSAGE("IDL : GetName : " << GeomObj->GetName());
- MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
SetAttractorEntry(entry.c_str(), attractor);
}
ASSERT(myBaseImpl);
string entry;
entry = GeomObj->GetStudyEntry();
- MESSAGE("IDL : GetName : " << GeomObj->GetName());
- MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
UnsetEntry(entry.c_str());
SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
}
TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
}
!theAttrEntry.in() || !theAttrEntry.in()[0] )
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
<< theFace << ", " << theAttractor << " )";
/*
- void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
- {}
+ void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
+ {}
- void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
- {}
+ void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
+ {}
- void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
- {}
+ void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception)
+ {}
- char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
- {}
+ char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception)
+ {}
- void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
- {
- ASSERT(myBaseImpl);
- this->GetImpl()->UnsetCustomSizeMap(entry);
- SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
- }
+ void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
+ {
+ ASSERT(myBaseImpl);
+ this->GetImpl()->UnsetCustomSizeMap(entry);
+ SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
+ }
- BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
- {}
+ BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
+ {}
- */
+*/
// ///////////////////////
// // ENFORCED VERTICES //
*
*/
BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
- MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
ASSERT(myBaseImpl);
BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
- this->GetImpl()->_GetAllEnforcedVerticesByFace();
+ this->GetImpl()->_GetAllEnforcedVerticesByFace();
resultMap->length(faceEntryEnfVertexListMap.size());
- MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
- new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
+ new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
- MESSAGE("Face Entry: " << mapElement->faceEntry);
_enfVertexList = it_entry->second;
BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
enfVertexList->length(_enfVertexList.size());
- MESSAGE("Number of enf vertex: " << enfVertexList->length());
::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
msg << "Enforced vertex: \n"
<< "Name: " << enfVertex->name << "\n";
if (coords->length())
- msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
+ msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
msg << "Geom entry: " << enfVertex->geomEntry << "\n"
<< "Group Name: " << enfVertex->grpName;
- MESSAGE(msg.str());
enfVertexList[j] = enfVertex;
}
*
*/
BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
- MESSAGE("IDL: GetAllEnforcedVertices()");
ASSERT(myBaseImpl);
BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
resultMap->length(enfVertexList.size());
- MESSAGE("Enforced Vertex map size is " << resultMap->length());
::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
- MESSAGE("Enforced Vertex #" << i);
currentEnfVertex = (*evlIt);
BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
// Name
msg << "Enforced vertex: \n"
<< "Name: " << enfVertex->name << "\n";
if (coords->length())
- msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
+ msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
msg << "Geom entry: " << enfVertex->geomEntry << "\n"
<< "Group Name: " << enfVertex->grpName;
- MESSAGE(msg.str());
resultMap[i] = enfVertex;
}
*
*/
BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
- MESSAGE("IDL: GetAllCoordsByFace()");
ASSERT(myBaseImpl);
BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
resultMap->length(entryCoordsListMap.size());
- MESSAGE("Enforced Vertex map size is " << resultMap->length());
::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
- MESSAGE("Face Entry: " << mapElement->faceEntry);
_coordsList = it_entry->second;
BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
coordsList->length(_coordsList.size());
- MESSAGE("Number of coords: " << coordsList->length());
::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
for (CORBA::ULong i=0;i<coords->length();i++)
coords[i] = (*it_coords)[i];
coordsList[j] = coords;
- MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
}
mapElement->coordsList = coordsList;
* They are the coords of the "manual" enforced vertices.
*/
BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
- MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
ASSERT(myBaseImpl);
BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
- this->GetImpl()->_GetAllEnforcedVerticesByCoords();
+ this->GetImpl()->_GetAllEnforcedVerticesByCoords();
resultMap->length(coordsEnfVertexMap.size());
- MESSAGE("Enforced Vertex map size is " << resultMap->length());
::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
- MESSAGE("Enforced Vertex #" << i);
currentEnfVertex = (it_coords->second);
BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
for (CORBA::ULong ind=0;ind<coords->length();ind++)
coords[ind] = it_coords->first[ind];
mapElement->coords = coords;
- MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
// Name
msg << "Enforced vertex: \n"
<< "Name: " << enfVertex->name << "\n";
if (coords->length())
- msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
+ msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
msg << "Geom entry: " << enfVertex->geomEntry << "\n"
<< "Group Name: " << enfVertex->grpName;
- MESSAGE(msg.str());
resultMap[i] = mapElement;
}
*
*/
BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
- MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
ASSERT(myBaseImpl);
BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
- this->GetImpl()->_GetAllEnfVertexEntriesByFace();
+ this->GetImpl()->_GetAllEnfVertexEntriesByFace();
resultMap->length(entryEnfVertexEntryListMap.size());
- MESSAGE("Enforced Vertex map size is " << resultMap->length());
::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
entryEnfVertexEntryListMap.begin();
for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
- new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
+ new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
- MESSAGE("Face Entry: " << mapElement->faceEntry);
_enfVertexEntryList = it_entry->second;
BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
enfVertexEntryList->length(_enfVertexEntryList.size());
- MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
- MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
}
mapElement->enfVertexEntryList = enfVertexEntryList;
* They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
*/
BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
- MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
ASSERT(myBaseImpl);
BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
- this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
+ this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
resultMap->length(enfVertexEntryEnfVertexMap.size());
- MESSAGE("Enforced Vertex map size is " << resultMap->length());
::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
- MESSAGE("Enforced Vertex #" << i);
currentEnfVertex = it_enfVertexEntry->second;
BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
- MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
// Name
msg << "Enforced vertex: \n"
<< "Name: " << enfVertex->name << "\n";
if (coords->length())
- msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
+ msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
msg << "Geom entry: " << enfVertex->geomEntry << "\n"
<< "Group Name: " << enfVertex->grpName;
- MESSAGE(msg.str());
mapElement->enfVertex = enfVertex;
resultMap[i] = mapElement;
}
/*!
- * Set/get/unset an enforced vertex on face
+ * Set/get/unset an enforced vertex on face - OBSOLETE
*/
bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
- CORBA::Double z) throw (SALOME::SALOME_Exception) {
+ CORBA::Double z) throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
}
if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
try {
return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
} catch (SALOME_Exception& ex) {
* Set/get/unset an enforced vertex with name on face
*/
bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
- CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
+ CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
try {
return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
} catch (SALOME_Exception& ex) {
* Set/get/unset an enforced vertex with geom object on face
*/
bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
- throw (SALOME::SALOME_Exception) {
+ throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
}
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
string theVertexName = theVertex->GetName();
- MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
- MESSAGE("IDL : theVertex->GetName : " << theVertexName);
- MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
try {
return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
} catch (SALOME_Exception& ex) {
* Set an enforced vertex with group name on face
*/
bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
- throw (SALOME::SALOME_Exception)
+ throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
}
if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
try {
return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
} catch (SALOME_Exception& ex) {
*/
bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z,
const char* theVertexName, const char* theGroupName)
- throw (SALOME::SALOME_Exception)
+ throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
}
if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
try {
return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
} catch (SALOME_Exception& ex) {
* Set an enforced vertex with geom entry and group name on face
*/
bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
- throw (SALOME::SALOME_Exception)
+ throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
}
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
string theVertexName = theVertex->GetName();
- MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
- MESSAGE("IDL : theVertex->GetName : " << theVertexName);
- MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
try {
return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
} catch (SALOME_Exception& ex) {
// ASSERT(myBaseImpl);
// if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
-// MESSAGE("theFace shape type is not FACE or COMPOUND");
// THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
// }
// if (theFaceEntry.empty())
// THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-// MESSAGE("IDL : GetName : " << theFace->GetName());
-// MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
// try {
// return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
// } catch (SALOME_Exception& ex) {
* Get the list of all enforced vertices
*/
BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
- throw (SALOME::SALOME_Exception) {
+ throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
try {
return GetEnforcedVerticesEntry(theFaceEntry.c_str());
} catch (SALOME_Exception& ex) {
}
bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
- CORBA::Double z) throw (SALOME::SALOME_Exception) {
+ CORBA::Double z) throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
}
if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
try {
return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
}
bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
- throw (SALOME::SALOME_Exception) {
+ throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
}
if (theVertexEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
try {
return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
ASSERT(myBaseImpl);
if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
}
if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
try {
return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
}
/*!
- * Set/get/unset an enforced vertex on geom object given by entry
+ * Set/get/unset an enforced vertex on face - NEW (no face)
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex with name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
+{
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, theVertexName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex with geom object on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+ string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ string theVertexName = theVertex->GetName();
+ try {
+ return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with group name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with name and group name on face
*/
-bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
- CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
- throw (SALOME::SALOME_Exception) {
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z,
+ const char* theVertexName, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
ASSERT(myBaseImpl);
- MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
+
+ try {
+ return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set an enforced vertex with geom entry and group name on face
+ */
+bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+
+ string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ string theVertexName = theVertex->GetName();
+ try {
+ return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
+{
+ try {
+ return UnsetEnforcedVertexEntry("", x, y, z);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception)
+{
+ if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
+ THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
+ }
+ std::string theVertexEntry = theVertex->GetStudyEntry();
+
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+
+ if (theVertexEntry.empty()) {
+ if (theVertex->GetShapeType() == GEOM::VERTEX)
+ aName = "Vertex_";
+ if (theVertex->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theVertex->GetEntry();
+ SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
+ if (!theSVertex->_is_nil())
+ theVertexEntry = theSVertex->GetID();
+ }
+ if (theVertexEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ try {
+ return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
+{
+ try {
+ return UnsetEnforcedVerticesEntry("");
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+/*!
+ * Set/get/unset an enforced vertex on geom object given by entry
+ */
+bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
+ CORBA::Double x,
+ CORBA::Double y,
+ CORBA::Double z,
+ const char* theVertexName,
+ const char* theVertexEntry,
+ const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
bool newValue = false;
if (string(theVertexEntry).empty()) {
try {
coords.push_back(y);
coords.push_back(z);
if (coordsList.find(coords) == coordsList.end()) {
- MESSAGE("Coords not found: add it in coordsList");
newValue = true;
} else {
- MESSAGE("Coords already found, compare names");
::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
- MESSAGE("The names are different: update");
- // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
newValue = true;
}
- else {
- MESSAGE("The names are identical");
- }
}
} catch (const std::invalid_argument& ex) {
// no enforced vertex for entry
- MESSAGE("Face entry not found : add it to the list");
newValue = true;
}
if (newValue) {
if (string(theVertexName).empty()) {
if (string(theGroupName).empty())
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
else
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
}
else {
if (string(theGroupName).empty())
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
else
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
<< theVertexName << "\", \"" << theGroupName << "\")";
}
}
::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
if ( it == enfVertexEntryList.end()) {
- MESSAGE("Geom entry not found: add it in enfVertexEntryList");
newValue = true;
}
else {
- MESSAGE("Geom entry already found, compare names");
::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
- MESSAGE("The names are different: update");
-// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
newValue = true;
}
- else {
- MESSAGE("The names are identical");
- }
}
} catch (const std::invalid_argument& ex) {
// no enforced vertex for entry
- MESSAGE("Face entry not found : add it to the list");
newValue = true;
}
if (newValue) {
if (string(theGroupName).empty())
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
else
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
+ SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
}
}
if (newValue)
this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
- MESSAGE("IDL : SetEnforcedVertexEntry END");
return newValue;
}
-//Enable internal enforced vertices on specific face if requested by user
-//CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
-// throw (SALOME::SALOME_Exception) {
-// ASSERT(myBaseImpl);
-// try {
-// return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
-// } catch (const std::exception& ex) {
-// std::cout << "Exception: " << ex.what() << std::endl;
-// THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
-// }
-//}
-
BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
- throw (SALOME::SALOME_Exception) {
- ASSERT(myBaseImpl);
- MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
-
+ throw (SALOME::SALOME_Exception)
+{
try {
BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
vertexList->length(_vList.size());
- MESSAGE("Number of enforced vertices: " << vertexList->length());
::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
vertexList[i] = enfVertex;
}
- MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
return vertexList._retn();
} catch (const std::invalid_argument& ex) {
SALOME::ExceptionStruct ExDescription;
}
}
-bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
- CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
+bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
+{
ASSERT(myBaseImpl);
- MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
bool res = false;
try {
res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
if (string(theVertexEntry).empty())
- SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
- << ")";
+ SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
+ << ")";
else
- SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
+ SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
} catch (const std::invalid_argument& ex) {
return false;
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
return res;
}
-
-//bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
-// CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
-// MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
-//
-// bool ret = false;
-//
-// try {
-// ret = _unsetEnfVertex(theFaceEntry, x, y, z);
-// } catch (SALOME_Exception& ex) {
-// THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
-// }
-//
-// if (ret)
-// SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
-// << ")";
-//
-// MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
-// return ret;
-//}
-
-bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
+bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
+{
ASSERT(myBaseImpl);
- MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
try {
this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
- SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
+ SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
} catch (const std::invalid_argument& ex) {
return false;
} catch (const std::exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
return true;
}
* Set true or false
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
+{
ASSERT(myBaseImpl);
this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
std::string theValueStr = theValue ? "True" : "False";
* Get true or false
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
+{
ASSERT(myBaseImpl);
return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
}
* Set group name
*/
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName)
+{
ASSERT(myBaseImpl);
this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
* Get group name
*/
//=============================================================================
-char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
+char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
+{
ASSERT(myBaseImpl);
return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
}
/*
* Enable internal enforced vertices on specific face if requested by user
*
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
+ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
throw (SALOME::SALOME_Exception)
-{
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
- try {
- SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
- } catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
+ {
+ try {
+ SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ }
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
+ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
throw (SALOME::SALOME_Exception)
-{
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
-
- if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
- MESSAGE("theFace shape type is not FACE or COMPOUND");
- THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
- }
-
- string theFaceEntry = theFace->GetStudyEntry();
-
- if (theFaceEntry.empty()) {
- GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- string aName;
- if (theFace->GetShapeType() == GEOM::FACE)
- aName = "Face_";
- if (theFace->GetShapeType() == GEOM::COMPOUND)
- aName = "Compound_";
- aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
- if (!theSFace->_is_nil())
- theFaceEntry = theSFace->GetID();
- }
- if (theFaceEntry.empty())
- THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-
- MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
- try {
- SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
- } catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
+ {
-void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
- throw (SALOME::SALOME_Exception)
-{
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
- ASSERT(myBaseImpl);
- try {
- this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
- std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
- if (string(theGroupName).empty())
- SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
- else
- SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
- } catch (const std::exception& ex) {
- std::cout << "Exception: " << ex.what() << std::endl;
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
- }
-}
+ if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
+ THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
+ }
-*/
+ string theFaceEntry = theFace->GetStudyEntry();
+
+ if (theFaceEntry.empty()) {
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+ if (theFace->GetShapeType() == GEOM::FACE)
+ aName = "Face_";
+ if (theFace->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theFace->GetEntry();
+ SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
+ if (!theSFace->_is_nil())
+ theFaceEntry = theSFace->GetID();
+ }
+ if (theFaceEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
-/* TODO GROUPS
- char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
- throw (SALOME::SALOME_Exception)
- {
- ASSERT(myBaseImpl);
- MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
try {
- return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
- ExDescription.lineNumber = 1146;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
+ SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
+ } catch (SALOME_Exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
- MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
- return 0;
}
-
- void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
+ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
- MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
try {
- this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
- ExDescription.lineNumber = 1170;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
+ this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
+ std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
+ if (string(theGroupName).empty())
+ SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
+ else
+ SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
+ } catch (const std::exception& ex) {
+ std::cout << "Exception: " << ex.what() << std::endl;
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
+ }
- SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
- << x << ", " << y << ", " << z << ", '" << groupName << "' )";
+*/
- MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
- }
- */
+/* TODO GROUPS
+ char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception)
+ {
+ ASSERT(myBaseImpl);
+ try {
+ return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
+ ExDescription.lineNumber = 1146;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ return 0;
+ }
+
+
+ void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
+ throw (SALOME::SALOME_Exception)
+ {
+ ASSERT(myBaseImpl);
+ try {
+ this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
+ ExDescription.lineNumber = 1170;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+
+ SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
+ << x << ", " << y << ", " << z << ", '" << groupName << "' )";
+
+ }
+*/
///////////////////////
///////////////////////
std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
{
-//enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
bool ok = false;
std::stringstream typesTxt;
for (std::size_t i=0; i<theShapeTypes.size(); i++)
- {
- GEOM::shape_type theShapeType = theShapeTypes[i];
- if (shape->GetShapeType() == theShapeType)
- ok = true;
- typesTxt << ShapeTypeToString(theShapeType);
- if (i < theShapeTypes.size()-1 )
- typesTxt << ", ";
- }
+ {
+ GEOM::shape_type theShapeType = theShapeTypes[i];
+ if (shape->GetShapeType() == theShapeType)
+ ok = true;
+ typesTxt << ShapeTypeToString(theShapeType);
+ if (i < theShapeTypes.size()-1 )
+ typesTxt << ", ";
+ }
if (!ok){
std::stringstream msg;
- msg << "shape shape type is not in" << typesTxt.str();
- MESSAGE(msg.str());
+ msg << "shape type is not in" << typesTxt.str();
THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
}
}
if (shape->GetShapeType() != theShapeType) {
std::stringstream msg;
msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
- MESSAGE(msg.str());
THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
}
}
std::stringstream listEntriesTxt;
if (!theSourceVerticesEntries.empty())
+ {
+ listEntriesTxt << ", [" ;
+ size_t i =0;
+ for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
{
- listEntriesTxt << ", [" ;
- size_t i =0;
- for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
- {
- if (i>0)
- listEntriesTxt << ", ";
- listEntriesTxt << *it;
- }
+ if (i>0)
+ listEntriesTxt << ", ";
+ listEntriesTxt << *it;
+ }
- listEntriesTxt << "], [" ;
- i =0;
- for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
- {
- if (i>0)
- listEntriesTxt << ", ";
- listEntriesTxt << *it;
- }
- listEntriesTxt << "]" ;
+ listEntriesTxt << "], [" ;
+ i =0;
+ for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
+ {
+ if (i>0)
+ listEntriesTxt << ", ";
+ listEntriesTxt << *it;
}
+ listEntriesTxt << "]" ;
+ }
return listEntriesTxt.str();
}
BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
{
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
- this->GetImpl()->_GetPreCadFacesPeriodicityVector();
+ this->GetImpl()->_GetPreCadFacesPeriodicityVector();
BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
return periodicityList._retn();
}
BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
{
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
- this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
+ this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
return periodicityList._retn();
}
// convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
{
- MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
- periodicityList->length(preCadPeriodicityVector.size());
+ periodicityList->length(preCadPeriodicityVector.size());
- for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
- {
- ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
+ for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
+ {
+ ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
- BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
- myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
- myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
+ BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
+ myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
+ myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
- BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
- if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
- {
- sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
- for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
- sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
- }
+ BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
+ if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
+ {
+ sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
+ for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
+ sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
+ }
- myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
+ myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
- BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
- if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
- {
- targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
- for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
- targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
- }
+ BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
+ if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
+ {
+ targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
+ for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
+ targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
+ }
- myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
+ myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
- periodicityList[i] = myPreCadPeriodicity;
- }
+ periodicityList[i] = myPreCadPeriodicity;
+ }
return periodicityList._retn();
void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
-throw (SALOME::SALOME_Exception)
+ throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
const GEOM::ListOfGO theSourceVertices;
void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
- const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
-throw (SALOME::SALOME_Exception)
+ const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
+ throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
- MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
size_t theLength = theSourceVertices.length();
if (theLength != theTargetVertices.length())
GEOM::GEOM_Object_ptr theVtx_i;
string theEntry_i;
for (size_t ind = 0; ind < theLength; ind++) {
- theVtx_i = theSourceVertices[ind];
- theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
- theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
+ theVtx_i = theSourceVertices[ind];
+ theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
+ theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
}
string prefix4 = "Target_vertex_";
BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
theTargetVerticesEntries->length(theLength);
for (size_t ind = 0; ind < theLength; ind++) {
- theVtx_i = theTargetVertices[ind];
- theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
- theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
+ theVtx_i = theTargetVertices[ind];
+ theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
+ theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
}
string theFace2Name = theFace2->GetName();
- MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
- MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
- MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
try {
- AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
- theSourceVerticesEntries, theTargetVerticesEntries);
+ AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
+ theSourceVerticesEntries, theTargetVerticesEntries);
} catch (SALOME_Exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
- const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
- throw (SALOME::SALOME_Exception)
+ const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
+ throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
// Convert BLSURFPlugin::TEntryList to vector<string>
vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
- theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
- theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
+ theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
+ theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
}
string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
- MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
- theSourceVerticesEntries, theTargetVerticesEntries);
+ theSourceVerticesEntries, theTargetVerticesEntries);
SMESH::TPythonDump pd;
if (!theSourceVerticesEntries.empty())
- {
- pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
- pd << listEntriesTxt.c_str();
- pd << ")";
- }
+ {
+ pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
+ pd << listEntriesTxt.c_str();
+ pd << ")";
+ }
else
pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
- MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
}
void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
- throw (SALOME::SALOME_Exception)
+ throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
const GEOM::ListOfGO theSourceVertices;
}
void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
- const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
- throw (SALOME::SALOME_Exception)
+ const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
+ throw (SALOME::SALOME_Exception)
{
- MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
ASSERT(myBaseImpl);
size_t theLength = theSourceVertices.length();
GEOM::GEOM_Object_ptr theVtx_i;
string theEntry_i;
for (size_t ind = 0; ind < theLength; ind++) {
- theVtx_i = theSourceVertices[ind];
- theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
- theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
+ theVtx_i = theSourceVertices[ind];
+ theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
+ theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
}
string prefix4 = "Target_vertex_";
BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
theTargetVerticesEntries->length(theLength);
for (size_t ind = 0; ind < theLength; ind++) {
- theVtx_i = theTargetVertices[ind];
- theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
- theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
+ theVtx_i = theTargetVertices[ind];
+ theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
+ theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
}
string theEdge2Name = theEdge2->GetName();
- MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
- MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
- MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
try {
- AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
- theSourceVerticesEntries, theTargetVerticesEntries);
+ AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
+ theSourceVerticesEntries, theTargetVerticesEntries);
} catch (SALOME_Exception& ex) {
THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
}
void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
- const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
- throw (SALOME::SALOME_Exception)
+ const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
+ throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
// Convert BLSURFPlugin::TEntryList to vector<string>
vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
- theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
- theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
+ theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
+ theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
}
string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
- MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
- theSourceVerticesEntries, theTargetVerticesEntries);
+ theSourceVerticesEntries, theTargetVerticesEntries);
SMESH::TPythonDump pd;
if (!theSourceVerticesEntries.empty())
- {
- pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
- pd << listEntriesTxt.c_str();
- pd << ")";
- }
+ {
+ pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
+ pd << listEntriesTxt.c_str();
+ pd << ")";
+ }
else
pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
- MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
}
// void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
ASSERT(myBaseImpl);
- MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
bool valueChanged/*, modeChanged*/ = false;
try {
valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
-// modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
+ // modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
if (valueChanged)// or (!valueChanged && modeChanged))
this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
} catch (const std::exception& ex) {
}
if (valueChanged)// or (!valueChanged && modeChanged))
SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
- MESSAGE("IDL : SetGMFFile END ");
}
//================================================================================
//================================================================================
char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
ASSERT(myBaseImpl);
-// MESSAGE("IDL : GetGMFFile()");
return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
}
// //================================================================================
// CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
// ASSERT(myBaseImpl);
-// MESSAGE("IDL : GetGMFFileMode()");
// return this->GetImpl()->GetGMFFileMode();
// }
*/
//=============================================================================
::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
- // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
}
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
std::string theValueStr = this->GetOptionValue("respect_geometry");
if (theValueStr.empty() || theValueStr == "respect")
- return true;
+ return true;
return false;
}
void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
if (theValueStr == "1")
- return true;
+ return true;
return false;
}
void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
// BLSURFPlugin parameters hypothesis
-class BLSURFPlugin_Hypothesis_i: public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis,
- public virtual SMESH_Hypothesis_i {
+class BLSURFPlugin_Hypothesis_i:
+ public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis,
+ public virtual SMESH_Hypothesis_i
+{
public:
// Constructor
- BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, ::SMESH_Gen* theGenImpl);
+ BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
+ ::SMESH_Gen* theGenImpl,
+ bool theHasGEOM);
// Destructor
virtual ~BLSURFPlugin_Hypothesis_i();
void SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification );
CORBA::Boolean GetJacobianRectificationRespectGeometry();
+ void SetUseDeprecatedPatchMesher( CORBA::Boolean useDeprecatedPatchMesher );
+ CORBA::Boolean GetUseDeprecatedPatchMesher();
+
void SetJacobianRectification( CORBA::Boolean allowRectification );
CORBA::Boolean GetJacobianRectification();
void SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception);
CORBA::Long GetMaxNumberOfPointsPerPatch();
+ void SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception);
+ CORBA::Long GetMaxNumberOfThreads();
+
void SetRespectGeometry( CORBA::Boolean toRespect );
CORBA::Boolean GetRespectGeometry();
void SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception);
char* GetTags();
+ void SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl);
+ BLSURFPlugin::THyperPatchList* GetHyperPatches();
+
void SetPreCADMergeEdges(CORBA::Boolean theValue);
CORBA::Boolean GetPreCADMergeEdges();
- void SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue);
- CORBA::Boolean GetPreCADRemoveTinyUVEdges();
-
void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue);
CORBA::Boolean GetPreCADRemoveDuplicateCADFaces();
/*!
* Set/get/unset an enforced vertex on geom object
*/
+ // OBSOLETE
bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
throw (SALOME::SALOME_Exception);
bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
throw (SALOME::SALOME_Exception);
bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
+ // NEW - no face
+ bool AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
+ throw (SALOME::SALOME_Exception);
+ bool AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
+ throw (SALOME::SALOME_Exception);
+
+ bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception);
+ bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
+ throw (SALOME::SALOME_Exception);
+ bool RemoveEnforcedVertices() throw (SALOME::SALOME_Exception);
+
/*!
* Set/get/unset an enforced vertex on geom object given by entry
*/
#include "BLSURFPlugin_BLSURF_i.hxx"
#include "BLSURFPlugin_Hypothesis_i.hxx"
-template <class T> class BLSURFPlugin_Creator_i:public HypothesisCreator_i<T>
+template <class T, bool NOGEOM>
+class BLSURFPlugin_Creator_i : public GenericHypothesisCreator_i
{
+ // Create a hypothesis
+ virtual SMESH_Hypothesis_i* Create(PortableServer::POA_ptr thePOA,
+ ::SMESH_Gen* theGenImpl)
+ {
+ return new T (thePOA, theGenImpl, !NOGEOM);
+ }
+
// as we have 'module BLSURFPlugin' in BLSURFPlugin_Algorithm.idl
virtual std::string GetModuleName() { return "BLSURFPlugin"; }
};
BLSURFPLUGIN_EXPORT
GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
{
- MESSAGE("GetHypothesisCreator " << aHypName);
-
GenericHypothesisCreator_i* aCreator = 0;
// Algorithms
if (strcmp(aHypName, "BLSURF") == 0 ||
strcmp(aHypName, "MG-CADSurf") == 0 )
- aCreator = new BLSURFPlugin_Creator_i<BLSURFPlugin_BLSURF_i>;
+ aCreator = new BLSURFPlugin_Creator_i<BLSURFPlugin_BLSURF_i,false>;
+ else if (strcmp(aHypName, "MG-CADSurf_NOGEOM") == 0 )
+ aCreator = new BLSURFPlugin_Creator_i<BLSURFPlugin_BLSURF_i,true>;
// Hypotheses
else if (strcmp(aHypName, "BLSURF_Parameters") == 0 ||
strcmp(aHypName, "MG-CADSurf Parameters") == 0 )
- aCreator = new BLSURFPlugin_Creator_i<BLSURFPlugin_Hypothesis_i>;
- else ;
+ aCreator = new BLSURFPlugin_Creator_i<BLSURFPlugin_Hypothesis_i,false>;
+ else if (strcmp(aHypName, "MG-CADSurf Parameters_NOGEOM") == 0 )
+ aCreator = new BLSURFPlugin_Creator_i<BLSURFPlugin_Hypothesis_i,true>;
return aCreator;
}
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType )
{
SMESHGUI_GenericHypothesisCreator* aCreator = NULL;
- if( aHypType=="BLSURF_Parameters" ||
- aHypType=="MG-CADSurf Parameters")
+ if ( aHypType == "BLSURF_Parameters" ||
+ aHypType == "MG-CADSurf Parameters" ||
+ aHypType == "MG-CADSurf Parameters_NOGEOM")
aCreator = new BLSURFPluginGUI_HypothesisCreator( aHypType );
return aCreator;
}
void BLSURFPluginGUI_AdvWidget::onChooseGMFFile()
{
QString fileName = QFileDialog::getSaveFileName(0, tr("BLSURF_GMF_FILE_DIALOG"), myGMFFileName->text(), tr("BLSURF_GMF_FILE_FORMAT"));
- std::cout << "fileName: " << fileName.toStdString() << std::endl;
- if (!fileName.endsWith(".mesh") && !fileName.endsWith(".meshb"))
- fileName.append(".mesh");
- myGMFFileName->setText(fileName);
+ if ( !fileName.isEmpty() ) {
+ if (!fileName.endsWith(".mesh") && !fileName.endsWith(".meshb"))
+ fileName.append(".mesh");
+ myGMFFileName->setText(fileName);
+ }
}
void BLSURFPluginGUI_AdvWidget::AddOption( int iTable, const char* option )
if ( !option )
{
myOptionTable->scrollToItem( row );
+ myOptionTable->setCurrentItem( row );
myOptionTable->editItem( row, NAME_COL );
}
}
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="3">
- <widget class="QTreeWidget" name="myOptionTable">
+ <widget class="BLSURFPluginGUI_TreeWidget" name="myOptionTable">
<property name="editTriggers">
- <set>QAbstractItemView::DoubleClicked</set>
+ <set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
+ </property>
+ <property name="tabKeyNavigation">
+ <bool>true</bool>
</property>
<column>
<property name="text">
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>BLSURFPluginGUI_TreeWidget</class>
+ <extends>QTreeWidget</extends>
+ <header location="global">BLSURFPluginGUI_TreeWidget.h</header>
+ </customwidget>
+ </customwidgets>
<tabstops>
<tabstop>addBtn</tabstop>
<tabstop>myVerbosity</tabstop>
//
#include "BLSURFPluginGUI_HypothesisCreator.h"
#include "BLSURFPluginGUI_Dlg.h"
+#include "BLSURFPlugin_Hypothesis.hxx"
-#include "GeometryGUI.h"
+#include <GeometryGUI.h>
-#include <SMESHGUI_Utils.h>
-#include <SMESHGUI_HypothesesUtils.h>
#include <SMESHGUI_Dialog.h>
-#include "SMESHGUI_SpinBox.h"
-#include "SMESH_NumberFilter.hxx"
+#include <SMESHGUI_HypothesesUtils.h>
+#include <SMESHGUI_IdValidator.h>
+#include <SMESHGUI_SpinBox.h>
+#include <SMESHGUI_Utils.h>
+#include <SMESH_Gen_i.hxx>
+#include <SMESH_NumberFilter.hxx>
+#include <StdMeshersGUI_SubShapeSelectorWdg.h>
-#include <SUIT_Session.h>
+#include <LightApp_SelectionMgr.h>
+#include <SALOME_ListIO.hxx>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+#include <SalomeApp_Application.h>
#include <SalomeApp_Tools.h>
#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
#include <QFrame>
-#include <QHBoxLayout>
-#include <QHeaderView>
#include <QGridLayout>
#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
+#include <QModelIndexList>
#include <QObject>
#include <QPushButton>
#include <QRadioButton>
#include <QSpinBox>
-#include <QTableWidget>
-#include <QTabWidget>
-#include <QVBoxLayout>
#include <QSplitter>
-
-#include <QStandardItemModel>
#include <QStandardItem>
+#include <QStandardItemModel>
+#include <QTabWidget>
+#include <QTableWidget>
#include <QTreeWidget>
#include <QTreeWidgetItem>
-#include <QModelIndexList>
-
-#include <LightApp_SelectionMgr.h>
-#include <SalomeApp_Application.h>
-#include <SALOME_ListIO.hxx>
-#include "SALOME_LifeCycleCORBA.hxx"
+#include <QVBoxLayout>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Iterator.hxx>
-#include <SMESH_Gen_i.hxx>
-#include <boost/shared_ptr.hpp>
-#include <boost/algorithm/string.hpp>
-#include <structmember.h>
-#include <stdexcept>
-#include <algorithm>
+
+#include <structmember.h> // Python
using namespace std;
SMP_TAB,
ENF_TAB,
PERIODICITY_TAB,
+ HYPERPATCH_TAB,
SMP_NAME_COLUMN =0,
SMP_SIZEMAP_COLUMN,
SMP_ENTRY_COLUMN,
// Enforced vertices inputs
enum {
ENF_VER_FACE = 0,
- ENF_VER_VERTEX,
+ ENF_VER_VERTEX = 0,
ENF_VER_X_COORD,
ENF_VER_Y_COORD,
ENF_VER_Z_COORD,
BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType )
: SMESHGUI_GenericHypothesisCreator( theHypType )
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator");
this->mySMPMap.clear();
GeomToolSelected = NULL;
bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::checkParams");
bool ok = true;
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
{
QString entry = mySizeMapTable->topLevelItem( row )->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
QString sizeMap = mySizeMapTable->topLevelItem( row )->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
- MESSAGE("entry ="<<entry.toStdString())
if ( !sizeMap.isEmpty() ) {
if (that->sizeMapValidationFromRow(row))
{
try {
- MESSAGE("entry ="<<entry.toStdString())
- MESSAGE("sizeMap ="<<sizeMap.toStdString())
-
e = entry.toStdString();
s = that->mySMPMap[entry].toStdString();
- MESSAGE("row = "<<row)
- MESSAGE("e = "<<e)
- MESSAGE("s = "<<s)
h->SetSizeMapEntry( e.c_str(), s.c_str() );
}
catch ( const SALOME::SALOME_Exception& ex )
QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::buildFrame");
-
QFrame* fr = new QFrame( 0 );
- // fr-> setMinimumSize(600,400);
QVBoxLayout* lay = new QVBoxLayout( fr );
- // lay->setSizeConstraint(QLayout::SetDefaultConstraint);
lay->setMargin( 5 );
lay->setSpacing( 0 );
if( isCreation() )
myName = new QLineEdit( myStdGroup );
myStdWidget = new BLSURFPluginGUI_StdWidget(myStdGroup);
+ if ( !hasGeom() ) {
+ myStdWidget->myPhysicalMesh->removeItem( PhysicalLocalSize );
+ }
int row = 0;
if( isCreation() ) {
}
aStdLayout->addWidget( myStdWidget, row++, 0, 1, 4 );
- //int maxrow = row;
row = 0;
if( isCreation() )
row = 1;
-// row = max(row,maxrow)+1;
aStdLayout->setRowStretch(row,1);
aStdLayout->setColumnStretch(1,1);
- //maxrow = row;
// advanced parameters
anAdvLayout->setSpacing( 6 );
anAdvLayout->setMargin( 11 );
myAdvWidget = new BLSURFPluginGUI_AdvWidget(myAdvGroup);
- //myAdvWidget->addBtn->setMenu( new QMenu() );
anAdvLayout->addWidget( myAdvWidget );
// Size Maps parameters
- mySmpGroup = new QWidget();
-// mySmpGroup->setMinimumWidth(500);
+ mySmpGroup = new QWidget( dlg() );
//Layout
QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
smpTab->setCurrentIndex( SMP_STD_TAB );
// Enforced vertices parameters
- myEnfGroup = new QWidget();
+ myEnfGroup = new QWidget( dlg() );
QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
-//
-// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced(myEnfGroup);
-// anEnfLayout->addWidget(myEnforcedVertexWidget);
-// MESSAGE("Creating DlgBlSurfHyp_Enforced widget instance");
-// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced();
myEnforcedTreeWidget = new QTreeWidget(myEnfGroup);
myEnforcedTreeWidget->setColumnCount( ENF_VER_NB_COLUMNS );
myEnforcedTreeWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
myEnforcedTreeWidget->setItemDelegate(new EnforcedTreeWidgetDelegate());
-// FACE AND VERTEX SELECTION
+ // FACE AND VERTEX SELECTION
TColStd_MapOfInteger shapeTypes1, shapeTypes2;
shapeTypes1.Add( TopAbs_FACE );
shapeTypes1.Add( TopAbs_COMPOUND );
shapeTypes2.Add( TopAbs_VERTEX );
shapeTypes2.Add( TopAbs_COMPOUND );
- SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
- myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
- myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }");
+ // SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1);
+ // myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true);
+ // myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }");
SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes2);
myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
myEnfVertexWdg->SetDefaultText(tr("BLS_SEL_VERTICES"), "QLineEdit { color: grey }");
- myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
+ //myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg);
QLabel* myXCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_X_LABEL" ), myEnfGroup );
myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
QLabel* myInternalEnforcedVerticesAllFacesGroupLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
myInternalEnforcedVerticesAllFacesGroup = new QLineEdit(myEnfGroup);
-// myGlobalGroupName = new QCheckBox(tr("BLSURF_ENF_VER_GROUPS"), myEnfGroup);
-// myGlobalGroupName->setChecked(false);
-
anEnfLayout->addWidget(myEnforcedTreeWidget, 0, 0, ENF_VER_NB_LINES, 1);
QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup);
// FACE AND VERTEX SELECTION
- anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2);
+ //anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2);
anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2);
anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1);
anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1);
anEnfLayout2->addWidget(myZCoord, ENF_VER_Z_COORD, 1, 1, 1);
anEnfLayout2->addWidget(myGroupNameLabel, ENF_VER_GROUP, 0, 1, 1);
anEnfLayout2->addWidget(myGroupName, ENF_VER_GROUP, 1, 1, 1);
-// anEnfLayout2->addWidget(myGlobalGroupName, ENF_VER_GROUP_CHECK, 0, 1, 2);
-// anEnfLayout2->setRowStretch( ENF_VER_SPACE, 1);
anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFaces, ENF_VER_INTERNAL_ALL_FACES, 0, 1, 2);
anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroupLabel, ENF_VER_INTERNAL_ALL_FACES_GROUP, 0, 1, 1);
anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroup, ENF_VER_INTERNAL_ALL_FACES_GROUP, 1, 1, 1);
anEnfLayout2->setRowStretch(ENF_VER_NB_LINES+1, 1);
-// anEnfLayout2->addWidget(makeGroupsCheck, ENF_VER_GROUP_CHECK, 0, 1, 2);
anEnfLayout->addLayout(anEnfLayout2, 0,1,ENF_VER_NB_LINES+1,2);
-// anEnfLayout->setRowStretch(1, 1);
// ---
// Periodicity parameters
- myPeriodicityGroup = new QWidget();
+ myPeriodicityGroup = new QWidget( dlg() );
aPeriodicityLayout1 = new QGridLayout(myPeriodicityGroup);
myPeriodicitySplitter = new QSplitter(myPeriodicityGroup);
myPeriodicitySelectionWidgets.append(myPeriodicityP3TargetWdg);
avoidSimultaneousSelection(myPeriodicitySelectionWidgets);
+ // HyperPatch parameters
+
+ QWidget* hpGroup = new QWidget();
+ QGridLayout* hpLayout = new QGridLayout(hpGroup);
+
+ myHyPatchTable = new QTableWidget( hpGroup );
+ myHyPatchTable->setColumnCount(1);
+ myHyPatchTable->setHorizontalHeaderLabels( QStringList() << tr("BLSURF_HYPATCH_TBL_HEADER") );
+ myHyPatchTable->setAlternatingRowColors(true);
+ myHyPatchTable->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
+
+
+ QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ myHyPatchFaceSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_FACE"), hpGroup );
+ myHyPatchGroupSelBtn = new QPushButton( iconSelect, tr("BLSURF_HYPATCH_SEL_GROUP"), hpGroup );
+ myHyPatchFaceSelBtn->setCheckable( true );
+ myHyPatchGroupSelBtn->setCheckable( true );
+
+ myHyPatchFaceSelector = new StdMeshersGUI_SubShapeSelectorWdg( hpGroup, TopAbs_FACE, /*toShowList=*/false );
+
+ QLabel* hpTagsLbl = new QLabel( tr("BLSURF_TAGS"), hpGroup );
+ myHyPatchTagsLE = new QLineEdit( hpGroup );
+ myHyPatchTagsLE->setValidator( new SMESHGUI_IdValidator( hpGroup ));
+
+ QPushButton* hpAddBtn = new QPushButton( tr("BLSURF_SM_ADD"), hpGroup );
+ QPushButton* hpRemBtn = new QPushButton( tr("BLSURF_SM_REMOVE"), hpGroup );
+
+ hpLayout->addWidget( myHyPatchTable, 0, 0, 5, 1 );
+ hpLayout->addWidget( myHyPatchFaceSelBtn, 0, 1, 1, 2 );
+ hpLayout->addWidget( myHyPatchGroupSelBtn, 0, 3, 1, 2 );
+ hpLayout->addWidget( hpTagsLbl, 1, 1, 1, 1 );
+ hpLayout->addWidget( myHyPatchTagsLE, 1, 2, 1, 3 );
+ hpLayout->addWidget( hpAddBtn, 2, 1, 1, 2 );
+ hpLayout->addWidget( hpRemBtn, 2, 3, 1, 2 );
+ hpLayout->addWidget( myHyPatchFaceSelector, 3, 1, 1, 4 );
+
+
+
// ---
myTabWidget->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
myTabWidget->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) );
- myTabWidget->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) );
- myTabWidget->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
- myTabWidget->insertTab( PERIODICITY_TAB, myPeriodicityGroup, tr( "BLSURF_PERIODICITY" ) );
-
+ if ( hasGeom() ) {
+ myTabWidget->insertTab( SMP_TAB, mySmpGroup, tr( "LOCAL_SIZE" ) );
+ myTabWidget->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
+ myTabWidget->insertTab( PERIODICITY_TAB, myPeriodicityGroup, tr( "BLSURF_PERIODICITY" ) );
+ myTabWidget->insertTab( HYPERPATCH_TAB, hpGroup, tr( "BLSURF_HYPERPATCH_TAB" ));
+ }
+ else
+ {
+ mySmpGroup->hide();
+ myEnfGroup->hide();
+ myPeriodicityGroup->hide();
+ hpGroup->hide();
+ }
myTabWidget->setCurrentIndex( STD_TAB );
connect( myAdvWidget->addBtn, SIGNAL( clicked() ), this, SLOT( onAddOption() ) );
connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) );
connect( removeMapButton, SIGNAL( clicked()), this, SLOT( onRemoveMap() ) );
connect( modifyMapButton, SIGNAL( clicked()), this, SLOT( onModifyMap() ) );
-// connect( mySizeMapTable, SIGNAL( cellChanged ( int, int )), this, SLOT( onSetSizeMap(int,int ) ) );
connect( mySizeMapTable, SIGNAL( itemClicked (QTreeWidgetItem *, int)),this, SLOT( onSmpItemClicked(QTreeWidgetItem *, int) ) );
connect( myGeomSelWdg2, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
connect( myGeomSelWdg1, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
connect( myAttSelWdg, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
-// connect( myAttractorGroup, SIGNAL( clicked(bool) ), this, SLOT( onAttractorGroupClicked(bool) ) );
connect( mySizeMapTable, SIGNAL( itemChanged (QTreeWidgetItem *, int)),this, SLOT( onSetSizeMap(QTreeWidgetItem *, int) ) );
connect( myAttractorCheck, SIGNAL( stateChanged ( int )), this, SLOT( onAttractorClicked( int ) ) );
connect( myConstSizeCheck, SIGNAL( stateChanged ( int )), this, SLOT( onConstSizeClicked( int ) ) );
// Enforced vertices
connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this, SLOT( synchronizeCoords() ) );
connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( updateEnforcedVertexValues(QTreeWidgetItem *, int) ) );
-// connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( update(QTreeWidgetItem *, int) ) );
connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertices() ) );
connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
connect( myInternalEnforcedVerticesAllFaces, SIGNAL( stateChanged ( int )), this, SLOT( onInternalVerticesClicked( int ) ) );
-// connect( myEnfVertexWdg, SIGNAL( selectionActivated()), this, SLOT( onVertexSelectionActivated() ) );
-// connect( myEnfFaceWdg, SIGNAL( selectionActivated()), this, SLOT( onFaceSelectionActivated() ) );
// Periodicity
connect( myPeriodicityAddButton, SIGNAL( clicked()), this, SLOT( onAddPeriodicity() ) );
ListOfWidgets::const_iterator anIt = myPeriodicitySelectionWidgets.begin();
for (; anIt != myPeriodicitySelectionWidgets.end(); anIt++)
- {
- StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
- connect( w1, SIGNAL(contentModified ()), this, SLOT(onPeriodicityContentModified()));
+ {
+ StdMeshersGUI_ObjectReferenceParamWdg * w1 = ( StdMeshersGUI_ObjectReferenceParamWdg* ) ( *anIt );
+ connect( w1, SIGNAL(contentModified ()), this, SLOT(onPeriodicityContentModified()));
+
+ }
+
+ // HyperPatch
+ connect( myHyPatchFaceSelBtn, SIGNAL( toggled(bool) ), SLOT( onHyPatchFaceSelection(bool) ));
+ connect( myHyPatchGroupSelBtn, SIGNAL( toggled(bool) ), SLOT( onHyPatchGroupSelection(bool) ));
+ connect( myHyPatchFaceSelector, SIGNAL( shapeSelected() ), SLOT( onHyPatchSelectionChanged()));
+ connect( hpAddBtn, SIGNAL( clicked() ), SLOT( onHyPatchAdd()));
+ connect( hpRemBtn, SIGNAL( clicked() ), SLOT( onHyPatchRemove()));
- }
-// connect( myPeriodicitySourceFaceWdg, SIGNAL(contentModified()), this, SLOT(onPeriodicityContentModified()));
return fr;
}
/** BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget*, QWidget*)
-This method stop the selection of the widgets StdMeshersGUI_ObjectReferenceParamWdg
+ This method stop the selection of the widgets StdMeshersGUI_ObjectReferenceParamWdg
*/
// void BLSURFPluginGUI_HypothesisCreator::deactivateSelection(QWidget* old, QWidget* now)
// {
myXCoord->setText("");
myYCoord->setText("");
myZCoord->setText("");
-// myGroupName->setText("");
+ // myGroupName->setText("");
}
/** BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(item, column)
-This method updates the tooltip of a modified item. The QLineEdit widgets content
-is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
+ This method updates the tooltip of a modified item. The QLineEdit widgets content
+ is synchronized with the coordinates of the enforced vertex clicked in the tree widget.
*/
void BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTreeWidgetItem* item, int column) {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues");
QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole);
QVariant x = item->data(ENF_VER_X_COLUMN, Qt::EditRole);
QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
}
/** BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(entry, shapeName, x, y, z)
-This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
+ This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
*/
-void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(QTreeWidgetItem* theItem, double x, double y, double z,
- std::string vertexName, std::string geomEntry, std::string groupName) {
-
- std::string theFaceName = theItem->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
-// MESSAGE("theItemName is " << theItem->text(ENF_VER_NAME_COLUMN).toStdString());
+void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z,
+ std::string vertexName,
+ std::string geomEntry,
+ std::string groupName)
+{
bool okToCreate = true;
- const int nbVert = theItem->childCount();
-// MESSAGE("Number of child rows: " << nbVert);
- if (nbVert >0) {
- double childValueX,childValueY,childValueZ;
- QString childEntry, childGroupName;
- QTreeWidgetItem* child;
- for (int row = 0;row<nbVert;row++) {
- child = theItem->child(row);
- childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString();
- childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString();
- childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
- childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
- childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
- if (((childValueX == x) && (childValueY == y) && (childValueZ == z)) || ( (childEntry.toStdString() != "") && (childEntry.toStdString() == geomEntry))) {
- // update group name
- if (childGroupName.toStdString() != groupName) {
- MESSAGE("Group is updated from \"" << childGroupName.toStdString() << "\" to \"" << groupName << "\"");
- child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
- }
- okToCreate = false;
- break;
- } // if
- } // for
- } // if
+ const int nbVert = myEnforcedTreeWidget->topLevelItemCount();
+ for (int row = 0; row < nbVert; row++ )
+ {
+ QTreeWidgetItem* child = myEnforcedTreeWidget->topLevelItem( row );
+ QString childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString();
+ QString childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString();
+ double childX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
+ double childY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
+ double childZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
+ if (((childEntry.isEmpty()) && (childX == x) && (childY == y) && (childZ == z)) ||
+ ( !childEntry.isEmpty() && childEntry == geomEntry.c_str() ))
+ {
+ // update group name
+ if ( childGroupName != groupName.c_str() ) {
+ child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
+ }
+ okToCreate = false;
+ break;
+ } // if
+ } // for
if (!okToCreate) {
- if (geomEntry.empty()) {
- MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
- }
- else {
- MESSAGE("In " << theFaceName << " vertex with entry " << geomEntry << " already exist: dont create again");
- }
return;
}
-
- if (geomEntry.empty()) {
- MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z<< " is created");
- }
- else {
- MESSAGE("In " << theFaceName << " vertex with geom entry " << geomEntry << " is created");
- }
- QTreeWidgetItem *vertexItem = new QTreeWidgetItem( theItem);
+ QTreeWidgetItem *vertexItem = new QTreeWidgetItem( myEnforcedTreeWidget );
vertexItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
QSize iconSize = iconSelect.size()*0.7;
-
- int vertexIndex=myEnforcedTreeWidget->indexOfTopLevelItem(theItem);
+
+ int vertexIndex=nbVert;
QString myVertexName;
int indexRef = -1;
while(indexRef != vertexIndex) {
myVertexName = QString(vertexName.c_str());
for (int row = 0;row<nbVert;row++) {
- QString name = theItem->child(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString();
+ QString name = myEnforcedTreeWidget->topLevelItem(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString();
if (myVertexName == name) {
vertexIndex++;
break;
if (groupName != "")
vertexItem->setData( ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
- QString toolTip = QString(theFaceName.c_str())+QString(": ")+myVertexName;
+ QString toolTip = myVertexName;
if (geomEntry.empty()) {
- toolTip += QString(" (%1, ").arg(x);
- toolTip += QString("%1, ").arg(y);
- toolTip += QString("%1)").arg(z);
+ toolTip += QString(" (%1, %2, %3").arg(x).arg(y).arg(z);
}
if (groupName != "")
toolTip += QString(" [%1]").arg(groupName.c_str());
vertexItem->setToolTip(ENF_VER_NAME_COLUMN,toolTip);
- theItem->setExpanded(true);
myEnforcedTreeWidget->setCurrentItem(vertexItem,ENF_VER_NAME_COLUMN);
}
/** BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
This method is called when a item is added into the enforced vertices tree widget
*/
-void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices");
-
+void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
+{
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
getGeomSelectionTool()->selectionMgr()->clearFilters();
- myEnfFaceWdg->deactivateSelection();
myEnfVertexWdg->deactivateSelection();
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
myEnforcedTreeWidget->resizeColumnToContents(column);
// Vertex selection
- int selEnfFace = myEnfFaceWdg->NbObjects();
int selEnfVertex = myEnfVertexWdg->NbObjects();
bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty());
- if (selEnfFace == 0)
- return;
-
if ((selEnfVertex == 0) && coordsEmpty)
return;
string entry, shapeName;
-
- for (int i = 0 ; i < selEnfFace ; i++) {
- myEnfFace = myEnfFaceWdg->GetObject< GEOM::GEOM_Object >(i);
- entry = myEnfFace->GetStudyEntry();
- shapeName = myEnfFace->GetName();
-
- QTreeWidgetItem * faceItem = addEnforcedFace(entry, shapeName);
-
- std::string groupName = myGroupName->text().toStdString();
-
- if (boost::trim_copy(groupName).empty())
- groupName = "";
+ {
+ std::string groupName = myGroupName->text().simplified().toStdString();
if (selEnfVertex <= 1)
{
z = myZCoord->GetValue();
if (selEnfVertex == 1) {
myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
- addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
}
else
- addEnforcedVertex(faceItem, x, y, z, "", "", groupName);
+ addEnforcedVertex(x, y, z, "", "", groupName);
}
else
{
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
measureOp->PointCoordinates (myEnfVertex, x, y, z);
if ( measureOp->IsDone() )
- addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
} else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
- addEnforcedVertex(faceItem, 0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
}
}
}
}
- myEnfFaceWdg->SetObject(GEOM::GEOM_Object::_nil());
myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil());
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
This method is called when a item is removed from the enforced vertices tree widget
*/
void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex");
QList<QTreeWidgetItem *> selectedItems = myEnforcedTreeWidget->selectedItems();
QList<QTreeWidgetItem *> selectedVertices;
QSet<QTreeWidgetItem *> selectedEntries;
foreach(item,selectedVertices) {
QTreeWidgetItem* parent = item->parent();
-// MESSAGE("From geometry "<< parent->text(ENF_VER_NAME_COLUMN).toStdString()<<" remove " << item->text(ENF_VER_NAME_COLUMN).toStdString());
- parent->removeChild(item);
+ if ( parent )
+ parent->removeChild(item);
delete item;
- if (parent->childCount() == 0) {
+ if ( parent && parent->childCount() == 0) {
if (selectedEntries.contains(parent))
selectedEntries.remove(parent);
delete parent;
}
foreach(item,selectedEntries) {
-// MESSAGE("Remove " << item->text(ENF_VER_NAME_COLUMN).toStdString());
delete item;
}
This method is called when a item is added into the periodicity table widget
*/
void BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
This method is called when a item is removed from the periodicity tree widget
*/
void BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity() {
-// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex");
QList<QTreeWidgetItem *> selectedItems = myPeriodicityTreeWidget->selectedItems();
QTreeWidgetItem* item;
foreach(item,selectedItems) {
- MESSAGE("Remove " << item->text(0).toStdString());
delete item;
}
//{
// if (myPeriodicityOnFaceRadioButton->isChecked())
// {
-// MESSAGE("Show Face");
// myPeriodicitySourceEdgeWdg->hide();
// myPeriodicityTargetEdgeWdg->hide();
// myPeriodicitySourceFaceWdg->show();
// }
// else
// {
-// MESSAGE("Show Edge");
// myPeriodicitySourceFaceWdg->hide();
// myPeriodicityTargetFaceWdg->hide();
// myPeriodicitySourceEdgeWdg->show();
*/
void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::retrieveParams");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
BlsurfHypothesisData data;
// myGMFFileMode->setChecked(data.myGMFFileMode);
// Sizemaps
- MESSAGE("retrieveParams():that->mySMPMap.size() = " << that->mySMPMap.size());
QMapIterator<QString, QString> i(that->mySMPMap);
GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
while (i.hasNext()) {
else
{
item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant( sizeMap ) );
- }
+ }
}
mySizeMapTable->resizeColumnToContents( SMP_ENTRY_COLUMN );
mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
// Enforced vertices
- MESSAGE("retrieveParams(): data.entryCoordsListMap.size() = " << data.faceEntryEnfVertexListMap.size());
TFaceEntryEnfVertexListMap::const_iterator evmIt = data.faceEntryEnfVertexListMap.begin();
for ( ; evmIt != data.faceEntryEnfVertexListMap.end() ; ++evmIt) {
TEntry entry = (*evmIt).first;
std::string shapeName = myGeomToolSelected->getNameFromEntry(entry);
- MESSAGE("Face entry: " << entry);
- MESSAGE("Face name: " << shapeName);
-
- QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
+
+ //QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName);
TEnfVertexList evs = (*evmIt).second;
TEnfVertex *enfVertex;
for ( ; evsIt != evs.end() ; ++evsIt) {
enfVertex = (*evsIt);
- MESSAGE("Name: " << enfVertex->name);
double x = 0, y = 0, z = 0;
if (enfVertex->coords.size()) {
x = enfVertex->coords[0];
y = enfVertex->coords[1];
z = enfVertex->coords[2];
}
- that->addEnforcedVertex(faceItem, x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
+ that->addEnforcedVertex(x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
}
}
-
+
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
myEnforcedTreeWidget->resizeColumnToContents(column);
myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces);
// Periodicity
- MESSAGE("retrieveParams(): periodicity ");
-
// Add an item in the tree widget for each association
for (size_t i=0 ; i<data.preCadPeriodicityVector.size() ; i++)
+ {
+ QTreeWidgetItem* item = new QTreeWidgetItem();
+ myPeriodicityTreeWidget->addTopLevelItem(item);
+ item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
+ TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
+ for (size_t k=0; k<periodicity_i.size(); k++)
{
- QTreeWidgetItem* item = new QTreeWidgetItem();
- myPeriodicityTreeWidget->addTopLevelItem(item);
- item->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
- TPreCadPeriodicity periodicity_i = data.preCadPeriodicityVector[i];
- for (size_t k=0; k<periodicity_i.size(); k++)
- {
- string shapeEntry = periodicity_i[k];
- string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
- item->setData(k, Qt::EditRole, shapeName.c_str() );
- item->setData(k, Qt::UserRole, shapeEntry.c_str() );
- }
+ string shapeEntry = periodicity_i[k];
+ string shapeName = myGeomToolSelected->getNameFromEntry(shapeEntry);
+ item->setData(k, Qt::EditRole, shapeName.c_str() );
+ item->setData(k, Qt::UserRole, shapeEntry.c_str() );
}
+ }
+
+ // Hyper patches
+ for ( int i = 0; i < data.hyperpatches.size(); ++i )
+ that->addHyPatchToTable( data.hyperpatches[i] );
// update widgets
that->myStdWidget->onPhysicalMeshChanged();
*/
QString BLSURFPluginGUI_HypothesisCreator::storeParams() const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParams");
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
BlsurfHypothesisData data;
*/
bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() );
// classic size maps
BLSURFPlugin::string_array_var mySizeMaps = h->GetSizeMapEntries();
-// MESSAGE("mySizeMaps->length() = " << mySizeMaps->length());
QString fullSizeMaps;
QStringList fullSizeMapList;
GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
for ( CORBA::ULong i = 0;i<mySizeMaps->length(); ++i ) {
fullSizeMaps = mySizeMaps[i].in();
-// MESSAGE("fullSizeMaps: " << fullSizeMaps.toStdString());
fullSizeMapList = fullSizeMaps.split( "|", QString::KeepEmptyParts );
if ( fullSizeMapList.count() > 1 ) {
string fullSizeMap = fullSizeMapList[1].toStdString();
int pos = fullSizeMap.find("return")+7;
-// MESSAGE("pos:" << pos);
QString sizeMap;
try {
sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
continue;
}
that->mySMPMap[fullSizeMapList[0]] = sizeMap;
-// MESSAGE("mySMPMap[" << fullSizeMapList[0].toStdString() << "] = " << sizeMap.toStdString());
that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShapeType(fullSizeMapList[0].toStdString());
-// MESSAGE("mySMPShapeTypeMap[" << fullSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullSizeMapList[0]]);
}
}
// custom size maps
/*
BLSURFPlugin::string_array_var myCustomSizeMaps = h->GetCustomSizeMapEntries();
- MESSAGE("myCustomSizeMaps->length() = " << myCustomSizeMaps->length());
for ( int i = 0;i<myCustomSizeMaps->length(); ++i ) {
QString fullCustomSizeMaps = myCustomSizeMaps[i].in();
if ( fullCustomSizeMapList.count() > 1 ) {
that->mySMPMap[fullCustomSizeMapList[0]] = fullCustomSizeMapList[1];
that->mySMPShapeTypeMap[fullCustomSizeMapList[0]] = GeomToolSelected->entryToShapeType(fullCustomSizeMapList[0].toStdString());
- MESSAGE("mySMPMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << fullCustomSizeMapList[1].toStdString());
- MESSAGE("mySMPShapeTypeMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullCustomSizeMapList[0]]);
}
}
*/
// attractor
BLSURFPlugin::string_array_var allMyAttractors = h->GetAttractorEntries();
-// MESSAGE("myAttractors->length() = " << allMyAttractors->length());
for ( CORBA::ULong i = 0;i<allMyAttractors->length(); ++i ) {
QString myAttractors = allMyAttractors[i].in();
if ( myAttractorList.count() > 1 ) {
that->mySMPMap[myAttractorList[0]] = myAttractorList[1];
that->mySMPShapeTypeMap[myAttractorList[0]] = myGeomToolSelected->entryToShapeType(myAttractorList[0].toStdString());
-// MESSAGE("mySMPMap[" << myAttractorList[0].toStdString() << "] = " << myAttractorList[1].toStdString());
-// MESSAGE("mySMPShapeTypeMap[" << myAttractorList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[myAttractorList[0]]);
}
}
// attractor new version
- MESSAGE("readParamsFromHypo, Attractors")
BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams();
for ( CORBA::ULong i = 0;i<allMyAttractorParams->length(); ++i ) {
BLSURFPlugin::TAttractorParams myAttractorParams = allMyAttractorParams[i];
QString faceEntry = myAttractorParams.faceEntry.in();
QString attEntry = myAttractorParams.attEntry.in();
- MESSAGE("attEntry = "<<attEntry.toStdString())
that->mySMPMap[faceEntry] = QString::number( myAttractorParams.startSize, 'g', 6 ); // TODO utiliser les préférences ici (cf. sketcher)
that->mySMPShapeTypeMap[faceEntry] = myGeomToolSelected->entryToShapeType(faceEntry.toStdString());
that->myATTMap[faceEntry].push_back( TAttractor( myAttractorParams.attEntry.in(),
*/
BLSURFPlugin::TFaceEntryEnfVertexListMap_var faceEntryEnfVertexListMap = h->GetAllEnforcedVerticesByFace();
- MESSAGE("faceEntryEnfVertexListMap->length() = " << faceEntryEnfVertexListMap->length());
- for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i ) {
- std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in();
-// BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList.in();
+ for ( CORBA::ULong i = 0;i<faceEntryEnfVertexListMap->length(); ++i )
+ {
+ std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in();
BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList;
-// BLSURFPlugin::TEnfVertexList_var vertexList = h->GetEnforcedVerticesEntry(entry.c_str());
-
-// TEnfVertexList& enfVertexList = h_data.faceEntryEnfVertexListMap[entry];
- for (CORBA::ULong j=0 ; j<vertexList.length(); ++j) {
+ for (CORBA::ULong j=0 ; j<vertexList.length(); ++j)
+ {
TEnfVertex *enfVertex = new TEnfVertex();
-
- enfVertex->name = CORBA::string_dup(vertexList[j].name.in());
- enfVertex->geomEntry = CORBA::string_dup(vertexList[j].geomEntry.in());
- enfVertex->grpName = CORBA::string_dup(vertexList[j].grpName.in());
+ enfVertex->name = vertexList[j].name.in();
+ enfVertex->geomEntry = vertexList[j].geomEntry.in();
+ enfVertex->grpName = vertexList[j].grpName.in();
for (CORBA::ULong k=0 ; k< vertexList[j].coords.length();k++)
enfVertex->coords.push_back(vertexList[j].coords[k]);
h_data.myInternalEnforcedVerticesAllFacesGroup = h->GetInternalEnforcedVertexAllFacesGroup();
// Periodicity
- MESSAGE("readParamsFromHypo, Periodicity")
h_data.preCadPeriodicityVector.clear();
BLSURFPlugin::TPeriodicityList_var preCadEdgePeriodicityVector = h->GetPreCadEdgesPeriodicityVector();
AddPreCadSequenceToVector(h_data, preCadEdgePeriodicityVector, false);
+
+ // Hyper Patches
+
+ h_data.hyperpatches.clear();
+ BLSURFPlugin::THyperPatchList_var patchList = h->GetHyperPatches();
+ for ( CORBA::ULong i = 0; i < patchList->length(); ++i )
+ {
+ QString tags;
+ BLSURFPlugin::THyperPatch& patch = patchList[i];
+ for ( CORBA::ULong j = 0; j < patch.length(); ++j )
+ tags += QString::number( patch[j] ) + " ";
+ if ( !tags.isEmpty() )
+ h_data.hyperpatches.append( tags );
+ }
+
return true;
}
*/
bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() );
h->SetOptimizeMesh( h_data.myOptimizeMesh );
if ( h->GetQuadraticMesh() != h_data.myQuadraticMesh )
- h->SetQuadraticMesh( h_data.myQuadraticMesh );
+ h->SetQuadraticMesh( h_data.myQuadraticMesh );
if ( h->GetVerbosity() != h_data.myVerbosity )
h->SetVerbosity( h_data.myVerbosity );
// options are set in checkParams()
//h->SetOptionValues( myOptions ); // is set in readParamsFromWidgets()
//h->SetPreCADOptionValues( myPreCADOptions ); // is set in readParamsFromWidgets()
-
+
if ( h->GetGMFFile() != h_data.myGMFFileName )
-// || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
-// h->SetGMFFile( h_data.myGMFFileName.c_str(), h_data.myGMFFileMode );
+ // || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
+ // h->SetGMFFile( h_data.myGMFFileName.c_str(), h_data.myGMFFileMode );
h->SetGMFFile( h_data.myGMFFileName.c_str());
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
const QString sizeMap = i.value();
if (sizeMap == "__TO_DELETE__") {
- MESSAGE("Delete entry " << entry.toStdString() << " from engine");
h->UnsetEntry(entry.toLatin1().constData());
}
else if (sizeMap.startsWith("ATTRACTOR")) {
-// MESSAGE("SetAttractorEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString());
h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData());
}
else if (sizeMap.startsWith("def")) {
-// MESSAGE("SetCustomSizeMapEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString());
-// h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
+ // h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() );
}
else {
if (!myATTMap[entry].empty()){
fullSizeMap = QString("def f(t): return ") + sizeMap;
else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX)
fullSizeMap = QString("def f(): return ") + sizeMap;
- MESSAGE("SetSizeMapEntry("<<entry.toStdString()<<") = " <<fullSizeMap.toStdString());
h->SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() );
}
}
double x, y, z = 0;
std::string enfName;
/* TODO GROUPS
- std::string groupName = "";
+ std::string groupName = "";
*/
TFaceEntryEnfVertexListMap::const_iterator evmIt = h_data.faceEntryEnfVertexListMap.begin();
// 1. Clear all enforced vertices in hypothesis
// 2. Add new enforced vertex according to h_data
-
+
if ( h->GetAllEnforcedVertices()->length() > 0 )
h->ClearAllEnforcedVertices();
TEnfName faceEntry;
{
faceEntry = evmIt->first;
evs = evmIt->second;
- MESSAGE("Number of enforced vertices for face entry " << faceEntry << ": " << evs.size());
evsIt = evs.begin();
for ( ; evsIt != evs.end() ; ++evsIt)
{
// Periodicity
if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 || h->GetPreCadEdgesPeriodicityVector()->length() > 0 )
- h->ClearPreCadPeriodicityVectors();
+ h->ClearPreCadPeriodicityVectors();
- MESSAGE("h_data.preCadPeriodicityVector.size(): " << h_data.preCadPeriodicityVector.size());
TPreCadPeriodicityVector::const_iterator pIt = h_data.preCadPeriodicityVector.begin();
for ( ; pIt != h_data.preCadPeriodicityVector.end() ; ++pIt)
+ {
+ TPreCadPeriodicity periodicity_i = *pIt;
+ TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
+ TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
+ TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
+ TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
+ TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
+ TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
+ TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
+ TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
+ bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
+
+ BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
+ if (! p1Source.empty())
{
- TPreCadPeriodicity periodicity_i = *pIt;
- TEntry source = periodicity_i[PERIODICITY_OBJ_SOURCE_COLUMN];
- TEntry target = periodicity_i[PERIODICITY_OBJ_TARGET_COLUMN];
- TEntry p1Source = periodicity_i[PERIODICITY_P1_SOURCE_COLUMN];
- TEntry p2Source = periodicity_i[PERIODICITY_P2_SOURCE_COLUMN];
- TEntry p3Source = periodicity_i[PERIODICITY_P3_SOURCE_COLUMN];
- TEntry p1Target = periodicity_i[PERIODICITY_P1_TARGET_COLUMN];
- TEntry p2Target = periodicity_i[PERIODICITY_P2_TARGET_COLUMN];
- TEntry p3Target = periodicity_i[PERIODICITY_P3_TARGET_COLUMN];
- bool onFace = (periodicity_i[PERIODICITY_SHAPE_TYPE]=="1") ? true : false;
-
- BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
- if (! p1Source.empty())
- {
- sourceVertices->length(3);
- sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
- sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
- sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
- }
-
+ sourceVertices->length(3);
+ sourceVertices[0]=CORBA::string_dup(p1Source.c_str());
+ sourceVertices[1]=CORBA::string_dup(p2Source.c_str());
+ sourceVertices[2]=CORBA::string_dup(p3Source.c_str());
+ }
- BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
- if (! p1Target.empty())
- {
- targetVertices->length(3);
- targetVertices[0]=CORBA::string_dup(p1Target.c_str());
- targetVertices[1]=CORBA::string_dup(p2Target.c_str());
- targetVertices[2]=CORBA::string_dup(p3Target.c_str());
- }
- if (onFace)
- h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
- else
- h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+ BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
+ if (! p1Target.empty())
+ {
+ targetVertices->length(3);
+ targetVertices[0]=CORBA::string_dup(p1Target.c_str());
+ targetVertices[1]=CORBA::string_dup(p2Target.c_str());
+ targetVertices[2]=CORBA::string_dup(p3Target.c_str());
}
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end periodicity");
+ if (onFace)
+ h->AddPreCadFacesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+ else
+ h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices);
+ }
+
+ // Hyper-patches
+ BLSURFPlugin::THyperPatchList_var hpl = new BLSURFPlugin::THyperPatchList();
+ hpl->length( h_data.hyperpatches.size() );
+
+ for ( int i = 0; i < h_data.hyperpatches.size(); ++i )
+ {
+ QStringList tags = h_data.hyperpatches[i].split(" ", QString::SkipEmptyParts);
+ BLSURFPlugin::THyperPatch& patch = hpl[ i ];
+ patch.length( tags.size() );
+
+ for ( int j = 0; j < tags.size(); ++j )
+ patch[ j ] = tags[ j ].toDouble();
+ }
+ h->SetHyperPatches( hpl );
} // try
- catch(const std::exception& ex) {
- std::cout << "Exception: " << ex.what() << std::endl;
- throw ex;
- }
-// catch(const SALOME::SALOME_Exception& ex)
-// {
-// throw ex;
-// // SalomeApp_Tools::QtCatchCorbaException(ex);
-// // ok = false;
-// }
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end");
+ catch(...) {
+ ok = false;
+ }
+
return ok;
}
/** BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets(h_data)
-Stores the widgets content to the hypothesis data.
+ Stores the widgets content to the hypothesis data.
*/
QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets");
h_data.myName = myName ? myName->text() : "";
h_data.myPhysicalMesh = myStdWidget->myPhysicalMesh->currentIndex();
h_data.myGeometricMesh = myStdWidget->myGeometricMesh->currentIndex();
int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
for ( ; row < nbRows; ++row )
{
- QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
- if ( that->mySMPMap.contains(entry) )
- guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
+ QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString();
+ if ( that->mySMPMap.contains(entry) )
+ guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); ";
}
// Enforced vertices
h_data.faceEntryEnfVertexListMap.clear();
int nbEnforcedShapes = myEnforcedTreeWidget->topLevelItemCount();
- int nbEnforcedVertices = 0;
- std::string groupName = "";
-// MESSAGE("Nb of enforced shapes: " << nbEnforcedShapes);
- for (int i=0 ; i<nbEnforcedShapes ; i++) {
- QTreeWidgetItem* shapeItem = myEnforcedTreeWidget->topLevelItem(i);
- if (shapeItem) {
- std::string faceEntry = shapeItem->data(ENF_VER_FACE_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
- nbEnforcedVertices = shapeItem->childCount();
- if (nbEnforcedVertices >0) {
- double childValueX,childValueY,childValueZ;
- std::string childName, vertexEntry;
- QTreeWidgetItem* child;
- TEnfVertexList evs;
- evs.clear();
- for (row = 0;row<nbEnforcedVertices;row++) {
- child = shapeItem->child(row);
- childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
- childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
- childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
- childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
- vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
-// if (myGlobalGroupName->isChecked())
-// groupName = myGlobalGroupName->text().toStdString();
-// else
- groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
-
- TEnfVertex *enfVertex = new TEnfVertex();
- enfVertex->name = childName;
- if (vertexEntry.empty()) {
- enfVertex->coords.push_back(childValueX);
- enfVertex->coords.push_back(childValueY);
- enfVertex->coords.push_back(childValueZ);
- }
- else
- enfVertex->geomEntry = vertexEntry;
- enfVertex->grpName = groupName;
-// TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex);
-// if (it == h_data.enfVertexList.end())
- h_data.enfVertexList.insert(enfVertex);
- evs.insert(enfVertex);
- /* TODO GROUPS
- if (groupName != "")
- h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
- */
- }
- h_data.faceEntryEnfVertexListMap[faceEntry] = evs;
- }
+ std::string groupName = "", faceEntry = "";
+ for (int i=0 ; i<nbEnforcedShapes ; i++)
+ {
+ double childValueX,childValueY,childValueZ;
+ std::string childName, vertexEntry;
+ QTreeWidgetItem* child;
+
+ child = myEnforcedTreeWidget->topLevelItem(i);
+ childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString();
+ childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
+ childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
+ childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
+ vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString();
+ // if (myGlobalGroupName->isChecked())
+ // groupName = myGlobalGroupName->text().toStdString();
+ // else
+ groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
+
+ TEnfVertex *enfVertex = new TEnfVertex();
+ enfVertex->name = childName;
+ if (vertexEntry.empty()) {
+ enfVertex->coords.push_back(childValueX);
+ enfVertex->coords.push_back(childValueY);
+ enfVertex->coords.push_back(childValueZ);
}
+ else
+ enfVertex->geomEntry = vertexEntry;
+ enfVertex->grpName = groupName;
+ // TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex);
+ // if (it == h_data.enfVertexList.end())
+ h_data.enfVertexList.insert(enfVertex);
+ /* TODO GROUPS
+ if (groupName != "")
+ h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
+ */
+ h_data.faceEntryEnfVertexListMap[faceEntry].insert( enfVertex );
}
h_data.myInternalEnforcedVerticesAllFaces = myInternalEnforcedVerticesAllFaces->isChecked();
if (item) {
for (int k=0; k<myPeriodicityTreeWidget->columnCount(); ++k)
{
- MESSAGE(k);
std::string entry = item->data(k, Qt::UserRole).toString().toStdString();
- MESSAGE(entry);
periodicity_i.push_back(entry);
}
h_data.preCadPeriodicityVector.push_back(periodicity_i);
guiHyp += "PERIODICITY = yes; ";
}
- MESSAGE("guiHyp : " << guiHyp.toLatin1().data());
+ // Hyper-patches
+ h_data.hyperpatches.clear();
+ for ( int row = 0; row < myHyPatchTable->rowCount(); ++row )
+ h_data.hyperpatches.append( myHyPatchTable->item( row, 0 )->text() );
+
return guiHyp;
}
void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item, int col)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked("<<col<<")")
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
if (col == SMP_SIZEMAP_COLUMN) {
QString entry = item->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
myGeomSelWdg1 ->deactivateSelection();
myGeomSelWdg2 ->deactivateSelection();
myAttSelWdg ->deactivateSelection();
- myEnfFaceWdg ->deactivateSelection();
myEnfVertexWdg ->deactivateSelection();
myPeriodicitySourceFaceWdg->deactivateSelection();
myPeriodicityTargetFaceWdg->deactivateSelection();
myPeriodicityP1TargetWdg ->deactivateSelection();
myPeriodicityP2TargetWdg ->deactivateSelection();
myPeriodicityP3TargetWdg ->deactivateSelection();
+ if ( myHyPatchFaceSelBtn->isChecked() )
+ myHyPatchFaceSelBtn->toggle();
+ if ( myHyPatchGroupSelBtn->isChecked() )
+ myHyPatchGroupSelBtn->toggle();
return;
}
else if ( sender() == smpTab )
void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveMap()");
QList<int> selectedRows;
QList<QTreeWidgetItem*> selected = mySizeMapTable->selectedItems();
QTreeWidgetItem* item;
void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int col)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< col << ")");
- MESSAGE("mySMPMap.size() = "<<mySMPMap.size());
if (col == SMP_SIZEMAP_COLUMN) {
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
QString entry = item->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString();
QString sizeMap = item->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString();
- MESSAGE("entry: " << entry.toStdString() << ", sizeMap: " << sizeMap.toStdString());
if (! that->mySMPShapeTypeMap.contains(entry))
- MESSAGE("no such entry in mySMPShapeTypeMap")
return;
if (that->mySMPMap.contains(entry))
if (that->mySMPMap[entry] == sizeMap
sizeMapValidationFromEntry(entry);
}
else {
- MESSAGE("Size map empty: reverse to precedent value" );
item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(that->mySMPMap[entry]) );
}
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
void BLSURFPluginGUI_HypothesisCreator::onModifyMap()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onModifyMap()");
bool res = false;
if ( smpTab->currentIndex() == ATT_TAB ){
if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){
bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject, bool modify)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertElement()");
// BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
// BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
TopAbs_ShapeEnum shapeType;
string entry, shapeName;
entry = (string) anObject->GetStudyEntry();
- MESSAGE("entry = "<<entry);
shapeName = anObject->GetName();
shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject ).ShapeType();
// Group management : the type of entities in the group is stored in the SMPShapeTypeMap
else{
if (that->mySMPMap.contains(shapeEntry)) {
if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
- // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
return false;
}
}
bool BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool modify)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()");
BLSURFPlugin::BLSURFPlugin_Hypothesis_var h =
BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis());
else{
// if (that->mySMPMap.contains(shapeEntry)) {
// if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
- // // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")");
// return false;
// }
// }
myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize );
myStdWidget->onPhysicalMeshChanged();
}
- MESSAGE("mySMPMap.size() = "<<mySMPMap.size());
return true;
}
bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation()");
int row = 0, nbRows = mySizeMapTable->topLevelItemCount();
for ( ; row < nbRows; ++row )
if (! sizeMapValidationFromRow(row))
bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(), row = "<<myRow);
QString myEntry = mySizeMapTable->topLevelItem( myRow )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString();
bool res = sizeMapValidationFromEntry(myEntry,displayError);
mySizeMapTable->setFocus();
bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEntry, bool displayError)
{
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry()");
- MESSAGE("myEntry = "<<myEntry.toStdString())
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
if (! that->mySMPMap.contains(myEntry)) {
-// MESSAGE("Geometry with entry "<<myEntry.toStdString()<<" was not found.");
return false;
}
if (! that->mySMPShapeTypeMap.contains(myEntry)) {
-// MESSAGE("Shape type with entry "<<myEntry.toStdString()<<" was not found.");
return false;
}
string expr;
if (that->mySMPMap[myEntry].startsWith("def")) {
-// MESSAGE("custom function" );
expr = that->mySMPMap[myEntry].toStdString();
}
else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) {
-// MESSAGE("Attractor" );
if ((that->mySMPMap[myEntry].count(QRegExp("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$")) != 1)) {
if (displayError)
PyGILState_Release(gstate);
-// MESSAGE("SizeMap expression "<<expr<<" is valid");
return true;
}
+//================================================================================
+/*!
+ * \brief SLOT: Activate selection of faces in the Viewer
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchFaceSelection(bool on)
+{
+ if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
+ {
+ QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+ QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+ myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
+ }
+ myHyPatchFaceSelector->setVisible( on ); // show its buttons
+ myHyPatchFaceSelector->ShowPreview( on ); // show faces in the Viewer
+ // treat selection or not
+ myHyPatchFaceSelector->ActivateSelection( on || myHyPatchGroupSelBtn->isChecked() );
+
+ if ( on )
+ myHyPatchGroupSelBtn->setChecked( false );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: Deactivate selection of faces in the Viewer
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchGroupSelection(bool on)
+{
+ if ( on && myHyPatchFaceSelector->GetMainShape().IsNull() )
+ {
+ QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
+ QString aSubEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
+ myHyPatchFaceSelector->SetGeomShapeEntry( aSubEntry, aMainEntry );
+ }
+ if ( !myHyPatchFaceSelBtn->isChecked() )
+ {
+ myHyPatchFaceSelector->setVisible( false ); // show its buttons
+ myHyPatchFaceSelector->ShowPreview( false ); // show faces in the Viewer
+ }
+ // treat selection or not
+ myHyPatchFaceSelector->ActivateSelection( on || myHyPatchFaceSelBtn->isChecked() );
+
+ if ( on )
+ myHyPatchFaceSelBtn->setChecked( false );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: show IDs of selected faces in Tags LineEdit
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchSelectionChanged()
+{
+ QString tagString;
+ const QList<int>& tags = myHyPatchFaceSelector->GetSelectedIDs();
+ for ( int i = 0; i < tags.size(); ++i )
+ tagString += QString::number( tags[i] ) + " ";
+
+ myHyPatchTagsLE->setText( tagString );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: Add the Tags to the HyperPatch table
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchAdd()
+{
+ QStringList tagList = myHyPatchTagsLE->text().split(" ", QString::SkipEmptyParts);
+ if ( tagList.size() > 1 )
+ {
+ addHyPatchToTable( myHyPatchTagsLE->text() );
+ myHyPatchTagsLE->setText("");
+ }
+}
+
+//================================================================================
+/*!
+ * \brief Add a row to myHyPatchTable
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::addHyPatchToTable(const QString& tags)
+{
+ if ( tags.isEmpty() ) return;
+
+ QTableWidgetItem* cell = new QTableWidgetItem( tags );
+ cell->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+
+ int row = myHyPatchTable->rowCount();
+ myHyPatchTable->insertRow( row );
+ myHyPatchTable->setItem( row, 0, cell );
+}
+
+//================================================================================
+/*!
+ * \brief SLOT: remove selected rows from the HyperPatch table
+ */
+//================================================================================
+
+void BLSURFPluginGUI_HypothesisCreator::onHyPatchRemove()
+{
+ QList<QTableWidgetItem *> items = myHyPatchTable->selectedItems();
+ while ( !items.isEmpty() )
+ {
+ myHyPatchTable->removeRow( items[0]->row() );
+ items = myHyPatchTable->selectedItems();
+ }
+}
+
+bool BLSURFPluginGUI_HypothesisCreator::hasGeom() const
+{
+ return hypType() == BLSURFPlugin_Hypothesis::GetHypType(true);
+}
+
QString BLSURFPluginGUI_HypothesisCreator::caption() const
{
return tr( "BLSURF_TITLE" );
if (entry == entryForChecking )
break;
}
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
return row;
}
class LightApp_SelectionMgr;
class BLSURFPluginGUI_StdWidget;
class BLSURFPluginGUI_AdvWidget;
+class StdMeshersGUI_SubShapeSelectorWdg;
// class DlgBlSurfHyp_Enforced;
// Name
TGroupNameEnfVertexListMap groupNameEnfVertexListMap;
*/
TPreCadPeriodicityVector preCadPeriodicityVector;
+ QStringList hyperpatches;
QString myName;
} BlsurfHypothesisData;
void onStateChange();
// Advanced tab
void onAddOption();
-// void onDeleteOption();
-// void onEditOption( int, int );
void onChangeOptionName( int, int );
-// void onOptionChosenInPopup( QAction* );
// Sizemap tab
void onMapGeomContentModified();
void onSmpItemClicked( QTreeWidgetItem *, int );
void onSetSizeMap(QTreeWidgetItem *, int);
// Enforced vertices tab
QTreeWidgetItem* addEnforcedFace(std::string theFaceEntry, std::string theFaceName);
- void addEnforcedVertex(QTreeWidgetItem * theFaceItem, double x=0, double y=0, double z=0,
- std::string vertexName = "", std::string geomEntry = "", std::string groupName = "");
+ void addEnforcedVertex(double x=0, double y=0, double z=0,
+ std::string vertexName = "",
+ std::string geomEntry = "",
+ std::string groupName = "");
void onAddEnforcedVertices();
void onRemoveEnforcedVertex();
void synchronizeCoords();
void updateEnforcedVertexValues(QTreeWidgetItem* , int );
void onSelectEnforcedVertex();
-// void deactivateSelection(QWidget*, QWidget*);
void clearEnforcedVertexWidgets();
void onInternalVerticesClicked(int);
// Periodicity tab
void onPeriodicityByVerticesChecked(bool);
-// void onPeriodicityRadioButtonChanged();
void onAddPeriodicity();
void onRemovePeriodicity();
void onPeriodicityTreeClicked(QTreeWidgetItem*, int);
void onPeriodicityContentModified();
+ // HyperPatch tab
+ void onHyPatchFaceSelection(bool);
+ void onHyPatchGroupSelection(bool);
+ void onHyPatchSelectionChanged();
+ void onHyPatchAdd();
+ void onHyPatchRemove();
private:
bool readParamsFromHypo( BlsurfHypothesisData& ) const;
bool sizeMapValidationFromEntry(QString,bool displayError = true);
GeomSelectionTools* getGeomSelectionTool() const;
GEOM::GEOM_Gen_var getGeomEngine();
- //void insertElementType( TopAbs_ShapeEnum );
bool insertElement( GEOM::GEOM_Object_var, bool modify = false );
bool insertAttractor(GEOM::GEOM_Object_var, GEOM::GEOM_Object_var, bool modify = false);
int findRowFromEntry(QString entry);
static LightApp_SelectionMgr* selectionMgr();
void avoidSimultaneousSelection(ListOfWidgets &myCustomWidgets) const;
void AddPreCadSequenceToVector(BlsurfHypothesisData& h_data, BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const;
+ void addHyPatchToTable(const QString& tags);
+ bool hasGeom() const;
private:
QWidget* myEnfGroup;
-// TODO FACE AND VERTEX SELECTION
StdMeshersGUI_ObjectReferenceParamWdg *myEnfFaceWdg;
GEOM::GEOM_Object_var myEnfFace;
StdMeshersGUI_ObjectReferenceParamWdg *myEnfVertexWdg;
GEOM::GEOM_Object_var myEnfVertex;
-// DlgBlSurfHyp_Enforced* myEnforcedVertexWidget;
QTreeWidget* myEnforcedTreeWidget;
SMESHGUI_SpinBox* myXCoord;
SMESHGUI_SpinBox* myYCoord;
SMESHGUI_SpinBox* myZCoord;
QLineEdit* myGroupName;
-// QGroupBox* makeGroupsCheck;
-// QCheckBox* myGlobalGroupName;
QPushButton* addVertexButton;
QPushButton* removeVertexButton;
// map = entry , size map
QMap<QString, QString> mySMPMap; // Map <face entry, size>
QMap<QString, TAttractorVec > myATTMap; // Map <face entry, att. entry, etc>
- // QMap<QString, double> myDistMap; // Map <entry,distance with constant size>
- // QMap<QString, double> myAttDistMap; // Map <entry, influence distance>
QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
GeomSelectionTools* GeomToolSelected;
LightApp_SelectionMgr* aSel;
// Periodicity
- QWidget* myPeriodicityGroup;
- QSplitter* myPeriodicitySplitter;
- QTreeWidget* myPeriodicityTreeWidget;
- QWidget* myPeriodicityRightWidget;
- QGridLayout* myPeriodicityRightGridLayout;
- QGroupBox* myPeriodicityGroupBox1;
- QGroupBox* myPeriodicityGroupBox2;
+ QWidget* myPeriodicityGroup;
+ QSplitter* myPeriodicitySplitter;
+ QTreeWidget* myPeriodicityTreeWidget;
+ QWidget* myPeriodicityRightWidget;
+ QGridLayout* myPeriodicityRightGridLayout;
+ QGroupBox* myPeriodicityGroupBox1;
+ QGroupBox* myPeriodicityGroupBox2;
QGridLayout* aPeriodicityLayout1;
- QGridLayout* myPeriodicityGroupBox1Layout;
- QGridLayout* myPeriodicityGroupBox2Layout;
+ QGridLayout* myPeriodicityGroupBox1Layout;
+ QGridLayout* myPeriodicityGroupBox2Layout;
QRadioButton* myPeriodicityOnFaceRadioButton;
QRadioButton* myPeriodicityOnEdgeRadioButton;
- QLabel* myPeriodicityMainSourceLabel;
- QLabel* myPeriodicityMainTargetLabel;
- QLabel* myPeriodicitySourceLabel;
- QLabel* myPeriodicityTargetLabel;
+ QLabel* myPeriodicityMainSourceLabel;
+ QLabel* myPeriodicityMainTargetLabel;
+ QLabel* myPeriodicitySourceLabel;
+ QLabel* myPeriodicityTargetLabel;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceFaceWdg;
-// StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceEdgeWdg;
GEOM::GEOM_Object_var myPeriodicityFace;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetFaceWdg;
-// StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetEdgeWdg;
GEOM::GEOM_Object_var myPeriodicityEdge;
- QLabel* myPeriodicityP1SourceLabel;
- QLabel* myPeriodicityP2SourceLabel;
- QLabel* myPeriodicityP3SourceLabel;
- QLabel* myPeriodicityP1TargetLabel;
- QLabel* myPeriodicityP2TargetLabel;
- QLabel* myPeriodicityP3TargetLabel;
+ QLabel* myPeriodicityP1SourceLabel;
+ QLabel* myPeriodicityP2SourceLabel;
+ QLabel* myPeriodicityP3SourceLabel;
+ QLabel* myPeriodicityP1TargetLabel;
+ QLabel* myPeriodicityP2TargetLabel;
+ QLabel* myPeriodicityP3TargetLabel;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP1SourceWdg;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2SourceWdg;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3SourceWdg;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2TargetWdg;
StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3TargetWdg;
ListOfWidgets myPeriodicitySelectionWidgets;
- QPushButton* myPeriodicityAddButton;
- QPushButton* myPeriodicityRemoveButton;
- QSpacerItem* myPeriodicityVerticalSpacer;
+ QPushButton* myPeriodicityAddButton;
+ QPushButton* myPeriodicityRemoveButton;
+ QSpacerItem* myPeriodicityVerticalSpacer;
+
+ QTableWidget* myHyPatchTable;
+ StdMeshersGUI_SubShapeSelectorWdg* myHyPatchFaceSelector;
+ QLineEdit* myHyPatchTagsLE;
+ QPushButton* myHyPatchFaceSelBtn;
+ QPushButton* myHyPatchGroupSelBtn;
BLSURFPlugin::string_array_var myOptions, myPreCADOptions, myCustomOptions;
--- /dev/null
+// Copyright (C) 2007-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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BLSURFPluginGUI_TreeWidget.h"
+#include <QKeyEvent>
+
+namespace
+{
+ bool isEditable( const QModelIndex& index )
+ {
+ return index.isValid() &&
+ index.flags() & Qt::ItemIsEditable &&
+ index.flags() & Qt::ItemIsEnabled &&
+ ( !index.data( Qt::UserRole + 1 ).isValid() || index.data( Qt::UserRole + 1 ).toInt() != 0 );
+ }
+}
+
+BLSURFPluginGUI_TreeWidget::BLSURFPluginGUI_TreeWidget( QWidget* parent )
+ : QTreeWidget( parent )
+{
+}
+
+QModelIndex BLSURFPluginGUI_TreeWidget::moveCursor( CursorAction action, Qt::KeyboardModifiers modifiers )
+{
+ QModelIndex current = currentIndex();
+ int column = current.column();
+ if ( action == MoveNext ) {
+ if ( column < columnCount()-1 ) {
+ QModelIndex next = current.sibling( current.row(), column+1 );
+ if ( isEditable( next ) )
+ return next;
+ }
+ else {
+ QModelIndex next = current.sibling( current.row()+1, 0 );
+ if ( isEditable( next ) )
+ return next;
+ }
+ }
+ else if ( action == MovePrevious ) {
+ if ( column == 0 ) {
+ QModelIndex next = current.sibling( current.row()-1, columnCount()-1 );
+ if ( isEditable( next ) )
+ return next;
+ }
+ else {
+ QModelIndex next = current.sibling( current.row(), column-1 );
+ if ( isEditable( next ) )
+ return next;
+ }
+ }
+ return QTreeWidget::moveCursor( action, modifiers );
+}
+
+void BLSURFPluginGUI_TreeWidget::keyPressEvent( QKeyEvent* e )
+{
+ switch ( e->key() ) {
+ case Qt::Key_F2:
+ {
+ QModelIndex index = currentIndex();
+ if ( !isEditable( index ) ) {
+ for ( int i = 0; i < columnCount(); i++ ) {
+ QModelIndex sibling = index.sibling( index.row(), i );
+ if ( isEditable( sibling ) ) {
+ if ( !edit( sibling, EditKeyPressed, e ) )
+ e->ignore();
+ }
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ QTreeWidget::keyPressEvent( e );
+}
--- /dev/null
+// Copyright (C) 2007-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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#if !defined(BLSURFPluginGUI_TreeWidget_H)
+#define BLSURFPluginGUI_TreeWidget_H
+
+#include <QTreeWidget>
+
+class BLSURFPluginGUI_TreeWidget : public QTreeWidget
+{
+ Q_OBJECT
+public:
+ BLSURFPluginGUI_TreeWidget( QWidget* );
+
+protected:
+ QModelIndex moveCursor( CursorAction, Qt::KeyboardModifiers );
+ void keyPressEvent( QKeyEvent* );
+};
+
+#endif // BLSURFPluginGUI_TreeWidget_H
<source>ICON_SMESH_TREE_HYPO_MG-CADSurf Parameters</source>
<translation>mesh_tree_hypo_BLSURF.png</translation>
</message>
+ <message>
+ <source>ICON_SMESH_TREE_ALGO_BLSURF</source>
+ <translation>mesh_tree_algo_BLSURF.png</translation>
+ </message>
+ <message>
+ <source>ICON_SMESH_TREE_HYPO_BLSURF_Parameters</source>
+ <translation>mesh_tree_hypo_BLSURF.png</translation>
+ </message>
+ <message>
+ <source>ICON_SMESH_TREE_ALGO_MG-CADSurf_NOGEOM</source>
+ <translation>mesh_tree_algo_BLSURF.png</translation>
+ </message>
+ <message>
+ <source>ICON_SMESH_TREE_HYPO_MG-CADSurf Parameters_NOGEOM</source>
+ <translation>mesh_tree_hypo_BLSURF.png</translation>
+ </message>
</context>
</TS>
<translation>Merge edges</translation>
</message>
<message>
- <source>BLSURF_PRECAD_REMOVE_TINY_UV_EDGES</source>
+ <source>remove_tiny_uv_edges</source>
<translation>Remove tiny UV edges</translation>
</message>
<message>
<source>BLSURF_PERIODICITY_SELECT_EDGE</source>
<translation>Edge</translation>
</message>
+ <message>
+ <source>BLSURF_HYPATCH_TBL_HEADER</source>
+ <translation>Hyper-patch IDs</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPATCH_SEL_FACE</source>
+ <translation>Face selection</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPATCH_SEL_GROUP</source>
+ <translation>Group selection</translation>
+ </message>
+ <message>
+ <source>BLSURF_TAGS</source>
+ <translation>IDs</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPERPATCH_TAB</source>
+ <translation>Hyper-patch</translation>
+ </message>
</context>
<context>
<name>BLSURFPluginGUI_AdvWidget</name>
<source>max_number_of_points_per_patch</source>
<translation>Maximal number of points per patch</translation>
</message>
+ <message>
+ <source>max_number_of_threads</source>
+ <translation>Maximal number of threads</translation>
+ </message>
<message>
<source>rectify_jacobian</source>
<translation>Rectify Jacobian</translation>
</message>
+ <message>
+ <source>use_deprecated_patch_mesher</source>
+ <translation>use deprecated patch mesher</translation>
+ </message>
<message>
<source>respect_geometry</source>
<translation>Respect geometry</translation>
<source>tags</source>
<translation>Tags</translation>
</message>
- <message>
- <source></source>
- <translation></translation>
- </message>
</context>
</TS>
<translation>Fusionner des arêtes</translation>
</message>
<message>
- <source>BLSURF_PRECAD_REMOVE_TINY_UV_EDGES</source>
+ <source>remove_tiny_uv_edges</source>
<translation>Supprime les petites arêtes UV</translation>
</message>
<message>
<source>BLSURF_PERIODICITY_SELECT_EDGE</source>
<translation>Arête</translation>
</message>
+ <message>
+ <source>BLSURF_HYPATCH_TBL_HEADER</source>
+ <translation>IDs de l'hyper-patch</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPATCH_SEL_FACE</source>
+ <translation>Faces</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPATCH_SEL_GROUP</source>
+ <translation>Groupes</translation>
+ </message>
+ <message>
+ <source>BLSURF_TAGS</source>
+ <translation>IDs</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPERPATCH_TAB</source>
+ <translation>Hyper-patch</translation>
+ </message>
</context>
<context>
<name>BLSURFPluginGUI_AdvWidget</name>
<source>max_number_of_points_per_patch</source>
<translation>Nombre de points maximal par patch</translation>
</message>
+ <message>
+ <source>max_number_of_threads</source>
+ <translation>Nombre de threads maximal</translation>
+ </message>
<message>
<source>rectify_jacobian</source>
<translation>Ajustement du Jacobien</translation>
</message>
+ <message>
+ <source>use_deprecated_patch_mesher</source>
+ <translation>use deprecated patch mesher</translation>
+ </message>
<message>
<source>respect_geometry</source>
<translation>Respect de la géométrie</translation>
<translation>エッジをマージします。</translation>
</message>
<message>
- <source>BLSURF_PRECAD_REMOVE_TINY_UV_EDGES</source>
- <translation>微小UVエッジの削除</translation>
+ <source>remove_tiny_uv_edges</source>
+ <translation>微小なuvエッジの削除</translation>
</message>
<message>
<source>BLSURF_PRECAD_REMOVE_DUPLICATE_CAD_FACES</source>
<source>BLSURF_PERIODICITY_SELECT_EDGE</source>
<translation>Edge</translation>
</message>
+ <message>
+ <source>BLSURF_HYPATCH_TBL_HEADER</source>
+ <translation>Hyper-patch ID</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPATCH_SEL_FACE</source>
+ <translation>面選択</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPATCH_SEL_GROUP</source>
+ <translation>グループ選択</translation>
+ </message>
+ <message>
+ <source>BLSURF_TAGS</source>
+ <translation>ID</translation>
+ </message>
+ <message>
+ <source>BLSURF_HYPERPATCH_TAB</source>
+ <translation>Hyper-patch</translation>
+ </message>
</context>
<context>
<name>BLSURFPluginGUI_AdvWidget</name>
<source>max_number_of_points_per_patch</source>
<translation>1パッチの最大点数</translation>
</message>
+ <message>
+ <source>max_number_of_threads</source>
+ <translation type="unfinished">Maximal number of threads</translation>
+ </message>
<message>
<source>rectify_jacobian</source>
<translation>ヤコビアンの修正</translation>
</message>
+ <message>
+ <source>use_deprecated_patch_mesher</source>
+ <translation>use deprecated patch mesher</translation>
+ </message>
<message>
<source>respect_geometry</source>
<translation>ジオメトリの尊重</translation>
<source>tags</source>
<translation>タグ</translation>
</message>
- <message>
- <source/>
- <translation type="unfinished"/>
- </message>
</context>
</TS>
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_BINARY_DIR}/idl
${PROJECT_SOURCE_DIR}/src/BLSURFPlugin
+ ${PROJECT_SOURCE_DIR}/src/GUI
)
# additional preprocessor / compiler flags
SET(BLSURFPluginGUI_HEADERS
BLSURFPluginGUI_HypothesisCreator.h
BLSURFPluginGUI_Dlg.h
+ BLSURFPluginGUI_TreeWidget.h
)
# --- sources ---
BLSURFPluginGUI_StdWidget.cxx
BLSURFPluginGUI_AdvWidget.cxx
BLSURFPluginGUI_HypothesisCreator.cxx
+ BLSURFPluginGUI_TreeWidget.cxx
)
# --- resources ---
#
SET(BLSURFPLUGIN_TEST_FILES
+ test_cadsurf_multithread.py
test_enforced_internal_vertex.py
test_enforced_vertex.py
test_periodicity_2D_precad.py
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import salome
+import time
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+flight_solid_brep_1 = geompy.ImportBREP(os.path.join(os.getenv("DATA_DIR"),"Shapes/Brep/flight_solid.brep" ))
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( flight_solid_brep_1, 'flight_solid.brep_1' )
+
+###
+### SMESH component
+###
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New(theStudy)
+
+Mesh_1 = smesh.Mesh(flight_solid_brep_1)
+MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_1.SetPhySize( 1 )
+MG_CADSurf_Parameters_1.SetMaxSize( 1 )
+MG_CADSurf_Parameters_1.SetGradation( 1.05 )
+MG_CADSurf_Parameters_1.SetAngleMesh( 1 )
+MG_CADSurf_Parameters_1.SetChordalError( 2.40018 )
+# 4 procs are used by default
+# => No need to set an option
+
+time0 = time.time()
+isDone = Mesh_1.Compute()
+time1 = time.time()
+
+time_multithread = time1-time0
+
+print "Time in 4 proc: %.3s"%(time_multithread)
+
+Mesh_2 = smesh.Mesh(flight_solid_brep_1)
+MG_CADSurf = Mesh_2.Triangle(algo=smeshBuilder.MG_CADSurf)
+MG_CADSurf_Parameters_2 = MG_CADSurf.Parameters()
+MG_CADSurf_Parameters_2.SetPhySize( 1 )
+MG_CADSurf_Parameters_2.SetMaxSize( 1 )
+MG_CADSurf_Parameters_2.SetGradation( 1.05 )
+MG_CADSurf_Parameters_2.SetAngleMesh( 1 )
+MG_CADSurf_Parameters_2.SetChordalError( 2.40018 )
+# Use only one thread
+MG_CADSurf_Parameters_2.SetMaxNumberOfThreads( 1 )
+
+time2 = time.time()
+isDone = Mesh_2.Compute()
+time3 = time.time()
+
+time_singlethread = time3-time2
+print "Time in 1 proc: %.3s"%(time_singlethread)
+
+assert time_multithread < time_singlethread/2.
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(True)
from salome.geom import geomBuilder
geompy = geomBuilder.New()
-r = 10
-dist = 10
dist_coin = 10.1
p1 = geompy.MakeVertex(0., 0., 0.)
left = geompy.GetFaceNearPoint(box, p3)
geompy.addToStudyInFather(box, left, "left")
+allEnforcedCoords = []
+allEnforcedCoords.append(( dist_coin, 0, dist_coin ))
+allEnforcedCoords.append(( 20, 0, 15.3 ))
+allEnforcedCoords.append(( 25, 1, 25.3 ))
+allEnforcedCoords.append(( 35, 1, 45.3 ))
+allEnforcedCoords.append(( 35, 1, 55.3 ))
+
+p4 = geompy.MakeVertex( *(allEnforcedCoords[1] ))
+p5 = geompy.MakeVertex( *(allEnforcedCoords[2] ))
+pp = geompy.MakeCompound( [p4,p5], theName="p4,p5" )
+p6 = geompy.MakeVertex( *(allEnforcedCoords[3] ), theName="p6")
+p7 = geompy.MakeVertex( *(allEnforcedCoords[4] ), theName="p7")
+
+xyz7 = allEnforcedCoords[4]
+
# Mesh
# ====
algo2d.SetPhySize( 8 )
algo2d.SetEnforcedVertex(left, dist_coin, 0, dist_coin)
+algo2d.AddEnforcedVertexGeom( pp )
+algo2d.AddEnforcedVertexGeom( p6 )
+algo2d.AddEnforcedVertex( *xyz7 )
-Mesh.Compute()
+assert Mesh.Compute()
+assert not Mesh.FindCoincidentNodes( 1e-7 )
-id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
+for x,y,z in allEnforcedCoords:
-x, y, z = Mesh.GetNodeXYZ(id_node)
+ id_node = Mesh.FindNodeClosestTo( x,y,z )
+ xn, yn, zn = Mesh.GetNodeXYZ( id_node )
-assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
+ # compare X and Z
+ assert "%.2f, %.2f"%(x, z) == "%.2f, %.2f"%( xn, zn ), \
+ "%.2f, %.2f, %.2f != %.2f, %.2f, %.2f"%( xn, yn, zn, x,y,z )
salome.sg.updateObjBrowser()
BLSURF_Parameters.SetPhySize( 5 )
BLSURF_Parameters.SetPreCADMergeEdges( True )
BLSURF_Parameters.SetPreCADProcess3DTopology( True )
+BLSURF_Parameters.SetPreCADOptionValue( 'remove_tiny_uv_edges', 'yes' )
Mesh_1.Compute()
import math
-area_tolerance = 1e-2
+area_tolerance = 0.1
nb_faces_tolerance = 20
## Return the min and max areas of a mesh