From 3da77aaf911e1600874ec3625c5a5224dc77d1b7 Mon Sep 17 00:00:00 2001 From: secher Date: Fri, 16 Mar 2007 12:58:38 +0000 Subject: [PATCH] put MED processes in engine, and use corba between GUI and Engine --- configure.in.base | 34 +- idl/FILTER_Gen.idl | 66 ++-- src/FILTER/Filter_Gen_i.cxx | 596 ++++++++++++++++++++++++++++++++- src/FILTER/Filter_Gen_i.hxx | 52 ++- src/FILTER/Makefile.in | 5 +- src/FILTERGUI/FilterGUI.cxx | 31 +- src/FILTERGUI/FilterGUI.h | 2 + src/FILTERGUI/SelectField.cxx | 40 +-- src/FILTERGUI/SelectField.h | 6 +- src/FILTERGUI/SelectParams.cxx | 480 +++----------------------- src/FILTERGUI/SelectParams.h | 20 +- 11 files changed, 810 insertions(+), 522 deletions(-) diff --git a/configure.in.base b/configure.in.base index 3336816..bffa2f4 100644 --- a/configure.in.base +++ b/configure.in.base @@ -183,6 +183,22 @@ echo CHECK_QT +echo +echo --------------------------------------------- +echo testing msg2qm +echo --------------------------------------------- +echo + +CHECK_MSG2QM + +echo +echo --------------------------------------------- +echo testing VTK +echo --------------------------------------------- +echo + +CHECK_VTK + echo echo --------------------------------------------- echo testing HDF5 @@ -199,6 +215,22 @@ echo CHECK_MED2 +echo +echo --------------------------------------------- +echo BOOST Library +echo --------------------------------------------- +echo + +CHECK_BOOST + +echo +echo --------------------------------------------- +echo Testing OpenCascade +echo --------------------------------------------- +echo + +CHECK_CAS + echo echo --------------------------------------------- echo Testing qwt @@ -266,7 +298,7 @@ echo --------------------------------------------- echo echo Configure -variables="cc_ok python_ok swig_ok threads_ok qt_ok hdf5_ok med2_ok omniORB_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok Med_ok filtoo_ok" +variables="cc_ok boost_ok python_ok swig_ok threads_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok Med_ok filtoo_ok" for var in $variables do diff --git a/idl/FILTER_Gen.idl b/idl/FILTER_Gen.idl index ea89d21..14e7691 100644 --- a/idl/FILTER_Gen.idl +++ b/idl/FILTER_Gen.idl @@ -28,48 +28,42 @@ #include "SALOME_Exception.idl" #include "SALOME_Component.idl" -#include "SALOMEDS.idl" module SALOME_FILTER { - interface FILTER_Gen : Engines::Component, SALOMEDS::Driver - { -// /*! -// it returns a Corba pointer %MESH on the mesh stored in the .med file -// fileName with the name meshName. -// */ -// SALOME_FILTER::MESH readMeshInFile(in string fileName, in string studyName, -// in string meshName) -// raises(SALOME::SALOME_Exception); + struct DT_IT { + long dt; + long it; + }; -// /*! -// it returns a Corba pointer %FIELD on the field instance with the order -// ordre at the iteration iter, stored in the .med -// file fileName with the name fieldName. -// */ -// SALOME_FILTER::FIELD readFieldInFile(in string fileName, in string studyName, -// in string fieldName, in long ordre, -// in long iter) -// raises (SALOME::SALOME_Exception); + enum rfunc {F_FIELD,F_GRAD}; + typedef rfunc ref_func; + typedef sequence LongSeq; + typedef sequence StrSeq; + typedef sequence DTITSeq; -// /*! -// it returns a Corba pointer on the %MED object regrouping all objects -// (%MESH and %FIELD) stored in the file fileName. All instances -// of the fields are stored without their type. -// */ -// SALOME_FILTER::MED readStructFile(in string fileName, -// in string studyName) -// raises (SALOME::SALOME_Exception); + interface FILTER_Gen : Engines::Component + { + exception FilterError{ + string error_msg; + }; -// /*! -// It pushes all Corba pointers (%MED, %MESH, %FIELD) in the study named -// studyName. The %MED object regroups all objects -// (%MESH and %FIELD) stored in the file fileName and all -// instances of the fields are stored with their own type. -// */ -// void readStructFileWithFieldType(in string fileName, -// in string studyName) -// raises (SALOME::SALOME_Exception); + void loadMED(in string inMEDFile); + void unloadMED(); + StrSeq getMeshNames(); + StrSeq getFieldNames(); + long getMeshDimension(in string meshName); + DTITSeq getFieldIteration(in string fieldName); + string getMeshName(in string fieldName,in long dt,in long it); + void readReferenceField(in string meshName,in string fieldName,in long ts); + 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 createEnsightInputFiles(); + void filtering(); + void projectFieldsOnDecimateMesh() raises(FilterError); + void createMedOutputFile(in string outMedFile); }; }; diff --git a/src/FILTER/Filter_Gen_i.cxx b/src/FILTER/Filter_Gen_i.cxx index 34be897..6c17443 100755 --- a/src/FILTER/Filter_Gen_i.cxx +++ b/src/FILTER/Filter_Gen_i.cxx @@ -33,6 +33,7 @@ #include "Utils_CorbaException.hxx" #include "utilities.h" +#include "MEDMEM_EnsightMeshDriver.hxx" #include #include #include @@ -40,10 +41,10 @@ #include #include #include -#include "SALOMEDS_Tool.hxx" using namespace std; - Filter_Gen_i* Filter_Gen_i::_FILTERGen = NULL; +using namespace SALOME_FILTER; +Filter_Gen_i* Filter_Gen_i::_FILTERGen = NULL; //============================================================================= /*! @@ -67,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) + Engines_Component_i(orb, poa, contId, instanceName, interfaceName),_med(NULL),_newMed(NULL),_mesh(NULL),_newMesh(NULL),_myGradient(NULL),_myDField(NULL),_myIField(NULL),_criteria(NULL) { MESSAGE("activate object"); _thisObj = this ; @@ -79,7 +80,6 @@ Filter_Gen_i:: Filter_Gen_i(CORBA::ORB_ptr orb, ASSERT(SINGLETON_::IsAlreadyExisting()) ; _NS->init_orb( _orb ) ; - //_myFilterI = 0; _FILTERGen = this; } @@ -92,5 +92,593 @@ Filter_Gen_i:: Filter_Gen_i(CORBA::ORB_ptr orb, Filter_Gen_i::~Filter_Gen_i() { MESSAGE("Filter_Gen_i::~Filter_Gen_i"); + + // destruction of gradient field + if(_myGradient) + delete _myGradient; + + // destruction of support of reference field: reference field is destroyed + // by destruction of med object + if(_myIField) + delete _myIField->getSupport(); + if(_myDField) + delete _myDField->getSupport(); + + // destruction of criteria: support and field + if(_criteria){ + delete _criteria->getSupport(); + delete _criteria; + } + + if(_med) + delete _med; +} + +void Filter_Gen_i::loadMED(const char* inMedFile) +{ + SCRUTE(inMedFile); + _file = inMedFile; + _med = new ::MED(MED_DRIVER,_file); +} + +void Filter_Gen_i::unloadMED() +{ + MESSAGE("unloadMED called"); + // destruction of gradient field + if(_myGradient){ + delete _myGradient; + _myGradient=NULL; + } + + // destruction of support of reference field: reference field is destroyed + // by destruction of med object + if(_myIField){ + delete _myIField->getSupport(); + _myIField=NULL; + } + if(_myDField){ + delete _myDField->getSupport(); + _myDField=NULL; + } + + // destruction of criteria: support and field + if(_criteria){ + delete _criteria->getSupport(); + delete _criteria; + _criteria=NULL; + } + + if(_med){ + delete _med; + _med=NULL; + } +} + +StrSeq* Filter_Gen_i::getMeshNames() +{ + StrSeq *seq = new StrSeq(); + deque deq = _med->getMeshNames(); + seq->length(deq.size()); + for(int i=0;i deq = _med->getFieldNames(); + seq->length(deq.size()); + for(int i=0;igetMesh(meshName)->getMeshDimension(); +} + +DTITSeq* Filter_Gen_i::getFieldIteration(const char* fieldName) +{ + DTITSeq *seq = new DTITSeq(); + deque deq = _med->getFieldIteration(fieldName); + seq->length(deq.size()); + for(int i=0;igetField(fieldName,dt,it)->getSupport()->getMesh()->getName().c_str()); +} + +void Filter_Gen_i::readReferenceField(const char* meshName, const char* fieldName, CORBA::Long ts) +{ + // read of input mesh + _mesh = _med->getMesh(meshName); + _mesh->read(); + + // read of input field + deque myIteration = _med->getFieldIteration (fieldName); + MEDMEM::FIELD_* field = _med->getField(fieldName,myIteration[ts].dt,myIteration[ts].it); + if (dynamic_cast*>(field)){ + _myDField = (MEDMEM::FIELD*)field; + _myDField->read(); + _myIField = NULL; + } + else{ + _myIField = (MEDMEM::FIELD*)field; + _myIField->read(); + _myDField = NULL; + } +} + +void Filter_Gen_i::buildGradient() throw(SALOME_FILTER::FILTER_Gen::FilterError) +{ + if(!_myGradient){ + FIELD * gradient; + try{ + if(_myDField) + gradient = _myDField->buildGradient(); + else + gradient = _myIField->buildGradient(); + _myGradient = gradient->buildNorm2Field(); + delete gradient; + } + catch(MEDEXCEPTION& Mex){ + MESSAGE("SALOME_Exception: Can't calculate gradient"); + throw SALOME_FILTER::FILTER_Gen::FilterError("Can't calculate gradient"); + } + } +} + +void Filter_Gen_i::getMinMax(CORBA::Double& imin, CORBA::Double& imax,ref_func rf) +{ + double min, max; + + switch(rf){ + case F_FIELD: + if (_myDField) + _myDField->getMinMax(min,max); + else{ + int xmin, xmax; + _myIField->getMinMax(xmin,xmax); + min = (double)xmin; + max = (double)xmax; + } + break; + case F_GRAD: + _myGradient->getMinMax(min,max); + break; + } + imin = min; + imax = max; +} + +LongSeq* Filter_Gen_i::getHistogram(CORBA::Long size,ref_func rf) +{ + int mysize = size; + vector myh; + + switch(rf){ + case F_FIELD: + if (_myDField) + myh = _myDField->getHistogram(mysize); + else + myh = _myIField->getHistogram(mysize); + break; + case F_GRAD: + myh = _myGradient->getHistogram(mysize); + break; + } + + LongSeq *seq = new LongSeq(); + seq->length(myh.size()); + for(int i=0;i *volume; + set listElements; + set ::iterator elemIt ; + + if(_myDField) + typ = _myDField->getSupport()->getEntity(); + else + typ = _myIField->getSupport()->getEntity(); + + // create support on nodes + SUPPORT *sup = new SUPPORT(_mesh,"Support",MED_NODE); + + // create integer field on nodes + _criteria = new FIELD(sup,1); + + _criteria->setName("Criteria"); + + // read number of nodes + int NumberOf = sup->getNumberOfElements(MED_ALL_ELEMENTS); + + // if reference field is on elements get reference field on nodes + switch(typ){ + case MED_CELL: + if(_myDField){ + // calculate reverse connectivity to have the list of elements which contains node i + revC = _myDField->getSupport()->getMesh()->getReverseConnectivity(MED_NODAL,typ); + indC = _myDField->getSupport()->getMesh()->getReverseConnectivityIndex(MED_NODAL,typ); + // calculate volume field on mesh + volume = _myDField->getSupport()->getMesh()->getVolume(_myDField->getSupport()); + } + else{ + // calculate reverse connectivity to have the list of elements which contains node i + revC = _myIField->getSupport()->getMesh()->getReverseConnectivity(MED_NODAL,typ); + indC = _myIField->getSupport()->getMesh()->getReverseConnectivityIndex(MED_NODAL,typ); + // calculate volume field on mesh + volume = _myIField->getSupport()->getMesh()->getVolume(_myIField->getSupport()); + } + break; + default: + break; + } + + for (int i=1; igetValueIJ(elem,1); + if( vol != 0. ){ + sigmaV += 1./vol; + if(_myDField) + val += _myDField->getValueIJ(elem,1)/vol; + else + val += ((double)_myIField->getValueIJ(elem,1))/vol; + } + } + val /= sigmaV; + break; + case MED_FACE: + throw SALOME_FILTER::FILTER_Gen::FilterError("Filter doesn't run on reference field on faces"); + break; + case MED_EDGE: + throw SALOME_FILTER::FILTER_Gen::FilterError("Filter doesn't run on reference field on edges"); + break; + case MED_NODE: + // read reference field value + if(_myDField) + val = _myDField->getValueIJ(i,1); + else + val = (double)_myIField->getValueIJ(i,1); + break; + case MED_ALL_ENTITIES: + throw SALOME_FILTER::FILTER_Gen::FilterError("Filter doesn't run on reference field on all entities"); + break; + } + + // set criteria field value + if( nbthresh == 1 ){ + if( areaFlag ) + if( val >= fthresh ) isGVal = true; + else isGVal = false; + else + if( val <= fthresh ) isGVal = true; + else isGVal = false; + } + else{ + min = fthresh; + max = sthresh; + if(sthresh < fthresh){ + min = sthresh; + max = fthresh; + } + if( areaFlag ) + if( (val <= min) || (val >= max) ) isGVal = true; + else isGVal = false; + else + if( (val >= min) && (val <= max) ) isGVal = true; + else isGVal = false; + } + if( isGVal ) + _criteria->setValueIJ(i,1,1); + else + _criteria->setValueIJ(i,1,0); + } +} + +void Filter_Gen_i::createEnsightInputFiles() +{ + int id; + + MESSAGE("Calculate boundary"); + // generate MED boundary of geometry + SUPPORT *supB = _mesh->getBoundaryElements(MED_FACE); + + // 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); + myMeshDriver.addSupport(supB); + id=_mesh->addDriver(myMeshDriver); + _mesh->write(id); + + MESSAGE("Create ensight field"); + ENSIGHT_FIELD_DRIVER myFieldDriver("/tmp/input.data",_criteria); + id=_criteria->addDriver(myFieldDriver); + _criteria->write(id); +} + +void Filter_Gen_i::filtering() +{ + string command; + + MESSAGE("call filtoo"); + // send filtoo command + command = "cd /tmp;filtoo -f input -o output > /tmp/filter.log"; + MESSAGE(command); + system(command.c_str()); + + // destroy filtoo input files +// command = "cd /tmp;rm -f input.*"; +// MESSAGE(command); +// system(command.c_str()); + +} + +void Filter_Gen_i::projectFieldsOnDecimateMesh() throw(SALOME_FILTER::FILTER_Gen::FilterError) +{ + 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(); + + // destroy filtoo output files +// command = "cd /tmp;rm -f output.*"; +// MESSAGE(command); +// system(command.c_str()); + + // get new mesh name + 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]); + + // create support on nodes on all new mesh + SUPPORT *newSup = new SUPPORT(_newMesh,"Support",MED_NODE); + + // read the id of nodes of output mesh, in input mesh + readMapping(); + + // read connectivity of new mesh to get neighbour node of created node + _connL = _newMesh->getConnectivityLength(MED_FULL_INTERLACE,MED_NODAL,MED_CELL,MED_ALL_ELEMENTS); + _conn = _newMesh->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,MED_CELL,MED_ALL_ELEMENTS); + _connI = _newMesh->getConnectivityIndex(MED_NODAL,MED_CELL); + + // read number of nodes on new mesh + int numberOfNodes = newSup->getNumberOfElements(MED_ALL_ELEMENTS); + int numberOfComponents; + + deque fieldsNames = _med->getFieldNames(); + int numberOfFields = fieldsNames.size(); + + try{ + + // loop on fields + for (int i=0; igetName().c_str(),fieldsNames[i].c_str()) == 0) + isReferenceField = true; + } + else + if( strcmp(_myIField->getName().c_str(),fieldsNames[i].c_str()) == 0) + isReferenceField = true; + + deque myIteration = _med->getFieldIteration (fieldsNames[i]); + string meshName = _med->getField(fieldsNames[i],myIteration[0].dt,myIteration[0].it)->getSupport()->getMesh()->getName(); + + // we process only fields on input mesh + if( strcmp(meshName.c_str(),_mesh->getName().c_str()) == 0){ + + // loop on time steps + int numberOfIteration = myIteration.size(); + for(int j=0;jgetField(fieldsNames[i],myIteration[j].dt,myIteration[j].it); + FIELD *myDField = NULL; + FIELD *newDField = NULL; + FIELD *myIField = NULL; + FIELD *newIField = NULL; + + if (dynamic_cast*>(field)){ + if(!isReferenceField) + // read input field on input file + myDField = new FIELD(MEDMEM::MED_DRIVER,_file,fieldsNames[i],myIteration[j].dt,myIteration[j].it); + else + myDField = _myDField; + // create new output field + newDField = new FIELD(newSup,field->getNumberOfComponents()); + newDField->setName(myDField->getName()); + } + else{ + if(!isReferenceField) + // read input field on input file + myIField = new FIELD(MEDMEM::MED_DRIVER,_file,fieldsNames[i],myIteration[j].dt,myIteration[j].it); + else + myIField = _myIField; + // create new output field + newIField = new FIELD(newSup,field->getNumberOfComponents()); + newIField->setName(myIField->getName()); + } + + // loop on nodes on new field + for (int k=1; kgetValueIJ(l,c); + else + ival = myIField->getValueIJ(l,c); + + // write value on new field + if(newDField) + newDField->setValueIJ(k,c,dval); + else + newIField->setValueIJ(k,c,ival); + } + + } + if(newDField) + _newMed.addField(newDField); + else + _newMed.addField(newIField); + + // Destroy input field if not referecne field + if(!isReferenceField) + if(myDField){ + delete myDField->getSupport(); + delete myDField; + } + else{ + delete myIField->getSupport(); + delete myIField; + } + + } + } + } + } + catch(SALOME_Exception){ + throw SALOME_FILTER::FILTER_Gen::FilterError("Unvalid decimate mlesh created by filtoo"); + } +} + +void Filter_Gen_i::readMapping() +{ + ifstream mapFile("/tmp/output.renum"); + + // read number of vertices to map + mapFile >> _nbvmap; + _map = new int[_nbvmap]; + + for(int i=0;i<_nbvmap;i++) + mapFile >> _map[i]; + +} + +int Filter_Gen_i::getNodeNumber(int num) +{ + int oldnum = _map[num]; + + // if new node get neighbour node + if(oldnum == 0) + oldnum = _map[getNeighbourVertex(num)]; + + return oldnum; } +int Filter_Gen_i::getNeighbourVertex(int num) throw(SALOME_Exception) +{ + int nnum; + int numberOfElements = _newMesh->getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS); + + int index; + // get index of created node in connectivity array + for(index=0;index<_connL;index++){ + if(_conn[index] == num){ + + // get index of element which contain created node + int i; + for(i=1;i<=numberOfElements;i++) + if(_connI[i] > index) + break; + + // search neighbour node which are in old mesh + for(int j=_connI[i-1];j<_connI[i];j++){ + nnum = _conn[j-1]; + if( _map[nnum] != 0) + break; + } + + // if neighbour node in old mesh: go out loop, else continue + if(_map[nnum]!=0) + break; + } + } + + // if no neighbour node in old mesh: throw exception + if(_map[nnum]==0) + throw SALOME_Exception("None of the neighbour node are in old mesh!!"); + + return nnum; +} + +void Filter_Gen_i::createMedOutputFile(const char *outMedFile) +{ + int id; + + MESSAGE("Create ensight mesh"); + id = _newMed->addDriver(MED_DRIVER,outMedFile); + _newMed->write(id); +} + + +//============================================================================= +/*! + * C factory, accessible with dlsym, after dlopen + */ +//============================================================================= + +extern "C" +{ + PortableServer::ObjectId * FILTEREngine_factory( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName) + { + MESSAGE("PortableServer::ObjectId * FilterEngine_factory()"); + SCRUTE(interfaceName); + Filter_Gen_i * myFilter_Gen + = new Filter_Gen_i(orb, poa, contId, instanceName, interfaceName); + return myFilter_Gen->getId() ; + } +} diff --git a/src/FILTER/Filter_Gen_i.hxx b/src/FILTER/Filter_Gen_i.hxx index 5320529..7d24408 100644 --- a/src/FILTER/Filter_Gen_i.hxx +++ b/src/FILTER/Filter_Gen_i.hxx @@ -32,19 +32,18 @@ #include #include #include CORBA_SERVER_HEADER(FILTER_Gen) -#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) + +#include "utilities.h" +#include "MEDMEM_Med.hxx" +#include "Utils_SALOME_Exception.hxx" #include "SALOME_Component_i.hxx" #include "SALOME_NamingService.hxx" -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - class Filter_Gen_i: public POA_SALOME_FILTER::FILTER_Gen, public Engines_Component_i { -private: - public: Filter_Gen_i(); Filter_Gen_i(CORBA::ORB_ptr orb, @@ -54,13 +53,54 @@ public: const char *interfaceName); virtual ~Filter_Gen_i(); + void loadMED(const char* inMedFile); + void unloadMED(); + SALOME_FILTER::StrSeq* getMeshNames(); + SALOME_FILTER::StrSeq* getFieldNames(); + CORBA::Long getMeshDimension(const char* meshName); + SALOME_FILTER::DTITSeq* getFieldIteration(const char* fieldName); + char* getMeshName(const char* fieldName,CORBA::Long dt,CORBA::Long it); + void readReferenceField(const char* meshName, const char* fieldName, CORBA::Long ts); + 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 createEnsightInputFiles(); + void filtering(); + void projectFieldsOnDecimateMesh() throw(SALOME_FILTER::FILTER_Gen::FilterError); + void createMedOutputFile(const char* outMedFile); private : + void readMapping(); + int getNodeNumber(int); + int getNeighbourVertex(int) throw(SALOME_Exception); + static Filter_Gen_i* _FILTERGen; // Point to last created instance of the class - private: bool _duringLoad; SALOME_NamingService *_NS; + + int _nbvmap; + int *_map; + int _connL; + const int *_conn; + const int *_connI; + string _file; + + ::MEDMEM::MED *_med, *_newMed; + MESH* _mesh, *_newMesh; + FIELD * _myGradient; + FIELD * _myDField; + FIELD * _myIField; + FIELD *_criteria; + }; +extern "C" + PortableServer::ObjectId * FilterMEDEngine_factory( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + PortableServer::ObjectId * contId, + const char *instanceName, + const char *interfaceName); #endif diff --git a/src/FILTER/Makefile.in b/src/FILTER/Makefile.in index b23d0af..42a8f11 100644 --- a/src/FILTER/Makefile.in +++ b/src/FILTER/Makefile.in @@ -56,10 +56,11 @@ LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome # additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) ${KERNEL_CXXFLAGS} +CPPFLAGS += $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) ${KERNEL_CXXFLAGS} $(MED_CXXFLAGS) CXXFLAGS += $(OCC_CXXFLAGS) ${KERNEL_CXXFLAGS} LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) ${KERNEL_LDFLAGS} \ - -lSalomeContainer -lSalomeHDFPersist -lSalomeDS -lSalomeNS -lRegistry -lOpUtil + -lSalomeContainer -lSalomeHDFPersist -lSalomeDS -lSalomeNS -lRegistry -lOpUtil \ + ${MED_LDFLAGS} -lMEDMEMImpl -lmedmem @CONCLUDE@ diff --git a/src/FILTERGUI/FilterGUI.cxx b/src/FILTERGUI/FilterGUI.cxx index a723e63..5735dcd 100644 --- a/src/FILTERGUI/FilterGUI.cxx +++ b/src/FILTERGUI/FilterGUI.cxx @@ -166,12 +166,32 @@ void FilterGUI::contextMenuPopup( const QString& client, QPopupMenu* menu, QStri } } +//============================================================================= +/*! + * + */ +//============================================================================= +SALOME_FILTER::FILTER_Gen_ptr FilterGUI::InitFilterGen() const +{ + SalomeApp_Application* app = dynamic_cast( application() ); + Engines::Component_var comp = + SALOME_LifeCycleCORBA(app->namingService()).FindOrLoad_Component( "FactoryServer", "FILTER" ); + + MESSAGE("_________________________________________"); + SALOME_FILTER::FILTER_Gen_var clr = SALOME_FILTER::FILTER_Gen::_narrow(comp); + ASSERT(!CORBA::is_nil(clr)); + return clr._retn(); +} + QString FilterGUI::engineIOR() const { -// SALOME_FILTER::MED_Gen_ptr aMedGen = InitMedGen(); -// if ( !CORBA::is_nil( aMedGen) ) -// return QString( getApp()->orb()->object_to_string( aMedGen )); - return QString( "" ); + QString anIOR( "" ); + SALOME_FILTER::FILTER_Gen_ptr aFilterGen = InitFilterGen(); + if ( !CORBA::is_nil( aFilterGen) ){ + CORBA::String_var objStr = getApp()->orb()->object_to_string( aFilterGen ); + anIOR = QString( objStr.in() ); + } + return anIOR; } void FilterGUI::windows( QMap& mappa ) const @@ -292,6 +312,9 @@ bool FilterGUI::OnGUIEvent (int theCommandID) _sel = NULL; } catch ( SALOME_Exception& S_ex ) { + delete _sel; + _sel=NULL; + MESSAGE("Select an input Field in MED file before filtering!!"); QMessageBox::information( application()->desktop(), "Filtering", "Unable to select parameters for filtering.\n" diff --git a/src/FILTERGUI/FilterGUI.h b/src/FILTERGUI/FilterGUI.h index 9ec37d3..6dd8229 100644 --- a/src/FILTERGUI/FilterGUI.h +++ b/src/FILTERGUI/FilterGUI.h @@ -39,6 +39,8 @@ public: virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); + SALOME_FILTER::FILTER_Gen_ptr InitFilterGen() const; + static void setOrb(); void EmitSignalCloseAllDialogs(); diff --git a/src/FILTERGUI/SelectField.cxx b/src/FILTERGUI/SelectField.cxx index a3368a5..942d79d 100644 --- a/src/FILTERGUI/SelectField.cxx +++ b/src/FILTERGUI/SelectField.cxx @@ -33,20 +33,21 @@ SelectField::SelectField(FilterGUI* theModule,const QString& file, : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), myFilterGUI( theModule ), _file(file), - _mesh(0), - _field(0), + _mesh(NULL), + _field(NULL), _ts(0), _dimMesh(-1) { QListViewItem *element; SCRUTE(_file); - _med = new ::MED(MED_DRIVER,_file); - deque meshesNames = _med->getMeshNames(); - int numberOfMeshes = meshesNames.size(); - - deque fieldsNames = _med->getFieldNames(); - int numberOfFields = fieldsNames.size(); + _filter = myFilterGUI->InitFilterGen(); + _filter->loadMED(_file); + SALOME_FILTER::StrSeq* meshesNames = _filter->getMeshNames(); + int numberOfMeshes = (*meshesNames).length(); + + SALOME_FILTER::StrSeq* fieldsNames = _filter->getFieldNames(); + int numberOfFields = (*fieldsNames).length(); QGridLayout* _lay = new QGridLayout( this, 1, 1 ); @@ -83,18 +84,18 @@ SelectField::SelectField(FilterGUI* theModule,const QString& file, _myList->addColumn(tr("FILTER_DIM")); for(int i=0;igetMesh(meshesNames[i])->getMeshDimension(); + _dimMesh = _filter->getMeshDimension((*meshesNames)[i]); char strd[4]; sprintf(strd,"%dD\0",_dimMesh); - element = new QListViewItem( _myList, meshesNames[i], tr("FILTER_MESH") ,strd); + element = new QListViewItem( _myList, QString((*meshesNames)[i]), tr("FILTER_MESH") ,strd); element->setExpandable(true); _myList->setOpen(element,true); for (int j=0; j myIteration = _med->getFieldIteration (fieldsNames[j]); - string meshName = _med->getField(fieldsNames[j],myIteration[0].dt,myIteration[0].it)->getSupport()->getMesh()->getName(); - if( strcmp(meshName.c_str(),meshesNames[i].c_str()) == 0){ - QListViewItem *elem = new QListViewItem( element, fieldsNames[j], tr("FILTER_FIELD") ); + SALOME_FILTER::DTITSeq *myIteration = _filter->getFieldIteration((*fieldsNames)[j]); + string meshName = _filter->getMeshName((*fieldsNames)[j],(*myIteration)[0].dt,(*myIteration)[0].it); + if( strcmp(meshName.c_str(),(*meshesNames)[i]) == 0){ + QListViewItem *elem = new QListViewItem( element, QString((*fieldsNames)[j]), tr("FILTER_FIELD") ); if(_dimMesh != 3) elem->setSelectable(false); } @@ -159,7 +160,7 @@ SelectField::~SelectField() { // no need to delete child widgets, Qt does it all for us cout << "SelectField: destructor called" << endl; - delete _med; + _filter->unloadMED(); } void SelectField::fieldSelected(QListViewItem *lvi) @@ -168,11 +169,12 @@ void SelectField::fieldSelected(QListViewItem *lvi) if( (strcmp(lvi->text(1),"Field") == 0) && (_dimMesh == 3) ){ _field = lvi->text(0); _mesh = lvi->parent()->text(0); - deque myIteration = _med->getFieldIteration (lvi->text(0)); - int numberOfIteration = myIteration.size(); +// deque myIteration = _filterMED->getFieldIteration(lvi->text(0)); + SALOME_FILTER::DTITSeq *myIteration = _filter->getFieldIteration(lvi->text(0)); + int numberOfIteration = (*myIteration).length(); if( numberOfIteration > 1 ){ - _mySlider->setRange(myIteration[0].dt, - myIteration[numberOfIteration-1].dt); + _mySlider->setRange((*myIteration)[0].dt, + (*myIteration)[numberOfIteration-1].dt); _myLab->show(); _mySlider->show(); } diff --git a/src/FILTERGUI/SelectField.h b/src/FILTERGUI/SelectField.h index 2ee4979..7b7ef94 100644 --- a/src/FILTERGUI/SelectField.h +++ b/src/FILTERGUI/SelectField.h @@ -22,13 +22,13 @@ #define SELECTFIELD_HEADER #include "utilities.h" -#include "MEDMEM_Med.hxx" #include "SalomeApp_Application.h" #include #include #include #include "FilterGUI.h" #include "FILTERGUI_Utils.h" +#include CORBA_SERVER_HEADER(FILTER_Gen) #include class QListView; @@ -56,7 +56,7 @@ public: QString getMesh() { return _mesh; } QString getField() { return _field; } int getTimeStep() { return _ts; } - ::MEDMEM::MED * getMED() { return _med; } + SALOME_FILTER::FILTER_Gen_ptr getFilter() {return _filter;} /* current filter object */ FilterGUI* myFilterGUI; /* Current FilterGUI object */ protected: @@ -78,7 +78,7 @@ private: QLabel *_myLab; QSlider *_mySlider; QPushButton* _buttonCancel, * _buttonHelp, * _buttonOk; - ::MEDMEM::MED *_med; + SALOME_FILTER::FILTER_Gen_ptr _filter; }; #endif diff --git a/src/FILTERGUI/SelectParams.cxx b/src/FILTERGUI/SelectParams.cxx index 9f27db0..346a59d 100644 --- a/src/FILTERGUI/SelectParams.cxx +++ b/src/FILTERGUI/SelectParams.cxx @@ -44,12 +44,12 @@ SelectParams::SelectParams(FilterGUI* theModule,SelectField *sel, const char* name, bool modal, WFlags fl) throw(SALOME_Exception) - : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),_size(1024),_sel(sel),_criteria(NULL),_myGradient(NULL) + : QDialog(FILTER::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),_size(1024),_sel(sel) { + MESSAGE("SelectParams constructor"); if(sel){ - // read reference field values - _med = sel->getMED(); + _filter = sel->getFilter(); // Get reference field and time step _inputFile = sel->getFile(); @@ -57,29 +57,10 @@ SelectParams::SelectParams(FilterGUI* theModule,SelectField *sel, _inputField = sel->getField(); _inputTS = sel->getTimeStep(); - // if no reference field selection: throw exception - if( _inputMesh.isNull() || _inputField.isNull() ){ - delete sel; + if( _inputFile.isEmpty() || _inputMesh.isEmpty() || _inputField.isEmpty()) throw SALOME_Exception("Select an input Field in MED file before filtering!!"); - } - - // read of input mesh - _mesh = _med->getMesh(_inputMesh); - _mesh->read(); - - // read of input field - deque myIteration = _med->getFieldIteration (_inputField); - MEDMEM::FIELD_* field = _med->getField(_inputField,myIteration[_inputTS].dt,myIteration[_inputTS].it); - if (dynamic_cast*>(field)){ - _myDField = (MEDMEM::FIELD*)field; - _myDField->read(); - _myIField = NULL; - } - else{ - _myIField = (MEDMEM::FIELD*)field; - _myIField->read(); - _myDField = NULL; - } + + _filter->readReferenceField(_inputMesh,_inputField,_inputTS); // Build QT widgets buildFrame(); @@ -101,25 +82,8 @@ SelectParams::~SelectParams() // destrcution of histogram arrays delete _x; delete _y; - - // destruction of gradient field - if(_myGradient) - delete _myGradient; - - // destruction of support of reference field: reference field is destroyed - // by destruction of med object in _sel destruction - if(_myIField) - delete _myIField->getSupport(); - if(_myDField) - delete _myDField->getSupport(); - - // destruction of criteria: support and field - if(_criteria){ - delete _criteria->getSupport(); - delete _criteria; - } - // destruction of SelectField object and MED object in it + // destruction of SelectField object and Filter object in it delete _sel; } @@ -356,23 +320,18 @@ void SelectParams::buildFrame() void SelectParams::gradSelected() { - if(!_myGradient){ - FIELD * gradient; - try{ - if(_myDField) - gradient = _myDField->buildGradient(); - else - gradient = _myIField->buildGradient(); - _myGradient = gradient->buildNorm2Field(); - delete gradient; - } - catch(MEDEXCEPTION& Mex){ - _myFieldB->setChecked(true); - QMessageBox::information( this, - "Filtering", - "Unable to calculate gradient on vector field.\n" - "You must select a reference scalar field." ); - } + try{ + _filter->buildGradient(); + } + catch(SALOME_FILTER::FILTER_Gen::FilterError){ + _myFieldB->setChecked(true); + QMessageBox::information( this, + "Filtering", + "Unable to calculate gradient on vector field.\n" + "You must select a reference scalar field." ); + } + catch(...){ + MESSAGE("unknownException"); } } @@ -457,27 +416,26 @@ void SelectParams::enterSThresh() void SelectParams::calcHisto() { char strth[128]; - vector myh; + CORBA::Double min, max; + CORBA::Long size = _size; + SALOME_FILTER::LongSeq* histo; if( _myFieldB->isChecked() ){ // calculate histogram values on field - if (_myDField){ - _myDField->getMinMax(_xmin,_xmax); - myh = _myDField->getHistogram(_size); - } - else{ - int xmin, xmax; - _myIField->getMinMax(xmin,xmax); - _xmin = (double)xmin; - _xmax = (double)xmax; - myh = _myIField->getHistogram(_size); - } + _filter->getMinMax(min,max,SALOME_FILTER::F_FIELD); + histo = _filter->getHistogram(size,SALOME_FILTER::F_FIELD); } else{ // calculate histogram values on gradient - _myGradient->getMinMax(_xmin,_xmax); - myh = _myGradient->getHistogram(_size); + _filter->getMinMax(min,max,SALOME_FILTER::F_GRAD); + histo = _filter->getHistogram(size,SALOME_FILTER::F_GRAD); } + _xmin = min; + _xmax = max; + vector myh(_size); + for(int i=0;i<_size;i++) + myh[i] = (*histo)[i]; + if( _myLinear->isChecked() ) _ymin = 0.0; else @@ -630,6 +588,7 @@ void SelectParams::getOutFileName() void SelectParams::process() throw(SALOME_Exception) { + int nbthresh; string command; MESSAGE("Input MED File : "<<_inputFile); @@ -643,9 +602,13 @@ void SelectParams::process() throw(SALOME_Exception) MESSAGE("Generate Criteria"); // generate MED integer field (0 or 1) for filtoo input try{ - generateCriteria(); + if( _myOneThresh->isChecked() ) + nbthresh = 1; + else + nbthresh = 2; + _filter->generateCriteria(nbthresh,_fthresh,_sthresh,_myExt->isChecked()); } - catch ( SALOME_Exception& S_ex ){ + catch (SALOME_FILTER::FILTER_Gen::FilterError){ QMessageBox::information( this, "Filtering", "Unable to process filtering.\n" @@ -654,367 +617,28 @@ void SelectParams::process() throw(SALOME_Exception) return; } - MESSAGE("Calculate boundary"); - // generate MED boundary of geometry - SUPPORT *supB = _mesh->getBoundaryElements(MED_FACE); - - // call ensight driver MED to generate input ensight mesh , - // input ensight boundary mesh and input criteria ensight field for filtoo - MESSAGE("Create ensight mesh"); - int id; - ENSIGHT_MESH_DRIVER myMeshDriver("/tmp/input.geom",_mesh); - myMeshDriver.addSupport(supB); - id=_mesh->addDriver(myMeshDriver); - _mesh->write(id); - MESSAGE("Create ensight field"); - ENSIGHT_FIELD_DRIVER myFieldDriver("/tmp/input.data",_criteria); - id=_criteria->addDriver(myFieldDriver); - _criteria->write(id); - - MESSAGE("call filtoo"); - // send filtoo command - command = "cd /tmp;filtoo -f input -o output > /tmp/filter.log"; - MESSAGE(command); - system(command.c_str()); - - // destroy filtoo input files -// command = "cd /tmp;rm -f input.*"; -// MESSAGE(command); -// system(command.c_str()); - - // have to call ensight driver MED to generate output MED file from filtoo output - MED _newMed(ENSIGHT_DRIVER,"/tmp/output.case"); - _newMed.read(); - - // project input fileds on new mesh - projectFields(); + // create ensight input files to filtoo + _filter->createEnsightInputFiles(); - // destroy filtoo output files -// command = "cd /tmp;rm -f output.*"; -// MESSAGE(command); -// system(command.c_str()); + // call filtoo + _filter->filtering(); + + // project input fields on new mesh + try{ + _filter->projectFieldsOnDecimateMesh(); + } + catch (SALOME_FILTER::FILTER_Gen::FilterError& ex){ + throw SALOME_Exception(ex.error_msg); + } // create new MED file with new mesh and fields - id = _newMed.addDriver(MED_DRIVER,_myOFN->text()); - _newMed.write(id); + _filter->createMedOutputFile(_myOFN->text()); // close the window accept(); } -void SelectParams::projectFields() -{ - - // get new mesh name - deque meshesNames = _newMed->getMeshNames(); - int numberOfMeshes = meshesNames.size(); - if( numberOfMeshes != 1) - throw SALOME_Exception("Unvalid number of meshes in filtoo output"); - - // new mesh generated by filtoo - _newMesh = _newMed->getMesh(meshesNames[0]); - - // create support on nodes on all new mesh - SUPPORT *newSup = new SUPPORT(_newMesh,"Support",MED_NODE); - - // read the id of nodes of output mesh, in input mesh - readMapping(); - - // read connectivity of new mesh to get neighbour node of created node - _connL = _newMesh->getConnectivityLength(MED_FULL_INTERLACE,MED_NODAL,MED_CELL,MED_ALL_ELEMENTS); - _conn = _newMesh->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,MED_CELL,MED_ALL_ELEMENTS); - _connI = _newMesh->getConnectivityIndex(MED_NODAL,MED_CELL); - - // read number of nodes on new mesh - int numberOfNodes = newSup->getNumberOfElements(MED_ALL_ELEMENTS); - int numberOfComponents; - - deque fieldsNames = _med->getFieldNames(); - int numberOfFields = fieldsNames.size(); - - // loop on fields - for (int i=0; igetName().c_str(),fieldsNames[i].c_str()) == 0) - isReferenceField = true; - else - if( strcmp(_myIField->getName().c_str(),fieldsNames[i].c_str()) == 0) - isReferenceField = true; - - deque myIteration = _med->getFieldIteration (fieldsNames[i]); - string meshName = _med->getField(fieldsNames[i],myIteration[0].dt,myIteration[0].it)->getSupport()->getMesh()->getName(); - - // we process only fields on input mesh - if( strcmp(meshName.c_str(),_mesh->getName().c_str()) == 0){ - - // loop on time steps - int numberOfIteration = myIteration.size(); - for(int j=0;jgetField(fieldsNames[i],myIteration[j].dt,myIteration[j].it); - FIELD *myDField = NULL; - FIELD *newDField = NULL; - FIELD *myIField = NULL; - FIELD *newIField = NULL; - - if (dynamic_cast*>(field)){ - if(!isReferenceField) - // read input field on input file - myDField = new FIELD(MEDMEM::MED_DRIVER,_inputFile,fieldsNames[i],myIteration[j].dt,myIteration[j].it); - else - myDField = _myDField; - // create new output field - newDField = new FIELD(newSup,field->getNumberOfComponents()); - newDField->setName(myDField->getName()); - } - else{ - if(!isReferenceField) - // read input field on input file - myIField = new FIELD(MEDMEM::MED_DRIVER,_inputFile,fieldsNames[i],myIteration[j].dt,myIteration[j].it); - else - myIField = _myIField; - // create new output field - newIField = new FIELD(newSup,field->getNumberOfComponents()); - newIField->setName(myIField->getName()); - } - - // loop on nodes on new field - for (int k=1; kgetValueIJ(l,c); - else - ival = myIField->getValueIJ(l,c); - - // write value on new field - if(newDField) - newDField->setValueIJ(k,c,dval); - else - newIField->setValueIJ(k,c,ival); - } - - } - if(newDField) - _newMed->addField(newDField); - else - _newMed->addField(newIField); - - // Destroy input field if not referecne field - if(!isReferenceField) - if(myDField){ - delete myDField->getSupport(); - delete myDField; - } - else{ - delete myIField->getSupport(); - delete myIField; - } - - } - } - } - -} - -void SelectParams::readMapping() -{ - ifstream mapFile("/tmp/output.renum"); - - // read number of vertices to map - mapFile >> _nbvmap; - _map = new int[_nbvmap]; - - for(int i=0;i<_nbvmap;i++) - mapFile >> _map[i]; - -} - -int SelectParams::getNodeNumber(int num) -{ - int oldnum = _map[num]; - - // if new node get neighbour node - if(oldnum == 0) - oldnum = _map[getNeighbourVertex(num)]; - - return oldnum; -} - -int SelectParams::getNeighbourVertex(int num) throw(SALOME_Exception) -{ - int nnum; - int numberOfElements = _newMesh->getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS); - - int index; - // get index of created node in connectivity array - for(index=0;index<_connL;index++){ - if(_conn[index] == num){ - - // get index of element which contain created node - int i; - for(i=1;i<=numberOfElements;i++) - if(_connI[i] > index) - break; - - // search neighbour node which are in old mesh - for(int j=_connI[i-1];j<_connI[i];j++){ - nnum = _conn[j-1]; - if( _map[nnum] != 0) - break; - } - - // if neighbour node in old mesh: go out loop, else continue - if(_map[nnum]!=0) - break; - } - } - - // if no neighbour node in old mesh: throw exception - if(_map[nnum]==0) - throw SALOME_Exception("None of the neighbour node are in old mesh!!"); - - return nnum; -} - -void SelectParams::generateCriteria() throw(SALOME_Exception) -{ - double val, min, max; - double sigmaV; - bool isGVal; - MED_EN::medEntityMesh typ; - const int *revC; - const int *indC; - FIELD *volume; - set listElements; - set ::iterator elemIt ; - - if(_myDField) - typ = _myDField->getSupport()->getEntity(); - else - typ = _myIField->getSupport()->getEntity(); - - // create support on nodes - SUPPORT *sup = new SUPPORT(_mesh,"Support",MED_NODE); - - // create integer field on nodes - _criteria = new FIELD(sup,1); - - _criteria->setName("Criteria"); - - // read number of nodes - int NumberOf = sup->getNumberOfElements(MED_ALL_ELEMENTS); - - // if reference field is on elements get reference field on nodes - switch(typ){ - case MED_CELL: - if(_myDField){ - // calculate reverse connectivity to have the list of elements which contains node i - revC = _myDField->getSupport()->getMesh()->getReverseConnectivity(MED_NODAL,typ); - indC = _myDField->getSupport()->getMesh()->getReverseConnectivityIndex(MED_NODAL,typ); - // calculate volume field on mesh - volume = _myDField->getSupport()->getMesh()->getVolume(_myDField->getSupport()); - } - else{ - // calculate reverse connectivity to have the list of elements which contains node i - revC = _myIField->getSupport()->getMesh()->getReverseConnectivity(MED_NODAL,typ); - indC = _myIField->getSupport()->getMesh()->getReverseConnectivityIndex(MED_NODAL,typ); - // calculate volume field on mesh - volume = _myIField->getSupport()->getMesh()->getVolume(_myIField->getSupport()); - } - break; - default: - break; - } - - for (int i=1; igetValueIJ(elem,1); - if( vol != 0. ){ - sigmaV += 1./vol; - if(_myDField) - val += _myDField->getValueIJ(elem,1)/vol; - else - val += ((double)_myIField->getValueIJ(elem,1))/vol; - } - } - val /= sigmaV; - break; - case MED_FACE: - throw SALOME_Exception("Filter doesn't run on reference field on faces"); - break; - case MED_EDGE: - throw SALOME_Exception("Filter doesn't run on reference field on edges"); - break; - case MED_NODE: - // read reference field value - if(_myDField) - val = _myDField->getValueIJ(i,1); - else - val = (double)_myIField->getValueIJ(i,1); - break; - case MED_ALL_ENTITIES: - throw SALOME_Exception("Filter doesn't run on reference field on all entities"); - break; - } - - // set criteria field value - if( _myOneThresh->isChecked() ){ - if( _myExt->isChecked() ) - if( val >= _fthresh ) isGVal = true; - else isGVal = false; - else - if( val <= _fthresh ) isGVal = true; - else isGVal = false; - } - else{ - min = _fthresh; - max = _sthresh; - if(_sthresh < _fthresh){ - min = _sthresh; - max = _fthresh; - } - if( _myExt->isChecked() ) - if( (val <= min) || (val >= max) ) isGVal = true; - else isGVal = false; - else - if( (val >= min) && (val <= max) ) isGVal = true; - else isGVal = false; - } - if( isGVal ) - _criteria->setValueIJ(i,1,1); - else - _criteria->setValueIJ(i,1,0); - } -} - void SelectParams::calcRateRed() { int i1, i2, i; diff --git a/src/FILTERGUI/SelectParams.h b/src/FILTERGUI/SelectParams.h index 51a3d62..6771b5b 100644 --- a/src/FILTERGUI/SelectParams.h +++ b/src/FILTERGUI/SelectParams.h @@ -22,8 +22,6 @@ #define SELECTPARAMS_HEADER #include "utilities.h" -#include "MEDMEM_Med.hxx" -#include "MEDMEM_Meshing.hxx" #include "SelectField.h" #include @@ -33,7 +31,6 @@ #include #include -/* #include CORBA_CLIENT_HEADER(MED_Gen) */ class QLineEdit; class QLabel; @@ -64,11 +61,6 @@ protected: virtual void displayFThresh(); virtual void displaySThresh(); virtual void enableWidgets(); - virtual void generateCriteria() throw(SALOME_Exception); - virtual void projectFields(); - virtual void readMapping(); - virtual int getNodeNumber(int); - virtual int getNeighbourVertex(int) throw(SALOME_Exception) ; protected slots: virtual void gradSelected(); @@ -92,11 +84,6 @@ private: double _fthresh, _sthresh; double *_x, *_y; double _xft[100], _yft[100], _xst[100], _yst[100]; - int _nbvmap; - int *_map; - int _connL; - const int *_conn; - const int *_connI; QLineEdit *_myLESH, *_myFThresh, *_myExpr, *_myLEST, *_myLEFT, *_myOFN; QButtonGroup *_myHSize, *_myFunc, *_myFScale, *_myNbThresh, *_myArea, *_myVThresh, *_myOutFile; @@ -111,12 +98,7 @@ private: QString _inputFile, _inputMesh, _inputField; int _inputTS; SelectField *_sel; - ::MEDMEM::MED *_med, *_newMed; - MESH* _mesh, *_newMesh; - FIELD * _myGradient; - FIELD * _myDField; - FIELD * _myIField; - FIELD *_criteria; + SALOME_FILTER::FILTER_Gen_ptr _filter; }; #endif -- 2.39.2