mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
Merge remote branch 'origin/V7_dev'
This commit is contained in:
commit
c6ab650a79
@ -1,4 +1,4 @@
|
||||
# 3d mesh generation
|
||||
# 3d mesh generation and mesh exploration
|
||||
|
||||
import salome
|
||||
salome.salome_init()
|
||||
@ -76,3 +76,20 @@ tetra.Compute()
|
||||
|
||||
# Create a mesh group of all triangles generated on geom faces present in faces_group
|
||||
group = tetra.Group(faces_group)
|
||||
|
||||
###
|
||||
# Explore the mesh
|
||||
###
|
||||
|
||||
# Retrieve coordinates of nodes
|
||||
coordStr = ""
|
||||
for node in tetra.GetNodesId():
|
||||
x,y,z = tetra.GetNodeXYZ( node )
|
||||
coordStr += "%s (%s, %s, %s) " % ( node, x,y,z )
|
||||
pass
|
||||
|
||||
# Retrieve nodal connectivity of triangles
|
||||
triaStr = ""
|
||||
for tria in tetra.GetElementsByType( SMESH.FACE ):
|
||||
nodes = tetra.GetElemNodes( tria )
|
||||
triaStr += "%s (%s, %s, %s) " % ( tria, nodes[0], nodes[1], nodes[2] )
|
||||
|
@ -38,3 +38,7 @@ print "MESH: Min aspect = %s, Max aspect = %s" % ( aspects[0], aspects[1] )
|
||||
# get max value of Aspect Ratio of faces in triaGroup
|
||||
grAspects = mesh.GetMinMax( SMESH.FT_AspectRatio, triaGroup )
|
||||
print "GROUP: Max aspect = %s" % grAspects[1]
|
||||
|
||||
# get Aspect Ratio of an element
|
||||
aspect = mesh.FunctorValue( SMESH.FT_AspectRatio, ids[0] )
|
||||
print "Aspect ratio of the face %s = %s" % ( ids[0], aspect )
|
||||
|
@ -40,7 +40,7 @@ print "size", aGroup.Size()
|
||||
print "is empty", aGroup.IsEmpty()
|
||||
|
||||
# check of presence of an entity in the group
|
||||
aGroup.Add([1,2]) # method specific to the standalone group
|
||||
aGroup.Add([1,2]) # Add() method is specific to the standalone group
|
||||
print "contains node 2", aGroup.Contains(2)
|
||||
|
||||
# get an entity by index
|
||||
|
@ -18,7 +18,7 @@ in the \ref smeshBuilder and \ref StdMeshersBuilder Python packages.
|
||||
Class \ref smeshBuilder.smeshBuilder "smeshBuilder" provides an interface to create and handle
|
||||
meshes. It can be used to create an empty mesh or to import mesh from the data file.
|
||||
|
||||
As soon as mesh is created, it is possible to manage it via its own
|
||||
As soon as a mesh is created, it is possible to manage it via its own
|
||||
methods, described in class \ref smeshBuilder.Mesh "Mesh" documentation.
|
||||
|
||||
Class \ref smeshstudytools.SMeshStudyTools "SMeshStudyTools" provides several methods to manipulate mesh objects in Salome study.
|
||||
@ -57,7 +57,7 @@ A usual workflow to generate a mesh on geometry is following:
|
||||
<pre>
|
||||
\ref Mesh.Compute "mesh.Compute"()
|
||||
</pre>
|
||||
</li>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
An easiest way to start with Python scripting is to do something in
|
||||
@ -68,7 +68,8 @@ by calling \a dir() Python built-in function.
|
||||
|
||||
All methods of the Mesh Group can be found in \ref tui_create_standalone_group sample script.
|
||||
|
||||
An example below demonstrates usage of the Python API for 3d mesh generation.
|
||||
An example below demonstrates usage of the Python API for 3d mesh
|
||||
generation and for retrieving information on mesh nodes and elements.
|
||||
|
||||
\anchor example_3d_mesh
|
||||
<h2>Example of 3d mesh generation:</h2>
|
||||
|
@ -4,16 +4,23 @@
|
||||
|
||||
It is sometimes useful to work alternatively in the GUI of SALOME and in the Python Console. To fetch an object from the TUI simply type:
|
||||
|
||||
\code
|
||||
myMesh_ref = salome.IDToObject("ID")
|
||||
// were ID is the string looking like "0:1:2:3" that appears in the object browser in the Entry column
|
||||
// ( If hidden show it by right clicking and checking the checkbox Entry)
|
||||
\code{.py}
|
||||
myMesh_ref = salome.IDToObject( ID )
|
||||
# were ID is a string looking like "0:1:2:3" that appears in the Object Browser in the Entry column.
|
||||
# ( If hidden, show it by right clicking and checking the checkbox Entry )
|
||||
myMesh = smesh.Mesh(myMesh_ref)
|
||||
\endcode
|
||||
or
|
||||
\code
|
||||
\code{.py}
|
||||
myMesh_ref = salome.myStudy.FindObjectByPath("/Mesh/myMesh").GetObject()
|
||||
// "/Mesh/myMesh" is the path to the desired object in the object browser
|
||||
#'/Mesh/myMesh' is a path to the desired object in the Object Browser
|
||||
myMesh = smesh.Mesh(myMesh_ref)
|
||||
\endcode
|
||||
or
|
||||
\code{.py}
|
||||
# get a selected mesh
|
||||
from salome.gui import helper
|
||||
myMesh_ref = helper.getSObjectSelected()[0].GetObject()
|
||||
myMesh = smesh.Mesh(myMesh_ref)
|
||||
\endcode
|
||||
|
||||
|
@ -1869,7 +1869,7 @@ void Length2D::GetValues(TValues& theValues)
|
||||
}
|
||||
else {
|
||||
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
|
||||
long aNodeId[2];
|
||||
long aNodeId[2] = {0,0};
|
||||
gp_Pnt P[3];
|
||||
|
||||
double aLength;
|
||||
|
@ -2124,7 +2124,7 @@ namespace
|
||||
|
||||
// No adjacent prisms. Select a variant with a best aspect ratio.
|
||||
|
||||
double badness[2] = { 0, 0 };
|
||||
double badness[2] = { 0., 0. };
|
||||
static SMESH::Controls::NumericalFunctorPtr aspectRatio( new SMESH::Controls::AspectRatio);
|
||||
const SMDS_MeshNode** nodes = vol.GetNodes();
|
||||
for ( int variant = 0; variant < nbVariants; ++variant )
|
||||
|
@ -660,7 +660,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
||||
const TopoDS_Vertex v = TopoDS::Vertex( vExp.Current() );
|
||||
gp_Pnt2d uv = BRep_Tool::Parameters( v, face );
|
||||
double minDist = DBL_MAX;
|
||||
int index;
|
||||
int index = 0;
|
||||
vector< TPoint >::const_iterator pVecIt = myPoints.begin();
|
||||
for ( iPoint = 0; pVecIt != myPoints.end(); pVecIt++, iPoint++ ) {
|
||||
double dist = uv.SquareDistance( (*pVecIt).myInitUV );
|
||||
|
@ -2726,7 +2726,7 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI
|
||||
}
|
||||
else
|
||||
{
|
||||
HypothesisData* anCurrentAlgo;
|
||||
HypothesisData* anCurrentAlgo = 0;
|
||||
bool isReqDisBound = true;
|
||||
QString anCurrentCompareType = anCompareType;
|
||||
isNone = currentHyp( aDim, Algo ) < 0;
|
||||
|
@ -360,7 +360,7 @@ void StdMeshers_Penta_3D::MakeNodes()
|
||||
// set XYZ on horizontal edges and get node columns of faces:
|
||||
// 2 columns for each face, between which a base node is located
|
||||
vector<const SMDS_MeshNode*>* nColumns[8];
|
||||
double ratio[ NB_WALL_FACES ]; // base node position between columns [0.-1.]
|
||||
double ratio[ NB_WALL_FACES ] = {0,0,0,0}; // base node position between columns [0.-1.]
|
||||
if ( createNode ) {
|
||||
for ( k = 0; k < NB_WALL_FACES ; ++k ) {
|
||||
ratio[ k ] = SetHorizEdgeXYZ (aBNXYZ, wallFaceID[ k ],
|
||||
|
@ -3300,7 +3300,7 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh,
|
||||
|
||||
UVPtStruct nullUVPtStruct;
|
||||
nullUVPtStruct.node = 0;
|
||||
nullUVPtStruct.x = nullUVPtStruct.y = nullUVPtStruct.u = nullUVPtStruct.y = 0;
|
||||
nullUVPtStruct.x = nullUVPtStruct.y = nullUVPtStruct.u = nullUVPtStruct.v = 0;
|
||||
nullUVPtStruct.param = 0;
|
||||
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
||||
#include <string>
|
||||
|
||||
#ifdef _DEBUG_
|
||||
#define __myDEBUG
|
||||
//#define __myDEBUG
|
||||
//#define __NOT_INVALIDATE_BAD_SMOOTH
|
||||
#endif
|
||||
|
||||
|
@ -300,7 +300,7 @@ namespace VISCOUS_2D
|
||||
double _D; // _vec1.Crossed( _vec2 )
|
||||
double _param1, _param2; // intersection param on _seg1 and _seg2
|
||||
|
||||
_SegmentIntersection(): _param1(0), _param2(0), _D(0) {}
|
||||
_SegmentIntersection(): _D(0), _param1(0), _param2(0) {}
|
||||
|
||||
bool Compute(const _Segment& seg1, const _Segment& seg2, bool seg2IsRay = false )
|
||||
{
|
||||
@ -562,7 +562,7 @@ void StdMeshers_ViscousLayers2D::SetProxyMeshOfEdge( const StdMeshers_FaceSide&
|
||||
// --------------------------------------------------------------------------------
|
||||
bool StdMeshers_ViscousLayers2D::HasProxyMesh( const TopoDS_Face& face, SMESH_Mesh& mesh )
|
||||
{
|
||||
return VISCOUS_2D::_ProxyMeshHolder::FindProxyMeshOfFace( face, mesh );
|
||||
return VISCOUS_2D::_ProxyMeshHolder::FindProxyMeshOfFace( face, mesh ).get();
|
||||
}
|
||||
// --------------------------------------------------------------------------------
|
||||
SMESH_ComputeErrorPtr
|
||||
|
Loading…
Reference in New Issue
Block a user