SET(MED_ROOT_DIR $ENV{MED_ROOT_DIR} CACHE PATH "MED_ROOT_DIR")
INCLUDE(${MED_ROOT_DIR}/adm_local/cmake_files/FindMED.cmake)
-EXECUTE_PROCESS(COMMAND pvpython ${CMAKE_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_INCLUDE_DIRS})
+EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_INCLUDE_DIRS})
SET(SUBDIRS
idl
SALOMEDS::Study_ptr PARAVIS_Gen_i::GetCurrentStudy(){
return myParaVisGen->GetCurrentStudy();
}
+ char* PARAVIS_Gen_i::getVersion()
+ {
+ return myParaVisGen->getVersion();
+ }
}
virtual void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
virtual SALOMEDS::Study_ptr GetCurrentStudy();
+
+ virtual char* getVersion();
};
};
#endif
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
+import sys
+
source = GetActiveSource()
representation = GetDisplayProperties(source)
representation.Visibility = 0
+oldmode = None
+
if source.SMProxy.GetVTKClassName() == 'vtkMedReader' :
+ oldmode = source.AnimationMode
source.AnimationMode = 'Modes'
ExtractSurface1 = ExtractSurface()
WarpByVector1.Vectors = ['POINTS', rootname]
break
+if vectorname == None :
+ source.AnimationMode = oldmode
+ sys.exit(0)
+
ScaleVector1.ScaleFactor = 0
ScaleVector1.UpdatePipeline()
bounds = info.DataInformation.GetBounds()
#include "PARAVIS_Gen_i.hh"
+#include "PARAVIS_version.h"
// IDL Headers
#include <omnithread.h>
return SALOMEDS::Study::_duplicate(myStudyDocument);
}
+ // Version information
+ char* PARAVIS_Gen_i::getVersion()
+ {
+#if PARAVIS_DEVELOPMENT
+ return CORBA::string_dup( PARAVIS_VERSION_STR"dev" );
+#else
+ return CORBA::string_dup( PARAVIS_VERSION_STR );
+#endif
+ }
}
virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
CORBA::Long theObjectID, SALOMEDS::SObject_ptr theObject);
+ //! inherited methods from Engines::EngineComponent. Returns module version.
+ virtual char* getVersion();
+
//! Implementation of PARAVIS_Gen interface
virtual PARAVIS::string_array* GetClassesList();
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_OverrideCursor.h>
+#include <SUIT_ExceptionHandler.h>
// SALOME Includes
#include "SALOME_LifeCycleCORBA.hxx"
#include <pqPipelineSource.h>
#include <pqActiveObjects.h>
#include <vtkProcessModule.h>
+#include <vtkSMSession.h>
+#include <vtkPVProgressHandler.h>
#include <pqParaViewBehaviors.h>
#include <pqHelpReaction.h>
#include <vtkOutputWindow.h>
return aSComponent;
}
+/*!
+ Clean up function; used to stop ParaView progress events when
+ exception is caught by global exception handler.
+*/
+void paravisCleanUp()
+{
+ if ( pqApplicationCore::instance() ) {
+ pqServer* s = pqApplicationCore::instance()->getActiveServer();
+ if ( s ) s->session()->GetProgressHandler()->CleanupPendingProgress();
+ }
+}
+
/*!
\brief Constructor. Sets the default name for the module.
*/
bool PVGUI_Module::activateModule( SUIT_Study* study )
{
myOldMsgHandler = qInstallMsgHandler(ParavisMessageOutput);
+
+ SUIT_ExceptionHandler::addCleanUpRoutine( paravisCleanUp );
bool isDone = SalomeApp_Module::activateModule( study );
if ( !isDone ) return false;
saveDockWidgetsState();
+ SUIT_ExceptionHandler::removeCleanUpRoutine( paravisCleanUp );
+
if (myOldMsgHandler)
qInstallMsgHandler(myOldMsgHandler);
<DataTypeDomain
name="input_type">
<DataType
- value="vtkPointSet" />
+ value="vtkPolyData" />
</DataTypeDomain>
<InputArrayDomain
name="input_array"
#include "vtkCellArray.h"
#include "vtkPointData.h"
#include "vtkCellData.h"
-//#include "vtkDataSetSurfaceFilter.h"
#include <math.h>
int vtkElevationSurfaceFilter::FillInputPortInformation(
int vtkNotUsed(port), vtkInformation* info)
{
- info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPointSet");
+ info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
return 1;
}
int vtkElevationSurfaceFilter::RequestData(vtkInformation *request,
vtkInformationVector **input, vtkInformationVector *output)
{
- vtkPointSet *psIn = vtkPointSet::SafeDownCast(
+ vtkPolyData *pdIn = vtkPolyData::SafeDownCast(
input[0]->GetInformationObject(0)->Get(vtkDataObject::DATA_OBJECT()));
- //vtkPolyData *psIn = vtkPolyData::SafeDownCast(
- // input[0]->GetInformationObject(0)->Get(vtkDataObject::DATA_OBJECT()));
-
- /*vtkSmartPointer<vtkDataSetSurfaceFilter> surfaceFilter = vtkSmartPointer<vtkDataSetSurfaceFilter>::New();
- surfaceFilter->SetInput(psIn);
- vtkPolyData* psIn = vtkPolyData::SafeDownCast(surfaceFilter->GetOutput());*/
-
vtkUnstructuredGrid *usgOut = vtkUnstructuredGrid::SafeDownCast(
output->GetInformationObject(0)->Get(vtkDataObject::DATA_OBJECT()));
vtkDataArray* array = this->GetInputArrayToProcess(0, input);
- if(psIn == NULL || array == NULL || usgOut == NULL
+ if(pdIn == NULL || array == NULL || usgOut == NULL
|| array->GetNumberOfComponents() != 1)
{
vtkDebugMacro("vtkElevationSurfaceFilter no correctly configured");
double dir[3];
if(this->AutoDetectDirection)
{
- this->ComputeDirection(psIn, dir);
+ this->ComputeDirection(pdIn, dir);
}
else
{
dir[1] *= this->GetScaleFactor();
dir[2] *= this->GetScaleFactor();
- usgOut->Allocate(psIn->GetNumberOfCells());
+ usgOut->Allocate(pdIn->GetNumberOfCells());
vtkSmartPointer<vtkPoints> newPts = vtkSmartPointer<vtkPoints>::New();
usgOut->SetPoints(newPts);
- usgOut->GetPointData()->CopyAllocate(psIn->GetPointData(),
- 2*psIn->GetNumberOfPoints());
- usgOut->GetCellData()->CopyAllocate(psIn->GetCellData(),
- psIn->GetNumberOfCells());
+ usgOut->GetPointData()->CopyAllocate(pdIn->GetPointData(),
+ 2*pdIn->GetNumberOfPoints());
+ usgOut->GetCellData()->CopyAllocate(pdIn->GetCellData(),
+ pdIn->GetNumberOfCells());
- vtkIdType ncell = psIn->GetNumberOfCells();
+ vtkIdType ncell = pdIn->GetNumberOfCells();
vtkSmartPointer<vtkIdList> newIds = vtkSmartPointer<vtkIdList>::New();
vtkSmartPointer<vtkIdList> polyhedronIds = vtkSmartPointer<vtkIdList>::New();
- vtkSmartPointer<vtkIdList> neighbors = vtkSmartPointer<vtkIdList>::New();
for(vtkIdType cellId=0; cellId < ncell; cellId++)
{
- vtkCell* cell = psIn->GetCell(cellId);
+ vtkCell* cell = pdIn->GetCell(cellId);
if(cell->GetCellDimension() != 2)
continue;
double coords[VTK_CELL_SIZE*3];
for(int ptid = 0; ptid < oldPtsNumber; ptid++)
{
- psIn->GetPoint(oldIds->GetId(ptid), coords + 3*ptid);
+ pdIn->GetPoint(oldIds->GetId(ptid), coords + 3*ptid);
}
for(int ptid = 0; ptid < oldPtsNumber; ptid++)
{
coords[(ptid+oldPtsNumber)*3+1] = coords[ptid*3+1] + cellScalar*dir[1];
coords[(ptid+oldPtsNumber)*3+2] = coords[ptid*3+2] + cellScalar*dir[2];
}
- double minScalar;
- bool minInitialized = false;
- for(int ptid = 0; ptid < oldPtsNumber; ptid++)
- {
- neighbors->Initialize();
- psIn->GetPointCells(oldIds->GetId(ptid), neighbors);
- for(int neiCellIt = 0; neiCellIt < neighbors->GetNumberOfIds(); neiCellIt++)
- {
- vtkIdType neigCellId = neighbors->GetId(neiCellIt);
- if(neigCellId == cellId)
- continue;
- double neighborScalar = array->GetTuple1(neigCellId);
- if(neighborScalar != 0.0)
- {
- if(!minInitialized)
- minScalar = neighborScalar;
- else
- minScalar = (neighborScalar < minScalar ? neighborScalar : minScalar);
- minInitialized = true;
- }
- }
- if(!minInitialized)
- minScalar = 0.0;
- }
- for(int ptid = 0; ptid < oldPtsNumber; ptid++)
- {
- if(cellScalar != 0)
- {
- coords[(ptid)*3+0] = coords[ptid*3+0] + minScalar*dir[0];
- coords[(ptid)*3+1] = coords[ptid*3+1] + minScalar*dir[1];
- coords[(ptid)*3+2] = coords[ptid*3+2] + minScalar*dir[2];
- }
- else
- {
- coords[(ptid+oldPtsNumber)*3+0] = coords[ptid*3+0] + minScalar*dir[0];
- coords[(ptid+oldPtsNumber)*3+1] = coords[ptid*3+1] + minScalar*dir[1];
- coords[(ptid+oldPtsNumber)*3+2] = coords[ptid*3+2] + minScalar*dir[2];
- }
- }
for(int ptid=0; ptid<newPtsNumber; ptid++)
{
vtkIdType newId = newPts->InsertNextPoint(coords + 3*ptid);
newIds->SetId(ptid, newId);
- usgOut->GetPointData()->CopyData(psIn->GetPointData(),
+ usgOut->GetPointData()->CopyData(pdIn->GetPointData(),
oldIds->GetId(ptid % oldPtsNumber),
newIds->GetId(ptid));
}
}
}
newCellId = usgOut->InsertNextCell(newCellType, newIds);
- usgOut->GetCellData()->CopyData(psIn->GetCellData(),
+ usgOut->GetCellData()->CopyData(pdIn->GetCellData(),
cellId,
newCellId);
}
- usgOut->GetFieldData()->ShallowCopy(psIn->GetFieldData());
+ usgOut->GetFieldData()->ShallowCopy(pdIn->GetFieldData());
usgOut->Squeeze();
return 1;
}
-void vtkElevationSurfaceFilter::ComputeDirection(vtkPointSet* psIn, double *outDir)
+void vtkElevationSurfaceFilter::ComputeDirection(vtkPolyData* pdIn, double *outDir)
{
double tmp[2][3] = {{0, 0, 0}, {0, 0, 0}};
outDir[0] = outDir[1] = outDir[2] = 0;
- vtkPoints* pts = psIn->GetPoints();
+ vtkPoints* pts = pdIn->GetPoints();
vtkSmartPointer<vtkGenericCell> cell = vtkSmartPointer<vtkGenericCell>::New();
- for(vtkIdType cellId = 0; cellId < psIn->GetNumberOfCells(); cellId++)
+ for(vtkIdType cellId = 0; cellId < pdIn->GetNumberOfCells(); cellId++)
{
- psIn->GetCell(cellId, cell);
+ pdIn->GetCell(cellId, cell);
if(cell->GetCellDimension() != 2)
continue;
#include "vtkAlgorithm.h"
-class vtkPointSet;
+class vtkPolyData;
class VTK_EXPORT vtkElevationSurfaceFilter: public vtkAlgorithm
{
vtkInformationVector**,
vtkInformationVector*);
- virtual void ComputeDirection(vtkPointSet*, double *outDir);
+ virtual void ComputeDirection(vtkPolyData*, double *outDir);
double ScaleFactor;
double Direction[3];
/usr/lib
)
-get_filename_component(MED_LIBRARY_DIR ${MED_LIBRARY} PATH)
-
FIND_LIBRARY(MEDC_LIBRARY medC
HINTS
${MED_LIBRARY_DIR}
/usr/lib
)
+get_filename_component(MED_LIBRARY_DIR ${MEDC_LIBRARY} PATH)
+
IF(MED_INCLUDE_DIR)
- IF(MED_LIBRARY)
- IF(MEDC_LIBRARY)
- SET(MED_LIBRARIES ${MED_LIBRARY} ${MEDC_LIBRARY} )
- SET( MED_FOUND "YES" )
- ENDIF(MEDC_LIBRARY)
- ENDIF(MED_LIBRARY)
+ IF(MEDC_LIBRARY)
+ SET(MED_LIBRARIES ${MEDC_LIBRARY} )
+ IF(MED_LIBRARY)
+ SET(MED_LIBRARIES ${MED_LIBRARIES} ${MED_LIBRARY} )
+ ENDIF(MED_LIBRARY)
+ SET( MED_FOUND "YES" )
+ ENDIF(MEDC_LIBRARY)
ENDIF(MED_INCLUDE_DIR)
IF(${MED_FOUND})
"2*y*z*(1-x)",
"2*z*(1-y-z)*(1-x)",
"2*y*(1-y-z)*(1-x)",
- "y*(1-x*x)",
- "z*(1-x*x)",
- "(1-y-z)*(1-x*x)",
"2*y*z*(1+x)",
"2*z*(1-y-z)*(1+x)",
- "2*y*(1-y-z)*(1+x)"};
+ "2*y*(1-y-z)*(1+x)",
+ "y*(1-x*x)",
+ "z*(1-x*x)",
+ "(1-y-z)*(1-x*x)"};
+
// PENTA18
const static int PENTA18_dim = 3;
{0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 13, 14, 9, 10, 11, 15, 16, 17};
static const char* PENTA18_varnames[PENTA18_dim] = {"x", "y", "z"};
static const char* PENTA18_functions[PENTA18_nnode] =
-{"x*y*x−1*2*y−1/2",
- "x*z*x−1*2*z−1/2",
- "x*x−1*zy−1*2*z2*y−1/2",
- "x*y*x1*2*y−1/2",
- "x*z*x1*2*z−1/2",
- "x*x1*zy−1*2*z2*y−1/2",
- "2*x*y*z*x−1",
- "−2*x*z*x−1*zy−1",
- "−2*x*y*x−1*zy−1",
- "y*1−x*x*2*y−1",
- "z*1−x*x*2*z−1",
- "1−x*x*zy−1*2*z2*y−1",
- "2*x*y*z*x1",
- "−2*x*z*x1*zy−1",
- "−2*x*y*x1*zy−1",
- "4*y*z*1−x*x",
- "4*z*x−1*zy−1",
- "4*y*x−1*zy−1"};
+{"x*y*(x−1)*(2*y−1)/2",
+ "x*z*(x−1)*(2*z−1)/2",
+ "x*(x−1)*(zy−1)*(2*z2*y−1)/2",
+ "x*y*(x1)*(2*y−1)/2",
+ "x*z*(x1)*(2*z−1)/2",
+ "x*(x1)*(zy−1)*(2*z2*y−1)/2",
+ "2*x*y*z*(x−1)",
+ "−2*x*z*(x−1)*(zy−1)",
+ "−2*x*y*(x−1)*(zy−1)",
+ "2*x*y*z*(x1)",
+ "−2*x*z*(x1)*(zy−1)",
+ "−2*x*y*(x1)*(zy−1)",
+ "y*(1−x*x)*(2*y−1)",
+ "z*(1−x*x)*(2*z−1)",
+ "(1−x*x)*(zy−1)*(2*z2*y−1)",
+ "4*y*z*(1−x*x)",
+ "4*z*(x−1)*(zy−1)",
+ "4*y*(x−1)*(zy−1)"};
// HEXA8
const static int HEXA8_dim = 3;
"1/4*(1-y*y)*(1+x)*(1-z)",
"1/4*(1-x*x)*(1+y)*(1-z)",
"1/4*(1-y*y)*(1-x)*(1-z)",
- "1/4*(1-z*z)*(1-x)*(1-y)",
- "1/4*(1-z*z)*(1+x)*(1-y)",
- "1/4*(1-z*z)*(1+x)*(1+y)",
- "1/4*(1-z*z)*(1-x)*(1+y)",
"1/4*(1-x*x)*(1-y)*(1+z)",
"1/4*(1-y*y)*(1+x)*(1+z)",
"1/4*(1-x*x)*(1+y)*(1+z)",
"1/4*(1-y*y)*(1-x)*(1+z)",
+ "1/4*(1-z*z)*(1-x)*(1-y)",
+ "1/4*(1-z*z)*(1+x)*(1-y)",
+ "1/4*(1-z*z)*(1+x)*(1+y)",
+ "1/4*(1-z*z)*(1-x)*(1+y)"
};
-
// HEXA27
const static int HEXA27_dim = 3;
const static int HEXA27_nnode = 27;
static const int HEXA27_aster2med[HEXA27_nnode] =
-{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 12, 13, 14, 15, 20, 21,
- 22, 23, 24, 25, 26};
+{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 12, 13, 14, 15, 24, 22,
+ 21, 23, 20, 25, 26};
static const char* HEXA27_varnames[HEXA27_dim] = {"x", "y", "z"};
static const char* HEXA27_functions[HEXA27_nnode] =
{"1/8*x*(x-1)*y*(y-1)*z*(z-1)",
"1/4*x*(x+1)*(1-y*y)*z*(z-1)",
"1/4*(1-x*x)*y*(y+1)*z*(z-1)",
"1/4*x*(x-1)*(1-y*y)*z*(z-1)",
- "1/4*x*(x-1)*y*(y-1)*(1-z*z)",
- "1/4*x*(x+1)*y*(y-1)*(1-z*z)",
- "1/4*x*(x+1)*y*(y+1)*(1-z*z)",
- "1/4*x*(x-1)*y*(y+1)*(1-z*z)",
"1/4*(1-x*x)*y*(y-1)*z*(z+1)",
"1/4*x*(x+1)*(1-y*y)*z*(z+1)",
"1/4*(1-x*x)*y*(y+1)*z*(z+1)",
"1/4*x*(x-1)*(1-y*y)*z*(z+1)",
- "1/2*(1-x*x)*(1-y*y)*z*(z-1)",
- "1/2*(1-x*x)*y*(y-1)*(1-z*z)",
+ "1/4*x*(x-1)*y*(y-1)*(1-z*z)",
+ "1/4*x*(x+1)*y*(y-1)*(1-z*z)",
+ "1/4*x*(x+1)*y*(y+1)*(1-z*z)",
+ "1/4*x*(x-1)*y*(y+1)*(1-z*z)",
"1/2*x*(x-1)*(1-y*y)*(1-z*z)",
+ "1/2*x*(x+1)*(1-y*y)*(1-z*z)",
"1/2*(1-x*x)*y*(y-1)*(1-z*z)",
- "1/2*x*(x-1)*(1-y*y)*(1-z*z)",
+ "1/2*(1-x*x)*y*(y+1)*(1-z*z)",
"1/2*(1-x*x)*(1-y*y)*z*(z-1)",
+ "1/2*(1-x*x)*(1-y*y)*z*(z+1)",
"(1-x*x)*(1-y*y)*(1-z*z)"
};
#include <list>
#include <set>
#include <algorithm>
+
using namespace std;
struct VTKField
vtkQuadratureSchemeDefinition* def=vtkQuadratureSchemeDefinition::New();
int cellType=vtkMedUtilities::GetVTKCellType(loc->GetGeometryType());
+ // Control to avoid crahs when loading a file with structural elements.
+ // This should be removed in version 7.1.0 of SALOME.
+ // See mantis issue 21990
+ if(loc->GetGeometryType() >= MED_STRUCT_GEO_INTERNAL)
+ {
+ vtkErrorMacro("You are loading a file containing structural elements BUT they are still not supported");
+ return;
+ }
+ if(loc->GetWeights()->GetVoidPointer(0) == NULL)
+ return;
def->Initialize(cellType, vtkMedUtilities::GetNumberOfPoint(
loc->GetGeometryType()), loc->GetNumberOfQuadraturePoint(),
(double*)loc->GetShapeFunction()->GetVoidPointer(0),
return "MED_POLYGON";
case MED_POLYHEDRON:
return "MED_POLYHEDRON";
+ case MED_STRUCT_GEO_INTERNAL:
+ return "MED_STRUCT_GEO_INTERNAL";
case MED_NO_GEOTYPE:
return "MED_NO_GEOTYPE";
default:
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/wrapfiles.txt
- COMMAND pvpython ${CMAKE_SOURCE_DIR}/getwrapclasses.py
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/getwrapclasses.py
DEPENDS ${CMAKE_SOURCE_DIR}/getwrapclasses.py ${PARAVIEW_PYTHON_EXECUTABLE}
)