-// Copyright (C) 2010-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2010-2022 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "MEDCouplingFieldDouble.hxx"
#include "InterpKernelGaussCoords.hxx"
#include "MEDFileData.hxx"
-#include "SauvReader.hxx"
#include "MEDCouplingMemArray.txx"
#ifdef MEDREADER_USE_MPI
#include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
#include "vtkInformationIntegerKey.h"
#include "vtkInformation.h"
-#include "vtkDataArrayTemplate.h"
+#include "vtkAOSDataArrayTemplate.h"
#include "vtkIdTypeArray.h"
#include "vtkDoubleArray.h"
#include "vtkIntArray.h"
template<class T>
vtkIdTypeArray *ELGACmp::createNew(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDataArray *vtkd, vtkDataSet *ds, ExportedTinyInfo *internalInfo) const
{
- const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_DELETE;
+ const int VTK_DATA_ARRAY_DELETE=vtkAOSDataArrayTemplate<T>::VTK_DATA_ARRAY_DELETE;
std::vector< std::vector<std::string> > locNames(_loc_names);
std::vector<vtkIdTypeArray *> elgas(_elgas);
std::vector< std::pair< vtkQuadratureSchemeDefinition *, unsigned char > > defs;
void AssignDataPointerToVTK(typename MEDFileVTKTraits<T>::VtkType *vtkTab, typename MEDFileVTKTraits<T>::MCType *mcTab, bool noCpyNumNodes)
{
if(noCpyNumNodes)
- vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),1,vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE);
+ vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),1,vtkAOSDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE);
else
- { vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),0,vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE); mcTab->accessToMemArray().setSpecificDeallocator(0); }
+ { vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),0,vtkAOSDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE); mcTab->accessToMemArray().setSpecificDeallocator(0); }
}
// here copy is always assumed.
template<class VTKT, class MCT>
-void AssignDataPointerOther(VTKT *vtkTab, MCT *mcTab, int nbElems)
+void AssignDataPointerOther(VTKT *vtkTab, MCT *mcTab, vtkIdType nbElems)
{
typedef typename VTKT::ValueType VTKType;
if ( sizeof( VTKType ) == sizeof( typename MCT::Type ))
const std::vector<TypeOfField>& discs, const ELGACmp& elgaCmp, const MEDCoupling::MEDFileFieldGlobsReal *globs,
MEDFileAnyTypeField1TS *f1ts, vtkDataSet *ds, ExportedTinyInfo *internalInfo)
{
- const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_DELETE;
+ const int VTK_DATA_ARRAY_DELETE=vtkAOSDataArrayTemplate<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((int)vi->getNumberOfComponents());
void MEDFileFieldRepresentationLeavesArrays::appendFields(const MEDTimeReq *tr, const MEDCoupling::MEDFileFieldGlobsReal *globs, const MEDCoupling::MEDMeshMultiLev *mml, const MEDCoupling::MEDFileMeshStruct *mst, vtkDataSet *ds, ExportedTinyInfo *internalInfo) const
{
- const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE;
+ //const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<double>::VTK_DATA_ARRAY_DELETE; // todo: unused
tr->setNumberOfTS((operator->())->getNumberOfTS());
tr->initIterator();
for(int timeStepId=0;timeStepId<tr->size();timeStepId++,++(*tr))
MCAuto<MEDFileAnyTypeField1TS> f1ts((operator->())->getTimeStepAtPos(tr->getCurrent()));
MEDFileAnyTypeField1TS *f1tsPtr(f1ts);
MEDFileField1TS *f1tsPtrDbl(dynamic_cast<MEDFileField1TS *>(f1tsPtr));
- MEDFileIntField1TS *f1tsPtrInt(dynamic_cast<MEDFileIntField1TS *>(f1tsPtr));
+ MEDFileInt32Field1TS *f1tsPtrInt(dynamic_cast<MEDFileInt32Field1TS *>(f1tsPtr));
+ MEDFileInt64Field1TS *f1tsPtrInt64(dynamic_cast<MEDFileInt64Field1TS *>(f1tsPtr));
MEDFileFloatField1TS *f1tsPtrFloat(dynamic_cast<MEDFileFloatField1TS *>(f1tsPtr));
DataArray *crudeArr(0),*postProcessedArr(0);
if(f1tsPtrDbl)
crudeArr=f1tsPtrDbl->getUndergroundDataArray();
else if(f1tsPtrInt)
crudeArr=f1tsPtrInt->getUndergroundDataArray();
+ else if(f1tsPtrInt64)
+ crudeArr=f1tsPtrInt64->getUndergroundDataArray();
else if(f1tsPtrFloat)
crudeArr=f1tsPtrFloat->getUndergroundDataArray();
else
{
AssignToFieldData<float>(v,tr,att,f1ts->getName(),postProcessedArr==crudeArr,discs,_elga_cmp,globs,f1ts,ds,internalInfo);
}
+ else if(f1tsPtrInt64)
+ {
+ AssignToFieldData<Int64>(v,tr,att,f1ts->getName(),postProcessedArr==crudeArr,discs,_elga_cmp,globs,f1ts,ds,internalInfo);
+ }
else
throw INTERP_KERNEL::Exception("MEDFileFieldRepresentationLeavesArrays::appendFields : only FLOAT64 and INT32 fields are dealt for the moment ! Internal Error !");
}
/*!
* \param [in] ms is the meshes pointer. It can be used only for information of geometric types. No special processing will be requested on ms.
+ * \param [in] meshName
+ * \param [in] sil
+ * \param [in] root
+ * \param [in] edge
+ * \param [out] names
*/
void MEDFileFieldRepresentationLeaves::feedSIL(const MEDCoupling::MEDFileMeshes *ms, const std::string& meshName, vtkMutableDirectedGraph* sil, vtkIdType root, vtkVariantArray *edge, std::vector<std::string>& names) const
{
MCAuto<DataArrayByte> typesSafe(typesMC);
MCAuto<DataArrayIdType> cellLocationsSafe(cellLocationsMC),cellsSafe(cellsMC),faceLocationsSafe(faceLocationsMC),facesSafe(facesMC);
//
- int nbOfCells(typesSafe->getNbOfElems());
+ vtkIdType nbOfCells(typesSafe->getNbOfElems());
vtkUnstructuredGrid *ret(vtkUnstructuredGrid::New());
vtkUnsignedCharArray *cellTypes(vtkUnsignedCharArray::New());
AssignDataPointerOther<vtkUnsignedCharArray,DataArrayByte>(cellTypes,typesSafe,nbOfCells);
fields_per_mesh[i]=_fields->partOfThisLyingOnSpecifiedMeshName(meshNames[i].c_str());
}
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTS > > allFMTSLeavesToDisplaySafe;
- std::size_t k(0);
for(std::vector< MCAuto<MEDFileFields> >::const_iterator fields=fields_per_mesh.begin();fields!=fields_per_mesh.end();fields++)
{
for(int j=0;j<(*fields)->getNumberOfFields();j++)
this->computeFullNameInLeaves();
}
-void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts)
+void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, int iPart, int nbOfParts)
{
MCAuto<MEDFileMeshes> ms;
MCAuto<MEDFileFields> fields;
- if(isMEDOrSauv)
{
if((iPart==-1 && nbOfParts==-1) || (iPart==0 && nbOfParts==1))
{
#endif
}
}
- else
- {
- MCAuto<MEDCoupling::SauvReader> sr(MEDCoupling::SauvReader::New(fileName));
- MCAuto<MEDCoupling::MEDFileData> mfd(sr->loadInMEDFileDS());
- ms=mfd->getMeshes(); ms->incrRef();
- int nbMeshes(ms->getNumberOfMeshes());
- for(int i=0;i<nbMeshes;i++)
- {
- MEDCoupling::MEDFileMesh *tmp(ms->getMeshAtPos(i));
- MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast<MEDCoupling::MEDFileUMesh *>(tmp));
- if(tmp2)
- tmp2->forceComputationOfParts();
- }
- fields=mfd->getFields();
- if(fields.isNotNull())
- fields->incrRef();
- }
loadInMemory(fields,ms);
}
if(ts.size()!=1)
{
std::vector<double> ts2(ts.size());
- std::transform(ts.begin(),ts.end(),ts2.begin(),std::bind2nd(std::plus<double>(),-timeReq));
- std::transform(ts2.begin(),ts2.end(),ts2.begin(),std::ptr_fun<double,double>(fabs));
- zeTimeId=std::distance(ts2.begin(),std::find_if(ts2.begin(),ts2.end(),std::bind2nd(std::less<double>(),1e-14)));
+ std::transform(ts.begin(),ts.end(),ts2.begin(),std::bind(std::plus<double>(),std::placeholders::_1,-timeReq));
+ std::transform(ts2.begin(),ts2.end(),ts2.begin(),[](double c) {return fabs(c);});
+ zeTimeId=std::distance(ts2.begin(),std::find_if(ts2.begin(),ts2.end(),std::bind(std::less<double>(),std::placeholders::_1,1e-14)));
}
//2nd chance
if(zeTimeId==ts.size())