Back to index

salome-smesh  6.5.0
Public Types | Public Member Functions
SMESH::SMESH_Pattern Interface Reference

SMESH_Pattern: interface of mesh pattern. More...

import "SMESH_Pattern.idl";

List of all members.

Public Types

enum  ErrorCode {
  ERR_OK, ERR_READ_NB_POINTS, ERR_READ_POINT_COORDS, ERR_READ_TOO_FEW_POINTS,
  ERR_READ_3D_COORD, ERR_READ_NO_KEYPOINT, ERR_READ_BAD_INDEX, ERR_READ_ELEM_POINTS,
  ERR_READ_NO_ELEMS, ERR_READ_BAD_KEY_POINT, ERR_SAVE_NOT_LOADED, ERR_LOAD_EMPTY_SUBMESH,
  ERR_LOADF_NARROW_FACE, ERR_LOADF_CLOSED_FACE, ERR_LOADF_CANT_PROJECT, ERR_LOADV_BAD_SHAPE,
  ERR_LOADV_COMPUTE_PARAMS, ERR_APPL_NOT_LOADED, ERR_APPL_BAD_DIMENTION, ERR_APPL_BAD_NB_VERTICES,
  ERR_APPLF_BAD_TOPOLOGY, ERR_APPLF_BAD_VERTEX, ERR_APPLF_INTERNAL_EEROR, ERR_APPLV_BAD_SHAPE,
  ERR_MAKEM_NOT_COMPUTED
}
 error code of the last of one of above operations More...

Public Member Functions

boolean LoadFromFile (in string theFileContents)
 Load a pattern from the string <theFileContents>
boolean LoadFromFace (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theFace, in boolean theProject)
 Create a pattern from the mesh built on <theFace>.
boolean LoadFrom3DBlock (in SMESH_Mesh theMesh, in GEOM::GEOM_Object theBlock)
 Create a pattern from the mesh built on <theBlock>
point_array ApplyToFace (in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertexOnKeyPoint1, in boolean theReverse)
 Compute nodes coordinates applying the loaded pattern to <theFace>.
point_array ApplyTo3DBlock (in GEOM::GEOM_Object theBlock, in GEOM::GEOM_Object theVertex000, in GEOM::GEOM_Object theVertex001)
 Compute nodes coordinates applying the loaded pattern to <theBlock>.
point_array ApplyToMeshFaces (in SMESH_Mesh theMesh, in long_array theFacesIDs, in long theNodeIndexOnKeyPoint1, in boolean theReverse)
 Compute nodes coordinates applying the loaded pattern to mesh faces.
point_array ApplyToHexahedrons (in SMESH_Mesh theMesh, in long_array theVolumesIDs, in long theNode000Index, in long theNode001Index)
 Compute nodes coordinates applying the loaded pattern to hexahedrons.
boolean MakeMesh (in SMESH_Mesh theMesh, in boolean CreatePolygons, in boolean CreatePolyedrs)
 Create nodes and elements in <theMesh> using nodes coordinates computed by either of Apply...() methods.
string GetString ()
 Return the loaded pattern in the string form to be saved in file.
ErrorCode GetErrorCode ()
 Return error code of the last operation.
boolean Is2D ()
 Return true if the loaded pattern is a 2D one.
point_array GetPoints ()
 Return coordinates of pattern points.
long_array GetKeyPoints ()
 Return indices of key-points within the arrays returned by GetPoints()
array_of_long_array GetElementPoints (in boolean all)
 Return nodal connectivity of the elements of the pattern or of all elements to be crated.

Detailed Description

SMESH_Pattern: interface of mesh pattern.

Definition at line 41 of file SMESH_Pattern.idl.


Member Enumeration Documentation

error code of the last of one of above operations

Enumerator:
ERR_OK 
ERR_READ_NB_POINTS 
ERR_READ_POINT_COORDS 
ERR_READ_TOO_FEW_POINTS 
ERR_READ_3D_COORD 
ERR_READ_NO_KEYPOINT 
ERR_READ_BAD_INDEX 
ERR_READ_ELEM_POINTS 
ERR_READ_NO_ELEMS 
ERR_READ_BAD_KEY_POINT 
ERR_SAVE_NOT_LOADED 
ERR_LOAD_EMPTY_SUBMESH 
ERR_LOADF_NARROW_FACE 
ERR_LOADF_CLOSED_FACE 
ERR_LOADF_CANT_PROJECT 
ERR_LOADV_BAD_SHAPE 
ERR_LOADV_COMPUTE_PARAMS 
ERR_APPL_NOT_LOADED 
ERR_APPL_BAD_DIMENTION 
ERR_APPL_BAD_NB_VERTICES 
ERR_APPLF_BAD_TOPOLOGY 
ERR_APPLF_BAD_VERTEX 
ERR_APPLF_INTERNAL_EEROR 
ERR_APPLV_BAD_SHAPE 
ERR_MAKEM_NOT_COMPUTED 

Definition at line 125 of file SMESH_Pattern.idl.

                   {
      ERR_OK,
      // Load(file)
      ERR_READ_NB_POINTS, // couldn't read nb of points
      ERR_READ_POINT_COORDS, // invalid nb of point coordinates
      ERR_READ_TOO_FEW_POINTS,  // too few points in a pattern
      ERR_READ_3D_COORD,  // coordinate of 3D point out of [0,1] range
      ERR_READ_NO_KEYPOINT, // no key-points in 2D pattern
      ERR_READ_BAD_INDEX, // invalid point index
      ERR_READ_ELEM_POINTS, // invalid nb of points in element
      ERR_READ_NO_ELEMS, // no elements in a pattern
      ERR_READ_BAD_KEY_POINT, // a key-point not on a boundary
      // Save(file)
      ERR_SAVE_NOT_LOADED, // pattern was not loaded
      // Load(shape)
      ERR_LOAD_EMPTY_SUBMESH, // no elements to load
      // Load(face)
      ERR_LOADF_NARROW_FACE, // too narrow face
      ERR_LOADF_CLOSED_FACE, // closed face
      ERR_LOADF_CANT_PROJECT, // impossible to project nodes
      // Load(volume)
      ERR_LOADV_BAD_SHAPE, // volume is not a brick of 6 faces
      ERR_LOADV_COMPUTE_PARAMS, // cant compute point parameters
      // Apply(shape)
      ERR_APPL_NOT_LOADED, // pattern was not loaded
      ERR_APPL_BAD_DIMENTION, // wrong shape dimention
      ERR_APPL_BAD_NB_VERTICES, // keypoints - vertices mismatch
      // Apply(face)
      ERR_APPLF_BAD_TOPOLOGY, // bad pattern topology
      ERR_APPLF_BAD_VERTEX, // first vertex not on an outer face boundary
      ERR_APPLF_INTERNAL_EEROR, // program error
      // Apply(volume)
      ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
      // MakeMesh
      ERR_MAKEM_NOT_COMPUTED // mapping failed
      };

Member Function Documentation

point_array SMESH::SMESH_Pattern::ApplyTo3DBlock ( in GEOM::GEOM_Object  theBlock,
in GEOM::GEOM_Object  theVertex000,
in GEOM::GEOM_Object  theVertex001 
)

Compute nodes coordinates applying the loaded pattern to <theBlock>.

The (0,0,0) key-point will be mapped into <theVertex000>. The (0,0,1) key-point will be mapped into <theVertex001>.

point_array SMESH::SMESH_Pattern::ApplyToFace ( in GEOM::GEOM_Object  theFace,
in GEOM::GEOM_Object  theVertexOnKeyPoint1,
in boolean  theReverse 
)

Compute nodes coordinates applying the loaded pattern to <theFace>.

The first key-point will be mapped into <theVertexOnKeyPoint1>, which must be in the outer wire of theFace

point_array SMESH::SMESH_Pattern::ApplyToHexahedrons ( in SMESH_Mesh  theMesh,
in long_array  theVolumesIDs,
in long  theNode000Index,
in long  theNode001Index 
)

Compute nodes coordinates applying the loaded pattern to hexahedrons.

The (0,0,0) key-point will be mapped into <theNode000Index>-th node of each volume. The (0,0,1) key-point will be mapped into <theNode001Index>-th node of each volume.

point_array SMESH::SMESH_Pattern::ApplyToMeshFaces ( in SMESH_Mesh  theMesh,
in long_array  theFacesIDs,
in long  theNodeIndexOnKeyPoint1,
in boolean  theReverse 
)

Compute nodes coordinates applying the loaded pattern to mesh faces.

The first key-point will be mapped into <theNodeIndexOnKeyPoint1>-th node of each face

Return nodal connectivity of the elements of the pattern or of all elements to be crated.

Return error code of the last operation.

Return indices of key-points within the arrays returned by GetPoints()

Return coordinates of pattern points.

Definition at line 4695 of file SMESH_Pattern.cxx.

{
  thePoints.clear();

  if ( !IsLoaded() )
    return false;

  vector< TPoint >::const_iterator pVecIt = myPoints.begin();
  for ( ; pVecIt != myPoints.end(); pVecIt++ )
    thePoints.push_back( & (*pVecIt).myInitXYZ );

  return ( thePoints.size() > 0 );
}

Return the loaded pattern in the string form to be saved in file.

Return true if the loaded pattern is a 2D one.

boolean SMESH::SMESH_Pattern::LoadFrom3DBlock ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theBlock 
)

Create a pattern from the mesh built on <theBlock>

boolean SMESH::SMESH_Pattern::LoadFromFace ( in SMESH_Mesh  theMesh,
in GEOM::GEOM_Object  theFace,
in boolean  theProject 
)

Create a pattern from the mesh built on <theFace>.

<theProject>==true makes override nodes positions on <theFace> computed by mesher

boolean SMESH::SMESH_Pattern::LoadFromFile ( in string  theFileContents)

Load a pattern from the string <theFileContents>

bool SMESH_Pattern::MakeMesh ( in SMESH_Mesh  theMesh,
in boolean  CreatePolygons,
in boolean  CreatePolyedrs 
)

Create nodes and elements in <theMesh> using nodes coordinates computed by either of Apply...() methods.

If CreatePolygons is TRUE, replace adjacent faces by polygons to keep mesh conformity. If CreatePolyedrs is TRUE, replace adjacent volumes by polyedrs to keep mesh conformity.

Definition at line 3897 of file SMESH_Pattern.cxx.

{
  MESSAGE(" ::MakeMesh() " );
  if ( !myIsComputed )
    return setErrorCode( ERR_MAKEM_NOT_COMPUTED );

  mergePoints( toCreatePolygons );

  SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();

  // clear elements and nodes existing on myShape
  clearMesh(theMesh);

  bool onMeshElements = ( !myElements.empty() );

  // Create missing nodes

  vector< const SMDS_MeshNode* > nodesVector; // i-th point/xyz -> node
  if ( onMeshElements )
  {
    nodesVector.resize( Max( myXYZ.size(), myXYZIdToNodeMap.rbegin()->first ), 0 );
    map< int, const SMDS_MeshNode*>::iterator i_node = myXYZIdToNodeMap.begin();
    for ( ; i_node != myXYZIdToNodeMap.end(); i_node++ ) {
      nodesVector[ i_node->first ] = i_node->second;
    }
    for ( int i = 0; i < myXYZ.size(); ++i ) {
      if ( !nodesVector[ i ] && isDefined( myXYZ[ i ] ) )
        nodesVector[ i ] = aMeshDS->AddNode (myXYZ[ i ].X(),
                                             myXYZ[ i ].Y(),
                                             myXYZ[ i ].Z());
    }
  }
  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 ));

    // loop on sub-shapes of myShape: create nodes
    map< int, list< TPoint* > >::iterator 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 ];
        if ( nodesVector [ pIndex ] )
          continue;
        SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(),
                                                point->myXYZ.Y(),
                                                point->myXYZ.Z());
        nodesVector [ pIndex ] = node;

        if ( !S.IsNull() /*subMeshDS*/ ) {
          // !!!!! do not merge new nodes with ones existing on submeshes (see method comment)
          switch ( S.ShapeType() ) {
          case TopAbs_VERTEX: {
            aMeshDS->SetNodeOnVertex( node, TopoDS::Vertex( S )); break;
          }
          case TopAbs_EDGE: {
            aMeshDS->SetNodeOnEdge( node, TopoDS::Edge( S ), point->myU ); break;
          }
          case TopAbs_FACE: {
            aMeshDS->SetNodeOnFace( node, TopoDS::Face( S ),
                                    point->myUV.X(), point->myUV.Y() ); break;
          }
          default:
            aMeshDS->SetNodeInVolume( node, TopoDS::Shell( S ));
          }
        }
      }
    }
  }

  // create elements

  if ( onMeshElements )
  {
    // prepare data to create poly elements
    makePolyElements( nodesVector, toCreatePolygons, toCreatePolyedrs );

    // refine elements
    createElements( theMesh, nodesVector, myElemXYZIDs, myElements );
    // sew old and new elements
    createElements( theMesh, nodesVector, myPolyElemXYZIDs, myPolyElems );
  }
  else
  {
    createElements( theMesh, nodesVector, myElemPointIDs, myElements );
  }

  aMeshDS->compactMesh();

//   const map<int,SMESHDS_SubMesh*>& sm = aMeshDS->SubMeshes();
//   map<int,SMESHDS_SubMesh*>::const_iterator i_sm = sm.begin();
//   for ( ; i_sm != sm.end(); i_sm++ )
//   {
//     cout << " SM " << i_sm->first << " ";
//     TopAbs::Print( aMeshDS->IndexToShape( i_sm->first ).ShapeType(), cout)<< " ";
//     //SMDS_ElemIteratorPtr GetElements();
//     SMDS_NodeIteratorPtr nit = i_sm->second->GetNodes();
//     while ( nit->more() )
//       cout << nit->next()->GetID() << " ";
//     cout << endl;
//   }
  return setErrorCode( ERR_OK );
}

Here is the call graph for this function:


The documentation for this interface was generated from the following files: