* point that aggregate a list of fields that relie on the same mesh
* with the same type (the fields in a timeseries differ by their
* time step).
- *
+ *
* Then you could have a field with no fieldseries associated but
* directly associated to a mesh. That is typically the case of
* fields created by MED operations: if you operate tow fields
typedef sequence<FieldHandler> FieldHandlerList;
typedef sequence<long> FieldIdList;
+ struct InterpolationParameters {
+ double precision;
+ double defaultValue;
+ boolean reverse;
+ string method;
+ string nature;
+ string intersectionType;
+ };
+
interface MEDDataManager: SALOME::GenericObj
{
-
+
//==========================================================
// Datasource management
//==========================================================
//==========================================================
// Mesh data management
//==========================================================
-
+
MeshHandler getMesh(in long meshId) raises (SALOME::SALOME_Exception);
MeshHandlerList getMeshList(in long datasourceId);
void updateFieldMetadata(in long fieldHandlerId,
- in string fieldname,
- in long iteration,
- in long order,
- in string source);
+ in string fieldname,
+ in long iteration,
+ in long order,
+ in string source);
//void saveFields(in FieldHandlerList fieldHandlerList, in string filepath);
void changeUnderlyingMesh(in long fieldHandlerId, in long meshHandlerId)
raises (SALOME::SALOME_Exception);
-
+
+ FieldHandler interpolateField(in long fieldHandlerId, in long meshHandlerId, in InterpolationParameters params)
+ raises (SALOME::SALOME_Exception);
+
//==========================================================
// General purpose data management
//==========================================================
${KERNEL_SalomeKernelHelpers}
${KERNEL_SalomeLifeCycleCORBA}
${KERNEL_SALOMELocalTrace}
- ${KERNEL_SALOMEBasics}
+ ${KERNEL_SALOMEBasics}
${KERNEL_SalomeGenericObj}
medcoupling
+ medcouplingremapper
interpkernel
${MEDFILE_C_LIBRARIES}
${HDF5_LIBRARIES}
${PLATFORM_LIBRARIES}
)
-# This undefines the macros MIN and MAX which are specified in the windows headers
+# This undefines the macros MIN and MAX which are specified in the windows headers
IF(WIN32)
SET(COMMON_FLAGS "${COMMON_FLAGS} -DNOMINMAX")
ENDIF(WIN32)
*/
MEDOP::DatasourceHandler * MEDDataManager_i::addDatasource(const char *filepath) {
- // We first check that this datasource is not already registered
+ // We first check that this datasource is not already registered
long sourceid = getDatasourceId(filepath);
if ( sourceid != LONG_UNDEFINED ) {
// The file is already registered under the identifier sourceid
for (int iField = 0; iField < nbOfFields; iField++) {
const char * fieldName = fieldNames[iField].c_str();
LOG("-- name of field " << iField << " = " << fieldName);
-
+
// A field name could identify several MEDCoupling fields, that
// differ by their spatial discretization on the mesh (values on
// cells, values on nodes, ...). This spatial discretization is
}
}
}
-
+
return new MEDOP::DatasourceHandler(*datasourceHandler);
}
long MEDDataManager_i::getDatasourceId(const char *filepath) {
std::string uri(file_to_source(filepath));
- DatasourceHandlerMapIterator it = _datasourceHandlerMap.begin();
+ DatasourceHandlerMapIterator it = _datasourceHandlerMap.begin();
while ( it != _datasourceHandlerMap.end() ) {
if ( strcmp(it->second->uri,uri.c_str()) == 0 ) {
return it->first;
/*!
* A fieldseries is a timeseries of fields. Then the list of fields is
- * the different time iterations defined for the specified field id.
+ * the different time iterations defined for the specified field id.
*/
MEDOP::FieldHandlerList * MEDDataManager_i::getFieldListInFieldseries(CORBA::Long fieldseriesId) {
if ( fieldIdList.length() == 0 ) {
throw KERNEL::createSalomeException("No fields to save");
}
-
+
// Consider the first field to initiate the med file
CORBA::Long fieldHandlerId = fieldIdList[0];
MEDOP::FieldHandler * fieldHandler = getFieldHandler(fieldHandlerId);
- MEDCouplingFieldDouble* fieldDouble = getFieldDouble(fieldHandler);
+ MEDCouplingFieldDouble* fieldDouble = getFieldDouble(fieldHandler);
try {
bool writeFromScratch = true;
MEDLoader::WriteField(filepath, fieldDouble, writeFromScratch);
-
+
writeFromScratch = false;
for(CORBA::ULong i=1; i<fieldIdList.length(); i++) {
fieldHandlerId = fieldIdList[i];
fieldHandler = getFieldHandler(fieldHandlerId);
- fieldDouble = getFieldDouble(fieldHandler);
+ fieldDouble = getFieldDouble(fieldHandler);
MEDLoader::WriteField(filepath, fieldDouble, writeFromScratch);
}
}
catch (INTERP_KERNEL::Exception &ex) {
- std::string message =
+ std::string message =
std::string("Error when saving file ") +
std::string(filepath) + std::string(" : ") + ex.what();
throw KERNEL::createSalomeException(message.c_str());
}
catch (const std::exception& ex) {
- std::string message =
+ std::string message =
std::string("Error when saving file ") +
std::string(filepath) + std::string(" : ") + ex.what();
throw KERNEL::createSalomeException(message.c_str());
listId.push_back(mapIt->first);
}
}
-
+
MEDOP::FieldIdList fieldIdList;
fieldIdList.length(listId.size());
for (int i=0; i<listId.size(); i++) {
fieldIdList[i] = CORBA::Long(listId[i]);
}
-
+
try {
this->saveFields(filepath, fieldIdList);
- }
+ }
catch (const SALOME::SALOME_Exception & ex) {
throw ex;
}
catch (const std::exception& ex) {
- std::string message =
+ std::string message =
std::string("Error when saving file ") +
std::string(filepath) + std::string(" : ") + ex.what();
throw KERNEL::createSalomeException(message.c_str());
myMesh = _meshMap[meshHandlerId];
} else {
// The mesh is not loaded yet ==> load it and register it in the map
- LOG("getUMesh: the mesh must be loaded. meshid="<<meshHandlerId);
+ LOG("getUMesh: the mesh must be loaded. meshid="<<meshHandlerId);
if ( _meshHandlerMap[meshHandlerId] == NULL ) {
- std::string message =
+ std::string message =
std::string("No mesh for id=") + ToString(meshHandlerId);
LOG("getUMesh: "<<message);
throw KERNEL::createSalomeException(message.c_str());
}
long sourceid = _meshHandlerMap[meshHandlerId]->sourceid;
- std::string filepath(source_to_file((_datasourceHandlerMap[sourceid])->uri));
+ std::string filepath(source_to_file((_datasourceHandlerMap[sourceid])->uri));
const char * meshName = _meshHandlerMap[meshHandlerId]->name;
int meshDimRelToMax = 0;
myMesh = MEDLoader::ReadUMeshFromFile(filepath,meshName,meshDimRelToMax);
*/
long MEDDataManager_i::getUMeshId(const MEDCouplingMesh * mesh) {
bool found = false;
- MeshMapIterator it = _meshMap.begin();
+ MeshMapIterator it = _meshMap.begin();
while ( it != _meshMap.end() ) {
found = (it->second == mesh);
if (found) {
// variables are updated by this function call. This is the mean to
// retrieve the iteration and order of the field.
double timestamp = fieldDouble->getTime(iteration, order);
-
+
// For the fields that are created in memory (by operations for
// example), the convention for the source attribute is to specify
// the fielddouble name, because this name describes the operation
else {
fieldHandler->meshid = meshHandlerId;
}
-
+
_fieldHandlerMap[fieldHandler->id] = fieldHandler;
_fieldDoubleMap[fieldHandler->id] = fieldDouble;
// >>> WARNING: CORBA structure assignement specification ==> return
// >>> a deep copy to avoid the destruction of the fieldHandler
// >>> registered in the map (assignement acts as a destructor for
- // >>> CORBA struct).
+ // >>> CORBA struct).
return new MEDOP::FieldHandler(*fieldHandler);
}
* new mesh is not identical to the old one.
*/
void MEDDataManager_i::changeUnderlyingMesh(CORBA::Long fieldHandlerId, CORBA::Long meshHandlerId) {
-
+
MEDOP::FieldHandler * fieldHandler = getFieldHandler(fieldHandlerId);
MEDCouplingFieldDouble* fieldDouble = getFieldDouble(fieldHandler);
MEDCouplingMesh * newMesh = getUMesh(meshHandlerId);
// synchronized
}
+INTERP_KERNEL::IntersectionType MEDDataManager_i::_getIntersectionType(const char* intersType) {
+ std::string type(intersType);
+ if (type == "Triangulation") {
+ return INTERP_KERNEL::Triangulation;
+ }
+ else if (type == "Convex") {
+ return INTERP_KERNEL::Convex;
+ }
+ else if (type == "Geometric2D") {
+ return INTERP_KERNEL::Geometric2D;
+ }
+ else if (type == "PointLocator") {
+ return INTERP_KERNEL::PointLocator;
+ }
+ else if (type == "Barycentric") {
+ return INTERP_KERNEL::Barycentric;
+ }
+ else if (type == "BarycentricGeo2D") {
+ return INTERP_KERNEL::BarycentricGeo2D;
+ }
+
+ std::string message("Error when trying to interpolate field: ");
+ message.append("Unrecognized intersection type: ");
+ message.append(type);
+ throw KERNEL::createSalomeException(message.c_str());
+}
+
+ParaMEDMEM::NatureOfField MEDDataManager_i::_getNatureOfField(const char* fieldNature) {
+ std::string nature(fieldNature);
+ if (nature == "NoNature") {
+ return NoNature;
+ }
+ else if (nature == "ConservativeVolumic") {
+ return ConservativeVolumic;
+ }
+ else if (nature == "Integral") {
+ return Integral;
+ }
+ else if (nature == "IntegralGlobConstraint") {
+ return IntegralGlobConstraint;
+ }
+ else if (nature == "RevIntegral") {
+ return RevIntegral;
+ }
+
+ std::string message("Error when trying to interpolate field: ");
+ message.append("Unrecognized field nature: ");
+ message.append(nature);
+ throw KERNEL::createSalomeException(message.c_str());
+}
+
+MEDOP::FieldHandler* MEDDataManager_i::interpolateField(CORBA::Long fieldHandlerId, CORBA::Long meshHandlerId, const MEDOP::InterpolationParameters& params) {
+ MEDOP::FieldHandler* fieldHandler = getFieldHandler(fieldHandlerId);
+ MEDCouplingFieldDouble* sourceField = getFieldDouble(fieldHandler);
+ MEDCouplingMesh* sourceMesh = getUMesh(fieldHandler->meshid);
+ MEDCouplingMesh* targetMesh = getUMesh(meshHandlerId);
+
+ double precision = params.precision;
+ INTERP_KERNEL::IntersectionType interpType = this->_getIntersectionType(params.intersectionType);
+ std::string method(params.method);
+ double defaultValue = params.defaultValue;
+ bool reverse = params.reverse;
+ ParaMEDMEM::NatureOfField nature = this->_getNatureOfField(params.nature);
+
+ // 1. Build remapper between sourceMesh and targetMesh (compute interpolation matrix)
+ MEDCouplingRemapper remapper;
+ remapper.setPrecision(precision);
+ remapper.setIntersectionType(interpType);
+ remapper.prepare(sourceMesh, targetMesh, method.c_str());
+
+ // 2. Apply interpolation to the field
+ sourceField->setNature(nature);
+ MEDCouplingFieldDouble* targetField = NULL;
+ if (reverse) {
+ targetField = remapper.reverseTransferField(sourceField, defaultValue);
+ } else {
+ targetField = remapper.transferField(sourceField, defaultValue);
+ }
+ targetField->setMesh(targetMesh);
+ targetField->setName(targetMesh->getName() + "_field");
+
+ // 3. Create and register field handler
+ MEDOP::FieldHandler* fieldResultHandler = this->addField(targetField, this->getUMeshId(targetField->getMesh()));
+ return fieldResultHandler;
+}
+
/*!
* the server side (data in the SALOME container).
*/
void MEDDataManager_i::serverlog() {
-
+
LOG("==== Field Handler Map ====================================================");
LOG("Size = "<<_fieldHandlerMap.size());
FieldHandlerMapIterator fhmIt;
#include CORBA_SERVER_HEADER(MEDDataManager)
#include "SALOME_GenericObj_i.hh"
+#include "MEDCouplingRemapper.hxx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
using namespace ParaMEDMEM;
{
public:
- //
+ //
// ===========================================================
// Functions specified in the IDL interface
// ===========================================================
// -----------------------------------------------------------
// Mesh management
MEDOP::MeshHandlerList * getMeshList(CORBA::Long datasourceId);
- MEDOP::MeshHandler * getMesh(CORBA::Long meshId);
+ MEDOP::MeshHandler * getMesh(CORBA::Long meshId);
// -----------------------------------------------------------
// Field management
const char * source);
void changeUnderlyingMesh(CORBA::Long fieldHandlerId, CORBA::Long meshHandlerId);
+ MEDOP::FieldHandler* interpolateField(CORBA::Long fieldHandlerId, CORBA::Long meshHandlerId, const MEDOP::InterpolationParameters& params);
void setEventListenerIOR(const char * ior);
char * getEventListenerIOR();
void serverlog();
- //
+ //
// ===========================================================
// Other public functions (non available via CORBA)
// ===========================================================
MEDCouplingUMesh * getUMesh(long meshHandlerId);
long getUMeshId(const MEDCouplingMesh * mesh);
+
+ INTERP_KERNEL::IntersectionType _getIntersectionType(const char* intersType);
+ ParaMEDMEM::NatureOfField _getNatureOfField(const char* fieldNature);
+
};
#endif // _MED_DATAMANAGER_I_HXX_
STDLOG("Creating a DatasourceController");
_salomeModule = salomeModule;
_studyEditor = new SALOME_AppStudyEditor(_salomeModule->getApp());
- _dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor);
+ _dlgChangeUnderlyingMesh = new DlgChangeUnderlyingMesh(_studyEditor);
connect(_dlgChangeUnderlyingMesh,SIGNAL(inputValidated()),
this, SLOT(OnChangeUnderlyingMeshInputValidated()));
+ _dlgInterpolateField = new DlgInterpolateField(_studyEditor);
+ connect(_dlgInterpolateField,SIGNAL(inputValidated()),
+ this, SLOT(OnInterpolateFieldInputValidated()));
+
}
DatasourceController::~DatasourceController() {
actionId = _salomeModule->createStandardAction(label,this,SLOT(OnChangeUnderlyingMesh()),icon);
_salomeModule->addActionInPopupMenu(actionId);
+ label = tr("LAB_INTERPOLATE_FIELD");
+ icon = tr("ICO_DATASOURCE_INTERPOLATE_FIELD");
+ actionId = _salomeModule->createStandardAction(label,this,SLOT(OnInterpolateField()),icon);
+ _salomeModule->addActionInPopupMenu(actionId);
+
}
/**
MEDOP::FieldHandler * fieldHandler =
MEDOPFactoryClient::getDataManager()->getFieldHandler(fieldId);
+ if (! fieldHandler) {
+ QMessageBox::warning(_salomeModule->getApp()->desktop(),
+ tr("Operation not allowed"),
+ tr("No field is defined"));
+ return;
+ }
+
QString alias(fieldHandler->fieldname);
DlgAlias dialog;
dialog.setAlias(alias);
}
}
-
void DatasourceController::OnChangeUnderlyingMesh() {
// We need a studyEditor updated on the active study
_studyEditor->updateActiveStudy();
// Tag the item to prevent double import
//_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
+}
+
+void DatasourceController::OnInterpolateField() {
+ // We need a studyEditor updated on the active study
+ _studyEditor->updateActiveStudy();
+
+ // Get the selected objects in the study (SObject). In case of a
+ // multiple selection, we consider only the first item. At least one
+ // item must be selected.
+ SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
+ if ( listOfSObject->size() > 0 ) {
+ SALOMEDS::SObject_var soField = listOfSObject->at(0);
+ int fieldId = _studyEditor->getParameterInt(soField,OBJECT_ID);
+ // _GBO_ : the dialog should not be modal, so that we can choose a
+ // mesh in the browser. Then we have to emit a signal from the
+ // dialog.accept, connected to a slot of the DatasourceControler
+ _dlgInterpolateField->setFieldId(fieldId);
+ Qt::WindowFlags flags = _dlgInterpolateField->windowFlags();
+ _dlgInterpolateField->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
+ _dlgInterpolateField->open();
+ }
+}
+
+void DatasourceController::OnInterpolateFieldInputValidated() {
+ MEDOP::InterpolationParameters params;
+ params.precision = _dlgInterpolateField->getPrecision();
+ STDLOG("precision = " << params.precision);
+ params.defaultValue = _dlgInterpolateField->getDefaultValue();
+ STDLOG("defaultValue = " << params.defaultValue);
+ params.reverse = _dlgInterpolateField->getReverse();
+ STDLOG("reverse = " << params.reverse);
+ params.intersectionType = _dlgInterpolateField->getIntersectionType().c_str();
+ STDLOG("intersectionType = " << params.intersectionType);
+ params.method = _dlgInterpolateField->getMethod().c_str();
+ STDLOG("method = " << params.method);
+ params.nature = _dlgInterpolateField->getFieldNature().c_str();
+ STDLOG("nature = " << params.nature);
+
+ int meshId = _dlgInterpolateField->getMeshId();
+ STDLOG("meshId = " << ToString(meshId));
+ int fieldId = _dlgInterpolateField->getFieldId();
+ MEDOP::FieldHandler* fieldHandler = MEDOPFactoryClient::getDataManager()->getFieldHandler(fieldId);
+
+ // We don't modify the original field but create first a duplicate
+ // MEDOP::FieldHandler* duplicate = MEDOPFactoryClient::getCalculator()->dup(*fieldHandler);
+ //MEDOPFactoryClient::getDataManager()->changeUnderlyingMesh(duplicate->id, meshId);
+ MEDOP::FieldHandler* result = NULL;
+ try {
+ result = MEDOPFactoryClient::getDataManager()->interpolateField(fieldId, meshId, params);
+ }
+ catch(...) {
+ STDLOG("Unable to process field interpolation; please check interpolation parameters");
+ QMessageBox::critical(_salomeModule->getApp()->desktop(),
+ tr("Operation failed"),
+ tr("Unable to process field interpolation; please check interpolation parameters"));
+ return;
+ }
+ // Request once more the duplicate to update the meta-data on this
+ // client side
+ // duplicate = MEDOPFactoryClient::getDataManager()->getFieldHandler(duplicate->id);
+
+ // >>>
+ // WARN: the following is a temporary code for test purpose
+ // Automatically add in ws
+ DatasourceEvent * event = new DatasourceEvent();
+ event->eventtype = DatasourceEvent::EVENT_IMPORT_OBJECT;
+ XmedDataObject * dataObject = new XmedDataObject();
+ dataObject->setFieldHandler(*result);
+ event->objectdata = dataObject;
+ emit datasourceSignal(event);
+ // Note that this signal is processed by the WorkspaceController
+ // // Tag the item to prevent double import
+ // //_studyEditor->setParameterBool(soField,OBJECT_IS_IN_WORKSPACE,true);
}
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// Author : Guillaume Boulant (EDF)
+// Author : Guillaume Boulant (EDF)
#ifndef DATASOURCE_CONTROLLER_H
#define DATASOURCE_CONTROLLER_H
#include "XmedDataModel.hxx"
#include "DlgChangeUnderlyingMesh.hxx"
+#include "DlgInterpolateField.hxx"
#include "MEDOPGUI.hxx"
//
// The DatasourceController defines data structures and classes to
// transmit an object AND an alias.
typedef struct {
enum EventType {
- //
+ //
EVENT_IMPORT_OBJECT, // Simply import the object in the workspace
EVENT_USE_OBJECT, // Import in the workspace AND define a proxy
// variable in the tui console to use it
public slots:
// Callback connected to dialog box validation signals
void OnChangeUnderlyingMeshInputValidated();
+ void OnInterpolateFieldInputValidated();
signals:
void datasourceSignal(const DatasourceEvent * event);
void OnVisualize();
void OnUseInWorkspace();
void OnChangeUnderlyingMesh();
+ void OnInterpolateField();
private:
SALOME_AppStudyEditor * _studyEditor;
DlgChangeUnderlyingMesh * _dlgChangeUnderlyingMesh;
+ DlgInterpolateField * _dlgInterpolateField;
};
<source>ICO_DATASOURCE_CHANGE_MESH</source>
<translation>datasource_changeUnderlyingMesh.png</translation>
</message>
+ <message>
+ <source>ICO_DATASOURCE_INTERPOLATE_FIELD</source>
+ <translation>datasource_interpolateField.png</translation>
+ </message>
<message>
<source>ICO_DATASOURCE_EXPAND_FIELD</source>
<translation>datasource_expandfield.png</translation>
<source>LAB_CHANGE_MESH</source>
<translation>Change underlying mesh</translation>
</message>
+ <message>
+ <location filename="MEDOP/gui/DatasourceController.cxx" line="113"/>
+ <source>LAB_INTERPOLATE_FIELD</source>
+ <translation>Interpolate field</translation>
+ </message>
<message>
<location filename="MEDOP/gui/DatasourceController.cxx" line="157"/>
<source>IMPORT_MED_FIELDS</source>
<translation>You must select a mesh in the explorer and clic the button Mesh</translation>
</message>
</context>
+ <context>
+ <name>DlgInterpolateField</name>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="391"/>
+ <source>SELECT_MESH</source>
+ <translation>You must select a mesh in the explorer and clic the button Mesh</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="406"/>
+ <source>TARGET_MESH_GT</source>
+ <translation>Target mesh -></translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="423"/>
+ <source>MSG_EXPLORER</source>
+ <translation>(Explorer provides a view on MED data sources (mesh and fields) referenced in data space)</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="450"/>
+ <source>LABEL_PRECISION</source>
+ <translation>Interpolator precision</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="493"/>
+ <source>LABEL_INTERSECTION_TYPE</source>
+ <translation>Intersection type</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="520"/>
+ <source>LABEL_METHOD</source>
+ <translation>Interpolation method</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="547"/>
+ <source>LABEL_DEFAULT_VALUE</source>
+ <translation>Default value of resulting field</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="581"/>
+ <source>LABEL_REVERSE</source>
+ <translation>Reverse interpolation ?</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="612"/>
+ <source>LABEL_NATURE</source>
+ <translation>Field nature</translation>
+ </message>
+ </context>
<context>
<name>DlgImageToMed</name>
<message>
<source>LAB_CHANGE_MESH</source>
<translation>Changer le maillage sous-jacent</translation>
</message>
+ <message>
+ <location filename="MEDOP/gui/DatasourceController.cxx" line="113"/>
+ <source>LAB_INTERPOLATE_FIELD</source>
+ <translation>Interpoler le champ</translation>
+ </message>
<message>
<location filename="MEDOP/gui/DatasourceController.cxx" line="157"/>
<source>IMPORT_MED_FIELDS</source>
<translation>Vous devez sélectionner un maillage dans l'explorateur et cliquer sur le bouton Maillage</translation>
</message>
</context>
+ <context>
+ <name>DlgInterpolateField</name>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="391"/>
+ <source>SELECT_MESH</source>
+ <translation>Vous devez sélectionner un maillage dans l'explorateur et cliquer sur le bouton Maillage</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="406"/>
+ <source>TARGET_MESH_GT</source>
+ <translation>Maillage cible -></translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="423"/>
+ <source>MSG_EXPLORER</source>
+ <translation>(L'explorateur fournit une vue des données MED (maillage et champs) référencées dans l'espace des données)</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="450"/>
+ <source>LABEL_PRECISION</source>
+ <translation>Précision de l'interpolateur</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="493"/>
+ <source>LABEL_INTERSECTION_TYPE</source>
+ <translation>Type d'intersection</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="520"/>
+ <source>LABEL_METHOD</source>
+ <translation>Méthode d'interpolation</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="547"/>
+ <source>LABEL_DEFAULT_VALUE</source>
+ <translation>Valeur par défaut du champ résultant</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="581"/>
+ <source>LABEL_REVERSE</source>
+ <translation>Interpolation inverse ?</translation>
+ </message>
+ <message>
+ <location filename="MEDOP/gui/dialogs/DlgInterpolateField.ui" line="612"/>
+ <source>LABEL_NATURE</source>
+ <translation>Nature du champ</translation>
+ </message>
+ </context>
<context>
<name>DlgImageToMed</name>
<message>
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// Author : Guillaume Boulant (EDF)
+// Author : Guillaume Boulant (EDF)
#include "XmedConsoleDriver.hxx"
#include "Utils_SALOME_Exception.hxx"
* instructions are sent once.
*/
void XmedConsoleDriver::setup() {
-
+
if ( !_importXmedDone ) {
QStringList commands;
// First import xmed to initialize the main objects, in particular
// A last one to clear the console screen
//commands+="wipe";
+ // start PVServer and show render view
+ commands+="import pvsimple as pvs";
+ commands+="";
+ //commands+="pvs.ShowParaviewView()";
+
this->exec(commands);
_importXmedDone = true;
}
DlgAlias.ui
DlgUseInWorkspace.ui
DlgChangeUnderlyingMesh.ui
+ DlgInterpolateField.ui
DlgImageToMed.ui
)
QT4_WRAP_UI(MEDOPGUI_dialogs_FORMS_HEADERS ${MEDOPGUI_dialogs_FORMS})
DlgAlias.hxx
DlgUseInWorkspace.hxx
DlgChangeUnderlyingMesh.hxx
+ DlgInterpolateField.hxx
DlgImageToMed.hxx
)
QT4_WRAP_CPP(MEDOPGUI_dialogs_HEADERS_MOC ${MEDOPGUI_dialogs_FILES})
DlgAlias.cxx
DlgUseInWorkspace.cxx
DlgChangeUnderlyingMesh.cxx
+ DlgInterpolateField.cxx
DlgImageToMed.cxx
)
ADD_LIBRARY(MEDOPGUI_dialogs SHARED ${MEDOPGUI_dialogs_SOURCES} ${MEDOPGUI_dialogs_HEADERS_MOC} ${MEDOPGUI_dialogs_FORMS_HEADERS})
-TARGET_LINK_LIBRARIES(MEDOPGUI_dialogs ${CAS_KERNEL} ${QT_LIBRARIES} ${KERNEL_SalomeIDLKernel}
- ${GUI_SalomeGuiHelpers} ${OMNIORB_LIBRARIES} ${GUI_qtx} ${GUI_suit} ${PLATFORM_LIBRARIES}
+TARGET_LINK_LIBRARIES(MEDOPGUI_dialogs ${CAS_KERNEL} ${QT_LIBRARIES} ${KERNEL_SalomeIDLKernel}
+ ${GUI_SalomeGuiHelpers} ${OMNIORB_LIBRARIES} ${GUI_qtx} ${GUI_suit} ${PLATFORM_LIBRARIES}
${KERNEL_SalomeLifeCycleCORBA} ${KERNEL_SalomeKernelHelpers} ${GUI_SalomeGuiHelpers})
INSTALL(TARGETS MEDOPGUI_dialogs DESTINATION ${SALOME_INSTALL_LIBS})
FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
-
<rect>
<x>0</x>
<y>0</y>
- <width>479</width>
- <height>429</height>
+ <width>420</width>
+ <height>350</height>
</rect>
</property>
+ <property name="minimumSize">
+ <size>
+ <width>420</width>
+ <height>350</height>
+ </size>
+ </property>
<property name="windowTitle">
<string>FORM</string>
</property>
--- /dev/null
+#include "DlgInterpolateField.hxx"
+#include "DatasourceConstants.hxx"
+
+#include <QString>
+#include <QMessageBox>
+#include <QDoubleValidator>
+
+DlgInterpolateField::DlgInterpolateField(SALOME_AppStudyEditor * studyEditor,
+ QDialog * parent)
+ : GenericDialog(parent)
+{
+ ui.setupUi(this->getPanel());
+ _meshId=-1;
+ _studyEditor = studyEditor;
+
+ QDoubleValidator* precisionValidator = new QDoubleValidator(1e-15, 1e-1, 1, this);
+ precisionValidator->setNotation(QDoubleValidator::ScientificNotation);
+ this->ui.lineEditPrecision->setValidator(precisionValidator);
+ this->ui.lineEditPrecision->setText("1e-12");
+
+ QDoubleValidator* defaultValueValidator = new QDoubleValidator(this);
+ this->ui.lineEditDefaultValue->setValidator(defaultValueValidator);
+ this->ui.lineEditDefaultValue->setText("0");
+
+ QStringList intersectionTypes;
+ intersectionTypes << "Triangulation" << "Convex" << "Geometric2D" << "PointLocator" << "Barycentric" << "BarycentricGeo2D";
+ this->ui.comboBoxIntersType->addItems(intersectionTypes);
+
+ QStringList methods;
+ methods << "P0P0" << "P0P1" << "P1P0" << "P1P1" << "P2P0";
+ this->ui.comboBoxMethod->addItems(methods);
+
+ QStringList natures;
+ natures << "NoNature" << "ConservativeVolumic" << "Integral" << "IntegralGlobConstraint" << "RevIntegral";
+ this->ui.comboBoxNature->addItems(natures);
+
+ connect(this->ui.btnSelectMesh, SIGNAL(clicked()), this, SLOT(OnSelectMesh()));
+ this->setWindowTitle("Field interpolation");
+ this->getPanel()->adjustSize();
+ this->adjustSize();
+}
+
+/** This reset the dialog for a new selection */
+void DlgInterpolateField::setFieldId(int fieldId) {
+ _fieldId = fieldId;
+ _meshId=-1;
+ this->ui.txtMesh->setText(QString(""));
+}
+int DlgInterpolateField::getFieldId() {
+ return _fieldId;
+}
+
+int DlgInterpolateField::getMeshId() {
+ return _meshId;
+}
+
+double DlgInterpolateField::getPrecision() {
+ return this->ui.lineEditPrecision->text().toDouble();
+}
+
+double DlgInterpolateField::getDefaultValue() {
+ return this->ui.lineEditDefaultValue->text().toDouble();
+}
+
+bool DlgInterpolateField::getReverse() {
+ return this->ui.checkBoxReverse->isChecked();
+}
+
+std::string DlgInterpolateField::getIntersectionType() {
+ return this->ui.comboBoxIntersType->currentText().toStdString();
+}
+
+std::string DlgInterpolateField::getMethod() {
+ return this->ui.comboBoxMethod->currentText().toStdString();
+}
+
+std::string DlgInterpolateField::getFieldNature() {
+ return this->ui.comboBoxNature->currentText().toStdString();
+}
+
+void DlgInterpolateField::accept() {
+ if ( _meshId == -1 ) {
+ QMessageBox::warning(this,
+ tr("Data verification"),
+ tr("You must select a mesh in the explorer and clic the button Mesh"));
+ }
+ else {
+ GenericDialog::accept();
+ emit inputValidated();
+ }
+}
+
+void DlgInterpolateField::OnSelectMesh() {
+ SALOME_StudyEditor::SObjectList * listOfSObject = _studyEditor->getSelectedObjects();
+ if ( listOfSObject->size() > 0 ) {
+ SALOMEDS::SObject_var soMesh = listOfSObject->at(0);
+ // _GBO_ TODO: we should test here if it is a mesh (attribute in
+ // the sobject)
+ _meshId = _studyEditor->getParameterInt(soMesh,OBJECT_ID);
+ const char * meshname = _studyEditor->getName(soMesh);
+ this->ui.txtMesh->setText(QString(meshname));
+ }
+
+}
--- /dev/null
+#ifndef _DlgInterpolateField_HXX
+#define _DlgInterpolateField_HXX
+
+#include <QtGui>
+#include "ui_DlgInterpolateField.h"
+#include "GenericDialog.hxx"
+
+#include <SALOME_AppStudyEditor.hxx>
+#include "MEDOPGUIdialogs.hxx"
+
+class MEDOPGUI_DIALOGS_EXPORT DlgInterpolateField : public GenericDialog
+{
+ Q_OBJECT
+
+public:
+ DlgInterpolateField(SALOME_AppStudyEditor * studyEditor, QDialog *parent = 0);
+
+ void setFieldId(int fieldId);
+ int getFieldId();
+ int getMeshId();
+
+ double getPrecision();
+ double getDefaultValue();
+ bool getReverse();
+ std::string getIntersectionType();
+ std::string getMethod();
+ std::string getFieldNature();
+
+signals:
+ void inputValidated();
+
+protected slots:
+ void OnSelectMesh();
+
+ private:
+ void accept();
+ int _meshId;
+
+ SALOME_AppStudyEditor * _studyEditor;
+ int _fieldId;
+
+ Ui_DlgInterpolateField ui; // instance of the class defined in ui_dlgInterpolateField.hxx
+};
+
+
+#endif // _DlgInterpolateField_HXX
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DlgInterpolateField</class>
+ <widget class="QWidget" name="DlgInterpolateField">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>550</width>
+ <height>450</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>550</width>
+ <height>450</height>
+ </size>
+ </property>
+ <property name="windowTitle">
+ <string>FORM</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="lblHelp">
+ <property name="palette">
+ <palette>
+ <active>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </active>
+ <inactive>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </inactive>
+ <disabled>
+ <colorrole role="WindowText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Button">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Light">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Midlight">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Dark">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Mid">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>170</red>
+ <green>170</green>
+ <blue>170</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Text">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="BrightText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="ButtonText">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>127</red>
+ <green>127</green>
+ <blue>127</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Base">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Window">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="Shadow">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>0</red>
+ <green>0</green>
+ <blue>0</blue>
+ </color>
+ </brush>
+ </colorrole>
+ <colorrole role="AlternateBase">
+ <brush brushstyle="SolidPattern">
+ <color alpha="255">
+ <red>255</red>
+ <green>255</green>
+ <blue>255</blue>
+ </color>
+ </brush>
+ </colorrole>
+ </disabled>
+ </palette>
+ </property>
+ <property name="font">
+ <font>
+ <family>Sans Serif</family>
+ <italic>true</italic>
+ </font>
+ </property>
+ <property name="text">
+ <string>SELECT_MESH</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>7</number>
+ </property>
+ <item>
+ <widget class="QPushButton" name="btnSelectMesh">
+ <property name="text">
+ <string>TARGET_MESH_GT</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="txtMesh"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="lblInfo">
+ <property name="font">
+ <font>
+ <italic>true</italic>
+ </font>
+ </property>
+ <property name="text">
+ <string>MSG_EXPLORER</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_7">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>LABEL_PRECISION</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEditPrecision">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>225</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>LABEL_INTERSECTION_TYPE</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBoxIntersType"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>LABEL_METHOD</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBoxMethod"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>LABEL_DEFAULT_VALUE</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEditDefaultValue">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>LABEL_REVERSE</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBoxReverse">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_5">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <item>
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>LABEL_NATURE</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="comboBoxNature"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_6">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
<class>GenericDialog</class>
- <widget class="QDialog" name="GenericDialog" >
- <property name="geometry" >
+ <widget class="QDialog" name="GenericDialog">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
- <height>300</height>
+ <width>260</width>
+ <height>164</height>
</rect>
</property>
- <property name="windowTitle" >
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
<string>DIALOG</string>
</property>
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>9</number>
+ </property>
<item>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
+ <layout class="QVBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>0</number>
+ </property>
<item>
- <widget class="QFrame" name="centralPanel" >
- <property name="frameShape" >
+ <widget class="QFrame" name="centralPanel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
- <property name="frameShadow" >
+ <property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<receiver>GenericDialog</receiver>
<slot>accept()</slot>
<hints>
- <hint type="sourcelabel" >
+ <hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
- <hint type="destinationlabel" >
+ <hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
<receiver>GenericDialog</receiver>
<slot>reject()</slot>
<hints>
- <hint type="sourcelabel" >
+ <hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
- <hint type="destinationlabel" >
+ <hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
SET(MED_RESOURCES_FILES
datasource_add.png
datasource_changeUnderlyingMesh.png
+ datasource_interpolateField.png
datasource_expandfield.png
datasource_field.png
datasource_mesh.png
workspace_save.png
)
INSTALL(FILES ${MED_RESOURCES_FILES} DESTINATION ${SALOME_MED_INSTALL_RES_DATA})
-
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Author : Guillaume Boulant (EDF)
+# Author : Guillaume Boulant (EDF)
import MEDCoupling
__mapTypeOfField2ParavisLabel={
try:
return __mapTypeOfField2ParavisLabel[typeOfField]
except IndexError, e:
- return "UNCKNOWN"
+ return "UNKNOWN"
def pvis_scalarmap(filename,meshname,fieldname,typeOfField,iteration=-1):
"""
load from a med file using the PARAVIS module.
"""
import pvsimple
-
+
reader = pvsimple.MEDReader( FileName=filename )
- # For fiels defined on cells, it seems to be required to specify
- # the type of fields
+
+ representation = pvsimple.Show()
if typeOfField == MEDCoupling.ON_CELLS:
- reader.Groups = ["GROUP/%s/%s/No_Group"%(meshname,pvis_typeOfFieldLabel(typeOfField))]
+ representation.ColorArrayName = ("CELLS", fieldname)
+ data = reader.CellData
+ else:
+ representation.ColorArrayName = ("POINTS", fieldname)
+ data = reader.PointData
+
+ # :TODO: Determine nb components
+ nb_cmp = 1
+ mode = "Magnitude" # "Component" if nb_cmp > 1
- representation = pvsimple.GetDisplayProperties(reader)
- representation.ColorArrayName = fieldname
+ # Get data range (mini/maxi)
+ for n in range(data.GetNumberOfArrays()):
+ if data.GetArray(n).GetName() == fieldname:
+ mini,maxi = data.GetArray(n).GetRange()
- lookupTable = pvsimple.GetLookupTableForArray(
- fieldname, 1, NanColor=[0.25, 0.0, 0.0],
- RGBPoints=[25.0, 0.23, 0.30, 0.754, 245.0, 0.71, 0.016, 0.15],
- VectorMode='Magnitude', ColorSpace='Diverging', ScalarRangeInitialized=1.0 )
- representation.LookupTable = lookupTable
+ stepvalue = (maxi-mini)/100. # 100 steps
+ # Build Lookup table
+ RGBPoints = [mini, 0.0, 0.0, 1.0, maxi, 1.0, 0.0, 0.0]
+ nb = int((maxi-mini)/stepvalue)-1
+ Table = pvsimple.GetLookupTableForArray("", nb_cmp, VectorMode=mode, ColorSpace='HSV')
+ Table.Discretize = 1
+ Table.NumberOfTableValues = nb
+ Table.RGBPoints = RGBPoints
+
+ representation.Representation = 'Surface'
+ representation.LookupTable = Table
+
+ # Build scalar bar
+ scalarbar = pvsimple.CreateScalarBar(LabelFormat = '%.1f',Title= "",LabelFontSize=12,Enabled=1,LookupTable=Table,TitleFontSize=12,LabelColor=[0.0, 0.0, 0.0],TitleColor=[0.0, 0.0, 0.0],)
+ pvsimple.SetActiveSource(reader)
+ pvsimple.GetRenderView().Representations.append(scalarbar)
+ pvsimple.SetActiveSource(reader)
pvsimple.Render()
return True
properties.testFieldName,
properties.testTypeOfField,
properties.testFieldIt)
-
+
if __name__ == "__main__":
TEST_scalarmap()
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Author : Guillaume Boulant (EDF)
+# Author : Guillaume Boulant (EDF)
#
# ===================================================================
import xmed
from xmed.fieldproxy import FieldProxy, newFieldProxy
-
+
# ===================================================================
# Operations on fields
if len(fieldHandlerList) > 0:
status+="(use 'f=get(id)' to get a field in the current context)"
-
+
return status
# For simpler typing, one can create a python command for status
# remote metadata on the engine (MEDCouplingFieldDouble) are
# displayed by the stat command. Otherwise, only the local
# metadata are displayed.
-
+
def __repr__(self):
return status(self.__local, self.__remote)
"""
This function indicates that we want to use the fields from the
specified med file. The fields meta-data are loaded in the engine
- part of the module. To get a fieldproxy on a field, call the get
+ part of the module. To get a fieldproxy on a field, call the get
function with the id of the required field. To display the whole
list of fields loaded in the engine, type 'ls' (la verbose).
"""
xmed.dataManager.addDatasource(filepath)
print status(local=False,remote=True)
-
+
def get(fieldHandlerId):
"""
This return a field proxy on the field identified by the specified
VIEWER_PARAVIS = "PARAVIS"
VIEWER_DEFAULT = VIEWER_PARAVIS
-VIEWER_TMP_FILE = "/tmp/medop_viewer.med"
+import tempfile
def view_using_paravis(aFieldProxy):
+ temp = tempfile.NamedTemporaryFile(prefix="medop_viewer", suffix='.med', delete=False)
+
# __GBO__ TO BE IMPROVED: we used a tmp file in this first step of
# development, but we should used at last a MEDCoupling corba
# object (see how to use the stuff in PARAVIS/src/Plugins)
- xmed.dataManager.saveFields(VIEWER_TMP_FILE, [aFieldProxy.id])
-
+ xmed.dataManager.saveFields(temp.name, [aFieldProxy.id])
+
from xmed.driver_pvis import pvis_scalarmap
- pvis_scalarmap(VIEWER_TMP_FILE,
+ pvis_scalarmap(temp.name,
aFieldProxy.meshname,
aFieldProxy.fieldname,
aFieldProxy.type,
aFieldProxy.iteration)
+ temp.close()
+#
def view_using_visu(aFieldProxy):
+ # No more used
+ raise Exception("view_using_visu: No more used")
+
+ VIEWER_TMP_FILE = "/tmp/medop_viewer.med"
+
# __GBO__ TO BE IMPROVED: we used a tmp file in this first step of
# development, but we should used at last a MEDCoupling corba
# object (see how to use the stuff in PARAVIS/src/Plugins)
iteration)
if result is False:
xmed.err("the field can't be displayed")
-
+
def view(aFieldProxy, using=VIEWER_DEFAULT):
"""
This displays a 3D view of the field using VISU or PARAVIS,
view_using_paravis(aFieldProxy)
else:
view_using_visu(aFieldProxy)
-
+