#include "vtkAdjacentVertexIterator.h"
#include "vtkIntArray.h"
+#include "vtkLongArray.h"
#include "vtkCellData.h"
#include "vtkPointData.h"
#include "vtkFloatArray.h"
#include "MEDFileField.hxx"
#include "MEDFileData.hxx"
#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingFieldInt.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingRefCountObject.hxx"
using MEDCoupling::MEDCouplingUMesh;
using MEDCoupling::MEDCouplingCMesh;
using MEDCoupling::MEDCouplingFieldDouble;
+using MEDCoupling::MEDCouplingFieldInt;
using MEDCoupling::MCAuto;
vtkStandardNewMacro(vtkMEDWriter);
std::copy(pt,pt+nbElts,ptOut);
return ret.retn();
}
+ vtkLongArray *d1(vtkLongArray::SafeDownCast(data));
+ if(d1)
+ {
+ const long *pt(d1->GetPointer(0));
+ std::copy(pt,pt+nbElts,ptOut);
+ return ret.retn();
+ }
std::ostringstream oss;
oss << "ConvertVTKArrayToMCArrayInt : unrecognized array \"" << typeid(*data).name() << "\" type !";
throw MZCException(oss.str());
if(d0 || d1)
return ConvertVTKArrayToMCArrayDouble(data);
vtkIntArray *d2(vtkIntArray::SafeDownCast(data));
- if(d2)
+ vtkLongArray *d3(vtkLongArray::SafeDownCast(data));
+ if(d2 || d3)
return ConvertVTKArrayToMCArrayInt(data);
std::ostringstream oss;
oss << "ConvertVTKArrayToMCArray : unrecognized array \"" << typeid(*data).name() << "\" type !";
fieldName=daiPtr->getName();
if((fieldName!=FAMFIELD_FOR_CELLS || tf!=MEDCoupling::ON_CELLS) && (fieldName!=FAMFIELD_FOR_NODES || tf!=MEDCoupling::ON_NODES))
{
- MCAuto<MEDCouplingFieldDouble> f(MEDCouplingFieldDouble::New(tf));
+ MCAuto<MEDCouplingFieldInt> f(MEDCouplingFieldInt::New(tf));
f->setName(fieldName);
f->setMesh(mesh);
MCAuto<MEDFileIntFieldMultiTS> fmts(MEDFileIntFieldMultiTS::New());
MCAuto<MEDFileIntField1TS> f1ts(MEDFileIntField1TS::New());
if(!n2oPtr)
- f1ts->setFieldNoProfileSBT(f,daiPtr);
+ {
+ f->setArray(dai);
+ f1ts->setFieldNoProfileSBT(f);
+ }
else
{
MCAuto<DataArrayInt> dai2(daiPtr->selectByTupleId(n2oPtr->begin(),n2oPtr->end()));
- f1ts->setFieldNoProfileSBT(f,dai2);
+ f->setArray(dai2);
+ f1ts->setFieldNoProfileSBT(f);
}
fmts->pushBackTimeStep(f1ts);
fs->pushField(fmts);
MEDFileUMesh *mmu(dynamic_cast<MEDFileUMesh *>(mm));
if(!mmu)
throw MZCException("AddNodeFields : internal error 2 !");
- MCAuto<MEDCouplingUMesh> mesh(mmu->getMeshAtLevel(0));
+ MCAuto<MEDCouplingUMesh> mesh;
+ if(!mmu->getNonEmptyLevels().empty())
+ mesh=mmu->getMeshAtLevel(0);
+ else
+ {
+ mesh=MEDCouplingUMesh::Build0DMeshFromCoords(mmu->getCoords());
+ mesh->setName(mmu->getName());
+ }
int nba(dsa->GetNumberOfArrays());
for(int i=0;i<nba;i++)
{
}
}
int dummy(0);
- int meshDim(lev->getMaxValue(dummy));
MCAuto<DataArrayInt> levs(lev->getDifferentValues());
std::vector< MicroField > ms;
vtkIdTypeArray *faces(ds->GetFaces()),*faceLoc(ds->GetFaceLocations());