From f8b0ba96d8da85b97e70cb1e5b21049dfd30ccf6 Mon Sep 17 00:00:00 2001 From: secher Date: Fri, 30 Mar 2007 14:13:16 +0000 Subject: [PATCH] update to get new ensight driver version --- idl/FILTER_Gen.idl | 2 +- src/FILTER/Filter_Gen_i.cxx | 38 +++++++++++++++++++++---------------- src/FILTER/Filter_Gen_i.hxx | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/idl/FILTER_Gen.idl b/idl/FILTER_Gen.idl index 14e7691..c0de06f 100644 --- a/idl/FILTER_Gen.idl +++ b/idl/FILTER_Gen.idl @@ -59,7 +59,7 @@ module SALOME_FILTER void buildGradient() raises(FilterError); void getMinMax(out double min,out double max,in ref_func rf); LongSeq getHistogram(in long size,in ref_func rf); - void generateCriteria(in long nbthresh,in double fthresh,in double thresh,in long areaFlag) raises(FilterError); + void generateCriteria(in long nbthresh,in double fthresh,in double sthresh,in boolean areaFlag) raises(FilterError); void createEnsightInputFiles(); void filtering(); void projectFieldsOnDecimateMesh() raises(FilterError); diff --git a/src/FILTER/Filter_Gen_i.cxx b/src/FILTER/Filter_Gen_i.cxx index 6c17443..4238838 100755 --- a/src/FILTER/Filter_Gen_i.cxx +++ b/src/FILTER/Filter_Gen_i.cxx @@ -68,7 +68,7 @@ Filter_Gen_i:: Filter_Gen_i(CORBA::ORB_ptr orb, PortableServer::ObjectId * contId, const char *instanceName, const char *interfaceName) : - Engines_Component_i(orb, poa, contId, instanceName, interfaceName),_med(NULL),_newMed(NULL),_mesh(NULL),_newMesh(NULL),_myGradient(NULL),_myDField(NULL),_myIField(NULL),_criteria(NULL) + Engines_Component_i(orb, poa, contId, instanceName, interfaceName),_med(NULL),_newMed(NULL),_mesh(NULL),_newMesh(NULL),_myGradient(NULL),_myDField(NULL),_myIField(NULL),_criteria(NULL),_map(NULL) { MESSAGE("activate object"); _thisObj = this ; @@ -110,8 +110,12 @@ Filter_Gen_i::~Filter_Gen_i() delete _criteria; } + if(_map) + delete [] _map; if(_med) delete _med; + if(_newMed) + delete _newMed; } void Filter_Gen_i::loadMED(const char* inMedFile) @@ -283,7 +287,7 @@ LongSeq* Filter_Gen_i::getHistogram(CORBA::Long size,ref_func rf) return seq; } -void Filter_Gen_i::generateCriteria(CORBA::Long nbthresh,CORBA::Double fthresh,CORBA::Double sthresh,CORBA::Long areaFlag) throw(SALOME_FILTER::FILTER_Gen::FilterError) +void Filter_Gen_i::generateCriteria(CORBA::Long nbthresh,CORBA::Double fthresh,CORBA::Double sthresh,CORBA::Boolean areaFlag) throw(SALOME_FILTER::FILTER_Gen::FilterError) { double val, min, max; double sigmaV; @@ -422,15 +426,17 @@ void Filter_Gen_i::createEnsightInputFiles() // call ensight driver MED to generate input ensight mesh , // input ensight boundary mesh and input criteria ensight field for filtoo MESSAGE("Create ensight mesh"); - ENSIGHT_MESH_DRIVER myMeshDriver("/tmp/input.geom",_mesh); + ENSIGHT_MESH_WRONLY_DRIVER myMeshDriver("/tmp/input.case",_mesh); myMeshDriver.addSupport(supB); - id=_mesh->addDriver(myMeshDriver); - _mesh->write(id); +// myMeshDriver.open(); + myMeshDriver.write(); +// myMeshDriver.close(); MESSAGE("Create ensight field"); - ENSIGHT_FIELD_DRIVER myFieldDriver("/tmp/input.data",_criteria); - id=_criteria->addDriver(myFieldDriver); - _criteria->write(id); + ENSIGHT_FIELD_WRONLY_DRIVER myFieldDriver("/tmp/input.case",_criteria); +// myFieldDriver.open(); + myFieldDriver.write(); +// myFieldDriver.close(); } void Filter_Gen_i::filtering() @@ -455,8 +461,8 @@ void Filter_Gen_i::projectFieldsOnDecimateMesh() throw(SALOME_FILTER::FILTER_Gen string command; // have to call ensight driver MED to generate output MED file from filtoo output - MED _newMed(ENSIGHT_DRIVER,"/tmp/output.case"); - _newMed.read(); + _newMed = new ::MED(ENSIGHT_DRIVER,"/tmp/output.case"); + _newMed->read(); // destroy filtoo output files // command = "cd /tmp;rm -f output.*"; @@ -464,13 +470,13 @@ void Filter_Gen_i::projectFieldsOnDecimateMesh() throw(SALOME_FILTER::FILTER_Gen // system(command.c_str()); // get new mesh name - deque meshesNames = _newMed.getMeshNames(); + deque meshesNames = _newMed->getMeshNames(); int numberOfMeshes = meshesNames.size(); if( numberOfMeshes != 1) throw SALOME_FILTER::FILTER_Gen::FilterError("Unvalid number of meshes in filtoo output"); // new mesh generated by filtoo - _newMesh = _newMed.getMesh(meshesNames[0]); + _newMesh = _newMed->getMesh(meshesNames[0]); // create support on nodes on all new mesh SUPPORT *newSup = new SUPPORT(_newMesh,"Support",MED_NODE); @@ -566,9 +572,9 @@ void Filter_Gen_i::projectFieldsOnDecimateMesh() throw(SALOME_FILTER::FILTER_Gen } if(newDField) - _newMed.addField(newDField); + _newMed->addField(newDField); else - _newMed.addField(newIField); + _newMed->addField(newIField); // Destroy input field if not referecne field if(!isReferenceField) @@ -654,8 +660,8 @@ void Filter_Gen_i::createMedOutputFile(const char *outMedFile) { int id; - MESSAGE("Create ensight mesh"); - id = _newMed->addDriver(MED_DRIVER,outMedFile); + MESSAGE("Create MED mesh: "<addDriver(MED_DRIVER,outMedFile,MED_EN::MED_ECRI); _newMed->write(id); } diff --git a/src/FILTER/Filter_Gen_i.hxx b/src/FILTER/Filter_Gen_i.hxx index 7d24408..0268e64 100644 --- a/src/FILTER/Filter_Gen_i.hxx +++ b/src/FILTER/Filter_Gen_i.hxx @@ -64,7 +64,7 @@ public: void buildGradient() throw(SALOME_FILTER::FILTER_Gen::FilterError); void getMinMax(CORBA::Double& imin, CORBA::Double& imax,SALOME_FILTER::ref_func rf); SALOME_FILTER::LongSeq* getHistogram(CORBA::Long size,SALOME_FILTER::ref_func rf); - void generateCriteria(CORBA::Long nbthresh,CORBA::Double fthresh,CORBA::Double thresh,CORBA::Long areaFlag) throw(SALOME_FILTER::FILTER_Gen::FilterError); + void generateCriteria(CORBA::Long nbthresh,CORBA::Double fthresh,CORBA::Double thresh,CORBA::Boolean areaFlag) throw(SALOME_FILTER::FILTER_Gen::FilterError); void createEnsightInputFiles(); void filtering(); void projectFieldsOnDecimateMesh() throw(SALOME_FILTER::FILTER_Gen::FilterError); -- 2.39.2