NRI : First integration.

This commit is contained in:
nri 2003-05-19 13:54:48 +00:00
parent c6248ade99
commit 26dabc480d
48 changed files with 7063 additions and 0 deletions

63
src/SMESH_I/Makefile.in Normal file
View File

@ -0,0 +1,63 @@
#==============================================================================
# File : Makefile.in
# Created : mar mai 21 09:12:43 CEST 2002
# Author : Paul RASCLE, EDF
# Project : SALOME
# Copyright : EDF 2002
# $Header$
#==============================================================================
# source path
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome
@COMMENCE@
EXPORT_PYSCRIPTS = smeshpy.py SMESH_test.py
# Libraries targets
LIB= libSMESHEngine.la
LIB_SRC = SMESH_Gen_i.cxx SMESH_Mesh_i.cxx SMESH_MEDMesh_i.cxx \
SMESH_MEDFamily_i.cxx SMESH_MEDSupport_i.cxx \
SMESH_subMesh_i.cxx \
SMESH_MeshEditor_i.cxx \
SMESH_Hypothesis_i.cxx \
SMESH_topo.cxx SMESH_HypothesisFactory_i.cxx \
SMESH_Algo_i.cxx \
SMESH_1D_Algo_i.cxx \
SMESH_2D_Algo_i.cxx \
SMESH_3D_Algo_i.cxx \
SMESH_NumberOfSegments_i.cxx \
SMESH_LocalLength_i.cxx \
SMESH_MaxElementArea_i.cxx \
SMESH_MaxElementVolume_i.cxx \
SMESH_Regular_1D_i.cxx \
SMESH_Quadrangle_2D_i.cxx \
SMESH_MEFISTO_2D_i.cxx \
SMESH_Hexa_3D_i.cxx
LIB_SERVER_IDL = SMESH_Gen.idl SMESH_Hypothesis.idl SMESH_Mesh.idl \
SALOME_Component.idl SALOME_Exception.idl \
SMESH_BasicHypothesis.idl
LIB_CLIENT_IDL = SALOMEDS.idl GEOM_Gen.idl GEOM_Shape.idl MED.idl SALOMEDS_Attributes.idl
# Executables targets
BIN =
BIN_SRC =
# additionnal information to compil and link file
CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES)
CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES)
#IDLCXXFLAGS+= -Wbtp
LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) $(MED2_LIBS) -lSMESHimpl -lSalomeContainer -lSalomeNS -lSalomeDS -lRegistry -lSalomeHDFPersist -lOpUtil -lGeometryClient -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverMED -lSalomeLifeCycleCORBA
@CONCLUDE@

View File

@ -0,0 +1,52 @@
using namespace std;
//=============================================================================
// File : SMESH_1D_Algo_i.cxx
// Created : sam mai 18 09:23:13 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_1D_Algo_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_1D_Algo_i::SMESH_1D_Algo_i()
{
MESSAGE("SMESH_1D_Algo_i::SMESH_1D_Algo_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_1D_Algo_i::~SMESH_1D_Algo_i()
{
MESSAGE("SMESH_1D_Algo_i::~SMESH_1D_Algo_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_1D_Algo_i::SetImpl(::SMESH_1D_Algo* impl)
{
MESSAGE("SMESH_1D_Algo_i::SetImpl");
SMESH_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,35 @@
//=============================================================================
// File : SMESH_1D_Algo_i.hxx
// Created : sam mai 18 09:23:09 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_1D_ALGO_I_HXX_
#define _SMESH_1D_ALGO_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include "SMESH_Algo_i.hxx"
#include "SMESH_1D_Algo.hxx"
class SMESH_1D_Algo_i:
public POA_SMESH::SMESH_1D_Algo,
public SMESH_Algo_i
{
public:
SMESH_1D_Algo_i();
virtual ~SMESH_1D_Algo_i();
protected:
virtual void SetImpl(::SMESH_1D_Algo* impl);
::SMESH_1D_Algo* _impl;
};
#endif

View File

@ -0,0 +1,52 @@
using namespace std;
//=============================================================================
// File : SMESH_2D_Algo_i.cxx
// Created : sam mai 18 09:23:51 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_2D_Algo_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_2D_Algo_i::SMESH_2D_Algo_i()
{
MESSAGE("SMESH_2D_Algo_i::SMESH_2D_Algo_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_2D_Algo_i::~SMESH_2D_Algo_i()
{
MESSAGE("SMESH_2D_Algo_i::~SMESH_2D_Algo_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_2D_Algo_i::SetImpl(::SMESH_2D_Algo* impl)
{
MESSAGE("SMESH_2D_Algo_i::SetImpl");
SMESH_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,35 @@
//=============================================================================
// File : SMESH_2D_Algo_i.hxx
// Created : sam mai 18 09:23:57 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_2D_ALGO_I_HXX_
#define _SMESH_2D_ALGO_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include "SMESH_Algo_i.hxx"
#include "SMESH_2D_Algo.hxx"
class SMESH_2D_Algo_i:
public POA_SMESH::SMESH_2D_Algo,
public SMESH_Algo_i
{
public:
SMESH_2D_Algo_i();
virtual ~SMESH_2D_Algo_i();
protected:
virtual void SetImpl(::SMESH_2D_Algo* impl);
::SMESH_2D_Algo* _impl;
};
#endif

View File

@ -0,0 +1,52 @@
using namespace std;
//=============================================================================
// File : SMESH_3D_Algo_i.cxx
// Created : sam mai 18 09:25:00 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_3D_Algo_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_3D_Algo_i::SMESH_3D_Algo_i()
{
MESSAGE("SMESH_3D_Algo_i::SMESH_3D_Algo_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_3D_Algo_i::~SMESH_3D_Algo_i()
{
MESSAGE("SMESH_3D_Algo_i::~SMESH_3D_Algo_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_3D_Algo_i::SetImpl(::SMESH_3D_Algo* impl)
{
MESSAGE("SMESH_3D_Algo_i::SetImpl");
SMESH_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,35 @@
//=============================================================================
// File : SMESH_3D_Algo_i.hxx
// Created : sam mai 18 09:25:05 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_3D_ALGO_I_HXX_
#define _SMESH_3D_ALGO_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include "SMESH_Algo_i.hxx"
class SMESH_3D_Algo;
class SMESH_3D_Algo_i:
public POA_SMESH::SMESH_3D_Algo,
public SMESH_Algo_i
{
public:
SMESH_3D_Algo_i();
virtual ~SMESH_3D_Algo_i();
protected:
virtual void SetImpl(::SMESH_3D_Algo* impl);
::SMESH_3D_Algo* _impl;
};
#endif

View File

@ -0,0 +1,76 @@
using namespace std;
//=============================================================================
// File : SMESH_Algo_i.cxx
// Created : sam mai 18 09:21:02 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_Algo_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
#include <string>
#include <vector>
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Algo_i::SMESH_Algo_i()
{
MESSAGE("SMESH_Algo_i::SMESH_Algo_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Algo_i::~SMESH_Algo_i()
{
MESSAGE("SMESH_Algo_i::~SMESH_Algo_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::ListOfHypothesisName* SMESH_Algo_i::GetCompatibleHypothesis()
{
MESSAGE("SMESH_Algo_i::GetCompatibleHypothesis");
SMESH::ListOfHypothesisName_var listOfHypothesis
= new SMESH::ListOfHypothesisName;
const vector<string> & hypList = _impl->GetCompatibleHypothesis();
int nbHyp = hypList.size();
listOfHypothesis->length(nbHyp);
for (int i=0; i<nbHyp; i++)
{
listOfHypothesis[i] = hypList[i].c_str();
}
return listOfHypothesis._retn();
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Algo_i::SetImpl(::SMESH_Algo* impl)
{
MESSAGE("SMESH_Algo_i::SetImpl");
//SMESH_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,37 @@
//=============================================================================
// File : SMESH_Algo_i.hxx
// Created : sam mai 18 09:21:09 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_ALGO_I_HXX_
#define _SMESH_ALGO_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_Algo.hxx"
class SMESH_Algo_i:
public POA_SMESH::SMESH_Algo,
public SMESH_Hypothesis_i
{
public:
SMESH_Algo_i();
virtual ~SMESH_Algo_i();
SMESH::ListOfHypothesisName* GetCompatibleHypothesis();
protected:
virtual void SetImpl(::SMESH_Algo* impl);
::SMESH_Algo* _impl;
};
#endif

1706
src/SMESH_I/SMESH_Gen_i.cxx Normal file

File diff suppressed because it is too large Load Diff

134
src/SMESH_I/SMESH_Gen_i.hxx Normal file
View File

@ -0,0 +1,134 @@
//=============================================================================
// File : SMESH_Gen_i.hxx
// Created : lun mai 6 13:41:30 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_GEN_I_HXX_
#define _SMESH_GEN_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Gen)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include CORBA_CLIENT_HEADER(GEOM_Gen)
#include CORBA_CLIENT_HEADER(GEOM_Shape)
#include CORBA_CLIENT_HEADER(SALOMEDS)
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
class SMESH_Mesh_i;
#include "SMESH_HypothesisFactory_i.hxx"
#include "SMESH_Mesh_i.hxx"
#include "SALOME_Component_i.hxx"
#include "SALOME_NamingService.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_topo.hxx"
#include "GEOM_Client.hxx"
#include <HDFOI.hxx>
#include <map>
typedef struct studyContext_iStruct
{
map<int,SMESH_Mesh_i*> mapMesh_i;
} StudyContext_iStruct;
class SMESH_Gen_i:
public POA_SMESH::SMESH_Gen,
public Engines_Component_i
{
public:
SMESH_Gen_i();
SMESH_Gen_i(CORBA::ORB_ptr orb,
PortableServer::POA_ptr poa,
PortableServer::ObjectId * contId,
const char *instanceName,
const char *interfaceName);
virtual ~SMESH_Gen_i();
SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const char* anHyp,
CORBA::Long studyId)
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Mesh_ptr Init(GEOM::GEOM_Gen_ptr geomEngine,
CORBA::Long studyId,
GEOM::GEOM_Shape_ptr aShape)
throw (SALOME::SALOME_Exception);
CORBA::Boolean Compute(SMESH::SMESH_Mesh_ptr aMesh,
GEOM::GEOM_Shape_ptr aShape)
throw (SALOME::SALOME_Exception);
CORBA::Boolean IsReadyToCompute(SMESH::SMESH_Mesh_ptr aMesh,
GEOM::GEOM_Shape_ptr aShape)
throw (SALOME::SALOME_Exception);
SMESH::long_array* GetSubShapesId(GEOM::GEOM_Gen_ptr geomEngine,
CORBA::Long studyId,
GEOM::GEOM_Shape_ptr mainShape,
const SMESH::shape_array& listOfSubShape)
throw (SALOME::SALOME_Exception);
// inherited methods from SALOMEDS::Driver
SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
const char* theURL,
bool isMultiFile);
bool Load(SALOMEDS::SComponent_ptr theComponent,
const SALOMEDS::TMPFile& theStream,
const char* theURL,
bool isMultiFile);
void Close(SALOMEDS::SComponent_ptr theComponent);
char* ComponentDataType();
char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject,
const char* IORString,
CORBA::Boolean isMultiFile);
char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject,
const char* aLocalPersistentID,
CORBA::Boolean isMultiFile);
bool CanPublishInStudy(CORBA::Object_ptr theIOR) { return false; }
SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_ptr theSObject,
CORBA::Object_ptr theObject,
const char* theName) throw (SALOME::SALOME_Exception) {
SALOMEDS::SObject_var aResultSO;
return aResultSO._retn();
}
CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject) {return false;}
SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID) {return false;}
CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID) {return false;}
SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
CORBA::Long theObjectID,
SALOMEDS::SObject_ptr theObject) {
SALOMEDS::SObject_var aResultSO;
return aResultSO._retn();
}
GEOM_Client* _ShapeReader;
protected:
SMESH_topo* ExploreMainShape(GEOM::GEOM_Gen_ptr geomEngine,
CORBA::Long studyId,
GEOM::GEOM_Shape_ptr aShape);
private:
SMESH_HypothesisFactory_i _hypothesisFactory_i;
::SMESH_Gen _impl; // no namespace here
int _localId; // unique Id of created objects, within SMESH_Gen_i entity
map<int, StudyContext_iStruct*> _mapStudyContext_i;
map <string, string> _SMESHCorbaObj;
};
#endif

View File

@ -0,0 +1,61 @@
using namespace std;
//=============================================================================
// File : SMESH_Hexa_3D_i.cxx
// Created : sam mai 18 23:15:45 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_Hexa_3D_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Hexa_3D_i::SMESH_Hexa_3D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_Hexa_3D_i::SMESH_Hexa_3D_i");
_genImpl = genImpl;
::SMESH_Hexa_3D* impl
= new ::SMESH_Hexa_3D(_genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
SetImpl(impl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Hexa_3D_i::~SMESH_Hexa_3D_i()
{
MESSAGE("SMESH_Hexa_3D_i::~SMESH_Hexa_3D_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Hexa_3D_i::SetImpl(::SMESH_Hexa_3D* impl)
{
MESSAGE("SMESH_Hexa_3D_i::SetImpl");
SMESH_3D_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,36 @@
//=============================================================================
// File : SMESH_Hexa_3D_i.hxx
// Created : sam mai 18 23:15:38 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_HEXA_3D_I_HXX_
#define _SMESH_HEXA_3D_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_3D_Algo_i.hxx"
#include "SMESH_Hexa_3D.hxx"
class SMESH_Hexa_3D_i:
public POA_SMESH::SMESH_Hexa_3D,
public SMESH_3D_Algo_i
{
public:
SMESH_Hexa_3D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_Hexa_3D_i();
protected:
virtual void SetImpl(::SMESH_Hexa_3D* impl);
::SMESH_Hexa_3D* _impl;
};
#endif

View File

@ -0,0 +1,116 @@
using namespace std;
//=============================================================================
// File : SMESH_HypothesisFactory_i.cxx
// Created : dim mai 19 22:02:42 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_HypothesisFactory_i.hxx"
#include "SMESH_Hypothesis_i.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
// Add new hypothesis here (include file)
//---------------------------------------
#include "SMESH_LocalLength_i.hxx"
#include "SMESH_NumberOfSegments_i.hxx"
#include "SMESH_MaxElementArea_i.hxx"
#include "SMESH_Regular_1D_i.hxx"
#include "SMESH_MEFISTO_2D_i.hxx"
#include "SMESH_Quadrangle_2D_i.hxx"
#include "SMESH_Hexa_3D_i.hxx"
//---------------------------------------
//=============================================================================
/*!
* Specific Hypothesis Creators are generated with a template which inherits a
* generic hypothesis creator. Each creator returns an hypothesis of the type
* given in the template.
*/
//=============================================================================
template <class T> class HypothesisCreator_i: public GenericHypothesisCreator_i
{
public:
virtual SMESH_Hypothesis_i* Create (const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
return new T(anHyp, studyId, genImpl);
};
};
//=============================================================================
/*!
* Constructor: instanciate specific hypothesis creators, fill a private map
* indexed by hypothesis names. THIS METHOD MUST BE COMPLETED WHEN A NEW
* HYPOTHESIS IS ADDED.
* Specific hypothesis creator are defined with the above template.
* Hypothesis names are related to the corresponding class names:
* prefix = SMESH_ ; suffix = _i .
*/
//=============================================================================
SMESH_HypothesisFactory_i::SMESH_HypothesisFactory_i()
{
// Add new hypothesis here (creators)
//---------------------------------------
_creatorMap["LocalLength"] = new HypothesisCreator_i<SMESH_LocalLength_i>;
_creatorMap["NumberOfSegments"] = new HypothesisCreator_i<SMESH_NumberOfSegments_i>;
_creatorMap["MaxElementArea"] = new HypothesisCreator_i<SMESH_MaxElementArea_i>;
_creatorMap["Regular_1D"] = new HypothesisCreator_i<SMESH_Regular_1D_i>;
_creatorMap["MEFISTO_2D"] = new HypothesisCreator_i<SMESH_MEFISTO_2D_i>;
_creatorMap["Quadrangle_2D"] = new HypothesisCreator_i<SMESH_Quadrangle_2D_i>;
_creatorMap["Hexa_3D"] = new HypothesisCreator_i<SMESH_Hexa_3D_i>;
//---------------------------------------
}
//=============================================================================
/*!
* Destructor: deletes specific hypothesis creators instanciated in the
* constructor.
*/
//=============================================================================
SMESH_HypothesisFactory_i::~SMESH_HypothesisFactory_i()
{
map<string, GenericHypothesisCreator_i*>::iterator it;
for (it = _creatorMap.begin(); it != _creatorMap.end(); it++)
{
delete (*it).second;
}
_creatorMap.clear();
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Hypothesis_i* SMESH_HypothesisFactory_i::Create(const char* anHyp,
CORBA::Long studyId,
::SMESH_Gen* genImpl)
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_HypothesisFactory::Create " << anHyp);
if (_creatorMap.find(anHyp) == _creatorMap.end())
{
MESSAGE("levee exception CORBA");
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis type name", \
SALOME::BAD_PARAM);
}
SMESH_Hypothesis_i* myHyp = _creatorMap[anHyp]->Create(anHyp,
studyId,
genImpl);
return myHyp;
}

View File

@ -0,0 +1,40 @@
//=============================================================================
// File : SMESH_HypothesisFactory_i.hxx
// Created : dim mai 19 22:02:45 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_HYPOTHESISFACTORY_I_HXX_
#define _SMESH_HYPOTHESISFACTORY_I_HXX_
#include "SMESH_Hypothesis_i.hxx"
#include <map>
#include <string>
class GenericHypothesisCreator_i
{
public:
virtual SMESH_Hypothesis_i* Create(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl) = 0;
};
class SMESH_HypothesisFactory_i
{
public:
SMESH_HypothesisFactory_i();
virtual ~SMESH_HypothesisFactory_i();
SMESH_Hypothesis_i* Create(const char* anHyp,
CORBA::Long studyId,
::SMESH_Gen* genImpl)
throw (SALOME::SALOME_Exception);
private:
map<string, GenericHypothesisCreator_i*> _creatorMap;
};
#endif

View File

@ -0,0 +1,64 @@
using namespace std;
//=============================================================================
// File : SMESH_Hypothesis_i.cxx
// Created : lun mai 6 13:42:11 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Gen.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Hypothesis_i::SMESH_Hypothesis_i()
{
MESSAGE("SMESH_Hypothesis_i");
};
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Hypothesis_i::~SMESH_Hypothesis_i()
{
MESSAGE("~SMESH_Hypothesis_i");
};
//=============================================================================
/*!
*
*/
//=============================================================================
char* SMESH_Hypothesis_i::GetName()
{
MESSAGE("GetName");
return CORBA::string_dup(_baseImpl->GetName());
// const char* name = _baseImpl->GetName();
// SCRUTE(name);
// return CORBA::string_dup(name);
};
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Hypothesis_i::GetId()
{
MESSAGE("GetId");
return _baseImpl->GetID();
}

View File

@ -0,0 +1,35 @@
//=============================================================================
// File : SMESH_Hypothesis_i.hxx
// Created : lun mai 6 13:42:08 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_HYPOTHESIS_I_HXX_
#define _SMESH_HYPOTHESIS_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
class SMESH_Gen;
class SMESH_Hypothesis;
class SMESH_Hypothesis_i:
public POA_SMESH::SMESH_Hypothesis
{
public:
SMESH_Hypothesis_i();
virtual ~SMESH_Hypothesis_i();
char* GetName();
CORBA::Long GetId();
protected:
::SMESH_Hypothesis* _baseImpl;
::SMESH_Gen* _genImpl;
int _id;
};
#endif

View File

@ -0,0 +1,79 @@
using namespace std;
//=============================================================================
// File : SMESH_LocalLength_i.cxx
// Created : mar mai 14 13:07:42 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_LocalLength_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
* Constructor:
* _name is related to the class name: prefix = SMESH_ ; suffix = _i .
*/
//=============================================================================
SMESH_LocalLength_i::SMESH_LocalLength_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_LocalLength_i::SMESH_LocalLength_i");
_impl = new ::SMESH_LocalLength(genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_LocalLength_i::~SMESH_LocalLength_i()
{
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_LocalLength_i::SetLength(CORBA::Double length)
throw (SALOME::SALOME_Exception)
{
ASSERT(_impl);
try
{
_impl->SetLength(length);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Double SMESH_LocalLength_i::GetLength()
{
ASSERT(_impl);
return _impl->GetLength();
}

View File

@ -0,0 +1,40 @@
//=============================================================================
// File : SMESH_LocalLength_i.hxx
// Created : mar mai 14 13:07:47 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_LOCALLENGTH_I_HXX_
#define _SMESH_LOCALLENGTH_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_LocalLength.hxx"
class SMESH_LocalLength_i:
public POA_SMESH::SMESH_LocalLength,
public SMESH_Hypothesis_i
{
public:
SMESH_LocalLength_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_LocalLength_i();
void SetLength(CORBA::Double length)
throw (SALOME::SALOME_Exception);
CORBA::Double GetLength();
protected:
::SMESH_LocalLength* _impl;
};
#endif

View File

@ -0,0 +1,244 @@
using namespace std;
//=============================================================================
// File : SMESH_MEDFamily_i.cxx
// Project : SALOME
// Copyright : EDF 2001
//=============================================================================
#include "SMESH_MEDFamily_i.hxx"
#include "utilities.h"
#include "Utils_CorbaException.hxx"
//=============================================================================
/*!
* Default constructor
*/
//=============================================================================
SMESH_MEDFamily_i::SMESH_MEDFamily_i()
{
BEGIN_OF("Default Constructor SMESH_MEDFamily_i");
END_OF("Default Constructor SMESH_MEDFamily_i");
}
//=============================================================================
/*!
* constructor par recopie
*/
//=============================================================================
SMESH_MEDFamily_i::SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f):
SMESH_MEDSupport_i(f._subMesh_i,f._name,f._description,f._entity),
_subMesh_i(f._subMesh_i),
_identifier(f._identifier),
_numberOfAttribute(f._numberOfAttribute),
_numberOfGroup(f._numberOfGroup),
_attributeValue(f._attributeValue)
{
BEGIN_OF("Copy Constructor SMESH_MEDFamily_i");
_attributeDescription=new string[_numberOfAttribute];
for (int i=0;i<_numberOfAttribute;i++) {
_attributeDescription[i]=f._attributeDescription[i];
};
_groupName=new string[_numberOfGroup];
for (int i=0;i<_numberOfAttribute;i++) {
_groupName[i]=f._groupName[i];
};
END_OF("Copy Constructor SMESH_MEDFamily_i");
}
//=============================================================================
/*!
* Destructor
*/
//=============================================================================
SMESH_MEDFamily_i::~SMESH_MEDFamily_i()
{
}
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
SMESH_MEDFamily_i::SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
string name, string description, SALOME_MED::medEntityMesh entity):
SMESH_MEDSupport_i( sm, name, description, entity ),
_subMesh_i(sm),
_identifier(identifier),
_numberOfAttribute(0),
_attributeIdentifier((int*)NULL),
_attributeValue((int*)NULL),
_attributeDescription((string*)NULL),
_numberOfGroup(0),
_groupName((string*)NULL)
{
BEGIN_OF("Constructor SMESH_MEDFamily_i");
END_OF("Constructor SMESH_MEDFamily_i");
}
//=============================================================================
/*!
* CORBA: Accessor for Family's Identifier
*/
//=============================================================================
CORBA::Long SMESH_MEDFamily_i::getIdentifier()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
return _identifier;
}
//=============================================================================
/*!
* CORBA: Accessor for number of attributes
*/
//=============================================================================
CORBA::Long SMESH_MEDFamily_i::getNumberOfAttributes()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
return _numberOfAttribute;
}
//=============================================================================
/*!
* CORBA: Accessor for attributes identifiers
*/
//=============================================================================
Engines::long_array* SMESH_MEDFamily_i::getAttributesIdentifiers()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
,SALOME::BAD_PARAM);
};
Engines::long_array_var myseq= new Engines::long_array;
myseq->length(_numberOfAttribute);
for (int i=0;i<_numberOfAttribute;i++)
{
myseq[i]=_attributeIdentifier[i];
};
return myseq._retn();
}
//=============================================================================
/*!
* CORBA: Accessor for attribute identifier I
*/
//=============================================================================
CORBA::Long SMESH_MEDFamily_i::getAttributeIdentifier(CORBA::Long i)
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
,SALOME::BAD_PARAM);
if (_numberOfAttribute = 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
,SALOME::BAD_PARAM);
};
ASSERT (i <= _numberOfAttribute);
return _attributeIdentifier[i];
}
//=============================================================================
/*!
* CORBA: Accessor for attributes values
*/
//=============================================================================
Engines::long_array* SMESH_MEDFamily_i::getAttributesValues()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
if (_numberOfAttribute == 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
,SALOME::BAD_PARAM);
};
Engines::long_array_var myseq= new Engines::long_array;
myseq->length(_numberOfAttribute);
for (int i=0;i<_numberOfAttribute;i++)
{
myseq[i]=_attributeValue[i];
};
return myseq._retn();
}
//=============================================================================
/*!
* CORBA: Accessor for attribute value I
*/
//=============================================================================
CORBA::Long SMESH_MEDFamily_i::getAttributeValue(CORBA::Long i)
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
if (_numberOfAttribute = 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
,SALOME::BAD_PARAM);
}
ASSERT (i <= _numberOfAttribute);
return _attributeValue[i];
}
//=============================================================================
/*!
* CORBA: Accessor for attributes desriptions
*/
//=============================================================================
Engines::string_array * SMESH_MEDFamily_i::getAttributesDescriptions()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
if (_numberOfAttribute = 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
,SALOME::BAD_PARAM);
}
Engines::string_array_var myseq = new Engines::string_array;
for (int i=0;i<_numberOfAttribute;i++)
{
myseq[i]=CORBA::string_dup(_attributeDescription[i].c_str());
}
return myseq._retn();
}
//=============================================================================
/*!
* CORBA: Accessor for attribute description i
*/
//=============================================================================
char * SMESH_MEDFamily_i::getAttributeDescription( CORBA::Long i)
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
SALOME::INTERNAL_ERROR);
if (_numberOfAttribute = 0)
{
MESSAGE("Les familles SMESH n ont pas d attribut");
THROW_SALOME_CORBA_EXCEPTION("No attributes"\
,SALOME::BAD_PARAM);
}
ASSERT (i <= _numberOfAttribute);
return CORBA::string_dup(_attributeDescription[i].c_str());
}

View File

@ -0,0 +1,59 @@
//=============================================================================
// File : SMESH_MEDFamily_i.hxx
// Project : SALOME
// Copyright : EDF 2001
//=============================================================================
#ifndef SMESH_MED_FAMILY_I_HXX_
#define SMESH_MED_FAMILY_I_HXX_
#include "SMESH_MEDSupport_i.hxx"
#include<string>
class SMESH_MEDFamily_i:
public POA_SALOME_MED::FAMILY,
public SMESH_MEDSupport_i
{
protected :
SMESH_MEDFamily_i();
~SMESH_MEDFamily_i();
::SMESH_subMesh_i* _subMesh_i;
// Values
int _identifier;
int _numberOfAttribute;
int * _attributeIdentifier;
int * _attributeValue;
string * _attributeDescription;
int _numberOfGroup ;
string * _groupName ;
public :
// Constructors and associated internal methods
SMESH_MEDFamily_i(int identifier, SMESH_subMesh_i* sm,
string name, string description, SALOME_MED::medEntityMesh entity );
SMESH_MEDFamily_i(const SMESH_MEDFamily_i & f);
CORBA::Long getIdentifier()
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfAttributes()
throw (SALOME::SALOME_Exception);
Engines::long_array* getAttributesIdentifiers()
throw (SALOME::SALOME_Exception);
CORBA::Long getAttributeIdentifier(CORBA::Long i)
throw (SALOME::SALOME_Exception);
Engines::long_array* getAttributesValues()
throw (SALOME::SALOME_Exception);
CORBA::Long getAttributeValue(CORBA::Long i)
throw (SALOME::SALOME_Exception);
Engines::string_array* getAttributesDescriptions()
throw (SALOME::SALOME_Exception);
char* getAttributeDescription( CORBA::Long i)
throw (SALOME::SALOME_Exception);
};
#endif /* MED_FAMILY_I_HXX_ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,163 @@
//=============================================================================
// File : SMESH_MEDMesh_i.hxx
// Project : SALOME
// Copyright : EDF 2001
//=============================================================================
#ifndef _MED_SMESH_MESH_I_HXX_
#define _MED_SMESH_MESH_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(MED)
#include <string>
#include <vector>
#include <map>
#include "SMESHDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMDS_MeshFacesIterator.hxx"
#include "SMDS_MeshEdgesIterator.hxx"
#include "SMDS_MeshNodesIterator.hxx"
#include "SMDS_MeshVolumesIterator.hxx"
#define MED_NBR_GEOMETRIE_MAILLE 15
#define MED_NBR_TYPE 5
class SMESH_Mesh_i;
class SMESH_MEDMesh_i:
public POA_SALOME_MED::MESH,
public PortableServer::RefCountServantBase
{
public :
private :
protected:
// C++ object containing values
::SMESH_Mesh_i* _mesh_i;
Handle (SMESHDS_Mesh) _meshDS;
string _meshId;
bool _compte;
bool _creeFamily;
int _indexElts;
int _indexEnts;
int _famIdent;
map <SALOME_MED::medGeometryElement,int> _mapIndToSeqElts;
Engines::long_array_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE];
map <SALOME_MED::medEntityMesh,int> _mapNbTypes;
map <SALOME_MED::medEntityMesh,int> _mapIndToVectTypes;
vector<SALOME_MED::medGeometryElement> _TypesId[MED_NBR_GEOMETRIE_MAILLE];
vector<SALOME_MED::FAMILY_ptr> _families;
public:
// Constructors and associated internal methods
SMESH_MEDMesh_i();
SMESH_MEDMesh_i(SMESH_Mesh_i* m);
~SMESH_MEDMesh_i();
// IDL Methods
char * getName() throw (SALOME::SALOME_Exception);
CORBA::Long getSpaceDimension() throw (SALOME::SALOME_Exception);
CORBA::Long getMeshDimension() throw (SALOME::SALOME_Exception);
char * getCoordinateSystem()
throw (SALOME::SALOME_Exception);
Engines::double_array* getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
throw (SALOME::SALOME_Exception);
Engines::string_array* getCoordinatesNames()
throw (SALOME::SALOME_Exception);
Engines::string_array* getCoordinatesUnits()
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfNodes()
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfTypes (SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
SALOME_MED::medGeometryElement_array* getTypes(SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfElements (SALOME_MED::medEntityMesh entity,
SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
Engines::long_array* getConnectivity (SALOME_MED::medModeSwitch typeSwitch,
SALOME_MED::medConnectivity mode,
SALOME_MED::medEntityMesh entity,
SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
Engines::long_array* getConnectivityIndex(SALOME_MED::medConnectivity mode,
SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode,
SALOME_MED::medEntityMesh entity,
SALOME_MED::medGeometryElement type,
const Engines::long_array & connectivity)
throw (SALOME::SALOME_Exception);
Engines::long_array* getReverseConnectivity(SALOME_MED::medConnectivity mode)
throw (SALOME::SALOME_Exception);
Engines::long_array* getReverseConnectivityIndex(SALOME_MED::medConnectivity mode)
throw (SALOME::SALOME_Exception);
// Family and Group
CORBA::Long getNumberOfFamilies (SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfGroups (SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
SALOME_MED::Family_array* getFamilies (SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
SALOME_MED::FAMILY_ptr getFamily (SALOME_MED::medEntityMesh entity,
CORBA::Long i)
throw (SALOME::SALOME_Exception);
SALOME_MED::Group_array* getGroups (SALOME_MED::medEntityMesh entity)
throw (SALOME::SALOME_Exception);
SALOME_MED::GROUP_ptr getGroup (SALOME_MED::medEntityMesh entity,
CORBA::Long i)
throw (SALOME::SALOME_Exception);
//
SALOME_MED::FIELD_ptr getVolume (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getArea (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getLength (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getNormal (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getBarycenter (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
SALOME_MED::FIELD_ptr getNeighbourhood (SALOME_MED::SUPPORT_ptr mySupport)
throw (SALOME::SALOME_Exception);
// Others
void addInStudy (SALOMEDS::Study_ptr myStudy,
SALOME_MED::MESH_ptr myIor)
throw (SALOME::SALOME_Exception);
CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType,
const char* fileName, const char* meshName)
throw (SALOME::SALOME_Exception);
void rmDriver (CORBA::Long i)
throw (SALOME::SALOME_Exception);
void read (CORBA::Long i)
throw (SALOME::SALOME_Exception);
void write (CORBA::Long i, const char* driverMeshName)
throw (SALOME::SALOME_Exception);
// Cuisine interne
CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
//
void calculeNbElts() throw (SALOME::SALOME_Exception);
void createFamilies() throw (SALOME::SALOME_Exception);
};
#endif /* _MED_MESH_I_HXX_ */

View File

@ -0,0 +1,353 @@
using namespace std;
//=============================================================================
// File : SMESH_MEDSupport_i.cxx
// Project : SALOME
// Copyright : EDF 2002
//=============================================================================
#include "SMESH_MEDSupport_i.hxx"
#include "utilities.h"
#include "Utils_CorbaException.hxx"
#include <TopoDS_Iterator.hxx>
#include "SMESHDS_Mesh.hxx"
#include "SMDS_MapIteratorOfExtendedMap.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_Mesh_i.hxx"
#include "SMESH_subMesh_i.hxx"
//=============================================================================
/*!
* Default constructor
*/
//=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i()
{
BEGIN_OF("Default Constructor SMESH_MEDSupport_i");
END_OF("Default Constructor SMESH_MEDSupport_i");
}
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i* sm,
string name,
string description,
SALOME_MED::medEntityMesh entity) :
_subMesh_i(sm),
_name(name),
_description(description),
_entity(entity),
_seqNumber(false),
_seqLength(0)
{
BEGIN_OF("Constructor SMESH_MEDSupport_i");
_meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
int subMeshId = _subMesh_i->GetId();
MESSAGE ( " subMeshId " << subMeshId )
if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != _subMesh_i->_mesh_i->_mapSubMesh.end()) {
::SMESH_subMesh* subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
_subMeshDS = subMesh->GetSubMeshDS();
}
if ( _entity == SALOME_MED::MED_NODE)
{
_numberOfGeometricType = 1 ;
_geometricType = new SALOME_MED::medGeometryElement[1] ;
_geometricType[0] = SALOME_MED::MED_NONE ;
}
else
{
MESSAGE("Pas implemente dans cette version");
THROW_SALOME_CORBA_EXCEPTION("Seules les familles de noeuds sont implementees ", \
SALOME::BAD_PARAM);
}
END_OF("Constructor SMESH_MEDSupport_i");
}
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
SMESH_MEDSupport_i::SMESH_MEDSupport_i(const SMESH_MEDSupport_i &s) :
_subMesh_i(s._subMesh_i),
_name(s._name),
_description(s._description),
_entity(s._entity),
_seqNumber(false),
_seqLength(0)
{
BEGIN_OF("Constructor SMESH_MEDSupport_i");
_meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
int subMeshId = _subMesh_i->GetId();
if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != _subMesh_i->_mesh_i->_mapSubMesh.end()) {
::SMESH_subMesh* subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
_subMeshDS = subMesh->GetSubMeshDS();
}
END_OF("Constructor SMESH_MEDSupport_i");
}
//=============================================================================
/*!
* Destructor
*/
//=============================================================================
SMESH_MEDSupport_i::~SMESH_MEDSupport_i()
{
}
//=============================================================================
/*!
* CORBA: Accessor for Corba Index
*/
//=============================================================================
CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS==NULL)
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
MESSAGE("Not implemented for SMESH_i");
THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", \
SALOME::BAD_PARAM);
}
//=============================================================================
/*!
* CORBA: Accessor for Name
*/
//=============================================================================
char * SMESH_MEDSupport_i::getName()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS.IsNull())
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
return CORBA::string_dup(_name.c_str());
}
//=============================================================================
/*!
* CORBA: Accessor for Description
*/
//=============================================================================
char* SMESH_MEDSupport_i::getDescription()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS.IsNull())
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
return CORBA::string_dup(_description.c_str());
}
//=============================================================================
/*!
* CORBA: Accessor for Mesh
*/
//=============================================================================
SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS.IsNull())
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
return _subMesh_i->_mesh_i->GetMEDMesh();
}
//=============================================================================
/*!
* CORBA: boolean indicating if support concerns all elements
*/
//=============================================================================
CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS.IsNull())
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
if (_seqNumber == false)
{
if (_entity != SALOME_MED::MED_NONE)
{
int i = 0;
const SMDS_MapOfMeshElement& myNodesMap = _subMeshDS->GetNodes();
for (SMDS_MapIteratorOfExtendedMap it(myNodesMap); it.More(); it.Next())
{
const Handle(SMDS_MeshElement)& elem = myNodesMap.FindID(it.Key()->GetID());
const Handle(SMDS_MeshNode)& node = _meshDS->GetNode(1,elem);
i ++;
}
_seqLength=i;
_seqNumber=true;
}
else
{
MESSAGE("Only Node Families are implemented ");
THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ", \
SALOME::BAD_PARAM);
}
}
try
{
if (_seqLength == _meshDS->NbNodes())
_isOnAllElements=true;
else
_isOnAllElements=false;
}
catch(...)
{
MESSAGE("unable to acces related Mesh");
THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
SALOME::INTERNAL_ERROR);
};
return _isOnAllElements;
}
//=============================================================================
/*!
* CORBA: Accessor for type of support's entity
*/
//=============================================================================
SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS.IsNull())
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
return _entity;
}
//=============================================================================
/*!
* CORBA: Accessor for types of geometry elements
*/
//=============================================================================
SALOME_MED::medGeometryElement_array * SMESH_MEDSupport_i::getTypes()
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS.IsNull())
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
SALOME_MED::medGeometryElement_array_var myseq = new SALOME_MED::medGeometryElement_array;
try
{
int mySeqLength = _numberOfGeometricType;
myseq->length(mySeqLength);
for (int i=0;i<mySeqLength;i++)
{
myseq[i]=_geometricType[i];
}
}
catch(...)
{
MESSAGE("Exception lors de la recherche des differents types");
THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types", \
SALOME::INTERNAL_ERROR);
}
return myseq._retn();
}
//=============================================================================
/*!
* CORBA: Number of different types of geometry elements
* existing in the support
*/
//=============================================================================
CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS.IsNull())
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
return _numberOfGeometricType;
}
//=============================================================================
/*!
* CORBA: get Nodes
*/
//=============================================================================
Engines::long_array * SMESH_MEDSupport_i::getNumber(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception)
{
if (_subMeshDS.IsNull())
THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
SALOME::INTERNAL_ERROR);
// A changer s'il ne s agit plus seulement de famille de noeuds
if (geomElement != SALOME_MED::MED_NONE)
THROW_SALOME_CORBA_EXCEPTION("Not implemented", \
SALOME::BAD_PARAM);
Engines::long_array_var myseq= new Engines::long_array;
int i =0;
const SMDS_MapOfMeshElement& myNodesMap = _subMeshDS->GetNodes();
for (SMDS_MapIteratorOfExtendedMap it(myNodesMap); it.More(); it.Next())
{
const Handle(SMDS_MeshElement)& elem = myNodesMap.FindID(it.Key()->GetID());
const Handle(SMDS_MeshNode)& node = _meshDS->GetNode(1,elem);
myseq->length(i+1);
myseq[i]=node->GetID();
SCRUTE(node->GetID());
SCRUTE(myseq[i]);
i++;
};
SCRUTE(myseq->length());
MESSAGE("yyyyy");
return myseq._retn();
}
//=============================================================================
/*!
* CORBA: Global Nodes Index (optionnaly designed by the user)
* CORBA: ??????????????????????????????
*/
//=============================================================================
Engines::long_array * SMESH_MEDSupport_i::getNumberIndex()
throw (SALOME::SALOME_Exception)
{
MESSAGE("Not implemented for SMESH_i");
THROW_SALOME_CORBA_EXCEPTION("Not Implemented", \
SALOME::BAD_PARAM);
return 0;
}
//=============================================================================
/*!
* CORBA: Array containing indexes for elements included in the support
*/
//=============================================================================
CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception)
{
MESSAGE("Not implemented for SMESH_i");
return 0;
}

View File

@ -0,0 +1,81 @@
//=============================================================================
// File : SMESH_MEDSupport_i.hxx
// Project : SALOME
// Copyright : EDF 2001
//=============================================================================
#ifndef _MED_SMESH_MEDSUPPORT_I_HXX_
#define _MED_SMESH_MEDSUPPORT_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(MED)
#include <string>
#include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMESH_MEDSupport_i.hxx"
class SMESH_subMesh_i;
class SMESH_MEDSupport_i:
public POA_SALOME_MED::SUPPORT,
public PortableServer::RefCountServantBase
{
protected :
SMESH_MEDSupport_i();
~SMESH_MEDSupport_i();
public :
Handle_SMESHDS_SubMesh _subMeshDS;
::SMESH_subMesh_i* _subMesh_i;
Handle_SMESHDS_Mesh _meshDS;
string _name;
string _description;
bool _isOnAllElements;
bool _seqNumber;
int _seqLength;
SALOME_MED::medEntityMesh _entity;
SALOME_MED::medGeometryElement * _geometricType;
int _numberOfGeometricType;
public:
// Constructors and associated internal methods
SMESH_MEDSupport_i(SMESH_subMesh_i* sm,
string name,
string description,
SALOME_MED::medEntityMesh entity);
SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s);
// IDL Methods
char * getName() throw (SALOME::SALOME_Exception);
char * getDescription() throw (SALOME::SALOME_Exception);
SALOME_MED::MESH_ptr getMesh() throw (SALOME::SALOME_Exception);
CORBA::Boolean isOnAllElements() throw (SALOME::SALOME_Exception);
SALOME_MED::medEntityMesh getEntity() throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
Engines::long_array* getNumber(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
Engines::long_array* getNumberIndex()
throw (SALOME::SALOME_Exception);
CORBA::Long getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement)
throw (SALOME::SALOME_Exception);
SALOME_MED::medGeometryElement_array* getTypes()
throw (SALOME::SALOME_Exception);
CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
void createSeq() throw (SALOME::SALOME_Exception);
};
#endif /* _MED_MEDSUPPORT_I_HXX_ */

View File

@ -0,0 +1,61 @@
using namespace std;
//=============================================================================
// File : SMESH_MEFISTO_2D_i.cxx
// Created : jeu mai 16 13:26:18 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_MEFISTO_2D_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_MEFISTO_2D_i::SMESH_MEFISTO_2D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_MEFISTO_2D_i::SMESH_MEFISTO_2D_i");
_genImpl = genImpl;
::SMESH_MEFISTO_2D* impl
= new ::SMESH_MEFISTO_2D(_genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
SetImpl(impl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_MEFISTO_2D_i::~SMESH_MEFISTO_2D_i()
{
MESSAGE("SMESH_MEFISTO_2D_i::~SMESH_MEFISTO_2D_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_MEFISTO_2D_i::SetImpl(::SMESH_MEFISTO_2D* impl)
{
MESSAGE("SMESH_MEFISTO_2D_i::SetImpl");
SMESH_2D_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,37 @@
//=============================================================================
// File : SMESH_MEFISTO_2D_i.hxx
// Created : jeu mai 16 13:26:22 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_MEFISTO_2D_I_HXX_
#define _SMESH_MEFISTO_2D_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_2D_Algo_i.hxx"
#include "SMESH_MEFISTO_2D.hxx"
class SMESH_MEFISTO_2D_i:
public POA_SMESH::SMESH_MEFISTO_2D,
public SMESH_2D_Algo_i
{
public:
SMESH_MEFISTO_2D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_MEFISTO_2D_i();
protected:
virtual void SetImpl(::SMESH_MEFISTO_2D* impl);
::SMESH_MEFISTO_2D* _impl;
};
#endif

View File

@ -0,0 +1,79 @@
using namespace std;
//=============================================================================
// File : SMESH_MaxElementArea_i.cxx
// Created : sam mai 18 23:14:24 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_MaxElementArea_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
* Constructor:
* _name is related to the class name: prefix = SMESH_ ; suffix = _i .
*/
//=============================================================================
SMESH_MaxElementArea_i::SMESH_MaxElementArea_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_MaxElementArea_i::SMESH_MaxElementArea_i");
_impl = new ::SMESH_MaxElementArea(genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_MaxElementArea_i::~SMESH_MaxElementArea_i()
{
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_MaxElementArea_i::SetMaxElementArea(CORBA::Double area)
throw (SALOME::SALOME_Exception)
{
ASSERT(_impl);
try
{
_impl->SetMaxArea(area);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Double SMESH_MaxElementArea_i::GetMaxElementArea()
{
ASSERT(_impl);
return _impl->GetMaxArea();
}

View File

@ -0,0 +1,39 @@
//=============================================================================
// File : SMESH_MaxElementArea_i.hxx
// Created : sam mai 18 23:14:29 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_MAXELEMENTAREA_I_HXX_
#define _SMESH_MAXELEMENTAREA_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_MaxElementArea.hxx"
class SMESH_MaxElementArea_i:
public POA_SMESH::SMESH_MaxElementArea,
public SMESH_Hypothesis_i
{
public:
SMESH_MaxElementArea_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_MaxElementArea_i();
void SetMaxElementArea(CORBA::Double area)
throw (SALOME::SALOME_Exception);
CORBA::Double GetMaxElementArea();
protected:
::SMESH_MaxElementArea* _impl;
};
#endif

View File

@ -0,0 +1,9 @@
using namespace std;
//=============================================================================
// File : SMESH_MaxElementVolume_i.cxx
// Created : sam mai 18 23:14:58 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================

View File

@ -0,0 +1,8 @@
//=============================================================================
// File : SMESH_MaxElementVolume_i.hxx
// Created : sam mai 18 23:14:53 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================

View File

@ -0,0 +1,215 @@
using namespace std;
// File : SMESH_MeshEditor_i.cxx
// Created : Wed Jun 19 18:43:26 2002
// Author : Nicolas REJNERI
// Project : SALOME
// Module : SMESH
// Copyright : Open CASCADE 2002
// $Header$
#include "SMESH_MeshEditor_i.hxx"
#include "SMDS_MeshEdgesIterator.hxx"
#include "SMDS_MeshFacesIterator.hxx"
#include "SMDS_MeshVolumesIterator.hxx"
#include "SMDS_MeshEdge.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx"
#include "utilities.h"
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_MeshEditor_i::SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh) {
_myMeshDS = theMesh;
};
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array& IDsOfElements) {
for (int i = 0 ; i< IDsOfElements.length(); i++) {
CORBA::Long index = IDsOfElements[i];
_myMeshDS->RemoveElement(index);
MESSAGE ( "Element "<< index << " was removed" )
}
return true;
};
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array& IDsOfNodes) {
// Here we try to collect all 1D, 2D and 3D elements which contain at least one
// of <IDsOfNodes> in order to remove such elements.
// This seems correct since e.g a triangle without 1 vertex looks nonsense.
TColStd_MapOfInteger elemsToRemove;
for (int i = 0 ; i< IDsOfNodes.length(); i++) {
CORBA::Long ID = IDsOfNodes[i];
SMDS_MeshEdgesIterator edgeIt(_myMeshDS);
for (; edgeIt.More(); edgeIt.Next()) {
Handle(SMDS_MeshEdge) anEdge = Handle(SMDS_MeshEdge)::DownCast(edgeIt.Value());
for (Standard_Integer i = 0; i < anEdge->NbNodes(); i++) {
if (anEdge->GetConnection(i) == ID) {
Standard_Integer elemID = anEdge->GetID();
if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID);
}
}
}
SMDS_MeshFacesIterator faceIt(_myMeshDS);
for (; faceIt.More(); faceIt.Next()) {
Handle(SMDS_MeshFace) aFace = Handle(SMDS_MeshFace)::DownCast(faceIt.Value());
for (Standard_Integer i = 0; i < aFace->NbNodes(); i++) {
if (aFace->GetConnection(i) == ID) {
Standard_Integer elemID = aFace->GetID();
if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID);
}
}
}
SMDS_MeshVolumesIterator volIt(_myMeshDS);
for (; volIt.More(); volIt.Next()) {
Handle(SMDS_MeshVolume) aVol = Handle(SMDS_MeshVolume)::DownCast(volIt.Value());
for (Standard_Integer i = 0; i < aVol->NbNodes(); i++) {
if (aVol->GetConnection(i) == ID) {
Standard_Integer elemID = aVol->GetID();
if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID);
}
}
}
}
// Now remove them!
TColStd_MapIteratorOfMapOfInteger it(elemsToRemove);
for (; it.More(); it.Next()) {
Standard_Integer elemID = it.Key();
_myMeshDS->RemoveElement(elemID);
MESSAGE("RemoveNodes(): element removed: " << elemID)
}
// It's nodes' turn to die
for (int i = 0 ; i< IDsOfNodes.length(); i++) {
CORBA::Long index = IDsOfNodes[i];
_myMeshDS->RemoveNode(index);
MESSAGE ( "Node "<< index << " was removed" )
}
return true;
};
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array& IDsOfNodes) {
int NbNodes = IDsOfNodes.length();
if ( NbNodes == 2 ) {
CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index2 = IDsOfNodes[1];
int idTri = _myMeshDS->AddEdge(index1,index2);
}
return true;
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x,
CORBA::Double y,
CORBA::Double z) {
MESSAGE( " AddNode " << x << " , " << y << " , " << z )
int idNode = _myMeshDS->AddNode(x,y,z);
MESSAGE( " idNode " << idNode )
return true;
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array& IDsOfNodes) {
int NbNodes = IDsOfNodes.length();
if ( NbNodes == 3 ) {
CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index3 = IDsOfNodes[2];
int idTri = _myMeshDS->AddFace(index1,index2,index3);
} else if ( NbNodes == 4 ) {
CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index4 = IDsOfNodes[3];
int idTri = _myMeshDS->AddFace(index1,index2,index3,index4);
}
return true;
};
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::long_array& IDsOfNodes) {
int NbNodes = IDsOfNodes.length();
if ( NbNodes == 4 ) {
CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index4 = IDsOfNodes[3];
int idTetra = _myMeshDS->AddVolume(index1,index2,index3,index4);
} else if ( NbNodes == 5 ) {
CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index4 = IDsOfNodes[3];
CORBA::Long index5 = IDsOfNodes[4];
int idPyramid = _myMeshDS->AddVolume(index1,index2,index3,index4,index5);
} else if ( NbNodes == 6 ) {
CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index4 = IDsOfNodes[3];
CORBA::Long index5 = IDsOfNodes[4];
CORBA::Long index6 = IDsOfNodes[5];
int idPrism = _myMeshDS->AddVolume(index1,index2,index3,index4,index5,index6);
} else if ( NbNodes == 8 ) {
CORBA::Long index1 = IDsOfNodes[0];
CORBA::Long index2 = IDsOfNodes[1];
CORBA::Long index3 = IDsOfNodes[2];
CORBA::Long index4 = IDsOfNodes[3];
CORBA::Long index5 = IDsOfNodes[4];
CORBA::Long index6 = IDsOfNodes[5];
CORBA::Long index7 = IDsOfNodes[6];
CORBA::Long index8 = IDsOfNodes[7];
int idHexa = _myMeshDS->AddVolume(index1,index2,index3,index4,index5,index6,index7,index8);
}
return true;
};

View File

@ -0,0 +1,44 @@
// File : SMESH_MeshEditor_i.hxx
// Created : Wed Jun 19 18:43:16 2002
// Author : Nicolas REJNERI
// Project : SALOME
// Module : SMESH
// Copyright : Open CASCADE 2002
// $Header$
#ifndef _SMESH_MESHEDITOR_I_HXX_
#define _SMESH_MESHEDIOTR_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include "SMESHDS_Mesh.hxx"
class SMESH_MeshEditor_i:
public POA_SMESH::SMESH_MeshEditor
{
public:
SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh);
virtual ~SMESH_MeshEditor_i() {};
// --- CORBA
CORBA::Boolean RemoveElements(const SMESH::long_array& IDsOfElements);
CORBA::Boolean RemoveNodes(const SMESH::long_array& IDsOfNodes);
CORBA::Boolean AddNode(CORBA::Double x,
CORBA::Double y,
CORBA::Double z);
CORBA::Boolean AddEdge(const SMESH::long_array& IDsOfNodes);
CORBA::Boolean AddFace(const SMESH::long_array& IDsOfNodes);
CORBA::Boolean AddVolume(const SMESH::long_array& IDsOfNodes);
private:
SMESH::SMESH_subMesh_var _myMesh;
Handle (SMESHDS_Mesh) _myMeshDS;
};
#endif

View File

@ -0,0 +1,636 @@
using namespace std;
//=============================================================================
// File : SMESH_Mesh_i.cxx
// Created : lun mai 6 13:41:55 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_Mesh_i.hxx"
#include "SMESH_subMesh_i.hxx"
#include "SMESH_MEDMesh_i.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
#include "SALOME_NamingService.hxx"
#include "Utils_SINGLETON.hxx"
#include "OpUtil.hxx"
#include "TCollection_AsciiString.hxx"
// #include "SMESHDS_ListOfAsciiString.hxx"
// #include "SMESHDS_ListIteratorOfListOfAsciiString.hxx"
#include "TColStd_ListOfInteger.hxx"
#include "TColStd_ListOfReal.hxx"
#include "TColStd_ListIteratorOfListOfInteger.hxx"
#include "TColStd_ListIteratorOfListOfReal.hxx"
#include "SMESHDS_Command.hxx"
#include "SMESHDS_CommandType.hxx"
#include "SMESHDS_ListOfCommand.hxx"
#include "SMESHDS_ListIteratorOfListOfCommand.hxx"
#include "Handle_SMESHDS_Command.hxx"
#include "SMESH_MeshEditor_i.hxx"
#include <string>
#include <iostream>
//#include <sstream>
//**** SMESHDS en champ
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Mesh_i::SMESH_Mesh_i()
{
MESSAGE("SMESH_Mesh_i: default constructor, not for use");
ASSERT(0);
};
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i* gen_i,
GEOM::GEOM_Gen_ptr geomEngine,
CORBA::Long studyId,
int localId)
{
MESSAGE("SMESH_Mesh_i");
_gen_i = gen_i;
_id = localId;
_geom = GEOM::GEOM_Gen::_narrow(geomEngine);
_studyId = studyId;
}
//=============================================================================
/*!
* Destructor
*/
//=============================================================================
SMESH_Mesh_i::~SMESH_Mesh_i()
{
MESSAGE("~SMESH_Mesh_i");
// ****
};
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw (SALOME::SALOME_Exception)
{
MESSAGE("AddHypothesis");
// **** proposer liste de subShape (selection multiple)
GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
if (CORBA::is_nil(mySubShape))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \
SALOME::BAD_PARAM);
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
if (CORBA::is_nil(myHyp))
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", \
SALOME::BAD_PARAM);
bool ret = false;
try
{
TopoDS_Shape myLocSubShape=
_gen_i->_ShapeReader->GetShape(_geom,mySubShape);
int hypId = myHyp->GetId();
ret = _impl->AddHypothesis(myLocSubShape, hypId);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
return ret;
};
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Boolean
SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw (SALOME::SALOME_Exception)
{
MESSAGE("RemoveHypothesis");
// **** proposer liste de subShape (selection multiple)
GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
if (CORBA::is_nil(mySubShape))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \
SALOME::BAD_PARAM);
SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp);
if (CORBA::is_nil(myHyp))
THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", \
SALOME::BAD_PARAM);
bool ret = false;
try
{
TopoDS_Shape myLocSubShape=
_gen_i->_ShapeReader->GetShape(_geom,mySubShape);
int hypId = myHyp->GetId();
ret = _impl->RemoveHypothesis(myLocSubShape, hypId);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
return ret;
};
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::ListOfHypothesis*
SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape)
throw (SALOME::SALOME_Exception)
{
MESSAGE("GetHypothesisList");
// ****
};
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM::GEOM_Shape_ptr aSubShape)
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_Mesh_i::GetElementsOnShape");
GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape);
if (CORBA::is_nil(mySubShape))
THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \
SALOME::BAD_PARAM);
int subMeshId = 0;
try
{
SMESH_subMesh_i* subMeshServant;
TopoDS_Shape myLocSubShape
= _gen_i->_ShapeReader->GetShape(_geom,mySubShape);
//Get or Create the SMESH_subMesh object implementation
::SMESH_subMesh * mySubMesh
= _impl->GetSubMesh(myLocSubShape);
subMeshId = mySubMesh->GetId();
// create a new subMesh object servant if there is none for the shape
if (_mapSubMesh.find(subMeshId) != _mapSubMesh.end())
{
ASSERT(_mapSubMesh_i.find(subMeshId) != _mapSubMesh_i.end());
subMeshServant = _mapSubMesh_i[subMeshId];
}
else
{
// create and activate the CORBA servant of Mesh
subMeshServant = new SMESH_subMesh_i(_gen_i, this, subMeshId);
SMESH::SMESH_subMesh_var subMesh
= SMESH::SMESH_subMesh::_narrow(subMeshServant->_this());
_mapSubMesh[subMeshId] = mySubMesh;
_mapSubMesh_i[subMeshId] = subMeshServant;
_mapSubMeshIor[subMeshId]
= SMESH::SMESH_subMesh::_duplicate(subMesh);
}
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
ASSERT(_mapSubMeshIor.find(subMeshId) != _mapSubMeshIor.end());
return SMESH::SMESH_subMesh::_duplicate(_mapSubMeshIor[subMeshId]);
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::log_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_Mesh_i::GetLog");
SMESH::log_array_var aLog;
try
{
const SMESHDS_ListOfCommand& logDS =_impl->GetLog();
aLog = new SMESH::log_array;
int indexLog = 0;
int lg = logDS.Extent();
SCRUTE(lg);
aLog->length(lg);
SMESHDS_ListIteratorOfListOfCommand its(logDS);
while(its.More())
{
Handle(SMESHDS_Command) com = its.Value();
int comType = com->GetType();
//SCRUTE(comType);
int lgcom = com->GetNumber();
//SCRUTE(lgcom);
const TColStd_ListOfInteger& intList = com->GetIndexes();
int inum = intList.Extent();
//SCRUTE(inum);
TColStd_ListIteratorOfListOfInteger ii(intList);
const TColStd_ListOfReal& coordList = com->GetCoords();
int rnum = coordList.Extent();
//SCRUTE(rnum);
TColStd_ListIteratorOfListOfReal ir(coordList);
aLog[indexLog].commandType = comType;
aLog[indexLog].number = lgcom;
aLog[indexLog].coords.length(rnum);
aLog[indexLog].indexes.length(inum);
for (int i=0; i<rnum; i++)
{
aLog[indexLog].coords[i] = ir.Value();
//MESSAGE(" "<<i<<" "<<ir.Value());
ir.Next();
}
for (int i=0; i<inum; i++)
{
aLog[indexLog].indexes[i] = ii.Value();
//MESSAGE(" "<<i<<" "<<ii.Value());
ii.Next();
}
indexLog++;
its.Next();
}
if (clearAfterGet) _impl->ClearLog();
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
}
return aLog._retn();
}
// SMESH::string_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet)
// throw (SALOME::SALOME_Exception)
// {
// MESSAGE("SMESH_Mesh_i::GetLog");
// SMESH::string_array_var aLog;
// try
// {
// const SMESHDS_ListOfCommand& logDS =_impl->GetLog();
// aLog = new SMESH::string_array;
// int logSize = 0;
// int indexLog = 0;
// int lg = logDS.Extent();
// SCRUTE(lg);
// SMESHDS_ListIteratorOfListOfCommand its(logDS);
// while(its.More())
// {
// Handle(SMESHDS_Command) com = its.Value();
// int comType = com->GetType();
// SCRUTE(comType);
// int lgcom = com->GetNumber();
// SCRUTE(lgcom);
// logSize += lgcom;
// aLog->length(logSize);
// SCRUTE(logSize);
// const TColStd_ListOfInteger& intList = com->GetIndexes();
// TColStd_ListIteratorOfListOfInteger ii(intList);
// const TColStd_ListOfReal& coordList = com->GetCoords();
// TColStd_ListIteratorOfListOfReal ir(coordList);
// for (int icom = 1; icom <= lgcom; icom++)
// {
// ostringstream S;
// switch (comType)
// {
// case SMESHDS_AddNode:
// S << "AddNode " << ii.Value(); ii.Next();
// S << " " << ir.Value(); ir.Next();
// S << " " << ir.Value(); ir.Next();
// S << " " << ir.Value(); ir.Next();
// break;
// case SMESHDS_AddEdge:
// S << "AddEdge " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// break;
// case SMESHDS_AddTriangle:
// S << "AddFace " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// break;
// case SMESHDS_AddQuadrangle:
// S << "AddFace " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// break;
// case SMESHDS_AddTetrahedron:
// S << "AddVolume " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// break;
// case SMESHDS_AddPyramid:
// S << "AddVolume " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// break;
// case SMESHDS_AddPrism:
// S << "AddVolume " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// break;
// case SMESHDS_AddHexahedron:
// S << "AddVolume " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// S << " " << ii.Value(); ii.Next();
// break;
// case SMESHDS_RemoveNode:
// S << "RemoveNode " << ii.Value(); ii.Next();
// break;
// case SMESHDS_RemoveElement:
// S << "RemoveElement " << ii.Value(); ii.Next();
// break;
// default:
// ASSERT(0);
// break;
// }
// string ch = S.str();
// SCRUTE(ch);
// aLog[indexLog++] = CORBA::string_dup(ch.c_str());
// }
// its.Next();
// }
// if (clearAfterGet) _impl->ClearLog();
// }
// catch (SALOME_Exception& S_ex)
// {
// THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
// }
// return aLog._retn();
// }
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Mesh_i::ClearLog()
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_Mesh_i::ClearLog");
// ****
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::GetId()
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_Mesh_i::GetId");
return _id;
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::GetStudyId()
throw (SALOME::SALOME_Exception)
{
return _studyId;
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Mesh_i::SetImpl(::SMESH_Mesh* impl)
{
MESSAGE("SMESH_Mesh_i::SetImpl");
_impl = impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
::SMESH_Mesh& SMESH_Mesh_i::GetImpl()
{
MESSAGE("SMESH_Mesh_i::GetImpl()");
return *_impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
GEOM::GEOM_Gen_ptr SMESH_Mesh_i::GetGeomEngine()
{
MESSAGE("SMESH_Mesh_i::GetGeomEngine");
return GEOM::GEOM_Gen::_duplicate(_geom);
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Mesh_i::SetIor(SMESH::SMESH_Mesh_ptr myIor)
{
MESSAGE("SMESH_Mesh_i::SetIor");
_myIor = SMESH::SMESH_Mesh::_duplicate(myIor);
ASSERT(! CORBA::is_nil(_myIor));
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetIor()
{
MESSAGE("SMESH_Mesh_i::GetIor");
ASSERT(! CORBA::is_nil(_myIor));
return SMESH::SMESH_Mesh::_duplicate(_myIor);
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor()
{
SMESH_MeshEditor_i* aMeshEditor = new SMESH_MeshEditor_i(_impl->GetMeshDS());
SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this();
return aMesh._retn();
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Mesh_i::ExportMED( const char* file )
throw (SALOME::SALOME_Exception)
{
_impl->ExportMED( file );
}
void SMESH_Mesh_i::ExportDAT( const char* file )
throw (SALOME::SALOME_Exception)
{
_impl->ExportDAT( file );
}
void SMESH_Mesh_i::ExportUNV( const char* file )
throw (SALOME::SALOME_Exception)
{
_impl->ExportUNV( file );
}
//=============================================================================
/*!
*
*/
//=============================================================================
SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh()
throw (SALOME::SALOME_Exception)
{
SMESH_MEDMesh_i* aMedMesh = new SMESH_MEDMesh_i( this );
SALOME_MED::MESH_var aMesh = aMedMesh->_this();
return aMesh._retn();
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbNodes()
throw (SALOME::SALOME_Exception)
{
return _impl->NbNodes();
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbEdges()
throw (SALOME::SALOME_Exception)
{
return _impl->NbEdges();
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbFaces()
throw (SALOME::SALOME_Exception)
{
return _impl->NbFaces();
}
CORBA::Long SMESH_Mesh_i::NbTriangles()
throw (SALOME::SALOME_Exception)
{
return _impl->NbTriangles();
}
CORBA::Long SMESH_Mesh_i::NbQuadrangles()
throw (SALOME::SALOME_Exception)
{
return _impl->NbQuadrangles();
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbVolumes()
throw (SALOME::SALOME_Exception)
{
return _impl->NbVolumes();
}
CORBA::Long SMESH_Mesh_i::NbTetras()
throw (SALOME::SALOME_Exception)
{
return _impl->NbTetras();
}
CORBA::Long SMESH_Mesh_i::NbHexas()
throw (SALOME::SALOME_Exception)
{
return _impl->NbHexas();
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_Mesh_i::NbSubMesh()
throw (SALOME::SALOME_Exception)
{
return _impl->NbSubMesh();
}

View File

@ -0,0 +1,140 @@
//=============================================================================
// File : SMESH_Mesh_i.hxx
// Created : lun mai 6 13:41:50 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_MESH_I_HXX_
#define _SMESH_MESH_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include CORBA_CLIENT_HEADER(GEOM_Gen)
#include CORBA_CLIENT_HEADER(GEOM_Shape)
#include CORBA_CLIENT_HEADER(MED)
class SMESH_Gen_i;
#include "SMESH_Mesh.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_subMesh_i.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_topo.hxx"
#include <map>
class SMESH_Mesh_i:
public POA_SMESH::SMESH_Mesh
{
public:
SMESH_Mesh_i();
SMESH_Mesh_i(SMESH_Gen_i* myGen_i,
GEOM::GEOM_Gen_ptr geomEngine,
CORBA::Long studyId,
int localId);
virtual ~SMESH_Mesh_i();
// --- CORBA
CORBA::Boolean AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw (SALOME::SALOME_Exception);
CORBA::Boolean RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw (SALOME::SALOME_Exception);
SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape)
throw (SALOME::SALOME_Exception);
SMESH::SMESH_subMesh_ptr GetElementsOnShape(GEOM::GEOM_Shape_ptr aSubShape)
throw (SALOME::SALOME_Exception);
// SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
// throw (SALOME::SALOME_Exception);
SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
throw (SALOME::SALOME_Exception);
SMESH::SMESH_MeshEditor_ptr GetMeshEditor();
void ClearLog()
throw (SALOME::SALOME_Exception);
CORBA::Long GetId()
throw (SALOME::SALOME_Exception);
CORBA::Long GetStudyId()
throw (SALOME::SALOME_Exception);
// --- C++ interface
void SetImpl(::SMESH_Mesh* impl);
::SMESH_Mesh& GetImpl(); // :: force no namespace here
GEOM::GEOM_Gen_ptr GetGeomEngine();
void SetIor(SMESH::SMESH_Mesh_ptr myIor);
SMESH::SMESH_Mesh_ptr GetIor();
void ExportMED( const char* file )
throw (SALOME::SALOME_Exception);
void ExportDAT( const char* file )
throw (SALOME::SALOME_Exception);
void ExportUNV( const char* file )
throw (SALOME::SALOME_Exception);
SALOME_MED::MESH_ptr GetMEDMesh()
throw (SALOME::SALOME_Exception);
CORBA::Long NbNodes()
throw (SALOME::SALOME_Exception);
CORBA::Long NbEdges()
throw (SALOME::SALOME_Exception);
CORBA::Long NbFaces()
throw (SALOME::SALOME_Exception);
CORBA::Long NbTriangles()
throw (SALOME::SALOME_Exception);
CORBA::Long NbQuadrangles()
throw (SALOME::SALOME_Exception);
CORBA::Long NbVolumes()
throw (SALOME::SALOME_Exception);
CORBA::Long NbTetras()
throw (SALOME::SALOME_Exception);
CORBA::Long NbHexas()
throw (SALOME::SALOME_Exception);
CORBA::Long NbSubMesh()
throw (SALOME::SALOME_Exception);
map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI
private:
::SMESH_Mesh* _impl; // :: force no namespace here
SMESH_Gen_i* _gen_i;
// CORBA::ORB_ptr _orb;
// SMESH_topo* _topo; // all local TopoDS_Shape of subShapes
int _id; // id given by creator (unique within the creator instance)
GEOM::GEOM_Gen_var _geom;
int _studyId;
// int _localId; // id attributed to all objects created by Mesh_i
map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
SMESH::SMESH_Mesh_var _myIor;
};
#endif

View File

@ -0,0 +1,80 @@
using namespace std;
//=============================================================================
// File : SMESH_NumberOfSegments_i.cxx
// Created : jeu mai 16 13:09:33 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_NumberOfSegments_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
* Constructor:
* _name is related to the class name: prefix = SMESH_ ; suffix = _i .
*/
//=============================================================================
SMESH_NumberOfSegments_i::SMESH_NumberOfSegments_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_NumberOfSegments_i::SMESH_NumberOfSegments_i");
_impl= new ::SMESH_NumberOfSegments(genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_NumberOfSegments_i::~SMESH_NumberOfSegments_i()
{
}
//=============================================================================
/*!
*
*/
//=============================================================================
void
SMESH_NumberOfSegments_i::SetNumberOfSegments(CORBA::Long segmentsNumber)
throw (SALOME::SALOME_Exception)
{
ASSERT(_impl);
try
{
_impl->SetNumberOfSegments(segmentsNumber);
}
catch (SALOME_Exception& S_ex)
{
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \
SALOME::BAD_PARAM);
}
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_NumberOfSegments_i::GetNumberOfSegments()
{
ASSERT(_impl);
return _impl->GetNumberOfSegments();
}

View File

@ -0,0 +1,39 @@
//=============================================================================
// File : SMESH_NumberOfSegments_i.hxx
// Created : jeu mai 16 13:09:38 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_NUMBEROFSEGMENTS_I_HXX_
#define _SMESH_NUMBEROFSEGMENTS_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_Hypothesis_i.hxx"
#include "SMESH_NumberOfSegments.hxx"
class SMESH_NumberOfSegments_i:
public POA_SMESH::SMESH_NumberOfSegments,
public SMESH_Hypothesis_i
{
public:
SMESH_NumberOfSegments_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_NumberOfSegments_i();
void SetNumberOfSegments(CORBA::Long segmentsNumber)
throw (SALOME::SALOME_Exception);
CORBA::Long GetNumberOfSegments();
protected:
::SMESH_NumberOfSegments* _impl;
};
#endif

View File

@ -0,0 +1,61 @@
using namespace std;
//=============================================================================
// File : SMESH_Quadrangle_2D_i.cxx
// Created : jeu mai 16 13:27:25 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_Quadrangle_2D_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Quadrangle_2D_i::SMESH_Quadrangle_2D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_Quadrangle_2D_i::SMESH_Quadrangle_2D_i");
_genImpl = genImpl;
::SMESH_Quadrangle_2D* impl
= new ::SMESH_Quadrangle_2D(_genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
SetImpl(impl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Quadrangle_2D_i::~SMESH_Quadrangle_2D_i()
{
MESSAGE("SMESH_Quadrangle_2D_i::~SMESH_Quadrangle_2D_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Quadrangle_2D_i::SetImpl(::SMESH_Quadrangle_2D* impl)
{
MESSAGE("SMESH_Quadrangle_2D_i::SetImpl");
SMESH_2D_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,37 @@
//=============================================================================
// File : SMESH_Quadrangle_2D_i.hxx
// Created : jeu mai 16 13:27:29 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_QUADRANGLE_2D_I_HXX_
#define _SMESH_QUADRANGLE_2D_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_2D_Algo_i.hxx"
#include "SMESH_Quadrangle_2D.hxx"
class SMESH_Quadrangle_2D_i:
public POA_SMESH::SMESH_Quadrangle_2D,
public SMESH_2D_Algo_i
{
public:
SMESH_Quadrangle_2D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_Quadrangle_2D_i();
protected:
virtual void SetImpl(::SMESH_Quadrangle_2D* impl);
::SMESH_Quadrangle_2D* _impl;
};
#endif

View File

@ -0,0 +1,61 @@
using namespace std;
//=============================================================================
// File : SMESH_Regular_1D_i.cxx
// Created : jeu mai 16 13:25:47 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_Regular_1D_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Regular_1D_i::SMESH_Regular_1D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl)
{
MESSAGE("SMESH_Regular_1D_i::SMESH_Regular_1D_i");
_genImpl = genImpl;
::SMESH_Regular_1D* impl
= new ::SMESH_Regular_1D(_genImpl->_hypothesisFactory.GetANewId(),
studyId,
genImpl);
SetImpl(impl);
_baseImpl = _impl;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Regular_1D_i::~SMESH_Regular_1D_i()
{
MESSAGE("SMESH_Regular_1D_i::~SMESH_Regular_1D_i");
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Regular_1D_i::SetImpl(::SMESH_Regular_1D* impl)
{
MESSAGE("SMESH_Regular_1D_i::SetImpl");
SMESH_1D_Algo_i::SetImpl(impl);
_impl = impl;
}

View File

@ -0,0 +1,37 @@
//=============================================================================
// File : SMESH_Regular_1D_i.hxx
// Created : jeu mai 16 13:25:50 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_REGULAR_1D_I_HXX_
#define _SMESH_REGULAR_1D_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_1D_Algo_i.hxx"
#include "SMESH_Regular_1D.hxx"
class SMESH_Regular_1D_i:
public POA_SMESH::SMESH_Regular_1D,
public SMESH_1D_Algo_i
{
public:
SMESH_Regular_1D_i(const char* anHyp,
int studyId,
::SMESH_Gen* genImpl);
virtual ~SMESH_Regular_1D_i();
protected:
virtual void SetImpl(::SMESH_Regular_1D* impl);
::SMESH_Regular_1D* _impl;
};
#endif

View File

@ -0,0 +1,155 @@
using namespace std;
//=============================================================================
// File : SMESH_subMesh_i.cxx
// Created : jeu mai 30 10:01:12 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_subMesh_i.hxx"
#include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
#include "OpUtil.hxx"
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_subMesh_i::SMESH_subMesh_i()
{
MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i default, not for use");
ASSERT(0);
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_subMesh_i::SMESH_subMesh_i(SMESH_Gen_i* gen_i,
SMESH_Mesh_i* mesh_i,
int localId)
{
MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i");
_gen_i = gen_i;
_mesh_i = mesh_i;
_localId = localId;
// ****
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_subMesh_i::~SMESH_subMesh_i()
{
MESSAGE("SMESH_subMesh_i::~SMESH_subMesh_i");
// ****
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_subMesh_i::GetNumberOfElements()
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_subMesh_i::GetNumberOfElements");
// ****
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_subMesh_i::GetNumberOfNodes()
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_subMesh_i::GetNumberOfNodes");
// ****
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::long_array* SMESH_subMesh_i::GetElementsId()
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_subMesh_i::GetElementsId");
// ****
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::long_array* SMESH_subMesh_i::GetNodesId()
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_subMesh_i::GetNodesId");
// ****
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetFather()
throw (SALOME::SALOME_Exception)
{
MESSAGE("SMESH_subMesh_i::GetFather");
SMESH::SMESH_Mesh_var meshIor = _mesh_i->GetIor();
return SMESH::SMESH_Mesh::_duplicate(meshIor);
}
//=============================================================================
/*!
*
*/
//=============================================================================
CORBA::Long SMESH_subMesh_i::GetId()
{
MESSAGE("SMESH_subMesh_i::GetId");
return _localId;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SALOME_MED::FAMILY_ptr SMESH_subMesh_i::GetFamily()
throw (SALOME::SALOME_Exception)
{
SALOME_MED::MESH_var MEDMesh = GetFather()->GetMEDMesh();
SALOME_MED::Family_array_var families =
MEDMesh->getFamilies(SALOME_MED::MED_NODE);
for ( int i = 0; i < families->length(); i++ ) {
if ( families[i]->getIdentifier() == ( _localId ) )
return families[i];
}
}

View File

@ -0,0 +1,60 @@
//=============================================================================
// File : SMESH_subMesh_i.hxx
// Created : jeu mai 30 10:01:17 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_SUBMESH_I_HXX_
#define _SMESH_SUBMESH_I_HXX_
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include CORBA_CLIENT_HEADER(GEOM_Gen)
#include CORBA_CLIENT_HEADER(GEOM_Shape)
#include CORBA_CLIENT_HEADER(MED)
class SMESH_Gen_i;
class SMESH_Mesh_i;
class SMESH_subMesh_i:
public POA_SMESH::SMESH_subMesh
{
public:
SMESH_subMesh_i();
SMESH_subMesh_i(SMESH_Gen_i* gen_i,
SMESH_Mesh_i* mesh_i,
int localId);
~SMESH_subMesh_i();
CORBA::Long GetNumberOfElements()
throw (SALOME::SALOME_Exception);
CORBA::Long GetNumberOfNodes()
throw (SALOME::SALOME_Exception);
SMESH::long_array* GetElementsId()
throw (SALOME::SALOME_Exception);
SMESH::long_array* GetNodesId()
throw (SALOME::SALOME_Exception);
SMESH::SMESH_Mesh_ptr GetFather()
throw (SALOME::SALOME_Exception);
CORBA::Long GetId();
SALOME_MED::FAMILY_ptr GetFamily()
throw (SALOME::SALOME_Exception);
SMESH_Mesh_i* _mesh_i; //NRI
protected:
SMESH_Gen_i* _gen_i;
int _localId;
};
#endif

203
src/SMESH_I/SMESH_test.py Normal file
View File

@ -0,0 +1,203 @@
# creer des geometries, en selectionner une
import SMESH
import smeshpy
import salome
from salome import sg
import math
#import SMESH_BasicHypothesis_idl
import geompy
geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry")
myBuilder = salome.myStudy.NewBuilder()
from geompy import gg
ShapeTypeCompSolid = 1
ShapeTypeSolid = 2
ShapeTypeShell = 3
ShapeTypeFace = 4
ShapeTypeWire = 5
ShapeTypeEdge = 6
ShapeTypeVertex = 7
# ---- define a box
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
idb = geompy.addToStudy(box,"box")
# ---- add first face of box in study
subShapeList=geompy.SubShapeAll(box,ShapeTypeFace)
face=subShapeList[0]
name = geompy.SubShapeName( face._get_Name(), box._get_Name() )
print name
idf=geompy.addToStudyInFather(box,face,name)
# ---- add shell from box in study
subShellList=geompy.SubShapeAll(box,ShapeTypeShell)
shell = subShellList[0]
name = geompy.SubShapeName( shell._get_Name(), box._get_Name() )
print name
ids=geompy.addToStudyInFather(box,shell,name)
# ---- add first edge of face in study
edgeList = geompy.SubShapeAll(face,ShapeTypeEdge)
edge=edgeList[0];
name = geompy.SubShapeName( edge._get_Name(), face._get_Name() )
print name
ide=geompy.addToStudyInFather(face,edge,name)
# ---- launch SMESH, init a Mesh with the box
gen=smeshpy.smeshpy()
mesh=gen.Init(idb)
# ---- create Hypothesis
print "-------------------------- create Hypothesis"
print "-------------------------- LocalLength"
hyp1=gen.CreateHypothesis("LocalLength")
print hyp1.GetName()
print hyp1.GetId()
hypo1 = hyp1._narrow(SMESH.SMESH_LocalLength)
print hypo1.GetLength()
hypo1.SetLength(100)
print hypo1.GetLength()
print "-------------------------- bidon"
hyp3=gen.CreateHypothesis("bidon")
print "-------------------------- NumberOfSegments"
hyp3=gen.CreateHypothesis("NumberOfSegments")
hypo3=hyp3._narrow(SMESH.SMESH_NumberOfSegments)
hypo3.SetNumberOfSegments(7)
print hypo3.GetName()
print hypo3.GetNumberOfSegments()
print hypo3.GetId()
print "-------------------------- MaxElementArea"
hyp4=gen.CreateHypothesis("MaxElementArea")
hypo4=hyp4._narrow(SMESH.SMESH_MaxElementArea)
hypo4.SetMaxElementArea(5000)
print hypo4.GetName()
print hypo4.GetMaxElementArea()
print hypo4.GetId()
print "-------------------------- Regular_1D"
alg1=gen.CreateHypothesis("Regular_1D")
print alg1.GetName()
print alg1.GetId()
algo1=alg1._narrow(SMESH.SMESH_Algo)
listHyp=algo1.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
algo_1=alg1._narrow(SMESH.SMESH_Regular_1D)
print algo_1.GetId()
print "-------------------------- MEFISTO_2D"
alg2=gen.CreateHypothesis("MEFISTO_2D")
print alg2.GetName()
print alg2.GetId()
algo2=alg2._narrow(SMESH.SMESH_Algo)
listHyp=algo2.GetCompatibleHypothesis()
for hyp in listHyp:
print hyp
algo_2=alg2._narrow(SMESH.SMESH_MEFISTO_2D)
print algo_2.GetId()
# ---- add hypothesis to edge
print "-------------------------- add hypothesis to edge"
edge=salome.IDToObject(ide)
submesh=mesh.GetElementsOnShape(edge)
ret=mesh.AddHypothesis(edge,algo_1)
print ret
ret=mesh.AddHypothesis(edge,hypo1)
print ret
# ---- compute edge
##print "-------------------------- compute edge"
##ret=gen.Compute(mesh,ide)
##print ret
##log=mesh.GetLog(1);
##for a in log:
## print a
# ---- add hypothesis to box
print "-------------------------- add hypothesis to box"
box=salome.IDToObject(idb)
submesh=mesh.GetElementsOnShape(box)
ret=mesh.AddHypothesis(box,algo_1)
print ret
ret=mesh.AddHypothesis(box,hypo1)
print ret
ret=mesh.AddHypothesis(box,algo_2)
print ret
ret=mesh.AddHypothesis(box,hypo4)
print ret
# ---- compute face
print "-------------------------- compute face"
ret=gen.Compute(mesh,idf)
print ret
log=mesh.GetLog(1);
for a in log:
print "-------"
ii = 0
ir = 0
comType = a.commandType
if comType == 0:
for i in range(a.number):
ind = a.indexes[ii]
ii = ii+1
r1 = a.coords[ir]
ir = ir+1
r2 = a.coords[ir]
ir = ir+1
r3 = a.coords[ir]
ir = ir+1
print "AddNode %i - %g %g %g" % (ind, r1, r2, r3)
elif comType == 1:
for i in range(a.number):
ind = a.indexes[ii]
ii = ii+1
i1 = a.indexes[ii]
ii = ii+1
i2 = a.indexes[ii]
ii = ii+1
print "AddEdge %i - %i %i" % (ind, i1, i2)
elif comType == 2:
for i in range(a.number):
ind = a.indexes[ii]
ii = ii+1
i1 = a.indexes[ii]
ii = ii+1
i2 = a.indexes[ii]
ii = ii+1
i3 = a.indexes[ii]
ii = ii+1
print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)
# ---- compute box
##print "-------------------------- compute box"
##ret=gen.Compute(mesh,idb)
##print ret
##log=mesh.GetLog(1);
##print log
##shell=salome.IDToObject(ids)
##submesh=mesh.GetElementsOnShape(shell)
##ret=mesh.AddHypothesis(shell,algo_1)
##print ret
##ret=mesh.AddHypothesis(shell,hypo1)
##print ret
##ret=gen.Compute(mesh,ids)
##print ret

View File

@ -0,0 +1,40 @@
using namespace std;
//=============================================================================
// File : SMESH_topo.cxx
// Created : lun mai 13 15:17:25 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
using namespace std;
#include "SMESH_topo.hxx"
#include "utilities.h"
SMESH_topo::SMESH_topo()
{
MESSAGE("SMESH_topo()");
}
SMESH_topo::~SMESH_topo()
{
MESSAGE("~SMESH_topo()");
}
//=============================================================================
/*!
* Static method, gives a unique local id for a given CORBA reference of
* a shape, within the SALOME session (multi studies).
* Internal geom id or stringified CORBA reference could be used here.
* GEOM Id is more efficient (shorter string).
*/
//=============================================================================
string SMESH_topo::GetShapeLocalId(GEOM::GEOM_Shape_ptr aShape)
{
string str = aShape->ShapeId(); //geomId
MESSAGE(str);
return str;
}

View File

@ -0,0 +1,61 @@
//=============================================================================
// File : SMESH_topo.hxx
// Created : lun mai 13 15:17:20 CEST 2002
// Author : Paul RASCLE, EDF
// Project : SALOME
// Copyright : EDF 2002
// $Header$
//=============================================================================
#ifndef _SMESH_TOPO_HXX_
#define _SMESH_TOPO_HXX_
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(GEOM_Shape)
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_CompSolid.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <string>
#include <map>
static const char* const SMESH_shapeTypeNames[9] = { "0=TopAbs_COMPOUND",
"1=TopAbs_COMPSOLID",
"2=TopAbs_SOLID",
"3=TopAbs_SHELL",
"4=TopAbs_FACE",
"5=TopAbs_WIRE",
"6=TopAbs_EDGE",
"7=TopAbs_VERTEX",
"8=TopAbs_SHAPE" };
class SMESH_topo
{
public:
static string GetShapeLocalId(GEOM::GEOM_Shape_ptr aShape);
SMESH_topo();
virtual ~SMESH_topo();
map <string, int> _mapIndShapes[9];
TopTools_IndexedMapOfShape _myShapes[9];
protected:
};
#endif

70
src/SMESH_I/smeshpy.py Normal file
View File

@ -0,0 +1,70 @@
import salome
import SMESH
from SALOME_utilities import *
#=============================================================================
class smeshpy:
_geom = None
_smesh = None
_studyId = None
#--------------------------------------------------------------------------
def __init__(self):
try:
self._geom = salome.lcc.FindOrLoadComponent("FactoryServer","Geometry")
self._smesh = salome.lcc.FindOrLoadComponent("FactoryServer","SMESH")
except:
MESSAGE( "exception in smeshpy:__init__" )
self._studyId = salome.myStudyId
#--------------------------------------------------------------------------
def Init(self, shapeId):
try:
shape = salome.IDToObject(shapeId)
aMesh = self._smesh.Init(self._geom, self._studyId, shape)
return aMesh
except:
MESSAGE( "exception in smeshpy:Init" )
return None
#--------------------------------------------------------------------------
def CreateHypothesis(self, name):
try:
hyp = self._smesh.CreateHypothesis(name,self._studyId)
return hyp
except:
MESSAGE( "exception in smeshpy:CreateHypothesis" )
return None
#--------------------------------------------------------------------------
def Compute(self, mesh, shapeId):
try:
shape = salome.IDToObject(shapeId)
ret=self._smesh.Compute(mesh, shape)
return ret
except:
MESSAGE( "exception in smeshpy:Compute" )
return 0
#=============================================================================
## #--------------------------------------------------------------------------
##def SmeshInit(shapeId):
## import salome
## import SMESH
## geom = salome.lcc.FindOrLoadComponent("FactoryServer", "Geometry")
## smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
## shape = salome.IDToObject(shapeId)
## studyId = salome.myStudyId
## MESSAGE( str(studyId) )
## aMesh = smesh.Init(geom, studyId, shape)
## return aMesh
## #--------------------------------------------------------------------------

225
src/SMESH_I/sstream Normal file
View File

@ -0,0 +1,225 @@
/* This is part of libio/iostream, providing -*- C++ -*- input/output.
Copyright (C) 2000 Free Software Foundation
This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option)
any later version.
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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
/* Written by Magnus Fromreide (magfr@lysator.liu.se). */
#ifndef __SSTREAM__
#define __SSTREAM__
#include <string>
#include <iostream.h>
#include <streambuf.h>
namespace std
{
class stringbuf : public streambuf
{
public:
typedef char char_type;
typedef int int_type;
typedef streampos pos_type;
typedef streamoff off_type;
explicit stringbuf(int which=ios::in|ios::out) :
streambuf(which), buf(), mode(static_cast<ios::open_mode>(which)),
rpos(0), bufsize(1)
{ }
explicit stringbuf(const std::string &s, int which=ios::in|ios::out) :
streambuf(which), buf(s), mode(static_cast<ios::open_mode>(which)),
bufsize(1)
{
if(mode & ios::in)
{
setg(&defbuf, &defbuf + bufsize, &defbuf + bufsize);
}
if(mode & ios::out)
{
setp(&defbuf, &defbuf + bufsize);
}
rpos = (mode & ios::ate ? s.size() : 0);
}
std::string str() const
{
const_cast<stringbuf*>(this)->sync(); // Sigh, really ugly hack
return buf;
};
void str(const std::string& s)
{
buf = s;
if(mode & ios::in)
{
gbump(egptr() - gptr());
}
if(mode & ios::out)
{
pbump(pbase() - pptr());
}
rpos = (mode & ios::ate ? s.size() : 0);
}
protected:
inline virtual int sync();
inline virtual int overflow(int = EOF);
inline virtual int underflow();
private:
std::string buf;
ios::open_mode mode;
std::string::size_type rpos;
streamsize bufsize;
char defbuf;
};
class stringstreambase : virtual public ios {
protected:
stringbuf __my_sb;
public:
std::string str() const
{
return dynamic_cast<stringbuf*>(_strbuf)->str();
}
void str(const std::string& s)
{
clear();
dynamic_cast<stringbuf*>(_strbuf)->str(s);
}
stringbuf* rdbuf()
{
return &__my_sb;
}
protected:
stringstreambase(int which) :
__my_sb(which)
{
init (&__my_sb);
}
stringstreambase(const std::string& s, int which) :
__my_sb(s, which)
{
init (&__my_sb);
}
};
class istringstream : public stringstreambase, public istream {
public:
istringstream(int which=ios::in) :
stringstreambase(which)
{ }
istringstream(const std::string& s, int which=ios::in) :
stringstreambase(s, which)
{ }
};
class ostringstream : public stringstreambase, public ostream {
public:
ostringstream(int which=ios::out) :
stringstreambase(which)
{ }
ostringstream(const std::string& s, int which=ios::out) :
stringstreambase(s, which)
{ }
};
class stringstream : public stringstreambase, public iostream {
public:
stringstream(int which=ios::in|ios::out) :
stringstreambase(which)
{ }
stringstream(const std::string &s, int which=ios::in|ios::out) :
stringstreambase(s, which)
{ }
};
}
inline int std::stringbuf::sync()
{
if((mode & ios::out) == 0)
return EOF;
streamsize n = pptr() - pbase();
if(n)
{
buf.replace(rpos, std::string::npos, pbase(), n);
if(buf.size() - rpos != n)
return EOF;
rpos += n;
pbump(-n);
gbump(egptr() - gptr());
}
return 0;
}
inline int std::stringbuf::overflow(int ch)
{
if((mode & ios::out) == 0)
return EOF;
streamsize n = pptr() - pbase();
if(n && sync())
return EOF;
if(ch != EOF)
{
std::string::size_type oldSize = buf.size();
buf.replace(rpos, std::string::npos, ch);
if(buf.size() - oldSize != 1)
return EOF;
++rpos;
}
return 0;
}
inline int std::stringbuf::underflow()
{
sync();
if((mode & ios::in) == 0)
{
return EOF;
}
if(rpos >= buf.size())
{
return EOF;
}
std::string::size_type n = egptr() - eback();
std::string::size_type s;
s = buf.copy(eback(), n, rpos);
pbump(pbase() - pptr());
gbump(eback() - gptr());
int res = (0377 & buf[rpos]);
rpos += s;
return res;
}
#endif /* not __STRSTREAM__ */