Version: 6.3.1
Public Member Functions

SMESH.SMESH_Gen Interface Reference

import "SMESH_Gen.idl";

Inheritance diagram for SMESH.SMESH_Gen:
Inheritance graph
[legend]

Public Member Functions

void SetGeomEngine (in GEOM::GEOM_Gen geomcompo)
FilterManager CreateFilterManager ()
SMESH_Pattern GetPattern ()
Measurements CreateMeasurements ()
void SetEmbeddedMode (in boolean theMode)
 Set the current mode.
boolean IsEmbeddedMode ()
 Get the current mode.
void SetCurrentStudy (in SALOMEDS::Study theStudy)
 Set the current study.
SALOMEDS::Study GetCurrentStudy ()
 Get the current study.
SMESH_Hypothesis CreateHypothesis (in string theHypName, in string theLibName) raises ( SALOME::SALOME_Exception )
 Create a hypothesis that can be shared by differents parts of the mesh.
SMESH_Hypothesis GetHypothesisParameterValues (in string theHypName, in string theLibName, in SMESH_Mesh theMesh, in GEOM::GEOM_Object theGeom, in boolean byMesh) raises ( SALOME::SALOME_Exception )
 Return a hypothesis holding parameter values corresponding either to the mesh existing on the given geometry or to size of the geometry.
void SetBoundaryBoxSegmentation (in long theNbSegments) raises ( SALOME::SALOME_Exception )
 Sets number of segments per diagonal of boundary box of geometry by which default segment length of appropriate 1D hypotheses is defined.
void SetDefaultNbSegments (in long theNbSegments) raises ( SALOME::SALOME_Exception )
 Sets default number of segments per edge.
void SetName (in string theObjectIOR, in string theObjectName) raises ( SALOME::SALOME_Exception )
 Set the object name.
SMESH_Mesh CreateMesh (in GEOM::GEOM_Object theObject) raises ( SALOME::SALOME_Exception )
 Create a Mesh object, given a geometry shape.
SMESH_Mesh CreateEmptyMesh () raises ( SALOME::SALOME_Exception )
 Create an empty mesh object.
SMESH_Mesh CreateMeshesFromUNV (in string theFileName) raises ( SALOME::SALOME_Exception )
 Create Mesh object importing data from given UNV file (UNV supported version is I-DEAS 10)
mesh_array CreateMeshesFromMED (in string theFileName, out SMESH::DriverMED_ReadStatus theStatus) raises ( SALOME::SALOME_Exception )
 Create Mesh object(s) importing data from given MED file.
SMESH_Mesh CreateMeshesFromSTL (in string theFileName) raises ( SALOME::SALOME_Exception )
 Create Mesh object importing data from given STL file.
SMESH_Mesh CopyMesh (in SMESH_IDSource meshPart, in string meshName, in boolean toCopyGroups, in boolean toKeepIDs) raises ( SALOME::SALOME_Exception )
 Create a mesh by copying a part of another mesh.
SMESH_Mesh Concatenate (in mesh_array theMeshesArray, in boolean theUniteIdenticalGroups, in boolean theMergeNodesAndElements, in double theMergeTolerance) raises ( SALOME::SALOME_Exception )
 Concatenate the given meshes into one mesh.
SMESH_Mesh ConcatenateWithGroups (in mesh_array theMeshesArray, in boolean theUniteIdenticalGroups, in boolean theMergeNodesAndElements, in double theMergeTolerance) raises ( SALOME::SALOME_Exception )
 Concatenate the given meshes into one mesh.
boolean Compute (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theSubObject) raises ( SALOME::SALOME_Exception )
 Mesh a subShape.
void CancelCompute (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theSubObject)
 Cancel a computation.
boolean IsReadyToCompute (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theSubObject) raises ( SALOME::SALOME_Exception )
 Return true if hypotheses are defined well.
long_array Evaluate (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theSubObject) raises ( SALOME::SALOME_Exception )
 Evaluates size of prospective mesh on a shape.
MeshPreviewStruct Precompute (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theSubObject, in Dimension theDimension, inout long_array theShapesId) raises ( SALOME::SALOME_Exception )
 Calculate Mesh as preview till indicated dimension First, verify list of hypothesis associated with the subShape.
algo_error_array GetAlgoState (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theSubObject) raises ( SALOME::SALOME_Exception )
 Return errors of hypotheses definintion algo_error_array is empty if everything is OK.
compute_error_array GetComputeErrors (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theSubObject) raises ( SALOME::SALOME_Exception )
 Return errors of mesh computation compute_error_array is empty if everything is OK.
MeshPreviewStruct GetBadInputElements (in SMESH_Mesh theMesh, in short theSubShapeID) raises ( SALOME::SALOME_Exception )
 Return mesh elements preventing computation of a subshape.
long_array GetSubShapesId (in GEOM::GEOM_Object theMainObject, in object_array theListOfSubObjects) raises ( SALOME::SALOME_Exception )
 Return indeces of faces, edges and vertices of given subshapes within theMainObject.
GEOM::GEOM_Object GetGeometryByMeshElement (in SMESH_Mesh theMesh, in long theElementID, in string theGeomName) raises ( SALOME::SALOME_Exception )
 Return geometrical object the given element is built on.
GEOM::GEOM_Object FindGeometryByMeshElement (in SMESH_Mesh theMesh, in long theElementID) raises ( SALOME::SALOME_Exception )
 Return geometrical object the given element is built on.
long GetObjectId (in Object theObject)
 Return id of object, registered in current study context.
boolean GetMEDVersion (in string theFileName, out MED_VERSION theVersion)
 Get MED version of the file by its name.
string_array GetMeshNames (in string theFileName)
 Get names of meshes defined in file with the specified name.

Detailed Description

Definition at line 114 of file SMESH_Gen.idl.


Member Function Documentation

void SMESH.SMESH_Gen.CancelCompute ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theSubObject 
)

Cancel a computation.

SMESH_ProxyMesh::Ptr StdMeshers_ViscousLayers::Compute ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theSubObject 
) raises ( SALOME::SALOME_Exception )

Mesh a subShape.

Import elements from the other mesh.

First, verify list of hypothesis associated with the subShape, return NOK if hypothesis are not sufficient

Definition at line 341 of file StdMeshers_CompositeSegment_1D.cxx.

References SMESHDS_Mesh.AddEdge(), SMESHDS_Mesh.AddNode(), COMPERR_BAD_INPUT_MESH, StdMeshers_Regular_1D.Compute(), SMESH_AdvancedEditor.nodes, SMESHDS_Mesh.RemoveNode(), SMESHDS_Mesh.SetMeshElementOnShape(), SMESHDS_Mesh.SetNodeOnEdge(), SMESHDS_Mesh.ShapeToIndex(), and SMESH_Algo.VertexNode().

{
  TopoDS_Edge edge = TopoDS::Edge( aShape );
  SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();

  // Get edges to be discretized as a whole
  TopoDS_Face nullFace;
  auto_ptr< StdMeshers_FaceSide > side( GetFaceSide(aMesh, edge, nullFace, true ));
  //side->dump("IN COMPOSITE SEG");

  if ( side->NbEdges() < 2 )
    return StdMeshers_Regular_1D::Compute( aMesh, aShape );

  // update segment lenght computed by StdMeshers_AutomaticLength
  const list <const SMESHDS_Hypothesis * > & hyps = GetUsedHypothesis(aMesh, aShape);
  if ( !hyps.empty() ) {
    StdMeshers_AutomaticLength * autoLenHyp = const_cast<StdMeshers_AutomaticLength *>
      (dynamic_cast <const StdMeshers_AutomaticLength * >(hyps.front()));
    if ( autoLenHyp )
      _value[ BEG_LENGTH_IND ]= autoLenHyp->GetLength( &aMesh, side->Length() );
  }

  // Compute node parameters
  auto_ptr< BRepAdaptor_CompCurve > C3d ( side->GetCurve3d() );
  double f = C3d->FirstParameter(), l = C3d->LastParameter();
  list< double > params;
  if ( !computeInternalParameters ( aMesh, *C3d, side->Length(), f, l, params, false ))
    return false;

  // Redistribute parameters near ends
  TopoDS_Vertex VFirst = side->FirstVertex();
  TopoDS_Vertex VLast  = side->LastVertex();
  redistributeNearVertices( aMesh, *C3d, side->Length(), params, VFirst, VLast );

  params.push_front(f);
  params.push_back(l);
  int nbNodes = params.size();

  // Create mesh

  const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
  const SMDS_MeshNode * nLast  = SMESH_Algo::VertexNode( VLast, meshDS );
  if (!nFirst)
    return error(COMPERR_BAD_INPUT_MESH, TComm("No node on vertex ")
                 <<meshDS->ShapeToIndex(VFirst));
  if (!nLast)
    return error(COMPERR_BAD_INPUT_MESH, TComm("No node on vertex ")
                 <<meshDS->ShapeToIndex(VLast));

  vector<const SMDS_MeshNode*> nodes( nbNodes, (const SMDS_MeshNode*)0 );
  nodes.front() = nFirst;
  nodes.back()  = nLast;

  // create internal nodes
  list< double >::iterator parIt = params.begin();
  double prevPar = *parIt;
  Standard_Real u;
  for ( int iN = 0; parIt != params.end(); ++iN, ++parIt)
  {
    if ( !nodes[ iN ] ) {
      gp_Pnt p = C3d->Value( *parIt );
      SMDS_MeshNode* n = meshDS->AddNode( p.X(), p.Y(), p.Z());
      C3d->Edge( *parIt, edge, u );
      meshDS->SetNodeOnEdge( n, edge, u );
//       cout << "new NODE: par="<<*parIt<<" ePar="<<u<<" e="<<edge.TShape().operator->()
//            << " " << n << endl;
      nodes[ iN ] = n;
    }
    // create edges
    if ( iN ) {
      double mPar = ( prevPar + *parIt )/2;
      if ( _quadraticMesh ) {
        // create medium node
        double segLen = GCPnts_AbscissaPoint::Length(*C3d, prevPar, *parIt);
        GCPnts_AbscissaPoint ruler( *C3d, segLen/2., prevPar );
        if ( ruler.IsDone() )
          mPar = ruler.Parameter();
        gp_Pnt p = C3d->Value( mPar );
        SMDS_MeshNode* n = meshDS->AddNode( p.X(), p.Y(), p.Z());
        //cout << "new NODE "<< n << endl;
        meshDS->SetNodeOnEdge( n, edge, u );
        SMDS_MeshEdge * seg = meshDS->AddEdge(nodes[ iN-1 ], nodes[ iN ], n);
        meshDS->SetMeshElementOnShape(seg, edge);
      }
      else {
        C3d->Edge( mPar, edge, u );
        SMDS_MeshEdge * seg = meshDS->AddEdge(nodes[ iN-1 ], nodes[ iN ]);
        meshDS->SetMeshElementOnShape(seg, edge);
      }
    }
    prevPar = *parIt;
  }

  // remove nodes on internal vertices
  for ( int iE = 1; iE < side->NbEdges(); ++iE )
  {
    TopoDS_Vertex V = side->FirstVertex( iE );
    while ( const SMDS_MeshNode * n = SMESH_Algo::VertexNode( V, meshDS ))
      meshDS->RemoveNode( n );
  }

  // Update submeshes state for all edges and internal vertices,
  // make them look computed even if none edge or node is set on them
  careOfSubMeshes( *side, _EventListener );

  return true;
}
SMESH_Mesh SMESH.SMESH_Gen.Concatenate ( in mesh_array  theMeshesArray,
in boolean  theUniteIdenticalGroups,
in boolean  theMergeNodesAndElements,
in double  theMergeTolerance 
) raises ( SALOME::SALOME_Exception )

Concatenate the given meshes into one mesh.

Union groups with the same name and type if theUniteIdenticalGroups flag is true. Merge coincident nodes and elements if theMergeNodesAndElements flag is true.

SMESH_Mesh SMESH.SMESH_Gen.ConcatenateWithGroups ( in mesh_array  theMeshesArray,
in boolean  theUniteIdenticalGroups,
in boolean  theMergeNodesAndElements,
in double  theMergeTolerance 
) raises ( SALOME::SALOME_Exception )

Concatenate the given meshes into one mesh.

Union groups with the same name and type if theUniteIdenticalGroups flag is true. Merge coincident nodes and elements if theMergeNodesAndElements flag is true. Create the groups of all elements from initial meshes.

SMESH_Mesh SMESH.SMESH_Gen.CopyMesh ( in SMESH_IDSource  meshPart,
in string  meshName,
in boolean  toCopyGroups,
in boolean  toKeepIDs 
) raises ( SALOME::SALOME_Exception )

Create a mesh by copying a part of another mesh.

Parameters:
meshPart- a part of mesh to copy
meshName- a name of the new mesh
toCopyGroups- to create in the new mesh groups the copied elements belongs to
toKeepIDs- to preserve IDs of the copied elements or not
SMESH_Mesh SMESH.SMESH_Gen.CreateEmptyMesh ( ) raises ( SALOME::SALOME_Exception )

Create an empty mesh object.

FilterManager SMESH.SMESH_Gen.CreateFilterManager ( )
SMESH_Hypothesis SMESH.SMESH_Gen.CreateHypothesis ( in string  theHypName,
in string  theLibName 
) raises ( SALOME::SALOME_Exception )

Create a hypothesis that can be shared by differents parts of the mesh.

An hypothesis is either:

  • a method used to generate or modify a part of the mesh (algorithm).
  • a parameter or a law used by an algorithm. Algorithms are 1D, 2D or 3D.
Measurements SMESH.SMESH_Gen.CreateMeasurements ( )
SMESH_Mesh SMESH.SMESH_Gen.CreateMesh ( in GEOM::GEOM_Object  theObject) raises ( SALOME::SALOME_Exception )

Create a Mesh object, given a geometry shape.

Mesh is created empty (no points, no elements). Shape is explored via GEOM_Client to create local copies. of TopoDS_Shapes and bind CORBA references of shape & subshapes with TopoDS_Shapes

mesh_array SMESH.SMESH_Gen.CreateMeshesFromMED ( in string  theFileName,
out SMESH::DriverMED_ReadStatus  theStatus 
) raises ( SALOME::SALOME_Exception )

Create Mesh object(s) importing data from given MED file.

SMESH_Mesh SMESH.SMESH_Gen.CreateMeshesFromSTL ( in string  theFileName) raises ( SALOME::SALOME_Exception )

Create Mesh object importing data from given STL file.

SMESH_Mesh SMESH.SMESH_Gen.CreateMeshesFromUNV ( in string  theFileName) raises ( SALOME::SALOME_Exception )

Create Mesh object importing data from given UNV file (UNV supported version is I-DEAS 10)

bool StdMeshers_Regular_1D::Evaluate ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theSubObject 
) raises ( SALOME::SALOME_Exception )

Evaluates size of prospective mesh on a shape.

Predict nb of mesh entities created by Compute()

Evaluate.

Definition at line 1631 of file SMESH_subMesh.cxx.

References ex01_cube2build.algo, COMPERR_OK, SMESH_Gen.GetShapeDim(), SMESH.SMESH_subMesh.GetSubShape(), SMESH_ComputeError.New(), PAL_MESH_041_mesh.ret, SMDSEntity_Last, and SMDSEntity_Node.

{
  _computeError.reset();

  bool ret = true;

  if (_subShape.ShapeType() == TopAbs_VERTEX) {
    vector<int> aVec(SMDSEntity_Last,0);
    aVec[SMDSEntity_Node] = 1;
    aResMap.insert(make_pair(this,aVec));
    return ret;
  }

  SMESH_Gen *gen = _father->GetGen();
  SMESH_Algo *algo = 0;
  SMESH_Hypothesis::Hypothesis_Status hyp_status;

  algo = gen->GetAlgo((*_father), _subShape);
  if(algo && !aResMap.count(this) )
  {
    ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
    if (!ret) return false;

    if (_father->HasShapeToMesh() && algo->NeedDescretBoundary())
    {
      // check submeshes needed
      bool subMeshEvaluated = true;
      int dimToCheck = SMESH_Gen::GetShapeDim( _subShape ) - 1;
      SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,/*complexShapeFirst=*/true);
      while ( smIt->more() && subMeshEvaluated )
      {
        SMESH_subMesh* sm = smIt->next();
        int dim = SMESH_Gen::GetShapeDim( sm->GetSubShape() );
        if (dim < dimToCheck) break; // the rest subMeshes are all of less dimension
        const vector<int> & nbs = aResMap[ sm ];
        subMeshEvaluated = (std::accumulate( nbs.begin(), nbs.end(), 0 ) > 0 );
      }
      if ( !subMeshEvaluated )
        return false;
    }
    _computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo);
    ret = algo->Evaluate((*_father), _subShape, aResMap);

    aResMap.insert( make_pair( this,vector<int>(0)));
  }

  return ret;
}
GEOM::GEOM_Object SMESH.SMESH_Gen.FindGeometryByMeshElement ( in SMESH_Mesh  theMesh,
in long  theElementID 
) raises ( SALOME::SALOME_Exception )

Return geometrical object the given element is built on.

The returned geometrical object not published in study by this method.

algo_error_array SMESH.SMESH_Gen.GetAlgoState ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theSubObject 
) raises ( SALOME::SALOME_Exception )

Return errors of hypotheses definintion algo_error_array is empty if everything is OK.

MeshPreviewStruct SMESH.SMESH_Gen.GetBadInputElements ( in SMESH_Mesh  theMesh,
in short  theSubShapeID 
) raises ( SALOME::SALOME_Exception )

Return mesh elements preventing computation of a subshape.

compute_error_array SMESH.SMESH_Gen.GetComputeErrors ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theSubObject 
) raises ( SALOME::SALOME_Exception )

Return errors of mesh computation compute_error_array is empty if everything is OK.

SALOMEDS::Study SMESH.SMESH_Gen.GetCurrentStudy ( )

Get the current study.

GEOM::GEOM_Object SMESH.SMESH_Gen.GetGeometryByMeshElement ( in SMESH_Mesh  theMesh,
in long  theElementID,
in string  theGeomName 
) raises ( SALOME::SALOME_Exception )

Return geometrical object the given element is built on.

The returned geometrical object, if not nil, is either found in the study or is published by this method with the given name

SMESH_Hypothesis SMESH.SMESH_Gen.GetHypothesisParameterValues ( in string  theHypName,
in string  theLibName,
in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theGeom,
in boolean  byMesh 
) raises ( SALOME::SALOME_Exception )

Return a hypothesis holding parameter values corresponding either to the mesh existing on the given geometry or to size of the geometry.

The returned hypothesis may be the one existing in a study and used to compute the mesh, or a temporary one created just to pass parameter values.

boolean SMESH.SMESH_Gen.GetMEDVersion ( in string  theFileName,
out MED_VERSION  theVersion 
)

Get MED version of the file by its name.

string_array SMESH.SMESH_Gen.GetMeshNames ( in string  theFileName)

Get names of meshes defined in file with the specified name.

long SMESH.SMESH_Gen.GetObjectId ( in Object  theObject)

Return id of object, registered in current study context.

Can be used to check if the object was created in the same container, as this engine.

SMESH_Pattern SMESH.SMESH_Gen.GetPattern ( )
long_array SMESH.SMESH_Gen.GetSubShapesId ( in GEOM::GEOM_Object  theMainObject,
in object_array  theListOfSubObjects 
) raises ( SALOME::SALOME_Exception )

Return indeces of faces, edges and vertices of given subshapes within theMainObject.

boolean SMESH.SMESH_Gen.IsEmbeddedMode ( )

Get the current mode.

boolean SMESH.SMESH_Gen.IsReadyToCompute ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theSubObject 
) raises ( SALOME::SALOME_Exception )

Return true if hypotheses are defined well.

MeshPreviewStruct SMESH.SMESH_Gen.Precompute ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theSubObject,
in Dimension  theDimension,
inout long_array  theShapesId 
) raises ( SALOME::SALOME_Exception )

Calculate Mesh as preview till indicated dimension First, verify list of hypothesis associated with the subShape.

Return mesh preview structure

void SMESH.SMESH_Gen.SetBoundaryBoxSegmentation ( in long  theNbSegments) raises ( SALOME::SALOME_Exception )

Sets number of segments per diagonal of boundary box of geometry by which default segment length of appropriate 1D hypotheses is defined.

void SMESH.SMESH_Gen.SetCurrentStudy ( in SALOMEDS::Study  theStudy)

Set the current study.

void SMESH.SMESH_Gen.SetDefaultNbSegments ( in long  theNbSegments) raises ( SALOME::SALOME_Exception )

Sets default number of segments per edge.

void SMESH.SMESH_Gen.SetEmbeddedMode ( in boolean  theMode)

Set the current mode.

void SMESH.SMESH_Gen.SetGeomEngine ( in GEOM::GEOM_Gen  geomcompo)
void SMESH.SMESH_Gen.SetName ( in string  theObjectIOR,
in string  theObjectName 
) raises ( SALOME::SALOME_Exception )

Set the object name.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS