// Module : SMESH
// $Header$
-using namespace std;
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
#include <TCollection_AsciiString.hxx>
-#include <fstream>
-#include <stdio.h>
-
#include "SMESH_Gen_i.hxx"
#include "SMESH_Mesh_i.hxx"
#include "SMESH_LocalLength_i.hxx"
#include "GEOM_Client.hxx"
#include <map>
+#include <fstream>
+#include <stdio.h>
+using namespace std;
#define NUM_TMP_FILES 4
_id = _poa->activate_object(_thisObj);
_ShapeReader = NULL;
- _localId = 0; // number of created objects & local id
}
return SMESH::SMESH_Hypothesis::_duplicate(hypothesis_i);
}
-//=============================================================================
-/*!
- *
+/**
+ * CORBA implementation of SMESH_Gen::Init. See SMESH_Gen.idl.
*/
-//=============================================================================
-
SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Init(GEOM::GEOM_Gen_ptr geomEngine,
CORBA::Long studyId,
GEOM::GEOM_Shape_ptr aShape) throw(SALOME::SALOME_Exception)
+{
+ return Init(geomEngine, studyId, aShape, -1);
+}
+
+/**
+ * This is NOT a CORBA implementation. Differ from the Init CORBA method
+ * by allowing to specify the ID of the created mesh.
+ */
+SMESH::SMESH_Mesh_ptr SMESH_Gen_i::Init(GEOM::GEOM_Gen_ptr geomEngine,
+ CORBA::Long studyId, GEOM::GEOM_Shape_ptr aShape, int meshID)
+ throw(SALOME::SALOME_Exception)
{
MESSAGE("Init");
// _narrow() duplicates the reference and checks the type
}
StudyContext_iStruct *myStudyContext = _mapStudyContext_i[studyId];
- // create a new mesh object servant, store it in a map in study context
-
- meshServant = new SMESH_Mesh_i(this, geom, studyId, _localId);
- myStudyContext->mapMesh_i[_localId] = meshServant;
- _localId++;
-
// create a new mesh object
-
TopoDS_Shape myLocShape = _ShapeReader->GetShape(geom, myShape);
- meshServant->SetImpl(_impl.Init(studyId, myLocShape));
+ SMESH_Mesh * meshImpl=_impl.Init(studyId, myLocShape, meshID);
+
+ // create a new mesh object servant, store it in a map in study context
+ meshServant = new SMESH_Mesh_i(this, geom, studyId, meshImpl);
+ myStudyContext->mapMesh_i[meshServant->GetId()] = meshServant;
}
catch(SALOME_Exception & S_ex)
{
string_to_object(anIOR->Value()));
SCRUTE(anIOR->Value());
SCRUTE(myAlgo->_is_nil());
- fprintf(destFile, "%i\n", myAlgo->GetId());
+ fprintf(destFile, "%li\n", myAlgo->GetId());
fprintf(destFile, "%s\n", myAlgo->GetName());
}
}
meshfile = "No data";
//********** opening of the HDF group
- sprintf(name_meshgroup, "Mesh %d", gotBranch->Tag());
+ sprintf(name_meshgroup, "Mesh %d", meshId);
SCRUTE(name_meshgroup);
hdf_group[gotBranch->Tag()] =
new HDFgroup(name_meshgroup, hdf_file);
{
char name_of_group[HDF_NAME_MAX_LEN + 1];
char objectId[10];
- double length, maxElementsArea, maxElementsVolume;
- int numberOfSegments;
HDFgroup * hdfGroup = new HDFgroup(name, hdf_file);
hdfGroup->OpenOnDisk();
void SMESH_Gen_i::loadMesh(char * name, HDFfile * hdf_file,
char* meshfile, SALOMEDS::Study_var Study)
{
- MESSAGE("in mesh load");
+ MESSAGE("SMESH_Gen_i::loadMesh("<<name<<","<<meshfile<<")");
+
char msgname[HDF_NAME_MAX_LEN + 1];
char objectId[10];
char name_of_group[HDF_NAME_MAX_LEN + 1];
SCRUTE(nb_meshsubgroup);
//********** Loading of the file name where the data are stored
- MESSAGE("Mesh data file");
strcpy(name_of_group, "Mesh data");
HDFdataset * dataset =
new HDFdataset(name_of_group, hdfGroupMeshId);
//********** Loading of the reference on the shape
//********** and mesh initialization
- MESSAGE("Ref on shape");
strcpy(name_of_group, "Ref on shape");
dataset =
new HDFdataset(name_of_group, hdfGroupMeshId);
if (!CORBA::is_nil(aShape))
{
_found = true;
- myNewMesh = this->Init(getGeomEngine(), Study->StudyId(), aShape);
+ myNewMesh = Init(getGeomEngine(), Study->StudyId(), aShape, myMeshId);
string iorString = _orb->object_to_string(myNewMesh);
sprintf(objectId, "%ld", myNewMesh->GetId());
- _SMESHCorbaObj[string("Mesh_") + string(objectId)] = iorString;
+ string key=string("Mesh_")+string(objectId);
+ MESSAGE("IOR of "<<key<<" is "<< iorString)
+ _SMESHCorbaObj[key] = iorString;
//**********
}
}
hdfGroupMeshId->CloseOnDisk();
- MESSAGE("End of Meshes Load");
}
/**
}
StudyContext_iStruct *myStudyContext = _mapStudyContext_i[studyId];
- // create a new mesh object servant, store it in a map in study context
- meshServant = new SMESH_Mesh_i(this, NULL, studyId, _localId);
- myStudyContext->mapMesh_i[_localId] = meshServant;
- _localId++;
-
// create a new mesh object
- meshServant->SetImpl(_impl.Import(studyId, fileName, fileType));
+ SMESH_Mesh * meshImpl=_impl.Import(studyId, fileName, fileType);
+
+ // create a new mesh object servant, store it in a map in study context
+ meshServant = new SMESH_Mesh_i(this, NULL, studyId, meshImpl);
+ myStudyContext->mapMesh_i[meshImpl->GetId()] = meshServant;
}
catch(SALOME_Exception & S_ex)
{
// Module : SMESH
// $Header$
-using namespace std;
#include "SMESH_Mesh_i.hxx"
#include "SMESH_subMesh_i.hxx"
#include "SMESH_MEDMesh_i.hxx"
#include <string>
#include <iostream>
-
-//**** SMESHDS en champ
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
-SMESH_Mesh_i::SMESH_Mesh_i()
-{
- MESSAGE("SMESH_Mesh_i: default constructor, not for use");
- ASSERT(0);
-};
+using namespace std;
//=============================================================================
/*!
//=============================================================================
SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i * gen_i,
- GEOM::GEOM_Gen_ptr geomEngine, CORBA::Long studyId, int localId)
+ GEOM::GEOM_Gen_ptr geomEngine, CORBA::Long studyId, ::SMESH_Mesh * impl)
{
MESSAGE("SMESH_Mesh_i");
_gen_i = gen_i;
- _id = localId;
_geom = GEOM::GEOM_Gen::_narrow(geomEngine);
- _studyId = studyId;
+ _impl=impl;
+ _studyId=studyId;
}
//=============================================================================
CORBA::Long SMESH_Mesh_i::GetId()throw(SALOME::SALOME_Exception)
{
- MESSAGE("SMESH_Mesh_i::GetId");
- return _id;
+ return _impl->GetId();
}
//=============================================================================
*/
//=============================================================================
-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()");