CXXFLAGS = @CXXFLAGS@
CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
+# BOOST Library
+
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+
# JAVA
JAVA_INCLUDES = @JAVA_INCLUDES@
HDF5_LIBS=@HDF5_LIBS@
HDF5_MT_LIBS=@HDF5_MT_LIBS@
-# MED2
-
-MED2_INCLUDES=@MED2_INCLUDES@
-MED2_LIBS=@MED2_LIBS@
-MED2_MT_LIBS=@MED2_MT_LIBS@
-
# OpenCasCade
OCC_INCLUDES=@CAS_CPPFLAGS@
ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \
ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \
ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
-ac_cc_warnings.m4 check_qt.m4 check_med2.m4 \
-check_swig.m4
+ac_cc_warnings.m4 check_qt.m4 check_swig.m4
$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
AC_CXX_HAVE_SSTREAM
+echo
+echo ---------------------------------------------
+echo BOOST Library
+echo ---------------------------------------------
+echo
+
+CHECK_BOOST
+
dnl
dnl ---------------------------------------------
dnl testing MPICH
CHECK_HDF5
-echo
-echo ---------------------------------------------
-echo testing MED2
-echo ---------------------------------------------
-echo
-
-CHECK_MED2
-
echo
echo ---------------------------------------------
echo Testing OpenCascade
echo
echo Configure
-variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok Med_ok"
+variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok qwt_ok doxygen_ok graphviz_ok Kernel_ok Med_ok"
for var in $variables
do
LIB = libVisuConvertor.la
LIB_SRC = VISU_Convertor.cxx VISU_Convertor_impl.cxx VISU_ConvertorUtils.cxx VISU_ExtractUnstructuredGrid.cxx \
- VISU_MedConvertor.cxx VISU_DatConvertor.cxx
+ VISU_MedConvertor.cxx
# Executables targets
BIN = VISUConvertor
BIN_SRC =
-CPPFLAGS+= -ftemplate-depth-32 $(VTK_INCLUDES) $(MED2_INCLUDES) $(QT_INCLUDES) \
- -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS+= $(VTK_LIBS) $(MED2_LIBS) $(HDF5_LIBS) $(QT_LIBS) \
- -L${KERNEL_ROOT_DIR}/lib/salome
+CPPFLAGS+= -ftemplate-depth-32 $(VTK_INCLUDES) $(HDF5_INCLUDES) $(QT_INCLUDES) \
+ -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+LDFLAGS+= $(VTK_LIBS) $(QT_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper
@CONCLUDE@
void parseFile(const char* theFileName) {
try{
- MESSAGE("'"<<theFileName<<"'...");
+ MSG(MYDEBUG,"'"<<theFileName<<"'...");
auto_ptr<VISU_Convertor> aCon(CreateConvertor(theFileName));
//aCon->GetSize();
//return;
aCon->GetMeshOnEntity(aMeshName,anEntity);
}
}
- OK:
- MESSAGE("OK");
+ MSG(MYDEBUG,"OK");
}catch(std::exception& exc){
- MESSAGE("Follow exception was occured in file:"<<theFileName<<"\n"<<exc.what());
+ MSG(MYDEBUG,"Follow exception was occured in file:"<<theFileName<<"\n"<<exc.what());
}catch(...){
- MESSAGE("Unknown exception was occured in VISU_Convertor_impl in file:"<<theFileName);
+ MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl in file:"<<theFileName);
}
}
return 0;
}
}catch(std::exception& exc){
- MESSAGE("Follow exception was occured :\n"<<exc.what());
+ MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
}catch(...){
- MESSAGE("Unknown exception was occured in VISU_Convertor_impl");
+ MSG(MYDEBUG,"Unknown exception was occured in VISU_Convertor_impl");
}
return 1;
}
#include "VISU_Convertor.hxx"
#include "VISU_ConvertorUtils.hxx"
-using namespace std;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
+#include <qstring.h>
-extern "C" {
- VISU_Convertor* CreateConvertor(const string& theFileName) {
- if(QFileInfo(theFileName.c_str()).extension(false) == "med")
- return CreateMedConvertor(theFileName);
- else
- return CreateDatConvertor(theFileName);
- }
-}
+using namespace std;
namespace VISU{
inline int GetNbOfPoints(int theVTKCellType){
#include <vtkFieldDataToAttributeDataFilter.h>
#include "VISU_ExtractUnstructuredGrid.hxx"
+#include "MED_Common.hxx"
#include <vtkSmartPointer.h>
TCellsConn myCellsConn;
TFamilyMap myFamilyMap;
TFieldMap myFieldMap;
+ MED::TGeom myGeom;
TMeshOnEntity() : myNbCells(0), myCellsSize(0) {}
std::pair<vtkIdType,vtkIdType> GetCellsDims(const std::string& theFamilyName = "") const;
TPointsDim myPointsDim;
TMeshOnEntityMap myMeshOnEntityMap;
TGroupMap myGroupMap;
+ MED::PMeshInfo myMeshInfo;
+ MED::TEntityInfo myEntityInfo;
TMesh() : myDim(0), myNbPoints(0) {}
const TField* GetField(const std::string& theFieldName) const;
};
};
extern "C"{
- VISU_Convertor* CreateMedConvertor(const std::string& theFileName) ;
- VISU_Convertor* CreateDatConvertor(const std::string& theFileName) ;
VISU_Convertor* CreateConvertor(const std::string& theFileName) ;
};
// Author : Alexey PETROV
// Module : VISU
-#include "VISU_Convertor.hxx"
#include "VISU_ConvertorUtils.hxx"
-
-#include <vtkCellType.h>
-
-using namespace std;
-
-#define MED2VTK(MEDTYPE,VTKTYPE,VTKNBNODES) \
- {MEDTYPE,#MEDTYPE,getNbMedNodes(MEDTYPE),VTKTYPE,#VTKTYPE,VTKNBNODES}
-Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE] = {
- MED2VTK(MED_POINT1,VTK_VERTEX,1),
- MED2VTK(MED_SEG2,VTK_LINE,2),
- MED2VTK(MED_SEG3,VTK_LINE,2),
- MED2VTK(MED_TRIA3,VTK_TRIANGLE,3),
- MED2VTK(MED_TRIA6,VTK_TRIANGLE,3),
- MED2VTK(MED_QUAD4,VTK_QUAD,4),
- MED2VTK(MED_QUAD8,VTK_QUAD,4),
- MED2VTK(MED_TETRA4,VTK_TETRA,4),
- MED2VTK(MED_TETRA10,VTK_TETRA,4),
- MED2VTK(MED_HEXA8,VTK_HEXAHEDRON,8),
- MED2VTK(MED_HEXA20,VTK_HEXAHEDRON,8),
- MED2VTK(MED_PENTA6,VTK_WEDGE,6),
- MED2VTK(MED_PENTA15,VTK_WEDGE,6),
- MED2VTK(MED_PYRA5,VTK_PYRAMID,5),
- MED2VTK(MED_PYRA13,VTK_PYRAMID,5)
-};
-#undef MED2VTK
-
-extern "C" {
- int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim){
- int anElemDim = theMedType / 100, nsup = 0;
- if(theMedEntity == VISU::CELL_ENTITY && anElemDim < theMeshDim) nsup = 1;
- return nsup + theMedType % 100;
+#include <vtkUnstructuredGridWriter.h>
+
+namespace VISU{
+
+ void
+ WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName)
+ {
+ vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
+ //aWriter->SetFileType(VTK_BINARY);
+ aWriter->SetFileName(theFileName.c_str());
+ aWriter->SetInput(theDataSet);
+ aWriter->Write();
+ aWriter->Delete();
}
- int getNbMedNodes(int geom){
- return geom % 100;
- }
-
- int getIdMedType(int medType){
- for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
- if(med2vtk[i].medType == medType) return i;
- return -1;
- }
-
- int med2vtkCellType(int medType){
- for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
- if(med2vtk[i].medType == medType) return med2vtk[i].vtkType;
- return -1;
- }
-
- int vtk2medCellType(int vtkType){
- for(int i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
- if(med2vtk[i].vtkType == vtkType) return med2vtk[i].medType;
- return -1;
- }
}
#ifndef VISU_ConvertorUtils_HeaderFile
#define VISU_ConvertorUtils_HeaderFile
-extern "C"{
-#include <med.h>
-}
-
-#include <fstream>
-#include <strstream>
#include <string>
#include <vtkCellType.h>
-#include <qstring.h>
-#include <qfileinfo.h>
-
-#ifndef MESSAGE
-#define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl
-
-#undef EXCEPT
-#define EXCEPT(msg) QString(QString(__FILE__) + "[" + QString::number(__LINE__) + "]::" + msg)
-
-#undef EXCEPTION
-#define EXCEPTION(msg) EXCEPT(msg).latin1()
+#include "MED_Utilities.hxx"
-#endif
+class vtkUnstructuredGrid;
-template<class T> std::string dtos(const std::string& fmt, T val){
- static QString aString;
- aString.sprintf(fmt.c_str(),val);
- return aString.latin1();
-}
+namespace VISU{
-extern "C"{
- int getNbMedConnect(int theMedType, int theMedEntity, int theMeshDim);
- int getNbMedNodes(int theMedType);
- int med2vtkCellType(int theMedType);
- int vtk2medCellType(int theVtkType);
- int getIdMedType(int medType);
+ void
+ WriteToFile(vtkUnstructuredGrid* theDataSet, const std::string& theFileName);
+
}
-struct Med2vtk {
- med_geometrie_element medType;
- const char *medName;
- int medNbNodes;
- int vtkType;
- const char *vtkName;
- int vtkNbNodes;
-};
-
-extern Med2vtk med2vtk[MED_NBR_GEOMETRIE_MAILLE];
-
#endif
#include <vtkMergeDataObjectFilter.h>
-#include <vtkUnstructuredGridWriter.h>
-
#include <qstring.h>
#include <qfileinfo.h>
#include <memory>
using namespace std;
+using namespace VISU;
static float ERR_SIZE_CALC = 1.00;
static int MYDEBUGWITHFILES = 0;
#endif
-void VISU::WriteToFile(vtkUnstructuredGrid* theDataSet, const string& theFileName){
- //vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
- //if(MYVTKDEBUG) aWriter->DebugOn();
- ////aWriter->SetFileType(VTK_BINARY);
- //aWriter->SetFileName(theFileName.c_str());
- //aWriter->SetInput(theDataSet);
- //aWriter->Write();
- //aWriter->Delete();
-}
-
-enum ECoordName{eX, eY, eZ, eNone};
-typedef VISU::TMesh::TCoord (*TGetCoord)(const VISU::TMesh::TPointsCoord&, int);
-
-template<ECoordName TheCoordId>
-VISU::TMesh::TCoord GetCoord(const VISU::TMesh::TPointsCoord& thePointsCoord,
- int theStartPos)
-{
- return thePointsCoord[theStartPos+TheCoordId];
-}
-
-template<>
-VISU::TMesh::TCoord GetCoord<eNone>(const VISU::TMesh::TPointsCoord& thePointsCoord,
- int theStartPos)
-{
- return 0.0;
-}
+namespace{
-static TGetCoord aXYZGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eY>,
- &GetCoord<eZ>
-};
-
-
-static TGetCoord aXYGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eY>,
- &GetCoord<eNone>
-};
-
-static TGetCoord aYZGetCoord[3] = {
- &GetCoord<eNone>,
- &GetCoord<eX>,
- &GetCoord<eY>
-};
-
-static TGetCoord aXZGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eNone>,
- &GetCoord<eY>
-};
-
-
-static TGetCoord aXGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eNone>,
- &GetCoord<eNone>
-};
-
-static TGetCoord aYGetCoord[3] = {
- &GetCoord<eNone>,
- &GetCoord<eX>,
- &GetCoord<eNone>
-};
-
-static TGetCoord aZGetCoord[3] = {
- &GetCoord<eNone>,
- &GetCoord<eNone>,
- &GetCoord<eX>
-};
-
-
-class TCoordHelper{
- const VISU::TMesh::TPointsCoord& myPointsCoord;
- TGetCoord* myGetCoord;
-public:
- TCoordHelper(const VISU::TMesh::TPointsCoord& thePointsCoord,
- TGetCoord* theGetCoord):
- myPointsCoord(thePointsCoord),
- myGetCoord(theGetCoord)
- {}
- virtual ~TCoordHelper(){}
- VISU::TMesh::TCoord GetCoord(int theStartPos, int theCoodId){
- return (*myGetCoord[theCoodId])(myPointsCoord,theStartPos);
+ template<class T>
+ std::string dtos(const std::string& fmt, T val){
+ static QString aString;
+ aString.sprintf(fmt.c_str(),val);
+ return aString.latin1();
}
-};
-typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
+ enum ECoordName{eX, eY, eZ, eNone};
+ typedef VISU::TMesh::TCoord (*TGetCoord)(const VISU::TMesh::TPointsCoord&, int);
+
+ template<ECoordName TheCoordId>
+ VISU::TMesh::TCoord GetCoord(const VISU::TMesh::TPointsCoord& thePointsCoord,
+ int theStartPos)
+ {
+ return thePointsCoord[theStartPos+TheCoordId];
+ }
+
+ template<>
+ VISU::TMesh::TCoord GetCoord<eNone>(const VISU::TMesh::TPointsCoord& thePointsCoord,
+ int theStartPos)
+ {
+ return 0.0;
+ }
+
+
+ TGetCoord aXYZGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eY>,
+ &GetCoord<eZ>
+ };
+
+
+ TGetCoord aXYGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eY>,
+ &GetCoord<eNone>
+ };
+
+ TGetCoord aYZGetCoord[3] = {
+ &GetCoord<eNone>,
+ &GetCoord<eX>,
+ &GetCoord<eY>
+ };
+
+ TGetCoord aXZGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eNone>,
+ &GetCoord<eY>
+ };
+
+
+ TGetCoord aXGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eNone>,
+ &GetCoord<eNone>
+ };
+
+ TGetCoord aYGetCoord[3] = {
+ &GetCoord<eNone>,
+ &GetCoord<eX>,
+ &GetCoord<eNone>
+ };
+
+ TGetCoord aZGetCoord[3] = {
+ &GetCoord<eNone>,
+ &GetCoord<eNone>,
+ &GetCoord<eX>
+ };
-namespace{
+
+ class TCoordHelper{
+ const VISU::TMesh::TPointsCoord& myPointsCoord;
+ TGetCoord* myGetCoord;
+ public:
+ TCoordHelper(const VISU::TMesh::TPointsCoord& thePointsCoord,
+ TGetCoord* theGetCoord):
+ myPointsCoord(thePointsCoord),
+ myGetCoord(theGetCoord)
+ {}
+ virtual ~TCoordHelper(){}
+ VISU::TMesh::TCoord GetCoord(int theStartPos, int theCoodId){
+ return (*myGetCoord[theCoodId])(myPointsCoord,theStartPos);
+ }
+ };
+ typedef std::auto_ptr<TCoordHelper> TCoordHelperPtr;
+
void GetPoints(VISU::TVTKSource& theStorage, VISU::TMesh& theMesh)
{
vtkPoints* aPoints = theMesh.myPoints.GetPointer();
vtkIdType iEnd = theMesh.myPointsCoord.size();
vtkIdType aNbPoints = iEnd / theMesh.myDim;
aPoints->SetNumberOfPoints(aNbPoints);
- if(MYDEBUG)
- MESSAGE("GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh.myDim);
+ MSG(MYDEBUG,"GetPoints - aNbPoints = "<<aNbPoints<<"; myDim = "<<theMesh.myDim);
for (vtkIdType i = 0, j = 0; i < iEnd; i += theMesh.myDim, j++)
aPoints->SetPoint(j,
aCoordHelperPtr->GetCoord(i,eX),
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents(1);
aCellTypesArray->SetNumberOfTuples(aNbCells);
- if(MYDEBUG) MESSAGE("GetCellsOnEntity - isFamilyPresent = "<<isFamilyPresent);
+ MSG(MYDEBUG,"GetCellsOnEntity - isFamilyPresent = "<<isFamilyPresent);
const VISU::TMeshOnEntity::TCellsConn &aCellsConn = theMeshOnEntity.myCellsConn;
VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.begin();
for(int i = 0, j = 0; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
int aVtkType = aCellsConnIter->first;
- if(MYDEBUG)
- MESSAGE("GetCellsOnEntity - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
+ MSG(MYDEBUG,"GetCellsOnEntity - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
if(!isFamilyPresent)
for(int k = 0, kEnd = anArray.size(); k < kEnd; k++, i++){
PrintCells(i,aConnectivity,anArray[k]);
else{
const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
if(aSubMesh.empty())
- throw std::runtime_error(EXCEPTION("GetCells >> There is no elements on the family !!!"));
+ EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
if(aSubMeshIter == aSubMesh.end()) continue;
const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
- if(MYDEBUG)
- MESSAGE("GetCellsOnEntity - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
+ MSG(MYDEBUG,"GetCellsOnEntity - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
for(; aCellsConnIter != aCellsConn.end(); aCellsConnIter++){
const VISU::TMeshOnEntity::TConnForCellType& anArray = aCellsConnIter->second;
int aVtkType = aCellsConnIter->first;
- if(MYDEBUG)
- MESSAGE("GetCellsOnGroup - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
+ MSG(MYDEBUG,"GetCellsOnGroup - aVtkType = "<<aVtkType<<"; anArray.size() = "<<anArray.size());
const VISU::TFamily::TSubMesh& aSubMesh = aFamily.mySubMesh;
if(aSubMesh.empty())
- throw std::runtime_error(EXCEPTION("GetCells >> There is no elements on the family !!!"));
+ EXCEPTION(runtime_error,"GetCells >> There is no elements on the family !!!");
VISU::TFamily::TSubMesh::const_iterator aSubMeshIter = aSubMesh.find(aVtkType);
if(aSubMeshIter == aSubMesh.end()) continue;
const VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aSubMeshIter->second;
- if(MYDEBUG)
- MESSAGE("GetCellsOnGroup - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
+ MSG(MYDEBUG,"GetCellsOnGroup - aSubMeshOnCellType.size() = "<<aSubMeshOnCellType.size());
VISU::TFamily::TSubMeshOnCellType::const_iterator aSubMeshOnCellTypeIter = aSubMeshOnCellType.begin();
for(; aSubMeshOnCellTypeIter != aSubMeshOnCellType.end(); aSubMeshOnCellTypeIter++, i++){
PrintCells(i,aConnectivity,anArray[*aSubMeshOnCellTypeIter]);
//theFloatArray->DebugOn();
theFloatArray->SetNumberOfTuples(theNumberOfTuples);
theFloatArray->SetName(theFieldName.c_str());
- if(MYDEBUG) MESSAGE("GetValsOnTimeStamp - theNumberOfTuples = "<<theNumberOfTuples);
+ MSG(MYDEBUG,"GetValsOnTimeStamp - theNumberOfTuples = "<<theNumberOfTuples);
const VISU::TField::TValForCells& aValForCells = theValForTime.myValForCells;
VISU::TField::TValForCells::const_iterator aValForCellsIter = aValForCells.begin();
for(int k = 0; aValForCellsIter != aValForCells.end(); aValForCellsIter++) {
const VISU::TField::TValForCellsWithType& anArray = aValForCellsIter->second;
int iEnd = anArray.size()/theField.myNbComp;
int aVtkType = aValForCellsIter->first;
- if(MYDEBUG) MESSAGE("GetValsOnTimeStamp - iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType);
+ MSG(MYDEBUG,"GetValsOnTimeStamp - iEnd = "<<iEnd<<"; aVtkType = "<<aVtkType);
switch(theField.myNbComp) {
case 1:
for (int i = 0; i < iEnd; i++)
theFloatArray->SetTuple3(k++,anArray[ji],anArray[ji+2],anArray[ji+5]);
break;
default:
- throw std::runtime_error(EXCEPTION("GetValsOnTimeStamp - There is no an algorithm for representation of the field !!!"));
+ EXCEPTION(runtime_error,"GetValsOnTimeStamp - There is no an algorithm for representation of the field !!!");
}
}
}
{
int aNumberOfTuples = theField.myDataSize/theField.myNbComp;
string aFieldName = GenerateFieldName(theField,theValForTime);
- if(MYDEBUG)
- MESSAGE("GetTimeStamp(TVTKSource) - aFieldName = "<<aFieldName<<
- "; aNumberOfTuples = "<<aNumberOfTuples);
-
+ MSG(MYDEBUG,"GetTimeStamp(TVTKSource) - aFieldName = "<<aFieldName<<
+ "; aNumberOfTuples = "<<aNumberOfTuples);
+
vtkDataSetAttributes* aDataSetAttributes;
switch(theField.myEntity){
case VISU::NODE_ENTITY :
{
int aNumberOfTuples = theField.myDataSize/theField.myNbComp;
string aFieldName = GenerateFieldName(theField,theValForTime);
- if(MYDEBUG)
- MESSAGE("GetTimeStamp(TVTKAttribyteFilter) - aFieldName = "<<aFieldName<<
- "; aNumberOfTuples = "<<aNumberOfTuples);
+ MSG(MYDEBUG,"GetTimeStamp(TVTKAttribyteFilter) - aFieldName = "<<aFieldName<<
+ "; aNumberOfTuples = "<<aNumberOfTuples);
vtkDataObject* aDataObject = vtkDataObject::New();
theMergeFilter->SetDataObject(aDataObject);
const VISU::TEntity& theEntity,
const string& theFamilyName)
{
- if(MYDEBUG)
- MESSAGE("GetMeshOnEntity - theMeshName = '"<<theMeshName<<
- "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+ MSG(MYDEBUG,"GetMeshOnEntity - theMeshName = '"<<theMeshName<<
+ "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
//Cheching possibility do the query
VISU::TMesh* pMesh = NULL;
VISU::TFamily* pFamily = NULL;
GetMeshOnEntitySize(theMeshName,theEntity,theFamilyName);
vtkUnstructuredGrid* aDataSet = aSource.GetPointer();
aDataSet->Update();
- MESSAGE("GetMeshOnEntity - GetPoints() = "<<float(aDataSet->GetPoints()->GetActualMemorySize()*1000));
- MESSAGE("GetMeshOnEntity - GetCells() = "<<float(aDataSet->GetCells()->GetActualMemorySize()*1000));
- MESSAGE("GetMeshOnEntity - GetCellTypesArray() = "<<float(aDataSet->GetCellTypesArray()->GetActualMemorySize()*1000));
- MESSAGE("GetMeshOnEntity - GetCellLocationsArray() = "<<float(aDataSet->GetCellLocationsArray()->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetMeshOnEntity - GetPoints() = "<<float(aDataSet->GetPoints()->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCells() = "<<float(aDataSet->GetCells()->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellTypesArray() = "<<float(aDataSet->GetCellTypesArray()->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellLocationsArray() = "<<float(aDataSet->GetCellLocationsArray()->GetActualMemorySize()*1000));
aDataSet->BuildLinks();
- MESSAGE("GetMeshOnEntity - GetCellLinks() = "<<float(aDataSet->GetCellLinks()->GetActualMemorySize()*1000));
- MESSAGE("GetMeshOnEntity - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetMeshOnEntity - GetCellLinks() = "<<float(aDataSet->GetCellLinks()->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetMeshOnEntity - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
}
}catch(...){
aSource = vtkSmartPointerBase();
VISU_Convertor_impl::GetMeshOnGroup(const string& theMeshName,
const string& theGroupName)
{
- if(MYDEBUG) MESSAGE("GetMeshOnGroup - theMeshName = '"<<theMeshName<<
- "'; theGroupName = '"<<theGroupName<<"'");
+ MSG(MYDEBUG,"GetMeshOnGroup - theMeshName = '"<<theMeshName<<
+ "'; theGroupName = '"<<theGroupName<<"'");
//Cheching possibility do the query
VISU::TMesh* pMesh = NULL;
VISU::TGroup* pGroup = NULL;
const string& theFieldName,
int theStampsNum)
{
- if(MYDEBUG){
- MESSAGE("GetTimeStampOnMesh - theMeshName = '"<<theMeshName<<"; theEntity = "<<theEntity);
- MESSAGE("GetTimeStampOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
- }
+ MSG(MYDEBUG,"GetTimeStampOnMesh - theMeshName = '"<<theMeshName<<"; theEntity = "<<theEntity);
+ MSG(MYDEBUG,"GetTimeStampOnMesh - theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
+
//Cheching possibility do the query
VISU::TMesh* pMesh = NULL;
VISU::TField* pField = NULL;
LoadMeshOnEntity(*pVTKMeshOnEntity);
}catch(std::exception& exc){
pVTKMeshOnEntity = pMeshOnEntity;
- MESSAGE("Follow exception was occured :\n"<<exc.what());
+ MSG(MYDEBUG,"Follow exception was occured :\n"<<exc.what());
}catch(...){
pVTKMeshOnEntity = pMeshOnEntity;
- MESSAGE("Unknown exception was occured!");
+ MSG(MYDEBUG,"Unknown exception was occured!");
}
GetMeshOnEntity(pVTKMeshOnEntity->myMeshName,pVTKMeshOnEntity->myEntity);
vtkUnstructuredGrid *aDataSet = anAttribyteFilter->GetUnstructuredGridOutput();
aDataSet->Update();
if(theEntity == VISU::NODE_ENTITY)
- MESSAGE("GetTimeStampOnMesh - GetData() = "<<float(aDataSet->GetPointData()->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetTimeStampOnMesh - GetData() = "<<float(aDataSet->GetPointData()->GetActualMemorySize()*1000));
else
- MESSAGE("GetMeshOnEntity - GetData() = "<<float(aDataSet->GetCellData()->GetActualMemorySize()*1000));
- MESSAGE("GetTimeStampOnMesh - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetMeshOnEntity - GetData() = "<<float(aDataSet->GetCellData()->GetActualMemorySize()*1000));
+ MSG(MYVTKDEBUG,"GetTimeStampOnMesh - GetActualMemorySize() = "<<float(aDataSet->GetActualMemorySize()*1000));
}
}
}catch(...){
{
GetMeshMap();
if(myMeshMap.find(theMeshName) == myMeshMap.end())
- throw std::runtime_error(EXCEPT("FindMesh >> There is no mesh with the name - '%1'!!!").
- arg(theMeshName.c_str()).latin1());
+ EXCEPTION(runtime_error,"FindMesh >> There is no mesh with the name - '"<<theMeshName<<"'!!!");
theMesh = &myMeshMap[theMeshName];
}
FindMesh(theMeshName,theMesh);
VISU::TMeshOnEntityMap& aMeshOnEntityMap = theMesh->myMeshOnEntityMap;
if(aMeshOnEntityMap.find(theEntity) == aMeshOnEntityMap.end())
- throw std::runtime_error(EXCEPT("FindMeshOnEntity >> There is no mesh on the entity - %1!!!").
- arg(int(theEntity)).latin1());
+ EXCEPTION(runtime_error,"FindMeshOnEntity >> There is no mesh on the entity - "<<theEntity<<"!!!");
theMeshOnEntity = &aMeshOnEntityMap[theEntity];
theFamily = VISU::GetFamily(*theMeshOnEntity,theFamilyName);
}
aResult += GetMeshOnEntitySize(aMeshName,anEntity);
}
}
- if(MYDEBUG)
- MESSAGE("GetSize - aResult = "<<float(aResult));
+ MSG(MYDEBUG,"GetSize - aResult = "<<float(aResult));
return aResult;
}
aLinksSize = 0;
vtkIdType aResult = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize + aLinksSize;
if(MYDEBUG){
- if(MYVTKDEBUG){
- MESSAGE("GetMeshOnEntitySize - aPointsSize = "<<float(aPointsSize));
- MESSAGE("GetMeshOnEntitySize - aConnectivitySize = "<<float(aConnectivitySize));
- MESSAGE("GetMeshOnEntitySize - aTypesSize = "<<float(aTypesSize));
- MESSAGE("GetMeshOnEntitySize - aLocationsSize = "<<float(aLocationsSize));
- MESSAGE("GetMeshOnEntitySize - aLinksSize = "<<float(aLinksSize));
- }
- MESSAGE("GetMeshOnEntitySize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
- "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+ MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aPointsSize = "<<float(aPointsSize));
+ MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aConnectivitySize = "<<float(aConnectivitySize));
+ MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aTypesSize = "<<float(aTypesSize));
+ MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aLocationsSize = "<<float(aLocationsSize));
+ MSG(MYVTKDEBUG,"GetMeshOnEntitySize - aLinksSize = "<<float(aLinksSize));
}
+ MSG(MYDEBUG,"GetMeshOnEntitySize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
+ "'; theEntity = "<<theEntity<<"; theFamilyName = '"<<theFamilyName<<"'");
+
aResult = vtkIdType(aResult*ERR_SIZE_CALC);
return aResult;
}
VISU::TGroupMap& aGroupMap = theMesh->myGroupMap;
VISU::TGroupMap::iterator aGroupMapIter = aGroupMap.find(theGroupName);
if(aGroupMapIter == aGroupMap.end())
- throw std::runtime_error(EXCEPT("FindMesh >> There is no the group in the mesh!!! - '%1'").arg(theGroupName.c_str()).latin1());
+ EXCEPTION(runtime_error,"FindMesh >> There is no the group in the mesh!!! - '"<<theGroupName<<"'");
theGroup = &aGroupMapIter->second;
}
aLinksSize = 0;
vtkIdType aResult = aPointsSize + aConnectivityAndTypesSize + aLocationsSize + aLinksSize;
if(MYDEBUG){
- if(MYVTKDEBUG){
- MESSAGE("GetMeshOnGroupSize - aPointsSize = "<<float(aPointsSize));
- MESSAGE("GetMeshOnGroupSize - aConnectivityAndTypesSize = "<<float(aConnectivityAndTypesSize));
- MESSAGE("GetMeshOnGroupSize - aLocationsSize = "<<float(aLocationsSize));
- MESSAGE("GetMeshOnGroupSize - aLinksSize = "<<float(aLinksSize));
- }
- MESSAGE("GetMeshOnGroupSize - aResult = "<<float(aResult)<<"; theMeshName = '"
- <<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
+ MSG(MYVTKDEBUG,"GetMeshOnGroupSize - aPointsSize = "<<float(aPointsSize));
+ MSG(MYVTKDEBUG,"GetMeshOnGroupSize - aConnectivityAndTypesSize = "<<float(aConnectivityAndTypesSize));
+ MSG(MYVTKDEBUG,"GetMeshOnGroupSize - aLocationsSize = "<<float(aLocationsSize));
+ MSG(MYVTKDEBUG,"GetMeshOnGroupSize - aLinksSize = "<<float(aLinksSize));
}
+ MSG(MYDEBUG,"GetMeshOnGroupSize - aResult = "<<float(aResult)<<"; theMeshName = '"
+ <<theMeshName<<"'; theGroupName = '"<<theGroupName<<"'");
+
aResult = vtkIdType(aResult*ERR_SIZE_CALC);
return aResult;
}
theVTKMeshOnEntity = pMeshOnEntity;
VISU::TFieldMap& aFieldMap = theMeshOnEntity->myFieldMap;
if(aFieldMap.find(theFieldName) == aFieldMap.end())
- throw std::runtime_error(EXCEPTION("FindField >> There is no field on the mesh!!!"));
+ EXCEPTION(runtime_error,"FindField >> There is no field on the mesh!!!");
theField = &aFieldMap[theFieldName];
}
float aMeshSize = GetMeshOnEntitySize(theMeshName,pVTKMeshOnEntity->myEntity);
float aFieldOnMeshSize = float(pField->myDataSize*sizeof(float)*pField->myNbValField * ERR_SIZE_CALC);
float aResult = aMeshSize + aFieldOnMeshSize;
- if(MYDEBUG){
- if(MYVTKDEBUG)
- MESSAGE("GetFieldOnMeshSize - aFieldOnMeshSize = "<<float(aFieldOnMeshSize));
- MESSAGE("GetFieldOnMeshSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
- "'; theEntity = "<<theEntity<<"; theFieldName = '"<<theFieldName<<"'");
- }
+ if(MYDEBUG)
+ MSG(MYVTKDEBUG,"GetFieldOnMeshSize - aFieldOnMeshSize = "<<float(aFieldOnMeshSize));
+ MSG(MYDEBUG,"GetFieldOnMeshSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<
+ "'; theEntity = "<<theEntity<<"; theFieldName = '"<<theFieldName<<"'");
+
return aResult;
}
FindField(theMeshName,theMesh,theEntity,theMeshOnEntity,theVTKMeshOnEntity,theFieldName,theField);
VISU::TField::TValField& aValField = theField->myValField;
if(aValField.find(theStampsNum) == aValField.end())
- throw std::runtime_error(EXCEPTION("FindTimeStamp >> There is no field with the timestamp!!!"));
+ EXCEPTION(runtime_error,"FindTimeStamp >> There is no field with the timestamp!!!");
theValForTime = &aValField[theStampsNum];
}
float aMeshSize = GetMeshOnEntitySize(theMeshName,pVTKMeshOnEntity->myEntity);
float aTimeStampSize = float(pField->myDataSize*sizeof(float) * ERR_SIZE_CALC);
float aResult = aMeshSize + aTimeStampSize;
- if(MYDEBUG){
+ if(MYDEBUG)
if(MYVTKDEBUG)
- MESSAGE("GetTimeStampSize - aTimeStampSize = "<<float(aTimeStampSize));
- MESSAGE("GetTimeStampSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<
- "; theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
- }
+ MSG(MYVTKDEBUG,"GetTimeStampSize - aTimeStampSize = "<<float(aTimeStampSize));
+ MSG(MYDEBUG,"GetTimeStampSize - aResult = "<<float(aResult)<<"; theMeshName = '"<<theMeshName<<"'; theEntity = "<<theEntity<<
+ "; theFieldName = '"<<theFieldName<<"'; theStampsNum = "<<theStampsNum);
+
return aResult;
}
{
VISU::TMesh* pMesh = NULL;
VISU::TField* pField = NULL;
- VISU::TFamily* pFamily = NULL;
VISU::TMeshOnEntity *pMeshOnEntity = NULL, *pVTKMeshOnEntity = NULL;
FindField(theMeshName,pMesh,theEntity,pMeshOnEntity,pVTKMeshOnEntity,
theFieldName,pField);
#include "VISU_Convertor.hxx"
-extern "C"{
-#include <med.h>
-}
-
#include <qstring.h>
#include <qfileinfo.h>
vtkUnstructuredGrid *anInput = this->GetInput(), *anOutput = this->GetOutput();
vtkIdType aNbCells = anInput->GetNumberOfCells();
anOutput->Allocate(aNbCells);
- if(MYDEBUG) MESSAGE("Execute - anInput->GetNumberOfCells() = "<<anInput->GetNumberOfCells());
+ MSG(MYDEBUG,"Execute - anInput->GetNumberOfCells() = "<<anInput->GetNumberOfCells());
vtkIdList *aCellIds = vtkIdList::New();
- if(MYDEBUG)
- MESSAGE("Execute - myRemovedCellIds.empty() = "<<myRemovedCellIds.empty()<<
- "; myRemovedCellTypes.empty() = "<<myRemovedCellTypes.empty());
+ MSG(MYDEBUG,"Execute - myRemovedCellIds.empty() = "<<myRemovedCellIds.empty()<<
+ "; myRemovedCellTypes.empty() = "<<myRemovedCellTypes.empty());
if(myRemovedCellIds.empty() && myRemovedCellTypes.empty())
anOutput->CopyStructure(anInput);
else if(!myRemovedCellIds.empty() && myRemovedCellTypes.empty()){
InsertCell(anInput,anOutput,aCellId,aCellIds);
aCellIds->Delete();
anOutput->SetPoints(anInput->GetPoints());
- if(MYDEBUG) MESSAGE("Execute - anOutput->GetNumberOfCells() = "<<anOutput->GetNumberOfCells());
+ MSG(MYDEBUG,"Execute - anOutput->GetNumberOfCells() = "<<anOutput->GetNumberOfCells());
}
#include "VISU_MedConvertor.hxx"
+#include "VISU_Convertor.hxx"
#include "VISU_ConvertorUtils.hxx"
-#include <valarray>
-#include <vtkCellType.h>
+#include "MED_Factory.hxx"
+#include "MED_Algorithm.hxx"
+#include "MED_Utilities.hxx"
-#define USER_INTERLACE MED_FULL_INTERLACE
+#include <vtkCellType.h>
#define _EDF_NODE_IDS_
using namespace std;
+using namespace MED;
+using namespace VISU;
#ifdef _DEBUG_
static int MYDEBUG = 0;
#endif
-static med_err ret = 0;
-
-typedef map<VISU::TEntity,med_entite_maillage> TVisu2MedEntity;
-
-static TVisu2MedEntity aVisu2MedEntity;
+namespace{
-static int INIT = (
- aVisu2MedEntity[VISU::NODE_ENTITY] = MED_NOEUD,
- aVisu2MedEntity[VISU::EDGE_ENTITY] = MED_ARETE,
- aVisu2MedEntity[VISU::FACE_ENTITY] = MED_FACE,
- aVisu2MedEntity[VISU::CELL_ENTITY] = MED_MAILLE,
- 1);
+ using namespace MED;
+ using namespace VISU;
+
+ int MEDGeom2NbNodes(MED::EGeometrieElement theMEDGeomType)
+ {
+ return theMEDGeomType % 100;
+ }
-static med_geometrie_element NODEGEOM[1] = {MED_POINT1};
+ int MEDGeomToVTK(MED::EGeometrieElement theMEDGeomType)
+ {
+ switch(theMEDGeomType){
+ case ePOINT1: return VTK_VERTEX;
+ case eSEG2: return VTK_LINE;
+ case eSEG3: return VTK_LINE;
+ case eTRIA3: return VTK_TRIANGLE;
+ case eTRIA6: return VTK_TRIANGLE;
+ case eQUAD4: return VTK_QUAD;
+ case eQUAD8: return VTK_QUAD;
+ case eTETRA4: return VTK_TETRA;
+ case eTETRA10: return VTK_TETRA;
+ case eHEXA8: return VTK_HEXAHEDRON;
+ case eHEXA20: return VTK_HEXAHEDRON;
+ case ePENTA6: return VTK_WEDGE;
+ case ePENTA15: return VTK_WEDGE;
+ case ePYRA5: return VTK_PYRAMID;
+ case ePYRA13: return VTK_PYRAMID;
+ }
+ return -1;
+ }
-static med_geometrie_element EDGEGEOM[MED_NBR_GEOMETRIE_ARETE] = {
- MED_SEG2, MED_SEG3
- };
+ int VTKGeom2NbNodes(int theVTKGeomType)
+ {
+ switch(theVTKGeomType){
+ case VTK_VERTEX: return 1;
+ case VTK_LINE: return 2;
+ case VTK_TRIANGLE: return 3;
+ case VTK_QUAD: return 4;
+ case VTK_TETRA: return 4;
+ case VTK_HEXAHEDRON: return 8;
+ case VTK_WEDGE: return 6;
+ case VTK_PYRAMID: return 5;
+ }
+ return -1;
+ }
-static med_geometrie_element FACEGEOM[MED_NBR_GEOMETRIE_FACE] = {
- MED_TRIA3, MED_QUAD4, MED_TRIA6, MED_QUAD8
- };
+ MED::EGeometrieElement VTKGeomToMED(int theVTKGeomType)
+ {
+ switch(theVTKGeomType){
+ case VTK_VERTEX: return ePOINT1;
+ case VTK_LINE: return eSEG2;
+ case VTK_TRIANGLE: return eTRIA3;
+ case VTK_QUAD: return eQUAD4;
+ case VTK_TETRA: return eTETRA4;
+ case VTK_HEXAHEDRON: return eHEXA8;
+ case VTK_WEDGE: return ePENTA6;
+ case VTK_PYRAMID: return ePYRA5;
+ }
+ return EGeometrieElement(-1);
+ }
-static med_geometrie_element CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = {
- MED_POINT1, MED_SEG2, MED_SEG3, MED_TRIA3,
- MED_QUAD4, MED_TRIA6, MED_QUAD8, MED_TETRA4,
- MED_PYRA5, MED_PENTA6, MED_HEXA8, MED_TETRA10,
- MED_PYRA13, MED_PENTA15, MED_HEXA20
- };
+ TEntity MEDEntityToVTK(MED::EEntiteMaillage theMEDEntity)
+ {
+ switch(theMEDEntity){
+ case eNOEUD: return NODE_ENTITY;
+ case eARETE: return EDGE_ENTITY;
+ case eFACE: return FACE_ENTITY;
+ case eMAILLE: return CELL_ENTITY;
+ }
+ return TEntity(-1);
+ }
-void GetEntity2Geom(const VISU::TEntity& theEntity, med_geometrie_element*& theVector, int* theEnd)
-{
- switch(theEntity){
- case VISU::CELL_ENTITY: theVector = CELLGEOM; *theEnd = MED_NBR_GEOMETRIE_MAILLE; break;
- case VISU::FACE_ENTITY: theVector = FACEGEOM; *theEnd = MED_NBR_GEOMETRIE_FACE; break;
- case VISU::EDGE_ENTITY: theVector = EDGEGEOM; *theEnd = MED_NBR_GEOMETRIE_ARETE; break;
- case VISU::NODE_ENTITY: theVector = NODEGEOM; *theEnd = 1; break;
- default:
- throw std::runtime_error("GetEntity2Geom >> theEntity is uncorrect");
+ MED::EEntiteMaillage VTKEntityToMED(TEntity theVTKEntity)
+ {
+ switch(theVTKEntity){
+ case NODE_ENTITY: return eNOEUD;
+ case EDGE_ENTITY: return eARETE;
+ case FACE_ENTITY: return eFACE;
+ case CELL_ENTITY: return eMAILLE;
+ }
+ return MED::EEntiteMaillage(-1);
}
+
}
extern "C"
-VISU_Convertor* CreateMedConvertor(const string& theFileName) {
+VISU_Convertor* CreateConvertor(const string& theFileName)
+{
return new VISU_MedConvertor(theFileName);
}
-class MedFile{
- char* myFileName;
- med_idt myFid;
- MedFile();
- MedFile(const MedFile&);
-public:
- MedFile(const char* theFileName) :
- myFileName(strdup(theFileName))
- {
- myFid = MEDouvrir(myFileName,MED_LECT);
- if(myFid < 0){
- free(myFileName);
- throw std::runtime_error(string("MedFile::MedFile >> MEDouvrir(...) - ") + theFileName);
- }
- }
- ~MedFile(){
- free(myFileName);
- if(myFid >= 0)
- MEDfermer(myFid);
- }
- const med_idt& GetFid() const { return myFid;};
-};
-
VISU_MedConvertor::VISU_MedConvertor(const string& theFileName) {
myFileInfo.setFile(QString(theFileName.c_str()));
myName = myFileInfo.baseName().latin1();
}
VISU_Convertor* VISU_MedConvertor::Build() {
- MedFile aMedFile(myFileInfo.absFilePath());
- med_idt fid = aMedFile.GetFid();
- med_int iMeshEnd = MEDnMaa(fid); //Get number of meshes
- if (iMeshEnd < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDnMaa(...)"));
- if(MYDEBUG) MESSAGE("ImportInfo - MEDnMaa = "<<iMeshEnd<<"; myFileInfo = "<<myFileInfo.filePath());
- for(int iMesh = 1; iMesh <= iMeshEnd; iMesh++){
- med_int aMeshDim;
- char aMeshName[MED_TAILLE_NOM+1] = "";
- MEDmaaInfo(fid,iMesh,aMeshName,&aMeshDim);
- if(MYDEBUG) MESSAGE("ImportInfo - aMeshName = '"<<aMeshName<<"'; aMeshDim = "<<aMeshDim);
- VISU::TMesh &aMesh = myMeshMap[aMeshName];
- aMesh.myDim = aMeshDim;
- aMesh.myName = aMeshName;
- typedef map<med_int,VISU::TEntity> TFamily2EntityMap;
- TFamily2EntityMap aFamily2EntityMap;
- typedef map<med_int,med_int> TFamilyCounterMap;
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+ TInt aNbMeshes = aMed->GetNbMeshes();
+ TMeshMap& aMeshMap = myMeshMap;
+
+ MSG(MYDEBUG,"VISU_MedConvertor::Build()");
+ INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<"\n");
+
+ for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
+
+ PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
+
+ PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
+
+ MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
+
+ TCellGroup aCellGroup = GetCellsByEntity(aMed,aMeshInfo,aEntityInfo);
+
+ TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
+
+ TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aNodeInfo,aCellGroup,aFamilyGroup);
+
+ TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
+
+ // creating TMesh structure and TMeshOnEntityMap
+ typedef map<TInt,TInt> TFamilyCounterMap;
TFamilyCounterMap aFamilyNbCellsCounterMap, aFamilyCellsSizeCounterMap;
- TVisu2MedEntity::const_iterator aVisu2MedEntityIter = aVisu2MedEntity.begin();
- for(; aVisu2MedEntityIter != aVisu2MedEntity.end(); aVisu2MedEntityIter++) {
- VISU::TEntity anEntity = aVisu2MedEntityIter->first;
- int iGeomElemEnd;
- med_geometrie_element* aGeomElemVector;
- GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
- med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
- for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- int medId = getIdMedType(aGeomElemVector[iGeomElem]);
- int aVtkType = med2vtk[medId].vtkType;
- med_geometrie_element aMedType = med2vtk[medId].medType;
- if(aMedEntity == MED_NOEUD){
- med_geometrie_element typgeo = (med_geometrie_element)0;
- med_connectivite typco = (med_connectivite)0;
- med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,typgeo,typco);
- if(iNumElemEnd > 0){
- VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
- aMeshOnEntity.myEntity = anEntity;
- aMeshOnEntity.myMeshName = aMeshName;
- aMeshOnEntity.myNbCells = iNumElemEnd;
- aMeshOnEntity.myCellsSize = 2*iNumElemEnd;
- aMesh.myNbPoints = iNumElemEnd;
- if(MYDEBUG)
- MESSAGE("ImportInfo -\t anEntity = "<<anEntity<<
- "; medName = "<<med2vtk[medId].medName<<
- "; myNbCells = "<<aMeshOnEntity.myNbCells<<
- "; myCellsSize = "<<aMeshOnEntity.myCellsSize);
- med_booleen iname_elem, inum_elem;
- valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
- valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
- med_repere rep;
- valarray<char> name_coord('\0',aMesh.myDim*MED_TAILLE_PNOM+1);
- valarray<char> unit_coord('\0',aMesh.myDim*MED_TAILLE_PNOM+1);
- valarray<med_float> coord(aMesh.myDim*iNumElemEnd);
- ret = MEDnoeudsLire(fid,aMeshName,aMesh.myDim,&coord[0],MED_FULL_INTERLACE,&rep,
- &name_coord[0],&unit_coord[0],&name_elem[0],&iname_elem,
- &num_elem[0],&inum_elem,&num_fam_elem[0],iNumElemEnd);
- if(ret < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDnoeudsLire(...)"));
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- if(num_fam_elem[iNumElem] != 0){
- aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity;
- aFamilyNbCellsCounterMap[num_fam_elem[iNumElem]] += 1;
- aFamilyCellsSizeCounterMap[num_fam_elem[iNumElem]] += 2;
- }
+
+ TInt aDim = aMeshInfo->GetDim();
+ const string& aMeshName = aMeshInfo->GetName();
+
+ TMesh& aMesh = aMeshMap[aMeshName];
+ aMesh.myDim = aDim;
+ aMesh.myName = aMeshName;
+ aMesh.myNbPoints = aNodeInfo->GetNbElem();
+ aMesh.myMeshInfo = aMeshInfo;
+ aMesh.myEntityInfo = aEntityInfo;
+
+ INITMSG(MYDEBUG,"aMeshName = '"<<aMeshName<<
+ "'; myNbPoints = "<<aMesh.myNbPoints<<
+ "; aDim = "<<aDim<<"\n");
+
+ BEGMSG(MYDEBUG,"aEntityInfo.size() = "<<aEntityInfo.size()<<"\n");
+
+ MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
+ for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
+ const EEntiteMaillage& aMEntity = anEntityIter->first;
+ const MED::TGeom& aTGeom = anEntityIter->second;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
+ aMeshOnEntity.myEntity = aVEntity;
+ aMeshOnEntity.myMeshName = aMeshName;
+ aMeshOnEntity.myGeom = aTGeom;
+
+ INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+
+ if(aMEntity == eNOEUD){
+ aMeshOnEntity.myNbCells = aMesh.myNbPoints;
+ aMeshOnEntity.myCellsSize = 2*aMesh.myNbPoints;
+
+ for(TInt iElem = 0; iElem < aMesh.myNbPoints; iElem++){
+ TInt aFamId = aNodeInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ aFamilyCellsSizeCounterMap[aFamId] += 2;
}
}
- //Get number of connectivities
- med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aMedType,MED_NOD);
- if (iNumElemEnd > 0) {
- VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
- aMeshOnEntity.myEntity = anEntity;
- aMeshOnEntity.myMeshName = aMeshName;
- med_booleen iname_elem, inum_elem;
- valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
- valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
- med_int aNbConnForElem = getNbMedConnect(aMedType,anEntity,aMesh.myDim);
- aMeshOnEntity.myNbCells += iNumElemEnd;
- aMeshOnEntity.myCellsSize += iNumElemEnd*(med2vtk[medId].vtkNbNodes + 1);
- if(MYDEBUG)
- MESSAGE("ImportInfo -\t anEntity = "<<anEntity<<
- "; medName = "<<med2vtk[medId].medName<<
- "; aNbConnForElem = "<<aNbConnForElem<<
- "; myNbCells = "<<aMeshOnEntity.myNbCells<<
- "; myCellsSize = "<<aMeshOnEntity.myCellsSize);
- valarray<med_int> conn(0,aNbConnForElem*iNumElemEnd);
- ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
- &name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
- &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
- if (ret < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDelementsLire(...)"));
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- if(num_fam_elem[iNumElem] != 0){
- aFamily2EntityMap[num_fam_elem[iNumElem]] = anEntity;
- aFamilyNbCellsCounterMap[num_fam_elem[iNumElem]] += 1;
- aFamilyCellsSizeCounterMap[num_fam_elem[iNumElem]] += med2vtk[medId].vtkNbNodes + 1;
- }
+
+ INITMSG(MYDEBUG,"myNbCells = "<<aMeshOnEntity.myNbCells<<
+ "; myCellsSize = "<<aMeshOnEntity.myCellsSize<<"\n");;
+
+ }else{
+ MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
+ aMeshOnEntity.myNbCells = 0;
+ aMeshOnEntity.myCellsSize = 0;
+ for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
+ const EGeometrieElement& aGeom = anTGeomIter->first;
+ int aVNbNodes = VTKGeom2NbNodes(MEDGeomToVTK(aGeom));
+ PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aCellInfo->GetNbElem();
+ aMeshOnEntity.myNbCells += aNbElem;
+ aMeshOnEntity.myCellsSize += aNbElem*(aVNbNodes+1);
+ INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<
+ "; myNbCells = "<<aMeshOnEntity.myNbCells<<
+ "; myCellsSize = "<<aMeshOnEntity.myCellsSize<<"\n");
+
+ for(TInt iElem = 0; iElem < aMesh.myNbPoints; iElem++){
+ TInt aFamId = aCellInfo->GetFamNum(iElem);
+ if(aFamId != 0){
+ aFamilyNbCellsCounterMap[aFamId] += 1;
+ aFamilyCellsSizeCounterMap[aFamId] += aVNbNodes + 1;
+ }
+ }
}
}
}
- med_int aNbFamily = MEDnFam(fid,aMeshName,0,MED_FAMILLE);
- if(MYDEBUG) MESSAGE("ImportInfo - aNbFamily = "<<aNbFamily);
- for(int aFamInd = 1; aFamInd <= aNbFamily; aFamInd++){
- med_int aNbAttrib = MEDnFam(fid,aMeshName,aFamInd,MED_ATTR);
- valarray<med_int> anAttId(aNbAttrib), anAttVal(aNbAttrib);
- valarray<char> anAttDesc('\0',aNbAttrib*MED_TAILLE_DESC+1);
- med_int aNbGroup = MEDnFam(fid,aMeshName,aFamInd,MED_GROUPE);
- if(0 && MYDEBUG)
- MESSAGE("ImportInfo - aFamInd = "<<aFamInd<<"; aNbAttrib = "<<aNbAttrib<<"; aNbGroup = "<<aNbGroup);
- valarray<char> aGroupNames('\0',aNbGroup*MED_TAILLE_LNOM+1);
- char aFamilyName[MED_TAILLE_NOM+1] = "";
- med_int aFamilyNum;
- ret = MEDfamInfo(fid,aMeshName,aFamInd,aFamilyName,&aFamilyNum,
- &anAttId[0],&anAttVal[0],&anAttDesc[0],&aNbAttrib,
- &aGroupNames[0],&aNbGroup);
- if(ret < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDfamInfo"));
- if(0 && MYDEBUG)
- MESSAGE("ImportInfo - aFamilyNum = "<<aFamilyNum<<"; aNbGroup = "<<aNbGroup);
- if(aFamily2EntityMap.find(aFamilyNum) == aFamily2EntityMap.end()) {
- if(MYDEBUG) MESSAGE("ImportInfo - a Family with name '"<<aFamilyName<<"' are empty !!!");
- continue;
- }
- VISU::TEntity anEntity = aFamily2EntityMap[aFamilyNum];
- VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
- VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyName];
- aFamily.myName = aFamilyName;
- aFamily.myEntity = anEntity;
- aFamily.myId = aFamilyNum;
- aFamily.myNbCells = aFamilyNbCellsCounterMap[aFamilyNum];
- aFamily.myCellsSize = aFamilyCellsSizeCounterMap[aFamilyNum];
- if(MYDEBUG)
- MESSAGE("ImportInfo - aFamily.myEntity = "<<anEntity<<
- "; myName = '"<<aFamilyName<<
- "'; myId = "<<aFamilyNum<<
+
+ TFamilyByEntity::const_iterator aFamilyByEntityIter = aFamilyByEntity.begin();
+ BEGMSG(MYDEBUG,"TFamilyByEntity:\n");
+ for(; aFamilyByEntityIter != aFamilyByEntity.end(); aFamilyByEntityIter++){
+ const EEntiteMaillage& aMEntity = aFamilyByEntityIter->first;
+ const TFamilyGroup& aFamilyGroup = aFamilyByEntityIter->second;
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
+
+ INITMSG(MYDEBUG,"aMEntity = "<<aMEntity<<"; aVEntity = "<<aVEntity<<"\n");
+ TFamilyGroup::const_iterator aFamilyGroupIter = aFamilyGroup.begin();
+ for(; aFamilyGroupIter != aFamilyGroup.end(); aFamilyGroupIter++){
+ const PFamilyInfo& aFamilyInfo = *aFamilyGroupIter;
+ if (aFamilyInfo->GetId() == 0) continue;
+ VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyInfo->GetName()];
+
+ aFamily.myId = aFamilyInfo->GetId();
+ aFamily.myName = aFamilyInfo->GetName();
+ aFamily.myEntity = aVEntity;
+ aFamily.myNbCells = aFamilyNbCellsCounterMap[aFamily.myId];
+ aFamily.myCellsSize = aFamilyCellsSizeCounterMap[aFamily.myId];
+
+ INITMSG(MYDEBUG,"aFamilyName = '"<<aFamily.myName<<
+ "'; myId = "<<aFamily.myId<<"; "<<
+ "; aNbAttr = "<<aFamilyInfo->GetNbAttr()<<
+ "; aNbGroup = "<<aFamilyInfo->GetNbGroup()<<
+ "; myEntity = "<<aFamily.myEntity<<
"; myNbCells = "<<aFamily.myNbCells<<
- "; myCellsSize = "<<aFamily.myCellsSize);
- VISU::TBindGroups& aBindGroups = aFamily.myGroups;
- for(int iGroup = 0, iPos = 0; iGroup < aNbGroup; iGroup++, iPos += MED_TAILLE_LNOM){
- char aGroupName[MED_TAILLE_LNOM+1];
- strncpy(aGroupName,&aGroupNames[iPos],MED_TAILLE_LNOM);
- aGroupName[MED_TAILLE_LNOM] = '\0';
- if(MYDEBUG) MESSAGE("ImportInfo - aGroupName["<<iGroup<<"] = '"<<aGroupName<<"'");
- aBindGroups.insert(aGroupName);
+ "; myCellsSize = "<<aFamily.myCellsSize<<"\n");
+
+ VISU::TBindGroups& aBindGroups = aFamily.myGroups;
+ const TInt aNbGroup = aFamilyInfo->GetNbGroup();
+ for(TInt i = 0; i < aNbGroup; i++){
+ const string& aGroupName = aFamilyInfo->GetGroupName(i);
+ aBindGroups.insert(aGroupName);
+ INITMSG(MYDEBUG,"aGroupName = '"<<aGroupName<<"'\n");
+ }
}
}
- //Calculation of TMesh.TGroupMap
- const VISU::TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
- if(aMeshOnEntityMap.empty()) continue;
+
+ BEGMSG(MYDEBUG,"VISU::TGroup:\n");
+
VISU::TGroupMap& aGroupMap = aMesh.myGroupMap;
- VISU::TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin();
- for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){
- const VISU::TMeshOnEntity& aMeshOnEntity = aMeshOnEntityMapIter->second;
- const VISU::TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
- if(aFamilyMap.empty()) continue;
- VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
- for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
- const VISU::TFamily& aFamily = aFamilyMapIter->second;
- const VISU::TBindGroups& aBindGroups = aFamily.myGroups;
- if(aBindGroups.empty()) continue;
- VISU::TBindGroups::const_iterator aBindGroupsIter = aBindGroups.begin();
- for(; aBindGroupsIter != aBindGroups.end(); aBindGroupsIter++){
- const string& aGroupName = *aBindGroupsIter;
- VISU::TGroup& aGroup = aGroupMap[aGroupName];
- aGroup.myName = aGroupName;
- aGroup.myMeshName = aMesh.myName;
- VISU::TFamilyAndEntity aFamilyAndEntity(aFamily.myName,aFamily.myEntity);
+ TGroupInfo::const_iterator aGroupInfoIter = aGroupInfo.begin();
+ for(;aGroupInfoIter != aGroupInfo.end(); aGroupInfoIter++){
+ const string& aGroupName = aGroupInfoIter->first;
+ const TFamilyGroup& aFamilyGroup = aGroupInfoIter->second;
+ VISU::TGroup aGroup;
+ aGroup.myName = aGroupName;
+ aGroup.myMeshName = aMesh.myName;
+
+ INITMSG(MYDEBUG,"aGroup.myName = '"<<aGroup.myName<<"'\n");
+
+ TFamilyGroup::const_iterator aFamilyIter = aFamilyGroup.begin();
+ for( ;aFamilyIter != aFamilyGroup.end(); aFamilyIter++){
+ const PFamilyInfo& aFamilyInfo = *aFamilyIter;
+ const string& aFamilyName = aFamilyInfo->GetName();
+
+ TEntity aVEntity = TEntity(-1);
+
+ // Find aVisuEntity
+ const TMeshOnEntityMap& aMeshOnEntityMap = aMesh.myMeshOnEntityMap;
+ TMeshOnEntityMap::const_iterator aMeshOnEntityIter = aMeshOnEntityMap.begin();
+ for (; aMeshOnEntityIter != aMeshOnEntityMap.end(); aMeshOnEntityIter++){
+ const TMeshOnEntity& aMeshOnEntity = aMeshOnEntityIter->second;
+ const TFamilyMap& aFamilyMap = aMeshOnEntity.myFamilyMap;
+ TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
+ for (; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
+ const string& aFamilyName = aFamilyMapIter->first;
+ const TFamily& aFamily = aFamilyMapIter->second;
+ TFamilyGroup::const_iterator aGroupInfoIter = aFamilyGroup.begin();
+ for (;aGroupInfoIter != aFamilyGroup.end(); aGroupInfoIter++){
+ const PFamilyInfo& aFamilyInfo = *aGroupInfoIter;
+ if(aFamilyInfo->GetName() == aFamilyName){
+ aVEntity = aFamily.myEntity;
+ goto exit_lable;
+ }
+ }
+ }
+ }
+ exit_lable:
+ if(aVEntity >= 0){
+ VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
+ VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyInfo->GetName()];
+ VISU::TFamilyAndEntity aFamilyAndEntity(aFamilyName,aVEntity);
aGroup.myFamilyAndEntitySet.insert(aFamilyAndEntity);
+ INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyName<<"'; aVEntity = "<<aVEntity<<"\n");
+
aGroup.myNbCells += aFamily.myNbCells;
aGroup.myCellsSize += aFamily.myCellsSize;
}
}
- }
- //Displaing information for the TMesh.TGroupMap
- VISU::TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin();
- if(MYDEBUG) MESSAGE("ImportInfo - aGroupMap.size() = "<<aGroupMap.size());
- for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){
- const VISU::TGroup& aCGroup = aGroupMapIter->second;
- const string& aGroupName = aGroupMapIter->first;
- if(MYDEBUG) MESSAGE("ImportInfo - aGroupName = '"<<aGroupName<<
- "'; myNbCells = "<<aCGroup.myNbCells<<
- "; myCellsSize = "<<aCGroup.myCellsSize);
- const VISU::TGroup& aGroup = aGroupMapIter->second;
- const VISU::TFamilyAndEntitySet& aFamilyAndEntitySet = aGroup.myFamilyAndEntitySet;
- VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = aFamilyAndEntitySet.begin();
- for(; aFamilyAndEntitySetIter != aFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
- const string& aFamilyName = aFamilyAndEntitySetIter->first;
- if(MYDEBUG) MESSAGE("ImportInfo - \t aFamilyName = '"<<aFamilyName<<"'");
+ BEGMSG(MYDEBUG,"myNbCells = "<<aGroup.myNbCells<<
+ "; myCellsSize = "<<aGroup.myCellsSize<<"\n\n");
+ if(!aGroup.myFamilyAndEntitySet.empty() && aGroup.myNbCells > 0){
+ aGroupMap.insert(VISU::TGroupMap::value_type(aGroupName,aGroup));
}
}
- }
- //Reading information about fields
- med_int iFieldEnd = MEDnChamp(fid,0);
- if (iFieldEnd < 0) throw std::runtime_error(EXCEPTION("ImportChamps >> MEDnChamp(fid,0)"));
- if(MYDEBUG) MESSAGE("ImportInfo - iFieldEnd = "<<iFieldEnd);
- for(med_int iField = 1; iField <= iFieldEnd; iField++){
- med_int ncomp = MEDnChamp(fid,iField);
- if(ncomp < 0) throw std::runtime_error(EXCEPTION("ImportChamps >> MEDnChamp(fid,i)"));
- valarray<char> aCompNames('\0',ncomp*MED_TAILLE_PNOM + 1);
- valarray<char> aUnitNames('\0',ncomp*MED_TAILLE_PNOM + 1);
- char name_field[MED_TAILLE_NOM + 1] = "";
- med_type_champ type_field;
- if(MEDchampInfo(fid,iField,name_field,&type_field,&aCompNames[0],&aUnitNames[0],ncomp) < 0)
- throw std::runtime_error(EXCEPTION("ImportInfo >> MEDchampInfo(...)"));
- //if(type_field != MED_REEL64) continue; //There is some problem in reading INTXX values
- TVisu2MedEntity::const_iterator aVisu2MedEntityIter = aVisu2MedEntity.begin();
- for(; aVisu2MedEntityIter != aVisu2MedEntity.end(); aVisu2MedEntityIter++) {
- VISU::TEntity anEntity = aVisu2MedEntityIter->first;
- int iGeomElemEnd;
- med_geometrie_element* aGeomElemVector;
- GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
- med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
- for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- med_geometrie_element& aGeom = aGeomElemVector[iGeomElem];
- med_int iTimeStampEnd = MEDnPasdetemps(fid,name_field,aMedEntity,aGeom);
- if(iTimeStampEnd < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDnPasdetemps(...)"));
- if(iTimeStampEnd > 0) {
- for(med_int iTimeStamp = 1; iTimeStamp <= iTimeStampEnd; iTimeStamp++) {
- char aMeshName[MED_TAILLE_NOM+1] = "";
- med_int ngauss = 0, numdt = 0, numo = 0;
- char dt_unit[MED_TAILLE_PNOM+1] = "";
- med_float dt = 0;
- ret = MEDpasdetempsInfo(fid,name_field,aMedEntity,aGeom,iTimeStamp,
- aMeshName,&ngauss,&numdt,dt_unit,&dt,&numo);
- if(ret < 0) throw std::runtime_error(EXCEPTION("ImportInfo >> MEDpasdetempsInfo(...) < 0"));
- if(myMeshMap.find(aMeshName) == myMeshMap.end())
- throw std::runtime_error(EXCEPTION("ImportInfo >> MEDpasdetempsInfo(...)"));
- VISU::TMesh &aMesh = myMeshMap[aMeshName];
- VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
- VISU::TFieldMap::iterator aFieldMapIter = aMeshOnEntity.myFieldMap.find(name_field);
- //if(MYDEBUG && aFieldMapIter == aMeshOnEntity.myFieldMap.end()){
- VISU::TField& aField = aMeshOnEntity.myFieldMap[name_field];
- if(iTimeStamp == 1){
- aField.myId = iField;
- aField.myName = name_field;
- aField.myEntity = anEntity;
- aField.myMeshName = aMeshName;
- aField.myNbComp = ncomp;
- aField.myNbValField = iTimeStampEnd;
- aField.myDataSize = aMeshOnEntity.myNbCells * ncomp;
- aField.myCompNames.resize(ncomp);
- aField.myUnitNames.resize(ncomp);
- if(MYDEBUG)
- MESSAGE("ImportInfo - aField.myName = '"<<name_field<<
- "'; myMeshName = '"<<aMeshName<<
- "'; myEntity = "<<anEntity<<
- "; myNbComp = "<<ncomp<<
- "; myDataSize = "<<aField.myDataSize);
- for(int iComp = 0, iPos = 0; iComp < ncomp; iComp++, iPos += MED_TAILLE_PNOM){
- char aCompName[MED_TAILLE_PNOM+1], aUnitName[MED_TAILLE_PNOM+1];
- strncpy(aCompName,&aCompNames[iPos],MED_TAILLE_PNOM);
- aCompName[MED_TAILLE_PNOM] = '\0';
- aField.myCompNames[iComp] = aCompName;
- strncpy(aUnitName,&aUnitNames[iPos],MED_TAILLE_PNOM);
- aUnitName[MED_TAILLE_PNOM] = '\0';
- aField.myUnitNames[iComp] = aUnitName;
- if(MYDEBUG)
- MESSAGE("ImportInfo - aCompName = '"<<aCompName<<"'; aUnitName = '"<<aUnitName<<"'");
- }
-
- }
- VISU::TField::TValForTime& aValForTime = aField.myValField[iTimeStamp];
- aValForTime.myId = iTimeStamp;
- aValForTime.myFieldName = aField.myName;
- aValForTime.myEntity = aField.myEntity;
- aValForTime.myMeshName = aField.myMeshName;
- aValForTime.myNbComp = aField.myNbComp;
- aValForTime.myTime = VISU::TField::TTime(dt,dt_unit);
- if(MYDEBUG)
- MESSAGE("ImportInfo -\t aValForTime.myTime = "<<dt<<", "<<dt_unit);
- }
- }
+
+ BEGMSG(MYDEBUG,"VISU::TField:\n");
+
+ TInt aNbFields = aMed->GetNbFields();
+ for(TInt iField = 1; iField <= aNbFields; iField++){
+ PFieldInfo aFieldInfo = aMed->GetPFieldInfo(aMeshInfo,iField);
+ TInt aNbComp = aFieldInfo->GetNbComp();
+ const string& aFieldName = aFieldInfo->GetName();
+
+ MED::TGeom aTGeom;
+ EEntiteMaillage aMEntity;
+ TInt aNbTimeStamps = aMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,aMEntity,aTGeom);
+
+ TEntity aVEntity = MEDEntityToVTK(aMEntity);
+ VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
+ VISU::TField& aField = aMeshOnEntity.myFieldMap[aFieldName];
+ aField.myId = iField;
+ aField.myNbComp = aNbComp;
+ aField.myEntity = aVEntity;
+ aField.myName = aFieldName;
+ aField.myMeshName = aMeshName;
+ aField.myNbValField = aNbTimeStamps;
+ aField.myDataSize = aMeshOnEntity.myNbCells * aNbComp;
+ aField.myCompNames.resize(aNbComp);
+ aField.myUnitNames.resize(aNbComp);
+
+ INITMSG(MYDEBUG,"myName = '"<<aField.myName<<
+ "'; myId = "<<aField.myId<<
+ "; myNbValField = "<<aField.myNbValField<<
+ "; myEntity = "<<aField.myEntity<<
+ "; myDataSize = "<<aField.myDataSize<<
+ "; myNbComp = "<<aField.myNbComp<<"\n");
+
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ aField.myCompNames[iComp] = aFieldInfo->GetCompName(iComp);
+ aField.myUnitNames[iComp] = aFieldInfo->GetUnitName(iComp);
+ }
+
+ for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
+ PTimeStampInfo aTimeStamp = aMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aTGeom,
+ iTimeStamp);
+ TFloat aDt = aTimeStamp->GetDt();
+ const string& anUnitDt = aTimeStamp->GetUnitDt();
+ PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStamp);
+ VISU::TField::TValForTime& aValForTime = aField.myValField[iTimeStamp];
+ aValForTime.myId = iTimeStamp;
+ aValForTime.myFieldName = aField.myName;
+ aValForTime.myEntity = aField.myEntity;
+ aValForTime.myMeshName = aField.myMeshName;
+ aValForTime.myNbComp = aField.myNbComp;
+ aValForTime.myTime = VISU::TField::TTime(aDt,anUnitDt);
+ INITMSG(MYDEBUG,"aDt = "<<aDt<<", "<<anUnitDt<<"\n");
}
}
}
+
return this;
}
int VISU_MedConvertor::LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity,
const string& theFamilyName)
{
- //Open the med file (it will be closed by call of destructor)
- MedFile aMedFile(myFileInfo.absFilePath());
- med_idt fid = aMedFile.GetFid();
- //Main part of code
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
const string& aMeshName = theMeshOnEntity.myMeshName;
const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
VISU::TMesh& aMesh = myMeshMap[aMeshName];
int isPointsUpdated;
if(anEntity == VISU::NODE_ENTITY)
- isPointsUpdated = LoadPoints(fid,aMesh,theFamilyName);
+ isPointsUpdated = LoadPoints(aMed,aMesh,theFamilyName);
else
- isPointsUpdated = LoadPoints(fid,aMesh);
- int isCellsOnEntityUpdated = LoadCellsOnEntity(fid,theMeshOnEntity,theFamilyName);
+ isPointsUpdated = LoadPoints(aMed,aMesh);
+ int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMeshOnEntity,theFamilyName);
return (isPointsUpdated || isCellsOnEntityUpdated);
}
int VISU_MedConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh,
const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
{
- //Open the med file (it will be closed by call of destructor)
- MedFile aMedFile(myFileInfo.absFilePath());
- med_idt fid = aMedFile.GetFid();
- //Main part of code
- int isPointsUpdated = 0;
- int isCellsOnEntityUpdated = 0;
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+ int isPointsUpdated = 0, isCellsOnEntityUpdated = 0;
VISU::TFamilyAndEntitySet::const_iterator aFamilyAndEntitySetIter = theFamilyAndEntitySet.begin();
for(; aFamilyAndEntitySetIter != theFamilyAndEntitySet.end(); aFamilyAndEntitySetIter++){
const string& aFamilyName = aFamilyAndEntitySetIter->first;
const VISU::TEntity& anEntity = aFamilyAndEntitySetIter->second;
VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[anEntity];
if(anEntity == VISU::NODE_ENTITY){
- isPointsUpdated += LoadPoints(fid,theMesh,aFamilyName);
- isCellsOnEntityUpdated += LoadCellsOnEntity(fid,aMeshOnEntity);
+ isPointsUpdated += LoadPoints(aMed,theMesh,aFamilyName);
+ isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,aMeshOnEntity);
}else{
- isPointsUpdated += LoadPoints(fid,theMesh);
- isCellsOnEntityUpdated += LoadCellsOnEntity(fid,aMeshOnEntity,aFamilyName);
+ isPointsUpdated += LoadPoints(aMed,theMesh);
+ isCellsOnEntityUpdated += LoadCellsOnEntity(aMed,aMeshOnEntity,aFamilyName);
}
}
VISU::TField& theField,
VISU::TField::TValForTime& theValForTime)
{
- //Open the med file (it will be closed by call of destructor)
- MedFile aMedFile(myFileInfo.absFilePath());
- med_idt fid = aMedFile.GetFid();
- //Main part of code
- int isPointsUpdated = LoadPoints(fid,theMesh);
- int isCellsOnEntityUpdated = LoadCellsOnEntity(fid,theMeshOnEntity);
- int isFieldUpdated = LoadField(fid,theMeshOnEntity,theField,theValForTime);
+ PWrapper aMed = CrWrapper(myFileInfo.absFilePath().latin1());
+ int isPointsUpdated = LoadPoints(aMed,theMesh);
+ int isCellsOnEntityUpdated = LoadCellsOnEntity(aMed,theMeshOnEntity);
+ int isFieldUpdated = LoadField(aMed,theMeshOnEntity,theField,theValForTime);
return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
}
-int VISU_MedConvertor::LoadPoints(const med_idt& fid, VISU::TMesh& theMesh, const string& theFamilyName)
+
+int
+VISU_MedConvertor::LoadPoints(const MED::PWrapper& theMed,
+ VISU::TMesh& theMesh,
+ const string& theFamilyName)
{
try{
//Check on existing family
if(isPointsLoaded)
if(!isFamilyPresent) return 0;
else if(!aFamily.mySubMesh.empty()) return 0;
- if(MYDEBUG)
- MESSAGE("LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'");
+
+ INITMSG(MYDEBUG,"LoadPoints - isPointsLoaded = "<<isPointsLoaded<<"; theFamilyName = '"<<theFamilyName<<"'\n");
+
//Main part of code
- char aMeshName[MED_TAILLE_NOM+1] = "";
- strcpy(aMeshName,theMesh.myName.c_str());
- med_geometrie_element typgeo = (med_geometrie_element)0; //MED_POINT1
- med_connectivite typco = (med_connectivite)0; //MED_NOD
- med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,typgeo,typco);
- if (iNumElemEnd <= 0) throw std::runtime_error(EXCEPTION("LoadPoints >> MEDnEntMaa(...)"));
- if(MYDEBUG) MESSAGE("LoadPoints - iNumElemEnd = "<<iNumElemEnd);
- med_repere rep;
- med_booleen iname_elem, inum_elem;
- valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
- valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
- valarray<char> name_coord('\0',theMesh.myDim*MED_TAILLE_PNOM+1);
- valarray<char> unit_coord('\0',theMesh.myDim*MED_TAILLE_PNOM+1);
- valarray<med_float> coord(theMesh.myDim*iNumElemEnd);
- ret = MEDnoeudsLire(fid,aMeshName,theMesh.myDim,&coord[0],MED_FULL_INTERLACE,&rep,
- &name_coord[0],&unit_coord[0],&name_elem[0],&iname_elem,
- &num_elem[0],&inum_elem,&num_fam_elem[0],iNumElemEnd);
- if(ret < 0) throw std::runtime_error(EXCEPTION("LoadPoints >> MEDnoeudsLire(...)"));
- if(!isPointsLoaded){
+ PNodeInfo aNodeInfo = theMed->GetPNodeInfo(theMesh.myMeshInfo);
+ TInt aNbElem = aNodeInfo->GetNbElem();
+ if(!isPointsLoaded){
VISU::TMesh::TPointsDim& aPointsDim = theMesh.myPointsDim;
aPointsDim.resize(theMesh.myDim);
- for(int iDim = 0, iPos = 0; iDim < theMesh.myDim; iDim++, iPos += MED_TAILLE_PNOM){
- char aCoordName[MED_TAILLE_PNOM+1];
- strncpy(aCoordName,&name_coord[iPos],MED_TAILLE_PNOM);
- aCoordName[MED_TAILLE_PNOM] = '\0';
- aPointsDim[iDim] = aCoordName;
- }
+ for(int iDim = 0; iDim < theMesh.myDim; iDim++)
+ aPointsDim[iDim] = aNodeInfo->GetCoordName(iDim);
VISU::TMesh::TPointsCoord& aPointsCoord = theMesh.myPointsCoord;
- aPointsCoord.resize(iNumElemEnd*theMesh.myDim);
- if(MYDEBUG) MESSAGE("LoadPoints - Filling coordinates of the mesh - inum_elem = "<<inum_elem);
- inum_elem = MED_FAUX; // It is workaround
- if(inum_elem == MED_FAUX)
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
- aPointsCoord[iNumElem2Dim] = coord[iNumElem2Dim];
- else
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- for(int iDim = 0, iNumElem2Dim = iNumElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iNumElem2Dim++)
- aPointsCoord[num_elem[iNumElem2Dim]] = coord[iNumElem2Dim];
- if(MYDEBUG) MESSAGE("LoadPoints - Filling aMeshOnEntity with type NODE_ENTITY");
+ aPointsCoord.resize(aNbElem*theMesh.myDim);
+ for (int iElem = 0; iElem < aNbElem; iElem++)
+ for(int iDim = 0, iElem2Dim = iElem*theMesh.myDim; iDim < theMesh.myDim; iDim++, iElem2Dim++)
+ aPointsCoord[iElem2Dim] = aNodeInfo->GetNodeCoord(iElem,iDim);
+
VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aMeshOnEntity.myCellsConn[VTK_VERTEX];
- aConnForCellType.resize(iNumElemEnd);
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- aConnForCellType[iNumElem] = VISU::TMeshOnEntity::TConnect(1,iNumElem);
+ aConnForCellType.resize(aNbElem);
+ for (int iElem = 0; iElem < aNbElem; iElem++)
+ aConnForCellType[iElem] = VISU::TMeshOnEntity::TConnect(1,iElem);
}
- if(isFamilyPresent && iNumElemEnd > 0){
- if(MYDEBUG) MESSAGE("LoadPoints - Filling aFamily SubMesh");
+ if(isFamilyPresent && aNbElem > 0){
VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[VTK_VERTEX];
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- if(num_fam_elem[iNumElem] == aFamily.myId)
- aSubMeshOnCellType.insert(iNumElem);
+ for (int iElem = 0; iElem < aNbElem; iElem++)
+ if(aNodeInfo->GetElemNum(iElem) == aFamily.myId)
+ aSubMeshOnCellType.insert(iElem);
}
return 1;
}catch(std::runtime_error& exc){
theMesh.myPointsCoord.clear();
- throw std::runtime_error(exc.what());
+ throw;
}catch(...){
theMesh.myPointsCoord.clear();
- throw std::runtime_error(EXCEPTION("Unknown exception !!!"));
+ EXCEPTION(runtime_error,"Unknown exception !!!");
}
return 0;
}
-int VISU_MedConvertor::LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity& theMeshOnEntity,
- const string& theFamilyName)
+
+int
+VISU_MedConvertor::LoadCellsOnEntity(const MED::PWrapper& theMed,
+ VISU::TMeshOnEntity& theMeshOnEntity,
+ const string& theFamilyName)
{
try{
//Check on existing family
if(isCellsLoaded)
if(!isFamilyPresent) return 0;
else if(!aFamily.mySubMesh.empty()) return 0;
- if(MYDEBUG) {
- MESSAGE("LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'");
- MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent);
- }
- //Main part of code
- int iGeomElemEnd;
- med_geometrie_element* aGeomElemVector;
- const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
- GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
- const med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
- char aMeshName[MED_TAILLE_NOM+1] = "";
- strcpy(aMeshName,theMeshOnEntity.myMeshName.c_str());
- if(MYDEBUG)
- MESSAGE("LoadCellsOnEntity - theMeshOnEntity.myEntity = "<<theMeshOnEntity.myEntity<<
- "; iGeomElemEnd = "<<iGeomElemEnd<<"; theFamilyName = '"<<theFamilyName<<"'");
- VISU::TMesh &aMesh = myMeshMap[theMeshOnEntity.myMeshName];
- int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
- valarray<med_int> num_node(aNbPoints);
- med_booleen inum_node =
- med_booleen(MEDnumLire(fid,aMeshName,&num_node[0],aNbPoints,MED_NOEUD,med_geometrie_element(0)) >= 0);
- if(MYDEBUG) MESSAGE("LoadCellsOnEntity - inum_node = "<<inum_node);
+
+ INITMSG(MYDEBUG,"LoadCellsOnEntity - theFamilyName = '"<<theFamilyName<<"'\n");
+ BEGMSG(MYDEBUG,"LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent<<endl);
+
+ const VISU::TEntity& aVEntity = theMeshOnEntity.myEntity;
+ const EEntiteMaillage& aMEntity = VTKEntityToMED(aVEntity);
+ const std::string& aMeshName = theMeshOnEntity.myMeshName;
+
+ VISU::TMesh& aMesh = myMeshMap[aMeshName];
+ const PMeshInfo& aMeshInfo = aMesh.myMeshInfo;
+
+ PNodeInfo aNodeInfo = theMed->GetPNodeInfo(aMesh.myMeshInfo);
+ TInt aNbPoints = aNodeInfo->GetNbElem();
+
+ std::map<TInt,TInt> aNodeIdMap;
#ifdef _EDF_NODE_IDS_
- inum_node = MED_FAUX;
+ EBooleen anIsNodeNum = eFAUX;
+#else
+ EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
+ if(anIsNodeNum){
+ for(TInt i = 0; i < aNbPoints; i++){
+ aNodeIdMap[aNodeInfo->GetElemNum(i)-1] = i;
+ }
+ }
#endif
- map<med_int,med_int> node_map;
- if(inum_node)
- for(int i = 0; i < aNbPoints; i++)
- node_map[num_node[i]-1] = i;
- for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- int medId = getIdMedType(aGeomElemVector[iGeomElem]);
- int nbMedNodes = med2vtk[medId].medNbNodes;
- int nbVtkNodes = med2vtk[medId].vtkNbNodes;
- int aVtkType = med2vtk[medId].vtkType;
- med_geometrie_element aMedType = med2vtk[medId].medType;
- med_int iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aMedType,MED_NOD);
- if (iNumElemEnd > 0) {
- med_booleen iname_elem, inum_elem;
- valarray<med_int> num_elem(iNumElemEnd), num_fam_elem(iNumElemEnd);
- valarray<char> name_elem('\0',iNumElemEnd*MED_TAILLE_PNOM+1);
- med_int aNbConnForElem = getNbMedConnect(aMedType,anEntity,aMesh.myDim);
- if(MYDEBUG) MESSAGE("LoadCellsOnEntity - medName = "<<med2vtk[medId].medName<<
- "; iNumElemEnd = "<<iNumElemEnd<<"; aNbConnForElem = "<<aNbConnForElem);
- valarray<med_int> conn(aNbConnForElem*iNumElemEnd);
- ret = MEDelementsLire(fid,aMeshName,aMesh.myDim,&conn[0],MED_FULL_INTERLACE,
- &name_elem[0],&iname_elem,&num_elem[0],&inum_elem,
- &num_fam_elem[0],iNumElemEnd,aMedEntity,aMedType,MED_NOD);
- if (ret < 0) throw std::runtime_error(EXCEPTION("LoadCellsOnEntity >> MEDelementsLire(...)"));
- if(!isCellsLoaded){
- VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVtkType];
- aConnForCellType.resize(iNumElemEnd);
- valarray<med_int> aConnect(nbMedNodes);
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
- VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iNumElem];
- anArray.resize(nbVtkNodes);
- if(inum_node)
- for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++)
- aConnect[k] = node_map[conn[kj+k]-1];
- else
- for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++)
- aConnect[k] = conn[kj+k] - 1;
- switch(aMedType){
- case MED_TETRA4 :
- case MED_TETRA10 :
- anArray[0] = aConnect[0];
- anArray[1] = aConnect[1];
- anArray[2] = aConnect[3];
- anArray[3] = aConnect[2];
- break;
- case MED_PYRA5 :
- case MED_PYRA13 :
- anArray[0] = aConnect[0];
- anArray[1] = aConnect[3];
- anArray[2] = aConnect[2];
- anArray[3] = aConnect[1];
- anArray[4] = aConnect[4];
- break;
- default:
- for (int k = 0; k < nbVtkNodes; k++)
- anArray[k] = aConnect[k];
- }
- for (int k = 0; k < nbVtkNodes; k++)
- if(anArray[k] < 0 || aNbPoints <= anArray[k])
- throw std::runtime_error(EXCEPT("ImportCells >> aNbPoints(%1) <= anArray[%2][%3](%4) < 0").
- arg(aNbPoints).arg(iNumElem).arg(k).arg(anArray[k]).latin1());
- }
- }
- //Filling aFamily SubMesh
- if(isFamilyPresent){
- VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVtkType];
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- if(num_fam_elem[iNumElem] == aFamily.myId)
- aSubMeshOnCellType.insert(iNumElem);
- }
+
+ const MED::TGeom& aTGeom = theMeshOnEntity.myGeom;
+ MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
+ TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
+
+ for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
+ const EGeometrieElement& aGeom = anTGeomIter->first;
+ int aVTKGeomType = MEDGeomToVTK(aGeom);
+ int aVNbNodes = VTKGeom2NbNodes(aVTKGeomType);
+
+ PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,aMEntity,aGeom);
+ TInt aNbElem = aCellInfo->GetNbElem();
+
+ if(!isCellsLoaded){
+ VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aCellsConn[aVTKGeomType];
+ aConnForCellType.resize(aNbElem);
+
+ int aMNbNodes = MEDGeom2NbNodes(aGeom);
+ vector<TInt> aConnect(aMNbNodes);
+
+ for (int iElem = 0; iElem < aNbElem; iElem++) {
+ VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iElem];
+ anArray.resize(aVNbNodes);
+
+ if(anIsNodeNum){
+ for(int i = 0; i < aMNbNodes; i++){
+ aConnect[i] = aNodeIdMap[aCellInfo->GetConn(iElem,i)-1];
+ }
+ }else{
+ for(int i = 0; i < aMNbNodes; i++){
+ aConnect[i] = aCellInfo->GetConn(iElem,i)-1;
+ }
+ }
+
+ switch(aGeom){
+ case eTETRA4:
+ case eTETRA10:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[1];
+ anArray[2] = aConnect[3];
+ anArray[3] = aConnect[2];
+ break;
+ case ePYRA5:
+ case ePYRA13:
+ anArray[0] = aConnect[0];
+ anArray[1] = aConnect[3];
+ anArray[2] = aConnect[2];
+ anArray[3] = aConnect[1];
+ anArray[4] = aConnect[4];
+ break;
+ default:
+ for(int iNode = 0; iNode < aVNbNodes; iNode++)
+ anArray[iNode] = aConnect[iNode];
+ }
+ for(int iNode = 0; iNode < aVNbNodes; iNode++)
+ if(anArray[iNode] < 0 || aNbPoints <= anArray[iNode])
+ EXCEPTION(runtime_error,"ImportCells >> aNbPoints("<<aNbPoints<<") "<<
+ "<= anArray["<<iElem<<"]"<<
+ "["<<iNode<<"]"<<
+ "("<<anArray[iNode]<<") < 0");
+ }
+ }
+ //Filling aFamily SubMesh
+ if(isFamilyPresent){
+ VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVTKGeomType];
+ for(int iElem = 0; iElem < aNbElem; iElem++)
+ if(aCellInfo->GetFamNum(iElem) == aFamily.myId)
+ aSubMeshOnCellType.insert(iElem);
}
}
return 1;
}catch(std::runtime_error& exc){
theMeshOnEntity.myCellsConn.clear();
- throw std::runtime_error(exc.what());
+ throw;
}catch(...){
theMeshOnEntity.myCellsConn.clear();
- throw std::runtime_error(EXCEPTION("Unknown exception !!!"));
+ EXCEPTION(runtime_error,"Unknown exception !!!");
}
return 0;
}
-int VISU_MedConvertor::LoadField(const med_idt& fid, const VISU::TMeshOnEntity& theMeshOnEntity,
- VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
+
+int
+VISU_MedConvertor::LoadField(const MED::PWrapper& theMed,
+ const VISU::TMeshOnEntity& theMeshOnEntity,
+ VISU::TField& theField,
+ VISU::TField::TValForTime& theValForTime)
{
//Check on loading already done
if(!theValForTime.myValForCells.empty()) return 0;
+
//Main part of code
- med_int ncomp = MEDnChamp(fid,theField.myId);
- if(ncomp < 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDnChamp(fid,i)"));
- valarray<char> comp('\0',ncomp*MED_TAILLE_PNOM + 1);
- valarray<char> unit('\0',ncomp*MED_TAILLE_PNOM + 1);
- char aFieldName[MED_TAILLE_NOM + 1] = "";
- char aMeshName[MED_TAILLE_NOM+1] = "";
- strcpy(aMeshName,theValForTime.myMeshName.c_str());
- med_type_champ type_field;
- if(MEDchampInfo(fid,theField.myId,aFieldName,&type_field,&comp[0],&unit[0],ncomp) < 0)
- throw std::runtime_error(EXCEPTION("LoadField >> MEDchampInfo(...)"));
- int iGeomElemEnd;
- med_geometrie_element* aGeomElemVector;
- const VISU::TEntity& anEntity = theField.myEntity;
- GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
- med_entite_maillage& aMedEntity = aVisu2MedEntity[anEntity];
- const VISU::TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
- if(MYDEBUG){
- MESSAGE("LoadField - aMeshName = '"<<aMeshName<<"' aFieldName = '"<<aFieldName<<"'; anEntity = "<<anEntity);
- MESSAGE("LoadField - iGeomElemEnd = "<<iGeomElemEnd<<"; ncomp = "<<ncomp<<"; type_field = "<<type_field);
- }
- for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- const med_geometrie_element& aGeom = aGeomElemVector[iGeomElem];
- med_int iTimeStampEnd = MEDnPasdetemps(fid,aFieldName,aMedEntity,aGeom);
- //Checking for accordance between the mesh and the field data
- med_int iNumElemEnd = 0;
- if(aMedEntity == MED_NOEUD)
- iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_COOR,MED_NOEUD,med_geometrie_element(0),med_connectivite(0));
- else
- iNumElemEnd = MEDnEntMaa(fid,aMeshName,MED_CONN,aMedEntity,aGeom,MED_NOD);
- int medId = getIdMedType(aGeomElemVector[iGeomElem]);
- int aVtkType = med2vtk[medId].vtkType;
- if(iTimeStampEnd <= 0){
- if(iNumElemEnd > 0){
- if(!theField.myIsTrimmed){
- theField.myIsTrimmed = true;
- theField.myDataSize -= iNumElemEnd*theField.myNbComp;
- }
- //throw std::runtime_error(EXCEPT("VISU_MedConvertor::LoadField - There is no the data "
- // "for cells with type %1 of the mesh !!!").
- // arg(med2vtk[medId].medName).latin1());
- }
+ const std::string& aMeshName = theMeshOnEntity.myMeshName;
+ VISU::TMesh& aMesh = myMeshMap[aMeshName];
+ const PMeshInfo& aMeshInfo = aMesh.myMeshInfo;
+ PFieldInfo aFieldInfo = theMed->GetPFieldInfo(aMeshInfo,theField.myId);
+
+ MED::TGeom aTGeom;
+ EEntiteMaillage aMEntity;
+ theMed->GetNbTimeStamps(aFieldInfo,aMesh.myEntityInfo,aMEntity,aTGeom);
+
+ PTimeStampInfo aTimeStampInfo = theMed->GetPTimeStampInfo(aFieldInfo,
+ aMEntity,
+ aTGeom,
+ theValForTime.myId);
+ TInt aNbGauss = aTimeStampInfo->GetNbGauss();
+ TInt aNbComp = theField.myNbComp;
+
+ PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
+
+ INITMSG(MYDEBUG,"LoadField - aMeshName = '"<<aMeshName<<
+ "'; aFieldName = '"<<aFieldInfo->GetName()<<
+ "'; aMEntity = "<<aMEntity<<
+ "; anId = "<<theValForTime.myId<<endl);
+ BEGMSG(MYDEBUG,"LoadField - aNbComp = "<<aNbComp<<
+ "; aNbGauss = "<<aNbGauss<<endl);
+
+ const MED::TGeom& anEntityTGeom = theMeshOnEntity.myGeom;
+ MED::TGeom::const_iterator aTGeomIter = anEntityTGeom.begin();
+ for(; aTGeomIter != anEntityTGeom.end(); aTGeomIter++){
+ const EGeometrieElement& aGeom = aTGeomIter->first;
+ const TInt& aNbElem = aTGeomIter->second;
+
+ INITMSG(MYDEBUG,"LoadField - aGeom = "<<aGeom<<"; aNbElem = '"<<aNbElem<<endl);
+
+ if(aTGeom.find(aGeom) == aTGeom.end()){
+ theField.myDataSize -= aNbElem*theField.myNbComp;
+ theField.myIsTrimmed = true;
}else{
- med_int ngauss = 0, numdt = 0, numo = 0;
- char dt_unit[MED_TAILLE_PNOM+1] = "";
- med_float dt = 0;
- ret = MEDpasdetempsInfo(fid,aFieldName,aMedEntity,aGeom,theValForTime.myId,
- aMeshName,&ngauss,&numdt,dt_unit,&dt,&numo);
- if(ret < 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDpasdetempsInfo(...)"));
- med_int nval = MEDnVal(fid,aFieldName,aMedEntity,aGeom,numdt,numo);
- if(nval <= 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDnVal(...) - nval <= 0"));
- else{
- //Checking for accordance between the mesh and the field data
- if(iNumElemEnd <= 0)
- throw std::runtime_error(EXCEPTION("LoadField - There is no the geom. elem. on the mesh !!!"));
- static int aMaxNbGaussPts = 52; // the workaround for broken files
- if(ngauss > aMaxNbGaussPts) ngauss = 1;
- if(iNumElemEnd*ngauss != nval)
- throw std::runtime_error(EXCEPT("LoadField - Size of values (%1) and size of mesh (%2) not equal !!!").
- arg(nval).arg(iNumElemEnd*ngauss).latin1());
- VISU::TField::TValForCellsWithType &anArray = theValForTime.myValForCells[aVtkType];
- int jEnd = theField.myNbComp*nval;
- int kEnd = jEnd/ngauss;
- anArray.resize(kEnd);
- char pflname[MED_TAILLE_NOM + 1] = "";
- switch(type_field){
- case MED_REEL64 : {
- valarray<med_float> valr(jEnd);
- ret = MEDchampLire(fid,aMeshName,aFieldName,(unsigned char*)&valr[0],MED_FULL_INTERLACE,MED_ALL,
- pflname,aMedEntity,aGeom,numdt,numo);
- if(ret < 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDchampLire(...)"));
- for (med_int k = 0, j = 0; k < kEnd; k++, j += ngauss){
- for (med_int iGauss = 0; iGauss < ngauss; iGauss++)
- anArray[k] = valr[j+iGauss];
- anArray[k] /= ngauss;
+ int aVTKGeomType = MEDGeomToVTK(aGeom);
+ VISU::TField::TValForCellsWithType& anArray = theValForTime.myValForCells[aVTKGeomType];
+ anArray.resize(aNbComp*aNbElem);
+ for(TInt iElem = 0, anId = 0; iElem < aNbElem; iElem++){
+ for(TInt iComp = 0; iComp < aNbComp; iComp++, anId++){
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ anArray[anId] += aTimeStampVal->GetVal(aGeom,iElem,iComp,iGauss);
}
- break;
- }
- //case MED_INT64 : //valarray<long long> valr(jEnd);
- case MED_INT32 : //valarray<long int> valr(jEnd);
- case MED_INT : {
- valarray<med_int> valr(jEnd);
- ret = MEDchampLire(fid,aMeshName,aFieldName,(unsigned char*)&valr[0],MED_FULL_INTERLACE,MED_ALL,
- pflname,aMedEntity,aGeom,numdt,numo);
- if(ret < 0) throw std::runtime_error(EXCEPTION("LoadField >> MEDchampLire(...)"));
- for (med_int k = 0, j = 0; k < kEnd; k++, j += ngauss){
- for (med_int iGauss = 0; iGauss < ngauss; iGauss++)
- anArray[k] = valr[j+iGauss];
- anArray[k] /= ngauss;
- }
- break;
- }
- default :
- throw std::runtime_error(EXCEPTION("LoadField >> Value of med_type_champ for the field is wrong !!!"));
+ anArray[anId] /= aNbGauss;
}
- if(MYDEBUG) MESSAGE("LoadField - aGeom = "<<aGeom<<"; nval = "<<nval<<"; ngauss = "<<ngauss
- <<"; iTimeStampEnd = "<<iTimeStampEnd<<"; pflname = '"<<pflname<<"'");
}
}
}
#include "VISU_Convertor_impl.hxx"
-extern "C"{
-#include <med.h>
-}
-
class VISU_MedConvertor: public VISU_Convertor_impl{
VISU_MedConvertor();
VISU_MedConvertor(const VISU_MedConvertor&);
VISU::TMeshOnEntity& theMeshOnEntity,
VISU::TField& theField,
VISU::TField::TValForTime& theValForTime);
-
- int LoadPoints(const med_idt& fid, VISU::TMesh& theMesh,
+
+ int LoadPoints(const MED::PWrapper& theMed,
+ VISU::TMesh& theMesh,
const std::string& theFamilyName = "");
- int LoadCellsOnEntity(const med_idt& fid, VISU::TMeshOnEntity& theMeshOnEntity,
+ int LoadCellsOnEntity(const MED::PWrapper& theMed,
+ VISU::TMeshOnEntity& theMeshOnEntity,
const std::string& theFamilyName = "");
-
- int LoadField(const med_idt& fid, const VISU::TMeshOnEntity& theMeshOnEntity,
- VISU::TField& theField, VISU::TField::TValForTime& theValForTime);
-
+
+ int LoadField(const MED::PWrapper& theMed,
+ const VISU::TMeshOnEntity& theMeshOnEntity,
+ VISU::TField& theField,
+ VISU::TField::TValForTime& theValForTime);
+
};
#endif
BIN = VISUPipeLine
BIN_SRC =
-CPPFLAGS+= $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
+CPPFLAGS+= $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
+ -I${KERNEL_ROOT_DIR}/include/salome $(HDF5_INCLUDES) $(BOOST_CPPFLAGS)
+
LDFLAGS+= $(VTK_LIBS) -lSalomeVTKFilter -lVisuConvertor \
-L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace
SALOMEDS.idl \
SALOME_ModuleCatalog.idl \
SALOME_Component.idl \
- SALOMEDS_Attributes.idl \
+ SALOMEDS_Attributes.idl \
SALOME_Comm.idl
LIB_SERVER_IDL =
# additionnal information to compil and link file
CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) \
- $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
- -I${KERNEL_ROOT_DIR}/include/salome
-CXXFLAGS += -ftemplate-depth-32 $(OCC_CXXFLAGS) \
- -I${KERNEL_ROOT_DIR}/include/salome
+ $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
+ -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
+CXXFLAGS += -ftemplate-depth-32 $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += $(MED2_LIBS) $(HDF5_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeGUI -lSalomeNS \
- -lVisuObject -lVISUEngineImpl -lmed -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGS += $(QWT_LIBS) -lSalomeGUI -lSalomeNS \
+ -lVisuObject -lVISUEngineImpl -lVTKViewer -L${KERNEL_ROOT_DIR}/lib/salome
@CONCLUDE@
//VRV: porting on Qt 3.0.5
#include <qmessagebox.h>
-#include <med.h>
#include CORBA_CLIENT_HEADER(MED_Gen)
#include <vtkActor.h>
Utils_Timer timer;
timer.Start();
#endif
- if(aFileInfo.extension(false) == "med"){
- QString IsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
- bool isBuild = (IsBuild.isEmpty()? 0 : IsBuild.toInt());
- if (VisuGUI_FileDlg::IsBuild){
- aResult = GetVisuGen()->ImportFile(aFileInfo.filePath());
- if(!CORBA::is_nil(aResult.in()))
- if(VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(GetServant(aResult).in())){
- if(!pResult->IsPossible())
- QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
- tr ("ERR_CANT_BUILD_PRESENTATION"),
- tr ("VISU_BUT_OK") );
- else
- aResult->BuildAll();
- }
- }else{
- QAD_CONFIG->addSetting( "Visu:BuildResult", false );
- //aResult=(GetVisuGen()->*theImportFun)(aFileInfo.filePath()); APO: 18/12/03 - fix crash on Linux RedHat 7.1
- aResult=GetVisuGen()->ImportFile(aFileInfo.filePath()); // APO: 18/12/03 - fix crash on Linux RedHat 7.1
- QAD_CONFIG->addSetting( "Visu:BuildResult", isBuild );
- }
+ QString IsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
+ bool isBuild = (IsBuild.isEmpty()? 0 : IsBuild.toInt());
+ if (VisuGUI_FileDlg::IsBuild){
+ aResult = GetVisuGen()->ImportFile(aFileInfo.filePath());
+ if(!CORBA::is_nil(aResult.in()))
+ if(VISU::Result_i* pResult = dynamic_cast<VISU::Result_i*>(GetServant(aResult).in())){
+ if(!pResult->IsPossible())
+ QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("VISU_WARNING"),
+ tr ("ERR_CANT_BUILD_PRESENTATION"),
+ tr ("VISU_BUT_OK") );
+ else
+ aResult->BuildAll();
+ }
+ }else{
+ QAD_CONFIG->addSetting( "Visu:BuildResult", false );
+ //aResult=(GetVisuGen()->*theImportFun)(aFileInfo.filePath()); APO: 18/12/03 - fix crash on Linux RedHat 7.1
+ aResult=GetVisuGen()->ImportFile(aFileInfo.filePath()); // APO: 18/12/03 - fix crash on Linux RedHat 7.1
+ QAD_CONFIG->addSetting( "Visu:BuildResult", isBuild );
}
#ifdef CHECKTIME
timer.Stop();
VISU_Actor* aResActor = NULL;
VISU::Prs3d_i* aSrcAddr = thePrs;
for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){
- if(!SALOME_Actor::SafeDownCast(anActor))
- continue;
if(anActor->IsA("VISU_Actor")){
anVISUActor = VISU_Actor::SafeDownCast(anActor);
VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d();
LIB_SERVER_IDL = VISU_Gen.idl SALOME_Component.idl \
SALOME_Exception.idl SALOME_GenericObj.idl MED.idl
-LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl \
- SALOME_Comm.idl
+LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Comm.idl
# Executables targets
BIN =
# additionnal information to compil and link file
CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) \
- $(MED2_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \
+ $(HDF5_INCLUDES) $(QWT_INCLUDES) $(BOOST_CPPFLAGS)\
-I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(PYTHON_LIBS) $(QT_MT_LIBS) $(VTK_LIBS) $(QWT_LIBS) -lSalomeNS -lTOOLSDS \
-lVisuConvertor -lVisuPipeLine -lVisuObject -lSalomeGenericObj \
-L${KERNEL_ROOT_DIR}/lib/salome
-LIBS+= $(MED2_LIBS) $(HDF5_LIBS) -lPlot2d \
- -L${KERNEL_ROOT_DIR}/lib/salome
+LIBS+= -lPlot2d -L${KERNEL_ROOT_DIR}/lib/salome
# additional file to be cleaned
MOSTLYCLEAN =
#include <valarray>
#include <vtkCellType.h>
-using namespace VISU;
using namespace std;
#define USER_INTERLACE MED_FULL_INTERLACE
#else
static int MYDEBUG = 0;
#endif
-static med_err ret = 0;
extern "C" {
VISU_Convertor* CreateMEDConvertor(SALOMEDS::SObject_ptr theMedSObject) {
}
}
-typedef map<VISU::TEntity,SALOME_MED::medEntityMesh> TVisu2MedEntity;
-static TVisu2MedEntity aVisu2MedEntity;
-typedef map<SALOME_MED::medEntityMesh,VISU::TEntity> TMed2VisuEntity;
-static TMed2VisuEntity aMed2VisuEntity;
-static int INIT = (
- aVisu2MedEntity[VISU::CELL_ENTITY] = SALOME_MED::MED_CELL,
- aVisu2MedEntity[VISU::FACE_ENTITY] = SALOME_MED::MED_FACE,
- aVisu2MedEntity[VISU::EDGE_ENTITY] = SALOME_MED::MED_EDGE,
- aVisu2MedEntity[VISU::NODE_ENTITY] = SALOME_MED::MED_NODE,
-
- aMed2VisuEntity[SALOME_MED::MED_CELL] = VISU::CELL_ENTITY,
- aMed2VisuEntity[SALOME_MED::MED_FACE] = VISU::FACE_ENTITY,
- aMed2VisuEntity[SALOME_MED::MED_EDGE] = VISU::EDGE_ENTITY,
- aMed2VisuEntity[SALOME_MED::MED_NODE] = VISU::NODE_ENTITY,
-
- 1);
-
-static int CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = {
- SALOME_MED::MED_POINT1,
- SALOME_MED::MED_SEG2,
- SALOME_MED::MED_SEG3,
- SALOME_MED::MED_TRIA3,
- SALOME_MED::MED_QUAD4,
- SALOME_MED::MED_TRIA6,
- SALOME_MED::MED_QUAD8,
- SALOME_MED::MED_TETRA4,
- SALOME_MED::MED_PYRA5,
- SALOME_MED::MED_PENTA6,
- SALOME_MED::MED_HEXA8,
- SALOME_MED::MED_TETRA10,
- SALOME_MED::MED_PYRA13,
- SALOME_MED::MED_PENTA15,
- SALOME_MED::MED_HEXA20
-};
-
-static const int VTKCELLGEOMEND = 8;
-static int VTKCELLGEOM[VTKCELLGEOMEND] = {
- SALOME_MED::MED_POINT1,
- SALOME_MED::MED_SEG2,
- SALOME_MED::MED_TRIA3,
- SALOME_MED::MED_QUAD4,
- SALOME_MED::MED_TETRA4,
- SALOME_MED::MED_PYRA5,
- SALOME_MED::MED_PENTA6,
- SALOME_MED::MED_HEXA8
-};
-
-static int FACEGEOM[MED_NBR_GEOMETRIE_FACE] = {
- SALOME_MED::MED_TRIA3,
- SALOME_MED::MED_QUAD4,
- SALOME_MED::MED_TRIA6,
- SALOME_MED::MED_QUAD8
-};
-
-static int EDGEGEOM[MED_NBR_GEOMETRIE_ARETE] = {
- SALOME_MED::MED_SEG2,
- SALOME_MED::MED_SEG3
-};
-
-static int NODEGEOM[1] = {
- SALOME_MED::MED_POINT1,
-};
-
-void GetEntity2Geom(const VISU::TEntity& theEntity, int*& theVector, int* theEnd)
-{
- switch(theEntity){
- case VISU::CELL_ENTITY: theVector = CELLGEOM; *theEnd = MED_NBR_GEOMETRIE_MAILLE; break;
- case VISU::FACE_ENTITY: theVector = FACEGEOM; *theEnd = MED_NBR_GEOMETRIE_FACE; break;
- case VISU::EDGE_ENTITY: theVector = EDGEGEOM; *theEnd = MED_NBR_GEOMETRIE_ARETE; break;
- case VISU::NODE_ENTITY: theVector = NODEGEOM; *theEnd = 1; break;
- default:
- throw std::runtime_error("GetEntity2Geom >> theEntity is uncorrect !!!");
+namespace{
+ using namespace SALOME_MED;
+ using namespace VISU;
+
+ const int MED_NBR_GEOMETRIE_MAILLE = 15;
+
+ medGeometryElement
+ CELLGEOM[MED_NBR_GEOMETRIE_MAILLE] = {
+ MED_POINT1,
+ MED_SEG2,
+ MED_SEG3,
+ MED_TRIA3,
+ MED_QUAD4,
+ MED_TRIA6,
+ MED_QUAD8,
+ MED_TETRA4,
+ MED_PYRA5,
+ MED_PENTA6,
+ MED_HEXA8,
+ MED_TETRA10,
+ MED_PYRA13,
+ MED_PENTA15,
+ MED_HEXA20
+ };
+
+ const int MED_NBR_GEOMETRIE_FACE = 4;
+
+ medGeometryElement
+ FACEGEOM[MED_NBR_GEOMETRIE_FACE] = {
+ MED_TRIA3,
+ MED_QUAD4,
+ MED_TRIA6,
+ MED_QUAD8
+ };
+
+ const int MED_NBR_GEOMETRIE_ARETE = 2;
+
+ medGeometryElement
+ EDGEGEOM[MED_NBR_GEOMETRIE_ARETE] = {
+ MED_SEG2,
+ MED_SEG3
+ };
+
+ const int MED_NBR_GEOMETRIE_NODE = 1;
+
+ medGeometryElement
+ NODEGEOM[MED_NBR_GEOMETRIE_NODE] = {
+ MED_POINT1,
+ };
+
+ int GetEntity2Geom(const VISU::TEntity& theEntity, medGeometryElement*& theVector)
+ {
+ switch(theEntity){
+ case CELL_ENTITY: theVector = CELLGEOM; return MED_NBR_GEOMETRIE_MAILLE; break;
+ case FACE_ENTITY: theVector = FACEGEOM; return MED_NBR_GEOMETRIE_FACE; break;
+ case EDGE_ENTITY: theVector = EDGEGEOM; return MED_NBR_GEOMETRIE_ARETE; break;
+ case NODE_ENTITY: theVector = NODEGEOM; return MED_NBR_GEOMETRIE_NODE; break;
+ }
+ return -1;
}
-}
-
-struct SalomeMed2vtk {
- SALOME_MED::medGeometryElement medType;
- char *medName;
- int medNbNodes;
- int vtkType;
- char *vtkName;
- int vtkNbNodes;
-};
-
-#define CORBAMED2VTK(MEDTYPE,VTKTYPE,VTKNBNODES) \
- {SALOME_MED::MEDTYPE,#MEDTYPE,getNbMedNodes(MEDTYPE),VTKTYPE,#VTKTYPE,VTKNBNODES}
-static SalomeMed2vtk salome_med2vtk[SALOME_MED::MED_ALL_ELEMENTS] = {
- {SALOME_MED::MED_NONE,"MED_NONE",0,VTK_EMPTY_CELL,"VTK_EMPTY_CELL",0},
- CORBAMED2VTK(MED_POINT1,VTK_VERTEX,1),
- CORBAMED2VTK(MED_SEG2,VTK_LINE,2),
- CORBAMED2VTK(MED_SEG3,VTK_LINE,2),
- CORBAMED2VTK(MED_TRIA3,VTK_TRIANGLE,3),
- CORBAMED2VTK(MED_QUAD4,VTK_QUAD,4),
- CORBAMED2VTK(MED_TRIA6,VTK_TRIANGLE,3),
- CORBAMED2VTK(MED_QUAD8,VTK_QUAD,4),
- CORBAMED2VTK(MED_TETRA4,VTK_TETRA,4),
- CORBAMED2VTK(MED_PYRA5,VTK_PYRAMID,5),
- CORBAMED2VTK(MED_PENTA6,VTK_WEDGE,6),
- CORBAMED2VTK(MED_HEXA8,VTK_HEXAHEDRON,8),
- CORBAMED2VTK(MED_TETRA10,VTK_TETRA,4),
- CORBAMED2VTK(MED_PYRA13,VTK_PYRAMID,5),
- CORBAMED2VTK(MED_PENTA15,VTK_WEDGE,6),
- CORBAMED2VTK(MED_HEXA20,VTK_HEXAHEDRON,8)
-};
-#undef CORBAMED2VTK
-
-int GetIdMEDType(int medType){
- for(int i = 0; i < SALOME_MED::MED_ALL_ELEMENTS; i++)
- if(salome_med2vtk[i].medType == medType) return i;
- return -1;
-}
-
-string GetName(SALOMEDS::SObject_ptr aSObject){
- SALOMEDS::GenericAttribute_var anAttr;
- if (aSObject->FindAttribute(anAttr,"AttributeName")) {
- SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
- CORBA::String_var aString = aName->Value();
- return aString.in();
+
+ int MEDGeom2NbNodes(int theMEDGeomType)
+ {
+ switch(theMEDGeomType){
+ case MED_NONE: return 0;
+ case MED_POINT1: return 1;
+ case MED_SEG2: return 2;
+ case MED_SEG3: return 3;
+ case MED_TRIA3: return 3;
+ case MED_TRIA6: return 6;
+ case MED_QUAD4: return 4;
+ case MED_QUAD8: return 8;
+ case MED_TETRA4: return 4;
+ case MED_TETRA10: return 10;
+ case MED_HEXA8: return 8;
+ case MED_HEXA20: return 20;
+ case MED_PENTA6: return 6;
+ case MED_PENTA15: return 15;
+ case MED_PYRA5: return 5;
+ case MED_PYRA13: return 13;
+ }
+ return -1;
}
- return "";
-}
-
-
-static void GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize,
- SALOME_MED::MESH_ptr theMEDMesh,
- const VISU::TEntity& theEntity)
-{
- int iGeomElemEnd;
- int* aGeomElemVector;
- GetEntity2Geom(theEntity,aGeomElemVector,&iGeomElemEnd);
- theNbCells = theCellsSize = 0;
- const SALOME_MED::medEntityMesh& aMedEntity = aVisu2MedEntity[theEntity];
- if(MYDEBUG) MESSAGE("GetCellsSize - theEntity = "<<theEntity);
- for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
- SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
- med_int iNumElemEnd = theMEDMesh->getNumberOfElements(aMedEntity,aMedType);
- if(iNumElemEnd > 0){
- if(MYDEBUG) MESSAGE("GetCellsSize - iNumElemEnd = "<<iNumElemEnd);
- theNbCells += iNumElemEnd;
- theCellsSize += iNumElemEnd*(salome_med2vtk[medId].vtkNbNodes + 1);
+
+ int MEDGeomToVTK(medGeometryElement theMEDGeomType)
+ {
+ switch(theMEDGeomType){
+ case MED_NONE: return VTK_EMPTY_CELL;
+ case MED_POINT1: return VTK_VERTEX;
+ case MED_SEG2: return VTK_LINE;
+ case MED_SEG3: return VTK_LINE;
+ case MED_TRIA3: return VTK_TRIANGLE;
+ case MED_TRIA6: return VTK_TRIANGLE;
+ case MED_QUAD4: return VTK_QUAD;
+ case MED_QUAD8: return VTK_QUAD;
+ case MED_TETRA4: return VTK_TETRA;
+ case MED_TETRA10: return VTK_TETRA;
+ case MED_HEXA8: return VTK_HEXAHEDRON;
+ case MED_HEXA20: return VTK_HEXAHEDRON;
+ case MED_PENTA6: return VTK_WEDGE;
+ case MED_PENTA15: return VTK_WEDGE;
+ case MED_PYRA5: return VTK_PYRAMID;
+ case MED_PYRA13: return VTK_PYRAMID;
}
+ return -1;
}
-}
-
-
-static void GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize,
- SALOME_MED::FAMILY_ptr theMEDFamily)
-{
- SALOME_MED::medGeometryElement_array_var aGeom = theMEDFamily->getTypes();
- med_int iGeomElemEnd = aGeom->length();
- theNbCells = theCellsSize = 0;
- if(MYDEBUG) MESSAGE("GetCellsSize - iGeomElemEnd = "<<iGeomElemEnd);
- for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- SALOME_MED::medGeometryElement aGeomType = aGeom[iGeomElem];
- SALOME_MED::long_array_var aCellNumForType = theMEDFamily->getNumber(aGeomType);
- int medId = GetIdMEDType(aGeomType);
- med_int iNumElemEnd = aCellNumForType->length();
- if(iNumElemEnd > 0){
- if(MYDEBUG) MESSAGE("GetCellsSize - iNumElemEnd = "<<iNumElemEnd);
- theNbCells += iNumElemEnd;
- theCellsSize += iNumElemEnd*(salome_med2vtk[medId].vtkNbNodes + 1);
+
+ int VTKGeom2NbNodes(int theVTKGeomType)
+ {
+ switch(theVTKGeomType){
+ case VTK_VERTEX: return 1;
+ case VTK_LINE: return 2;
+ case VTK_TRIANGLE: return 3;
+ case VTK_QUAD: return 4;
+ case VTK_TETRA: return 4;
+ case VTK_HEXAHEDRON: return 8;
+ case VTK_WEDGE: return 6;
+ case VTK_PYRAMID: return 5;
}
+ return -1;
}
-}
-
-
-static void GetCellsSize(VISU::TMesh& theMesh,
- SALOME_MED::MESH_ptr theMEDMesh,
- const VISU::TEntity& theEntity)
-{
- VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[theEntity];
- if(theEntity == VISU::NODE_ENTITY){
- theMesh.myNbPoints = theMEDMesh->getNumberOfNodes();
- aMeshOnEntity.myNbCells = theMesh.myNbPoints;
- aMeshOnEntity.myCellsSize = 2*theMesh.myNbPoints;
- vtkIdType aNbCells, aCellsSize;
- GetCellsSize(aNbCells,aCellsSize,theMEDMesh,VISU::CELL_ENTITY);
- if(aNbCells > 0){
- VISU::TMeshOnEntity& aMeshOnCells = theMesh.myMeshOnEntityMap[VISU::CELL_ENTITY];
- aMeshOnCells.myEntity = VISU::CELL_ENTITY;
- aMeshOnCells.myMeshName = theMesh.myName;
- aMeshOnCells.myNbCells = aNbCells;
- aMeshOnCells.myCellsSize = aCellsSize;
+
+ medGeometryElement VTKGeomToMED(int theVTKGeomType)
+ {
+ switch(theVTKGeomType){
+ case VTK_VERTEX: return MED_POINT1;
+ case VTK_LINE: return MED_SEG2;
+ case VTK_TRIANGLE: return MED_TRIA3;
+ case VTK_QUAD: return MED_QUAD4;
+ case VTK_TETRA: return MED_TETRA4;
+ case VTK_HEXAHEDRON: return MED_HEXA8;
+ case VTK_WEDGE: return MED_PENTA6;
+ case VTK_PYRAMID: return MED_PYRA5;
+ }
+ return medGeometryElement(-1);
+ }
+
+ VISU::TEntity MEDEntityToVTK(medEntityMesh theMEDEntity)
+ {
+ switch(theMEDEntity){
+ case MED_NODE: return NODE_ENTITY;
+ case MED_EDGE: return EDGE_ENTITY;
+ case MED_FACE: return FACE_ENTITY;
+ case MED_CELL: return CELL_ENTITY;
}
- }else
- GetCellsSize(aMeshOnEntity.myNbCells,aMeshOnEntity.myCellsSize,theMEDMesh,theEntity);
+ return VISU::TEntity(-1);
+ }
+
+ medEntityMesh VTKEntityToMED(VISU::TEntity theVTKEntity)
+ {
+ switch(theVTKEntity){
+ case NODE_ENTITY: return MED_NODE;
+ case EDGE_ENTITY: return MED_EDGE;
+ case FACE_ENTITY: return MED_FACE;
+ case CELL_ENTITY: return MED_CELL;
+ }
+ return medEntityMesh(-1);
+ }
+
+ string GetSObjectName(SALOMEDS::SObject_ptr aSObject){
+ SALOMEDS::GenericAttribute_var anAttr;
+ if (aSObject->FindAttribute(anAttr,"AttributeName")) {
+ SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ CORBA::String_var aString = aName->Value();
+ return aString.in();
+ }
+ return "";
+ }
+
+ void
+ GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize,
+ SALOME_MED::MESH_ptr theMEDMesh,
+ const VISU::TEntity& theVEntity)
+ {
+ medGeometryElement* aGeomElems;
+ theNbCells = theCellsSize = 0;
+ int iGeomEnd = GetEntity2Geom(theVEntity,aGeomElems);
+ const medEntityMesh& aMEntity = VTKEntityToMED(theVEntity);
+ if(MYDEBUG) MESSAGE("GetCellsSize - theVEntity = "<<theVEntity);
+ for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
+ medGeometryElement aMEDGeom = aGeomElems[iGeom];
+ int iNumElemEnd = theMEDMesh->getNumberOfElements(aMEntity,aMEDGeom);
+ if(iNumElemEnd > 0){
+ if(MYDEBUG) MESSAGE("GetCellsSize - iNumElemEnd = "<<iNumElemEnd);
+ theCellsSize += iNumElemEnd*(MEDGeom2NbNodes(aMEDGeom) + 1);
+ theNbCells += iNumElemEnd;
+ }
+ }
+ }
+
+
+ void
+ GetCellsSize(vtkIdType& theNbCells, vtkIdType& theCellsSize,
+ SALOME_MED::FAMILY_ptr theMEDFamily)
+ {
+ medGeometryElement_array_var aGeom = theMEDFamily->getTypes();
+ int iGeomEnd = aGeom->length();
+ theNbCells = theCellsSize = 0;
+ if(MYDEBUG) MESSAGE("GetCellsSize - iGeomEnd = "<<iGeomEnd);
+ for(int iGeom = 0; iGeom < iGeomEnd; iGeom++) {
+ medGeometryElement aMEDGeom = aGeom[iGeom];
+ long_array_var aCellNumForType = theMEDFamily->getNumber(aMEDGeom);
+ int iNumElemEnd = aCellNumForType->length();
+ if(iNumElemEnd > 0){
+ if(MYDEBUG) MESSAGE("GetCellsSize - iNumElemEnd = "<<iNumElemEnd);
+ theNbCells += iNumElemEnd;
+ theCellsSize += iNumElemEnd*(MEDGeom2NbNodes(aMEDGeom) + 1);
+ }
+ }
+ }
+
+
+ void
+ GetCellsSize(VISU::TMesh& theMesh,
+ SALOME_MED::MESH_ptr theMEDMesh,
+ const VISU::TEntity& theEntity)
+ {
+ VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[theEntity];
+ if(theEntity == VISU::NODE_ENTITY){
+ theMesh.myNbPoints = theMEDMesh->getNumberOfNodes();
+ aMeshOnEntity.myNbCells = theMesh.myNbPoints;
+ aMeshOnEntity.myCellsSize = 2*theMesh.myNbPoints;
+ vtkIdType aNbCells, aCellsSize;
+ GetCellsSize(aNbCells,aCellsSize,theMEDMesh,VISU::CELL_ENTITY);
+ if(aNbCells > 0){
+ VISU::TMeshOnEntity& aMeshOnCells = theMesh.myMeshOnEntityMap[VISU::CELL_ENTITY];
+ aMeshOnCells.myEntity = VISU::CELL_ENTITY;
+ aMeshOnCells.myMeshName = theMesh.myName;
+ aMeshOnCells.myNbCells = aNbCells;
+ aMeshOnCells.myCellsSize = aCellsSize;
+ }
+ }else
+ GetCellsSize(aMeshOnEntity.myNbCells,aMeshOnEntity.myCellsSize,theMEDMesh,theEntity);
+ }
+
}
-VISU_Convertor* VISU_MEDFieldConvertor::Build() {
+VISU_Convertor*
+VISU_MEDFieldConvertor::Build()
+{
if(myField->_is_nil())
throw std::runtime_error("VISU_MEDFieldConvertor::Build >> myField->_is_nil() !!!");
SALOME_MED::SUPPORT_var aMEDSupport = myField->getSupport();
if(aMEDSupport->_is_nil())
throw std::runtime_error("VISU_MEDFieldConvertor::Build >> aMEDSupport->_is_nil() !!!");
- SALOME_MED::medEntityMesh aMEDEntity = aMEDSupport->getEntity();
- VISU::TEntity anEntity = aMed2VisuEntity[aMEDEntity];
+ SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
+ VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
if(aMEDMesh->_is_nil())
throw std::runtime_error("VISU_MEDFieldConvertor::Build >> aMEDMesh->_is_nil() !!!");
aMesh2.myMesh = aMEDMesh;
if(MYDEBUG) MESSAGE("VISU_MEDFieldConvertor::Build - aMeshName = "<<aMeshName<<"; myDim = "<<aMesh.myDim);
- VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
- aMeshOnEntity.myEntity = anEntity;
+ VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
+ aMeshOnEntity.myEntity = aVEntity;
aMeshOnEntity.myMeshName = aMeshName.in();
- VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
+ VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[aVEntity];
aMeshOnEntity2.mySupport = aMEDSupport;
- if(anEntity == VISU::NODE_ENTITY)
+ if(aVEntity == VISU::NODE_ENTITY)
aMesh2.myMeshOnEntityMap[VISU::CELL_ENTITY].mySupport = aMEDSupport;
- GetCellsSize(aMesh,aMEDMesh,anEntity);
+ GetCellsSize(aMesh,aMEDMesh,aVEntity);
VISU::TField& aField = aMeshOnEntity.myFieldMap[aFieldName.in()];
aField.myId = myField->getOrderNumber();
aField.myName = aFieldName.in();
- aField.myEntity = anEntity;
+ aField.myEntity = aVEntity;
aField.myMeshName = aMeshName.in();
aField.myNbComp = myField->getNumberOfComponents();
aField.myNbValField = 1;
return this;
}
-VISU_Convertor* VISU_MEDConvertor::Build() {
+
+VISU_Convertor*
+VISU_MEDConvertor::Build()
+{
if(mySObject->_is_nil())
throw std::runtime_error("VISU_MEDConvertor::Build >> mySObject->_is_nil() !!!");
SALOMEDS::Study_var aStudy = mySObject->GetStudy();
- CORBA::Object_var aMedObject = SObjectToObject(mySObject);
+ CORBA::Object_var aMedObject = VISU::SObjectToObject(mySObject);
if(!CORBA::is_nil(aMedObject)){
SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(aMedObject);
return Build(aMED);
}
-VISU_Convertor* VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
+VISU_Convertor*
+VISU_MEDConvertor::Build(SALOME_MED::MED_ptr theMED)
{
if(theMED->_is_nil()) return NULL;
CORBA::Short aTag = mySObject->Tag();
SALOMEDS::ChildIterator_var aMeshIterator = aStudy->NewChildIterator(aMeshSObj);
for(; aMeshIterator->More(); aMeshIterator->Next()){
aMeshSObj = aMeshIterator->Value();
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshSObj = '"<<::GetName(aMeshSObj)<<"'");
- CORBA::Object_var aMedMesh = SObjectToObject(aMeshSObj);
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aMeshSObj = '"<<GetSObjectName(aMeshSObj)<<"'");
+ CORBA::Object_var aMedMesh = VISU::SObjectToObject(aMeshSObj);
if(CORBA::is_nil(aMedMesh)) continue;
SALOME_MED::MESH_var aMEDMesh = SALOME_MED::MESH::_narrow(aMedMesh);
if(aMEDMesh->_is_nil()) continue;
SALOMEDS::ChildIterator_var aSupportIterator = aStudy->NewChildIterator(aMeshSObj);
for(; aSupportIterator->More(); aSupportIterator->Next()){
SALOMEDS::SObject_var aSupportSObj = aSupportIterator->Value();
- CORBA::Object_var aMedSupport = SObjectToObject(aSupportSObj);
+ CORBA::Object_var aMedSupport = VISU::SObjectToObject(aSupportSObj);
if(CORBA::is_nil(aMedSupport)) continue;
SALOME_MED::SUPPORT_var aMEDSupport = SALOME_MED::SUPPORT::_narrow(aMedSupport);
if(aMEDSupport->_is_nil()) continue;
SALOME_MED::MESH_var aMeshOnSupport = aMEDSupport->getMesh();
- SALOME_MED::medEntityMesh aMEDEntity = aMEDSupport->getEntity();
- VISU::TEntity anEntity = aMed2VisuEntity[aMEDEntity];
+ SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
+ VISU::TEntity aVEntity = MEDEntityToVTK(aMEntity);
CORBA::String_var aSupportName = aMEDSupport->getName();
if(aMEDSupport->isOnAllElements()){
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - Support isOnAllElements = '"<<aSupportName<<"' anEntity = "<<anEntity);
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - Support isOnAllElements = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
int aNbCells, aCellsSize;
//Check, if there is any data on the support?
- if(anEntity == VISU::NODE_ENTITY){
+ if(aVEntity == VISU::NODE_ENTITY){
aMesh.myNbPoints = aMeshOnSupport->getNumberOfNodes();
aNbCells = aMesh.myNbPoints;
aCellsSize = 2*aMesh.myNbPoints;
}else{
- GetCellsSize(aNbCells,aCellsSize,aMeshOnSupport,anEntity);
+ GetCellsSize(aNbCells,aCellsSize,aMeshOnSupport,aVEntity);
}
if(aNbCells == 0) continue;
- VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+ VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
aMeshOnEntity.myMeshName = aMeshName.in();
- aMeshOnEntity.myEntity = anEntity;
+ aMeshOnEntity.myEntity = aVEntity;
aMeshOnEntity.myNbCells = aNbCells;
aMeshOnEntity.myCellsSize = aCellsSize;
- VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
+ VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[aVEntity];
aMeshOnEntity2.mySupport = aMEDSupport;
}else{
SALOME_MED::FAMILY_var aMEDFamily = SALOME_MED::FAMILY::_narrow(aMedSupport);
int aNbCells, aCellsSize;
GetCellsSize(aNbCells,aCellsSize,aMEDFamily);
if(aNbCells > 0){
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFamily = '"<<aSupportName<<"' anEntity = "<<anEntity);
- VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFamily = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
+ VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aSupportName.in()];
aFamily.myName = aSupportName.in();
- aFamily.myEntity = anEntity;
+ aFamily.myEntity = aVEntity;
aFamily.myNbCells = aNbCells;
aFamily.myCellsSize = aCellsSize;
aFamily.myId = aMEDFamily->getIdentifier();
- VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[anEntity];
+ VISUMED::TMeshOnEntity& aMeshOnEntity2 = aMesh2.myMeshOnEntityMap[aVEntity];
VISUMED::TFamily& aFamily2 = aMeshOnEntity2.myFamilyMap[aSupportName.in()];
aFamily2.myFamily = aMEDFamily;
}
}
SALOME_MED::GROUP_var aMEDGroup = SALOME_MED::GROUP::_narrow(aMedSupport);
if(!aMEDGroup->_is_nil()) {
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup = '"<<aSupportName<<"' anEntity = "<<anEntity);
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup = '"<<aSupportName<<"' aVEntity = "<<aVEntity);
VISUMED::TGroupMap& aGroupMap2 = aMesh2.myGroupMap;
VISUMED::TGroup& aGroup2 = aGroupMap2[aSupportName.in()];
aGroup2.myGroup = aMEDGroup;
for(int iFamaily = 0; iFamaily < iFamilyEnd; iFamaily++){
aMEDFamily = aFamilies[iFamaily];
CORBA::String_var aFamilyName = aMEDFamily->getName();
- VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[anEntity];
+ VISU::TMeshOnEntity& aMeshOnEntity = aMesh.myMeshOnEntityMap[aVEntity];
if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aGroup - aFamilyName = '"<<aFamilyName.in()<<"'");
VISU::TFamily& aFamily = aMeshOnEntity.myFamilyMap[aFamilyName.in()];
VISU::TBindGroups& aBindGroups = aFamily.myGroups;
SALOMEDS::ChildIterator_var aFieldIterator = aStudy->NewChildIterator(aFieldSObj);
for(int iField = 0; aFieldIterator->More(); aFieldIterator->Next(), iField++){
aFieldSObj = aFieldIterator->Value();
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFieldName = '"<<::GetName(aFieldSObj)<<"'");
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aFieldName = '"<<GetSObjectName(aFieldSObj)<<"'");
SALOMEDS::ChildIterator_var aTimeStampIterator = aStudy->NewChildIterator(aFieldSObj);
for(int iTimeStamp = 1; aTimeStampIterator->More(); aTimeStampIterator->Next(), iTimeStamp++){
SALOMEDS::SObject_var aTimeStampSObj = aTimeStampIterator->Value();
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<::GetName(aTimeStampSObj)<<"'");
- CORBA::Object_var aMedField = SObjectToObject(aTimeStampSObj);
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<GetSObjectName(aTimeStampSObj)<<"'");
+ CORBA::Object_var aMedField = VISU::SObjectToObject(aTimeStampSObj);
if(CORBA::is_nil(aMedField)) continue;
SALOME_MED::FIELD_var aMEDField = SALOME_MED::FIELD::_narrow(aMedField);
if(aMEDField->_is_nil()) continue;
SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport();
if(aMEDSupport->_is_nil()) continue;
- SALOME_MED::medEntityMesh aMEDEntity = aMEDSupport->getEntity();
- VISU::TEntity anEntity = aMed2VisuEntity[aMEDEntity];
+ SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
+ VISU::TEntity anEntity = MEDEntityToVTK(aMEntity);
SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
if(aMEDMesh->_is_nil()) continue;
CORBA::String_var aMeshName = aMEDMesh->getName();
}
-VISU_Convertor* VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
+VISU_Convertor*
+VISU_MEDConvertor::Build(SALOMEDS::ChildIterator_ptr theTimeStampIterator)
{
if(theTimeStampIterator->_is_nil()) return NULL;
for(int iTimeStamp = 1; theTimeStampIterator->More(); theTimeStampIterator->Next(), iTimeStamp++){
SALOMEDS::SObject_var aTimeStampSObj = theTimeStampIterator->Value();
- if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<::GetName(aTimeStampSObj)<<"'");
- CORBA::Object_var aMedField = SObjectToObject(aTimeStampSObj);
+ if(MYDEBUG) MESSAGE("VISU_MEDConvertor::Build - aTimeStampSObj = '"<<GetSObjectName(aTimeStampSObj)<<"'");
+ CORBA::Object_var aMedField = VISU::SObjectToObject(aTimeStampSObj);
if(CORBA::is_nil(aMedField)) continue;
SALOME_MED::FIELD_var aMEDField = SALOME_MED::FIELD::_narrow(aMedField);
if(aMEDField->_is_nil()) continue;
SALOME_MED::SUPPORT_var aMEDSupport = aMEDField->getSupport();
if(aMEDSupport->_is_nil()) continue;
- SALOME_MED::medEntityMesh aMEDEntity = aMEDSupport->getEntity();
- VISU::TEntity anEntity = aMed2VisuEntity[aMEDEntity];
+ SALOME_MED::medEntityMesh aMEntity = aMEDSupport->getEntity();
+ VISU::TEntity anEntity = MEDEntityToVTK(aMEntity);
SALOME_MED::MESH_var aMEDMesh = aMEDSupport->getMesh();
if(aMEDMesh->_is_nil()) continue;
CORBA::String_var aMeshName = aMEDMesh->getName();
}
-int VISU_MEDConvertor::LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity,
- const string& theFamilyName)
+int
+VISU_MEDConvertor::LoadMeshOnEntity(VISU::TMeshOnEntity& theMeshOnEntity,
+ const string& theFamilyName)
{
//Main part of code
const string& aMeshName = theMeshOnEntity.myMeshName;
return (isPointsUpdated || isCellsOnEntityUpdated);
}
-
-int VISU_MEDConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh,
- const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
+
+
+int
+VISU_MEDConvertor::LoadMeshOnGroup(VISU::TMesh& theMesh,
+ const VISU::TFamilyAndEntitySet& theFamilyAndEntitySet)
{
//Main part of code
int isPointsUpdated = 0;
return (isPointsUpdated || isCellsOnEntityUpdated);
}
-int VISU_MEDConvertor::LoadFieldOnMesh(VISU::TMesh& theMesh,
- VISU::TMeshOnEntity& theMeshOnEntity,
- VISU::TField& theField,
- VISU::TField::TValForTime& theValForTime)
+
+int
+VISU_MEDConvertor::LoadFieldOnMesh(VISU::TMesh& theMesh,
+ VISU::TMeshOnEntity& theMeshOnEntity,
+ VISU::TField& theField,
+ VISU::TField::TValForTime& theValForTime)
{
//Main part of code
int isPointsUpdated = LoadPoints(theMesh);
return (isPointsUpdated || isCellsOnEntityUpdated || isFieldUpdated);
}
-int VISU_MEDConvertor::LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName)
+int
+VISU_MEDConvertor::LoadPoints(VISU::TMesh& theMesh, const string& theFamilyName)
{
//Check on existing family
VISU::TMeshOnEntity& aMeshOnEntity = theMesh.myMeshOnEntityMap[VISU::NODE_ENTITY];
return 1;
}
-int VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
+
+int
+VISU_MEDConvertor::LoadCellsOnEntity(VISU::TMeshOnEntity& theMeshOnEntity, const string& theFamilyName)
{
//Check on existing family
VISU::TFamily* pFamily = VISU::GetFamily(theMeshOnEntity,theFamilyName);
MESSAGE("LoadCellsOnEntity - isCellsLoaded = "<<isCellsLoaded<<"; isFamilyPresent = "<<isFamilyPresent);
}
//Main part of code
- int iGeomElemEnd;
- int* aGeomElemVector;
- const VISU::TEntity& anEntity = theMeshOnEntity.myEntity;
- GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
- const SALOME_MED::medEntityMesh& aMedEntity = aVisu2MedEntity[anEntity];
+ SALOME_MED::medGeometryElement* aGeomElems;
+ const VISU::TEntity& aVEntity = theMeshOnEntity.myEntity;
+ int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
+ const SALOME_MED::medEntityMesh& aMEntity = VTKEntityToMED(aVEntity);
VISU::TMesh &aMesh = myMeshMap[theMeshOnEntity.myMeshName];
int aNbPoints = aMesh.myPointsCoord.size()/aMesh.myDim;
if(!isCellsLoaded){
- for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
- int nbMedNodes = salome_med2vtk[medId].medNbNodes;
- int nbVtkNodes = salome_med2vtk[medId].vtkNbNodes;
- int aVtkType = salome_med2vtk[medId].vtkType;
- SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
- med_int iNumElemEnd = aMedMesh->getNumberOfElements(aMedEntity,aMedType);
+ for(int iGeom = 0, aCounter = 0; iGeom < iGeomEnd; iGeom++){
+ SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
+ int aMNbNodes = MEDGeom2NbNodes(aGeom);
+ int aVGeom = MEDGeomToVTK(aGeom);
+ int aVNbNodes = VTKGeom2NbNodes(aVGeom);
+ int iNumElemEnd = aMedMesh->getNumberOfElements(aMEntity,aGeom);
if (iNumElemEnd > 0) {
SALOME_MED::long_array_var conn =
- aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMedEntity,aMedType);
- VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVtkType];
+ aMedMesh->getConnectivity(SALOME_MED::MED_FULL_INTERLACE,SALOME_MED::MED_NODAL,aMEntity,aGeom);
+ VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = theMeshOnEntity.myCellsConn[aVGeom];
//APO - aConnForCellType.resize(iNumElemEnd);
- valarray<med_int> aConnect(nbMedNodes);
+ valarray<int> aConnect(aMNbNodes);
int aNbConnForElem = conn->length()/iNumElemEnd;
- if(MYDEBUG) MESSAGE("LoadCellsOnEntity - medName = "<<salome_med2vtk[medId].medName<<
- "; iNumElemEnd = "<<iNumElemEnd<<"; aNbConnForElem = "<<aNbConnForElem);
+ if(MYDEBUG) MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
+ "; iNumElemEnd = "<<iNumElemEnd<<
+ "; aNbConnForElem = "<<aNbConnForElem);
for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
- //APO - VISU::TMeshOnEntity::TConnect& anArray = aConnForCellType[iNumElem];
- //APO - anArray.resize(nbVtkNodes);
- VISU::TMeshOnEntity::TConnect anArray(nbVtkNodes);
- for (int k = 0, kj = iNumElem*aNbConnForElem; k < nbMedNodes; k++) {
+ VISU::TMeshOnEntity::TConnect anArray(aVNbNodes);
+ for (int k = 0, kj = iNumElem*aNbConnForElem; k < aMNbNodes; k++) {
aConnect[k] = conn[kj+k] - 1;
}
- switch(aMedType){
+ switch(aGeom){
case SALOME_MED::MED_TETRA4 :
case SALOME_MED::MED_TETRA10 :
anArray[0] = aConnect[0];
anArray[4] = aConnect[4];
break;
default:
- for (int k = 0; k < nbVtkNodes; k++)
+ for (int k = 0; k < aVNbNodes; k++)
anArray[k] = aConnect[k];
}
- for (int k = 0; k < nbVtkNodes; k++)
+ for (int k = 0; k < aVNbNodes; k++)
if(anArray[k] < 0 || aNbPoints <= anArray[k]){
static QString aString;
aString.sprintf("ImportCells >> aNbPoints(%d) <= anArray[%d][%d]=%d < 0 !!!",aNbPoints,iNumElem,k,anArray[k]);
}
//Workaround for MED Component data structure
int aSize = aConnForCellType.size();
- aMeshOnEntity2.myCellsFirstIndex[aMedType] = VISUMED::TMeshOnEntity::TIndexAndSize(aCounter,aSize);
+ aMeshOnEntity2.myCellsFirstIndex[aGeom] = VISUMED::TMeshOnEntity::TIndexAndSize(aCounter,aSize);
aCounter += aSize;
}
}
if(isFamilyPresent){
VISUMED::TFamily aFamily2 = aMeshOnEntity2.myFamilyMap[aFamily.myName];
SALOME_MED::FAMILY_var aMedFamily = aFamily2.myFamily;
- SALOME_MED::medGeometryElement_array_var aGeom = aMedFamily->getTypes();
- iGeomElemEnd = aGeom->length();
- if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomElemEnd = "<<iGeomElemEnd);
- for (int iGeomElem = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- SALOME_MED::medGeometryElement aGeomType = aGeom[iGeomElem];
- SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeomType);
- int medId = GetIdMEDType(aGeomType);
- int aVtkType = salome_med2vtk[medId].vtkType;
- SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
- VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVtkType];
- med_int iNumElemEndTmp = theMeshOnEntity.myCellsConn[aVtkType].size();
- med_int iNumElemEnd = aCellNumForType->length();
- int aCounter = aMeshOnEntity2.myCellsFirstIndex[aMedType].first;
+ SALOME_MED::medGeometryElement_array_var aGeoms = aMedFamily->getTypes();
+ iGeomEnd = aGeoms->length();
+ if(MYDEBUG) MESSAGE("LoadCellsOnEntity - iGeomEnd = "<<iGeomEnd);
+ for (int iGeom = 0; iGeom < iGeomEnd; iGeom++) {
+ SALOME_MED::medGeometryElement aGeom = aGeoms[iGeom];
+ SALOME_MED::long_array_var aCellNumForType = aMedFamily->getNumber(aGeom);
+ int aVGeom = MEDGeomToVTK(aGeom);
+ VISU::TFamily::TSubMeshOnCellType& aSubMeshOnCellType = aFamily.mySubMesh[aVGeom];
+ int iNumElemEndTmp = theMeshOnEntity.myCellsConn[aVGeom].size();
+ int iNumElemEnd = aCellNumForType->length();
+ int aCounter = aMeshOnEntity2.myCellsFirstIndex[aGeom].first;
if(MYDEBUG)
- MESSAGE("LoadCellsOnEntity - medName = "<<salome_med2vtk[medId].medName<<
- "; iNumElemEnd = "<<iNumElemEnd<<"; aCounter = "<<aCounter);
+ MESSAGE("LoadCellsOnEntity - aGeom = "<<aGeom<<
+ "; iNumElemEnd = "<<iNumElemEnd<<
+ "; aCounter = "<<aCounter);
for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++) {
int tmp = aCellNumForType[iNumElem]-aCounter-1;
if(0 > tmp || tmp >= iNumElemEndTmp) {
return 1;
}
-template<class TArray> int ImportField(TArray& theArray,
- const VISU::TMesh& theMesh,
- const VISU::TField& theField,
- VISU::TField::TValForTime& theValForTime,
- const VISU::TMeshOnEntity& theMeshOnEntity,
- const VISUMED::TMeshOnEntity& theMeshOnEntity2)
+template<class TArray>
+int
+ImportField(TArray& theArray,
+ const VISU::TMesh& theMesh,
+ const VISU::TField& theField,
+ VISU::TField::TValForTime& theValForTime,
+ const VISU::TMeshOnEntity& theMeshOnEntity,
+ const VISUMED::TMeshOnEntity& theMeshOnEntity2)
{
if(theField.myEntity == VISU::NODE_ENTITY){
VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[VTK_VERTEX];
for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
aValForCellsWithType[iNumElem] = theArray[iNumElem];
}else{
- int iGeomElemEnd;
- int* aGeomElemVector;
- const VISU::TEntity& anEntity = theField.myEntity;
- GetEntity2Geom(anEntity,aGeomElemVector,&iGeomElemEnd);
- for (int iGeomElem = 0, aCounter = 0; iGeomElem < iGeomElemEnd; iGeomElem++) {
- int medId = GetIdMEDType(aGeomElemVector[iGeomElem]);
- int aVtkType = salome_med2vtk[medId].vtkType;
- SALOME_MED::medGeometryElement aMedType = salome_med2vtk[medId].medType;
+ SALOME_MED::medGeometryElement* aGeomElems;
+ const VISU::TEntity& aVEntity = theField.myEntity;
+ int iGeomEnd = GetEntity2Geom(aVEntity,aGeomElems);
+ for(int iGeom = 0; iGeom < iGeomEnd; iGeom++){
+ SALOME_MED::medGeometryElement aGeom = aGeomElems[iGeom];
+ int aVGeom = MEDGeomToVTK(aGeom);
const VISUMED::TMeshOnEntity::TCellsFirstIndex& aCellsFirstIndex = theMeshOnEntity2.myCellsFirstIndex;
- VISUMED::TMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aMedType);
+ VISUMED::TMeshOnEntity::TCellsFirstIndex::const_iterator aCellsFirstIndexIter = aCellsFirstIndex.find(aGeom);
if(aCellsFirstIndexIter != aCellsFirstIndex.end()){
- const VISU::TMeshOnEntity::TCellsConn& aCellsConn = theMeshOnEntity.myCellsConn;
- VISU::TMeshOnEntity::TCellsConn::const_iterator aCellsConnIter = aCellsConn.find(aVtkType);
- const VISU::TMeshOnEntity::TConnForCellType& aConnForCellType = aCellsConnIter->second;
const VISUMED::TMeshOnEntity::TIndexAndSize& aIndexAndSize = aCellsFirstIndexIter->second;
int iNumElemEnd = aIndexAndSize.second;
if(MYDEBUG)
- MESSAGE("ImportField - medName = "<<salome_med2vtk[medId].medName<<
- "; aIndexAndSize = {"<<aIndexAndSize.first<<","<<aIndexAndSize.second<<"}");
- VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[aVtkType];
+ MESSAGE("ImportField - aGeom = "<<aGeom<<
+ "; aIndexAndSize = {"<<aIndexAndSize.first<<
+ ","<<aIndexAndSize.second<<"}");
+ VISU::TField::TValForCellsWithType& aValForCellsWithType = theValForTime.myValForCells[aVGeom];
aValForCellsWithType.resize(iNumElemEnd*theField.myNbComp);
- for (int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
- for (int k = 0, kj = iNumElem*theField.myNbComp; k < theField.myNbComp; k++)
+ for(int iNumElem = 0; iNumElem < iNumElemEnd; iNumElem++)
+ for(int k = 0, kj = iNumElem*theField.myNbComp; k < theField.myNbComp; k++)
aValForCellsWithType[kj+k] = theArray[aIndexAndSize.first*theField.myNbComp+kj+k];
}
}
return 1;
}
-int VISU_MEDConvertor::LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
- const VISU::TField& theField, VISU::TField::TValForTime& theValForTime)
+int
+VISU_MEDConvertor::LoadField(const VISU::TMeshOnEntity& theMeshOnEntity,
+ const VISU::TField& theField,
+ VISU::TField::TValForTime& theValForTime)
{
//Check on loading already done
if(!theValForTime.myValForCells.empty()) return 0;
#include <string>
-extern "C"{
-#include <med.h>
-}
-
namespace VISUMED{
struct TFamily{
SALOME_MED::FAMILY_var myFamily;
#ifdef _DEBUG_
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#endif
VISU::Result_var VISU::FindResult(SALOMEDS::SObject_ptr theSObject){
VISU::TFamilyMap::const_iterator aFamilyMapIter = aFamilyMap.begin();
for(; aFamilyMapIter != aFamilyMap.end(); aFamilyMapIter++){
const string& aFamilyName = aFamilyMapIter->first;
- const VISU::TFamily& aFamily = aFamilyMapIter->second;
aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s",
VISU::TFAMILY,aMeshName.c_str(),anEntity,aFamilyName.c_str());
CreateAttributes(myStudyDocument,aEntity2Entry[anEntity].c_str(),aRefFatherEntry.c_str(),
else
mySourceId = eFile;
if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = "<<mySourceId);
- myInput = CreateMedConvertor(myFileInfo.filePath().latin1());
+ myInput = CreateConvertor(myFileInfo.filePath().latin1());
QString aComment;
aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s",
GetComment(),VISU::TRESULT,myFileInfo.filePath().latin1(),
LIB_CLIENT_IDL =
-CPPFLAGS += -ftemplate-depth-32 $(PYTHON_INCLUDES) $(QT_INCLUDES) \
- $(VTK_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES)
+CPPFLAGS += -ftemplate-depth-32 $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(QT_INCLUDES) \
+ $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
LDFLAGS += $(PYTHON_LIBS) -lVisuConvertor -lVisuPipeLine
@CONCLUDE@