Back to index

salome-smesh  6.5.0
Public Member Functions | Private Types | Private Attributes
StdMeshers_ProjectionSource3D_i Class Reference

This hypothesis specifies a meshed shell or solid to take a mesh pattern from and optionally association of vertices between the source shape and a target one (where a hipothesis is assigned to) More...

#include <StdMeshers_ProjectionSource3D_i.hxx>

Collaboration diagram for StdMeshers_ProjectionSource3D_i:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StdMeshers_ProjectionSource3D_i (PortableServer::POA_ptr thePOA, int theStudyId,::SMESH_Gen *theGenImpl)
 StdMeshers_ProjectionSource3D_i::StdMeshers_ProjectionSource3D_i.
virtual ~StdMeshers_ProjectionSource3D_i ()
 StdMeshers_ProjectionSource3D_i::~StdMeshers_ProjectionSource3D_i.
void SetSource3DShape (GEOM::GEOM_Object_ptr shape) throw ( SALOME::SALOME_Exception )
 Sets a source <shape> to take a mesh pattern from.
GEOM::GEOM_Object_ptr GetSource3DShape ()
 Returns the source shape.
void SetSourceMesh (SMESH::SMESH_Mesh_ptr mesh) throw ( SALOME::SALOME_Exception )
 Sets source <mesh> to take a mesh pattern from.
SMESH::SMESH_Mesh_ptr GetSourceMesh ()
 Return source mesh.
void SetVertexAssociation (GEOM::GEOM_Object_ptr sourceVertex1, GEOM::GEOM_Object_ptr sourceVertex2, GEOM::GEOM_Object_ptr targetVertex1, GEOM::GEOM_Object_ptr targetVertex2) throw ( SALOME::SALOME_Exception )
 Sets vertex association between the source shape and the target one.
GEOM::GEOM_Object_ptr GetSourceVertex (CORBA::Long i)
 Returns the -th source vertex associated with the -th target vertex.
GEOM::GEOM_Object_ptr GetTargetVertex (CORBA::Long i)
 Returns the -th target vertex associated with the -th source vertex.
::StdMeshers_ProjectionSource3D * GetImpl ()
 StdMeshers_ProjectionSource3D_i::GetImpl.
CORBA::Boolean IsDimSupported (SMESH::Dimension type)
 Verify whether hypothesis supports given entity type.
virtual char * SaveTo ()
 Write parameters in a string.
virtual void LoadFrom (const char *theStream)
 Retrieve parameters from the string.

Private Types

enum  {
  SRC_SHAPE3D = 0, SRC_VERTEX1, SRC_VERTEX2, TGT_VERTEX1,
  TGT_VERTEX2, NB_SHAPES
}

Private Attributes

std::string myShapeEntries [NB_SHAPES]
SMESH::SMESH_Mesh_var myCorbaMesh

Detailed Description

This hypothesis specifies a meshed shell or solid to take a mesh pattern from and optionally association of vertices between the source shape and a target one (where a hipothesis is assigned to)

Definition at line 49 of file StdMeshers_ProjectionSource3D_i.hxx.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
SRC_SHAPE3D 
SRC_VERTEX1 
SRC_VERTEX2 
TGT_VERTEX1 
TGT_VERTEX2 
NB_SHAPES 

Definition at line 122 of file StdMeshers_ProjectionSource3D_i.hxx.


Constructor & Destructor Documentation

StdMeshers_ProjectionSource3D_i::StdMeshers_ProjectionSource3D_i ( PortableServer::POA_ptr  thePOA,
int  theStudyId,
::SMESH_Gen *  theGenImpl 
)

StdMeshers_ProjectionSource3D_i::StdMeshers_ProjectionSource3D_i.

Constructor

Definition at line 50 of file StdMeshers_ProjectionSource3D_i.cxx.

                                     : SALOME::GenericObj_i( thePOA ), 
                                         SMESH_Hypothesis_i( thePOA )
{
  MESSAGE( "StdMeshers_ProjectionSource3D_i::StdMeshers_ProjectionSource3D_i" );
  myBaseImpl = new ::StdMeshers_ProjectionSource3D( theGenImpl->GetANewId(),
                                                    theStudyId,
                                                    theGenImpl );
}

StdMeshers_ProjectionSource3D_i::~StdMeshers_ProjectionSource3D_i.

Destructor

Definition at line 69 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  MESSAGE( "StdMeshers_ProjectionSource3D_i::~StdMeshers_ProjectionSource3D_i" );
}

Member Function Documentation

StdMeshers_ProjectionSource3D * StdMeshers_ProjectionSource3D_i::GetImpl ( )

StdMeshers_ProjectionSource3D_i::GetImpl.

Get implementation

Definition at line 233 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  return ( ::StdMeshers_ProjectionSource3D* )myBaseImpl;
}

Returns the source shape.

Returns the source face.

Definition at line 187 of file StdMeshers_ProjectionSource3D_i.cxx.

Here is the call graph for this function:

Return source mesh.

Definition at line 137 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  SMESH::SMESH_Mesh_var mesh = myCorbaMesh;
  return mesh._retn();
}
GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource3D_i::GetSourceVertex ( CORBA::Long  i)

Returns the -th source vertex associated with the -th target vertex.

Returns the vertex associated with the target vertex.

Result may be nil if association not set. Valid indices are 1 and 2

Result may be nil if association not set

Definition at line 202 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  ASSERT( myBaseImpl );
  return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
    ( myShapeEntries[ i == 1 ? SRC_VERTEX1 : SRC_VERTEX2 ],
      this->GetImpl()->GetSourceVertex((int) i ));
}

Here is the call graph for this function:

GEOM::GEOM_Object_ptr StdMeshers_ProjectionSource3D_i::GetTargetVertex ( CORBA::Long  i)

Returns the -th target vertex associated with the -th source vertex.

Result may be nil if association not set.

Definition at line 217 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  ASSERT( myBaseImpl );
  return StdMeshers_ObjRefUlils::EntryOrShapeToGeomObject
    ( myShapeEntries[ i == 1 ? TGT_VERTEX1 : TGT_VERTEX2 ],
      this->GetImpl()->GetTargetVertex( (int)i ));
}

Here is the call graph for this function:

Verify whether hypothesis supports given entity type.

Parameters:
type- dimension (see SMESH::Dimension enumeration)
Return values:
CORBA::Boolean- TRUE if dimension is supported, FALSE otherwise

Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)

Definition at line 247 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  return type == SMESH::DIM_3D;
}
void StdMeshers_ProjectionSource3D_i::LoadFrom ( const char *  theStream) [virtual]

Retrieve parameters from the string.

Parameters:
theStream- the input string

Definition at line 280 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  ASSERT( myBaseImpl );
  std::istringstream is( theStream );

  TopoDS_Shape shapes[ NB_SHAPES ];
  for ( int i = 0; i < NB_SHAPES; ++i )
    shapes[ i ] = StdMeshers_ObjRefUlils::LoadFromStream( is );
  SMESH::SMESH_Mesh_var mesh =
    StdMeshers_ObjRefUlils::LoadObjectFromStream< SMESH::SMESH_Mesh >( is );

  ::SMESH_Mesh* meshImpl = 0;

  if ( !CORBA::is_nil( mesh ))
  {
    SMESH_Mesh_i* mesh_i = SMESH::DownCast< SMESH_Mesh_i* >( mesh );
    if ( mesh_i )
      meshImpl = &mesh_i->GetImpl();
  }

  myCorbaMesh = SMESH::SMESH_Mesh::_duplicate( mesh );

  GetImpl()->SetSourceMesh       ( meshImpl );
  GetImpl()->SetSource3DShape    ( shapes[ SRC_SHAPE3D ] );
  GetImpl()->SetVertexAssociation( shapes[ SRC_VERTEX1 ],
                                   shapes[ SRC_VERTEX2 ],
                                   shapes[ TGT_VERTEX1 ],
                                   shapes[ TGT_VERTEX2 ]);

  myBaseImpl->LoadFrom( is );

  std::istringstream str( theStream );
  for ( int i = 0; i < NB_SHAPES; ++i )
    str >> myShapeEntries[ i ];
}

Here is the call graph for this function:

Write parameters in a string.

Return values:
char*- resulting string

Definition at line 259 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  ASSERT( myBaseImpl );
  std::ostringstream os;

  for ( int i = 0; i < NB_SHAPES; ++i )
    StdMeshers_ObjRefUlils::SaveToStream( myShapeEntries[ i ], os );
  StdMeshers_ObjRefUlils::SaveToStream( GetSourceMesh(), os );

  myBaseImpl->SaveTo( os );

  return CORBA::string_dup( os.str().c_str() );
}

Here is the call graph for this function:

void StdMeshers_ProjectionSource3D_i::SetSource3DShape ( GEOM::GEOM_Object_ptr  shape) throw ( SALOME::SALOME_Exception )

Sets a source <shape> to take a mesh pattern from.

Sets a source <face> to take a mesh pattern from.

Definition at line 80 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  ASSERT( myBaseImpl );
  try {
    this->GetImpl()->SetSource3DShape( StdMeshers_ObjRefUlils::GeomObjectToShape( shape ));

    CORBA::String_var entry = shape->GetStudyEntry();
    myShapeEntries[ SRC_SHAPE3D ] = entry.in();
  }
  catch ( SALOME_Exception& S_ex ) {
    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
  }
  // Update Python script
  SMESH::TPythonDump() << _this() << ".SetSource3DShape( " << shape << " )";
}

Here is the call graph for this function:

void StdMeshers_ProjectionSource3D_i::SetSourceMesh ( SMESH::SMESH_Mesh_ptr  mesh) throw ( SALOME::SALOME_Exception )

Sets source <mesh> to take a mesh pattern from.

Definition at line 103 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  ASSERT( myBaseImpl );

  ::SMESH_Mesh* mesh = 0;

  if ( !CORBA::is_nil( theMesh ))
  {
    SMESH_Mesh_i* mesh_i = SMESH::DownCast< SMESH_Mesh_i* >( theMesh );
    if ( !mesh_i )
      THROW_SALOME_CORBA_EXCEPTION( "bad mesh", SALOME::BAD_PARAM );
    mesh = &mesh_i->GetImpl();
  }

  try {
    this->GetImpl()->SetSourceMesh ( mesh );
  }
  catch ( SALOME_Exception& S_ex ) {
    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
  }

  myCorbaMesh = SMESH::SMESH_Mesh::_duplicate( theMesh );

  // Update Python script
  SMESH::TPythonDump() << _this() << ".SetSourceMesh( " << theMesh << " )";
}
void StdMeshers_ProjectionSource3D_i::SetVertexAssociation ( GEOM::GEOM_Object_ptr  sourceVertex1,
GEOM::GEOM_Object_ptr  sourceVertex2,
GEOM::GEOM_Object_ptr  targetVertex1,
GEOM::GEOM_Object_ptr  targetVertex2 
) throw ( SALOME::SALOME_Exception )

Sets vertex association between the source shape and the target one.

This parameter is optional. Two vertices must belong to one edge of a shape

Definition at line 151 of file StdMeshers_ProjectionSource3D_i.cxx.

{
  ASSERT( myBaseImpl );
  try {
    TopoDS_Shape v1 = StdMeshers_ObjRefUlils::GeomObjectToShape( sourceVertex1 );
    TopoDS_Shape v2 = StdMeshers_ObjRefUlils::GeomObjectToShape( sourceVertex2 );
    TopoDS_Shape v3 = StdMeshers_ObjRefUlils::GeomObjectToShape( targetVertex1 );
    TopoDS_Shape v4 = StdMeshers_ObjRefUlils::GeomObjectToShape( targetVertex2 );
    this->GetImpl()->SetVertexAssociation( v1, v2, v3, v4 );

    myShapeEntries[ SRC_VERTEX1 ] = StdMeshers_ObjRefUlils::GeomObjectToEntry( sourceVertex1 );
    myShapeEntries[ SRC_VERTEX2 ] = StdMeshers_ObjRefUlils::GeomObjectToEntry( sourceVertex2 );
    myShapeEntries[ TGT_VERTEX1 ] = StdMeshers_ObjRefUlils::GeomObjectToEntry( targetVertex1 );
    myShapeEntries[ TGT_VERTEX2 ] = StdMeshers_ObjRefUlils::GeomObjectToEntry( targetVertex2 );
  }
  catch ( SALOME_Exception& S_ex ) {
    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
  }
  // Update Python script
  SMESH::TPythonDump() << _this() << ".SetVertexAssociation( "
                       << sourceVertex1 << ", "
                       << sourceVertex2 << ", "
                       << targetVertex1 << ", "
                       << targetVertex2 << " )";
}

Here is the call graph for this function:


Member Data Documentation

SMESH::SMESH_Mesh_var StdMeshers_ProjectionSource3D_i::myCorbaMesh [private]

Definition at line 124 of file StdMeshers_ProjectionSource3D_i.hxx.

Definition at line 123 of file StdMeshers_ProjectionSource3D_i.hxx.


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