##
FIND_PACKAGE(SalomeMEDCoupling REQUIRED)
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ ADD_DEFINITIONS("-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+
+
OPTION(BUILD_SHARED_LIBS "Build with shared libraries." ${VTK_BUILD_SHARED_LIBS})
SET(VTK_INSTALL_RUNTIME_DIR lib)
#include "vtkAdjacentVertexIterator.h"
#include "vtkIntArray.h"
+#include "vtkLongArray.h"
#include "vtkCellData.h"
#include "vtkPointData.h"
#include "vtkCylinder.h"
return 1;
}
-std::vector<int> UnWrapByDuplicatingNodes(vtkCellArray *ca, vtkIdType& offset, const MEDCoupling::DataArrayDouble *thetas)
+std::vector<mcIdType> UnWrapByDuplicatingNodes(vtkCellArray *ca, vtkIdType& offset, const MEDCoupling::DataArrayDouble *thetas)
{
- std::vector<int> ret;
+ std::vector<mcIdType> ret;
vtkIdType nbCells(ca->GetNumberOfCells());
vtkIdType *conn(ca->GetPointer());
const double *tptr(thetas->begin());
throw MZCException("Expecting unstructured one !");
MEDCoupling::MCAuto<MEDCoupling::MEDCouplingUMesh> m0(mmu->getMeshAtLevel(0));
{
- int v(0);
- MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> c0s(m0->getCellIdsLyingOnNodes(&v,&v+1,false));
+ mcIdType v(0);
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> c0s(m0->getCellIdsLyingOnNodes(&v,&v+1,false));
if(c0s->empty())
throw MZCException("Orphan node 0 !");
- std::vector<int> nodes0;
+ std::vector<mcIdType> nodes0;
m0->getNodeIdsOfCell(c0s->getIJ(0,0),nodes0);
MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> tmp0(c_cyl->selectByTupleIdSafe(nodes0.data(),nodes0.data()+nodes0.size()));
tmp0=tmp0->keepSelectedComponents({1});
{
MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> c_cyl_2(c_cyl->keepSelectedComponents({1}));
c_cyl_2->abs();
- MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> poses(c_cyl_2->findIdsInRange(0.,eps));
+ MEDCoupling::MCAuto<MEDCoupling::DataArrayIdType> poses(c_cyl_2->findIdsInRange(0.,eps));
c_cyl->setPartOfValuesSimple3(0.,poses->begin(),poses->end(),1,2,1);
}
//
}
vtkCellArray *cb(outdata->GetPolys());
vtkIdType offset(nbNodes);
- std::vector<int> dupNodes(UnWrapByDuplicatingNodes(cb,offset,c_cyl_post));
+ std::vector<mcIdType> dupNodes(UnWrapByDuplicatingNodes(cb,offset,c_cyl_post));
//
MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> c_cyl_post2(c_cyl_post->selectByTupleId(dupNodes.data(),dupNodes.data()+dupNodes.size()));
c_cyl_post2->applyLin(1.,2*M_PI);
continue;
unsigned char newCellType = VTK_EMPTY_CELL;
- unsigned char oldCellType = cell->GetCellType();
+ unsigned char oldCellType = (unsigned char)cell->GetCellType();
switch(oldCellType)
{
case VTK_TRIANGLE :
y = y / aScaleFactor;
double x_point, y_point;
- for (int r = 0; r < circle.size(); r++)
+ for (std::size_t r = 0; r < circle.size(); r++)
{
x_point = (x*circle[r]).real();
y_point = (y*circle[r]).real();
anIter->Delete();
this->FieldList->Reset();
- this->FieldList->SetNumberOfValues(aList.size());
+ this->FieldList->SetNumberOfValues((vtkIdType)aList.size());
list<string>::const_iterator anIterName;
int i = 0;
for (anIterName = aList.begin(); anIterName != aList.end(); anIterName++)
LIST(APPEND CMAKE_MODULE_PATH "${MEDCOUPLING_ROOT_DIR}/cmake_files")
FIND_PACKAGE(SalomeMEDCoupling REQUIRED)
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ ADD_DEFINITIONS("-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+
OPTION(BUILD_SHARED_LIBS "Build with shared libraries." ${VTK_BUILD_SHARED_LIBS})
SET(VTK_INSTALL_RUNTIME_DIR lib)
#include <sstream>
using MEDCoupling::DataArray;
-using MEDCoupling::DataArrayInt;
+using MEDCoupling::DataArrayInt32;
+using MEDCoupling::DataArrayInt64;
using MEDCoupling::DataArrayDouble;
using MEDCoupling::MEDCouplingMesh;
using MEDCoupling::MEDCouplingUMesh;
FIND_PACKAGE(SalomeMEDCoupling REQUIRED)
FIND_PACKAGE(SalomeMEDFile REQUIRED)
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ ADD_DEFINITIONS("-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+
SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS}
${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON})
SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS})
#include "InterpKernelGaussCoords.hxx"
#include "MEDFileData.hxx"
#include "SauvReader.hxx"
+#include "MEDCouplingMemArray.txx"
#ifdef MEDREADER_USE_MPI
#include "ParaMEDFileMesh.hxx"
#include "vtkIdTypeArray.h"
#include "vtkDoubleArray.h"
#include "vtkIntArray.h"
+#include "vtkLongArray.h"
#include "vtkFloatArray.h"
#include "vtkCellArray.h"
#include "vtkPointData.h"
for(vtkIdType cellId=0;cellId<ncell;cellId++)
{
vtkCell *cell(ds->GetCell(cellId));
- int delta(m[cell->GetCellType()]);
+ int delta(m[(unsigned char)cell->GetCellType()]);
pt[cellId]=offset;
offset+=delta;
}
typedef MEDCoupling::DataArrayInt MCType;
};
+template<>
+class MEDFileVTKTraits<long>
+{
+public:
+ typedef vtkLongArray VtkType;
+ typedef MEDCoupling::DataArrayInt64 MCType;
+};
+
template<>
class MEDFileVTKTraits<float>
{
typedef MEDCoupling::DataArrayDouble MCType;
};
+typedef typename MEDFileVTKTraits<mcIdType>::VtkType vtkMCIdTypeArray;
+
+
template<class T>
void AssignDataPointerToVTK(typename MEDFileVTKTraits<T>::VtkType *vtkTab, typename MEDFileVTKTraits<T>::MCType *mcTab, bool noCpyNumNodes)
{
template<class VTKT, class MCT>
void AssignDataPointerOther(VTKT *vtkTab, MCT *mcTab, int nbElems)
{
- vtkTab->SetVoidArray(reinterpret_cast<unsigned char *>(mcTab->getPointer()),nbElems,0,VTKT::VTK_DATA_ARRAY_FREE);
- mcTab->accessToMemArray().setSpecificDeallocator(0);
+ typedef typename VTKT::ValueType VTKType;
+ if ( sizeof( VTKType ) == sizeof( typename MCT::Type ))
+ {
+ vtkTab->SetVoidArray(reinterpret_cast<unsigned char *>(mcTab->getPointer()),nbElems,0,VTKT::VTK_DATA_ARRAY_FREE);
+ mcTab->accessToMemArray().setSpecificDeallocator(0);
+ }
+ else
+ {
+ VTKType* newArray = new VTKType[ nbElems ];
+ std::copy( mcTab->begin(), mcTab->begin() + nbElems, newArray );
+ vtkTab->SetVoidArray(reinterpret_cast<unsigned char *>(newArray),nbElems,0,VTKT::VTK_DATA_ARRAY_DELETE);
+ }
}
template<class T>
const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_DELETE;
typename MEDFileVTKTraits<T>::MCType *vi(static_cast<typename MEDFileVTKTraits<T>::MCType *>(vPtr));
typename MEDFileVTKTraits<T>::VtkType *vtkd(MEDFileVTKTraits<T>::VtkType::New());
- vtkd->SetNumberOfComponents(vi->getNumberOfComponents());
- for(int i=0;i<vi->getNumberOfComponents();i++)
+ vtkd->SetNumberOfComponents((int)vi->getNumberOfComponents());
+ for(unsigned int i=0;i<vi->getNumberOfComponents();i++)
vtkd->SetComponentName(i,vi->getVarOnComponent(i).c_str());
AssignDataPointerToVTK<T>(vtkd,vi,noCpyNumNodes);
std::string name(tr->buildName(crudeName));
{
DataArrayDouble *coordsMC(0);
DataArrayByte *typesMC(0);
- DataArrayInt *cellLocationsMC(0),*cellsMC(0),*faceLocationsMC(0),*facesMC(0);
+ DataArrayIdType *cellLocationsMC(0),*cellsMC(0),*faceLocationsMC(0),*facesMC(0);
bool statusOfCoords(mm->buildVTUArrays(coordsMC,typesMC,cellLocationsMC,cellsMC,faceLocationsMC,facesMC));
MCAuto<DataArrayDouble> coordsSafe(coordsMC);
MCAuto<DataArrayByte> typesSafe(typesMC);
- MCAuto<DataArrayInt> cellLocationsSafe(cellLocationsMC),cellsSafe(cellsMC),faceLocationsSafe(faceLocationsMC),facesSafe(facesMC);
+ MCAuto<DataArrayIdType> cellLocationsSafe(cellLocationsMC),cellsSafe(cellsMC),faceLocationsSafe(faceLocationsMC),facesSafe(facesMC);
//
int nbOfCells(typesSafe->getNbOfElems());
vtkUnstructuredGrid *ret(vtkUnstructuredGrid::New());
vtkUnsignedCharArray *cellTypes(vtkUnsignedCharArray::New());
AssignDataPointerOther<vtkUnsignedCharArray,DataArrayByte>(cellTypes,typesSafe,nbOfCells);
vtkIdTypeArray *cellLocations(vtkIdTypeArray::New());
- AssignDataPointerOther<vtkIdTypeArray,DataArrayInt>(cellLocations,cellLocationsSafe,nbOfCells);
+ AssignDataPointerOther<vtkIdTypeArray,DataArrayIdType>(cellLocations,cellLocationsSafe,nbOfCells);
vtkCellArray *cells(vtkCellArray::New());
vtkIdTypeArray *cells2(vtkIdTypeArray::New());
- AssignDataPointerOther<vtkIdTypeArray,DataArrayInt>(cells2,cellsSafe,cellsSafe->getNbOfElems());
+ AssignDataPointerOther<vtkIdTypeArray,DataArrayIdType>(cells2,cellsSafe,cellsSafe->getNbOfElems());
cells->SetCells(nbOfCells,cells2);
cells2->Delete();
if(faceLocationsMC!=0 && facesMC!=0)
{
vtkIdTypeArray *faces(vtkIdTypeArray::New());
- AssignDataPointerOther<vtkIdTypeArray,DataArrayInt>(faces,facesSafe,facesSafe->getNbOfElems());
+ AssignDataPointerOther<vtkIdTypeArray,DataArrayIdType>(faces,facesSafe,facesSafe->getNbOfElems());
vtkIdTypeArray *faceLocations(vtkIdTypeArray::New());
- AssignDataPointerOther<vtkIdTypeArray,DataArrayInt>(faceLocations,faceLocationsSafe,faceLocationsSafe->getNbOfElems());
+ AssignDataPointerOther<vtkIdTypeArray,DataArrayIdType>(faceLocations,faceLocationsSafe,faceLocationsSafe->getNbOfElems());
ret->SetCells(cellTypes,cellLocations,cells,faceLocations,faces);
faceLocations->Delete();
faces->Delete();
{
int meshStr[3]={1,1,1};
DataArrayDouble *coords(0);
- std::vector<int> nodeStrct;
+ std::vector<mcIdType> nodeStrct;
bool isInternal;
mm->buildVTUArrays(coords,nodeStrct,isInternal);
std::size_t dim(nodeStrct.size());
//
appendFields(tr,globs,mml,meshes,ret,internalInfo);
// The arrays links to mesh
- DataArrayInt *famCells(0),*numCells(0);
+ DataArrayIdType *famCells(0),*numCells(0);
bool noCpyFamCells(false),noCpyNumCells(false);
ptMML2->retrieveFamilyIdsOnCells(famCells,noCpyFamCells);
if(famCells)
{
- vtkIntArray *vtkTab(vtkIntArray::New());
+ vtkMCIdTypeArray *vtkTab(vtkMCIdTypeArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::FAMILY_ID_CELL_NAME);
- AssignDataPointerToVTK<int>(vtkTab,famCells,noCpyFamCells);
+ AssignDataPointerToVTK<mcIdType>(vtkTab,famCells,noCpyFamCells);
ret->GetCellData()->AddArray(vtkTab);
vtkTab->Delete();
famCells->decrRef();
ptMML2->retrieveNumberIdsOnCells(numCells,noCpyNumCells);
if(numCells)
{
- vtkIntArray *vtkTab(vtkIntArray::New());
+ vtkMCIdTypeArray *vtkTab(vtkMCIdTypeArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::NUM_ID_CELL_NAME);
- AssignDataPointerToVTK<int>(vtkTab,numCells,noCpyNumCells);
+ AssignDataPointerToVTK<mcIdType>(vtkTab,numCells,noCpyNumCells);
ret->GetCellData()->AddArray(vtkTab);
vtkTab->Delete();
numCells->decrRef();
}
// The arrays links to mesh
- DataArrayInt *famNodes(0),*numNodes(0);
+ DataArrayIdType *famNodes(0),*numNodes(0);
bool noCpyFamNodes(false),noCpyNumNodes(false);
ptMML2->retrieveFamilyIdsOnNodes(famNodes,noCpyFamNodes);
if(famNodes)
{
- vtkIntArray *vtkTab(vtkIntArray::New());
+ vtkMCIdTypeArray *vtkTab(vtkMCIdTypeArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::FAMILY_ID_NODE_NAME);
- AssignDataPointerToVTK<int>(vtkTab,famNodes,noCpyFamNodes);
+ AssignDataPointerToVTK<mcIdType>(vtkTab,famNodes,noCpyFamNodes);
ret->GetPointData()->AddArray(vtkTab);
vtkTab->Delete();
famNodes->decrRef();
ptMML2->retrieveNumberIdsOnNodes(numNodes,noCpyNumNodes);
if(numNodes)
{
- vtkIntArray *vtkTab(vtkIntArray::New());
+ vtkMCIdTypeArray *vtkTab(vtkMCIdTypeArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::NUM_ID_NODE_NAME);
- AssignDataPointerToVTK<int>(vtkTab,numNodes,noCpyNumNodes);
+ AssignDataPointerToVTK<mcIdType>(vtkTab,numNodes,noCpyNumNodes);
ret->GetPointData()->AddArray(vtkTab);
vtkTab->Delete();
numNodes->decrRef();
}
// Global Node Ids if any ! (In // mode)
- DataArrayInt *gni(ptMML2->retrieveGlobalNodeIdsIfAny());
+ DataArrayIdType *gni(ptMML2->retrieveGlobalNodeIdsIfAny());
if(gni)
{
- vtkIntArray *vtkTab(vtkIntArray::New());
+ vtkMCIdTypeArray *vtkTab(vtkMCIdTypeArray::New());
vtkTab->SetNumberOfComponents(1);
vtkTab->SetName(MEDFileFieldRepresentationLeavesArrays::GLOBAL_NODE_ID_NAME);
- AssignDataPointerToVTK<int>(vtkTab,gni,false);
+ AssignDataPointerToVTK<mcIdType>(vtkTab,gni,false);
ret->GetPointData()->AddArray(vtkTab);
vtkTab->Delete();
gni->decrRef();
MEDCoupling::MEDFileMesh *tmp(ms->getMeshAtPos(i));
MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast<MEDCoupling::MEDFileUMesh *>(tmp));
if(tmp2)
- MCAuto<DataArrayInt> tmp3(tmp2->zipCoords());
+ MCAuto<DataArrayIdType> tmp3(tmp2->zipCoords());
}
fields=MEDFileFields::LoadPartOf(fileName,false,ms);//false is important to not read the values
#else
zeTimeId=std::distance(ts2.begin(),std::find_if(ts2.begin(),ts2.end(),std::bind2nd(std::less<double>(),1e-14)));
}
//2nd chance
- if(zeTimeId==(int)ts.size())
+ if(zeTimeId==ts.size())
zeTimeId=std::distance(ts.begin(),std::find(ts.begin(),ts.end(),timeReq));
- if(zeTimeId==(int)ts.size())
+ if(zeTimeId==ts.size())
{//OK the time requested does not fit time series given to ParaView. It is typically the case if more than one MEDReader instance are created or TimeInspector in real time mode.
//In this case the default behaviour is taken. Keep the highest time step in this lower than timeReq.
int pos(-1);
{
if(ts[i]>valAttachedToPos)
{
- pos=i;
+ pos=(int)i;
valAttachedToPos=ts[i];
}
}
{
if(ts[i]<valAttachedToPos)
{
- pos=i;
+ pos=(int)i;
valAttachedToPos=ts[i];
}
}
int vtkExtractCellType::GetSILUpdateStamp()
{
- return this->SILTime;
+ return (int)this->SILTime;
}
void vtkExtractCellType::PrintSelf(ostream& os, vtkIndent indent)
#include "vtkExtractGroup.h"
#include "MEDFileFieldRepresentationTree.hxx"
#include "vtkMEDReader.h"
+#include "VTKMEDTraits.hxx"
#include "vtkAdjacentVertexIterator.h"
#include "vtkDataArrayTemplate.h"
#include "vtkIntArray.h"
+#include "vtkLongArray.h"
#include "vtkCellData.h"
#include "vtkPointData.h"
if((*it).getName()==famName)
return (*it).getId();
}
+ return std::numeric_limits<int>::max();
}
ExtractGroupFam::ExtractGroupFam(const char *name):ExtractGroupStatus(name),_id(0)
if(!da)
return 0;
std::string daName(da->GetName());
- vtkIntArray *dai(vtkIntArray::SafeDownCast(da));
+ typedef MEDFileVTKTraits<mcIdType>::VtkType vtkMCIdTypeArray;
+ vtkMCIdTypeArray *dai(vtkMCIdTypeArray::SafeDownCast(da));
if(daName!=arrNameOfFamilyField || !dai)
return 0;
//
zeSelection->SetNumberOfComponents(1);
char *pt(new char[nbOfTuples]);
zeSelection->SetArray(pt,nbOfTuples,0,VTK_DATA_ARRAY_DELETE);
- const int *inPtr(dai->GetPointer(0));
+ const mcIdType *inPtr(dai->GetPointer(0));
std::fill(pt,pt+nbOfTuples,0);
catchAll=true; catchSmth=false;
std::vector<bool> pt2(nbOfTuples,false);
private:
vtkDataSet *_ds;
};
-
int vtkExtractGroup::RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
{
try
{
-// std::cerr << "########################################## vtkExtractGroup::RequestData ##########################################" << std::endl;
-// request->Print(cout);
+ // std::cerr << "########################################## vtkExtractGroup::RequestData ##########################################" << std::endl;
+ // request->Print(cout);
vtkInformation* inputInfo=inputVector[0]->GetInformationObject(0);
vtkMultiBlockDataSet *inputMB(vtkMultiBlockDataSet::SafeDownCast(inputInfo->Get(vtkDataObject::DATA_OBJECT())));
if(inputMB->GetNumberOfBlocks()!=1)
int vtkExtractGroup::GetSILUpdateStamp()
{
- return this->SILTime;
+ return (int)this->SILTime;
}
void vtkExtractGroup::PrintSelf(ostream& os, vtkIndent indent)
{
const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
vtkDoubleArray *ret(vtkDoubleArray::New());
- std::size_t nbOfTuples(oldArr->GetNumberOfTuples());
+ vtkIdType nbOfTuples(oldArr->GetNumberOfTuples());
const double *inPt(oldArr->GetPointer(0));
double *pt((double *)malloc(nbOfTuples*3*sizeof(double)));
- for(std::size_t i=0;i<nbOfTuples;i++)
+ for(vtkIdType i=0;i<nbOfTuples;i++)
{
pt[3*i+0]=inPt[2*i+0];
pt[3*i+1]=inPt[2*i+1];
const int VTK_DATA_ARRAY_FREE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_FREE;
vtkDoubleArray *ret(vtkDoubleArray::New());
int nbOfCompo(oldArr->GetNumberOfComponents());
- std::size_t nbOfTuples(oldArr->GetNumberOfTuples());
+ vtkIdType nbOfTuples(oldArr->GetNumberOfTuples());
const double *inPt(oldArr->GetPointer(0));
double *pt((double *)malloc(nbOfTuples*3*sizeof(double)));
- for(std::size_t i=0;i<nbOfTuples;i++)
+ for(vtkIdType i=0;i<nbOfTuples;i++)
{
pt[3*i+0]=inPt[nbOfCompo*i+0];
pt[3*i+1]=inPt[nbOfCompo*i+1];
class PropertyKeeper
{
public:
- PropertyKeeper(vtkMEDReader *master):_master(master),IsGVActivated(false),GVValue(0),IsCMActivated(false),CMValue(0),IsGhostActivated(false),GCGCP(1) { }
+ PropertyKeeper(vtkMEDReader *master):IsGVActivated(false),GVValue(0),IsCMActivated(false),CMValue(0),IsGhostActivated(false),GCGCP(1),_master(master) { }
void assignPropertiesIfNeeded();
bool arePropertiesOnTreeToSetAfter() const;
//
{
public:
- vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsMEDOrSauv(true),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),FirstCall0(2),PK(master),MyMTime(0),GCGCP(true)
+ vtkMEDReaderInternal(vtkMEDReader *master):TK(0),IsMEDOrSauv(true),IsStdOrMode(false),GenerateVect(false),SIL(0),LastLev0(-1),PK(master),MyMTime(0),GCGCP(true),FirstCall0(2)
{
}
if(!ti.empty())
{
const std::vector<double>& data(ti.getData());
- outInfo->Set(vtkMEDReader::GAUSS_DATA(),&data[0],data.size());
+ outInfo->Set(vtkMEDReader::GAUSS_DATA(),&data[0],(int)data.size());
request->Append(vtkExecutive::KEYS_TO_COPY(),vtkMEDReader::GAUSS_DATA());// Thank you to SciberQuest and DIPOLE_CENTER ! Don't understand why ! In RequestInformation it does not work !
}
output->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(),reqTS);
try
{
this->Internal->Tree.changeStatusOfAndUpdateToHaveCoherentVTKDataSet(this->Internal->Tree.getIdHavingZeName(name),status);
- if(this->Internal->_wonderful_set.size()==GetNumberOfFieldsTreeArrays())
+ if((int)this->Internal->_wonderful_set.size()==GetNumberOfFieldsTreeArrays())
{
if(this->Internal->_wonderful_ref!=this->Internal->Tree.dumpState())
{
int pos(0);
std::istringstream iss(name); iss >> pos;
this->Internal->TK.getTimesFlagArray()[pos].first=(bool)status;
- if(pos==this->Internal->TK.getTimesFlagArray().size()-1)
+ if(pos==(int)this->Internal->TK.getTimesFlagArray().size()-1)
if(!this->Internal->PluginStart0())
{
this->Modified();
double timeRange[2];
timeRange[0]=tsteps.front();
timeRange[1]=tsteps.back();
- outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&tsteps[0],tsteps.size());
+ outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&tsteps[0],(int)tsteps.size());
outInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
this->Internal->LastLev0=lev0;
}
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../IO )
+INCLUDE_DIRECTORIES(
+ ${CMAKE_CURRENT_SOURCE_DIR}/../IO
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../MEDWriter/IO
+ )
IF(PARAVIEW_BUILD_QT_GUI)
emit layoutAboutToBeChanged();
if(nbOn>sz/2)
{
- for(std::size_t ii=0;ii<sz;ii++)
+ for(int ii=0;ii<sz;ii++)
_activated[ii]=false;
signalVal=0;
}
else
{
- for(std::size_t ii=0;ii<sz;ii++)
+ for(int ii=0;ii<sz;ii++)
_activated[ii]=true;
signalVal=(int)sz;
}
int VectBoolModel::getNbOfActivatedTimeSteps() const
{
int sz(curSize()),nbOn(0);
- for(std::size_t ii=0;ii<sz;ii++)
+ for(int ii=0;ii<sz;ii++)
if(_activated[ii])
nbOn++;
return nbOn;
int VectBoolModel::curSize() const
{
- return _dts.size();
+ return (int)_dts.size();
}
///////////////
if (prop)
{
// Searching first activated leaf id
- for (int i = 1; i < prop->GetNumberOfElements(); i += 2)
+ for (unsigned int i = 1; i < prop->GetNumberOfElements(); i += 2)
{
if (prop->GetElement(i)[0] == '1')
{
const char* leafString = prop->GetElement(i - 1);
const char* tmp = strchr(leafString, '/');
size_t num = tmp - leafString;
- char* dest = new char[num];
+ char* dest = new char[num+1];
strncpy(dest, leafString, num);
dest[num] = '\0';
- tsId = strtol(dest + 2, NULL, 10);
- delete dest;
+ tsId = (vtkIdType)strtol(dest + 2, NULL, 10);
+ delete [] dest;
break;
}
}
FIND_PACKAGE(SalomeMEDCoupling REQUIRED)
FIND_PACKAGE(SalomeMEDFile REQUIRED)
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ ADD_DEFINITIONS("-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+
PV_PROCESS_MODULES()
INCLUDE_DIRECTORIES(
#ifndef __VTKMEDTRAITS_HXX__
#define __VTKMEDTRAITS_HXX__
+class vtkIntArray;
+class vtkLongArray;
+class vtkFloatArray;
+class vtkDoubleArray;
+
template<class T>
class MEDFileVTKTraits
{
{
public:
typedef vtkIntArray VtkType;
- typedef MEDCoupling::DataArrayInt MCType;
+ typedef MEDCoupling::DataArrayInt32 MCType;
+};
+
+template<>
+class MEDFileVTKTraits<long>
+{
+public:
+ typedef vtkLongArray VtkType;
+ typedef MEDCoupling::DataArrayInt64 MCType;
};
template<>
using MEDCoupling::MEDFileFieldMultiTS;
using MEDCoupling::MEDFileAnyTypeFieldMultiTS;
using MEDCoupling::DataArray;
-using MEDCoupling::DataArrayInt;
+using MEDCoupling::DataArrayInt32;
+using MEDCoupling::DataArrayInt64;
using MEDCoupling::DataArrayFloat;
using MEDCoupling::DataArrayDouble;
using MEDCoupling::MEDCouplingMesh;
return oss.str();
}
-DataArrayInt *ConvertVTKArrayToMCArrayInt(vtkDataArray *data)
+DataArrayIdType *ConvertVTKArrayToMCArrayInt(vtkDataArray *data)
{
if(!data)
throw MZCException("ConvertVTKArrayToMCArrayInt : internal error !");
int nbTuples(data->GetNumberOfTuples()),nbComp(data->GetNumberOfComponents());
std::size_t nbElts(nbTuples*nbComp);
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
ret->alloc(nbTuples,nbComp);
for(int i=0;i<nbComp;i++)
{
if(comp)
ret->setInfoOnComponent(i,comp);
}
- int *ptOut(ret->getPointer());
+ mcIdType *ptOut(ret->getPointer());
vtkIntArray *d0(vtkIntArray::SafeDownCast(data));
if(d0)
{
if(nbComp>1 && nbComp<=3)
{
char tmp[2];
- tmp[0]='X'+i; tmp[1]='\0';
+ tmp[0]=(char)('X'+i); tmp[1]='\0';
ret->setInfoOnComponent(i,tmp);
}
}
const vtkIdType *conn(ca->GetPointer());
for(int i=0;i<nbCells;i++)
{
- int sz(*conn++);
- std::vector<int> conn2(sz);
+ mcIdType sz(ToIdType(*conn++));
+ std::vector<mcIdType> conn2(sz);
for(int jj=0;jj<sz;jj++)
- conn2[jj]=conn[jj];
+ conn2[jj]=ToIdType(conn[jj]);
subMesh->insertNextCell(type,sz,&conn2[0]);
conn+=sz;
}
return subMesh.retn();
}
-MEDCouplingUMesh *BuildMeshFromCellArrayTriangleStrip(vtkCellArray *ca, DataArrayDouble *coords, MCAuto<DataArrayInt>& ids)
+MEDCouplingUMesh *BuildMeshFromCellArrayTriangleStrip(vtkCellArray *ca, DataArrayDouble *coords, MCAuto<DataArrayIdType>& ids)
{
MCAuto<MEDCouplingUMesh> subMesh(MEDCouplingUMesh::New("",2));
subMesh->setCoords(coords); subMesh->allocateCells();
return 0;
vtkIdType nbEntries(ca->GetNumberOfConnectivityEntries());
const vtkIdType *conn(ca->GetPointer());
- ids=DataArrayInt::New() ; ids->alloc(0,1);
+ ids=DataArrayIdType::New() ; ids->alloc(0,1);
for(int i=0;i<nbCells;i++)
{
int sz(*conn++);
{
for(int j=0;j<nbTri;j++,conn++)
{
- int conn2[3]; conn2[0]=conn[0] ; conn2[1]=conn[1] ; conn2[2]=conn[2];
+ mcIdType conn2[3]; conn2[0]=conn[0] ; conn2[1]=conn[1] ; conn2[2]=conn[2];
subMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,conn2);
ids->pushBackSilent(i);
}
vs2[ii]=vs[ii].getMesh();
arrs2[ii]=vs[ii].getCellFields();
if(nbElts<0)
- nbElts=arrs2[ii].size();
+ nbElts=(int)arrs2[ii].size();
else
- if(arrs2[ii].size()!=nbElts)
+ if((int)arrs2[ii].size()!=nbElts)
throw MZCException("MicroField cstor : internal error !");
}
_cellFs.resize(nbElts);
}
template<class T>
-void AppendToFields(MEDCoupling::TypeOfField tf, MEDCouplingMesh *mesh, const DataArrayInt *n2oPtr, typename MEDFileVTKTraits<T>::MCType *dadPtr, MEDFileFields *fs, double timeStep, int tsId)
+void AppendToFields(MEDCoupling::TypeOfField tf, MEDCouplingMesh *mesh, const DataArrayIdType *n2oPtr, typename MEDFileVTKTraits<T>::MCType *dadPtr, MEDFileFields *fs, double timeStep, int tsId)
{
std::string fieldName(dadPtr->getName());
MCAuto< typename Traits<T>::FieldType > f(Traits<T>::FieldType::New(tf));
fs->pushField(fmts);
}
-void AppendMCFieldFrom(MEDCoupling::TypeOfField tf, MEDCouplingMesh *mesh, MEDFileData *mfd, MCAuto<DataArray> da, const DataArrayInt *n2oPtr, double timeStep, int tsId)
+void AppendMCFieldFrom(MEDCoupling::TypeOfField tf, MEDCouplingMesh *mesh, MEDFileData *mfd, MCAuto<DataArray> da, const DataArrayIdType *n2oPtr, double timeStep, int tsId)
{
static const char FAMFIELD_FOR_CELLS[]="FamilyIdCell";
static const char FAMFIELD_FOR_NODES[]="FamilyIdNode";
return ;
}
MCAuto<DataArrayInt> dai(MEDCoupling::DynamicCast<DataArray,DataArrayInt>(da));
- if(dai.isNotNull())
+ MCAuto<DataArrayIdType> daId(MEDCoupling::DynamicCast<DataArray,DataArrayIdType>(da));
+ if(dai.isNotNull() || daId.isNotNull())
{
std::string fieldName(dai->getName());
if((fieldName!=FAMFIELD_FOR_CELLS || tf!=MEDCoupling::ON_CELLS) && (fieldName!=FAMFIELD_FOR_NODES || tf!=MEDCoupling::ON_NODES))
{
+ if(!dai)
+ throw MZCException("AppendMCFieldFrom : internal error 3 (not int32) !");
AppendToFields<int>(tf,mesh,n2oPtr,dai,fs,timeStep,tsId);
return ;
}
MEDFileMesh *mm(ms->getMeshWithName(mesh->getName()));
if(!mm)
throw MZCException("AppendMCFieldFrom : internal error 3 !");
+ if(!daId)
+ throw MZCException("AppendMCFieldFrom : internal error 3 (not mcIdType) !");
if(!n2oPtr)
- mm->setFamilyFieldArr(mesh->getMeshDimension()-mm->getMeshDimension(),dai);
+ mm->setFamilyFieldArr(mesh->getMeshDimension()-mm->getMeshDimension(),daId);
else
{
- MCAuto<DataArrayInt> dai2(dai->selectByTupleId(n2oPtr->begin(),n2oPtr->end()));
+ MCAuto<DataArrayIdType> dai2(daId->selectByTupleId(n2oPtr->begin(),n2oPtr->end()));
mm->setFamilyFieldArr(mesh->getMeshDimension()-mm->getMeshDimension(),dai2);
}
}
MEDFileMesh *mm(ms->getMeshWithName(mesh->getName()));
if(!mm)
throw MZCException("AppendMCFieldFrom : internal error 4 !");
+ if(!daId)
+ throw MZCException("AppendMCFieldFrom : internal error 4 (not mcIdType) !");
if(!n2oPtr)
- mm->setFamilyFieldArr(1,dai);
+ mm->setFamilyFieldArr(1,daId);
else
{
- MCAuto<DataArrayInt> dai2(dai->selectByTupleId(n2oPtr->begin(),n2oPtr->end()));
+ MCAuto<DataArrayIdType> dai2(daId->selectByTupleId(n2oPtr->begin(),n2oPtr->end()));
mm->setFamilyFieldArr(1,dai2);
}
}
throw MZCException("PutAtLevelDealOrder : internal error 2 !");
MCAuto<MEDCouplingUMesh> mesh(mf.getMesh());
mesh->setName(mfd->getMeshes()->getMeshAtPos(0)->getName());
- MCAuto<DataArrayInt> o2n(mesh->sortCellsInMEDFileFrmt());
- const DataArrayInt *o2nPtr(o2n);
- MCAuto<DataArrayInt> n2o;
+ MCAuto<DataArrayIdType> o2n(mesh->sortCellsInMEDFileFrmt());
+ const DataArrayIdType *o2nPtr(o2n);
+ MCAuto<DataArrayIdType> n2o;
mmu->setMeshAtLevel(meshDimRel,mesh);
- const DataArrayInt *n2oPtr(0);
+ const DataArrayIdType *n2oPtr(0);
if(o2n)
{
n2o=o2n->invertArrayO2N2N2O(mesh->getNumberOfCells());
}
}
-std::vector<MCAuto<DataArray> > AddPartFields(const DataArrayInt *part, vtkDataSetAttributes *dsa)
+std::vector<MCAuto<DataArray> > AddPartFields(const DataArrayIdType *part, vtkDataSetAttributes *dsa)
{
std::vector< MCAuto<DataArray> > ret;
if(!dsa)
vtkCellArray *ca(ds->GetStrips());
if(ca)
{
- MCAuto<DataArrayInt> ids;
+ MCAuto<DataArrayIdType> ids;
MCAuto<MEDCouplingUMesh> subMesh(BuildMeshFromCellArrayTriangleStrip(ca,coords,ids));
if((const MEDCouplingUMesh *)subMesh)
{
{
MCAuto<MEDCouplingUMesh> m0(MEDCouplingUMesh::New("",*curLev));
m0->setCoords(coords); m0->allocateCells();
- MCAuto<DataArrayInt> cellIdsCurLev(lev->findIdsEqual(*curLev));
- for(const int *cellId=cellIdsCurLev->begin();cellId!=cellIdsCurLev->end();cellId++)
+ MCAuto<DataArrayIdType> cellIdsCurLev(lev->findIdsEqual(*curLev));
+ for(const mcIdType *cellId=cellIdsCurLev->begin();cellId!=cellIdsCurLev->end();cellId++)
{
int vtkType(ctPtr[*cellId]);
std::map<int,int>::iterator it(m.find(vtkType));
INTERP_KERNEL::NormalizedCellType ct=it!=m.end()?(INTERP_KERNEL::NormalizedCellType)((*it).second):INTERP_KERNEL::NORM_POINT1;
if(ct!=INTERP_KERNEL::NORM_POLYHED && vtkType!=VTK_POLY_VERTEX)
{
- std::vector<int> conn2(sz);
+ std::vector<mcIdType> conn2(sz);
for(int kk=0;kk<sz;kk++)
conn2[kk]=caPtr[offset+1+kk];
m0->insertNextCell(ct,sz,&conn2[0]);
if(!faces || !faceLoc)
throw MZCException("ConvertFromUnstructuredGrid : faces are expected when there are polyhedra !");
const vtkIdType *facPtr(faces->GetPointer(0)),*facLocPtr(faceLoc->GetPointer(0));
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
int off0(facLocPtr[*cellId]);
int nbOfFaces(facPtr[off0++]);
for(int k=0;k<nbOfFaces;k++)
if(k<nbOfFaces-1)
conn.push_back(-1);
}
- m0->insertNextCell(ct,conn.size(),&conn[0]);
+ m0->insertNextCell(ct,ToIdType(conn.size()),&conn[0]);
}
else
{
if(sz!=1)
throw MZCException("ConvertFromUnstructuredGrid : non single poly vertex not managed by MED !");
- m0->insertNextCell(ct,1,caPtr+offset+1);
+ m0->insertNextCell(ct,1,(const mcIdType*)(caPtr+offset+1));
}
}
std::vector<MCAuto<DataArray> > cellFs(AddPartFields(cellIdsCurLev,ds->GetCellData()));
#include "vtkSystemIncludes.h" //needed for exports
-#include "MEDFileMesh.hxx"
-#include "MEDFileField.hxx"
-#include "MEDFileData.hxx"
+#include "MEDCouplingRefCountObject.hxx"
#include "MEDCouplingMemArray.hxx"
-#include "MEDCouplingFieldInt.hxx"
-#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldDouble.hxx"
-#include "MEDCouplingRefCountObject.hxx"
+#include "MEDCouplingFieldFloat.hxx"
+#include "MEDCouplingFieldInt.hxx"
+#include "MEDFileData.hxx"
+#include "MEDFileField.hxx"
+#include "MEDFileMesh.hxx"
#include "MEDLoaderTraits.hxx"
#include <exception>
isPolyh=true;
std::set<vtkIdType> s(tmp,tmp+nbOfNodeInCurCell);
vtkSmartPointer<vtkCellArray> faces=vtkSmartPointer<vtkCellArray>::New();
- int nbOfFaces=std::count(tmp,tmp+nbOfNodeInCurCell,-1)+1;
+ std::size_t nbOfFaces=std::count(tmp,tmp+nbOfNodeInCurCell,-1)+1;
vtkIdType *work=tmp;
- for(int i=0;i<nbOfFaces;i++)
+ for(std::size_t i=0;i<nbOfFaces;i++)
{
vtkIdType *work2=std::find(work,tmp+nbOfNodeInCurCell,-1);
- int nbOfNodesInFace=std::distance(work,work2);
+ int nbOfNodesInFace=(int)std::distance(work,work2);
faces->InsertNextCell(nbOfNodesInFace,work);
work=work2+1;
}
s.erase(-1);
std::vector<vtkIdType> v(s.begin(),s.end());
- ret->InsertNextCell(VTK_POLYHEDRON,v.size(),&v[0],nbOfFaces,faces->GetPointer());
+ ret->InsertNextCell(VTK_POLYHEDRON,(vtkIdType)v.size(),&v[0],(vtkIdType)nbOfFaces,faces->GetPointer());
}
}
delete [] tmp;
return;
if(ior[0]=='\0')
return;
- int length=strlen(ior);
+ std::size_t length=strlen(ior);
IOR.resize(length+1);
std::copy(ior,ior+length+1,&IOR[0]);
this->Modified();
double timeRange[2];
timeRange[0]=tsteps.front();
timeRange[1]=tsteps.back();
- myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&tsteps[0],tsteps.size());
+ myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(),&tsteps[0],(vtkIdType)tsteps.size());
myInfo->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(),timeRange,2);
}
}
LIST(APPEND CMAKE_MODULE_PATH "${MEDCOUPLING_ROOT_DIR}/cmake_files")
FIND_PACKAGE(SalomeMEDCoupling REQUIRED)
+IF(MEDCOUPLING_USE_64BIT_IDS)
+ ADD_DEFINITIONS("-DMEDCOUPLING_USE_64BIT_IDS")
+ENDIF(MEDCOUPLING_USE_64BIT_IDS)
+
OPTION(BUILD_SHARED_LIBS "Build with shared libraries." ${VTK_BUILD_SHARED_LIBS})
SET(VTK_INSTALL_RUNTIME_DIR lib)
#include "vtkMultiBlockDataGroupFilter.h"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMemArray.txx"
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "InterpKernelAutoPtr.hxx"
#include <sstream>
using MEDCoupling::DataArray;
-using MEDCoupling::DataArrayInt;
+using MEDCoupling::DataArrayInt32;
+using MEDCoupling::DataArrayInt64;
using MEDCoupling::DataArrayDouble;
using MEDCoupling::MEDCouplingMesh;
using MEDCoupling::MEDCouplingUMesh;
throw INTERP_KERNEL::Exception("Input data set is not an unstructured mesh ! This filter works only on unstructured meshes !");
}
-DataArrayInt *ConvertVTKArrayToMCArrayInt(vtkDataArray *data)
+DataArrayIdType *ConvertVTKArrayToMCArrayInt(vtkDataArray *data)
{
if(!data)
throw INTERP_KERNEL::Exception("ConvertVTKArrayToMCArrayInt : internal error !");
int nbTuples(data->GetNumberOfTuples()),nbComp(data->GetNumberOfComponents());
std::size_t nbElts(nbTuples*nbComp);
- MCAuto<DataArrayInt> ret(DataArrayInt::New());
+ MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
ret->alloc(nbTuples,nbComp);
for(int i=0;i<nbComp;i++)
{
if(comp)
ret->setInfoOnComponent(i,comp);
}
- int *ptOut(ret->getPointer());
+ mcIdType *ptOut(ret->getPointer());
vtkIntArray *d0(vtkIntArray::SafeDownCast(data));
if(d0)
{
return coords.retn();
}
-void ConvertFromUnstructuredGrid(vtkUnstructuredGrid *ds, std::vector< MCAuto<MEDCouplingUMesh> >& ms, std::vector< MCAuto<DataArrayInt> >& ids)
+void ConvertFromUnstructuredGrid(vtkUnstructuredGrid *ds, std::vector< MCAuto<MEDCouplingUMesh> >& ms, std::vector< MCAuto<DataArrayIdType> >& ids)
{
MCAuto<DataArrayDouble> coords(BuildCoordsFrom(ds));
vtkIdType nbCells(ds->GetNumberOfCells());
{
MCAuto<MEDCouplingUMesh> m0(MEDCouplingUMesh::New("",*curLev));
m0->setCoords(coords); m0->allocateCells();
- MCAuto<DataArrayInt> cellIdsCurLev(lev->findIdsEqual(*curLev));
- for(const int *cellId=cellIdsCurLev->begin();cellId!=cellIdsCurLev->end();cellId++)
+ MCAuto<DataArrayIdType> cellIdsCurLev(lev->findIdsEqual(*curLev));
+ for(const mcIdType *cellId=cellIdsCurLev->begin();cellId!=cellIdsCurLev->end();cellId++)
{
std::map<int,int>::iterator it(m.find(ctPtr[*cellId]));
vtkIdType offset(claPtr[*cellId]);
INTERP_KERNEL::NormalizedCellType ct((INTERP_KERNEL::NormalizedCellType)(*it).second);
if(ct!=INTERP_KERNEL::NORM_POLYHED)
{
- std::vector<int> conn2(sz);
+ std::vector<mcIdType> conn2(sz);
for(int kk=0;kk<sz;kk++)
conn2[kk]=caPtr[offset+1+kk];
m0->insertNextCell(ct,sz,&conn2[0]);
if(!faces || !faceLoc)
throw INTERP_KERNEL::Exception("ConvertFromUnstructuredGrid : faces are expected when there are polyhedra !");
const vtkIdType *facPtr(faces->GetPointer(0)),*facLocPtr(faceLoc->GetPointer(0));
- std::vector<int> conn;
+ std::vector<mcIdType> conn;
int off0(facLocPtr[*cellId]);
int nbOfFaces(facPtr[off0++]);
for(int k=0;k<nbOfFaces;k++)
if(k<nbOfFaces-1)
conn.push_back(-1);
}
- m0->insertNextCell(ct,conn.size(),&conn[0]);
+ m0->insertNextCell(ct,ToIdType(conn.size()),&conn[0]);
}
}
ms.push_back(m0); ids.push_back(cellIdsCurLev);
{
const DataArrayDouble *vorCoords(mVor->getCoords());
vtkSmartPointer<vtkDoubleArray> da(vtkSmartPointer<vtkDoubleArray>::New());
- da->SetNumberOfComponents(vorCoords->getNumberOfComponents());
- da->SetNumberOfTuples(vorCoords->getNumberOfTuples());
+ da->SetNumberOfComponents((vtkIdType)vorCoords->getNumberOfComponents());
+ da->SetNumberOfTuples((vtkIdType)vorCoords->getNumberOfTuples());
std::copy(vorCoords->begin(),vorCoords->end(),da->GetPointer(0));
points->SetData(da);
}
}
vtkSmartPointer<vtkIdTypeArray> cells(vtkSmartPointer<vtkIdTypeArray>::New());
{
- MCAuto<DataArrayInt> tmp2(mVor->computeEffectiveNbOfNodesPerCell());
+ MCAuto<DataArrayIdType> tmp2(mVor->computeEffectiveNbOfNodesPerCell());
cells->SetNumberOfComponents(1);
- cells->SetNumberOfTuples(tmp2->accumulate(0)+nbCells);
+ cells->SetNumberOfTuples(tmp2->accumulate((std::size_t)0)+nbCells);
dPtr=cells->GetPointer(0);
}
- const int *connPtr(mVor->getNodalConnectivity()->begin()),*connIPtr(mVor->getNodalConnectivityIndex()->begin());
+ const mcIdType *connPtr(mVor->getNodalConnectivity()->begin()),*connIPtr(mVor->getNodalConnectivityIndex()->begin());
int k(0),kk(0);
std::vector<vtkIdType> ee,ff;
for(int i=0;i<nbCells;i++,connIPtr++)
{
INTERP_KERNEL::NormalizedCellType ct(static_cast<INTERP_KERNEL::NormalizedCellType>(connPtr[connIPtr[0]]));
- *aPtr++=zeMapRev[connPtr[connIPtr[0]]];
+ *aPtr++=(unsigned char)zeMapRev[connPtr[connIPtr[0]]];
if(ct!=INTERP_KERNEL::NORM_POLYHED)
{
int sz(connIPtr[1]-connIPtr[0]-1);
else
{
std::set<int> s(connPtr+connIPtr[0]+1,connPtr+connIPtr[1]); s.erase(-1);
- int nbFace(std::count(connPtr+connIPtr[0]+1,connPtr+connIPtr[1],-1)+1);
+ vtkIdType nbFace((vtkIdType)(std::count(connPtr+connIPtr[0]+1,connPtr+connIPtr[1],-1)+1));
ff.push_back(nbFace);
- const int *work(connPtr+connIPtr[0]+1);
+ const mcIdType *work(connPtr+connIPtr[0]+1);
for(int j=0;j<nbFace;j++)
{
- const int *work2=std::find(work,connPtr+connIPtr[1],-1);
- ff.push_back(std::distance(work,work2));
+ const mcIdType *work2=std::find(work,connPtr+connIPtr[1],-1);
+ ff.push_back((vtkIdType)std::distance(work,work2));
ff.insert(ff.end(),work,work2);
work=work2+1;
}
vtkSmartPointer<vtkIdTypeArray> faceLocations(vtkSmartPointer<vtkIdTypeArray>::New());
{
faceLocations->SetNumberOfComponents(1);
- faceLocations->SetNumberOfTuples(ee.size());
+ faceLocations->SetNumberOfTuples((vtkIdType)ee.size());
std::copy(ee.begin(),ee.end(),faceLocations->GetPointer(0));
}
vtkSmartPointer<vtkIdTypeArray> faces(vtkSmartPointer<vtkIdTypeArray>::New());
{
faces->SetNumberOfComponents(1);
- faces->SetNumberOfTuples(ff.size());
+ faces->SetNumberOfTuples((vtkIdType)ff.size());
std::copy(ff.begin(),ff.end(),faces->GetPointer(0));
}
vtkSmartPointer<vtkCellArray> cells2(vtkSmartPointer<vtkCellArray>::New());
cells->SetNumberOfTuples(mVor->getNodalConnectivity()->getNumberOfTuples());
dPtr=cells->GetPointer(0);
}
- const int *connPtr(mVor->getNodalConnectivity()->begin()),*connIPtr(mVor->getNodalConnectivityIndex()->begin());
+ const mcIdType *connPtr(mVor->getNodalConnectivity()->begin()),*connIPtr(mVor->getNodalConnectivityIndex()->begin());
int k(0);
for(int i=0;i<nbCells;i++,connIPtr++)
{
cells->SetNumberOfTuples(mVor->getNodalConnectivity()->getNumberOfTuples());
dPtr=cells->GetPointer(0);
}
- const int *connPtr(mVor->getNodalConnectivity()->begin()),*connIPtr(mVor->getNodalConnectivityIndex()->begin());
+ const mcIdType *connPtr(mVor->getNodalConnectivity()->begin()),*connIPtr(mVor->getNodalConnectivityIndex()->begin());
for(int i=0;i<nbCells;i++,connIPtr++)
{
*dPtr++=2;
OffsetKeeper():_vtk_arr(0) { }
void pushBack(vtkDataArray *da) { _da_on.push_back(da); }
void setVTKArray(vtkIdTypeArray *arr) {
- MCAuto<DataArrayInt> offmc(ConvertVTKArrayToMCArrayInt(arr));
+ MCAuto<DataArrayIdType> offmc(ConvertVTKArrayToMCArrayInt(arr));
_off_arr=offmc; _vtk_arr=arr; }
const std::vector<vtkDataArray *>& getArrayGauss() const { return _da_on; }
- const DataArrayInt *getOffsets() const { return _off_arr; }
+ const DataArrayIdType *getOffsets() const { return _off_arr; }
vtkIdTypeArray *getVTKOffsets() const { return _vtk_arr; }
private:
std::vector<vtkDataArray *> _da_on;
- MCAuto<DataArrayInt> _off_arr;
+ MCAuto<DataArrayIdType> _off_arr;
vtkIdTypeArray *_vtk_arr;
};
}
template<class T, class U>
-vtkSmartPointer<T> ExtractFieldFieldArr(T *elt2, int sizeOfOutArr, int nbOfCellsOfInput, const int *offsetsPtr, const int *nbPtsPerCellPtr)
+vtkSmartPointer<T> ExtractFieldFieldArr(T *elt2, int sizeOfOutArr, int nbOfCellsOfInput, const mcIdType *offsetsPtr, const mcIdType *nbPtsPerCellPtr)
{
vtkSmartPointer<T> elt3(vtkSmartPointer<T>::New());
int nbc(elt2->GetNumberOfComponents());
}
template<class T, class U>
-vtkSmartPointer<T> ExtractCellFieldArr(T *elt2, int sizeOfOutArr, int nbOfCellsOfInput, const int *idsPtr, const int *nbPtsPerCellPtr)
+vtkSmartPointer<T> ExtractCellFieldArr(T *elt2, int sizeOfOutArr, int nbOfCellsOfInput, const mcIdType *idsPtr, const mcIdType *nbPtsPerCellPtr)
{
vtkSmartPointer<T> elt3(vtkSmartPointer<T>::New());
int nbc(elt2->GetNumberOfComponents());
return elt3;
}
-vtkSmartPointer<vtkUnstructuredGrid> Voronize(const MEDCouplingUMesh *m, const DataArrayInt *ids, vtkIdTypeArray *vtkOff, const DataArrayInt *offsetsBase, const std::vector<vtkDataArray *>& arrGauss, const std::vector<double>& GaussAdvData, const std::vector<vtkDataArray *>& arrsOnCells)
+vtkSmartPointer<vtkUnstructuredGrid> Voronize(const MEDCouplingUMesh *m, const DataArrayIdType *ids, vtkIdTypeArray *vtkOff, const DataArrayIdType *offsetsBase, const std::vector<vtkDataArray *>& arrGauss, const std::vector<double>& GaussAdvData, const std::vector<vtkDataArray *>& arrsOnCells)
{
if(arrGauss.empty())
throw INTERP_KERNEL::Exception("Voronize : no Gauss array !");
field->setMesh(m);
// Gauss Part
int nbOfCellsOfInput(m->getNumberOfCells());
- MCAuto<DataArrayInt> nbPtsPerCellArr(DataArrayInt::New()); nbPtsPerCellArr->alloc(nbOfCellsOfInput,1);
+ MCAuto<DataArrayIdType> nbPtsPerCellArr(DataArrayIdType::New()); nbPtsPerCellArr->alloc(nbOfCellsOfInput,1);
std::map<int,int> zeMapRev(ComputeRevMapOfType()),zeMap(ComputeMapOfType());
std::set<INTERP_KERNEL::NormalizedCellType> agt(m->getAllGeoTypes());
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=agt.begin();it!=agt.end();it++)
std::vector<double> refCoo,posInRefCoo,wCpp(w,w+np);
FillAdvInfoFrom((*it2).second,GaussAdvData,np,nbPtsPerCell,refCoo,posInRefCoo);
field->setGaussLocalizationOnType(*it,refCoo,posInRefCoo,wCpp);
- MCAuto<DataArrayInt> ids2(m->giveCellsWithType(*it));
+ MCAuto<DataArrayIdType> ids2(m->giveCellsWithType(*it));
nbPtsPerCellArr->setPartOfValuesSimple3(np,ids2->begin(),ids2->end(),0,1,1);
}
- int zeSizeOfOutCellArr(nbPtsPerCellArr->accumulate(0));
+ int zeSizeOfOutCellArr(nbPtsPerCellArr->accumulate((std::size_t)0));
{ MCAuto<DataArrayDouble> fakeArray(DataArrayDouble::New()); fakeArray->alloc(zeSizeOfOutCellArr,1); field->setArray(fakeArray); }
field->checkConsistencyLight();
MCAuto<MEDCouplingFieldDouble> vor(field->voronoize(1e-12));// The key is here !
//
vtkSmartPointer<vtkUnstructuredGrid> ret(ConvertUMeshFromMCToVTK(mVor));
// now fields...
- MCAuto<DataArrayInt> myOffsets(offsetsBase->selectByTupleIdSafe(ids->begin(),ids->end()));
- const int *myOffsetsPtr(myOffsets->begin()),*nbPtsPerCellArrPtr(nbPtsPerCellArr->begin());
+ MCAuto<DataArrayIdType> myOffsets(offsetsBase->selectByTupleIdSafe(ids->begin(),ids->end()));
+ const mcIdType *myOffsetsPtr(myOffsets->begin()),*nbPtsPerCellArrPtr(nbPtsPerCellArr->begin());
for(std::vector<vtkDataArray *>::const_iterator it=arrGauss.begin();it!=arrGauss.end();it++)
{
vtkDataArray *elt(*it);
throw INTERP_KERNEL::Exception("ComputeVoroGauss : no Gauss points fields in DataSet !");
}
std::vector< MCAuto<MEDCouplingUMesh> > ms;
- std::vector< MCAuto<DataArrayInt> > ids;
+ std::vector< MCAuto<DataArrayIdType> > ids;
ConvertFromUnstructuredGrid(usgIn,ms,ids);
{
vtkDataArray *offTmp(usgIn->GetCellData()->GetArray(zeArrOffset.c_str()));
for(std::size_t i=0;i<sz;i++)
{
MCAuto<MEDCouplingUMesh> mmc(ms[i]);
- MCAuto<DataArrayInt> myIds(ids[i]);
+ MCAuto<DataArrayIdType> myIds(ids[i]);
vtkSmartPointer<vtkUnstructuredGrid> vor(Voronize(mmc,myIds,zeOffsets.getVTKOffsets(),zeOffsets.getOffsets(),zeOffsets.getArrayGauss(),GaussAdvData,arrsOnCells));
res.push_back(vor);
}