mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
Merge from BR_imps_2013 14/01/2014
This commit is contained in:
parent
b117205bfd
commit
f7aba4830d
@ -1,12 +1,11 @@
|
||||
# Arithmetic 1D
|
||||
# Arithmetic 1D and Geometric Progression
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
import GEOM
|
||||
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import SMESH, SALOMEDS
|
||||
from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
@ -21,12 +20,20 @@ hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
||||
algo1D = hexa.Segment()
|
||||
|
||||
# optionally reverse node distribution on certain edges
|
||||
allEdges = geompy.SubShapeAllSortedIDs( box, geompy.ShapeType["EDGE"])
|
||||
allEdges = geompy.SubShapeAllSorted( box, geompy.ShapeType["EDGE"])
|
||||
reversedEdges = [ allEdges[0], allEdges[4] ]
|
||||
|
||||
# define "Arithmetic1D" hypothesis to cut all edges in several segments with increasing arithmetic length
|
||||
algo1D.Arithmetic1D(1, 4, reversedEdges)
|
||||
|
||||
# define "Geometric Progression" hypothesis on one edge to cut this edge in segments with length increasing by 20% starting from 1
|
||||
gpAlgo = hexa.Segment( allEdges[1] )
|
||||
gpAlgo.GeometricProgression( 1, 1.2 )
|
||||
|
||||
# propagate distribution of nodes computed using "Geometric Progression" to parallel edges
|
||||
gpAlgo.PropagationOfDistribution()
|
||||
|
||||
|
||||
# create a quadrangle 2D algorithm for faces
|
||||
hexa.Quadrangle()
|
||||
|
||||
|
@ -11,7 +11,8 @@ from salome.smesh import smeshBuilder
|
||||
smesh = smeshBuilder.New(salome.myStudy)
|
||||
|
||||
# create a box
|
||||
box = geompy.MakeBoxDXDYDZ(10., 10., 10.)
|
||||
base = geompy.MakeSketcher("Sketcher:F 0 0:TT 10 0:TT 20 10:TT 0 10:WF", theName="F")
|
||||
box = geompy.MakePrismDXDYDZ( base, 0,0,10 )
|
||||
geompy.addToStudy(box, "Box")
|
||||
|
||||
# get one edge of the box to put local hypothesis on
|
||||
@ -20,7 +21,7 @@ EdgeX = geompy.GetEdgeNearPoint(box, p5)
|
||||
geompy.addToStudyInFather(box, EdgeX, "Edge [0,0,0 - 10,0,0]")
|
||||
|
||||
# create a hexahedral mesh on the box
|
||||
hexa = smesh.Mesh(box, "Box : hexahedrical mesh")
|
||||
hexa = smesh.Mesh(box, "Propagation of hypothesis")
|
||||
|
||||
# set global algorithms and hypotheses
|
||||
algo1D = hexa.Segment()
|
||||
@ -28,15 +29,37 @@ hexa.Quadrangle()
|
||||
hexa.Hexahedron()
|
||||
algo1D.NumberOfSegments(4)
|
||||
|
||||
# create a sub-mesh with local 1D hypothesis and propagation
|
||||
# create a sub-mesh with local 1D hypothesis and "Propagation of 1D Hypothesis"
|
||||
algo_local = hexa.Segment(EdgeX)
|
||||
|
||||
# define "Arithmetic1D" hypothesis to cut an edge in several segments with increasing length
|
||||
algo_local.Arithmetic1D(1, 4)
|
||||
|
||||
# define "Propagation" hypothesis that propagates all other 1D hypotheses
|
||||
# from all edges on the opposite side of a face in case of quadrangular faces
|
||||
# define "Propagation" hypothesis that propagates "Arithmetic1D" hypothesis
|
||||
# from 'EdgeX' on opposite sides of all quadilateral faces
|
||||
algo_local.Propagation()
|
||||
|
||||
# compute the mesh
|
||||
# compute the mesh which contains prisms
|
||||
hexa.Compute()
|
||||
|
||||
|
||||
# create another mesh on the box
|
||||
mesh = smesh.Mesh(box, "Propagation of distribution of nodes")
|
||||
|
||||
# set global algorithms and hypotheses
|
||||
algo1D = mesh.Segment()
|
||||
mesh.Quadrangle()
|
||||
mesh.Hexahedron()
|
||||
algo1D.NumberOfSegments(4)
|
||||
|
||||
# create a sub-mesh with local 1D hypothesis and "Propagation of Node Distribution"
|
||||
algo_local = mesh.Segment(EdgeX)
|
||||
algo_local.Arithmetic1D(1, 4)
|
||||
|
||||
# define "Propagation Of Distribution" hypothesis that propagates
|
||||
# distribution of nodes generated by "Arithmetic1D" hypothesis
|
||||
# from 'EdgeX' on opposite sides of all quadilateral faces
|
||||
algo_local.PropagationOfDistribution()
|
||||
|
||||
# compute the mesh which contains hexahedra only
|
||||
mesh.Compute()
|
||||
|
BIN
doc/salome/gui/SMESH/images/a-geometric1d.png
Normal file
BIN
doc/salome/gui/SMESH/images/a-geometric1d.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 50 KiB |
@ -6,6 +6,7 @@
|
||||
<ul>
|
||||
<li>\ref adaptive_1d_anchor "Adaptive"</li>
|
||||
<li>\ref arithmetic_1d_anchor "Arithmetic 1D"</li>
|
||||
<li>\ref geometric_1d_anchor "Geometric Progression"</li>
|
||||
<li>\ref average_length_anchor "Local Length"</li>
|
||||
<li>\ref max_length_anchor "Max Size"</li>
|
||||
<li>\ref deflection_1d_anchor "Deflection 1D"</li>
|
||||
@ -55,7 +56,30 @@ picking them in the 3D viewer or by selecting the edges or groups of edges in th
|
||||
\image html b-ithmetic1d.png "Arithmetic 1D hypothesis - the size of mesh elements gradually increases"
|
||||
|
||||
<b>See Also</b> a sample TUI Script of a
|
||||
\ref tui_1d_arithmetic "Defining Arithmetic 1D hypothesis" operation.
|
||||
\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation.
|
||||
|
||||
<br>
|
||||
\anchor geometric_1d_anchor
|
||||
<h2>Geometric Progression hypothesis</h2>
|
||||
|
||||
<b>Geometric Progression</b> hypothesis allows to split edges into
|
||||
segments with a length that changes in geometric progression (Lk =
|
||||
Lk-1 * d) beginning from a given starting length and with a given
|
||||
common ratio.
|
||||
|
||||
The direction of the splitting is defined by the orientation of the
|
||||
underlying geometrical edge. <b>"Reverse Edges"</b> list box allows to
|
||||
specify the edges for which the splitting should be made in the
|
||||
direction opposing to their orientation. This list box is enabled only
|
||||
if the geometry object is selected for the meshing. In this case the
|
||||
user can select edges to be reversed either directly picking them in
|
||||
the 3D viewer or by selecting the edges or groups of edges in the
|
||||
Object Browser.
|
||||
|
||||
\image html a-geometric1d.png
|
||||
|
||||
<b>See Also</b> a sample TUI Script of a
|
||||
\ref tui_1d_arithmetic "Defining Arithmetic 1D and Geometric Progression hypothesis" operation.
|
||||
|
||||
<br>
|
||||
\anchor deflection_1d_anchor
|
||||
|
@ -20,6 +20,7 @@ In \b MESH there are the following Basic Hypotheses:
|
||||
<li>\ref max_length_anchor "Max Size"</li>
|
||||
<li>\ref adaptive_1d_anchor "Adaptive"</li>
|
||||
<li>\ref arithmetic_1d_anchor "Arithmetic 1D"</li>
|
||||
<li>\ref geometric_1d_anchor "Geometric 1D"</li>
|
||||
<li>\ref start_and_end_length_anchor "Start and end length"</li>
|
||||
<li>\ref deflection_1d_anchor "Deflection 1D"</li>
|
||||
<li>\ref automatic_length_anchor "Automatic Length"</li>
|
||||
@ -41,6 +42,7 @@ There also exist
|
||||
with other hypotheses:
|
||||
<ul>
|
||||
<li>\ref propagation_anchor "Propagation of 1D Hypothesis on opposite edges"</li>
|
||||
<li>\ref propagofdistribution_anchor "Propagation of Node Distribution on Opposite Edges"</li>
|
||||
<li>\ref viscous_layers_anchor "Viscous layers"</li>
|
||||
<li>\ref quadratic_mesh_anchor "Quadratic mesh"</li>
|
||||
<li>\ref non_conform_allowed_anchor "Non conform mesh allowed"</li>
|
||||
|
@ -38,6 +38,19 @@ has been locally defined on the opposite edge.
|
||||
<br><b>See Also</b> a sample TUI Script of a
|
||||
\ref tui_propagation "Propagation hypothesis" operation
|
||||
|
||||
\anchor propagofdistribution_anchor
|
||||
<h2>Propagation of Node Distribution on Opposite Edges</h2>
|
||||
|
||||
<b>Propagation of Node Distribution on Opposite Edges</b> allows to propagate
|
||||
distribution of nodes onto an opposite edge. If a local hypothesis and
|
||||
propagation are defined on an edge of a quadrangular face, the
|
||||
opposite edge will have the same number of nodes and the same
|
||||
relations between segment lengths, unless another hypothesis
|
||||
has been locally defined on the opposite edge.
|
||||
|
||||
<br><b>See Also</b> a sample TUI Script of a
|
||||
\ref tui_propagation "Propagation hypothesis" operation
|
||||
|
||||
\anchor quadrangle_preference_anchor
|
||||
<h2>Quadrangle Preference</h2>
|
||||
|
||||
@ -68,29 +81,29 @@ computations.
|
||||
<li><b>Number of layers</b> - defines the number of element layers.</li>
|
||||
<li><b>Stretch factor</b> - defines the growth factor of element height
|
||||
from the mesh boundary inwards.</li>
|
||||
<li><b>Specified Edges are</b> - defines how the shapes specified by
|
||||
<li><b>Specified Faces/Edges are</b> - defines how the shapes specified by
|
||||
the next parameter are used.
|
||||
<li><b>Faces without layers</b> and <b>Edges with/without layers</b> -
|
||||
in the 3D case it defines geometrical faces on which element layers
|
||||
should not be constructed; in the 2D case it defines geometrical edges
|
||||
on which element layers either should be or should not be
|
||||
constructed, depending on the value of the previous parameter
|
||||
(<b>Specified Edges are</b>).
|
||||
<li><b> Faces/Edges with/without layers</b> -
|
||||
defines geometrical faces or edges on which element layers
|
||||
either should be or should not be constructed, depending on the
|
||||
value of the previous parameter (<b>Specified Faces/Edges are</b>).
|
||||
Faces (or edges) can be selected either in the Object Browser or in
|
||||
the VTK Viewer.
|
||||
\note A mesh shown in the 3D Viewer can prevent selection of faces
|
||||
and edges, just hide the mesh to avoid this. To avoid a long wait when a
|
||||
geometry with many faces (or edges) is displayed, the number of faces
|
||||
(edges) shown at a time is limited by the value of "Sub-shapes
|
||||
preview chunk size" preference (in Preferences/Mesh/General tab).<br>
|
||||
|
||||
Whatever shapes are specified by this
|
||||
parameter, the element layers are not constructed on geometrical
|
||||
faces shared by several solids in 3D case and edges shared by
|
||||
several faces in 2D case. In other words the element layers can be
|
||||
constructed on boundary faces and edges, and are not constructed on
|
||||
internal faces and edges. There is an exception to this rule in 2D
|
||||
case: if "Viscous Layers 2D" hypothesis is assigned to a sub-mesh,
|
||||
the element layers can be constructed on boundary edges of the shape
|
||||
of this sub-mesh.
|
||||
If faces/edges without layers are specified, the element layers are
|
||||
not constructed on geometrical faces shared by several solids in 3D
|
||||
case and edges shared by several faces in 2D case. In other words,
|
||||
in this mode the element layers can be constructed on boundary faces
|
||||
and edges only, and are not constructed on internal faces and
|
||||
edges. There is an exception to this rule: if a hypothesis is
|
||||
assigned to a sub-mesh, the element layers can be constructed on
|
||||
boundary faces/edges of the shape of this sub-mesh, at same time
|
||||
possibly being internal faces/edges within the whole model.
|
||||
\image html viscous_layers_on_submesh.png 2D viscous layers constructed on boundary edges of a sub-mesh on a disk face.
|
||||
|
||||
</li>
|
||||
@ -101,5 +114,4 @@ computations.
|
||||
<br><b>See also</b> a sample TUI script of a \ref tui_viscous_layers
|
||||
"Viscous layers construction".
|
||||
|
||||
|
||||
*/
|
||||
|
@ -9,6 +9,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
|
||||
<ul>
|
||||
<li>\ref tui_1d_adaptive "Adaptive 1D" hypothesis</li>
|
||||
<li>\ref tui_1d_arithmetic "Arithmetic 1D" hypothesis</li>
|
||||
<li>\ref tui_1d_arithmetic "Geometric Progression" hypothesis</li>
|
||||
<li>\ref tui_deflection_1d "Deflection 1D and Number of Segments" hypotheses</li>
|
||||
<li>\ref tui_start_and_end_length "Start and End Length" hypotheses</li>
|
||||
<li>\ref tui_average_length "Local Length"</li>
|
||||
@ -44,7 +45,7 @@ This page provides example codes of \ref tui_defining_meshing_algos
|
||||
|
||||
<br>
|
||||
\anchor tui_1d_arithmetic
|
||||
<h3>Arithmetic 1D</h3>
|
||||
<h3>Arithmetic 1D and Geometric Progression</h3>
|
||||
\tui_script{defining_hypotheses_ex01.py}
|
||||
|
||||
<br>
|
||||
|
@ -127,10 +127,36 @@ module StdMeshers
|
||||
double GetFineness();
|
||||
};
|
||||
|
||||
/*!
|
||||
* Common inteface of 1D hypotheses that can be reversed
|
||||
*/
|
||||
interface Reversible1D
|
||||
{
|
||||
/*!
|
||||
* Set list of edges to reverse
|
||||
*/
|
||||
void SetReversedEdges( in SMESH::long_array list );
|
||||
|
||||
/*!
|
||||
* Returns list of edges to reverse
|
||||
*/
|
||||
SMESH::long_array GetReversedEdges();
|
||||
|
||||
/*!
|
||||
* Set entry of the main object
|
||||
*/
|
||||
void SetObjectEntry( in string entry );
|
||||
|
||||
/*!
|
||||
* Get the entry of the main object
|
||||
*/
|
||||
string GetObjectEntry();
|
||||
};
|
||||
|
||||
/*!
|
||||
* StdMeshers_NumberOfSegments: interface of "Nb. Segments" hypothesis
|
||||
*/
|
||||
interface StdMeshers_NumberOfSegments : SMESH::SMESH_Hypothesis
|
||||
interface StdMeshers_NumberOfSegments : SMESH::SMESH_Hypothesis, Reversible1D
|
||||
{
|
||||
/*!
|
||||
* Builds and returns point distribution according to passed density function
|
||||
@ -209,32 +235,12 @@ module StdMeshers
|
||||
*/
|
||||
long ConversionMode()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Set list of edges to reverse
|
||||
*/
|
||||
void SetReversedEdges( in SMESH::long_array list );
|
||||
|
||||
/*!
|
||||
* Returns list of edges to reverse
|
||||
*/
|
||||
SMESH::long_array GetReversedEdges();
|
||||
|
||||
/*!
|
||||
* Set entry of the main object
|
||||
*/
|
||||
void SetObjectEntry( in string entry );
|
||||
|
||||
/*!
|
||||
* Get the entry of the main object
|
||||
*/
|
||||
string GetObjectEntry();
|
||||
};
|
||||
|
||||
/*!
|
||||
* StdMeshers_Arithmetic1D: interface of "Arithmetic 1D" hypothesis
|
||||
*/
|
||||
interface StdMeshers_Arithmetic1D : SMESH::SMESH_Hypothesis
|
||||
interface StdMeshers_Arithmetic1D : SMESH::SMESH_Hypothesis, Reversible1D
|
||||
{
|
||||
/*!
|
||||
* Sets <start segment length> or <end segment length> parameter value
|
||||
@ -260,26 +266,36 @@ module StdMeshers
|
||||
* Returns <start segment length> or <end segment length> parameter value
|
||||
*/
|
||||
double GetLength(in boolean isStartLength);
|
||||
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
* StdMeshers_Arithmetic1D: interface of "Geometric 1D" hypothesis
|
||||
*/
|
||||
interface StdMeshers_Geometric1D : SMESH::SMESH_Hypothesis, Reversible1D
|
||||
{
|
||||
/*!
|
||||
* Set list of edges to reverse
|
||||
* Sets length of the first segment
|
||||
*/
|
||||
void SetReversedEdges( in SMESH::long_array list );
|
||||
|
||||
void SetStartLength(in double length)
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Returns list of edges to reverse
|
||||
* Sets value of Common Ratio
|
||||
*/
|
||||
SMESH::long_array GetReversedEdges();
|
||||
|
||||
void SetCommonRatio(in double factor)
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Set entry of the main object
|
||||
* Returns length of the first segment
|
||||
*/
|
||||
void SetObjectEntry( in string entry );
|
||||
|
||||
double GetStartLength();
|
||||
|
||||
/*!
|
||||
* Get the entry of the main object
|
||||
* Returns value of Common Ratio
|
||||
*/
|
||||
string GetObjectEntry();
|
||||
double GetCommonRatio();
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -319,7 +335,7 @@ module StdMeshers
|
||||
/*!
|
||||
* StdMeshers_StartEndLength: interface of "Start and End Length" hypothesis
|
||||
*/
|
||||
interface StdMeshers_StartEndLength : SMESH::SMESH_Hypothesis
|
||||
interface StdMeshers_StartEndLength : SMESH::SMESH_Hypothesis, Reversible1D
|
||||
{
|
||||
/*!
|
||||
* Sets <start segment length> or <end segment length> parameter value
|
||||
@ -346,25 +362,6 @@ module StdMeshers
|
||||
*/
|
||||
double GetLength(in boolean isStartLength);
|
||||
|
||||
/*!
|
||||
* Set list of edges to reverse
|
||||
*/
|
||||
void SetReversedEdges( in SMESH::long_array list );
|
||||
|
||||
/*!
|
||||
* Returns list of edges to reverse
|
||||
*/
|
||||
SMESH::long_array GetReversedEdges();
|
||||
|
||||
/*!
|
||||
* Set entry of the main object
|
||||
*/
|
||||
void SetObjectEntry( in string entry );
|
||||
|
||||
/*!
|
||||
* Get the entry of the main object
|
||||
*/
|
||||
string GetObjectEntry();
|
||||
};
|
||||
|
||||
|
||||
@ -388,7 +385,7 @@ module StdMeshers
|
||||
/*!
|
||||
* StdMeshers_FixedPoints1D: interface of "Fixed points 1D" hypothesis
|
||||
*/
|
||||
interface StdMeshers_FixedPoints1D : SMESH::SMESH_Hypothesis
|
||||
interface StdMeshers_FixedPoints1D : SMESH::SMESH_Hypothesis, Reversible1D
|
||||
{
|
||||
/*!
|
||||
* Sets some points on edge using parameter on curve from 0 to 1
|
||||
@ -410,26 +407,7 @@ module StdMeshers
|
||||
* Returns list of numbers of segments
|
||||
*/
|
||||
SMESH::long_array GetNbSegments();
|
||||
|
||||
/*!
|
||||
* Set list of edges to reverse
|
||||
*/
|
||||
void SetReversedEdges( in SMESH::long_array list );
|
||||
|
||||
/*!
|
||||
* Returns list of edges to reverse
|
||||
*/
|
||||
SMESH::long_array GetReversedEdges();
|
||||
|
||||
/*!
|
||||
* Set entry of the main object
|
||||
*/
|
||||
void SetObjectEntry( in string entry );
|
||||
|
||||
/*!
|
||||
* Get the entry of the main object
|
||||
*/
|
||||
string GetObjectEntry();
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -483,7 +461,8 @@ module StdMeshers
|
||||
};
|
||||
|
||||
/*!
|
||||
* StdMeshers_Propagation: interface of "Propagation" hypothesis.
|
||||
* StdMeshers_Propagation: interface of "Propagation of 1D Hyp. on
|
||||
* Opposite Edges" hypothesis.
|
||||
* Presence of this hypothesis on any edge propagates any other 1D
|
||||
* hypothesis from this edge on all edges, opposite to it.
|
||||
* It concerns only edges of quadrangle faces.
|
||||
@ -492,6 +471,17 @@ module StdMeshers
|
||||
{
|
||||
};
|
||||
|
||||
/*!
|
||||
* StdMeshers_Propagation: interface of "Propagation of Node
|
||||
* Distribution on Opposite Edges" hypothesis.
|
||||
* Presence of this hypothesis on any edge propagates distribution of nodes
|
||||
* from this edge on all edges, opposite to it.
|
||||
* It concerns only edges of quadrangle faces.
|
||||
*/
|
||||
interface StdMeshers_PropagOfDistribution : SMESH::SMESH_Hypothesis
|
||||
{
|
||||
};
|
||||
|
||||
/*!
|
||||
* StdMeshers_QuadranglePreference: interface of "QuadranglePreference" hypothesis.
|
||||
* This hypothesis is used by StdMeshers_Quadrangle_2D algorithm.
|
||||
@ -807,6 +797,22 @@ module StdMeshers
|
||||
* Get the type of quadrangulation
|
||||
*/
|
||||
QuadType GetQuadType();
|
||||
|
||||
/*!
|
||||
* Set positions of enforced nodes
|
||||
*/
|
||||
void SetEnforcedNodes(in GEOM::ListOfGO vertices, in SMESH::nodes_array points)
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Returns positions of enforced nodes
|
||||
*/
|
||||
void GetEnforcedNodes(out GEOM::ListOfGO vertices, out SMESH::nodes_array points);
|
||||
|
||||
/*!
|
||||
* Returns entries of shapes defining enforced nodes
|
||||
*/
|
||||
SMESH::string_array GetEnfVertices();
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -865,6 +871,14 @@ module StdMeshers
|
||||
void SetIgnoreFaces(in SMESH::long_array faceIDs) raises (SALOME::SALOME_Exception);
|
||||
SMESH::long_array GetIgnoreFaces();
|
||||
|
||||
/*!
|
||||
* Set faces either to exclude from treatment or to make the Viscous Layers on.
|
||||
*/
|
||||
void SetFaces(in SMESH::long_array faceIDs,
|
||||
in boolean toIgnore) raises (SALOME::SALOME_Exception);
|
||||
SMESH::long_array GetFaces();
|
||||
boolean GetIsToIgnoreFaces();
|
||||
|
||||
/*!
|
||||
* Set total thickness of layers of prisms
|
||||
*/
|
||||
@ -936,7 +950,7 @@ module StdMeshers
|
||||
/*!
|
||||
* Set size threshold. A polyhedral cell got by cutting an initial
|
||||
* hexahedron by geometry boundary is considered small and is removed if
|
||||
* it's size is \athreshold times less than the size of the initial hexahedron.
|
||||
* it's size is \a threshold times less than the size of the initial hexahedron.
|
||||
* threshold must be > 1.0
|
||||
*/
|
||||
void SetSizeThreshold(in double threshold) raises (SALOME::SALOME_Exception);
|
||||
@ -971,6 +985,13 @@ module StdMeshers
|
||||
void GetGridSpacing(out SMESH::string_array spaceFunctions,
|
||||
out SMESH::double_array internalPoints,
|
||||
in short axis) raises (SALOME::SALOME_Exception);
|
||||
/*!
|
||||
* Enables implementation of geometrical edges into the mesh. If this feature
|
||||
* is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
|
||||
* they don't coincide with the grid lines
|
||||
*/
|
||||
void SetToAddEdges(in boolean toAdd);
|
||||
boolean GetToAddEdges();
|
||||
|
||||
/*!
|
||||
* \brief Computes node coordinates by spacing functions
|
||||
@ -978,13 +999,15 @@ module StdMeshers
|
||||
* \param x1 - upper coordinate
|
||||
* \param spaceFuns - space functions
|
||||
* \param points - internal points
|
||||
* \param coords - the computed coordinates
|
||||
* \param axisName - e.g. "X"
|
||||
* \return the computed coordinates
|
||||
*/
|
||||
SMESH::double_array ComputeCoordinates(in double x0,
|
||||
in double x1,
|
||||
in SMESH::string_array spaceFuns,
|
||||
in SMESH::double_array points,
|
||||
in string axisName ) raises (SALOME::SALOME_Exception);
|
||||
in string axisName )
|
||||
raises (SALOME::SALOME_Exception);
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -925,6 +925,11 @@ module SMESH
|
||||
*/
|
||||
long_array GetElemFaceNodes(in long elemId, in short faceIndex);
|
||||
|
||||
/*!
|
||||
* Returns three components of normal of given mesh face (or an empty array in KO case)
|
||||
*/
|
||||
double_array GetFaceNormal(in long faceId);
|
||||
|
||||
/*!
|
||||
* Returns an element based on all given nodes.
|
||||
*/
|
||||
|
@ -55,6 +55,11 @@
|
||||
icon-id ="mesh_hypo_length.png"
|
||||
dim ="1"/>
|
||||
|
||||
<hypothesis type ="GeometricProgression"
|
||||
label-id ="Geometric Progression"
|
||||
icon-id ="mesh_hypo_length.png"
|
||||
dim ="1"/>
|
||||
|
||||
<hypothesis type ="FixedPoints1D"
|
||||
label-id ="Fixed Points 1D"
|
||||
icon-id ="mesh_hypo_length.png"
|
||||
@ -86,6 +91,12 @@
|
||||
dim ="1"
|
||||
auxiliary="true"/>
|
||||
|
||||
<hypothesis type ="PropagOfDistribution"
|
||||
label-id ="Propagation of Node Distribution on Opposite Edges"
|
||||
icon-id ="mesh_hypo_length.png"
|
||||
dim ="1"
|
||||
auxiliary="true"/>
|
||||
|
||||
<hypothesis type ="AutomaticLength"
|
||||
label-id ="Automatic Length"
|
||||
icon-id ="mesh_hypo_length.png"
|
||||
@ -205,8 +216,8 @@
|
||||
<algorithm type ="Regular_1D"
|
||||
label-id ="Wire Discretisation"
|
||||
icon-id ="mesh_algo_regular.png"
|
||||
hypos ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
|
||||
opt-hypos="Propagation,QuadraticMesh"
|
||||
hypos ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,GeometricProgression,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
|
||||
opt-hypos="Propagation,PropagOfDistribution,QuadraticMesh"
|
||||
input ="VERTEX"
|
||||
output ="EDGE"
|
||||
dim ="1">
|
||||
@ -215,12 +226,14 @@
|
||||
<hypo>LocalLength=LocalLength(SetLength(1),,SetPrecision(1))</hypo>
|
||||
<hypo>MaxLength=MaxSize(SetLength(1))</hypo>
|
||||
<hypo>Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
|
||||
<hypo>GeometricProgression=GeometricProgression(SetStartLength(),SetCommonRatio(),SetReversedEdges())</hypo>
|
||||
<hypo>StartEndLength=StartEndLength(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
|
||||
<hypo>Deflection1D=Deflection1D(SetDeflection())</hypo>
|
||||
<hypo>Adaptive1D=Adaptive(SetMinSize(),SetMaxSize(),SetDeflection())</hypo>
|
||||
<hypo>AutomaticLength=AutomaticLength(SetFineness())</hypo>
|
||||
<hypo>FixedPoints1D=FixedPoints1D(SetPoints(),SetNbSegments(),SetReversedEdges())</hypo>
|
||||
<hypo>Propagation=Propagation()</hypo>
|
||||
<hypo>PropagOfDistribution=PropagationOfDistribution()</hypo>
|
||||
<hypo>QuadraticMesh=QuadraticMesh()</hypo>
|
||||
</python-wrap>
|
||||
</algorithm>
|
||||
@ -228,8 +241,8 @@
|
||||
<algorithm type ="CompositeSegment_1D"
|
||||
label-id ="Composite Side Discretisation"
|
||||
icon-id ="mesh_algo_regular.png"
|
||||
hypos ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
|
||||
opt-hypos="Propagation,QuadraticMesh"
|
||||
hypos ="Adaptive1D,LocalLength,MaxLength,Arithmetic1D,GeometricProgression,StartEndLength,NumberOfSegments,Deflection1D,AutomaticLength,FixedPoints1D"
|
||||
opt-hypos="Propagation,PropagOfDistribution,QuadraticMesh"
|
||||
input ="VERTEX"
|
||||
output ="EDGE"
|
||||
dim ="1">
|
||||
@ -238,12 +251,14 @@
|
||||
<hypo>LocalLength=LocalLength(SetLength(), ,SetPrecision())</hypo>
|
||||
<hypo>MaxLength=MaxSize(SetLength())</hypo>
|
||||
<hypo>Arithmetic1D=Arithmetic1D(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
|
||||
<hypo>GeometricProgression=GeometricProgression(SetStartLength(),SetCommonRatio(),SetReversedEdges())</hypo>
|
||||
<hypo>StartEndLength=StartEndLength(SetStartLength(),SetEndLength(),SetReversedEdges())</hypo>
|
||||
<hypo>Deflection1D=Deflection1D(SetDeflection())</hypo>
|
||||
<hypo>Adaptive1D=Adaptive(SetMinSize(),SetMaxSize(),SetDeflection())</hypo>
|
||||
<hypo>AutomaticLength=AutomaticLength(SetFineness())</hypo>
|
||||
<hypo>FixedPoints1D=FixedPoints1D(SetPoints(),SetNbSegments(),SetReversedEdges())</hypo>
|
||||
<hypo>Propagation=Propagation()</hypo>
|
||||
<hypo>PropagOfDistribution=PropagationOfDistribution()</hypo>
|
||||
<hypo>QuadraticMesh=QuadraticMesh()</hypo>
|
||||
</python-wrap>
|
||||
</algorithm>
|
||||
@ -292,6 +307,7 @@
|
||||
label-id ="Hexahedron (i,j,k)"
|
||||
icon-id ="mesh_algo_hexa.png"
|
||||
input ="QUAD"
|
||||
output ="HEXA,PENTA"
|
||||
need-geom="false"
|
||||
opt-hypos="ViscousLayers"
|
||||
dim ="3">
|
||||
@ -379,6 +395,7 @@
|
||||
label-id="3D Extrusion"
|
||||
icon-id ="mesh_algo_hexa.png"
|
||||
input ="QUAD,TRIA"
|
||||
output ="HEXA,PENTA,OCTA,POLYHEDRON"
|
||||
dim ="3">
|
||||
<python-wrap>
|
||||
<algo>Prism_3D=Prism()</algo>
|
||||
@ -390,6 +407,7 @@
|
||||
icon-id ="mesh_algo_hexa.png"
|
||||
hypos ="NumberOfLayers, LayerDistribution"
|
||||
input ="QUAD,TRIA"
|
||||
output ="HEXA,PENTA,OCTA,POLYHEDRON"
|
||||
dim ="3">
|
||||
<python-wrap>
|
||||
<algo>RadialPrism_3D=Prism('RadialPrism_3D')</algo>
|
||||
@ -424,7 +442,7 @@
|
||||
icon-id ="mesh_algo_quad.png"
|
||||
hypos ="NumberOfLayers2D, LayerDistribution2D"
|
||||
input ="EDGE"
|
||||
output ="QUAD,TRIA"
|
||||
output ="QUAD"
|
||||
dim ="2">
|
||||
<python-wrap>
|
||||
<algo>RadialQuadrangle_1D2D=Quadrangle(algo=smeshBuilder.RADIAL_QUAD)</algo>
|
||||
@ -437,6 +455,7 @@
|
||||
icon-id ="mesh_algo_hexa.png"
|
||||
hypos ="CartesianParameters3D"
|
||||
support-submeshes="false"
|
||||
output ="HEXA"
|
||||
dim ="3">
|
||||
<python-wrap>
|
||||
<algo>Cartesian_3D=BodyFitted()</algo>
|
||||
|
@ -410,7 +410,7 @@ bool SMESH_Algo::GetSortedNodesOnEdge(const SMESHDS_Mesh* theM
|
||||
return false;
|
||||
|
||||
SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
|
||||
if ( !eSubMesh || !eSubMesh->GetElements()->more() )
|
||||
if ( !eSubMesh || ( eSubMesh->NbElements()==0 && eSubMesh->NbNodes() == 0))
|
||||
return false; // edge is not meshed
|
||||
|
||||
int nbNodes = 0;
|
||||
|
@ -896,7 +896,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
|
||||
const bool force,
|
||||
double distXYZ[4]) const
|
||||
{
|
||||
int shapeID = n->getshapeId();
|
||||
int shapeID = n->getshapeId();
|
||||
bool infinit = Precision::IsInfinite( u );
|
||||
if ( force || toCheckPosOnShape( shapeID ) || infinit )
|
||||
{
|
||||
|
@ -2641,10 +2641,10 @@ bool SMESH_Pattern::Apply (const SMDS_MeshFace* theFace,
|
||||
|
||||
list< const SMDS_MeshNode* > nodes;
|
||||
list< const SMDS_MeshNode* >::iterator n = nodes.end();
|
||||
SMDS_ElemIteratorPtr noIt = theFace->nodesIterator();
|
||||
SMDS_NodeIteratorPtr noIt = theFace->nodeIterator();
|
||||
int iSub = 0;
|
||||
while ( noIt->more() && iSub < nbFaceNodes ) {
|
||||
const SMDS_MeshNode* node = smdsNode( noIt->next() );
|
||||
const SMDS_MeshNode* node = noIt->next();
|
||||
nodes.push_back( node );
|
||||
if ( iSub++ == theNodeIndexOnKeyPoint1 )
|
||||
n = --nodes.end();
|
||||
@ -2661,7 +2661,7 @@ bool SMESH_Pattern::Apply (const SMDS_MeshFace* theFace,
|
||||
list< gp_XYZ > xyzList;
|
||||
myOrderedNodes.resize( nbFaceNodes );
|
||||
for ( iSub = 0, n = nodes.begin(); n != nodes.end(); ++n ) {
|
||||
xyzList.push_back( gp_XYZ( (*n)->X(), (*n)->Y(), (*n)->Z() ));
|
||||
xyzList.push_back( SMESH_TNodeXYZ( *n ));
|
||||
myOrderedNodes[ iSub++] = *n;
|
||||
}
|
||||
|
||||
@ -2963,11 +2963,6 @@ bool SMESH_Pattern::Apply (SMESH_Mesh* theMesh,
|
||||
myXYZ.resize( myPoints.size() * theFaces.size(), undefinedXYZ() );
|
||||
myElements.reserve( theFaces.size() );
|
||||
|
||||
// to find point index
|
||||
map< TPoint*, int > pointIndex;
|
||||
for ( int i = 0; i < myPoints.size(); i++ )
|
||||
pointIndex.insert( make_pair( & myPoints[ i ], i ));
|
||||
|
||||
int ind1 = 0; // lowest point index for a face
|
||||
|
||||
// meshed geometry
|
||||
@ -3019,7 +3014,7 @@ bool SMESH_Pattern::Apply (SMESH_Mesh* theMesh,
|
||||
{
|
||||
list< TPoint* > & linkPoints = getShapePoints( eID++ );
|
||||
const SMDS_MeshNode* n1 = myOrderedNodes[ i ];
|
||||
const SMDS_MeshNode* n2 = myOrderedNodes[ i + 1 == nbNodes ? 0 : i + 1 ];
|
||||
const SMDS_MeshNode* n2 = myOrderedNodes[( i+1 ) % nbNodes ];
|
||||
// make a link and a node set
|
||||
TNodeSet linkSet, node1Set;
|
||||
linkSet.insert( n1 );
|
||||
@ -3028,7 +3023,7 @@ bool SMESH_Pattern::Apply (SMESH_Mesh* theMesh,
|
||||
list< TPoint* >::iterator p = linkPoints.begin();
|
||||
{
|
||||
// map the first link point to n1
|
||||
int nId = pointIndex[ *p ] + ind1;
|
||||
int nId = ( *p - &myPoints[0] ) + ind1;
|
||||
myXYZIdToNodeMap[ nId ] = n1;
|
||||
list< list< int > >& groups = myIdsOnBoundary[ node1Set ];
|
||||
groups.push_back(list< int > ());
|
||||
@ -3040,7 +3035,7 @@ bool SMESH_Pattern::Apply (SMESH_Mesh* theMesh,
|
||||
list< int >& indList = groups.back();
|
||||
// add points to the map excluding the end points
|
||||
for ( p++; *p != linkPoints.back(); p++ )
|
||||
indList.push_back( pointIndex[ *p ] + ind1 );
|
||||
indList.push_back( ( *p - &myPoints[0] ) + ind1 );
|
||||
}
|
||||
ind1 += myPoints.size();
|
||||
}
|
||||
@ -3443,7 +3438,7 @@ void SMESH_Pattern::mergePoints (const bool uniteGroups)
|
||||
Bnd_Box box;
|
||||
TNodeSet::const_iterator n = nodes.begin();
|
||||
for ( ; n != nodes.end(); ++n )
|
||||
box.Add( gp_Pnt( (*n)->X(), (*n)->Y(), (*n)->Z() ));
|
||||
box.Add( gp_Pnt( SMESH_TNodeXYZ( *n )));
|
||||
double x, y, z, X, Y, Z;
|
||||
box.Get( x, y, z, X, Y, Z );
|
||||
gp_Pnt p( x, y, z ), P( X, Y, Z );
|
||||
@ -3454,7 +3449,7 @@ void SMESH_Pattern::mergePoints (const bool uniteGroups)
|
||||
bool unite = ( uniteGroups && nodes.size() == 2 );
|
||||
map< double, int > distIndMap;
|
||||
const SMDS_MeshNode* node = *nodes.begin();
|
||||
gp_Pnt P( node->X(), node->Y(), node->Z() );
|
||||
gp_Pnt P = SMESH_TNodeXYZ( node );
|
||||
|
||||
// compare points, replace indices
|
||||
|
||||
@ -3928,32 +3923,142 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh,
|
||||
myXYZ[ i ].Y(),
|
||||
myXYZ[ i ].Z());
|
||||
}
|
||||
}
|
||||
if ( theMesh->HasShapeToMesh() )
|
||||
{
|
||||
// set nodes on EDGEs (IMP 22368)
|
||||
SMESH_MesherHelper helper( *theMesh );
|
||||
helper.ToFixNodeParameters( true );
|
||||
map< TNodeSet, list< list< int > > >::iterator idListIt = myIdsOnBoundary.begin();
|
||||
for ( ; idListIt != myIdsOnBoundary.end(); idListIt++ )
|
||||
{
|
||||
list<list< int > >& groups = idListIt->second;
|
||||
const TNodeSet& nodes = idListIt->first;
|
||||
if ( nodes.size() != 2 )
|
||||
continue; // not a link
|
||||
const SMDS_MeshNode* n1 = *nodes.begin();
|
||||
const SMDS_MeshNode* n2 = *nodes.rbegin();
|
||||
TopoDS_Shape S1 = helper.GetSubShapeByNode( n1, aMeshDS );
|
||||
TopoDS_Shape S2 = helper.GetSubShapeByNode( n2, aMeshDS );
|
||||
if ( S1.IsNull() || S1.ShapeType() < TopAbs_EDGE ||
|
||||
S2.IsNull() || S2.ShapeType() < TopAbs_EDGE )
|
||||
continue;
|
||||
TopoDS_Shape S;
|
||||
if ( S1.ShapeType() == TopAbs_EDGE )
|
||||
{
|
||||
if ( S1 == S2 || helper.IsSubShape( S2, S1 ))
|
||||
S = S1;
|
||||
}
|
||||
else if ( S2.ShapeType() == TopAbs_EDGE )
|
||||
{
|
||||
if ( helper.IsSubShape( S1, S2 ))
|
||||
S = S2;
|
||||
}
|
||||
else
|
||||
{
|
||||
S = helper.GetCommonAncestor( S1, S2, *theMesh, TopAbs_EDGE );
|
||||
}
|
||||
if ( S.IsNull() )
|
||||
continue;
|
||||
const TopoDS_Edge & E = TopoDS::Edge( S );
|
||||
helper.SetSubShape( E );
|
||||
list<list< int > >::iterator g = groups.begin();
|
||||
for ( ; g != groups.end(); ++g )
|
||||
{
|
||||
list< int >& ids = *g;
|
||||
list< int >::iterator id = ids.begin();
|
||||
for ( ; id != ids.end(); ++id )
|
||||
if ( nodesVector[ *id ] && nodesVector[ *id ]->getshapeId() < 1 )
|
||||
{
|
||||
double u = 1e100;
|
||||
aMeshDS->SetNodeOnEdge( nodesVector[ *id ], E, u );
|
||||
helper.CheckNodeU( E, nodesVector[ *id ], u, 1e-7, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // if ( onMeshElements )
|
||||
|
||||
else
|
||||
{
|
||||
nodesVector.resize( myPoints.size(), 0 );
|
||||
|
||||
// to find point index
|
||||
map< TPoint*, int > pointIndex;
|
||||
for ( int i = 0; i < myPoints.size(); i++ )
|
||||
pointIndex.insert( make_pair( & myPoints[ i ], i ));
|
||||
// find existing nodes on EDGEs and VERTEXes (IMP 22368)
|
||||
map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin();
|
||||
if ( !myShapeIDMap.IsEmpty() && aMeshDS->NbNodes() > 0 )
|
||||
|
||||
for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ )
|
||||
{
|
||||
const TopoDS_Shape& S = myShapeIDMap( idPointIt->first );
|
||||
list< TPoint* > & points = idPointIt->second;
|
||||
if ( points.empty() )
|
||||
continue;
|
||||
|
||||
switch ( S.ShapeType() )
|
||||
{
|
||||
case TopAbs_VERTEX:
|
||||
{
|
||||
int pIndex = points.back() - &myPoints[0];
|
||||
if ( !nodesVector[ pIndex ] )
|
||||
nodesVector[ pIndex ] = SMESH_Algo::VertexNode( TopoDS::Vertex( S ), aMeshDS );
|
||||
break;
|
||||
}
|
||||
case TopAbs_EDGE:
|
||||
{
|
||||
const TopoDS_Edge& edge = TopoDS::Edge( S );
|
||||
map< double, const SMDS_MeshNode* > paramsOfNodes;
|
||||
if ( !SMESH_Algo::GetSortedNodesOnEdge( aMeshDS, edge,
|
||||
/*ignoreMediumNodes=*/false,
|
||||
paramsOfNodes )
|
||||
|| paramsOfNodes.size() < 3 )
|
||||
break;
|
||||
// points on VERTEXes are included with wrong myU
|
||||
list< TPoint* >::reverse_iterator pItR = ++points.rbegin();
|
||||
list< TPoint* >::iterator pItF = ++points.begin();
|
||||
const bool isForward = ( (*pItF)->myU < (*pItR)->myU );
|
||||
map< double, const SMDS_MeshNode* >::iterator u2n = ++paramsOfNodes.begin();
|
||||
map< double, const SMDS_MeshNode* >::iterator u2nEnd = --paramsOfNodes.end();
|
||||
TPoint* p;
|
||||
while ( u2n != u2nEnd && pItF != points.end() )
|
||||
{
|
||||
const double u = u2n->first;
|
||||
const SMDS_MeshNode* n = u2n->second;
|
||||
const double tol = ( (++u2n)->first - u ) / 20;
|
||||
do
|
||||
{
|
||||
p = ( isForward ? *pItF : *pItR );
|
||||
if ( Abs( u - p->myU ) < tol )
|
||||
{
|
||||
int pIndex = p - &myPoints[0];
|
||||
if ( !nodesVector [ pIndex ] )
|
||||
nodesVector [ pIndex ] = n;
|
||||
++pItF;
|
||||
++pItR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while ( p->myU < u && ( ++pItF, ++pItR != points.rend() ));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:;
|
||||
}
|
||||
} // end of "find existing nodes on EDGEs and VERTEXes"
|
||||
|
||||
// loop on sub-shapes of myShape: create nodes
|
||||
map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin();
|
||||
idPointIt = myShapeIDToPointsMap.begin();
|
||||
for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ )
|
||||
{
|
||||
TopoDS_Shape S;
|
||||
//SMESHDS_SubMesh * subMeshDS = 0;
|
||||
if ( !myShapeIDMap.IsEmpty() ) {
|
||||
S = myShapeIDMap( idPointIt->first );
|
||||
//subMeshDS = aMeshDS->MeshElements( S );
|
||||
}
|
||||
list< TPoint* > & points = idPointIt->second;
|
||||
list< TPoint* >::iterator pIt = points.begin();
|
||||
for ( ; pIt != points.end(); pIt++ )
|
||||
{
|
||||
TPoint* point = *pIt;
|
||||
int pIndex = pointIndex[ point ];
|
||||
//int pIndex = pointIndex[ point ];
|
||||
int pIndex = point - &myPoints[0];
|
||||
if ( nodesVector [ pIndex ] )
|
||||
continue;
|
||||
SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(),
|
||||
@ -4148,8 +4253,9 @@ void SMESH_Pattern::createElements(SMESH_Mesh* theMes
|
||||
SMDS_ElemIteratorPtr noIt = elem->nodesIterator();
|
||||
while ( noIt->more() ) {
|
||||
SMDS_MeshNode* node = const_cast<SMDS_MeshNode*>(smdsNode( noIt->next() ));
|
||||
if (!node->getshapeId() &&
|
||||
shellNodes.find( node ) == shellNodes.end() ) {
|
||||
if ( node->getshapeId() < 1 &&
|
||||
shellNodes.find( node ) == shellNodes.end() )
|
||||
{
|
||||
if ( S.ShapeType() == TopAbs_FACE )
|
||||
aMeshDS->SetNodeOnFace( node, shapeID,
|
||||
Precision::Infinite(),// <- it's a sign that UV is not set
|
||||
|
@ -356,7 +356,7 @@ private:
|
||||
// all functions assure that shapes are indexed so that first go
|
||||
// ordered vertices, then ordered edge, then faces and maybe a shell
|
||||
TopTools_IndexedMapOfOrientedShape myShapeIDMap;
|
||||
std::map< int, std::list< TPoint* > > myShapeIDToPointsMap;
|
||||
std::map< int, std::list< TPoint*> > myShapeIDToPointsMap;
|
||||
|
||||
// for the 2d case:
|
||||
// nb of key-points in each of pattern boundaries
|
||||
|
@ -551,6 +551,8 @@ QString SMESHGUI_GenericHypothesisCreator::helpPage() const
|
||||
aHelpFileName = "a1d_meshing_hypo_page.html#max_length_anchor";
|
||||
else if ( aHypType == "Arithmetic1D")
|
||||
aHelpFileName = "a1d_meshing_hypo_page.html#arithmetic_1d_anchor";
|
||||
else if ( aHypType == "GeometricProgression")
|
||||
aHelpFileName = "a1d_meshing_hypo_page.html#geometric_1d_anchor";
|
||||
else if ( aHypType == "FixedPoints1D")
|
||||
aHelpFileName = "a1d_meshing_hypo_page.html#fixed_points_1d_anchor";
|
||||
else if ( aHypType == "MaxElementArea")
|
||||
|
@ -296,24 +296,45 @@ namespace SMESH
|
||||
}
|
||||
|
||||
|
||||
QStringList GetHypothesesSets(int maxDim)
|
||||
QStringList GetHypothesesSets(int maxDim, const QString& MeshType)
|
||||
{
|
||||
QStringList aSetNameList;
|
||||
|
||||
// Init list of available hypotheses, if needed
|
||||
InitAvailableHypotheses();
|
||||
|
||||
QList<HypothesesSet*>::iterator hypoSet;
|
||||
for ( hypoSet = myListOfHypothesesSets.begin();
|
||||
for ( hypoSet = myListOfHypothesesSets.begin();
|
||||
hypoSet != myListOfHypothesesSets.end();
|
||||
++hypoSet ) {
|
||||
HypothesesSet* aSet = *hypoSet;
|
||||
if ( aSet &&
|
||||
( aSet->count( true ) || aSet->count( false )) &&
|
||||
aSet->maxDim() <= maxDim)
|
||||
bool isAvailable = false;
|
||||
if ( !MeshType.isEmpty() )
|
||||
{
|
||||
aSetNameList.append( mangledHypoSetName( aSet ));
|
||||
if ( aSet->maxDim() != maxDim)
|
||||
continue;
|
||||
aSet->init( true );
|
||||
while ( aSet->next(), aSet->more() )
|
||||
{
|
||||
if ( HypothesisData* hypData = SMESH::GetHypothesisData( aSet->current() ) )
|
||||
{
|
||||
QStringList::const_iterator inElemType = hypData->OutputTypes.begin();
|
||||
for ( ; inElemType != hypData->OutputTypes.end(); inElemType++ )
|
||||
{
|
||||
if ( *inElemType == MeshType ){
|
||||
isAvailable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( isAvailable ) break;
|
||||
}
|
||||
}
|
||||
else if ( aSet && ( aSet->count( true ) || aSet->count( false )) &&
|
||||
aSet->maxDim() <= maxDim)
|
||||
{
|
||||
isAvailable = true;
|
||||
}
|
||||
if ( isAvailable ) aSetNameList.append( mangledHypoSetName( aSet ));
|
||||
}
|
||||
aSetNameList.removeDuplicates();
|
||||
aSetNameList.sort();
|
||||
|
@ -71,7 +71,7 @@ namespace SMESH
|
||||
const bool = false,
|
||||
const bool = true);
|
||||
SMESHGUI_EXPORT
|
||||
QStringList GetHypothesesSets( int maxDim );
|
||||
QStringList GetHypothesesSets( int, const QString& );
|
||||
|
||||
SMESHGUI_EXPORT
|
||||
HypothesesSet* GetHypothesesSet( const QString& );
|
||||
|
@ -364,6 +364,9 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh
|
||||
// geometry
|
||||
createObject( tr( "GEOMETRY" ), mainFrame(), Geom );
|
||||
myGeomPopup = 0;
|
||||
// mesh type
|
||||
QLabel* anMeshTypeLbl = new QLabel( tr( "MESH_TYPE" ), this );
|
||||
myMeshType = new QComboBox( this );
|
||||
|
||||
// Create tab widget
|
||||
|
||||
@ -398,10 +401,16 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh
|
||||
aLay->addWidget( objectWg( Geom, Label ), 2, 0 );
|
||||
aLay->addWidget( objectWg( Geom, Btn ), 2, 1 );
|
||||
aLay->addWidget( objectWg( Geom, Control ), 2, 2 );
|
||||
aLay->addWidget( myTabWg, 4, 0, 1, 3 );
|
||||
aLay->addWidget( myHypoSetButton, 5, 0, 1, 3 );
|
||||
aLay->addWidget( anMeshTypeLbl, 3, 0 );
|
||||
aLay->addWidget( myMeshType, 3, 2 );
|
||||
aLay->addWidget( myTabWg, 5, 0, 1, 3 );
|
||||
aLay->addWidget( myHypoSetButton, 6, 0, 1, 3 );
|
||||
aLay->setRowMinimumHeight( 3, 20 );
|
||||
|
||||
myMeshType->clear();
|
||||
|
||||
// Connect signals and slots
|
||||
connect( myMeshType, SIGNAL( activated( int ) ), SLOT( onChangedMeshType( int ) ) );
|
||||
// Disable controls if necessary
|
||||
setObjectShown( Mesh, false );
|
||||
if ( theToCreate )
|
||||
@ -615,3 +624,36 @@ int SMESHGUI_MeshDlg::getActiveObject()
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Sets available types of mesh
|
||||
* \param theTypeMesh - list of available types of mesh
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI_MeshDlg::setAvailableMeshType( const QStringList& theTypeMesh )
|
||||
{
|
||||
myMeshType->clear();
|
||||
myMeshType->addItems(theTypeMesh);
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Emits selectMeshType( const int, const int ) signal
|
||||
*
|
||||
* SLOT is called when a combo box "mesh type" is selected.
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI_MeshDlg::onChangedMeshType( const int isIndex )
|
||||
{
|
||||
emit selectMeshType( Dim3D - myTabWg->currentIndex(), isIndex );
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Get current index types of mesh
|
||||
*/
|
||||
//================================================================================
|
||||
int SMESHGUI_MeshDlg::currentMeshType( )
|
||||
{
|
||||
return myMeshType->currentIndex( );
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,21 +74,26 @@ public:
|
||||
void enableTab(const int);
|
||||
bool isTabEnabled(const int) const;
|
||||
int getActiveObject();
|
||||
void setAvailableMeshType(const QStringList& );
|
||||
int currentMeshType();
|
||||
|
||||
signals:
|
||||
void hypoSet( const QString& );
|
||||
void geomSelectionByMesh( bool );
|
||||
void selectMeshType( const int, const int );
|
||||
|
||||
private slots:
|
||||
void onHypoSetPopup( QAction* );
|
||||
void onGeomPopup( QAction* );
|
||||
void onGeomSelectionButton( bool );
|
||||
void onChangedMeshType( const int );
|
||||
|
||||
private:
|
||||
QMap<int, SMESHGUI_MeshTab*> myTabs;
|
||||
QTabWidget* myTabWg;
|
||||
QToolButton* myHypoSetButton;
|
||||
QMenu* myGeomPopup;
|
||||
QComboBox* myMeshType;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -95,6 +95,7 @@ SMESHGUI_MeshOp::SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh )
|
||||
if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
|
||||
GeometryGUI::InitGeomGen();
|
||||
myIsOnGeometry = true;
|
||||
myMaxShapeDim = -1;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -211,14 +212,13 @@ void SMESHGUI_MeshOp::startOperation()
|
||||
}
|
||||
connect( myDlg, SIGNAL( hypoSet( const QString& )), SLOT( onHypoSet( const QString& )));
|
||||
connect( myDlg, SIGNAL( geomSelectionByMesh( bool )), SLOT( onGeomSelectionByMesh( bool )));
|
||||
|
||||
connect( myDlg, SIGNAL( selectMeshType( const int, const int ) ), SLOT( onAlgoSetByMeshType( const int, const int)));
|
||||
if ( myToCreate )
|
||||
if ( myIsMesh ) myHelpFileName = "constructing_meshes_page.html";
|
||||
else myHelpFileName = "constructing_submeshes_page.html";
|
||||
else myHelpFileName = "editing_meshes_page.html";
|
||||
}
|
||||
SMESHGUI_SelectionOp::startOperation();
|
||||
|
||||
// iterate through dimensions and get available algoritms, set them to the dialog
|
||||
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
|
||||
for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ )
|
||||
@ -245,6 +245,11 @@ void SMESHGUI_MeshOp::startOperation()
|
||||
myDlg->activateObject( SMESHGUI_MeshDlg::Obj );
|
||||
|
||||
myDlg->setCurrentTab( SMESH::DIM_3D );
|
||||
|
||||
QStringList TypeMeshList;
|
||||
createMeshTypeList( TypeMeshList );
|
||||
setAvailableMeshType( TypeMeshList );
|
||||
|
||||
myDlg->show();
|
||||
myDlg->setGeomPopupEnabled(false);
|
||||
selectionDone();
|
||||
@ -582,7 +587,8 @@ void SMESHGUI_MeshOp::selectionDone()
|
||||
onAlgoSelected(-1, i);
|
||||
}
|
||||
myDlg->setMaxHypoDim( shapeDim );
|
||||
myDlg->setHypoSets( SMESH::GetHypothesesSets( shapeDim ));
|
||||
myMaxShapeDim = shapeDim;
|
||||
myDlg->setHypoSets( SMESH::GetHypothesesSets( shapeDim, "" ));
|
||||
|
||||
if (!myToCreate) // edition: read hypotheses
|
||||
{
|
||||
@ -669,12 +675,16 @@ void SMESHGUI_MeshOp::selectionDone()
|
||||
for (int i = SMESH::DIM_0D;i < SMESH::DIM_3D; ++i) {
|
||||
myDlg->disableTab(i);
|
||||
}
|
||||
myMaxShapeDim = -1;
|
||||
//Hide labels and fields (Mesh ang Geometry)
|
||||
myDlg->setObjectShown( SMESHGUI_MeshDlg::Mesh, false );
|
||||
myDlg->setObjectShown( SMESHGUI_MeshDlg::Geom, false );
|
||||
myDlg->adjustSize();
|
||||
readMesh();
|
||||
}
|
||||
QStringList TypeMeshList;
|
||||
createMeshTypeList( TypeMeshList );
|
||||
setAvailableMeshType( TypeMeshList );
|
||||
}
|
||||
catch ( const SALOME::SALOME_Exception& S_ex )
|
||||
{
|
||||
@ -1380,7 +1390,19 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
|
||||
availableHyps( aDim, Algo, anAvailable, myAvailableHypData[ aDim ][ Algo ]);
|
||||
myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailable );
|
||||
}
|
||||
|
||||
// check that tab enable, if algorithm building needed algo is one less than dimension
|
||||
if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() &&
|
||||
( aDim > SMESH::DIM_0D ) && !isAccessibleDim( aDim - 1 ) ){
|
||||
myDlg->enableTab( aDim - 1 );
|
||||
}
|
||||
if ( (myDlg->currentMeshType() != MT_ANY) &&
|
||||
(( !algoData && ( aDim > SMESH::DIM_0D ) && isAccessibleDim( aDim - 1 )) ||
|
||||
( algoData && myIsOnGeometry && algoData->InputTypes.isEmpty() &&
|
||||
( aDim > SMESH::DIM_0D ) && isAccessibleDim( aDim - 1 ) ) ) ){
|
||||
for (int i = aDim - 1; i >= SMESH::DIM_0D; i--){
|
||||
if ( isAccessibleDim( i ) ) myDlg->disableTab( i );
|
||||
}
|
||||
}
|
||||
// check that algorithms of other dimentions are compatible with
|
||||
// the selected one
|
||||
|
||||
@ -2343,3 +2365,193 @@ void SMESHGUI_MeshOp::selectObject( _PTR(SObject) theSObj ) const
|
||||
sm->setSelectedObjects( anIOList, false );
|
||||
}
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Create available list types of mesh
|
||||
* \param theTypeMesh - Output list of available types of mesh
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI_MeshOp::createMeshTypeList( QStringList& theTypeMesh)
|
||||
{
|
||||
theTypeMesh.clear();
|
||||
theTypeMesh.append( tr( "MT_ANY" ) );
|
||||
if ( myIsOnGeometry && ( myMaxShapeDim >= 2 || myMaxShapeDim == -1 ) )
|
||||
{
|
||||
theTypeMesh.append( tr( "MT_TRIANGULAR" ) );
|
||||
theTypeMesh.append( tr( "MT_QUADRILATERAL" ) );
|
||||
}
|
||||
if ( myIsOnGeometry && ( myMaxShapeDim == 3 || myMaxShapeDim == -1 ) )
|
||||
{
|
||||
theTypeMesh.append( tr( "MT_TETRAHEDRAL" ) );
|
||||
theTypeMesh.append( tr( "MT_HEXAHEDRAL" ) );
|
||||
}
|
||||
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Set available types of mesh
|
||||
* \param theTypeMesh - List of available types of mesh
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI_MeshOp::setAvailableMeshType( const QStringList& theTypeMesh )
|
||||
{
|
||||
myDlg->setAvailableMeshType( theTypeMesh );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief SLOT. Is called when the user select type of mesh
|
||||
* \param theTabIndex - Index of current active tab
|
||||
* \param theIndex - Index of current type of mesh
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESHGUI_MeshOp::onAlgoSetByMeshType( const int theTabIndex, const int theIndex)
|
||||
{
|
||||
int aDim;
|
||||
if ( !myIsOnGeometry ) return;
|
||||
THypDataList anAvailableAlgsData;
|
||||
QStringList anAvailableAlgs;
|
||||
QString anCompareType = "ANY";
|
||||
bool isAvailableChoiceAlgo = false;
|
||||
int anCurrentAvailableAlgo = 0;
|
||||
bool isNone = true;
|
||||
switch ( theIndex ) {
|
||||
case MT_ANY:
|
||||
{
|
||||
for ( int dim = SMESH::DIM_2D; dim <= SMESH::DIM_3D; dim++ )
|
||||
{
|
||||
isNone = currentHyp( dim, Algo ) < 0;
|
||||
isAvailableChoiceAlgo = false;
|
||||
// retrieves a list of available algorithms from resources
|
||||
availableHyps( dim, Algo, anAvailableAlgs, anAvailableAlgsData );
|
||||
//return current algo in current tab
|
||||
if ( !isNone && !myAvailableHypData[dim][Algo].empty() ){
|
||||
for (int i = 0 ; i < anAvailableAlgsData.count(); i++)
|
||||
{
|
||||
HypothesisData* algoAny = anAvailableAlgsData.at(i);
|
||||
HypothesisData* algoCur = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) );
|
||||
QString tem = algoAny->Label;
|
||||
if ( algoAny->Label == algoCur->Label ){
|
||||
isAvailableChoiceAlgo = true;
|
||||
anCurrentAvailableAlgo = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( !isNone ){
|
||||
isAvailableChoiceAlgo = true;
|
||||
anCurrentAvailableAlgo = currentHyp( dim, Algo );
|
||||
}
|
||||
//set new algorithm list and select the current algorithm
|
||||
myAvailableHypData[dim][Algo] = anAvailableAlgsData;
|
||||
myDlg->tab( dim )->setAvailableHyps( Algo, anAvailableAlgs );
|
||||
if ( isAvailableChoiceAlgo )
|
||||
setCurrentHyp( dim, Algo, anCurrentAvailableAlgo );
|
||||
}
|
||||
int aMaxShapeDim = ( myMaxShapeDim == -1 ) ? SMESH::DIM_3D : myMaxShapeDim;
|
||||
for ( int i = SMESH::DIM_0D; i <= aMaxShapeDim; i++ ) {
|
||||
myDlg->enableTab( i );
|
||||
}
|
||||
myDlg->setCurrentTab( theTabIndex );
|
||||
myDlg->setHypoSets( SMESH::GetHypothesesSets( aMaxShapeDim, "" ) );
|
||||
}
|
||||
break;
|
||||
case MT_TRIANGULAR:{
|
||||
aDim = SMESH::DIM_2D;
|
||||
anCompareType = "TRIA";
|
||||
}
|
||||
break;
|
||||
case MT_QUADRILATERAL:{
|
||||
aDim = SMESH::DIM_2D;
|
||||
anCompareType = "QUAD";
|
||||
}
|
||||
break;
|
||||
case MT_TETRAHEDRAL:{
|
||||
aDim = SMESH::DIM_3D;
|
||||
anCompareType = "TETRA";
|
||||
}
|
||||
break;
|
||||
case MT_HEXAHEDRAL:{
|
||||
aDim = SMESH::DIM_3D;
|
||||
anCompareType = "HEXA";
|
||||
}
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
if ( anCompareType != "ANY" )
|
||||
{
|
||||
QString anCurrentAlgo;
|
||||
bool isReqDisBound = true;
|
||||
isNone = currentHyp( aDim, Algo ) < 0;
|
||||
// retrieves a list of available algorithms from resources
|
||||
availableHyps( aDim, Algo, anAvailableAlgs, anAvailableAlgsData );
|
||||
// finding algorithm which is selected
|
||||
if ( !isNone && !myAvailableHypData[aDim][Algo].empty() &&
|
||||
myAvailableHypData[aDim][Algo].count() != anAvailableAlgsData.count() ){
|
||||
anCurrentAlgo = myAvailableHypData[aDim][Algo].at( currentHyp( aDim, Algo ) )->Label;
|
||||
isReqDisBound = myAvailableHypData[aDim][Algo].at( currentHyp( aDim, Algo ) )->InputTypes.isEmpty();
|
||||
}
|
||||
else if ( !isNone ){
|
||||
anCurrentAlgo = anAvailableAlgsData.at( currentHyp( aDim, Algo ) )->Label;
|
||||
isReqDisBound = anAvailableAlgsData.at( currentHyp( aDim, Algo ) )->InputTypes.isEmpty();
|
||||
}
|
||||
anAvailableAlgs.clear();
|
||||
myAvailableHypData[aDim][Algo].clear();
|
||||
// finding and adding algorithm depending on the type mesh
|
||||
for ( int i = 0 ; i < anAvailableAlgsData.count(); i++ )
|
||||
{
|
||||
HypothesisData* algoIn = anAvailableAlgsData.at( i );
|
||||
bool isAvailableAlgo = ( algoIn->OutputTypes.count() == 0 );
|
||||
QStringList::const_iterator inElemType = algoIn->OutputTypes.begin();
|
||||
for ( ; inElemType != algoIn->OutputTypes.end(); inElemType++ )
|
||||
{
|
||||
if ( *inElemType == anCompareType ){
|
||||
isAvailableAlgo = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( isAvailableAlgo || algoIn->OutputTypes.count()==0 ){
|
||||
anAvailableAlgs.append( algoIn->Label );
|
||||
myAvailableHypData[aDim][Algo].append( algoIn );
|
||||
}
|
||||
//algorithm will be active, if the chosen algorithm available in the current mesh type
|
||||
if ( !isNone && isAvailableAlgo && algoIn->Label == anCurrentAlgo ){
|
||||
isAvailableChoiceAlgo = true;
|
||||
anCurrentAvailableAlgo = anAvailableAlgs.count() - 1 ;
|
||||
}
|
||||
}
|
||||
//set new algorithm list and select the current algorithm
|
||||
myDlg->tab( aDim )->setAvailableHyps( Algo, anAvailableAlgs );
|
||||
if ( isAvailableChoiceAlgo )
|
||||
setCurrentHyp( aDim, Algo, anCurrentAvailableAlgo );
|
||||
int aMaxShapeDim = ( myMaxShapeDim == -1 ) ? SMESH::DIM_3D : myMaxShapeDim;
|
||||
if ( isNone || isReqDisBound || !isAvailableChoiceAlgo ) {
|
||||
for ( int i = SMESH::DIM_0D; i <= aMaxShapeDim; i++ ) {
|
||||
if ( aDim != i ) {
|
||||
myDlg->disableTab( i );
|
||||
setCurrentHyp(i, Algo, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( !isNone ){
|
||||
if ( aDim == SMESH::DIM_2D){
|
||||
myDlg->disableTab( SMESH::DIM_3D );
|
||||
setCurrentHyp( SMESH::DIM_3D, Algo, -1);
|
||||
}
|
||||
for ( int i = aMaxShapeDim; i > SMESH::DIM_0D; i-- )
|
||||
{
|
||||
isReqDisBound = ( currentHyp( i, Algo ) < 0 ) ? true : myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty();
|
||||
if ( aMaxShapeDim != i && isReqDisBound) {
|
||||
for (int j = i - 1; j >= SMESH::DIM_0D; j--){
|
||||
myDlg->disableTab( j );
|
||||
setCurrentHyp( j , Algo, -1 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
myDlg->setHypoSets( SMESH::GetHypothesesSets( aDim, anCompareType ) );
|
||||
myDlg->enableTab( aDim );
|
||||
myDlg->setCurrentTab( aDim );
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp
|
||||
|
||||
public:
|
||||
enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
|
||||
enum MeshType{ MT_ANY = 0, MT_TRIANGULAR, MT_QUADRILATERAL, MT_TETRAHEDRAL, MT_HEXAHEDRAL };
|
||||
|
||||
typedef std::pair<SMESH::SMESH_Hypothesis_var, QString> THypItem;
|
||||
typedef QList< THypItem > THypList;
|
||||
@ -83,6 +84,7 @@ protected slots:
|
||||
void processSet();
|
||||
void onHypoCreated( int );
|
||||
void onHypoEdited( int );
|
||||
void onAlgoSetByMeshType( const int, const int );
|
||||
|
||||
private:
|
||||
typedef QList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
|
||||
@ -125,7 +127,8 @@ private:
|
||||
char* isSubmeshIgnored() const;
|
||||
_PTR(SObject) getSubmeshByGeom() const;
|
||||
void selectObject( _PTR(SObject) ) const;
|
||||
|
||||
void createMeshTypeList( QStringList& );
|
||||
void setAvailableMeshType( const QStringList& );
|
||||
private:
|
||||
SMESHGUI_MeshDlg* myDlg;
|
||||
SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
|
||||
@ -136,13 +139,12 @@ private:
|
||||
TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
|
||||
TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
|
||||
// edited mesh/sub-mesh
|
||||
|
||||
// hypdata corresponding to hypotheses present in myDlg
|
||||
THypDataList myAvailableHypData[4][NbHypTypes];
|
||||
|
||||
bool myIgnoreAlgoSelection;
|
||||
HypothesesSet* myHypoSet;
|
||||
int myDim, myType;
|
||||
int myDim, myType, myMaxShapeDim;
|
||||
|
||||
QString myObjectToSelect;
|
||||
};
|
||||
|
@ -5977,6 +5977,10 @@ Please specify them and try again</translation>
|
||||
<source>MESH</source>
|
||||
<translation>Mesh</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MESH_TYPE</source>
|
||||
<translation>Mesh type</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME</source>
|
||||
<translation>Name</translation>
|
||||
@ -6032,6 +6036,26 @@ Please specify it and try again</translation>
|
||||
<source>MESH_IS_NULL</source>
|
||||
<translation>Mesh is null</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_ANY</source>
|
||||
<translation>Any</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_HEXAHEDRAL</source>
|
||||
<translation>Hexahedral</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_TETRAHEDRAL</source>
|
||||
<translation>Tetrahedral</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_TRIANGULAR</source>
|
||||
<translation>Triangular</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_QUADRILATERAL</source>
|
||||
<translation>Quadrilaterial</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME_OF_MESH_IS_EMPTY</source>
|
||||
<translation>Name of mesh is empty
|
||||
|
@ -5971,6 +5971,10 @@ Indiquez-les et essayez de nouveau</translation>
|
||||
<source>MESH</source>
|
||||
<translation>Maillage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MESH_TYPE</source>
|
||||
<translation type="unfinished">Mesh type</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME</source>
|
||||
<translation>Nom</translation>
|
||||
@ -6026,6 +6030,26 @@ Spécifiez-le et essayez de nouveau</translation>
|
||||
<source>MESH_IS_NULL</source>
|
||||
<translation>Le maillage est nul</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_ANY</source>
|
||||
<translation type="unfinished">Any</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_HEXAHEDRAL</source>
|
||||
<translation type="unfinished">Hexahedral</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_TETRAHEDRAL</source>
|
||||
<translation type="unfinished">Tetrahedral</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_TRIANGULAR</source>
|
||||
<translation type="unfinished">Triangular</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MT_QUADRILATERAL</source>
|
||||
<translation>Quadrilaterial</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME_OF_MESH_IS_EMPTY</source>
|
||||
<translation>Le nom du maillage est vide
|
||||
|
@ -26,6 +26,11 @@
|
||||
//
|
||||
#include "SMESH_Block.hxx"
|
||||
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_MeshVolume.hxx"
|
||||
#include "SMDS_VolumeTool.hxx"
|
||||
#include "SMESH_MeshAlgos.hxx"
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <BRepAdaptor_Curve2d.hxx>
|
||||
#include <BRepAdaptor_Surface.hxx>
|
||||
@ -56,10 +61,7 @@
|
||||
#include <math_Matrix.hxx>
|
||||
#include <math_Vector.hxx>
|
||||
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_MeshVolume.hxx"
|
||||
#include "SMDS_VolumeTool.hxx"
|
||||
#include "utilities.h"
|
||||
#include <utilities.h>
|
||||
|
||||
#include <list>
|
||||
#include <limits>
|
||||
@ -309,24 +311,15 @@ gp_XYZ SMESH_Block::TFace::Point( const gp_XYZ& theParams ) const
|
||||
|
||||
namespace
|
||||
{
|
||||
inline
|
||||
bool isPntInTria( const gp_XY& p, const gp_XY& t0, const gp_XY& t1, const gp_XY& t2 )
|
||||
{
|
||||
const double // matrix 2x2
|
||||
T11 = t0.X()-t2.X(), T12 = t1.X()-t2.X(),
|
||||
T21 = t0.Y()-t2.Y(), T22 = t1.Y()-t2.Y();
|
||||
const double Tdet = T11*T22 - T12*T21; // matrix determinant
|
||||
if ( Abs( Tdet ) < std::numeric_limits<double>::min() )
|
||||
return false;
|
||||
// matrix inverse
|
||||
const double t11 = T22, t12 = -T12, t21 = -T21, t22 = T11;
|
||||
// vector
|
||||
const double r11 = p.X()-t2.X(), r12 = p.Y()-t2.Y();
|
||||
// barycentric coordinates: mutiply matrix by vector
|
||||
const double bc0 = (t11 * r11 + t12 * r12)/Tdet;
|
||||
const double bc1 = (t21 * r11 + t22 * r12)/Tdet;
|
||||
double bc0, bc1;
|
||||
SMESH_MeshAlgos::GetBarycentricCoords( p, t0, t1, t2, bc0, bc1 );
|
||||
return ( bc0 >= 0. && bc1 >= 0. && bc0 + bc1 <= 1. );
|
||||
}
|
||||
|
||||
inline
|
||||
bool isPntInQuad( const gp_XY& p,
|
||||
const gp_XY& q0, const gp_XY& q1, const gp_XY& q2, const gp_XY& q3 )
|
||||
{
|
||||
|
@ -68,20 +68,19 @@ class SMESHUtils_EXPORT SMESH_Block: public math_FunctionSetWithDerivatives
|
||||
// ----------------------------
|
||||
ID_NONE = 0,
|
||||
|
||||
ID_V000 = 1, ID_V100, ID_V010, ID_V110, ID_V001, ID_V101, ID_V011, ID_V111,
|
||||
ID_V000 = 1, ID_V100, ID_V010, ID_V110, ID_V001, ID_V101, ID_V011, ID_V111, // 1-8
|
||||
|
||||
ID_Ex00, ID_Ex10, ID_Ex01, ID_Ex11,
|
||||
ID_E0y0, ID_E1y0, ID_E0y1, ID_E1y1,
|
||||
ID_E00z, ID_E10z, ID_E01z, ID_E11z,
|
||||
ID_Ex00, ID_Ex10, ID_Ex01, ID_Ex11, // 9-12
|
||||
ID_E0y0, ID_E1y0, ID_E0y1, ID_E1y1, // 13-16
|
||||
ID_E00z, ID_E10z, ID_E01z, ID_E11z, // 17-20
|
||||
|
||||
ID_Fxy0, ID_Fxy1, ID_Fx0z, ID_Fx1z, ID_F0yz, ID_F1yz,
|
||||
ID_Fxy0, ID_Fxy1, ID_Fx0z, ID_Fx1z, ID_F0yz, ID_F1yz, // 21-26
|
||||
|
||||
ID_Shell
|
||||
};
|
||||
enum { // to use TShapeID for indexing certain type subshapes
|
||||
ID_Shell, // 27
|
||||
|
||||
// to use TShapeID for indexing certain type subshapes
|
||||
|
||||
ID_FirstV = ID_V000, ID_FirstE = ID_Ex00, ID_FirstF = ID_Fxy0
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -285,7 +284,7 @@ public:
|
||||
std::list< int > & theNbEdgesInWires,
|
||||
TopoDS_Vertex theFirstVertex=TopoDS_Vertex(),
|
||||
const bool theShapeAnalysisAlgo=false);
|
||||
// Return nb wires and a list of oredered edges.
|
||||
// Return nb wires and a list of ordered edges.
|
||||
// It is used to assign indices to subshapes.
|
||||
// theFirstVertex may be NULL.
|
||||
// Always try to set a seam edge first
|
||||
|
@ -1386,6 +1386,39 @@ double SMESH_MeshAlgos::GetDistance( const SMDS_MeshFace* face,
|
||||
return badDistance;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Returns barycentric coordinates of a point within a triangle.
|
||||
* A not returned bc2 = 1. - bc0 - bc1.
|
||||
* The point lies within the triangle if ( bc0 >= 0 && bc1 >= 0 && bc0+bc1 <= 1 )
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMESH_MeshAlgos::GetBarycentricCoords( const gp_XY& p,
|
||||
const gp_XY& t0,
|
||||
const gp_XY& t1,
|
||||
const gp_XY& t2,
|
||||
double & bc0,
|
||||
double & bc1)
|
||||
{
|
||||
const double // matrix 2x2
|
||||
T11 = t0.X()-t2.X(), T12 = t1.X()-t2.X(),
|
||||
T21 = t0.Y()-t2.Y(), T22 = t1.Y()-t2.Y();
|
||||
const double Tdet = T11*T22 - T12*T21; // matrix determinant
|
||||
if ( Abs( Tdet ) < std::numeric_limits<double>::min() )
|
||||
{
|
||||
bc0 = bc1 = 2.;
|
||||
return;
|
||||
}
|
||||
// matrix inverse
|
||||
const double t11 = T22, t12 = -T12, t21 = -T21, t22 = T11;
|
||||
// vector
|
||||
const double r11 = p.X()-t2.X(), r12 = p.Y()-t2.Y();
|
||||
// barycentric coordinates: mutiply matrix by vector
|
||||
bc0 = (t11 * r11 + t12 * r12)/Tdet;
|
||||
bc1 = (t21 * r11 + t22 * r12)/Tdet;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindFaceInSet
|
||||
//purpose : Return a face having linked nodes n1 and n2 and which is
|
||||
|
@ -97,9 +97,16 @@ namespace SMESH_MeshAlgos
|
||||
/*!
|
||||
* \brief Return true if the point is IN or ON of the element
|
||||
*/
|
||||
SMESHUtils_EXPORT bool IsOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
|
||||
SMESHUtils_EXPORT
|
||||
bool IsOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
|
||||
|
||||
SMESHUtils_EXPORT double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point );
|
||||
SMESHUtils_EXPORT
|
||||
double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point );
|
||||
|
||||
SMESHUtils_EXPORT
|
||||
void GetBarycentricCoords( const gp_XY& point,
|
||||
const gp_XY& t0, const gp_XY& t1, const gp_XY& t2,
|
||||
double & bc0, double & bc1);
|
||||
|
||||
/*!
|
||||
* Return a face having linked nodes n1 and n2 and which is
|
||||
@ -107,35 +114,40 @@ namespace SMESH_MeshAlgos
|
||||
* - in elemSet provided that !elemSet.empty()
|
||||
* i1 and i2 optionally returns indices of n1 and n2
|
||||
*/
|
||||
SMESHUtils_EXPORT const SMDS_MeshElement*
|
||||
FindFaceInSet(const SMDS_MeshNode* n1,
|
||||
const SMDS_MeshNode* n2,
|
||||
const TIDSortedElemSet& elemSet,
|
||||
const TIDSortedElemSet& avoidSet,
|
||||
int* i1=0,
|
||||
int* i2=0);
|
||||
SMESHUtils_EXPORT
|
||||
const SMDS_MeshElement* FindFaceInSet(const SMDS_MeshNode* n1,
|
||||
const SMDS_MeshNode* n2,
|
||||
const TIDSortedElemSet& elemSet,
|
||||
const TIDSortedElemSet& avoidSet,
|
||||
int* i1=0,
|
||||
int* i2=0);
|
||||
/*!
|
||||
* \brief Calculate normal of a mesh face
|
||||
*/
|
||||
SMESHUtils_EXPORT bool FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool normalized=true);
|
||||
SMESHUtils_EXPORT
|
||||
bool FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool normalized=true);
|
||||
|
||||
/*!
|
||||
* \brief Return nodes common to two elements
|
||||
*/
|
||||
SMESHUtils_EXPORT std::vector< const SMDS_MeshNode*> GetCommonNodes(const SMDS_MeshElement* e1,
|
||||
SMESHUtils_EXPORT
|
||||
std::vector< const SMDS_MeshNode*> GetCommonNodes(const SMDS_MeshElement* e1,
|
||||
const SMDS_MeshElement* e2);
|
||||
|
||||
/*!
|
||||
* \brief Return SMESH_NodeSearcher. The caller is responsible for deleteing it
|
||||
*/
|
||||
SMESHUtils_EXPORT SMESH_NodeSearcher* GetNodeSearcher( SMDS_Mesh& mesh );
|
||||
SMESHUtils_EXPORT
|
||||
SMESH_NodeSearcher* GetNodeSearcher( SMDS_Mesh& mesh );
|
||||
|
||||
/*!
|
||||
* \brief Return SMESH_ElementSearcher. The caller is responsible for deleting it
|
||||
*/
|
||||
SMESHUtils_EXPORT SMESH_ElementSearcher* GetElementSearcher( SMDS_Mesh& mesh );
|
||||
SMESHUtils_EXPORT SMESH_ElementSearcher* GetElementSearcher( SMDS_Mesh& mesh,
|
||||
SMDS_ElemIteratorPtr elemIt );
|
||||
SMESHUtils_EXPORT
|
||||
SMESH_ElementSearcher* GetElementSearcher( SMDS_Mesh& mesh );
|
||||
SMESHUtils_EXPORT
|
||||
SMESH_ElementSearcher* GetElementSearcher( SMDS_Mesh& mesh,
|
||||
SMDS_ElemIteratorPtr elemIt );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -29,9 +29,10 @@
|
||||
|
||||
#include "SMESH_Utils.hxx"
|
||||
|
||||
#include <SMDS_MeshNode.hxx>
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
|
||||
#include <gp_XYZ.hxx>
|
||||
#include <gp_XY.hxx>
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
@ -42,7 +43,7 @@ typedef std::map<const SMDS_MeshElement*,
|
||||
std::list<const SMDS_MeshElement*>, TIDCompare > TElemOfElemListMap;
|
||||
typedef std::map<const SMDS_MeshElement*,
|
||||
std::list<const SMDS_MeshNode*>, TIDCompare > TElemOfNodeListMap;
|
||||
typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
|
||||
typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
|
||||
|
||||
//!< Set of elements sorted by ID, to be used to assure predictability of edition
|
||||
typedef std::set< const SMDS_MeshElement*, TIDCompare > TIDSortedElemSet;
|
||||
@ -50,8 +51,8 @@ typedef std::set< const SMDS_MeshNode*, TIDCompare > TIDSortedNodeSet;
|
||||
|
||||
typedef std::pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink;
|
||||
|
||||
struct faceQuadStruct; // defined in StdMeshers_Quadrangle_2D.hxx
|
||||
typedef boost::shared_ptr<faceQuadStruct> TFaceQuadStructPtr;
|
||||
struct FaceQuadStruct; // defined in StdMeshers_Quadrangle_2D.hxx
|
||||
typedef boost::shared_ptr<FaceQuadStruct> TFaceQuadStructPtr;
|
||||
|
||||
|
||||
namespace SMESHUtils
|
||||
@ -137,6 +138,10 @@ typedef struct uvPtStruct
|
||||
double x, y; // 2d parameter, normalized [0,1]
|
||||
const SMDS_MeshNode * node;
|
||||
|
||||
uvPtStruct(): node(NULL) {}
|
||||
|
||||
inline gp_XY UV() const { return gp_XY( u, v ); }
|
||||
|
||||
struct NodeAccessor // accessor to iterate on nodes in UVPtStructVec
|
||||
{
|
||||
static const SMDS_MeshNode* value(std::vector< uvPtStruct >::const_iterator it)
|
||||
|
@ -2075,6 +2075,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand )
|
||||
"GetSubMeshElementsId","GetSubMeshNodesId","GetSubMeshElementType","Dump","GetNodeXYZ",
|
||||
"GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes",
|
||||
"GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces",
|
||||
"GetElemFaceNodes", "GetFaceNormal", "FindElementByNodes",
|
||||
"IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor",
|
||||
"Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder"
|
||||
,"" }; // <- mark of end
|
||||
|
@ -240,13 +240,20 @@ namespace SMESH
|
||||
template<class TArray>
|
||||
void DumpArray(const TArray& theArray, TPythonDump & theStream)
|
||||
{
|
||||
theStream << "[ ";
|
||||
for (int i = 1; i <= theArray.length(); i++) {
|
||||
theStream << theArray[i-1];
|
||||
if ( i < theArray.length() )
|
||||
theStream << ", ";
|
||||
if ( theArray.length() == 0 )
|
||||
{
|
||||
theStream << "[]";
|
||||
}
|
||||
else
|
||||
{
|
||||
theStream << "[ ";
|
||||
for (int i = 1; i <= theArray.length(); i++) {
|
||||
theStream << theArray[i-1];
|
||||
if ( i < theArray.length() )
|
||||
theStream << ", ";
|
||||
}
|
||||
theStream << " ]";
|
||||
}
|
||||
theStream << " ]";
|
||||
}
|
||||
|
||||
TPythonDump&
|
||||
@ -263,6 +270,13 @@ namespace SMESH
|
||||
return *this;
|
||||
}
|
||||
|
||||
TPythonDump&
|
||||
TPythonDump::operator<<(const SMESH::nodes_array& theArg)
|
||||
{
|
||||
DumpArray( theArg, *this );
|
||||
return *this;
|
||||
}
|
||||
|
||||
TPythonDump&
|
||||
TPythonDump::operator<<(const SMESH::string_array& theArray)
|
||||
{
|
||||
@ -517,6 +531,11 @@ namespace SMESH
|
||||
DumpArray( *theList, *this );
|
||||
return *this;
|
||||
}
|
||||
TPythonDump& TPythonDump::operator<<(const GEOM::ListOfGO& theList)
|
||||
{
|
||||
DumpArray( theList, *this );
|
||||
return *this;
|
||||
}
|
||||
TPythonDump& TPythonDump::operator<<(const SMESH::ListOfIDSources& theList)
|
||||
{
|
||||
DumpArray( theList, *this );
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_Group.hxx"
|
||||
#include "SMESH_Group_i.hxx"
|
||||
#include "SMESH_MeshAlgos.hxx"
|
||||
#include "SMESH_MeshEditor.hxx"
|
||||
#include "SMESH_MeshEditor_i.hxx"
|
||||
#include "SMESH_MeshPartDS.hxx"
|
||||
@ -4023,6 +4024,32 @@ SMESH::long_array* SMESH_Mesh_i::GetElemFaceNodes(CORBA::Long elemId,
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetElemFaceNodes
|
||||
//purpose : Returns three components of normal of given mesh face.
|
||||
//=======================================================================
|
||||
|
||||
SMESH::double_array* SMESH_Mesh_i::GetFaceNormal(CORBA::Long elemId)
|
||||
{
|
||||
if ( _preMeshInfo )
|
||||
_preMeshInfo->FullLoadFromFile();
|
||||
|
||||
SMESH::double_array_var aResult = new SMESH::double_array();
|
||||
|
||||
if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() )
|
||||
{
|
||||
gp_XYZ normal;
|
||||
if ( SMESH_MeshAlgos::FaceNormal( mesh->FindElement(elemId), normal, /*normalized=*/true ))
|
||||
{
|
||||
aResult->length( 3 );
|
||||
aResult[ 0 ] = normal.X();
|
||||
aResult[ 1 ] = normal.Y();
|
||||
aResult[ 2 ] = normal.Z();
|
||||
}
|
||||
}
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindElementByNodes
|
||||
//purpose : Returns an element based on all given nodes.
|
||||
|
@ -532,6 +532,11 @@ public:
|
||||
*/
|
||||
SMESH::long_array* GetElemFaceNodes(CORBA::Long elemId, CORBA::Short faceIndex);
|
||||
|
||||
/*!
|
||||
* Returns three components of normal of given mesh face (or an empty array in KO case)
|
||||
*/
|
||||
SMESH::double_array* GetFaceNormal(CORBA::Long faceId);
|
||||
|
||||
/*!
|
||||
* Returns an element based on all given nodes.
|
||||
*/
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
#include CORBA_SERVER_HEADER(SALOMEDS)
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
@ -162,6 +163,9 @@ namespace SMESH
|
||||
TPythonDump&
|
||||
operator<<(const SMESH::string_array& theArg);
|
||||
|
||||
TPythonDump&
|
||||
operator<<(const SMESH::nodes_array& theArg);
|
||||
|
||||
TPythonDump&
|
||||
operator<<(SMESH::SMESH_Hypothesis_ptr theArg);
|
||||
|
||||
@ -216,6 +220,9 @@ namespace SMESH
|
||||
TPythonDump&
|
||||
operator<<(const SMESH::ListOfGroups * theList);
|
||||
|
||||
TPythonDump&
|
||||
operator<<(const GEOM::ListOfGO& theList);
|
||||
|
||||
TPythonDump&
|
||||
operator<<(const SMESH::ListOfIDSources& theList);
|
||||
|
||||
|
@ -199,7 +199,8 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
|
||||
hyp.SetDeflection(deflection)
|
||||
return hyp
|
||||
|
||||
## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length
|
||||
## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with a length
|
||||
# that changes in arithmetic progression
|
||||
# @param start defines the length of the first segment
|
||||
# @param end defines the length of the last segment
|
||||
# @param reversedEdges is a list of edges to mesh using reversed orientation.
|
||||
@ -226,6 +227,32 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
|
||||
hyp.SetObjectEntry( entry )
|
||||
return hyp
|
||||
|
||||
## Defines "GeometricProgression" hypothesis to cut an edge in several
|
||||
# segments with a length that changes in Geometric progression
|
||||
# @param start defines the length of the first segment
|
||||
# @param ratio defines the common ratio of the geometric progression
|
||||
# @param reversedEdges is a list of edges to mesh using reversed orientation.
|
||||
# A list item can also be a tuple (edge, 1st_vertex_of_edge)
|
||||
# @param UseExisting if ==true - searches for an existing hypothesis created with
|
||||
# the same parameters, else (default) - creates a new one
|
||||
# @return an instance of StdMeshers_Geometric1D hypothesis
|
||||
# @ingroup l3_hypos_1dhyps
|
||||
def GeometricProgression(self, start, ratio, reversedEdges=[], UseExisting=0):
|
||||
reversedEdgeInd = self.ReversedEdgeIndices(reversedEdges)
|
||||
entry = self.MainShapeEntry()
|
||||
from salome.smesh.smeshBuilder import IsEqual
|
||||
compFun = lambda hyp, args: ( IsEqual(hyp.GetLength(1), args[0]) and \
|
||||
IsEqual(hyp.GetLength(0), args[1]) and \
|
||||
hyp.GetReversedEdges() == args[2] and \
|
||||
(not args[2] or hyp.GetObjectEntry() == args[3]))
|
||||
hyp = self.Hypothesis("GeometricProgression", [start, ratio, reversedEdgeInd, entry],
|
||||
UseExisting=UseExisting, CompareMethod=compFun)
|
||||
hyp.SetStartLength( start )
|
||||
hyp.SetCommonRatio( ratio )
|
||||
hyp.SetReversedEdges( reversedEdgeInd )
|
||||
hyp.SetObjectEntry( entry )
|
||||
return hyp
|
||||
|
||||
## Defines "FixedPoints1D" hypothesis to cut an edge using parameter
|
||||
# on curve from 0 to 1 (additionally it is neecessary to check
|
||||
# orientation of edges and create list of reversed edges if it is
|
||||
@ -237,7 +264,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
|
||||
# A list item can also be a tuple (edge, 1st_vertex_of_edge)
|
||||
# @param UseExisting if ==true - searches for an existing hypothesis created with
|
||||
# the same parameters, else (default) - creates a new one
|
||||
# @return an instance of StdMeshers_Arithmetic1D hypothesis
|
||||
# @return an instance of StdMeshers_FixedPoints1D hypothesis
|
||||
# @ingroup l3_hypos_1dhyps
|
||||
def FixedPoints1D(self, points, nbSegs=[1], reversedEdges=[], UseExisting=0):
|
||||
if not isinstance(reversedEdges,list): #old version script, before adding reversedEdges
|
||||
@ -295,12 +322,23 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
|
||||
hyp.SetDeflection(d)
|
||||
return hyp
|
||||
|
||||
## Defines "Propagation" hypothesis that propagates all other hypotheses on all other edges that are at
|
||||
# the opposite side in case of quadrangular faces
|
||||
## Defines "Propagation" hypothesis that propagates 1D hypotheses
|
||||
# from an edge where this hypothesis is assigned to
|
||||
# on all other edges that are at the opposite side in case of quadrangular faces
|
||||
# This hypothesis should be assigned to an edge to propagate a hypothesis from.
|
||||
# @ingroup l3_hypos_additi
|
||||
def Propagation(self):
|
||||
return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
|
||||
|
||||
## Defines "Propagation of Node Distribution" hypothesis that propagates
|
||||
# distribution of nodes from an edge where this hypothesis is assigned to,
|
||||
# to opposite edges of quadrangular faces, so that number of segments on all these
|
||||
# edges will be the same, as well as relations between segment lengths.
|
||||
# @ingroup l3_hypos_additi
|
||||
def PropagationOfDistribution(self):
|
||||
return self.Hypothesis("PropagOfDistribution", UseExisting=1,
|
||||
CompareMethod=self.CompareEqualHyp)
|
||||
|
||||
## Defines "AutomaticLength" hypothesis
|
||||
# @param fineness for the fineness [0-1]
|
||||
# @param UseExisting if ==true - searches for an existing hypothesis created with the
|
||||
@ -552,28 +590,56 @@ class StdMeshersBuilder_Quadrangle(Mesh_Algorithm):
|
||||
# same number of segments, the other pair must have an even difference
|
||||
# between the numbers of segments on the sides.
|
||||
# @param triangleVertex: vertex of a trilateral geometrical face, around which triangles
|
||||
# will be created while other elements will be quadrangles.
|
||||
# Vertex can be either a GEOM_Object or a vertex ID within the
|
||||
# shape to mesh
|
||||
# @param UseExisting: if ==true - searches for the existing hypothesis created with
|
||||
# the same parameters, else (default) - creates a new one
|
||||
# will be created while other elements will be quadrangles.
|
||||
# Vertex can be either a GEOM_Object or a vertex ID within the
|
||||
# shape to mesh
|
||||
# @param enfVertices: list of shapes defining positions where nodes (enforced nodes)
|
||||
# must be created by the mesher. Shapes can be of any type,
|
||||
# vertices of given shapes define positions of enforced nodes.
|
||||
# Only vertices successfully projected to the face are used.
|
||||
# @param enfPoint: list of points giving positions of enforced nodes.
|
||||
# Point can be defined either as SMESH.PointStruct's
|
||||
# ([SMESH.PointStruct(x1,y1,z1), SMESH.PointStruct(x2,y2,z2),...])
|
||||
# or triples of values ([[x1,y1,z1], [x2,y2,z2], ...]).
|
||||
# In the case if the defined QuadrangleParameters() refer to a sole face,
|
||||
# all given points must lie on this face, else the mesher fails.
|
||||
# @param UseExisting: if \c True - searches for the existing hypothesis created with
|
||||
# the same parameters, else (default) - creates a new one
|
||||
# @ingroup l3_hypos_quad
|
||||
def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0, UseExisting=0):
|
||||
import GEOM
|
||||
def QuadrangleParameters(self, quadType=StdMeshers.QUAD_STANDARD, triangleVertex=0,
|
||||
enfVertices=[],enfPoints=[],UseExisting=0):
|
||||
import GEOM, SMESH
|
||||
vertexID = triangleVertex
|
||||
if isinstance( triangleVertex, GEOM._objref_GEOM_Object ):
|
||||
vertexID = self.mesh.geompyD.GetSubShapeID( self.mesh.geom, triangleVertex )
|
||||
if isinstance( enfVertices, int ) and not enfPoints and not UseExisting:
|
||||
# a call of old syntax, before inserting enfVertices and enfPoints before UseExisting
|
||||
UseExisting, enfVertices = enfVertices, []
|
||||
pStructs, xyz = [], []
|
||||
for p in enfPoints:
|
||||
if isinstance( p, SMESH.PointStruct ):
|
||||
xyz.append(( p.x, p.y, p.z ))
|
||||
pStructs.append( p )
|
||||
else:
|
||||
xyz.append(( p[0], p[1], p[2] ))
|
||||
pStructs.append( SMESH.PointStruct( p[0], p[1], p[2] ))
|
||||
if not self.params:
|
||||
compFun = lambda hyp,args: \
|
||||
hyp.GetQuadType() == args[0] and \
|
||||
( hyp.GetTriaVertex()==args[1] or ( hyp.GetTriaVertex()<1 and args[1]<1))
|
||||
self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID],
|
||||
(hyp.GetTriaVertex()==args[1] or ( hyp.GetTriaVertex()<1 and args[1]<1)) and \
|
||||
((hyp.GetEnforcedNodes()) == (args[2],args[3])) # True w/o enfVertices only
|
||||
entries = [ shape.GetStudyEntry() for shape in enfVertices ]
|
||||
self.params = self.Hypothesis("QuadrangleParams", [quadType,vertexID,entries,xyz],
|
||||
UseExisting = UseExisting, CompareMethod=compFun)
|
||||
pass
|
||||
if self.params.GetQuadType() != quadType:
|
||||
self.params.SetQuadType(quadType)
|
||||
if vertexID > 0:
|
||||
self.params.SetTriaVertex( vertexID )
|
||||
from salome.smesh.smeshBuilder import AssureGeomPublished
|
||||
for v in enfVertices:
|
||||
AssureGeomPublished( self.mesh, v )
|
||||
self.params.SetEnforcedNodes( enfVertices, pStructs )
|
||||
return self.params
|
||||
|
||||
## Defines "QuadrangleParams" hypothesis with a type of quadrangulation that only
|
||||
@ -980,7 +1046,8 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
|
||||
return hyp
|
||||
|
||||
## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
|
||||
# to build between the inner and the outer shells with a length that changes in arithmetic progression
|
||||
# to build between the inner and the outer shells with a length that changes
|
||||
# in arithmetic progression
|
||||
# @param start the length of the first segment
|
||||
# @param end the length of the last segment
|
||||
def Arithmetic1D(self, start, end ):
|
||||
@ -992,6 +1059,20 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
|
||||
hyp.SetLength(end , 0)
|
||||
return hyp
|
||||
|
||||
## Defines "GeometricProgression" hypothesis, specifying the distribution of segments
|
||||
# to build between the inner and the outer shells with a length that changes
|
||||
# in Geometric progression
|
||||
# @param start the length of the first segment
|
||||
# @param ratio the common ratio of the geometric progression
|
||||
def GeometricProgression(self, start, ratio ):
|
||||
if self.algoType != "RadialPrism_3D":
|
||||
print "Prism_3D algorith doesn't support any hyposesis"
|
||||
return None
|
||||
hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
|
||||
hyp.SetStartLength( start )
|
||||
hyp.SetCommonRatio( ratio )
|
||||
return hyp
|
||||
|
||||
## Defines "StartEndLength" hypothesis, specifying distribution of segments
|
||||
# to build between the inner and the outer shells as geometric length increasing
|
||||
# @param start for the length of the first segment
|
||||
@ -1148,6 +1229,16 @@ class StdMeshersBuilder_RadialQuadrangle1D2D(Mesh_Algorithm):
|
||||
hyp.SetLength(end , 0)
|
||||
return hyp
|
||||
|
||||
## Defines "GeometricProgression" hypothesis, specifying the distribution of segments
|
||||
# with a length that changes in Geometric progression
|
||||
# @param start the length of the first segment
|
||||
# @param ratio the common ratio of the geometric progression
|
||||
def GeometricProgression(self, start, ratio ):
|
||||
hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
|
||||
hyp.SetStartLength( start )
|
||||
hyp.SetCommonRatio( ratio )
|
||||
return hyp
|
||||
|
||||
## Defines "StartEndLength" hypothesis, specifying distribution of segments
|
||||
# as geometric length increasing
|
||||
# @param start for the length of the first segment
|
||||
|
@ -2418,6 +2418,12 @@ class Mesh:
|
||||
def GetElemFaceNodes(self,elemId, faceIndex):
|
||||
return self.mesh.GetElemFaceNodes(elemId, faceIndex)
|
||||
|
||||
## Returns three components of normal of given mesh face
|
||||
# (or an empty array in KO case)
|
||||
# @ingroup l1_meshinfo
|
||||
def GetFaceNormal(self, faceId):
|
||||
return self.mesh.GetFaceNormal(faceId)
|
||||
|
||||
## Returns an element based on all given nodes.
|
||||
# @ingroup l1_meshinfo
|
||||
def FindElementByNodes(self,nodes):
|
||||
@ -3181,7 +3187,8 @@ class Mesh:
|
||||
# Note that nodes built on edges and boundary nodes are always fixed.
|
||||
# @param MaxNbOfIterations the maximum number of iterations
|
||||
# @param MaxAspectRatio varies in range [1.0, inf]
|
||||
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
|
||||
# @param Method is either Laplacian (SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH)
|
||||
# or Centroidal (SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)
|
||||
# @return TRUE in case of success, FALSE otherwise.
|
||||
# @ingroup l2_modif_smooth
|
||||
def Smooth(self, IDsOfElements, IDsOfFixedNodes,
|
||||
@ -3199,7 +3206,8 @@ class Mesh:
|
||||
# Note that nodes built on edges and boundary nodes are always fixed.
|
||||
# @param MaxNbOfIterations the maximum number of iterations
|
||||
# @param MaxAspectRatio varies in range [1.0, inf]
|
||||
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
|
||||
# @param Method is either Laplacian (SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH)
|
||||
# or Centroidal (SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)
|
||||
# @return TRUE in case of success, FALSE otherwise.
|
||||
# @ingroup l2_modif_smooth
|
||||
def SmoothObject(self, theObject, IDsOfFixedNodes,
|
||||
@ -3215,7 +3223,8 @@ class Mesh:
|
||||
# Note that nodes built on edges and boundary nodes are always fixed.
|
||||
# @param MaxNbOfIterations the maximum number of iterations
|
||||
# @param MaxAspectRatio varies in range [1.0, inf]
|
||||
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
|
||||
# @param Method is either Laplacian (SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH)
|
||||
# or Centroidal (SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)
|
||||
# @return TRUE in case of success, FALSE otherwise.
|
||||
# @ingroup l2_modif_smooth
|
||||
def SmoothParametric(self, IDsOfElements, IDsOfFixedNodes,
|
||||
@ -3233,7 +3242,8 @@ class Mesh:
|
||||
# Note that nodes built on edges and boundary nodes are always fixed.
|
||||
# @param MaxNbOfIterations the maximum number of iterations
|
||||
# @param MaxAspectRatio varies in range [1.0, inf]
|
||||
# @param Method Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
|
||||
# @param Method is either Laplacian (SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH)
|
||||
# or Centroidal (SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)
|
||||
# @return TRUE in case of success, FALSE otherwise.
|
||||
# @ingroup l2_modif_smooth
|
||||
def SmoothParametricObject(self, theObject, IDsOfFixedNodes,
|
||||
|
@ -267,21 +267,26 @@ class Mesh_Algorithm:
|
||||
# @param thickness total thickness of layers of prisms
|
||||
# @param numberOfLayers number of layers of prisms
|
||||
# @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
|
||||
# @param ignoreFaces list of geometrical faces (or their ids) not to generate layers on
|
||||
# @param faces list of geometrical faces (or their ids).
|
||||
# Viscous layers are either generated on these faces or not, depending on
|
||||
# the value of \a isFacesToIgnore parameter.
|
||||
# @param isFacesToIgnore if \c True, the Viscous layers are not generated on the
|
||||
# faces specified by the previous parameter (\a faces).
|
||||
# @ingroup l3_hypos_additi
|
||||
def ViscousLayers(self, thickness, numberOfLayers, stretchFactor, ignoreFaces=[]):
|
||||
def ViscousLayers(self, thickness, numberOfLayers, stretchFactor,
|
||||
faces=[], isFacesToIgnore=True ):
|
||||
if not isinstance(self.algo, SMESH._objref_SMESH_3D_Algo):
|
||||
raise TypeError, "ViscousLayers are supported by 3D algorithms only"
|
||||
if not "ViscousLayers" in self.GetCompatibleHypothesis():
|
||||
raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName()
|
||||
if ignoreFaces and isinstance( ignoreFaces[0], geomBuilder.GEOM._objref_GEOM_Object ):
|
||||
ignoreFaces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in ignoreFaces ]
|
||||
if faces and isinstance( faces[0], geomBuilder.GEOM._objref_GEOM_Object ):
|
||||
faces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in faces ]
|
||||
hyp = self.Hypothesis("ViscousLayers",
|
||||
[thickness, numberOfLayers, stretchFactor, ignoreFaces])
|
||||
[thickness, numberOfLayers, stretchFactor, faces])
|
||||
hyp.SetTotalThickness(thickness)
|
||||
hyp.SetNumberLayers(numberOfLayers)
|
||||
hyp.SetStretchFactor(stretchFactor)
|
||||
hyp.SetIgnoreFaces(ignoreFaces)
|
||||
hyp.SetFaces(faces, isFacesToIgnore)
|
||||
return hyp
|
||||
|
||||
## Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral
|
||||
@ -290,9 +295,9 @@ class Mesh_Algorithm:
|
||||
# @param thickness total thickness of layers of quadrilaterals
|
||||
# @param numberOfLayers number of layers
|
||||
# @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
|
||||
# @param edges list of geometrical edge (or their ids).
|
||||
# @param edges list of geometrical edges (or their ids).
|
||||
# Viscous layers are either generated on these edges or not, depending on
|
||||
# the values of \a isEdgesToIgnore parameter.
|
||||
# the value of \a isEdgesToIgnore parameter.
|
||||
# @param isEdgesToIgnore if \c True, the Viscous layers are not generated on the
|
||||
# edges specified by the previous parameter (\a edges).
|
||||
# @ingroup l3_hypos_additi
|
||||
@ -313,7 +318,7 @@ class Mesh_Algorithm:
|
||||
hyp.SetEdges(edges, isEdgesToIgnore)
|
||||
return hyp
|
||||
|
||||
## Transform a list of ether edges or tuples (edge, 1st_vertex_of_edge)
|
||||
## Transform a list of either edges or tuples (edge, 1st_vertex_of_edge)
|
||||
# into a list acceptable to SetReversedEdges() of some 1D hypotheses
|
||||
# @ingroup l3_hypos_1dhyps
|
||||
def ReversedEdgeIndices(self, reverseList):
|
||||
|
@ -75,8 +75,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
|
||||
# header files / no moc processing
|
||||
SET(StdMeshers_HEADERS
|
||||
StdMeshers_LocalLength.hxx
|
||||
StdMeshers_Reversible1D.hxx
|
||||
StdMeshers_StartEndLength.hxx
|
||||
StdMeshers_Arithmetic1D.hxx
|
||||
StdMeshers_Geometric1D.hxx
|
||||
StdMeshers_FixedPoints1D.hxx
|
||||
StdMeshers_NumberOfSegments.hxx
|
||||
StdMeshers_Deflection1D.hxx
|
||||
@ -136,8 +138,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
|
||||
# sources / static
|
||||
SET(StdMeshers_SOURCES
|
||||
StdMeshers_LocalLength.cxx
|
||||
StdMeshers_Reversible1D.cxx
|
||||
StdMeshers_StartEndLength.cxx
|
||||
StdMeshers_Arithmetic1D.cxx
|
||||
StdMeshers_Geometric1D.cxx
|
||||
StdMeshers_FixedPoints1D.cxx
|
||||
StdMeshers_NumberOfSegments.cxx
|
||||
StdMeshers_Deflection1D.cxx
|
||||
|
@ -32,11 +32,12 @@
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <Bnd_Box.hxx>
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include <Bnd_Box.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include <gp_Vec.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=======================================================================
|
||||
@ -48,10 +49,23 @@ StdMeshers_CartesianParameters3D::StdMeshers_CartesianParameters3D(int h
|
||||
int studyId,
|
||||
SMESH_Gen * gen)
|
||||
: SMESH_Hypothesis(hypId, studyId, gen),
|
||||
_sizeThreshold( 4.0 ) // default according to the customer specification
|
||||
_sizeThreshold( 4.0 ), // default according to the customer specification
|
||||
_toAddEdges( false )
|
||||
{
|
||||
_name = "CartesianParameters3D"; // used by "Cartesian_3D"
|
||||
_param_algo_dim = 3; // 3D
|
||||
|
||||
_axisDirs[0] = 1.;
|
||||
_axisDirs[1] = 0.;
|
||||
_axisDirs[2] = 0.;
|
||||
|
||||
_axisDirs[3] = 0.;
|
||||
_axisDirs[4] = 1.;
|
||||
_axisDirs[5] = 0.;
|
||||
|
||||
_axisDirs[6] = 0.;
|
||||
_axisDirs[7] = 0.;
|
||||
_axisDirs[8] = 1.;
|
||||
}
|
||||
|
||||
|
||||
@ -308,6 +322,44 @@ void StdMeshers_CartesianParameters3D::GetCoordinates(std::vector<double>& xNode
|
||||
zNodes = _coords[2];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetAxisDirs
|
||||
//purpose : Sets directions of axes
|
||||
//=======================================================================
|
||||
|
||||
void StdMeshers_CartesianParameters3D::SetAxisDirs(const double* the9DirComps)
|
||||
throw ( SALOME_Exception )
|
||||
{
|
||||
gp_Vec x( the9DirComps[0],
|
||||
the9DirComps[1],
|
||||
the9DirComps[2] );
|
||||
gp_Vec y( the9DirComps[3],
|
||||
the9DirComps[4],
|
||||
the9DirComps[5] );
|
||||
gp_Vec z( the9DirComps[6],
|
||||
the9DirComps[7],
|
||||
the9DirComps[8] );
|
||||
if ( x.Magnitude() < RealSmall() ||
|
||||
y.Magnitude() < RealSmall() ||
|
||||
z.Magnitude() < RealSmall() )
|
||||
throw SALOME_Exception("Zero magnitude of axis direction");
|
||||
|
||||
if ( x.IsParallel( y, M_PI / 180. ) ||
|
||||
x.IsParallel( z, M_PI / 180. ) ||
|
||||
y.IsParallel( z, M_PI / 180. ))
|
||||
throw SALOME_Exception("Parallel axis directions");
|
||||
|
||||
bool isChanged = false;
|
||||
for ( int i = 0; i < 9; ++i )
|
||||
{
|
||||
if ( Abs( _axisDirs[i] - the9DirComps[i] ) > 1e-7 )
|
||||
isChanged = true;
|
||||
_axisDirs[i] = the9DirComps[i];
|
||||
}
|
||||
if ( isChanged )
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetGrid
|
||||
//purpose : Return coordinates of node positions along the three axes
|
||||
@ -332,6 +384,33 @@ double StdMeshers_CartesianParameters3D::GetSizeThreshold() const
|
||||
return _sizeThreshold;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetToAddEdges
|
||||
//purpose : Enables implementation of geometrical edges into the mesh. If this feature
|
||||
// is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
|
||||
// they don't coincide with the grid lines
|
||||
//=======================================================================
|
||||
|
||||
void StdMeshers_CartesianParameters3D::SetToAddEdges(bool toAdd)
|
||||
{
|
||||
if ( _toAddEdges != toAdd )
|
||||
{
|
||||
_toAddEdges = toAdd;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetToAddEdges
|
||||
//purpose : Returns true if implementation of geometrical edges into the
|
||||
// mesh is enabled
|
||||
//=======================================================================
|
||||
|
||||
bool StdMeshers_CartesianParameters3D::GetToAddEdges() const
|
||||
{
|
||||
return _toAddEdges;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsDefined
|
||||
//purpose : Return true if parameters are well defined
|
||||
@ -369,6 +448,7 @@ std::ostream & StdMeshers_CartesianParameters3D::SaveTo(std::ostream & save)
|
||||
for ( size_t j = 0; j < _spaceFunctions[i].size(); ++j )
|
||||
save << _spaceFunctions[i][j] << " ";
|
||||
}
|
||||
save << _toAddEdges << " ";
|
||||
|
||||
return save;
|
||||
}
|
||||
@ -382,7 +462,7 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load)
|
||||
{
|
||||
bool ok;
|
||||
|
||||
ok = (load >> _sizeThreshold );
|
||||
ok = ( load >> _sizeThreshold );
|
||||
for ( int ax = 0; ax < 3; ++ax )
|
||||
{
|
||||
if (ok)
|
||||
@ -419,6 +499,9 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
load >> _toAddEdges;
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
|
@ -100,6 +100,10 @@ public:
|
||||
std::vector<double>& yNodes,
|
||||
std::vector<double>& zNodes,
|
||||
const Bnd_Box& bndBox) const throw ( SALOME_Exception );
|
||||
|
||||
void SetAxisDirs(const double* the9DirComps) throw ( SALOME_Exception );
|
||||
const double* GetAxisDirs() const { return _axisDirs; }
|
||||
|
||||
/*!
|
||||
* Set size threshold. A polyhedral cell got by cutting an initial
|
||||
* hexahedron by geometry boundary is considered small and is removed if
|
||||
@ -111,6 +115,14 @@ public:
|
||||
*/
|
||||
double GetSizeThreshold() const;
|
||||
|
||||
/*!
|
||||
* \brief Enables implementation of geometrical edges into the mesh. If this feature
|
||||
* is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
|
||||
* they don't coincide with the grid lines
|
||||
*/
|
||||
void SetToAddEdges(bool toAdd);
|
||||
bool GetToAddEdges() const;
|
||||
|
||||
/*!
|
||||
* \brief Return true if parameters are well defined
|
||||
*/
|
||||
@ -138,7 +150,10 @@ public:
|
||||
std::vector<std::string> _spaceFunctions[3];
|
||||
std::vector<double> _internalPoints[3];
|
||||
|
||||
double _axisDirs[9];
|
||||
|
||||
double _sizeThreshold;
|
||||
bool _toAddEdges;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -251,7 +251,8 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const StdMeshers_FaceSide* theSide,
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes)
|
||||
StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes,
|
||||
const TopoDS_Face& theFace)
|
||||
{
|
||||
myEdge.resize( 1 );
|
||||
myEdgeID.resize( 1, -1 );
|
||||
@ -272,12 +273,42 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(UVPtStructVec& theSideNodes)
|
||||
if ( !myPoints.empty() )
|
||||
{
|
||||
myPoints[0].normParam = 0;
|
||||
gp_Pnt pPrev = SMESH_TNodeXYZ( myPoints[0].node );
|
||||
for ( size_t i = 1; i < myPoints.size(); ++i )
|
||||
if ( myPoints[0].node &&
|
||||
myPoints.back().node &&
|
||||
myPoints[ myNbPonits/2 ].node )
|
||||
{
|
||||
gp_Pnt p = SMESH_TNodeXYZ( myPoints[i].node );
|
||||
myLength += ( myPoints[i].normParam = p.Distance( pPrev ));
|
||||
pPrev = p;
|
||||
gp_Pnt pPrev = SMESH_TNodeXYZ( myPoints[0].node );
|
||||
for ( size_t i = 1; i < myPoints.size(); ++i )
|
||||
{
|
||||
gp_Pnt p = SMESH_TNodeXYZ( myPoints[i].node );
|
||||
myLength += p.Distance( pPrev );
|
||||
myPoints[i].normParam = myLength;
|
||||
pPrev = p;
|
||||
}
|
||||
}
|
||||
else if ( !theFace.IsNull() )
|
||||
{
|
||||
TopLoc_Location loc;
|
||||
Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc );
|
||||
gp_Pnt pPrev = surf->Value( myPoints[0].u, myPoints[0].v );
|
||||
for ( size_t i = 1; i < myPoints.size(); ++i )
|
||||
{
|
||||
gp_Pnt p = surf->Value( myPoints[i].u, myPoints[i].v );
|
||||
myLength += p.Distance( pPrev );
|
||||
myPoints[i].normParam = myLength;
|
||||
pPrev = p;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt2d pPrev = myPoints[0].UV();
|
||||
for ( size_t i = 1; i < myPoints.size(); ++i )
|
||||
{
|
||||
gp_Pnt2d p = myPoints[i].UV();
|
||||
myLength += p.Distance( pPrev );
|
||||
myPoints[i].normParam = myLength;
|
||||
pPrev = p;
|
||||
}
|
||||
}
|
||||
if ( myLength > std::numeric_limits<double>::min() )
|
||||
for ( size_t i = 1; i < myPoints.size(); ++i )
|
||||
@ -926,6 +957,18 @@ gp_Pnt2d StdMeshers_FaceSide::Value2d(double U) const
|
||||
return myC2d[ i ]->Value(par);
|
||||
|
||||
}
|
||||
else if ( !myPoints.empty() )
|
||||
{
|
||||
int i = U * double( myPoints.size()-1 );
|
||||
while ( i > 0 && myPoints[ i ].normParam > U )
|
||||
--i;
|
||||
while ( i+1 < myPoints.size() && myPoints[ i+1 ].normParam < U )
|
||||
++i;
|
||||
double r = (( U - myPoints[ i ].normParam ) /
|
||||
( myPoints[ i+1 ].normParam - myPoints[ i ].normParam ));
|
||||
return ( myPoints[ i ].UV() * ( 1 - r ) +
|
||||
myPoints[ i+1 ].UV() * r );
|
||||
}
|
||||
return myDefaultPnt2d;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
|
||||
@ -47,7 +48,6 @@ class SMESH_Mesh;
|
||||
class Adaptor2d_Curve2d;
|
||||
class Adaptor3d_Curve;
|
||||
class BRepAdaptor_CompCurve;
|
||||
class TopoDS_Face;
|
||||
struct SMESH_ComputeError;
|
||||
class StdMeshers_FaceSide;
|
||||
|
||||
@ -96,7 +96,43 @@ public:
|
||||
/*!
|
||||
* \brief Create a side from an UVPtStructVec
|
||||
*/
|
||||
StdMeshers_FaceSide(UVPtStructVec& theSideNodes);
|
||||
StdMeshers_FaceSide(UVPtStructVec& theSideNodes,
|
||||
const TopoDS_Face& theFace = TopoDS_Face());
|
||||
|
||||
// static "consrtuctors"
|
||||
static StdMeshers_FaceSidePtr New(const TopoDS_Face& Face,
|
||||
const TopoDS_Edge& Edge,
|
||||
SMESH_Mesh* Mesh,
|
||||
const bool IsForward,
|
||||
const bool IgnoreMediumNodes,
|
||||
SMESH_ProxyMesh::Ptr ProxyMesh = SMESH_ProxyMesh::Ptr())
|
||||
{ return StdMeshers_FaceSidePtr
|
||||
( new StdMeshers_FaceSide( Face,Edge,Mesh,IsForward,IgnoreMediumNodes,ProxyMesh ));
|
||||
}
|
||||
static StdMeshers_FaceSidePtr New (const TopoDS_Face& Face,
|
||||
std::list<TopoDS_Edge>& Edges,
|
||||
SMESH_Mesh* Mesh,
|
||||
const bool IsForward,
|
||||
const bool IgnoreMediumNodes,
|
||||
SMESH_ProxyMesh::Ptr ProxyMesh = SMESH_ProxyMesh::Ptr())
|
||||
{ return StdMeshers_FaceSidePtr
|
||||
( new StdMeshers_FaceSide( Face,Edges,Mesh,IsForward,IgnoreMediumNodes,ProxyMesh ));
|
||||
}
|
||||
static StdMeshers_FaceSidePtr New (const StdMeshers_FaceSide* Side,
|
||||
const SMDS_MeshNode* Node,
|
||||
const gp_Pnt2d* Pnt2d1,
|
||||
const gp_Pnt2d* Pnt2d2=NULL,
|
||||
const Handle(Geom2d_Curve)& C2d=NULL,
|
||||
const double UFirst=0.,
|
||||
const double ULast=1.)
|
||||
{ return StdMeshers_FaceSidePtr
|
||||
( new StdMeshers_FaceSide( Side,Node,Pnt2d1,Pnt2d2,C2d,UFirst,ULast ));
|
||||
}
|
||||
static StdMeshers_FaceSidePtr New (UVPtStructVec& theSideNodes,
|
||||
const TopoDS_Face& theFace = TopoDS_Face())
|
||||
{
|
||||
return StdMeshers_FaceSidePtr( new StdMeshers_FaceSide( theSideNodes, theFace ));
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Return wires of a face as StdMeshers_FaceSide's
|
||||
|
204
src/StdMeshers/StdMeshers_Geometric1D.cxx
Normal file
204
src/StdMeshers/StdMeshers_Geometric1D.cxx
Normal file
@ -0,0 +1,204 @@
|
||||
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESH : implementaion of SMESH idl descriptions
|
||||
// File : StdMeshers_Geometric1D.cxx
|
||||
// Module : SMESH
|
||||
//
|
||||
#include "StdMeshers_Geometric1D.hxx"
|
||||
|
||||
#include "SMESH_Mesh.hxx"
|
||||
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <SMESH_Algo.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_Geometric1D::StdMeshers_Geometric1D(int hypId, int studyId, SMESH_Gen * gen)
|
||||
:StdMeshers_Reversible1D(hypId, studyId, gen)
|
||||
{
|
||||
_begLength = 1.;
|
||||
_ratio = 1.;
|
||||
_name = "GeometricProgression";
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Sets length of the first segment
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Geometric1D::SetStartLength(double length)
|
||||
throw(SALOME_Exception)
|
||||
{
|
||||
if ( _begLength != length )
|
||||
{
|
||||
if (length <= 0)
|
||||
throw SALOME_Exception(LOCALIZED("length must be positive"));
|
||||
_begLength = length;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Sets value of Common Ratio
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Geometric1D::SetCommonRatio(double factor)
|
||||
throw(SALOME_Exception)
|
||||
{
|
||||
if ( _ratio != factor )
|
||||
{
|
||||
if (factor == 0)
|
||||
throw SALOME_Exception(LOCALIZED("Zero factor is not allowed"));
|
||||
_ratio = factor;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Returns length of the first segment
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
double StdMeshers_Geometric1D::GetStartLength() const
|
||||
{
|
||||
return _begLength;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Returns value of Common Ratio
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
double StdMeshers_Geometric1D::GetCommonRatio() const
|
||||
{
|
||||
return _ratio;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
ostream & StdMeshers_Geometric1D::SaveTo(ostream & save)
|
||||
{
|
||||
save << _begLength << " " << _ratio << " ";
|
||||
|
||||
StdMeshers_Reversible1D::SaveTo( save );
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
istream & StdMeshers_Geometric1D::LoadFrom(istream & load)
|
||||
{
|
||||
bool isOK = true;
|
||||
isOK = (load >> _begLength);
|
||||
isOK = (load >> _ratio);
|
||||
|
||||
if (isOK)
|
||||
StdMeshers_Reversible1D::LoadFrom( load );
|
||||
|
||||
return load;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Initialize start and end length by the mesh built on the geometry
|
||||
* \param theMesh - the built mesh
|
||||
* \param theShape - the geometry of interest
|
||||
* \retval bool - true if parameter values have been successfully defined
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool StdMeshers_Geometric1D::SetParametersByMesh(const SMESH_Mesh* theMesh,
|
||||
const TopoDS_Shape& theShape)
|
||||
{
|
||||
if ( !theMesh || theShape.IsNull() )
|
||||
return false;
|
||||
|
||||
_begLength = _ratio = 0.;
|
||||
|
||||
int nbEdges = 0;
|
||||
TopTools_IndexedMapOfShape edgeMap;
|
||||
TopExp::MapShapes( theShape, TopAbs_EDGE, edgeMap );
|
||||
for ( int i = 1; i <= edgeMap.Extent(); ++i )
|
||||
{
|
||||
const TopoDS_Edge& edge = TopoDS::Edge( edgeMap( i ));
|
||||
BRepAdaptor_Curve C( edge );
|
||||
|
||||
vector< double > params;
|
||||
if ( SMESH_Algo::GetNodeParamOnEdge( theMesh->GetMeshDS(), edge, params ))
|
||||
{
|
||||
nbEdges++;
|
||||
double l1 = GCPnts_AbscissaPoint::Length( C, params[0], params[1] );
|
||||
_begLength += l1;
|
||||
if ( params.size() > 2 && l1 > 1e-100 )
|
||||
_ratio += GCPnts_AbscissaPoint::Length( C, params[1], params[2]) / l1;
|
||||
else
|
||||
_ratio += 1;
|
||||
}
|
||||
}
|
||||
if ( nbEdges ) {
|
||||
_begLength /= nbEdges;
|
||||
_ratio /= nbEdges;
|
||||
}
|
||||
else {
|
||||
_begLength = 1;
|
||||
_ratio = 1;
|
||||
}
|
||||
return nbEdges;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Initialize my parameter values by default parameters.
|
||||
* \retval bool - true if parameter values have been successfully defined
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool StdMeshers_Geometric1D::SetParametersByDefaults(const TDefaults& dflts,
|
||||
const SMESH_Mesh* /*mesh*/)
|
||||
{
|
||||
return ( _begLength = dflts._elemLength );
|
||||
}
|
||||
|
67
src/StdMeshers/StdMeshers_Geometric1D.hxx
Normal file
67
src/StdMeshers/StdMeshers_Geometric1D.hxx
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESH : implementaion of SMESH idl descriptions
|
||||
// File : StdMeshers_Geometric1D.hxx
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMESH_Geometric1D_HXX_
|
||||
#define _SMESH_Geometric1D_HXX_
|
||||
|
||||
#include "SMESH_StdMeshers.hxx"
|
||||
|
||||
#include "StdMeshers_Reversible1D.hxx"
|
||||
#include "Utils_SALOME_Exception.hxx"
|
||||
|
||||
class STDMESHERS_EXPORT StdMeshers_Geometric1D: public StdMeshers_Reversible1D
|
||||
{
|
||||
public:
|
||||
StdMeshers_Geometric1D(int hypId, int studyId, SMESH_Gen* gen);
|
||||
|
||||
void SetStartLength(double length) throw(SALOME_Exception);
|
||||
void SetCommonRatio(double factor) throw(SALOME_Exception);
|
||||
|
||||
double GetStartLength() const;
|
||||
double GetCommonRatio() const;
|
||||
|
||||
virtual std::ostream & SaveTo(std::ostream & save);
|
||||
virtual std::istream & LoadFrom(std::istream & load);
|
||||
|
||||
/*!
|
||||
* \brief Initialize start and end length by the mesh built on the geometry
|
||||
* \param theMesh - the built mesh
|
||||
* \param theShape - the geometry of interest
|
||||
* \retval bool - true if parameter values have been successfully defined
|
||||
*/
|
||||
virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
|
||||
|
||||
/*!
|
||||
* \brief Initialize my parameter values by default parameters.
|
||||
* \retval bool - true if parameter values have been successfully defined
|
||||
*/
|
||||
virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
|
||||
|
||||
protected:
|
||||
double _begLength, _ratio;
|
||||
};
|
||||
|
||||
#endif
|
@ -222,8 +222,8 @@ namespace
|
||||
* \brief Finds FaceQuadStruct having a side equal to a given one and rearranges
|
||||
* the found FaceQuadStruct::side to have the given side at a Q_BOTTOM place
|
||||
*/
|
||||
FaceQuadStructPtr getQuadWithBottom( StdMeshers_FaceSide* side,
|
||||
FaceQuadStructPtr quad[ 6 ])
|
||||
FaceQuadStructPtr getQuadWithBottom( StdMeshers_FaceSidePtr side,
|
||||
FaceQuadStructPtr quad[ 6 ])
|
||||
{
|
||||
FaceQuadStructPtr foundQuad;
|
||||
for ( int i = 1; i < 6; ++i )
|
||||
@ -231,7 +231,7 @@ namespace
|
||||
if ( !quad[i] ) continue;
|
||||
for ( unsigned iS = 0; iS < quad[i]->side.size(); ++iS )
|
||||
{
|
||||
const StdMeshers_FaceSide* side2 = quad[i]->side[iS];
|
||||
const StdMeshers_FaceSidePtr side2 = quad[i]->side[iS];
|
||||
if (( side->FirstVertex().IsSame( side2->FirstVertex() ) ||
|
||||
side->FirstVertex().IsSame( side2->LastVertex() ))
|
||||
&&
|
||||
@ -241,7 +241,7 @@ namespace
|
||||
{
|
||||
if ( iS != Q_BOTTOM )
|
||||
{
|
||||
vector< StdMeshers_FaceSide*> newSides;
|
||||
vector< FaceQuadStruct::Side > newSides;
|
||||
for ( unsigned j = iS; j < quad[i]->side.size(); ++j )
|
||||
newSides.push_back( quad[i]->side[j] );
|
||||
for ( unsigned j = 0; j < iS; ++j )
|
||||
@ -391,7 +391,7 @@ bool StdMeshers_Hexa_3D::Compute(SMESH_Mesh & aMesh,
|
||||
for ( int i = 0; i < 6; ++i )
|
||||
{
|
||||
const TopoDS_Face& F = aCubeSide[i]._quad->face;
|
||||
StdMeshers_FaceSide* baseQuadSide = aCubeSide[i]._quad->side[ Q_BOTTOM ];
|
||||
StdMeshers_FaceSidePtr baseQuadSide = aCubeSide[i]._quad->side[ Q_BOTTOM ];
|
||||
list<TopoDS_Edge> baseEdges( baseQuadSide->Edges().begin(), baseQuadSide->Edges().end() );
|
||||
|
||||
// assure correctness of node positions on baseE:
|
||||
|
@ -107,7 +107,7 @@ namespace {
|
||||
algo->myProxyMesh->GetMesh() != helper->GetMesh() )
|
||||
algo->myProxyMesh.reset( new SMESH_ProxyMesh( *helper->GetMesh() ));
|
||||
|
||||
algo->myQuadStruct.reset();
|
||||
algo->myQuadList.clear();
|
||||
|
||||
if ( helper )
|
||||
algo->_quadraticMesh = helper->GetIsQuadratic();
|
||||
@ -166,15 +166,15 @@ namespace {
|
||||
//================================================================================
|
||||
|
||||
bool setBottomEdge( const TopoDS_Edge& botE,
|
||||
faceQuadStruct::Ptr& quad,
|
||||
FaceQuadStruct::Ptr& quad,
|
||||
const TopoDS_Shape& face)
|
||||
{
|
||||
quad->side[ QUAD_TOP_SIDE ]->Reverse();
|
||||
quad->side[ QUAD_LEFT_SIDE ]->Reverse();
|
||||
quad->side[ QUAD_TOP_SIDE ].grid->Reverse();
|
||||
quad->side[ QUAD_LEFT_SIDE ].grid->Reverse();
|
||||
int edgeIndex = 0;
|
||||
for ( size_t i = 0; i < quad->side.size(); ++i )
|
||||
{
|
||||
StdMeshers_FaceSide* quadSide = quad->side[i];
|
||||
StdMeshers_FaceSidePtr quadSide = quad->side[i];
|
||||
for ( int iE = 0; iE < quadSide->NbEdges(); ++iE )
|
||||
if ( botE.IsSame( quadSide->Edge( iE )))
|
||||
{
|
||||
@ -681,7 +681,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
|
||||
continue; // already computed prism
|
||||
}
|
||||
// find a source FACE of the SOLID: it's a FACE sharing a bottom EDGE with wFace
|
||||
const TopoDS_Edge& wEdge = (*wQuad)->side[ QUAD_TOP_SIDE ]->Edge(0);
|
||||
const TopoDS_Edge& wEdge = (*wQuad)->side[ QUAD_TOP_SIDE ].grid->Edge(0);
|
||||
PShapeIteratorPtr faceIt = myHelper->GetAncestors( wEdge, *myHelper->GetMesh(),
|
||||
TopAbs_FACE);
|
||||
while ( const TopoDS_Shape* f = faceIt->next() )
|
||||
@ -879,7 +879,7 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism,
|
||||
int nbKnownFaces;
|
||||
do {
|
||||
nbKnownFaces = faceMap.Extent();
|
||||
StdMeshers_FaceSide *rightSide, *topSide; // sides of the quad
|
||||
StdMeshers_FaceSidePtr rightSide, topSide; // sides of the quad
|
||||
for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i )
|
||||
{
|
||||
rightSide = thePrism.myWallQuads[i].back()->side[ QUAD_RIGHT_SIDE ];
|
||||
@ -911,8 +911,8 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism,
|
||||
{
|
||||
for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i )
|
||||
{
|
||||
StdMeshers_FaceSide* topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ];
|
||||
const TopoDS_Edge & topE = topSide->Edge( 0 );
|
||||
StdMeshers_FaceSidePtr topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ];
|
||||
const TopoDS_Edge & topE = topSide->Edge( 0 );
|
||||
if ( topSide->NbEdges() > 1 )
|
||||
return toSM( error(COMPERR_BAD_SHAPE, TCom("Side face #") <<
|
||||
shapeID( thePrism.myWallQuads[i].back()->face )
|
||||
@ -958,8 +958,8 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism,
|
||||
// Check that the top FACE shares all the top EDGEs
|
||||
for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i )
|
||||
{
|
||||
StdMeshers_FaceSide* topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ];
|
||||
const TopoDS_Edge & topE = topSide->Edge( 0 );
|
||||
StdMeshers_FaceSidePtr topSide = thePrism.myWallQuads[i].back()->side[ QUAD_TOP_SIDE ];
|
||||
const TopoDS_Edge & topE = topSide->Edge( 0 );
|
||||
if ( !myHelper->IsSubShape( topE, thePrism.myTop ))
|
||||
return toSM( error( TCom("Wrong source face (#") << shapeID( thePrism.myBottom )));
|
||||
}
|
||||
@ -1205,7 +1205,7 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
||||
int wgt = 0; // "weight"
|
||||
for ( ; quad != thePrism.myWallQuads[iW].end(); ++quad )
|
||||
{
|
||||
StdMeshers_FaceSide* lftSide = (*quad)->side[ QUAD_LEFT_SIDE ];
|
||||
StdMeshers_FaceSidePtr lftSide = (*quad)->side[ QUAD_LEFT_SIDE ];
|
||||
for ( int i = 0; i < lftSide->NbEdges(); ++i )
|
||||
{
|
||||
++wgt;
|
||||
@ -1224,7 +1224,7 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
||||
quad = thePrism.myWallQuads[iW].begin();
|
||||
for ( ; quad != thePrism.myWallQuads[iW].end(); ++quad )
|
||||
for ( int i = 0; i < NB_QUAD_SIDES; ++i )
|
||||
(*quad)->side[ i ]->SetIgnoreMediumNodes( true );
|
||||
(*quad)->side[ i ].grid->SetIgnoreMediumNodes( true );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1237,8 +1237,8 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
||||
Prism_3D::TQuadList::const_iterator quad = quads.begin();
|
||||
for ( ; quad != quads.end(); ++quad )
|
||||
{
|
||||
StdMeshers_FaceSide* rgtSide = (*quad)->side[ QUAD_RIGHT_SIDE ]; // tgt
|
||||
StdMeshers_FaceSide* lftSide = (*quad)->side[ QUAD_LEFT_SIDE ]; // src
|
||||
StdMeshers_FaceSidePtr rgtSide = (*quad)->side[ QUAD_RIGHT_SIDE ]; // tgt
|
||||
StdMeshers_FaceSidePtr lftSide = (*quad)->side[ QUAD_LEFT_SIDE ]; // src
|
||||
bool swapLeftRight = ( lftSide->NbSegments( /*update=*/true ) == 0 &&
|
||||
rgtSide->NbSegments( /*update=*/true ) > 0 );
|
||||
if ( swapLeftRight )
|
||||
@ -1373,8 +1373,8 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
||||
// to compute stuctured quad mesh on wall FACEs
|
||||
// ---------------------------------------------------
|
||||
{
|
||||
const TopoDS_Edge& botE = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge(0);
|
||||
const TopoDS_Edge& topE = (*quad)->side[ QUAD_TOP_SIDE ]->Edge(0);
|
||||
const TopoDS_Edge& botE = (*quad)->side[ QUAD_BOTTOM_SIDE ].grid->Edge(0);
|
||||
const TopoDS_Edge& topE = (*quad)->side[ QUAD_TOP_SIDE ].grid->Edge(0);
|
||||
SMESH_subMesh* botSM = mesh->GetSubMesh( botE );
|
||||
SMESH_subMesh* topSM = mesh->GetSubMesh( topE );
|
||||
SMESH_subMesh* srcSM = botSM;
|
||||
@ -2352,7 +2352,7 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
|
||||
Prism_3D::TQuadList::const_iterator quad = thePrism.myWallQuads[ iE ].begin();
|
||||
for ( ; quad != thePrism.myWallQuads[ iE ].end(); ++quad )
|
||||
{
|
||||
const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge( 0 );
|
||||
const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ].grid->Edge( 0 );
|
||||
if ( !myHelper->LoadNodeColumns( faceColumns, (*quad)->face, quadBot, meshDS ))
|
||||
return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ")
|
||||
<< "on a side face #" << MeshDS()->ShapeToIndex( (*quad)->face ));
|
||||
@ -2373,7 +2373,7 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
|
||||
Prism_3D::TQuadList::const_iterator quad = thePrism.myWallQuads[ iE ].begin();
|
||||
for ( ; quad != thePrism.myWallQuads[ iE ].end(); ++quad )
|
||||
{
|
||||
const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge( 0 );
|
||||
const TopoDS_Edge& quadBot = (*quad)->side[ QUAD_BOTTOM_SIDE ].grid->Edge( 0 );
|
||||
if ( !myHelper->LoadNodeColumns( faceColumns, (*quad)->face, quadBot, meshDS ))
|
||||
return error(COMPERR_BAD_INPUT_MESH, TCom("Can't find regular quadrangle mesh ")
|
||||
<< "on a side face #" << MeshDS()->ShapeToIndex( (*quad)->face ));
|
||||
|
@ -1018,9 +1018,9 @@ bool StdMeshers_Projection_2D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape&
|
||||
map< double, const SMDS_MeshNode* >::iterator u_oldNode, u_newNode, u_newOnSeam, newEnd;
|
||||
set< const SMDS_MeshNode* > seamNodes;
|
||||
|
||||
// mapper puts on a seam edge nodes from 2 edges
|
||||
// mapper changed, no more "mapper puts on a seam edge nodes from 2 edges"
|
||||
if ( isSeam && ! getBoundaryNodes ( sm, tgtFace, u2nodesOnSeam, seamNodes ))
|
||||
RETURN_BAD_RESULT("getBoundaryNodes() failed");
|
||||
;//RETURN_BAD_RESULT("getBoundaryNodes() failed");
|
||||
|
||||
SMDS_NodeIteratorPtr nIt = smDS->GetNodes();
|
||||
while ( nIt->more() )
|
||||
|
@ -64,7 +64,8 @@ namespace {
|
||||
/*!
|
||||
* \brief Return an edge from which hypotheses are propagated from
|
||||
*/
|
||||
static TopoDS_Edge GetSource(SMESH_subMesh * submesh);
|
||||
static TopoDS_Edge GetSource(SMESH_subMesh * submesh,
|
||||
bool& isPropagOfDistribution);
|
||||
/*!
|
||||
* \brief Does it's main job
|
||||
*/
|
||||
@ -90,23 +91,28 @@ StdMeshers_Propagation::StdMeshers_Propagation (int hypId, int studyId, SMESH_Ge
|
||||
_name = GetName();
|
||||
_param_algo_dim = -1; // 1D auxiliary
|
||||
}
|
||||
StdMeshers_PropagOfDistribution::StdMeshers_PropagOfDistribution (int hypId,
|
||||
int studyId,
|
||||
SMESH_Gen * gen)
|
||||
: StdMeshers_Propagation(hypId, studyId, gen) { _name = GetName(); }
|
||||
StdMeshers_Propagation::~StdMeshers_Propagation() {}
|
||||
string StdMeshers_Propagation::GetName () { return "Propagation"; }
|
||||
string StdMeshers_PropagOfDistribution::GetName () { return "PropagOfDistribution"; }
|
||||
ostream & StdMeshers_Propagation::SaveTo (ostream & save) { return save; }
|
||||
istream & StdMeshers_Propagation::LoadFrom (istream & load) { return load; }
|
||||
ostream & operator << (ostream & save, StdMeshers_Propagation & hyp) { return hyp.SaveTo(save); }
|
||||
istream & operator >> (istream & load, StdMeshers_Propagation & hyp) { return hyp.LoadFrom(load); }
|
||||
bool StdMeshers_Propagation::SetParametersByMesh(const SMESH_Mesh*,
|
||||
const TopoDS_Shape& ) { return false; }
|
||||
bool StdMeshers_Propagation::SetParametersByDefaults(const TDefaults&,const SMESH_Mesh*) { return false; }
|
||||
void StdMeshers_Propagation::SetPropagationMgr(SMESH_subMesh* subMesh) { PropagationMgr::Set( subMesh ); }
|
||||
/*!
|
||||
* \brief Return an edge from which hypotheses are propagated from
|
||||
* \brief Return an edge from which hypotheses are propagated
|
||||
*/
|
||||
TopoDS_Edge StdMeshers_Propagation::GetPropagationSource(SMESH_Mesh& theMesh,
|
||||
const TopoDS_Shape& theEdge)
|
||||
TopoDS_Edge StdMeshers_Propagation::GetPropagationSource(SMESH_Mesh& theMesh,
|
||||
const TopoDS_Shape& theEdge,
|
||||
bool& isPropagOfDistribution)
|
||||
{
|
||||
return PropagationMgr::GetSource(theMesh.GetSubMeshContaining( theEdge ));
|
||||
return PropagationMgr::GetSource( theMesh.GetSubMeshContaining( theEdge ),
|
||||
isPropagOfDistribution);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -126,11 +132,13 @@ namespace {
|
||||
struct PropagationMgrData : public EventListenerData
|
||||
{
|
||||
bool myForward; //!< true if a curve of edge in chain is codirected with one of source edge
|
||||
bool myIsPropagOfDistribution; //!< type of Propagation hyp
|
||||
PropagationMgrData( SubMeshState state=WAIT_PROPAG_HYP ): EventListenerData(true) {
|
||||
myType = state; myForward = true;
|
||||
myType = state; myForward = true; myIsPropagOfDistribution = false;
|
||||
}
|
||||
void Init() {
|
||||
myType = WAIT_PROPAG_HYP; mySubMeshes.clear(); myForward = true;
|
||||
myIsPropagOfDistribution = false;
|
||||
}
|
||||
SubMeshState State() const {
|
||||
return (SubMeshState) myType;
|
||||
@ -217,8 +225,13 @@ namespace {
|
||||
const SMESH_Hypothesis* getProagationHyp (SMESH_Mesh& theMesh,
|
||||
const TopoDS_Shape& theEdge)
|
||||
{
|
||||
static SMESH_HypoFilter propagHypFilter
|
||||
( SMESH_HypoFilter::HasName( StdMeshers_Propagation::GetName ()));
|
||||
static SMESH_HypoFilter propagHypFilter;
|
||||
if ( propagHypFilter.IsEmpty() )
|
||||
{
|
||||
propagHypFilter.
|
||||
Init( SMESH_HypoFilter::HasName( StdMeshers_Propagation::GetName ())).
|
||||
Or ( SMESH_HypoFilter::HasName( StdMeshers_PropagOfDistribution::GetName ()));
|
||||
}
|
||||
return theMesh.GetHypothesis( theEdge, propagHypFilter, true );
|
||||
}
|
||||
//================================================================================
|
||||
@ -248,6 +261,10 @@ namespace {
|
||||
PropagationMgrData* chainData = getData( theMainSubMesh );
|
||||
chainData->SetState( HAS_PROPAG_HYP );
|
||||
|
||||
if ( const SMESH_Hypothesis * propagHyp = getProagationHyp( *mesh, theMainEdge ))
|
||||
chainData->myIsPropagOfDistribution =
|
||||
( StdMeshers_PropagOfDistribution::GetName() == propagHyp->GetName() );
|
||||
|
||||
// Edge submeshes, to which the 1D hypothesis will be propagated from theMainEdge
|
||||
list<SMESH_subMesh*> & chain = chainData->mySubMeshes;
|
||||
chain.clear();
|
||||
@ -462,17 +479,21 @@ namespace {
|
||||
{
|
||||
if ( findData( submesh )) return;
|
||||
DBGMSG( "PropagationMgr::Set() on " << submesh->GetId() );
|
||||
EventListenerData* data = new PropagationMgrData();
|
||||
PropagationMgrData* data = new PropagationMgrData();
|
||||
submesh->SetEventListener( getListener(), data, submesh );
|
||||
|
||||
const SMESH_Hypothesis * propagHyp =
|
||||
getProagationHyp( *submesh->GetFather(), submesh->GetSubShape() );
|
||||
if ( propagHyp )
|
||||
{
|
||||
data->myIsPropagOfDistribution =
|
||||
( StdMeshers_PropagOfDistribution::GetName() == propagHyp->GetName() );
|
||||
getListener()->ProcessEvent( SMESH_subMesh::ADD_HYP,
|
||||
SMESH_subMesh::ALGO_EVENT,
|
||||
submesh,
|
||||
data,
|
||||
propagHyp);
|
||||
}
|
||||
}
|
||||
//================================================================================
|
||||
/*!
|
||||
@ -480,7 +501,8 @@ namespace {
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
TopoDS_Edge PropagationMgr::GetSource(SMESH_subMesh * submesh)
|
||||
TopoDS_Edge PropagationMgr::GetSource(SMESH_subMesh * submesh,
|
||||
bool& isPropagOfDistribution)
|
||||
{
|
||||
if ( PropagationMgrData* data = findData( submesh )) {
|
||||
if ( data->State() == IN_CHAIN ) {
|
||||
@ -489,6 +511,9 @@ namespace {
|
||||
TopoDS_Shape edge = sm->GetSubShape();
|
||||
edge = edge.Oriented( data->myForward ? TopAbs_FORWARD : TopAbs_REVERSED );
|
||||
DBGMSG( " GetSource() = edge " << sm->GetId() << " REV = " << (!data->myForward));
|
||||
isPropagOfDistribution = false;
|
||||
if ( PropagationMgrData* data = findData( sm ))
|
||||
isPropagOfDistribution = data->myIsPropagOfDistribution;
|
||||
if ( edge.ShapeType() == TopAbs_EDGE )
|
||||
return TopoDS::Edge( edge );
|
||||
}
|
||||
@ -502,9 +527,9 @@ namespace {
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void PropagationMgr::ProcessEvent(const int event,
|
||||
const int eventType,
|
||||
SMESH_subMesh* subMesh,
|
||||
void PropagationMgr::ProcessEvent(const int event,
|
||||
const int eventType,
|
||||
SMESH_subMesh* subMesh,
|
||||
SMESH_subMeshEventListenerData* listenerData,
|
||||
const SMESH_Hypothesis* hyp)
|
||||
{
|
||||
@ -516,7 +541,8 @@ namespace {
|
||||
return;
|
||||
DBGMSG( "PropagationMgr::ProcessEvent() on " << subMesh->GetId() );
|
||||
|
||||
bool isPropagHyp = ( StdMeshers_Propagation::GetName() == hyp->GetName() );
|
||||
bool isPropagHyp = ( StdMeshers_Propagation::GetName() == hyp->GetName() ||
|
||||
StdMeshers_PropagOfDistribution::GetName() == hyp->GetName() );
|
||||
|
||||
PropagationMgrData* data = static_cast<PropagationMgrData*>( listenerData );
|
||||
switch ( data->State() ) {
|
||||
|
@ -50,8 +50,6 @@ class STDMESHERS_EXPORT StdMeshers_Propagation:public SMESH_Hypothesis
|
||||
|
||||
virtual std::ostream & SaveTo(std::ostream & save);
|
||||
virtual std::istream & LoadFrom(std::istream & load);
|
||||
friend std::ostream & operator <<(std::ostream & save, StdMeshers_Propagation & hyp);
|
||||
friend std::istream & operator >>(std::istream & load, StdMeshers_Propagation & hyp);
|
||||
|
||||
static std::string GetName ();
|
||||
|
||||
@ -69,7 +67,9 @@ class STDMESHERS_EXPORT StdMeshers_Propagation:public SMESH_Hypothesis
|
||||
* \param theEdge - edge to which hypotheses are propagated
|
||||
* \retval TopoDS_Edge - source edge, also passing orientation
|
||||
*/
|
||||
static TopoDS_Edge GetPropagationSource(SMESH_Mesh& theMesh, const TopoDS_Shape& theEdge);
|
||||
static TopoDS_Edge GetPropagationSource(SMESH_Mesh& theMesh,
|
||||
const TopoDS_Shape& theEdge,
|
||||
bool& isPropagOfDistribution );
|
||||
|
||||
/*!
|
||||
* \brief Initialize my parameter values by the mesh built on the geometry
|
||||
@ -88,4 +88,19 @@ class STDMESHERS_EXPORT StdMeshers_Propagation:public SMESH_Hypothesis
|
||||
virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
|
||||
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
/*!
|
||||
* \brief Propagation Of Distribution hypothesis
|
||||
*/
|
||||
// =======================================================================
|
||||
|
||||
class STDMESHERS_EXPORT StdMeshers_PropagOfDistribution: public StdMeshers_Propagation
|
||||
{
|
||||
public:
|
||||
StdMeshers_PropagOfDistribution(int hypId, int studyId, SMESH_Gen * gen);
|
||||
|
||||
static std::string GetName();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -87,6 +87,43 @@ void StdMeshers_QuadrangleParams::SetQuadType (StdMeshers_QuadType type)
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Set positions of enforced nodes
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshers_QuadrangleParams::
|
||||
SetEnforcedNodes( const std::vector< TopoDS_Shape >& shapes,
|
||||
const std::vector< gp_Pnt >& points )
|
||||
{
|
||||
bool isChanged = ( shapes != _enforcedVertices ||
|
||||
points.size() != _enforcedPoints.size() );
|
||||
for ( size_t i = 0; i < points.size() && !isChanged; ++i )
|
||||
isChanged = ( _enforcedPoints[ i ].SquareDistance( points[i] ) > 1e-100 );
|
||||
|
||||
if ( isChanged )
|
||||
{
|
||||
_enforcedVertices = shapes;
|
||||
_enforcedPoints = points;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Returns positions of enforced nodes
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshers_QuadrangleParams::
|
||||
GetEnforcedNodes( std::vector< TopoDS_Shape >& shapes,
|
||||
std::vector< gp_Pnt >& points ) const
|
||||
{
|
||||
shapes = _enforcedVertices;
|
||||
points = _enforcedPoints;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
@ -98,6 +135,13 @@ ostream & StdMeshers_QuadrangleParams::SaveTo(ostream & save)
|
||||
save << _triaVertexID << " UNDEFINED " << int(_quadType);
|
||||
else
|
||||
save << _triaVertexID << " " << _objEntry << " " << int(_quadType);
|
||||
|
||||
save << " " << _enforcedPoints.size();
|
||||
for ( size_t i = 0; i < _enforcedPoints.size(); ++i )
|
||||
save << " " << _enforcedPoints[i].X()
|
||||
<< " " << _enforcedPoints[i].Y()
|
||||
<< " " << _enforcedPoints[i].Z();
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
@ -122,29 +166,25 @@ istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
|
||||
if (isOK)
|
||||
_quadType = StdMeshers_QuadType(type);
|
||||
|
||||
// _enforcedVertices are loaded at StdMeshers_I level
|
||||
// because GEOM objects are referred by study entry.
|
||||
|
||||
int nbP = 0;
|
||||
double x,y,z;
|
||||
if ( load >> nbP && nbP > 0 )
|
||||
{
|
||||
_enforcedPoints.reserve( nbP );
|
||||
while ( _enforcedPoints.size() < _enforcedPoints.capacity() )
|
||||
if ( load >> x &&
|
||||
load >> y &&
|
||||
load >> z )
|
||||
_enforcedPoints.push_back( gp_Pnt( x,y,z ));
|
||||
else
|
||||
break;
|
||||
}
|
||||
return load;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
ostream & operator <<(ostream & save, StdMeshers_QuadrangleParams & hyp)
|
||||
{
|
||||
return hyp.SaveTo( save );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
istream & operator >>(istream & load, StdMeshers_QuadrangleParams & hyp)
|
||||
{
|
||||
return hyp.LoadFrom( load );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Redifined method
|
||||
|
@ -24,9 +24,12 @@
|
||||
#define _SMESH_QUADRANGLEPARAMS_HXX_
|
||||
|
||||
#include "SMESH_StdMeshers.hxx"
|
||||
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
#include "Utils_SALOME_Exception.hxx"
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
enum StdMeshers_QuadType
|
||||
{
|
||||
@ -38,8 +41,7 @@ enum StdMeshers_QuadType
|
||||
QUAD_NB_TYPES
|
||||
};
|
||||
|
||||
class STDMESHERS_EXPORT StdMeshers_QuadrangleParams:
|
||||
public SMESH_Hypothesis
|
||||
class STDMESHERS_EXPORT StdMeshers_QuadrangleParams: public SMESH_Hypothesis
|
||||
{
|
||||
public:
|
||||
StdMeshers_QuadrangleParams(int hypId, int studyId, SMESH_Gen* gen);
|
||||
@ -54,12 +56,13 @@ public:
|
||||
void SetQuadType (StdMeshers_QuadType type);
|
||||
StdMeshers_QuadType GetQuadType() const { return _quadType; }
|
||||
|
||||
void SetEnforcedNodes( const std::vector< TopoDS_Shape >& shapes,
|
||||
const std::vector< gp_Pnt >& points );
|
||||
void GetEnforcedNodes( std::vector< TopoDS_Shape >& shapes,
|
||||
std::vector< gp_Pnt >& points ) const;
|
||||
|
||||
virtual std::ostream & SaveTo(std::ostream & save);
|
||||
virtual std::istream & LoadFrom(std::istream & load);
|
||||
friend std::ostream& operator << (std::ostream & save,
|
||||
StdMeshers_QuadrangleParams & hyp);
|
||||
friend std::istream& operator >> (std::istream & load,
|
||||
StdMeshers_QuadrangleParams & hyp);
|
||||
|
||||
/*!
|
||||
* \brief Initialize start and end length by the mesh built on the geometry
|
||||
@ -78,9 +81,11 @@ public:
|
||||
const SMESH_Mesh* theMesh=0);
|
||||
|
||||
protected:
|
||||
int _triaVertexID;
|
||||
std::string _objEntry;
|
||||
StdMeshers_QuadType _quadType;
|
||||
int _triaVertexID;
|
||||
std::string _objEntry;
|
||||
StdMeshers_QuadType _quadType;
|
||||
std::vector< TopoDS_Shape > _enforcedVertices;
|
||||
std::vector< gp_Pnt > _enforcedPoints;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -30,31 +30,77 @@
|
||||
#include "SMESH_Algo.hxx"
|
||||
#include "SMESH_ProxyMesh.hxx"
|
||||
#include "SMESH_StdMeshers.hxx"
|
||||
#include "StdMeshers_FaceSide.hxx"
|
||||
#include "StdMeshers_QuadrangleParams.hxx"
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <Bnd_B2d.hxx>
|
||||
|
||||
class SMDS_MeshNode;
|
||||
class SMESH_Mesh;
|
||||
class SMESH_MesherHelper;
|
||||
class SMESH_ProxyMesh;
|
||||
class StdMeshers_FaceSide;
|
||||
struct uvPtStruct;
|
||||
|
||||
|
||||
enum TSideID { QUAD_BOTTOM_SIDE=0, QUAD_RIGHT_SIDE, QUAD_TOP_SIDE, QUAD_LEFT_SIDE, NB_QUAD_SIDES };
|
||||
|
||||
typedef uvPtStruct UVPtStruct;
|
||||
typedef struct faceQuadStruct
|
||||
struct FaceQuadStruct
|
||||
{
|
||||
std::vector< StdMeshers_FaceSide*> side;
|
||||
bool isEdgeOut[4]; // true, if an EDGE has more nodes, than an opposite one
|
||||
UVPtStruct* uv_grid;
|
||||
TopoDS_Face face;
|
||||
~faceQuadStruct();
|
||||
void shift( size_t nb, bool keepUnitOri );
|
||||
typedef boost::shared_ptr<faceQuadStruct> Ptr;
|
||||
} FaceQuadStruct;
|
||||
struct Side // a side of FaceQuadStruct
|
||||
{
|
||||
struct Contact // contact of two sides
|
||||
{
|
||||
int point; // index of a grid point of this side where two sides meat
|
||||
Side* other_side;
|
||||
int other_point;
|
||||
};
|
||||
StdMeshers_FaceSidePtr grid;
|
||||
int from, to; // indices of grid points used by the quad
|
||||
std::set<int> forced_nodes; // indices of forced grid points
|
||||
std::vector<Contact> contacts; // contacts with sides of other quads
|
||||
int nbNodeOut; // nb of missing nodes on an opposite shorter side
|
||||
|
||||
Side(StdMeshers_FaceSidePtr theGrid = StdMeshers_FaceSidePtr());
|
||||
Side& operator=(const Side& otherSide);
|
||||
operator StdMeshers_FaceSidePtr() { return grid; }
|
||||
operator const StdMeshers_FaceSidePtr() const { return grid; }
|
||||
void AddContact( int ip, Side* side, int iop );
|
||||
int ToSideIndex( int quadNodeIndex ) const;
|
||||
int ToQuadIndex( int sideNodeIndex ) const;
|
||||
bool IsForced( int nodeIndex ) const;
|
||||
bool IsReversed() const { return nbNodeOut ? false : to < from; }
|
||||
int NbPoints() const { return Abs( to - from ); }
|
||||
double Param( int nodeIndex ) const;
|
||||
double Length( int from=-1, int to=-1) const;
|
||||
gp_XY Value2d( double x ) const;
|
||||
// some sortcuts
|
||||
const vector<UVPtStruct>& GetUVPtStruct(bool isXConst=0, double constValue=0) const
|
||||
{ return nbNodeOut ?
|
||||
grid->SimulateUVPtStruct( NbPoints()-nbNodeOut-1, isXConst, constValue ) :
|
||||
grid->GetUVPtStruct( isXConst, constValue );
|
||||
}
|
||||
};
|
||||
|
||||
std::vector< Side > side;
|
||||
std::vector< UVPtStruct> uv_grid;
|
||||
int iSize, jSize;
|
||||
TopoDS_Face face;
|
||||
Bnd_B2d uv_box;
|
||||
|
||||
FaceQuadStruct ( const TopoDS_Face& F = TopoDS_Face() );
|
||||
UVPtStruct& UVPt( int i, int j ) { return uv_grid[ i + j * iSize ]; }
|
||||
void shift ( size_t nb, bool keepUnitOri );
|
||||
int & nbNodeOut( int iSide ) { return side[ iSide ].nbNodeOut; }
|
||||
bool findCell ( const gp_XY& uv, int & i, int & j );
|
||||
bool isNear ( const gp_XY& uv, int & i, int & j, int nbLoops=1 );
|
||||
bool isEqual ( const gp_XY& uv, int i, int j );
|
||||
void normPa2IJ( double x, double y, int & i, int & j );
|
||||
void updateUV ( const gp_XY& uv, int i, int j, bool isVertical );
|
||||
|
||||
typedef boost::shared_ptr<FaceQuadStruct> Ptr;
|
||||
};
|
||||
|
||||
class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo
|
||||
{
|
||||
@ -89,16 +135,17 @@ protected:
|
||||
std::vector<int>& aNbNodes,
|
||||
bool& IsQuadratic);
|
||||
|
||||
bool setNormalizedGrid(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Face& aFace,
|
||||
FaceQuadStruct::Ptr& quad);
|
||||
bool setNormalizedGrid(FaceQuadStruct::Ptr quad);
|
||||
|
||||
void splitQuad(SMESHDS_Mesh *theMeshDS,
|
||||
const int theFaceID,
|
||||
const SMDS_MeshNode* theNode1,
|
||||
const SMDS_MeshNode* theNode2,
|
||||
const SMDS_MeshNode* theNode3,
|
||||
const SMDS_MeshNode* theNode4);
|
||||
void splitQuadFace(SMESHDS_Mesh * theMeshDS,
|
||||
const int theFaceID,
|
||||
const SMDS_MeshNode* theNode1,
|
||||
const SMDS_MeshNode* theNode2,
|
||||
const SMDS_MeshNode* theNode3,
|
||||
const SMDS_MeshNode* theNode4);
|
||||
|
||||
bool computeQuadDominant(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Face& aFace);
|
||||
|
||||
bool computeQuadDominant(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Face& aFace,
|
||||
@ -108,6 +155,10 @@ protected:
|
||||
const TopoDS_Face& aFace,
|
||||
FaceQuadStruct::Ptr quad);
|
||||
|
||||
bool computeTriangles(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Face& aFace,
|
||||
FaceQuadStruct::Ptr quad);
|
||||
|
||||
bool evaluateQuadPref(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape,
|
||||
std::vector<int>& aNbNodes,
|
||||
@ -129,20 +180,43 @@ protected:
|
||||
int & theNbDegenEdges,
|
||||
const bool considerMesh);
|
||||
|
||||
bool getEnforcedUV();
|
||||
|
||||
bool addEnforcedNodes();
|
||||
|
||||
int splitQuad(FaceQuadStruct::Ptr quad, int i, int j);
|
||||
|
||||
typedef std::map< StdMeshers_FaceSidePtr, std::vector< FaceQuadStruct::Ptr > > TQuadsBySide;
|
||||
void updateSideUV( FaceQuadStruct::Side& side,
|
||||
int iForced,
|
||||
const TQuadsBySide& quads,
|
||||
int * iNext=NULL);
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
// true if QuadranglePreference hypothesis is assigned that forces
|
||||
// construction of quadrangles if the number of nodes on opposite edges
|
||||
// is not the same in the case where the global number of nodes on edges
|
||||
// is even
|
||||
bool myQuadranglePreference;
|
||||
bool myTrianglePreference;
|
||||
int myTriaVertexID;
|
||||
bool myNeedSmooth;
|
||||
const StdMeshers_QuadrangleParams* myParams;
|
||||
StdMeshers_QuadType myQuadType;
|
||||
|
||||
StdMeshers_QuadType myQuadType;
|
||||
SMESH_MesherHelper* myHelper; // tool for working with quadratic elements
|
||||
SMESH_ProxyMesh::Ptr myProxyMesh;
|
||||
FaceQuadStruct::Ptr myQuadStruct;
|
||||
SMESH_MesherHelper* myHelper;
|
||||
SMESH_ProxyMesh::Ptr myProxyMesh;
|
||||
std::list< FaceQuadStruct::Ptr > myQuadList;
|
||||
|
||||
struct ForcedPoint
|
||||
{
|
||||
gp_XY uv;
|
||||
gp_XYZ xyz;
|
||||
TopoDS_Vertex vertex;
|
||||
|
||||
double U() const { return uv.X(); }
|
||||
double V() const { return uv.Y(); }
|
||||
operator const gp_XY& () { return uv; }
|
||||
};
|
||||
std::vector< ForcedPoint > myForcedPnts;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "SMESH_subMeshEventListener.hxx"
|
||||
#include "StdMeshers_Adaptive1D.hxx"
|
||||
#include "StdMeshers_Arithmetic1D.hxx"
|
||||
#include "StdMeshers_Geometric1D.hxx"
|
||||
#include "StdMeshers_AutomaticLength.hxx"
|
||||
#include "StdMeshers_Deflection1D.hxx"
|
||||
#include "StdMeshers_Distribution.hxx"
|
||||
@ -89,12 +90,14 @@ StdMeshers_Regular_1D::StdMeshers_Regular_1D(int hypId, int studyId,
|
||||
_compatibleHypothesis.push_back("StartEndLength");
|
||||
_compatibleHypothesis.push_back("Deflection1D");
|
||||
_compatibleHypothesis.push_back("Arithmetic1D");
|
||||
_compatibleHypothesis.push_back("GeometricProgression");
|
||||
_compatibleHypothesis.push_back("FixedPoints1D");
|
||||
_compatibleHypothesis.push_back("AutomaticLength");
|
||||
_compatibleHypothesis.push_back("Adaptive1D");
|
||||
|
||||
_compatibleHypothesis.push_back("QuadraticMesh"); // auxiliary !!!
|
||||
_compatibleHypothesis.push_back("Propagation"); // auxiliary !!!
|
||||
// auxiliary:
|
||||
_compatibleHypothesis.push_back("QuadraticMesh");
|
||||
_compatibleHypothesis.push_back("Propagation");
|
||||
_compatibleHypothesis.push_back("PropagOfDistribution");
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -223,6 +226,21 @@ bool StdMeshers_Regular_1D::CheckHypothesis( SMESH_Mesh& aMesh,
|
||||
aStatus = SMESH_Hypothesis::HYP_OK;
|
||||
}
|
||||
|
||||
else if (hypName == "GeometricProgression")
|
||||
{
|
||||
const StdMeshers_Geometric1D * hyp =
|
||||
dynamic_cast <const StdMeshers_Geometric1D * >(theHyp);
|
||||
ASSERT(hyp);
|
||||
_value[ BEG_LENGTH_IND ] = hyp->GetStartLength();
|
||||
_value[ END_LENGTH_IND ] = hyp->GetCommonRatio();
|
||||
ASSERT( _value[ BEG_LENGTH_IND ] > 0 && _value[ END_LENGTH_IND ] > 0 );
|
||||
_hypType = GEOMETRIC_1D;
|
||||
|
||||
_revEdgesIDs = hyp->GetReversedEdges();
|
||||
|
||||
aStatus = SMESH_Hypothesis::HYP_OK;
|
||||
}
|
||||
|
||||
else if (hypName == "FixedPoints1D") {
|
||||
_fpHyp = dynamic_cast <const StdMeshers_FixedPoints1D*>(theHyp);
|
||||
ASSERT(_fpHyp);
|
||||
@ -616,6 +634,58 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
||||
|
||||
double f = theFirstU, l = theLastU;
|
||||
|
||||
// Propagation Of Distribution
|
||||
//
|
||||
if ( !_mainEdge.IsNull() && _isPropagOfDistribution )
|
||||
{
|
||||
TopoDS_Edge mainEdge = TopoDS::Edge( _mainEdge ); // should not be a reference!
|
||||
_gen->Compute( theMesh, mainEdge, /*aShapeOnly=*/true, /*anUpward=*/true);
|
||||
|
||||
SMESHDS_SubMesh* smDS = theMesh.GetMeshDS()->MeshElements( mainEdge );
|
||||
if ( !smDS )
|
||||
return error("No mesh on the source edge of Propagation Of Distribution");
|
||||
if ( smDS->NbNodes() < 1 )
|
||||
return true; // 1 segment
|
||||
|
||||
vector< double > mainEdgeParams;
|
||||
if ( ! SMESH_Algo::GetNodeParamOnEdge( theMesh.GetMeshDS(), mainEdge, mainEdgeParams ))
|
||||
return error("Bad node parameters on the source edge of Propagation Of Distribution");
|
||||
|
||||
vector< double > segLen( mainEdgeParams.size() - 1 );
|
||||
double totalLen = 0;
|
||||
BRepAdaptor_Curve mainEdgeCurve( mainEdge );
|
||||
for ( size_t i = 1; i < mainEdgeParams.size(); ++i )
|
||||
{
|
||||
segLen[ i-1 ] = GCPnts_AbscissaPoint::Length( mainEdgeCurve,
|
||||
mainEdgeParams[i-1],
|
||||
mainEdgeParams[i]);
|
||||
totalLen += segLen[ i-1 ];
|
||||
}
|
||||
for ( size_t i = 0; i < segLen.size(); ++i )
|
||||
segLen[ i ] *= theLength / totalLen;
|
||||
|
||||
size_t iSeg = theReverse ? segLen.size()-1 : 0;
|
||||
size_t dSeg = theReverse ? -1 : +1;
|
||||
double param = theFirstU;
|
||||
int nbParams = 0;
|
||||
for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
|
||||
{
|
||||
GCPnts_AbscissaPoint Discret( theC3d, segLen[ iSeg ], param );
|
||||
if ( !Discret.IsDone() ) break;
|
||||
param = Discret.Parameter();
|
||||
theParams.push_back( param );
|
||||
++nbParams;
|
||||
}
|
||||
if ( nbParams != segLen.size()-1 )
|
||||
return error( SMESH_Comment("Can't divide into ") << segLen.size() << " segements");
|
||||
|
||||
compensateError( segLen[ theReverse ? segLen.size()-1 : 0 ],
|
||||
segLen[ theReverse ? 0 : segLen.size()-1 ],
|
||||
f, l, theLength, theC3d, theParams, true );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
switch( _hypType )
|
||||
{
|
||||
case LOCAL_LENGTH:
|
||||
@ -824,9 +894,54 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
|
||||
return true;
|
||||
}
|
||||
|
||||
case GEOMETRIC_1D: {
|
||||
|
||||
double a1 = _value[ BEG_LENGTH_IND ], an;
|
||||
double q = _value[ END_LENGTH_IND ];
|
||||
|
||||
double U1 = theReverse ? l : f;
|
||||
double Un = theReverse ? f : l;
|
||||
double param = U1;
|
||||
double eltSize = a1;
|
||||
if ( theReverse )
|
||||
eltSize = -eltSize;
|
||||
|
||||
int nbParams = 0;
|
||||
while ( true ) {
|
||||
// computes a point on a curve <theC3d> at the distance <eltSize>
|
||||
// from the point of parameter <param>.
|
||||
GCPnts_AbscissaPoint Discret( theC3d, eltSize, param );
|
||||
if ( !Discret.IsDone() ) break;
|
||||
param = Discret.Parameter();
|
||||
if ( f < param && param < l )
|
||||
theParams.push_back( param );
|
||||
else
|
||||
break;
|
||||
an = eltSize;
|
||||
eltSize *= q;
|
||||
++nbParams;
|
||||
}
|
||||
if ( nbParams > 1 )
|
||||
{
|
||||
if ( Abs( param - Un ) < 0.2 * Abs( param - theParams.back() ))
|
||||
{
|
||||
compensateError( a1, eltSize, U1, Un, theLength, theC3d, theParams );
|
||||
}
|
||||
else if ( Abs( Un - theParams.back() ) <
|
||||
0.2 * Abs( theParams.back() - *(--theParams.rbegin())))
|
||||
{
|
||||
theParams.pop_back();
|
||||
compensateError( a1, an, U1, Un, theLength, theC3d, theParams );
|
||||
}
|
||||
}
|
||||
if (theReverse) theParams.reverse(); // NPAL18025
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case FIXED_POINTS_1D: {
|
||||
const std::vector<double>& aPnts = _fpHyp->GetPoints();
|
||||
const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
|
||||
const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
|
||||
int i = 0;
|
||||
TColStd_SequenceOfReal Params;
|
||||
for(; i<aPnts.size(); i++) {
|
||||
@ -1231,7 +1346,8 @@ StdMeshers_Regular_1D::GetUsedHypothesis(SMESH_Mesh & aMesh,
|
||||
if (nbHyp == 0 && aShape.ShapeType() == TopAbs_EDGE)
|
||||
{
|
||||
// Check, if propagated from some other edge
|
||||
_mainEdge = StdMeshers_Propagation::GetPropagationSource( aMesh, aShape );
|
||||
_mainEdge = StdMeshers_Propagation::GetPropagationSource( aMesh, aShape,
|
||||
_isPropagOfDistribution );
|
||||
if ( !_mainEdge.IsNull() )
|
||||
{
|
||||
// Propagation of 1D hypothesis from <aMainEdge> on this edge;
|
||||
|
@ -102,7 +102,7 @@ protected:
|
||||
StdMeshers_SegmentLengthAroundVertex* getVertexHyp(SMESH_Mesh & theMesh,
|
||||
const TopoDS_Vertex & theV);
|
||||
|
||||
enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, ADAPTIVE, NONE };
|
||||
enum HypothesisType { LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, BEG_END_LENGTH, DEFLECTION, ARITHMETIC_1D, FIXED_POINTS_1D, ADAPTIVE, GEOMETRIC_1D, NONE };
|
||||
|
||||
enum ValueIndex {
|
||||
SCALE_FACTOR_IND = 0,
|
||||
@ -140,6 +140,7 @@ protected:
|
||||
// a source of propagated hypothesis, is set by CheckHypothesis()
|
||||
// always called before Compute()
|
||||
TopoDS_Shape _mainEdge;
|
||||
bool _isPropagOfDistribution;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
99
src/StdMeshers/StdMeshers_Reversible1D.cxx
Normal file
99
src/StdMeshers/StdMeshers_Reversible1D.cxx
Normal file
@ -0,0 +1,99 @@
|
||||
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESH : implementaion of SMESH idl descriptions
|
||||
// File : StdMeshers_Reversible1D.cxx
|
||||
// Module : SMESH
|
||||
//
|
||||
|
||||
#include "StdMeshers_Reversible1D.hxx"
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_Reversible1D::StdMeshers_Reversible1D(int hypId, int studyId, SMESH_Gen * gen)
|
||||
:SMESH_Hypothesis(hypId, studyId, gen)
|
||||
{
|
||||
_param_algo_dim = 1;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Reversible1D::SetReversedEdges( const std::vector<int>& ids )
|
||||
{
|
||||
if ( ids != _edgeIDs )
|
||||
{
|
||||
_edgeIDs = ids;
|
||||
NotifySubMeshesHypothesisModification();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
std::ostream & StdMeshers_Reversible1D::SaveTo(std::ostream & save)
|
||||
{
|
||||
save << " " << _edgeIDs.size() << " ";
|
||||
|
||||
if ( !_edgeIDs.empty() )
|
||||
{
|
||||
for ( size_t i = 0; i < _edgeIDs.size(); i++)
|
||||
save << " " << _edgeIDs[i];
|
||||
save << " " << _objEntry << " ";
|
||||
}
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
std::istream & StdMeshers_Reversible1D::LoadFrom(std::istream & load)
|
||||
{
|
||||
bool isOK;
|
||||
int intVal;
|
||||
|
||||
isOK = (load >> intVal);
|
||||
if (isOK && intVal > 0) {
|
||||
_edgeIDs.reserve( intVal );
|
||||
for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
|
||||
isOK = (load >> intVal);
|
||||
if ( isOK ) _edgeIDs.push_back( intVal );
|
||||
}
|
||||
isOK = (load >> _objEntry);
|
||||
}
|
||||
|
||||
return load;
|
||||
}
|
59
src/StdMeshers/StdMeshers_Reversible1D.hxx
Normal file
59
src/StdMeshers/StdMeshers_Reversible1D.hxx
Normal file
@ -0,0 +1,59 @@
|
||||
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESH : implementaion of SMESH idl descriptions
|
||||
// File : StdMeshers_Reversible1D.hxx
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMESH_Reversible1D_HXX_
|
||||
#define _SMESH_Reversible1D_HXX_
|
||||
|
||||
#include "SMESH_StdMeshers.hxx"
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
|
||||
#include <vector>
|
||||
|
||||
/*!
|
||||
* \brief A base of reversible 1D hypotheses
|
||||
*/
|
||||
class STDMESHERS_EXPORT StdMeshers_Reversible1D : public SMESH_Hypothesis
|
||||
{
|
||||
public:
|
||||
StdMeshers_Reversible1D(int hypId, int studyId, SMESH_Gen* gen);
|
||||
|
||||
void SetReversedEdges( const std::vector<int>& ids);
|
||||
|
||||
void SetObjectEntry( const char* entry ) { _objEntry = entry; }
|
||||
|
||||
const char* GetObjectEntry() { return _objEntry.c_str(); }
|
||||
|
||||
const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
|
||||
|
||||
virtual std::ostream & SaveTo(std::ostream & save);
|
||||
virtual std::istream & LoadFrom(std::istream & load);
|
||||
|
||||
protected:
|
||||
std::vector<int> _edgeIDs;
|
||||
std::string _objEntry;
|
||||
};
|
||||
|
||||
#endif
|
@ -25,6 +25,9 @@
|
||||
//
|
||||
#include "StdMeshers_UseExisting_1D2D.hxx"
|
||||
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_subMesh.hxx"
|
||||
|
||||
//=======================================================================
|
||||
//function : StdMeshers_UseExisting_1D
|
||||
//purpose :
|
||||
@ -56,10 +59,11 @@ bool StdMeshers_UseExisting_1D::CheckHypothesis(SMESH_Mesh& ,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool StdMeshers_UseExisting_1D::Compute(SMESH_Mesh&, const TopoDS_Shape&)
|
||||
bool StdMeshers_UseExisting_1D::Compute(SMESH_Mesh& mesh, const TopoDS_Shape& edge)
|
||||
{
|
||||
// This algorithm exists to allow mesh generation by mesh
|
||||
// edition functions in TUI mode
|
||||
mesh.GetSubMesh( edge )->SetIsAlwaysComputed( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -110,10 +114,11 @@ bool StdMeshers_UseExisting_2D::CheckHypothesis(SMESH_Mesh& ,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool StdMeshers_UseExisting_2D::Compute(SMESH_Mesh&, const TopoDS_Shape&)
|
||||
bool StdMeshers_UseExisting_2D::Compute(SMESH_Mesh& mesh, const TopoDS_Shape& face)
|
||||
{
|
||||
// This algorithm exists to allow mesh generation by mesh edition
|
||||
// functions in TUI mode
|
||||
mesh.GetSubMesh( face )->SetIsAlwaysComputed( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "SMESH_ControlsDef.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_Group.hxx"
|
||||
#include "SMESH_HypoFilter.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_MeshAlgos.hxx"
|
||||
#include "SMESH_MesherHelper.hxx"
|
||||
@ -63,6 +64,7 @@
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@ -382,8 +384,10 @@ namespace VISCOUS_3D
|
||||
{
|
||||
TopoDS_Shape _solid;
|
||||
const StdMeshers_ViscousLayers* _hyp;
|
||||
TopoDS_Shape _hypShape;
|
||||
_MeshOfSolid* _proxyMesh;
|
||||
set<TGeomID> _reversedFaceIds;
|
||||
set<TGeomID> _ignoreFaceIds;
|
||||
|
||||
double _stepSize, _stepSizeCoeff;
|
||||
const SMDS_MeshNode* _stepSizeNodes[2];
|
||||
@ -393,10 +397,10 @@ namespace VISCOUS_3D
|
||||
// iteration over the map is 5 time longer than over the vector
|
||||
vector< _LayerEdge* > _edges;
|
||||
|
||||
// key: an id of shape (EDGE or VERTEX) shared by a FACE with
|
||||
// layers and a FACE w/o layers
|
||||
// key: an id of shape (EDGE or VERTEX) shared by a FACE with
|
||||
// layers and a FACE w/o layers
|
||||
// value: the shape (FACE or EDGE) to shrink mesh on.
|
||||
// _LayerEdge's basing on nodes on key shape are inflated along the value shape
|
||||
// _LayerEdge's basing on nodes on key shape are inflated along the value shape
|
||||
map< TGeomID, TopoDS_Shape > _shrinkShape2Shape;
|
||||
|
||||
// FACE's WOL, srink on which is forbiden due to algo on the adjacent SOLID
|
||||
@ -414,7 +418,9 @@ namespace VISCOUS_3D
|
||||
|
||||
_SolidData(const TopoDS_Shape& s=TopoDS_Shape(),
|
||||
const StdMeshers_ViscousLayers* h=0,
|
||||
_MeshOfSolid* m=0) :_solid(s), _hyp(h), _proxyMesh(m) {}
|
||||
const TopoDS_Shape& hs=TopoDS_Shape(),
|
||||
_MeshOfSolid* m=0)
|
||||
:_solid(s), _hyp(h), _hypShape(hs), _proxyMesh(m) {}
|
||||
~_SolidData();
|
||||
|
||||
Handle(Geom_Curve) CurveForSmooth( const TopoDS_Edge& E,
|
||||
@ -517,7 +523,6 @@ namespace VISCOUS_3D
|
||||
SMESH_ComputeErrorPtr _error;
|
||||
|
||||
vector< _SolidData > _sdVec;
|
||||
set<TGeomID> _ignoreShapeIds;
|
||||
int _tmpFaceID;
|
||||
};
|
||||
//--------------------------------------------------------------------------------
|
||||
@ -617,7 +622,7 @@ namespace VISCOUS_3D
|
||||
//
|
||||
StdMeshers_ViscousLayers::StdMeshers_ViscousLayers(int hypId, int studyId, SMESH_Gen* gen)
|
||||
:SMESH_Hypothesis(hypId, studyId, gen),
|
||||
_isToIgnoreShapes(18), _nbLayers(1), _thickness(1), _stretchFactor(1)
|
||||
_isToIgnoreShapes(1), _nbLayers(1), _thickness(1), _stretchFactor(1)
|
||||
{
|
||||
_name = StdMeshers_ViscousLayers::GetHypType();
|
||||
_param_algo_dim = -3; // auxiliary hyp used by 3D algos
|
||||
@ -686,7 +691,7 @@ std::ostream & StdMeshers_ViscousLayers::SaveTo(std::ostream & save)
|
||||
<< " " << _thickness
|
||||
<< " " << _stretchFactor
|
||||
<< " " << _shapeIds.size();
|
||||
for ( unsigned i = 0; i < _shapeIds.size(); ++i )
|
||||
for ( size_t i = 0; i < _shapeIds.size(); ++i )
|
||||
save << " " << _shapeIds[i];
|
||||
save << " " << !_isToIgnoreShapes; // negate to keep the behavior in old studies.
|
||||
return save;
|
||||
@ -788,7 +793,7 @@ namespace
|
||||
// get average dir of edges going fromV
|
||||
gp_XYZ edgeDir;
|
||||
//if ( edges.size() > 1 )
|
||||
for ( unsigned i = 0; i < edges.size(); ++i )
|
||||
for ( size_t i = 0; i < edges.size(); ++i )
|
||||
{
|
||||
edgeDir = getEdgeDir( edges[i], fromV );
|
||||
double size2 = edgeDir.SquareModulus();
|
||||
@ -909,9 +914,9 @@ namespace
|
||||
py = new ofstream(fname);
|
||||
*py << "import SMESH" << endl
|
||||
<< "from salome.smesh import smeshBuilder" << endl
|
||||
<< "smesh = smeshBuilder.New(salome.myStudy)" << endl
|
||||
<< "smesh = smeshBuilder.New(salome.myStudy)" << endl
|
||||
<< "meshSO = smesh.GetCurrentStudy().FindObjectID('0:1:2:3')" << endl
|
||||
<< "mesh = smesh.Mesh( meshSO.GetObject() )"<<endl;
|
||||
<< "mesh = smesh.Mesh( meshSO.GetObject() )"<<endl;
|
||||
}
|
||||
void Finish() {
|
||||
if (py)
|
||||
@ -1069,7 +1074,7 @@ SMESH_ComputeErrorPtr _ViscousBuilder::Compute(SMESH_Mesh& theMesh,
|
||||
if ( !findFacesWithLayers() )
|
||||
return _error;
|
||||
|
||||
for ( unsigned i = 0; i < _sdVec.size(); ++i )
|
||||
for ( size_t i = 0; i < _sdVec.size(); ++i )
|
||||
{
|
||||
if ( ! makeLayer(_sdVec[i]) )
|
||||
return _error;
|
||||
@ -1108,6 +1113,7 @@ bool _ViscousBuilder::findSolidsWithLayers()
|
||||
_sdVec.reserve( allSolids.Extent());
|
||||
|
||||
SMESH_Gen* gen = _mesh->GetGen();
|
||||
SMESH_HypoFilter filter;
|
||||
for ( int i = 1; i <= allSolids.Extent(); ++i )
|
||||
{
|
||||
// find StdMeshers_ViscousLayers hyp assigned to the i-th solid
|
||||
@ -1122,10 +1128,14 @@ bool _ViscousBuilder::findSolidsWithLayers()
|
||||
viscHyp = dynamic_cast<const StdMeshers_ViscousLayers*>( *hyp );
|
||||
if ( viscHyp )
|
||||
{
|
||||
TopoDS_Shape hypShape;
|
||||
filter.Init( filter.Is( viscHyp ));
|
||||
_mesh->GetHypothesis( allSolids(i), filter, true, &hypShape );
|
||||
|
||||
_MeshOfSolid* proxyMesh = _ViscousListener::GetSolidMesh( _mesh,
|
||||
allSolids(i),
|
||||
/*toCreate=*/true);
|
||||
_sdVec.push_back( _SolidData( allSolids(i), viscHyp, proxyMesh ));
|
||||
_sdVec.push_back( _SolidData( allSolids(i), viscHyp, hypShape, proxyMesh ));
|
||||
_sdVec.back()._index = getMeshDS()->ShapeToIndex( allSolids(i));
|
||||
}
|
||||
}
|
||||
@ -1144,44 +1154,69 @@ bool _ViscousBuilder::findSolidsWithLayers()
|
||||
|
||||
bool _ViscousBuilder::findFacesWithLayers()
|
||||
{
|
||||
// collect all faces to ignore defined by hyp
|
||||
vector<TopoDS_Shape> ignoreFaces;
|
||||
for ( unsigned i = 0; i < _sdVec.size(); ++i )
|
||||
{
|
||||
vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapes();
|
||||
for ( unsigned i = 0; i < ids.size(); ++i )
|
||||
{
|
||||
const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[i] );
|
||||
if ( !s.IsNull() && s.ShapeType() == TopAbs_FACE )
|
||||
{
|
||||
_ignoreShapeIds.insert( ids[i] );
|
||||
ignoreFaces.push_back( s );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ignore internal faces
|
||||
SMESH_MesherHelper helper( *_mesh );
|
||||
TopExp_Explorer exp;
|
||||
for ( unsigned i = 0; i < _sdVec.size(); ++i )
|
||||
TopTools_IndexedMapOfShape solids;
|
||||
|
||||
// collect all faces to ignore defined by hyp
|
||||
for ( size_t i = 0; i < _sdVec.size(); ++i )
|
||||
{
|
||||
exp.Init( _sdVec[i]._solid.Oriented( TopAbs_FORWARD ), TopAbs_FACE );
|
||||
for ( ; exp.More(); exp.Next() )
|
||||
solids.Add( _sdVec[i]._solid );
|
||||
|
||||
vector<TGeomID> ids = _sdVec[i]._hyp->GetBndShapes();
|
||||
if ( _sdVec[i]._hyp->IsToIgnoreShapes() ) // FACEs to ignore are given
|
||||
{
|
||||
TGeomID faceInd = getMeshDS()->ShapeToIndex( exp.Current() );
|
||||
if ( helper.NbAncestors( exp.Current(), *_mesh, TopAbs_SOLID ) > 1 )
|
||||
{
|
||||
_ignoreShapeIds.insert( faceInd );
|
||||
ignoreFaces.push_back( exp.Current() );
|
||||
if ( helper.IsReversedSubMesh( TopoDS::Face( exp.Current() )))
|
||||
for ( size_t ii = 0; ii < ids.size(); ++ii )
|
||||
{
|
||||
const TopoDS_Shape& s = getMeshDS()->IndexToShape( ids[ii] );
|
||||
if ( !s.IsNull() && s.ShapeType() == TopAbs_FACE )
|
||||
_sdVec[i]._ignoreFaceIds.insert( ids[ii] );
|
||||
}
|
||||
}
|
||||
else // FACEs with layers are given
|
||||
{
|
||||
exp.Init( _sdVec[i]._solid, TopAbs_FACE );
|
||||
for ( ; exp.More(); exp.Next() )
|
||||
{
|
||||
TGeomID faceInd = getMeshDS()->ShapeToIndex( exp.Current() );
|
||||
if ( find( ids.begin(), ids.end(), faceInd ) == ids.end() )
|
||||
_sdVec[i]._ignoreFaceIds.insert( faceInd );
|
||||
}
|
||||
}
|
||||
|
||||
// ignore internal FACEs if inlets and outlets are specified
|
||||
{
|
||||
TopTools_IndexedDataMapOfShapeListOfShape solidsOfFace;
|
||||
if ( _sdVec[i]._hyp->IsToIgnoreShapes() )
|
||||
TopExp::MapShapesAndAncestors( _sdVec[i]._hypShape,
|
||||
TopAbs_FACE, TopAbs_SOLID, solidsOfFace);
|
||||
|
||||
exp.Init( _sdVec[i]._solid.Oriented( TopAbs_FORWARD ), TopAbs_FACE );
|
||||
for ( ; exp.More(); exp.Next() )
|
||||
{
|
||||
const TopoDS_Face& face = TopoDS::Face( exp.Current() );
|
||||
if ( helper.NbAncestors( face, *_mesh, TopAbs_SOLID ) < 2 )
|
||||
continue;
|
||||
|
||||
const TGeomID faceInd = getMeshDS()->ShapeToIndex( face );
|
||||
if ( _sdVec[i]._hyp->IsToIgnoreShapes() )
|
||||
{
|
||||
int nbSolids = solidsOfFace.FindFromKey( face ).Extent();
|
||||
if ( nbSolids > 1 )
|
||||
_sdVec[i]._ignoreFaceIds.insert( faceInd );
|
||||
}
|
||||
|
||||
if ( helper.IsReversedSubMesh( face ))
|
||||
{
|
||||
_sdVec[i]._reversedFaceIds.insert( faceInd );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find faces to shrink mesh on (solution 2 in issue 0020832);
|
||||
TopTools_IndexedMapOfShape shapes;
|
||||
for ( unsigned i = 0; i < _sdVec.size(); ++i )
|
||||
for ( size_t i = 0; i < _sdVec.size(); ++i )
|
||||
{
|
||||
shapes.Clear();
|
||||
TopExp::MapShapes(_sdVec[i]._solid, TopAbs_EDGE, shapes);
|
||||
@ -1201,18 +1236,35 @@ bool _ViscousBuilder::findFacesWithLayers()
|
||||
// check presence of layers on them
|
||||
int ignore[2];
|
||||
for ( int j = 0; j < 2; ++j )
|
||||
ignore[j] = _ignoreShapeIds.count ( getMeshDS()->ShapeToIndex( FF[j] ));
|
||||
if ( ignore[0] == ignore[1] ) continue; // nothing interesting
|
||||
ignore[j] = _sdVec[i]._ignoreFaceIds.count ( getMeshDS()->ShapeToIndex( FF[j] ));
|
||||
if ( ignore[0] == ignore[1] )
|
||||
continue; // nothing interesting
|
||||
TopoDS_Shape fWOL = FF[ ignore[0] ? 0 : 1 ];
|
||||
// check presence of layers on fWOL within an adjacent SOLID
|
||||
PShapeIteratorPtr sIt = helper.GetAncestors( fWOL, *_mesh, TopAbs_SOLID );
|
||||
while ( const TopoDS_Shape* solid = sIt->next() )
|
||||
if ( !solid->IsSame( _sdVec[i]._solid ))
|
||||
{
|
||||
int iSolid = solids.FindIndex( *solid );
|
||||
int iFace = getMeshDS()->ShapeToIndex( fWOL );
|
||||
if ( iSolid > 0 && !_sdVec[ iSolid-1 ]._ignoreFaceIds.count( iFace ))
|
||||
{
|
||||
_sdVec[i]._noShrinkFaces.insert( iFace );
|
||||
fWOL.Nullify();
|
||||
}
|
||||
}
|
||||
// add edge to maps
|
||||
TGeomID edgeInd = getMeshDS()->ShapeToIndex( edge );
|
||||
_sdVec[i]._shrinkShape2Shape.insert( make_pair( edgeInd, fWOL ));
|
||||
if ( !fWOL.IsNull())
|
||||
{
|
||||
TGeomID edgeInd = getMeshDS()->ShapeToIndex( edge );
|
||||
_sdVec[i]._shrinkShape2Shape.insert( make_pair( edgeInd, fWOL ));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Exclude from _shrinkShape2Shape FACE's that can't be shrinked since
|
||||
// the algo of the SOLID sharing the FACE does not support it
|
||||
set< string > notSupportAlgos; notSupportAlgos.insert("Hexa_3D");
|
||||
for ( unsigned i = 0; i < _sdVec.size(); ++i )
|
||||
for ( size_t i = 0; i < _sdVec.size(); ++i )
|
||||
{
|
||||
TopTools_MapOfShape noShrinkVertices;
|
||||
map< TGeomID, TopoDS_Shape >::iterator e2f = _sdVec[i]._shrinkShape2Shape.begin();
|
||||
@ -1229,7 +1281,7 @@ bool _ViscousBuilder::findFacesWithLayers()
|
||||
SMESH_Algo* algo = _mesh->GetGen()->GetAlgo( *_mesh, *solid );
|
||||
if ( !algo || !notSupportAlgos.count( algo->GetName() )) continue;
|
||||
notShrinkFace = true;
|
||||
for ( unsigned j = 0; j < _sdVec.size(); ++j )
|
||||
for ( size_t j = 0; j < _sdVec.size(); ++j )
|
||||
{
|
||||
if ( _sdVec[j]._solid.IsSame( *solid ) )
|
||||
if ( _sdVec[j]._shrinkShape2Shape.count( edgeID ))
|
||||
@ -1262,10 +1314,10 @@ bool _ViscousBuilder::findFacesWithLayers()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Find the SHAPE along which to inflate _LayerEdge based on VERTEX
|
||||
|
||||
for ( unsigned i = 0; i < _sdVec.size(); ++i )
|
||||
for ( size_t i = 0; i < _sdVec.size(); ++i )
|
||||
{
|
||||
shapes.Clear();
|
||||
TopExp::MapShapes(_sdVec[i]._solid, TopAbs_VERTEX, shapes);
|
||||
@ -1279,11 +1331,12 @@ bool _ViscousBuilder::findFacesWithLayers()
|
||||
while ( fIt->more())
|
||||
{
|
||||
const TopoDS_Shape* f = fIt->next();
|
||||
const int fID = getMeshDS()->ShapeToIndex( *f );
|
||||
if ( helper.IsSubShape( *f, _sdVec[i]._solid ) )
|
||||
{
|
||||
totalNbFaces++;
|
||||
if ( _ignoreShapeIds.count ( fID ) && ! _sdVec[i]._noShrinkFaces.count( fID ))
|
||||
const int fID = getMeshDS()->ShapeToIndex( *f );
|
||||
if ( _sdVec[i]._ignoreFaceIds.count ( fID ) &&
|
||||
!_sdVec[i]._noShrinkFaces.count( fID ))
|
||||
facesWOL.push_back( *f );
|
||||
}
|
||||
}
|
||||
@ -1293,42 +1346,42 @@ bool _ViscousBuilder::findFacesWithLayers()
|
||||
switch ( facesWOL.size() )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
helper.SetSubShape( facesWOL[0] );
|
||||
if ( helper.IsRealSeam( vInd )) // inflate along a seam edge?
|
||||
{
|
||||
helper.SetSubShape( facesWOL[0] );
|
||||
if ( helper.IsRealSeam( vInd )) // inflate along a seam edge?
|
||||
{
|
||||
TopoDS_Shape seamEdge;
|
||||
PShapeIteratorPtr eIt = helper.GetAncestors(vertex, *_mesh, TopAbs_EDGE);
|
||||
while ( eIt->more() && seamEdge.IsNull() )
|
||||
{
|
||||
const TopoDS_Shape* e = eIt->next();
|
||||
if ( helper.IsRealSeam( *e ) )
|
||||
seamEdge = *e;
|
||||
}
|
||||
if ( !seamEdge.IsNull() )
|
||||
{
|
||||
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, seamEdge ));
|
||||
break;
|
||||
}
|
||||
}
|
||||
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, facesWOL[0] ));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// find an edge shared by 2 faces
|
||||
TopoDS_Shape seamEdge;
|
||||
PShapeIteratorPtr eIt = helper.GetAncestors(vertex, *_mesh, TopAbs_EDGE);
|
||||
while ( eIt->more())
|
||||
while ( eIt->more() && seamEdge.IsNull() )
|
||||
{
|
||||
const TopoDS_Shape* e = eIt->next();
|
||||
if ( helper.IsSubShape( *e, facesWOL[0]) &&
|
||||
helper.IsSubShape( *e, facesWOL[1]))
|
||||
{
|
||||
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, *e )); break;
|
||||
}
|
||||
if ( helper.IsRealSeam( *e ) )
|
||||
seamEdge = *e;
|
||||
}
|
||||
if ( !seamEdge.IsNull() )
|
||||
{
|
||||
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, seamEdge ));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, facesWOL[0] ));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
// find an edge shared by 2 faces
|
||||
PShapeIteratorPtr eIt = helper.GetAncestors(vertex, *_mesh, TopAbs_EDGE);
|
||||
while ( eIt->more())
|
||||
{
|
||||
const TopoDS_Shape* e = eIt->next();
|
||||
if ( helper.IsSubShape( *e, facesWOL[0]) &&
|
||||
helper.IsSubShape( *e, facesWOL[1]))
|
||||
{
|
||||
_sdVec[i]._shrinkShape2Shape.insert( make_pair( vInd, *e )); break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return error("Not yet supported case", _sdVec[i]._index);
|
||||
}
|
||||
@ -1351,10 +1404,10 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
|
||||
subIds = data._noShrinkFaces;
|
||||
TopExp_Explorer exp( data._solid, TopAbs_FACE );
|
||||
for ( ; exp.More(); exp.Next() )
|
||||
if ( ! _ignoreShapeIds.count( getMeshDS()->ShapeToIndex( exp.Current() )))
|
||||
{
|
||||
SMESH_subMesh* fSubM = _mesh->GetSubMesh( exp.Current() );
|
||||
faceIds.insert( fSubM->GetId() );
|
||||
if ( ! data._ignoreFaceIds.count( getMeshDS()->ShapeToIndex( exp.Current() )))
|
||||
faceIds.insert( fSubM->GetId() );
|
||||
SMESH_subMeshIteratorPtr subIt =
|
||||
fSubM->getDependsOnIterator(/*includeSelf=*/true, /*complexShapeFirst=*/false);
|
||||
while ( subIt->more() )
|
||||
@ -1368,7 +1421,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
|
||||
for (; s2s != data._shrinkShape2Shape.end(); ++s2s )
|
||||
{
|
||||
TGeomID shapeInd = s2s->first;
|
||||
for ( unsigned i = 0; i < _sdVec.size(); ++i )
|
||||
for ( size_t i = 0; i < _sdVec.size(); ++i )
|
||||
{
|
||||
if ( _sdVec[i]._index == data._index ) continue;
|
||||
map< TGeomID, TopoDS_Shape >::iterator s2s2 = _sdVec[i]._shrinkShape2Shape.find( shapeInd );
|
||||
@ -1475,7 +1528,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
|
||||
|
||||
// Set target nodes into _Simplex and _2NearEdges
|
||||
TNode2Edge::iterator n2e;
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
if ( data._edges[i]->IsOnEdge())
|
||||
for ( int j = 0; j < 2; ++j )
|
||||
@ -1489,7 +1542,7 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
|
||||
data._edges[i]->_2neibors->_edges[j] = n2e->second;
|
||||
}
|
||||
else
|
||||
for ( unsigned j = 0; j < data._edges[i]->_simplices.size(); ++j )
|
||||
for ( size_t j = 0; j < data._edges[i]->_simplices.size(); ++j )
|
||||
{
|
||||
_Simplex& s = data._edges[i]->_simplices[j];
|
||||
s._nNext = data._n2eMap[ s._nNext ]->_nodes.back();
|
||||
@ -1573,7 +1626,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data,
|
||||
SMESH_MesherHelper helper( *_mesh );
|
||||
bool ok = true;
|
||||
|
||||
for ( unsigned iS = 0; iS < edgesByGeom.size(); ++iS )
|
||||
for ( size_t iS = 0; iS < edgesByGeom.size(); ++iS )
|
||||
{
|
||||
vector<_LayerEdge*>& eS = edgesByGeom[iS];
|
||||
if ( eS.empty() ) continue;
|
||||
@ -1617,7 +1670,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data,
|
||||
if ( eE.empty() ) continue;
|
||||
if ( eE[0]->_sWOL.IsNull() )
|
||||
{
|
||||
for ( unsigned i = 0; i < eE.size() && !needSmooth; ++i )
|
||||
for ( size_t i = 0; i < eE.size() && !needSmooth; ++i )
|
||||
needSmooth = ( eE[i]->_cosin > 0.1 );
|
||||
}
|
||||
else
|
||||
@ -1625,7 +1678,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data,
|
||||
const TopoDS_Face& F1 = TopoDS::Face( S );
|
||||
const TopoDS_Face& F2 = TopoDS::Face( eE[0]->_sWOL );
|
||||
const TopoDS_Edge& E = TopoDS::Edge( eExp.Current() );
|
||||
for ( unsigned i = 0; i < eE.size() && !needSmooth; ++i )
|
||||
for ( size_t i = 0; i < eE.size() && !needSmooth; ++i )
|
||||
{
|
||||
gp_Vec dir1 = getFaceDir( F1, E, eE[i]->_nodes[0], helper, ok );
|
||||
gp_Vec dir2 = getFaceDir( F2, E, eE[i]->_nodes[0], helper, ok );
|
||||
@ -1664,7 +1717,7 @@ bool _ViscousBuilder::sortEdges( _SolidData& data,
|
||||
}
|
||||
|
||||
// then the rest _LayerEdge's
|
||||
for ( unsigned iS = 0; iS < edgesByGeom.size(); ++iS )
|
||||
for ( size_t iS = 0; iS < edgesByGeom.size(); ++iS )
|
||||
{
|
||||
vector<_LayerEdge*>& eVec = edgesByGeom[iS];
|
||||
data._edges.insert( data._edges.end(), eVec.begin(), eVec.end() );
|
||||
@ -1870,9 +1923,9 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge,
|
||||
|
||||
if ( posType == SMDS_TOP_FACE )
|
||||
{
|
||||
getSimplices( node, edge._simplices, _ignoreShapeIds, &data );
|
||||
getSimplices( node, edge._simplices, data._ignoreFaceIds, &data );
|
||||
double avgNormProj = 0, avgLen = 0;
|
||||
for ( unsigned i = 0; i < edge._simplices.size(); ++i )
|
||||
for ( size_t i = 0; i < edge._simplices.size(); ++i )
|
||||
{
|
||||
gp_XYZ vec = edge._pos.back() - SMESH_TNodeXYZ( edge._simplices[i]._nPrev );
|
||||
avgNormProj += edge._normal * vec;
|
||||
@ -2103,7 +2156,7 @@ void _ViscousBuilder::getSimplices( const SMDS_MeshNode* node,
|
||||
void _ViscousBuilder::makeGroupOfLE()
|
||||
{
|
||||
#ifdef _DEBUG_
|
||||
for ( unsigned i = 0 ; i < _sdVec.size(); ++i )
|
||||
for ( size_t i = 0 ; i < _sdVec.size(); ++i )
|
||||
{
|
||||
if ( _sdVec[i]._edges.empty() ) continue;
|
||||
// string name = SMESH_Comment("_LayerEdge's_") << i;
|
||||
@ -2113,10 +2166,10 @@ void _ViscousBuilder::makeGroupOfLE()
|
||||
// SMESHDS_Mesh* mDS = _mesh->GetMeshDS();
|
||||
|
||||
dumpFunction( SMESH_Comment("make_LayerEdge_") << i );
|
||||
for ( unsigned j = 0 ; j < _sdVec[i]._edges.size(); ++j )
|
||||
for ( size_t j = 0 ; j < _sdVec[i]._edges.size(); ++j )
|
||||
{
|
||||
_LayerEdge* le = _sdVec[i]._edges[j];
|
||||
for ( unsigned iN = 1; iN < le->_nodes.size(); ++iN )
|
||||
for ( size_t iN = 1; iN < le->_nodes.size(); ++iN )
|
||||
dumpCmd(SMESH_Comment("mesh.AddEdge([ ") <<le->_nodes[iN-1]->GetID()
|
||||
<< ", " << le->_nodes[iN]->GetID() <<"])");
|
||||
//gDS->SMDSGroup().Add( mDS->AddEdge( le->_nodes[iN-1], le->_nodes[iN]));
|
||||
@ -2124,7 +2177,7 @@ void _ViscousBuilder::makeGroupOfLE()
|
||||
dumpFunctionEnd();
|
||||
|
||||
dumpFunction( SMESH_Comment("makeNormals") << i );
|
||||
for ( unsigned j = 0 ; j < _sdVec[i]._edges.size(); ++j )
|
||||
for ( size_t j = 0 ; j < _sdVec[i]._edges.size(); ++j )
|
||||
{
|
||||
_LayerEdge& edge = *_sdVec[i]._edges[j];
|
||||
SMESH_TNodeXYZ nXYZ( edge._nodes[0] );
|
||||
@ -2178,7 +2231,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
|
||||
auto_ptr<SMESH_ElementSearcher> searcher
|
||||
( SMESH_MeshAlgos::GetElementSearcher( *getMeshDS(),
|
||||
data._proxyMesh->GetFaces( data._solid )) );
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
if ( data._edges[i]->IsOnEdge() ) continue;
|
||||
data._edges[i]->FindIntersection( *searcher, intersecDist, data._epsilon );
|
||||
@ -2213,7 +2266,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
|
||||
|
||||
// Elongate _LayerEdge's
|
||||
dumpFunction(SMESH_Comment("inflate")<<data._index<<"_step"<<nbSteps); // debug
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
data._edges[i]->SetNewLength( curThick, helper );
|
||||
}
|
||||
@ -2229,7 +2282,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
|
||||
if ( nbSteps > 0 )
|
||||
{
|
||||
dumpFunction(SMESH_Comment("invalidate")<<data._index<<"_step"<<nbSteps); // debug
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
data._edges[i]->InvalidateStep( nbSteps+1 );
|
||||
}
|
||||
@ -2241,7 +2294,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
|
||||
|
||||
// Evaluate achieved thickness
|
||||
avgThick = 0;
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
avgThick += data._edges[i]->_len;
|
||||
avgThick /= data._edges.size();
|
||||
#ifdef __myDEBUG
|
||||
@ -2289,7 +2342,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
|
||||
TopoDS_Face F;
|
||||
|
||||
int iBeg, iEnd = 0;
|
||||
for ( unsigned iS = 0; iS < data._endEdgeToSmooth.size(); ++iS )
|
||||
for ( size_t iS = 0; iS < data._endEdgeToSmooth.size(); ++iS )
|
||||
{
|
||||
iBeg = iEnd;
|
||||
iEnd = data._endEdgeToSmooth[ iS ];
|
||||
@ -2355,7 +2408,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
|
||||
{
|
||||
_LayerEdge* edge = data._edges[i];
|
||||
SMESH_TNodeXYZ tgtXYZ( edge->_nodes.back() );
|
||||
for ( unsigned j = 0; j < edge->_simplices.size(); ++j )
|
||||
for ( size_t j = 0; j < edge->_simplices.size(); ++j )
|
||||
if ( !edge->_simplices[j].IsForward( edge->_nodes[0], &tgtXYZ ))
|
||||
{
|
||||
cout << "Bad simplex ( " << edge->_nodes[0]->GetID()<< " "<< tgtXYZ._node->GetID()
|
||||
@ -2384,7 +2437,7 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
|
||||
const SMDS_MeshElement* closestFace = 0;
|
||||
int iLE = 0;
|
||||
#endif
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
if ( data._edges[i]->FindIntersection( *searcher, dist, data._epsilon, &intFace ))
|
||||
return false;
|
||||
@ -2695,7 +2748,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data,
|
||||
vector< const SMDS_MeshNode*> nodes(4); // of a tmp mesh face
|
||||
|
||||
dumpFunction(SMESH_Comment("makeTmpFacesOnEdges")<<data._index);
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
_LayerEdge* edge = data._edges[i];
|
||||
if ( !edge->IsOnEdge() || !edge->_sWOL.IsNull() ) continue;
|
||||
@ -2712,7 +2765,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data,
|
||||
}
|
||||
// look for a _LayerEdge containg tgt2
|
||||
// _LayerEdge* neiborEdge = 0;
|
||||
// unsigned di = 0; // check _edges[i+di] and _edges[i-di]
|
||||
// size_t di = 0; // check _edges[i+di] and _edges[i-di]
|
||||
// while ( !neiborEdge && ++di <= data._edges.size() )
|
||||
// {
|
||||
// if ( i+di < data._edges.size() && data._edges[i+di]->_nodes.back() == tgt2 )
|
||||
@ -2751,7 +2804,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data,
|
||||
TLEdge2LEdgeSet edge2CloseEdge;
|
||||
|
||||
const double eps = data._epsilon * data._epsilon;
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
_LayerEdge* edge = data._edges[i];
|
||||
if ( !edge->IsOnEdge() || !edge->_sWOL.IsNull() ) continue;
|
||||
@ -2922,7 +2975,7 @@ bool _ViscousBuilder::updateNormals( _SolidData& data,
|
||||
// 2) Check absence of intersections
|
||||
// TODO?
|
||||
|
||||
for ( unsigned i = 0 ; i < tmpFaces.size(); ++i )
|
||||
for ( size_t i = 0 ; i < tmpFaces.size(); ++i )
|
||||
delete tmpFaces[i];
|
||||
|
||||
return true;
|
||||
@ -2948,7 +3001,7 @@ bool _LayerEdge::FindIntersection( SMESH_ElementSearcher& searcher,
|
||||
bool segmentIntersected = false;
|
||||
distance = Precision::Infinite();
|
||||
int iFace = -1; // intersected face
|
||||
for ( unsigned j = 0 ; j < suspectFaces.size() && !segmentIntersected; ++j )
|
||||
for ( size_t j = 0 ; j < suspectFaces.size() && !segmentIntersected; ++j )
|
||||
{
|
||||
const SMDS_MeshElement* face = suspectFaces[j];
|
||||
if ( face->GetNodeIndex( _nodes.back() ) >= 0 ||
|
||||
@ -3236,7 +3289,7 @@ bool _LayerEdge::Smooth(int& badNb)
|
||||
|
||||
// compute new position for the last _pos
|
||||
gp_XYZ newPos (0,0,0);
|
||||
for ( unsigned i = 0; i < _simplices.size(); ++i )
|
||||
for ( size_t i = 0; i < _simplices.size(); ++i )
|
||||
newPos += SMESH_TNodeXYZ( _simplices[i]._nPrev );
|
||||
newPos /= _simplices.size();
|
||||
|
||||
@ -3259,11 +3312,11 @@ bool _LayerEdge::Smooth(int& badNb)
|
||||
// count quality metrics (orientation) of tetras around _tgtNode
|
||||
int nbOkBefore = 0;
|
||||
SMESH_TNodeXYZ tgtXYZ( _nodes.back() );
|
||||
for ( unsigned i = 0; i < _simplices.size(); ++i )
|
||||
for ( size_t i = 0; i < _simplices.size(); ++i )
|
||||
nbOkBefore += _simplices[i].IsForward( _nodes[0], &tgtXYZ );
|
||||
|
||||
int nbOkAfter = 0;
|
||||
for ( unsigned i = 0; i < _simplices.size(); ++i )
|
||||
for ( size_t i = 0; i < _simplices.size(); ++i )
|
||||
nbOkAfter += _simplices[i].IsForward( _nodes[0], &newPos );
|
||||
|
||||
if ( nbOkAfter < nbOkBefore )
|
||||
@ -3389,14 +3442,14 @@ bool _ViscousBuilder::refine(_SolidData& data)
|
||||
gp_XY uv;
|
||||
bool isOnEdge;
|
||||
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
_LayerEdge& edge = *data._edges[i];
|
||||
|
||||
// get accumulated length of segments
|
||||
vector< double > segLen( edge._pos.size() );
|
||||
segLen[0] = 0.0;
|
||||
for ( unsigned j = 1; j < edge._pos.size(); ++j )
|
||||
for ( size_t j = 1; j < edge._pos.size(); ++j )
|
||||
segLen[j] = segLen[j-1] + (edge._pos[j-1] - edge._pos[j] ).Modulus();
|
||||
|
||||
// allocate memory for new nodes if it is not yet refined
|
||||
@ -3444,8 +3497,8 @@ bool _ViscousBuilder::refine(_SolidData& data)
|
||||
|
||||
// create intermediate nodes
|
||||
double hSum = 0, hi = h0/f;
|
||||
unsigned iSeg = 1;
|
||||
for ( unsigned iStep = 1; iStep < edge._nodes.size(); ++iStep )
|
||||
size_t iSeg = 1;
|
||||
for ( size_t iStep = 1; iStep < edge._nodes.size(); ++iStep )
|
||||
{
|
||||
// compute an intermediate position
|
||||
hi *= f;
|
||||
@ -3512,7 +3565,7 @@ bool _ViscousBuilder::refine(_SolidData& data)
|
||||
|
||||
if ( !getMeshDS()->IsEmbeddedMode() )
|
||||
// Log node movement
|
||||
for ( unsigned i = 0; i < data._edges.size(); ++i )
|
||||
for ( size_t i = 0; i < data._edges.size(); ++i )
|
||||
{
|
||||
_LayerEdge& edge = *data._edges[i];
|
||||
SMESH_TNodeXYZ p ( edge._nodes.back() );
|
||||
@ -3526,7 +3579,7 @@ bool _ViscousBuilder::refine(_SolidData& data)
|
||||
TopExp_Explorer exp( data._solid, TopAbs_FACE );
|
||||
for ( ; exp.More(); exp.Next() )
|
||||
{
|
||||
if ( _ignoreShapeIds.count( getMeshDS()->ShapeToIndex( exp.Current() )))
|
||||
if ( data._ignoreFaceIds.count( getMeshDS()->ShapeToIndex( exp.Current() )))
|
||||
continue;
|
||||
SMESHDS_SubMesh* fSubM = getMeshDS()->MeshElements( exp.Current() );
|
||||
SMDS_ElemIteratorPtr fIt = fSubM->GetElements();
|
||||
@ -3577,7 +3630,7 @@ bool _ViscousBuilder::shrink()
|
||||
// make map of (ids of FACEs to shrink mesh on) to (_SolidData containing _LayerEdge's
|
||||
// inflated along FACE or EDGE)
|
||||
map< TGeomID, _SolidData* > f2sdMap;
|
||||
for ( unsigned i = 0 ; i < _sdVec.size(); ++i )
|
||||
for ( size_t i = 0 ; i < _sdVec.size(); ++i )
|
||||
{
|
||||
_SolidData& data = _sdVec[i];
|
||||
TopTools_MapOfShape FFMap;
|
||||
@ -3684,7 +3737,7 @@ bool _ViscousBuilder::shrink()
|
||||
|
||||
// Replace source nodes by target nodes in mesh faces to shrink
|
||||
const SMDS_MeshNode* nodes[20];
|
||||
for ( unsigned i = 0; i < lEdges.size(); ++i )
|
||||
for ( size_t i = 0; i < lEdges.size(); ++i )
|
||||
{
|
||||
_LayerEdge& edge = *lEdges[i];
|
||||
const SMDS_MeshNode* srcNode = edge._nodes[0];
|
||||
@ -3712,7 +3765,7 @@ bool _ViscousBuilder::shrink()
|
||||
vector< _SmoothNode > nodesToSmooth( smoothNodes.size() );
|
||||
{
|
||||
const bool sortSimplices = isConcaveFace;
|
||||
for ( unsigned i = 0; i < smoothNodes.size(); ++i )
|
||||
for ( size_t i = 0; i < smoothNodes.size(); ++i )
|
||||
{
|
||||
const SMDS_MeshNode* n = smoothNodes[i];
|
||||
nodesToSmooth[ i ]._node = n;
|
||||
@ -3728,7 +3781,7 @@ bool _ViscousBuilder::shrink()
|
||||
// Find EDGE's to shrink and set simpices to LayerEdge's
|
||||
set< _Shrinker1D* > eShri1D;
|
||||
{
|
||||
for ( unsigned i = 0; i < lEdges.size(); ++i )
|
||||
for ( size_t i = 0; i < lEdges.size(); ++i )
|
||||
{
|
||||
_LayerEdge* edge = lEdges[i];
|
||||
if ( edge->_sWOL.ShapeType() == TopAbs_EDGE )
|
||||
@ -3801,7 +3854,7 @@ bool _ViscousBuilder::shrink()
|
||||
int oldBadNb = badNb;
|
||||
badNb = 0;
|
||||
moved = false;
|
||||
for ( unsigned i = 0; i < nodesToSmooth.size(); ++i )
|
||||
for ( size_t i = 0; i < nodesToSmooth.size(); ++i )
|
||||
{
|
||||
moved |= nodesToSmooth[i].Smooth( badNb,surface,helper,refSign,
|
||||
smoothType, /*set3D=*/isConcaveFace);
|
||||
@ -3870,7 +3923,7 @@ bool _ViscousBuilder::shrink()
|
||||
case 3: smoothType = _SmoothNode::ANGULAR; break;
|
||||
}
|
||||
dumpFunction(SMESH_Comment("shrinkFace")<<f2sd->first<<"_st"<<++smooStep); // debug
|
||||
for ( unsigned i = 0; i < nodesToSmooth.size(); ++i )
|
||||
for ( size_t i = 0; i < nodesToSmooth.size(); ++i )
|
||||
{
|
||||
nodesToSmooth[i].Smooth( badNb,surface,helper,refSign,
|
||||
smoothType,/*set3D=*/st==1 );
|
||||
@ -3883,7 +3936,7 @@ bool _ViscousBuilder::shrink()
|
||||
|
||||
if ( !getMeshDS()->IsEmbeddedMode() )
|
||||
// Log node movement
|
||||
for ( unsigned i = 0; i < nodesToSmooth.size(); ++i )
|
||||
for ( size_t i = 0; i < nodesToSmooth.size(); ++i )
|
||||
{
|
||||
SMESH_TNodeXYZ p ( nodesToSmooth[i]._node );
|
||||
getMeshDS()->MoveNode( nodesToSmooth[i]._node, p.X(), p.Y(), p.Z() );
|
||||
@ -3937,7 +3990,7 @@ bool _ViscousBuilder::prepareEdgeToShrink( _LayerEdge& edge,
|
||||
// if ( faceSubMesh->Contains( f ))
|
||||
// faces.push_back( f );
|
||||
// }
|
||||
// for ( unsigned i = 0; i < faces.size(); ++i )
|
||||
// for ( size_t i = 0; i < faces.size(); ++i )
|
||||
// {
|
||||
// const int nbNodes = faces[i]->NbCornerNodes();
|
||||
// for ( int j = 0; j < nbNodes; ++j )
|
||||
@ -4397,11 +4450,11 @@ bool _SmoothNode::Smooth(int& badNb,
|
||||
// count quality metrics (orientation) of triangles around the node
|
||||
int nbOkBefore = 0;
|
||||
gp_XY tgtUV = helper.GetNodeUV( face, _node );
|
||||
for ( unsigned i = 0; i < _simplices.size(); ++i )
|
||||
for ( size_t i = 0; i < _simplices.size(); ++i )
|
||||
nbOkBefore += _simplices[i].IsForward( tgtUV, _node, face, helper, refSign );
|
||||
|
||||
int nbOkAfter = 0;
|
||||
for ( unsigned i = 0; i < _simplices.size(); ++i )
|
||||
for ( size_t i = 0; i < _simplices.size(); ++i )
|
||||
nbOkAfter += _simplices[i].IsForward( newPos, _node, face, helper, refSign );
|
||||
|
||||
if ( nbOkAfter < nbOkBefore )
|
||||
@ -4496,7 +4549,7 @@ gp_XY _SmoothNode::computeAngularPos(vector<gp_XY>& uv,
|
||||
|
||||
_SolidData::~_SolidData()
|
||||
{
|
||||
for ( unsigned i = 0; i < _edges.size(); ++i )
|
||||
for ( size_t i = 0; i < _edges.size(); ++i )
|
||||
{
|
||||
if ( _edges[i] && _edges[i]->_2neibors )
|
||||
delete _edges[i]->_2neibors;
|
||||
@ -4569,7 +4622,7 @@ void _Shrinker1D::AddEdge( const _LayerEdge* e, SMESH_MesherHelper& helper )
|
||||
{
|
||||
// remove target node of the _LayerEdge from _nodes
|
||||
int nbFound = 0;
|
||||
for ( unsigned i = 0; i < _nodes.size(); ++i )
|
||||
for ( size_t i = 0; i < _nodes.size(); ++i )
|
||||
if ( !_nodes[i] || _nodes[i] == tgtNode0 || _nodes[i] == tgtNode1 )
|
||||
_nodes[i] = 0, nbFound++;
|
||||
if ( nbFound == _nodes.size() )
|
||||
@ -4607,7 +4660,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper)
|
||||
l = helper.GetNodeU( E, _edges[1]->_nodes.back(), _nodes.back() );
|
||||
double totLen = GCPnts_AbscissaPoint::Length( aCurve, f, l );
|
||||
|
||||
for ( unsigned i = 0; i < _nodes.size(); ++i )
|
||||
for ( size_t i = 0; i < _nodes.size(); ++i )
|
||||
{
|
||||
if ( !_nodes[i] ) continue;
|
||||
double len = totLen * _normPar[i];
|
||||
@ -4629,7 +4682,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper)
|
||||
if ( _edges[1] )
|
||||
l = helper.GetNodeU( E, _edges[1]->_nodes.back(), _nodes.back() );
|
||||
|
||||
for ( unsigned i = 0; i < _nodes.size(); ++i )
|
||||
for ( size_t i = 0; i < _nodes.size(); ++i )
|
||||
{
|
||||
if ( !_nodes[i] ) continue;
|
||||
double u = f * ( 1-_normPar[i] ) + l * _normPar[i];
|
||||
@ -4648,7 +4701,7 @@ void _Shrinker1D::Compute(bool set3D, SMESH_MesherHelper& helper)
|
||||
void _Shrinker1D::RestoreParams()
|
||||
{
|
||||
if ( _done )
|
||||
for ( unsigned i = 0; i < _nodes.size(); ++i )
|
||||
for ( size_t i = 0; i < _nodes.size(); ++i )
|
||||
{
|
||||
if ( !_nodes[i] ) continue;
|
||||
SMDS_EdgePosition* pos = static_cast<SMDS_EdgePosition*>( _nodes[i]->GetPosition() );
|
||||
@ -4701,7 +4754,7 @@ bool _ViscousBuilder::addBoundaryElements()
|
||||
{
|
||||
SMESH_MesherHelper helper( *_mesh );
|
||||
|
||||
for ( unsigned i = 0; i < _sdVec.size(); ++i )
|
||||
for ( size_t i = 0; i < _sdVec.size(); ++i )
|
||||
{
|
||||
_SolidData& data = _sdVec[i];
|
||||
TopTools_IndexedMapOfShape geomEdges;
|
||||
@ -4772,7 +4825,7 @@ bool _ViscousBuilder::addBoundaryElements()
|
||||
{
|
||||
const TopoDS_Shape* pF = fIt->next();
|
||||
if ( helper.IsSubShape( *pF, data._solid) &&
|
||||
!_ignoreShapeIds.count( e2f->first ))
|
||||
!data._ignoreFaceIds.count( e2f->first ))
|
||||
F = *pF;
|
||||
}
|
||||
}
|
||||
@ -4788,7 +4841,7 @@ bool _ViscousBuilder::addBoundaryElements()
|
||||
// Make faces
|
||||
const int dj1 = reverse ? 0 : 1;
|
||||
const int dj2 = reverse ? 1 : 0;
|
||||
for ( unsigned j = 1; j < ledges.size(); ++j )
|
||||
for ( size_t j = 1; j < ledges.size(); ++j )
|
||||
{
|
||||
vector< const SMDS_MeshNode*>& nn1 = ledges[j-dj1]->_nodes;
|
||||
vector< const SMDS_MeshNode*>& nn2 = ledges[j-dj2]->_nodes;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QApplication>
|
||||
#include <QButtonGroup>
|
||||
#include <QCheckBox>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
@ -49,14 +50,14 @@
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QModelIndex>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QString>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QTabWidget>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QVBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QTabWidget>
|
||||
|
||||
#define SPACING 6
|
||||
#define MARGIN 11
|
||||
@ -162,7 +163,7 @@ namespace StdMeshersGUI
|
||||
myStepSpin->SetValue( myStep = 1. );
|
||||
|
||||
// 3) Coodrinates/Spacing group
|
||||
QFrame* csFrame = new QFrame( this );
|
||||
QFrame* csFrame = new QFrame( this );
|
||||
QVBoxLayout* scLay = new QVBoxLayout( csFrame );
|
||||
scLay->setMargin( 0 );
|
||||
scLay->setSpacing( SPACING );
|
||||
@ -610,7 +611,12 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame()
|
||||
argGroupLayout->addWidget( myThreshold, row, 1 );
|
||||
row++;
|
||||
|
||||
// 2) Grid definition
|
||||
// 2) "Implement edges"
|
||||
myAddEdges = new QCheckBox( tr("ADD_EDGES"), GroupC1 );
|
||||
argGroupLayout->addWidget( myAddEdges, row, 0, 1, 2 );
|
||||
row++;
|
||||
|
||||
// 3) Grid definition
|
||||
QTabWidget* tabWdg = new QTabWidget( fr );
|
||||
myAxisTabs[ 0 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 0 );
|
||||
myAxisTabs[ 1 ] = new StdMeshersGUI::GridAxisTab( tabWdg, 1 );
|
||||
@ -637,6 +643,8 @@ void StdMeshersGUI_CartesianParamCreator::retrieveParams() const
|
||||
else
|
||||
myThreshold->setText( varName );
|
||||
|
||||
myAddEdges->setChecked( h->GetToAddEdges() );
|
||||
|
||||
for ( int ax = 0; ax < 3; ++ax )
|
||||
{
|
||||
if ( h->IsGridBySpacing( ax ))
|
||||
@ -653,7 +661,8 @@ void StdMeshersGUI_CartesianParamCreator::retrieveParams() const
|
||||
}
|
||||
}
|
||||
if ( dlg() )
|
||||
dlg()->setMinimumSize( dlg()->minimumSizeHint().width(), dlg()->minimumSizeHint().height() );
|
||||
dlg()->setMinimumSize( dlg()->minimumSizeHint().width(),
|
||||
dlg()->minimumSizeHint().height() );
|
||||
}
|
||||
|
||||
QString StdMeshersGUI_CartesianParamCreator::storeParams() const
|
||||
@ -668,6 +677,7 @@ QString StdMeshersGUI_CartesianParamCreator::storeParams() const
|
||||
|
||||
h->SetVarParameter( myThreshold->text().toLatin1().constData(), "SetSizeThreshold" );
|
||||
h->SetSizeThreshold( myThreshold->text().toDouble() );
|
||||
h->SetToAddEdges( myAddEdges->isChecked() );
|
||||
|
||||
for ( int ax = 0; ax < 3; ++ax )
|
||||
{
|
||||
|
@ -39,18 +39,19 @@
|
||||
#include <QFrame>
|
||||
#include <QItemDelegate>
|
||||
|
||||
class SMESHGUI_SpinBox;
|
||||
class QLineEdit;
|
||||
class QButtonGroup;
|
||||
class QTreeWidgetItem;
|
||||
class QString;
|
||||
class QWidget;
|
||||
class QTreeWidget;
|
||||
class QListWidget;
|
||||
class QStyleOptionViewItem;
|
||||
class QModelIndex;
|
||||
class QAbstractItemModel;
|
||||
class QButtonGroup;
|
||||
class QCheckBox;
|
||||
class QLineEdit;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
class QModelIndex;
|
||||
class QString;
|
||||
class QStyleOptionViewItem;
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
class QWidget;
|
||||
class SMESHGUI_SpinBox;
|
||||
|
||||
namespace StdMeshersGUI
|
||||
{
|
||||
@ -136,6 +137,7 @@ protected:
|
||||
private:
|
||||
QLineEdit* myName;
|
||||
SMESHGUI_SpinBox* myThreshold;
|
||||
QCheckBox* myAddEdges;
|
||||
StdMeshersGUI::GridAxisTab* myAxisTabs[3];
|
||||
};
|
||||
|
||||
|
@ -523,6 +523,23 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
h->SetObjectEntry( w->GetMainShapeEntry() );
|
||||
}
|
||||
}
|
||||
else if( hypType()=="GeometricProgression" )
|
||||
{
|
||||
StdMeshers::StdMeshers_Geometric1D_var h =
|
||||
StdMeshers::StdMeshers_Geometric1D::_narrow( hypothesis() );
|
||||
|
||||
StdMeshersGUI_SubShapeSelectorWdg* w =
|
||||
widget< StdMeshersGUI_SubShapeSelectorWdg >( 2 );
|
||||
|
||||
h->SetVarParameter( params[0].text(), "SetStartLength" );
|
||||
h->SetStartLength( params[0].myValue.toDouble() );
|
||||
h->SetVarParameter( params[1].text(), "SetCommonRatio" );
|
||||
h->SetCommonRatio( params[1].myValue.toDouble() );
|
||||
if (w) {
|
||||
h->SetReversedEdges( w->GetListOfIDs() );
|
||||
h->SetObjectEntry( w->GetMainShapeEntry() );
|
||||
}
|
||||
}
|
||||
else if( hypType()=="FixedPoints1D" )
|
||||
{
|
||||
StdMeshers::StdMeshers_FixedPoints1D_var h =
|
||||
@ -704,9 +721,9 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
|
||||
h->SetStretchFactor ( params[2].myValue.toDouble() );
|
||||
|
||||
if ( StdMeshersGUI_SubShapeSelectorWdg* idsWg =
|
||||
widget< StdMeshersGUI_SubShapeSelectorWdg >( 3 ))
|
||||
widget< StdMeshersGUI_SubShapeSelectorWdg >( 4 ))
|
||||
{
|
||||
h->SetIgnoreFaces( idsWg->GetListOfIDs() );
|
||||
h->SetFaces( idsWg->GetListOfIDs(), params[3].myValue.toInt() );
|
||||
}
|
||||
}
|
||||
else if( hypType()=="ViscousLayers2D" )
|
||||
@ -878,6 +895,41 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
customWidgets()->append ( aDirectionWidget );
|
||||
}
|
||||
|
||||
else if( hypType()=="GeometricProgression" )
|
||||
{
|
||||
StdMeshers::StdMeshers_Geometric1D_var h =
|
||||
StdMeshers::StdMeshers_Geometric1D::_narrow( hyp );
|
||||
|
||||
item.myName = tr( "SMESH_START_LENGTH_PARAM" );
|
||||
if(!initVariableName( hyp, item, "SetStartLength" ))
|
||||
item.myValue = h->GetStartLength();
|
||||
p.append( item );
|
||||
|
||||
customWidgets()->append (0);
|
||||
|
||||
item.myName = tr( "SMESH_COMMON_RATIO" );
|
||||
if(!initVariableName( hyp, item, "SetCommonRatio" ))
|
||||
item.myValue = h->GetCommonRatio();
|
||||
p.append( item );
|
||||
|
||||
customWidgets()->append (0);
|
||||
|
||||
item.myName = tr( "SMESH_REVERSED_EDGES" );
|
||||
p.append( item );
|
||||
|
||||
StdMeshersGUI_SubShapeSelectorWdg* aDirectionWidget =
|
||||
new StdMeshersGUI_SubShapeSelectorWdg();
|
||||
QString aGeomEntry = SMESHGUI_GenericHypothesisCreator::getShapeEntry();
|
||||
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
|
||||
if ( aGeomEntry == "" )
|
||||
aGeomEntry = h->GetObjectEntry();
|
||||
|
||||
aDirectionWidget->SetGeomShapeEntry( aGeomEntry );
|
||||
aDirectionWidget->SetMainShapeEntry( aMainEntry );
|
||||
aDirectionWidget->SetListOfIDs( h->GetReversedEdges() );
|
||||
aDirectionWidget->showPreview( true );
|
||||
customWidgets()->append ( aDirectionWidget );
|
||||
}
|
||||
|
||||
else if( hypType()=="FixedPoints1D" )
|
||||
{
|
||||
@ -1192,7 +1244,19 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
QString aMainEntry = SMESHGUI_GenericHypothesisCreator::getMainShapeEntry();
|
||||
if ( !aMainEntry.isEmpty() )
|
||||
{
|
||||
item.myName = tr( "SMESH_FACES_WO_LAYERS" );
|
||||
item.myName = tr( "TO_IGNORE_FACES_OR_NOT" );
|
||||
p.append( item );
|
||||
|
||||
StdMeshersGUI_RadioButtonsGrpWdg* ignoreWdg = new StdMeshersGUI_RadioButtonsGrpWdg("");
|
||||
ignoreWdg->setButtonLabels ( QStringList()
|
||||
<< tr("NOT_TO_IGNORE_FACES")
|
||||
<< tr("TO_IGNORE_FACES") );
|
||||
ignoreWdg->setChecked( h->GetIsToIgnoreFaces() );
|
||||
connect(ignoreWdg->getButtonGroup(),SIGNAL(buttonClicked(int)),this,SLOT(onValueChanged()));
|
||||
customWidgets()->append( ignoreWdg );
|
||||
|
||||
item.myName =
|
||||
tr( h->GetIsToIgnoreFaces() ? "SMESH_FACES_WO_LAYERS" : "SMESH_FACES_WITH_LAYERS" );
|
||||
p.append( item );
|
||||
|
||||
StdMeshersGUI_SubShapeSelectorWdg* idsWg =
|
||||
@ -1200,7 +1264,7 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
|
||||
|
||||
idsWg->SetGeomShapeEntry( aMainEntry );
|
||||
idsWg->SetMainShapeEntry( aMainEntry );
|
||||
idsWg->SetListOfIDs( h->GetIgnoreFaces() );
|
||||
idsWg->SetListOfIDs( h->GetFaces() );
|
||||
idsWg->showPreview( true );
|
||||
customWidgets()->append ( idsWg );
|
||||
}
|
||||
@ -1325,6 +1389,13 @@ void StdMeshersGUI_StdHypothesisCreator::attuneStdWidget (QWidget* w, const int)
|
||||
{
|
||||
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "parametric_precision" );
|
||||
}
|
||||
else if( hypType()=="GeometricProgression" )
|
||||
{
|
||||
if (sb->objectName() == tr("SMESH_START_LENGTH_PARAM"))
|
||||
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
|
||||
else if (sb->objectName() == tr("SMESH_COMMON_RATIO"))
|
||||
sb->RangeStepAndValidator( -VALUE_MAX, VALUE_MAX, 0.5, "len_tol_precision" );
|
||||
}
|
||||
else if( hypType()=="MaxLength" )
|
||||
{
|
||||
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
|
||||
@ -1423,6 +1494,7 @@ QString StdMeshersGUI_StdHypothesisCreator::hypTypeName( const QString& t ) cons
|
||||
types.insert( "Deflection1D", "DEFLECTION1D" );
|
||||
types.insert( "Adaptive1D", "ADAPTIVE1D" );
|
||||
types.insert( "Arithmetic1D", "ARITHMETIC_1D" );
|
||||
types.insert( "GeometricProgression", "GEOMETRIC_1D" );
|
||||
types.insert( "FixedPoints1D", "FIXED_POINTS_1D" );
|
||||
types.insert( "AutomaticLength", "AUTOMATIC_LENGTH" );
|
||||
types.insert( "ProjectionSource1D", "PROJECTION_SOURCE_1D" );
|
||||
@ -1596,12 +1668,15 @@ void StdMeshersGUI_StdHypothesisCreator::valueChanged( QWidget* paramWidget)
|
||||
toCopyGroups->setEnabled( true );
|
||||
}
|
||||
}
|
||||
else if ( hypType() == "ViscousLayers2D" && paramWidget->inherits("QButtonGroup"))
|
||||
else if ( hypType().startsWith( "ViscousLayers" ) && paramWidget->inherits("QButtonGroup"))
|
||||
{
|
||||
if ( QLabel* label = getLabel(4) )
|
||||
{
|
||||
bool toIgnore = widget< StdMeshersGUI_RadioButtonsGrpWdg >( 3 )->checkedId();
|
||||
label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" ));
|
||||
if ( hypType() == "ViscousLayers2D" )
|
||||
label->setText( tr( toIgnore ? "SMESH_EDGES_WO_LAYERS" : "SMESH_EDGES_WITH_LAYERS" ));
|
||||
else
|
||||
label->setText( tr( toIgnore ? "SMESH_FACES_WO_LAYERS" : "SMESH_FACES_WITH_LAYERS" ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,10 @@
|
||||
<source>ICON_DLG_ARITHMETIC_1D</source>
|
||||
<translation>mesh_hypo_length.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_GEOMETRIC_1D</source>
|
||||
<translation>mesh_hypo_length.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_FIXED_POINTS_1D</source>
|
||||
<translation>mesh_hypo_length.png</translation>
|
||||
@ -23,10 +27,6 @@
|
||||
<source>ICON_DLG_ADAPTIVE1D</source>
|
||||
<translation>mesh_hypo_length.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_GEOMETRIC_1D</source>
|
||||
<translation>mesh_hypo_length.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_LAYER_DISTRIBUTION</source>
|
||||
<translation>mesh_hypo_layer_distribution.png</translation>
|
||||
@ -163,6 +163,10 @@
|
||||
<source>ICON_SMESH_TREE_HYPO_Arithmetic1D</source>
|
||||
<translation>mesh_tree_hypo_length.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_HYPO_Geometric1D</source>
|
||||
<translation>mesh_tree_hypo_length.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_HYPO_AutomaticLength</source>
|
||||
<translation>mesh_tree_hypo_length.png</translation>
|
||||
@ -231,6 +235,10 @@
|
||||
<source>ICON_SMESH_TREE_HYPO_Propagation</source>
|
||||
<translation>mesh_tree_hypo_length.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_HYPO_PropagOfDistribution</source>
|
||||
<translation>mesh_tree_hypo_length.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_HYPO_QuadranglePreference</source>
|
||||
<translation>mesh_tree_algo_quad.png</translation>
|
||||
|
@ -15,6 +15,18 @@
|
||||
<source>TO_IGNORE_EDGES</source>
|
||||
<translation>Edges without layers (inlets and oulets)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TO_IGNORE_FACES_OR_NOT</source>
|
||||
<translation>Specified faces are</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NOT_TO_IGNORE_FACES</source>
|
||||
<translation>Faces with layers (walls)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TO_IGNORE_FACES</source>
|
||||
<translation>Faces without layers (inlets and oulets)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>@default</name>
|
||||
@ -22,14 +34,22 @@
|
||||
<source>SMESH_ARITHMETIC_1D_HYPOTHESIS</source>
|
||||
<translation>Arithmetic 1D</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_ARITHMETIC_1D_PARAM</source>
|
||||
<translation>Arithmetic Reason</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_ARITHMETIC_1D_TITLE</source>
|
||||
<translation>Hypothesis Construction</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_GEOMETRIC_1D_HYPOTHESIS</source>
|
||||
<translation>Geometric Progression</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_GEOMETRIC_1D_TITLE</source>
|
||||
<translation>Hypothesis Construction</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_COMMON_RATIO</source>
|
||||
<translation>Common Ratio</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_AUTOMATIC_LENGTH_HYPOTHESIS</source>
|
||||
<translation>Automatic Length</translation>
|
||||
@ -493,6 +513,10 @@
|
||||
<source>THRESHOLD</source>
|
||||
<translation>Threshold</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ADD_EDGES</source>
|
||||
<translation>Implement Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>AXIS_X</source>
|
||||
<translation>Axis X</translation>
|
||||
|
@ -3,6 +3,18 @@
|
||||
<TS version="2.0" language="fr_FR">
|
||||
<context>
|
||||
<name>@default</name>
|
||||
<message>
|
||||
<source>SMESH_COMMON_RATIO</source>
|
||||
<translation type="unfinished">Common Ratio</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_GEOMETRIC_1D_TITLE</source>
|
||||
<translation type="unfinished">Hypothesis Construction</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_GEOMETRIC_1D_HYPOTHESIS</source>
|
||||
<translation type="unfinished">Geometric Progression</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_EDGES_WITH_LAYERS</source>
|
||||
<translation type="unfinished">Edges with layers</translation>
|
||||
@ -475,6 +487,10 @@
|
||||
</context>
|
||||
<context>
|
||||
<name>StdMeshersGUI_CartesianParamCreator</name>
|
||||
<message>
|
||||
<source>ADD_EDGES</source>
|
||||
<translation type="unfinished">Implement Edges</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>THRESHOLD</source>
|
||||
<translation>Seuil</translation>
|
||||
|
@ -129,8 +129,10 @@ ENDIF(SALOME_SMESH_ENABLE_MEFISTO)
|
||||
SET(StdMeshersEngine_SOURCES
|
||||
StdMeshers_i.cxx
|
||||
StdMeshers_LocalLength_i.cxx
|
||||
StdMeshers_Reversible1D_i.cxx
|
||||
StdMeshers_StartEndLength_i.cxx
|
||||
StdMeshers_Arithmetic1D_i.cxx
|
||||
StdMeshers_Geometric1D_i.cxx
|
||||
StdMeshers_FixedPoints1D_i.cxx
|
||||
StdMeshers_NumberOfSegments_i.cxx
|
||||
StdMeshers_Deflection1D_i.cxx
|
||||
|
@ -224,6 +224,28 @@ void StdMeshers_CartesianParameters3D_i::GetGridSpacing(SMESH::string_array_out
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SetToAddEdges
|
||||
//purpose : Enables implementation of geometrical edges into the mesh.
|
||||
//=======================================================================
|
||||
|
||||
void StdMeshers_CartesianParameters3D_i::SetToAddEdges(CORBA::Boolean toAdd)
|
||||
{
|
||||
GetImpl()->SetToAddEdges( toAdd );
|
||||
SMESH::TPythonDump() << _this() << ".SetToAddEdges( " << toAdd << " )";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetToAddEdges
|
||||
//purpose : Returns true if implementation of geometrical edges into the
|
||||
// mesh is enabled
|
||||
//=======================================================================
|
||||
|
||||
CORBA::Boolean StdMeshers_CartesianParameters3D_i::GetToAddEdges()
|
||||
{
|
||||
return GetImpl()->GetToAddEdges();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsGridBySpacing
|
||||
//purpose : Return true if the grid is defined by spacing functions and
|
||||
|
@ -84,6 +84,14 @@ class STDMESHERS_I_EXPORT StdMeshers_CartesianParameters3D_i:
|
||||
SMESH::double_array_out xInternalPoints,
|
||||
CORBA::Short axis) throw (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* \brief Enables implementation of geometrical edges into the mesh. If this feature
|
||||
* is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
|
||||
* they don't coincide with the grid lines
|
||||
*/
|
||||
void SetToAddEdges(CORBA::Boolean toAdd);
|
||||
CORBA::Boolean GetToAddEdges();
|
||||
|
||||
/*!
|
||||
* \brief Return true if the grid is defined by spacing functions and
|
||||
* not by node coordinates
|
||||
|
143
src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx
Normal file
143
src/StdMeshers_I/StdMeshers_Geometric1D_i.cxx
Normal file
@ -0,0 +1,143 @@
|
||||
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
// File : StdMeshers_Geometric1D_i.cxx
|
||||
// Module : SMESH
|
||||
//
|
||||
#include "StdMeshers_Geometric1D_i.hxx"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
|
||||
#include <Utils_CorbaException.hxx>
|
||||
#include <utilities.h>
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Geometric1D_i::StdMeshers_Geometric1D_i
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_Geometric1D_i::StdMeshers_Geometric1D_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA ),
|
||||
StdMeshers_Reversible1D_i( this )
|
||||
{
|
||||
myBaseImpl = new ::StdMeshers_Geometric1D( theGenImpl->GetANewId(),
|
||||
theStudyId,
|
||||
theGenImpl );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Sets <start segment length> parameter value
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Geometric1D_i::SetStartLength( CORBA::Double theLength )
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
try {
|
||||
this->GetImpl()->SetStartLength( theLength );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
// Update Python script
|
||||
SMESH::TPythonDump()
|
||||
<< _this() << ".SetStartLength( " << SMESH::TVar(theLength) << " )";
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Sets <common ratio> parameter value
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Geometric1D_i::SetCommonRatio( CORBA::Double factor )
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
try {
|
||||
this->GetImpl()->SetCommonRatio( factor );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
// Update Python script
|
||||
SMESH::TPythonDump()
|
||||
<< _this() << ".SetCommonRatio( " << SMESH::TVar(factor) << " )";
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Returns length of the first segment
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Double StdMeshers_Geometric1D_i::GetStartLength()
|
||||
{
|
||||
return this->GetImpl()->GetStartLength();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Returns value of Common Ratio
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Double StdMeshers_Geometric1D_i::GetCommonRatio()
|
||||
{
|
||||
return this->GetImpl()->GetCommonRatio();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Geometric1D_i::GetImpl
|
||||
*
|
||||
* Get implementation
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
::StdMeshers_Geometric1D* StdMeshers_Geometric1D_i::GetImpl()
|
||||
{
|
||||
return ( ::StdMeshers_Geometric1D* )myBaseImpl;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether hypothesis supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
CORBA::Boolean StdMeshers_Geometric1D_i::IsDimSupported(::SMESH::Dimension type)
|
||||
{
|
||||
return type == SMESH::DIM_1D;
|
||||
}
|
65
src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx
Normal file
65
src/StdMeshers_I/StdMeshers_Geometric1D_i.hxx
Normal file
@ -0,0 +1,65 @@
|
||||
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
// File : StdMeshers_Geometric1D_i.hxx
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMESH_Geometric1D_I_HXX_
|
||||
#define _SMESH_Geometric1D_I_HXX_
|
||||
|
||||
#include "SMESH_StdMeshers_I.hxx"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_Geometric1D.hxx"
|
||||
#include "StdMeshers_Reversible1D_i.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Geometric 1D hypothesis
|
||||
// ======================================================
|
||||
class STDMESHERS_I_EXPORT StdMeshers_Geometric1D_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_Geometric1D,
|
||||
public virtual SMESH_Hypothesis_i,
|
||||
public virtual StdMeshers_Reversible1D_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_Geometric1D_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
|
||||
void SetStartLength(CORBA::Double length) throw(SALOME::SALOME_Exception);
|
||||
void SetCommonRatio(CORBA::Double factor) throw(SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Double GetStartLength();
|
||||
CORBA::Double GetCommonRatio();
|
||||
|
||||
virtual ::CORBA::Boolean IsDimSupported(::SMESH::Dimension type);
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_Geometric1D* GetImpl();
|
||||
};
|
||||
|
||||
#endif
|
@ -37,7 +37,7 @@ using namespace std;
|
||||
//purpose : Return study entry of GEOM Object
|
||||
//=======================================================================
|
||||
|
||||
std::string StdMeshers_ObjRefUlils::GeomObjectToEntry(GEOM::GEOM_Object_ptr& theGeomObject)
|
||||
std::string StdMeshers_ObjRefUlils::GeomObjectToEntry(GEOM::GEOM_Object_ptr theGeomObject)
|
||||
{
|
||||
if ( CORBA::is_nil( theGeomObject ))
|
||||
return "NULL_OBJECT";
|
||||
@ -109,13 +109,16 @@ void StdMeshers_ObjRefUlils::SaveToStream( const TopoDS_Shape& theShape, ostream
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
TopoDS_Shape StdMeshers_ObjRefUlils::LoadFromStream( istream & stream)
|
||||
TopoDS_Shape StdMeshers_ObjRefUlils::LoadFromStream( istream & stream,
|
||||
std::string* entry)
|
||||
{
|
||||
if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
|
||||
SALOMEDS::Study_var study = gen->GetCurrentStudy();
|
||||
if ( ! study->_is_nil() ) {
|
||||
string str;
|
||||
if (stream >> str) {
|
||||
string str;
|
||||
if (stream >> str) {
|
||||
if ( entry )
|
||||
* entry = str;
|
||||
if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
|
||||
SALOMEDS::Study_var study = gen->GetCurrentStudy();
|
||||
if ( ! study->_is_nil() ) {
|
||||
SALOMEDS::SObject_wrap sobj = study->FindObjectID( str.c_str() );
|
||||
CORBA::Object_var obj = gen->SObjectToObject( sobj );
|
||||
GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( obj );
|
||||
@ -123,6 +126,8 @@ TopoDS_Shape StdMeshers_ObjRefUlils::LoadFromStream( istream & stream)
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( entry )
|
||||
entry->clear();
|
||||
return TopoDS_Shape();
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
/*!
|
||||
* \brief Return study entry of GEOM Object
|
||||
*/
|
||||
static std::string GeomObjectToEntry(GEOM::GEOM_Object_ptr& theGeomObject);
|
||||
static std::string GeomObjectToEntry(GEOM::GEOM_Object_ptr theGeomObject);
|
||||
|
||||
/*!
|
||||
* \brief Return GEOM Object by its study entry or TopoDS_Shape
|
||||
@ -89,7 +89,7 @@ public:
|
||||
* \param stream - the stream
|
||||
* \retval TopoDS_Shape - resulting shape
|
||||
*/
|
||||
static TopoDS_Shape LoadFromStream( std::istream & stream );
|
||||
static TopoDS_Shape LoadFromStream( std::istream & stream, std::string* entry=NULL );
|
||||
|
||||
/*!
|
||||
* \brief Store the CORBA object in the stream
|
||||
|
@ -23,7 +23,6 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
// File : StdMeshers_Propagation_i.cxx
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
//
|
||||
#include "StdMeshers_Propagation_i.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
@ -43,8 +42,8 @@ using namespace std;
|
||||
StdMeshers_Propagation_i::StdMeshers_Propagation_i (PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA )
|
||||
{
|
||||
MESSAGE( "StdMeshers_Propagation_i::StdMeshers_Propagation_i" );
|
||||
myBaseImpl = new ::StdMeshers_Propagation(theGenImpl->GetANewId(),
|
||||
@ -52,42 +51,50 @@ StdMeshers_Propagation_i::StdMeshers_Propagation_i (PortableServer::POA_ptr theP
|
||||
theGenImpl);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Propagation_i::~StdMeshers_Propagation_i
|
||||
*
|
||||
* Destructor
|
||||
*/
|
||||
//=============================================================================
|
||||
StdMeshers_Propagation_i::~StdMeshers_Propagation_i()
|
||||
{
|
||||
MESSAGE( "StdMeshers_Propagation_i::~StdMeshers_Propagation_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Propagation_i::GetImpl
|
||||
*
|
||||
* Get implementation
|
||||
*/
|
||||
//=============================================================================
|
||||
::StdMeshers_Propagation* StdMeshers_Propagation_i::GetImpl()
|
||||
{
|
||||
MESSAGE( "StdMeshers_Propagation_i::GetImpl" );
|
||||
return ( ::StdMeshers_Propagation* )myBaseImpl;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether hypothesis supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* \brief Verify whether hypothesis supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
//================================================================================
|
||||
CORBA::Boolean StdMeshers_Propagation_i::IsDimSupported( SMESH::Dimension type )
|
||||
{
|
||||
return type == SMESH::DIM_1D;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_PropagOfDistribution_i::StdMeshers_PropagOfDistribution_i
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
StdMeshers_PropagOfDistribution_i::
|
||||
StdMeshers_PropagOfDistribution_i (PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA )
|
||||
{
|
||||
myBaseImpl = new ::StdMeshers_PropagOfDistribution(theGenImpl->GetANewId(),
|
||||
theStudyId,
|
||||
theGenImpl);
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether hypothesis supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
CORBA::Boolean StdMeshers_PropagOfDistribution_i::IsDimSupported( SMESH::Dimension type )
|
||||
{
|
||||
return type == SMESH::DIM_1D;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
// File : StdMeshers_Propagation_i.hxx
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
//
|
||||
#ifndef _SMESH_PROPAGATION_I_HXX_
|
||||
#define _SMESH_PROPAGATION_I_HXX_
|
||||
@ -41,6 +40,7 @@ class SMESH_Gen;
|
||||
// ======================================================
|
||||
// Propagation hypothesis
|
||||
// ======================================================
|
||||
|
||||
class STDMESHERS_I_EXPORT StdMeshers_Propagation_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_Propagation,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
@ -50,11 +50,24 @@ public:
|
||||
StdMeshers_Propagation_i (PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl);
|
||||
// Destructor
|
||||
virtual ~StdMeshers_Propagation_i();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_Propagation* GetImpl();
|
||||
// ======================================================
|
||||
// Propagation of Distribution hypothesis
|
||||
// ======================================================
|
||||
|
||||
class STDMESHERS_I_EXPORT StdMeshers_PropagOfDistribution_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_PropagOfDistribution,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_PropagOfDistribution_i (PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl);
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
|
@ -21,14 +21,17 @@
|
||||
// Module : SMESH
|
||||
|
||||
#include "StdMeshers_QuadrangleParams_i.hxx"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
#include "StdMeshers_ObjRefUlils.hxx"
|
||||
|
||||
#include "Utils_CorbaException.hxx"
|
||||
#include "utilities.h"
|
||||
#include <Utils_CorbaException.hxx>
|
||||
#include <utilities.h>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include "SMESH_TryCatch.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -82,13 +85,11 @@ void StdMeshers_QuadrangleParams_i::SetTriaVertex(CORBA::Long vertID)
|
||||
this->GetImpl()->SetTriaVertex( vertID );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
|
||||
// Update Python script
|
||||
SMESH::TPythonDump() << _this() << ".SetTriaVertex( "
|
||||
<< vertID << " )";
|
||||
SMESH::TPythonDump() << _this() << ".SetTriaVertex( " << vertID << " )";
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -147,8 +148,7 @@ char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
|
||||
entry = this->GetImpl()->GetObjectEntry();
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
return CORBA::string_dup( entry );
|
||||
}
|
||||
@ -162,12 +162,6 @@ char* StdMeshers_QuadrangleParams_i::GetObjectEntry()
|
||||
//=============================================================================
|
||||
void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
|
||||
{
|
||||
//static char* quadTypes[5] = {"StdMeshers.QUAD_STANDARD",
|
||||
// "StdMeshers.QUAD_TRIANGLE_PREF",
|
||||
// "StdMeshers.QUAD_QUADRANGLE_PREF",
|
||||
// "StdMeshers.QUAD_QUADRANGLE_PREF_REVERSED",
|
||||
// "StdMeshers.QUAD_REDUCED"};
|
||||
|
||||
MESSAGE("StdMeshers_QuadrangleParams_i::SetQuadType");
|
||||
ASSERT(myBaseImpl);
|
||||
|
||||
@ -199,7 +193,6 @@ void StdMeshers_QuadrangleParams_i::SetQuadType(StdMeshers::QuadType type)
|
||||
quadType = "UNKNOWN";
|
||||
}
|
||||
SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadType << " )";
|
||||
//SMESH::TPythonDump() << _this() << ".SetQuadType( " << quadTypes[int(type)] << " )";
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -216,6 +209,100 @@ StdMeshers::QuadType StdMeshers_QuadrangleParams_i::GetQuadType()
|
||||
return StdMeshers::QuadType(int(this->GetImpl()->GetQuadType()));
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Set positions of enforced nodes
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshers_QuadrangleParams_i::SetEnforcedNodes(const GEOM::ListOfGO& theVertices,
|
||||
const SMESH::nodes_array& thePoints)
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
try {
|
||||
std::vector< TopoDS_Shape > shapes;
|
||||
std::vector< gp_Pnt > points;
|
||||
shapes.reserve( theVertices.length() );
|
||||
points.reserve( thePoints.length() );
|
||||
|
||||
myShapeEntries.clear();
|
||||
|
||||
for ( size_t i = 0; i < theVertices.length(); ++i )
|
||||
{
|
||||
if ( CORBA::is_nil( theVertices[i] ))
|
||||
continue;
|
||||
CORBA::String_var entry = theVertices[i]->GetStudyEntry();
|
||||
if ( !entry.in() || !entry.in()[0] )
|
||||
THROW_SALOME_CORBA_EXCEPTION( "Not published enforced vertex shape", SALOME::BAD_PARAM );
|
||||
|
||||
shapes.push_back( StdMeshers_ObjRefUlils::GeomObjectToShape( theVertices[i].in() ));
|
||||
myShapeEntries.push_back( entry.in() );
|
||||
}
|
||||
for ( size_t i = 0; i < thePoints.length(); ++i )
|
||||
{
|
||||
points.push_back( gp_Pnt( thePoints[i].x, thePoints[i].y, thePoints[i].z ));
|
||||
}
|
||||
this->GetImpl()->SetEnforcedNodes( shapes, points );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
// Update Python script
|
||||
SMESH::TPythonDump() << _this() << ".SetEnforcedNodes( "
|
||||
<< theVertices << ", " << thePoints << " )";
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Returns positions of enforced nodes
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshers_QuadrangleParams_i::GetEnforcedNodes(GEOM::ListOfGO_out theVertices,
|
||||
SMESH::nodes_array_out thePoints)
|
||||
{
|
||||
SMESH_TRY;
|
||||
|
||||
std::vector< TopoDS_Shape > shapes;
|
||||
std::vector< gp_Pnt > points;
|
||||
this->GetImpl()->GetEnforcedNodes( shapes, points );
|
||||
|
||||
theVertices = new GEOM::ListOfGO;
|
||||
thePoints = new SMESH::nodes_array;
|
||||
|
||||
size_t i = 0;
|
||||
theVertices->length( myShapeEntries.size() );
|
||||
for ( i = 0; i < myShapeEntries.size(); ++i )
|
||||
theVertices[i] =
|
||||
StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject( myShapeEntries[i], shapes[i] );
|
||||
|
||||
thePoints->length( points.size() );
|
||||
for ( i = 0; i < points.size(); ++i )
|
||||
{
|
||||
thePoints[i].x = points[i].X();
|
||||
thePoints[i].y = points[i].Y();
|
||||
thePoints[i].z = points[i].Z();
|
||||
}
|
||||
SMESH_CATCH( SMESH::doNothing );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Returns study entries of shapes defining enforced nodes
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
SMESH::string_array* StdMeshers_QuadrangleParams_i::GetEnfVertices()
|
||||
{
|
||||
SMESH::string_array_var arr = new SMESH::string_array;
|
||||
arr->length( myShapeEntries.size() );
|
||||
|
||||
for ( size_t i = 0; i < myShapeEntries.size(); ++i )
|
||||
arr[ i ] = myShapeEntries[ i ].c_str();
|
||||
|
||||
return arr._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_QuadrangleParams_i::GetImpl
|
||||
@ -243,3 +330,58 @@ CORBA::Boolean StdMeshers_QuadrangleParams_i::IsDimSupported( SMESH::Dimension t
|
||||
{
|
||||
return type == SMESH::DIM_2D;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Write parameters in a string
|
||||
* \retval char* - resulting string
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
char* StdMeshers_QuadrangleParams_i::SaveTo()
|
||||
{
|
||||
ASSERT( myBaseImpl );
|
||||
std::ostringstream os;
|
||||
|
||||
os << "ENTRIES: " << myShapeEntries.size();
|
||||
for ( size_t i = 0; i < myShapeEntries.size(); ++i )
|
||||
StdMeshers_ObjRefUlils::SaveToStream( myShapeEntries[ i ], os );
|
||||
os << " ";
|
||||
|
||||
myBaseImpl->SaveTo( os );
|
||||
|
||||
return CORBA::string_dup( os.str().c_str() );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Retrieve parameters from the string
|
||||
* \param theStream - the input string
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshers_QuadrangleParams_i::LoadFrom( const char* theStream )
|
||||
{
|
||||
ASSERT( myBaseImpl );
|
||||
|
||||
bool hasEntries = ( strncmp( "ENTRIES: ", theStream, 9 ) == 0 );
|
||||
std::istringstream is( theStream + ( hasEntries ? 9 : 0 ));
|
||||
|
||||
if ( hasEntries )
|
||||
{
|
||||
int nb = 0;
|
||||
if ( is >> nb && nb > 0 )
|
||||
{
|
||||
std::vector< TopoDS_Shape > shapes;
|
||||
std::vector< gp_Pnt > points;
|
||||
myShapeEntries.resize( nb );
|
||||
|
||||
for ( int i = 0; i < nb; ++i )
|
||||
shapes.push_back( StdMeshers_ObjRefUlils::LoadFromStream( is, & myShapeEntries[i] ));
|
||||
|
||||
GetImpl()->SetEnforcedNodes( shapes, points );
|
||||
}
|
||||
}
|
||||
|
||||
myBaseImpl->LoadFrom( is );
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
// File : StdMeshers_QuadrangleParams_i.hxx
|
||||
// Author : Sergey KUUL, OCC
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_QUADRANGLEPARAMS_I_HXX_
|
||||
#define _SMESH_QUADRANGLEPARAMS_I_HXX_
|
||||
@ -47,13 +46,6 @@ public:
|
||||
// Destructor
|
||||
virtual ~StdMeshers_QuadrangleParams_i();
|
||||
|
||||
// Set length
|
||||
//void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
|
||||
// throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Get length
|
||||
//CORBA::Double GetLength(CORBA::Boolean theIsStart);
|
||||
|
||||
// Set base vertex for triangles
|
||||
void SetTriaVertex (CORBA::Long vertID);
|
||||
|
||||
@ -72,11 +64,31 @@ public:
|
||||
// Get the type of quadrangulation
|
||||
StdMeshers::QuadType GetQuadType();
|
||||
|
||||
// Set positions of enforced nodes
|
||||
void SetEnforcedNodes(const GEOM::ListOfGO& vertices,
|
||||
const SMESH::nodes_array& points) throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Returns positions of enforced nodes
|
||||
void GetEnforcedNodes(GEOM::ListOfGO_out vertices, SMESH::nodes_array_out points);
|
||||
|
||||
// Returns entries of shapes defining enforced nodes
|
||||
SMESH::string_array* GetEnfVertices();
|
||||
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_QuadrangleParams* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
|
||||
// Redefined Persistence
|
||||
virtual char* SaveTo();
|
||||
virtual void LoadFrom( const char* theStream );
|
||||
|
||||
protected:
|
||||
|
||||
std::vector<std::string> myShapeEntries;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
143
src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx
Normal file
143
src/StdMeshers_I/StdMeshers_Reversible1D_i.cxx
Normal file
@ -0,0 +1,143 @@
|
||||
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
// File : StdMeshers_Reversible1D_i.cxx
|
||||
// Module : SMESH
|
||||
//
|
||||
#include "StdMeshers_Reversible1D_i.hxx"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
|
||||
#include <Utils_CorbaException.hxx>
|
||||
#include <utilities.h>
|
||||
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Constructor
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
StdMeshers_Reversible1D_i::StdMeshers_Reversible1D_i( SMESH_Hypothesis_i* reversible )
|
||||
: myHyp( reversible )
|
||||
{
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Reversible1D_i::SetReversedEdges
|
||||
*
|
||||
* Set edges to reverse
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Reversible1D_i::SetReversedEdges( const SMESH::long_array& theIds )
|
||||
{
|
||||
try {
|
||||
std::vector<int> ids( theIds.length() );
|
||||
CORBA::Long iEnd = theIds.length();
|
||||
for ( CORBA::Long i = 0; i < iEnd; i++ )
|
||||
ids[ i ] = theIds[ i ];
|
||||
|
||||
this->GetImpl()->SetReversedEdges( ids );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
|
||||
// Update Python script
|
||||
SMESH::TPythonDump() << myHyp->_this() << ".SetReversedEdges( " << theIds << " )";
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Reversible1D_i::SetObjectEntry
|
||||
*
|
||||
* Set the Entry for the Main Object
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_Reversible1D_i::SetObjectEntry( const char* theEntry )
|
||||
{
|
||||
string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
|
||||
try {
|
||||
this->GetImpl()->SetObjectEntry( entry.c_str() );
|
||||
// Update Python script
|
||||
SMESH::TPythonDump() << myHyp->_this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )";
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),SALOME::BAD_PARAM );
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Reversible1D_i::GetObjectEntry
|
||||
*
|
||||
* Set the Entry for the Main Object
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
char* StdMeshers_Reversible1D_i::GetObjectEntry()
|
||||
{
|
||||
const char* entry;
|
||||
try {
|
||||
entry = this->GetImpl()->GetObjectEntry();
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
|
||||
}
|
||||
return CORBA::string_dup( entry );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Reversible1D_i::GetReversedEdges
|
||||
*
|
||||
* Get reversed edges
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::long_array* StdMeshers_Reversible1D_i::GetReversedEdges()
|
||||
{
|
||||
SMESH::long_array_var anArray = new SMESH::long_array;
|
||||
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
|
||||
anArray->length( ids.size() );
|
||||
for ( CORBA::Long i = 0; i < ids.size(); i++)
|
||||
anArray [ i ] = ids [ i ];
|
||||
|
||||
return anArray._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Reversible1D_i::GetImpl
|
||||
*
|
||||
* Get implementation
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
::StdMeshers_Reversible1D* StdMeshers_Reversible1D_i::GetImpl()
|
||||
{
|
||||
return ( ::StdMeshers_Reversible1D* )myHyp->GetImpl();
|
||||
}
|
66
src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx
Normal file
66
src/StdMeshers_I/StdMeshers_Reversible1D_i.hxx
Normal file
@ -0,0 +1,66 @@
|
||||
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
// File : StdMeshers_Reversible1D_i.hxx
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMESH_Reversible1D_I_HXX_
|
||||
#define _SMESH_Reversible1D_I_HXX_
|
||||
|
||||
#include "SMESH_StdMeshers_I.hxx"
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_Reversible1D.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Common metrhods of Reversible 1D hypotheses
|
||||
// ======================================================
|
||||
class STDMESHERS_I_EXPORT StdMeshers_Reversible1D_i:
|
||||
public virtual POA_StdMeshers::Reversible1D
|
||||
{
|
||||
public:
|
||||
StdMeshers_Reversible1D_i( SMESH_Hypothesis_i* reversible );
|
||||
|
||||
//Set Reversed Edges
|
||||
void SetReversedEdges( const SMESH::long_array& theIDs);
|
||||
|
||||
//Get Reversed Edges
|
||||
SMESH::long_array* GetReversedEdges();
|
||||
|
||||
//Set the Entry of the Object
|
||||
void SetObjectEntry( const char* theEntry);
|
||||
|
||||
//Get Object Entry
|
||||
char* GetObjectEntry();
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_Reversible1D* GetImpl();
|
||||
|
||||
private:
|
||||
SMESH_Hypothesis_i* myHyp;
|
||||
};
|
||||
|
||||
#endif
|
@ -78,15 +78,34 @@ StdMeshers_ViscousLayers_i::~StdMeshers_ViscousLayers_i()
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshers_ViscousLayers_i::SetIgnoreFaces(const ::SMESH::long_array& faceIDs)
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
void StdMeshers_ViscousLayers_i::SetFaces(const ::SMESH::long_array& faceIDs,
|
||||
CORBA::Boolean toIgnore)
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
vector<int> ids( faceIDs.length() );
|
||||
for ( unsigned i = 0; i < ids.size(); ++i )
|
||||
if (( ids[i] = faceIDs[i] ) < 1 )
|
||||
THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM );
|
||||
GetImpl()->SetBndShapes( ids, /*toIgnore=*/true );
|
||||
SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )";
|
||||
|
||||
GetImpl()->SetBndShapes( ids, toIgnore );
|
||||
|
||||
SMESH::TPythonDump() << _this() << ".SetFaces( " << faceIDs << ", " << toIgnore << " )";
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
SMESH::long_array* StdMeshers_ViscousLayers_i::GetFaces()
|
||||
{
|
||||
vector<int> idsVec = GetImpl()->GetBndShapes();
|
||||
SMESH::long_array_var ids = new SMESH::long_array;
|
||||
ids->length( idsVec.size() );
|
||||
for ( unsigned i = 0; i < idsVec.size(); ++i )
|
||||
ids[i] = idsVec[i];
|
||||
return ids._retn();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -97,15 +116,37 @@ throw ( SALOME::SALOME_Exception )
|
||||
|
||||
SMESH::long_array* StdMeshers_ViscousLayers_i::GetIgnoreFaces()
|
||||
{
|
||||
SMESH::long_array_var ids = new SMESH::long_array;
|
||||
if ( GetImpl()->IsToIgnoreShapes() )
|
||||
{
|
||||
vector<int> idsVec = GetImpl()->GetBndShapes();
|
||||
ids->length( idsVec.size() );
|
||||
for ( unsigned i = 0; i < idsVec.size(); ++i )
|
||||
ids[i] = idsVec[i];
|
||||
}
|
||||
return ids._retn();
|
||||
return this->GetFaces();
|
||||
return new SMESH::long_array;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
CORBA::Boolean StdMeshers_ViscousLayers_i::GetIsToIgnoreFaces()
|
||||
{
|
||||
return GetImpl()->IsToIgnoreShapes();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void StdMeshers_ViscousLayers_i::SetIgnoreFaces(const ::SMESH::long_array& faceIDs)
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
vector<int> ids( faceIDs.length() );
|
||||
for ( unsigned i = 0; i < ids.size(); ++i )
|
||||
if (( ids[i] = faceIDs[i] ) < 1 )
|
||||
THROW_SALOME_CORBA_EXCEPTION( "Invalid face id", SALOME::BAD_PARAM );
|
||||
GetImpl()->SetBndShapes( ids, /*toIgnore=*/true );
|
||||
SMESH::TPythonDump() << _this() << ".SetIgnoreFaces( " << faceIDs << " )";
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
|
@ -51,6 +51,11 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers_i:
|
||||
void SetIgnoreFaces(const ::SMESH::long_array& faceIDs) throw ( SALOME::SALOME_Exception );
|
||||
SMESH::long_array* GetIgnoreFaces();
|
||||
|
||||
void SetFaces(const SMESH::long_array& faceIDs,
|
||||
CORBA::Boolean toIgnore) throw (SALOME::SALOME_Exception);
|
||||
SMESH::long_array* GetFaces();
|
||||
CORBA::Boolean GetIsToIgnoreFaces();
|
||||
|
||||
void SetTotalThickness(::CORBA::Double thickness) throw ( SALOME::SALOME_Exception );
|
||||
::CORBA::Double GetTotalThickness();
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "StdMeshers_AutomaticLength_i.hxx"
|
||||
#include "StdMeshers_StartEndLength_i.hxx"
|
||||
#include "StdMeshers_Arithmetic1D_i.hxx"
|
||||
#include "StdMeshers_Geometric1D_i.hxx"
|
||||
#include "StdMeshers_FixedPoints1D_i.hxx"
|
||||
#include "StdMeshers_NumberOfSegments_i.hxx"
|
||||
#include "StdMeshers_Deflection1D_i.hxx"
|
||||
@ -136,6 +137,8 @@ STDMESHERS_I_EXPORT
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_NotConformAllowed_i>;
|
||||
else if (strcmp(aHypName, "Propagation") == 0)
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Propagation_i>;
|
||||
else if (strcmp(aHypName, "PropagOfDistribution") == 0)
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_PropagOfDistribution_i>;
|
||||
else if (strcmp(aHypName, "MaxElementArea") == 0)
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_MaxElementArea_i>;
|
||||
else if (strcmp(aHypName, "MaxElementVolume") == 0)
|
||||
@ -150,6 +153,8 @@ STDMESHERS_I_EXPORT
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_FixedPoints1D_i>;
|
||||
else if (strcmp(aHypName, "Arithmetic1D") == 0)
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Arithmetic1D_i>;
|
||||
else if (strcmp(aHypName, "GeometricProgression") == 0)
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_Geometric1D_i>;
|
||||
else if (strcmp(aHypName, "AutomaticLength") == 0)
|
||||
aCreator = new StdHypothesisCreator_i<StdMeshers_AutomaticLength_i>;
|
||||
else if (strcmp(aHypName, "QuadranglePreference") == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user