-// Copyright (C) 2017-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2017-2021 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
using namespace MEDCoupling;
-template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<int>;
+template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<Int32>;
+template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<Int64>;
template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<float>;
template class MEDCoupling::MEDFileTemplateFieldMultiTSWithoutSDA<double>;
-template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<int>;
+template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<Int32>;
+template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<Int64>;
template class MEDCoupling::MEDFileNDTemplateFieldMultiTSWithoutSDA<float>;
-template class MEDCoupling::MEDFileTemplateFieldMultiTS<int>;
+template class MEDCoupling::MEDFileTemplateFieldMultiTS<Int32>;
+template class MEDCoupling::MEDFileTemplateFieldMultiTS<Int64>;
template class MEDCoupling::MEDFileTemplateFieldMultiTS<float>;
template class MEDCoupling::MEDFileTemplateFieldMultiTS<double>;
-template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<int>;
+template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<Int32>;
+template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<Int64>;
template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<float>;
extern INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype);
std::size_t j=bg;
for(int i=0;i<nbOfEntriesToKeep;i++,j+=step)
{
- if(j>=0 && j<sz)
+ if(j<sz)
{
const MEDFileAnyTypeField1TSWithoutSDA *tse=_time_steps[j];
MCAuto<MEDFileAnyTypeField1TSWithoutSDA> tse2;
int i=0;
for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
{
- std::string chapter(17,'0'+i);
+ std::string chapter(17,(char)('0'+i));
oss << startLine << chapter << std::endl;
const MEDFileAnyTypeField1TSWithoutSDA *cur=(*it);
if(cur)
MEDFileCapability mfcap(fid);
if( ( !entities || entities->areAllStaticPresentAndNoDyn() ) && mfcap.isFastReader())
{// no entities
- int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT));
+ med_int nentitype(MEDfieldnEntityType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT));
INTERP_KERNEL::AutoPtr<med_entity_type> types(new med_entity_type[nentitype]);
med_int usedbyncs;
MEDFILESAFECALLERRD0(MEDfieldEntityType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types,&usedbyncs));
std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesFastP;
for(int i=0;i<nentitype;i++)
{
- int ngeotype(MEDfieldnGeometryType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i]));
+ med_int ngeotype(MEDfieldnGeometryType(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i]));
INTERP_KERNEL::AutoPtr<med_geometry_type> geotypes(new med_geometry_type[ngeotype]);
med_int geousedbyncs;
MEDFILESAFECALLERRD0(MEDfieldGeometryType,(fid,_name.c_str(),MED_ALL_DT,MED_ALL_IT,types[i],geotypes,&geousedbyncs));
- for(int j=0;j<ngeotype;j++)
+ for(med_int j=0;j<ngeotype;j++)
{
std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> p(MEDFileMesh::ConvertFromMEDFileEntity(types[i]),ConvertGeometryType(geotypes[j]));
entitiesFastP.push_back(p);
}
case MED_INT32:
{
- _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
+ _time_steps[i]=MEDFileInt32Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
+ break;
+ }
+ case MED_INT64:
+ {
+ _time_steps[i]=MEDFileInt64Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
break;
}
case MED_FLOAT32:
{
if(sizeof(med_int)==sizeof(int))
{
- _time_steps[i]=MEDFileIntField1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
+ _time_steps[i]=MEDFileInt32Field1TSWithoutSDA::New(getName(),getMeshName(),i+1,FromMedInt<int>(numdt),FromMedInt<int>(numo),_infos);
break;
}
}
default:
- throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32, FLOAT32 !");
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::loadStructureOrStructureAndBigArraysRecursively : managed field type are : FLOAT64, INT32, FLOAT32, INT64 !");
}
if(loadAll)
_time_steps[i]->loadStructureAndBigArraysRecursively(fid,*this,ms,entitiesForSubInstances);
void MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayIdType *profile, MEDFileFieldGlobsReal& glob, bool smartPflKiller)
{
if(!field)
- throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTSWithoutSDA::appendFieldNoProfileSBT : input field is NULL !");
if(!_time_steps.empty())
checkCoherencyOfTinyInfo(field,arr);
MCAuto<MEDFileAnyTypeField1TSWithoutSDA> obj(createNew1TSWithoutSDAEmptyInstance());
return myF1TSC->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
}
-MEDFileIntFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const
+MEDFileInt32FieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::convertToInt() const
{
- MCAuto<MEDFileIntFieldMultiTSWithoutSDA> ret(new MEDFileIntFieldMultiTSWithoutSDA);
+ MCAuto<MEDFileInt32FieldMultiTSWithoutSDA> ret(new MEDFileInt32FieldMultiTSWithoutSDA);
ret->MEDFileAnyTypeFieldMultiTSWithoutSDA::operator =(*this);
int i=0;
for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,i++)
return ret.retn();
}
+MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileFieldMultiTSWithoutSDA::createNewWithSDA() const
+{
+ MCAuto<MEDFileFieldMultiTS> ret(MEDFileFieldMultiTS::New());
+ return DynamicCast<MEDFileFieldMultiTS,MEDFileAnyTypeFieldMultiTS>(ret);
+}
+
+//=
+
+MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileInt32FieldMultiTSWithoutSDA::createNewWithSDA() const
+{
+ MCAuto<MEDFileInt32FieldMultiTS> ret(MEDFileInt32FieldMultiTS::New());
+ return DynamicCast<MEDFileInt32FieldMultiTS,MEDFileAnyTypeFieldMultiTS>(ret);
+}
+
+//=
+
+MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileInt64FieldMultiTSWithoutSDA::createNewWithSDA() const
+{
+ MCAuto<MEDFileInt64FieldMultiTS> ret(MEDFileInt64FieldMultiTS::New());
+ return DynamicCast<MEDFileInt64FieldMultiTS,MEDFileAnyTypeFieldMultiTS>(ret);
+}
+
+//=
+
+MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileFloatFieldMultiTSWithoutSDA::createNewWithSDA() const
+{
+ MCAuto<MEDFileFloatFieldMultiTS> ret(MEDFileFloatFieldMultiTS::New());
+ return DynamicCast<MEDFileFloatFieldMultiTS,MEDFileAnyTypeFieldMultiTS>(ret);
+}
+
//= MEDFileAnyTypeFieldMultiTS
MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS()
}
case MED_INT32:
{
- ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
+ ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
+ break;
+ }
+ case MED_INT64:
+ {
+ ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
break;
}
case MED_FLOAT32:
{
if(sizeof(med_int)==sizeof(int))
{
- ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
+ ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,i,loadAll,ms,entities);
break;
}
}
default:
{
- std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !";
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid,fieldName) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !";
throw INTERP_KERNEL::Exception(oss.str());
}
}
}
case MED_INT32:
{
- ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
+ ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
+ break;
+ }
+ case MED_INT64:
+ {
+ ret=new MEDFileInt64FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
break;
}
case MED_FLOAT32:
{
if(sizeof(med_int)==sizeof(int))
{
- ret=new MEDFileIntFieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
+ ret=new MEDFileInt32FieldMultiTSWithoutSDA(fid,0,loadAll,ms,0);
break;
}
}
default:
{
- std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32] !";
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTS::BuildContentFrom(fid) : file \'" << FileNameFromFID(fid) << "\' contains field with name \'" << fieldName << "\' but the type of the first field is not in [MED_FLOAT64, MED_INT32, MED_FLOAT32, MED_INT64] !";
throw INTERP_KERNEL::Exception(oss.str());
}
}
ret->_content=c; c->incrRef();
return ret.retn();
}
- if(dynamic_cast<const MEDFileIntFieldMultiTSWithoutSDA *>(c))
+ if(dynamic_cast<const MEDFileInt32FieldMultiTSWithoutSDA *>(c))
+ {
+ MCAuto<MEDFileInt32FieldMultiTS> ret(MEDFileInt32FieldMultiTS::New());
+ ret->_content=c; c->incrRef();
+ return ret.retn();
+ }
+ if(dynamic_cast<const MEDFileInt64FieldMultiTSWithoutSDA *>(c))
{
- MCAuto<MEDFileIntFieldMultiTS> ret(MEDFileIntFieldMultiTS::New());
+ MCAuto<MEDFileInt64FieldMultiTS> ret(MEDFileInt64FieldMultiTS::New());
ret->_content=c; c->incrRef();
return ret.retn();
}
//= MEDFileAnyTypeFieldMultiTS
/*!
- * Returns a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS holding data of the first field
+ * Returns a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS holding data of the first field
* that has been read from a specified MED file.
* \param [in] fileName - the name of the MED file to read.
- * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS. The caller
+ * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS. The caller
* is to delete this field using decrRef() as it is no more needed.
* \throw If reading the file fails.
*/
}
/*!
- * Returns a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS holding data of a given field
+ * Returns a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS holding data of a given field
* that has been read from a specified MED file.
* \param [in] fileName - the name of the MED file to read.
* \param [in] fieldName - the name of the field to read.
- * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileIntFieldMultiTS. The caller
+ * \return MEDFileFieldMultiTS * - a new instance of MEDFileFieldMultiTS or MEDFileInt32FieldMultiTS. The caller
* is to delete this field using decrRef() as it is no more needed.
* \throw If reading the file fails.
* \throw If there is no field named \a fieldName in the file.
}
/*!
- * Returns a new MEDFileField1TS or MEDFileIntField1TS holding data of a given time step of \a this field.
+ * Returns a new MEDFileField1TS or MEDFileInt32Field1TS holding data of a given time step of \a this field.
* \param [in] iteration - the iteration number of a required time step.
* \param [in] order - the iteration order number of required time step.
- * \return MEDFileField1TS * or MEDFileIntField1TS *- a new instance of MEDFileField1TS or MEDFileIntField1TS. The caller is to
+ * \return MEDFileField1TS * or MEDFileInt32Field1TS *- a new instance of MEDFileField1TS or MEDFileInt32Field1TS. The caller is to
* delete this field using decrRef() as it is no more needed.
* \throw If there is no required time step in \a this field.
*/
}
/*!
- * Returns a new MEDFileField1TS or MEDFileIntField1TS holding data of a given time step of \a this field.
+ * Returns a new MEDFileField1TS or MEDFileInt32Field1TS holding data of a given time step of \a this field.
* \param [in] time - the time of the time step of interest.
* \param [in] eps - a precision used to compare time values.
* \return MEDFileField1TS * - a new instance of MEDFileField1TS. The caller is to
/*!
* \a dts and \a ftmss are expected to have same size.
+ * see MEDFileFieldPerMeshPerTypePerDisc::Aggregate for description of \a dts.
*/
MCAuto<MEDFileAnyTypeFieldMultiTS> MEDFileAnyTypeFieldMultiTS::Aggregate(const std::vector<const MEDFileAnyTypeFieldMultiTS *>& fmtss, const std::vector< std::vector< std::pair<int,mcIdType> > >& dts)
{
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : input vector is empty !");
std::size_t sz(fmtss.size());
std::vector<const MEDFileFieldMultiTS *> fmtss1;
- std::vector<const MEDFileIntFieldMultiTS *> fmtss2;
+ std::vector<const MEDFileInt32FieldMultiTS *> fmtss2;
+ std::vector<const MEDFileInt64FieldMultiTS *> fmtss3;
for(std::vector<const MEDFileAnyTypeFieldMultiTS *>::const_iterator it=fmtss.begin();it!=fmtss.end();it++)
{
if(!(*it))
fmtss1.push_back(elt1);
continue;
}
- const MEDFileIntFieldMultiTS *elt2(dynamic_cast<const MEDFileIntFieldMultiTS *>(*it));
+ const MEDFileInt32FieldMultiTS *elt2(dynamic_cast<const MEDFileInt32FieldMultiTS *>(*it));
if(elt2)
{
fmtss2.push_back(elt2);
continue;
}
+ const MEDFileInt64FieldMultiTS *elt3(dynamic_cast<const MEDFileInt64FieldMultiTS *>(*it));
+ if(elt3)
+ {
+ fmtss3.push_back(elt3);
+ continue;
+ }
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not recognized type !");
}
- if(fmtss1.size()!=sz && fmtss2.size()!=sz)
+ if(fmtss1.size()!=sz && fmtss2.size()!=sz && fmtss3.size()!=sz)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : type of data is not homogeneous !");
if(fmtss1.size()==sz)
return AggregateHelperFMTS<double>(fmtss1,dts);
if(fmtss2.size()!=sz)
- return AggregateHelperFMTS<int>(fmtss2,dts);
+ return AggregateHelperFMTS<Int32>(fmtss2,dts);
+ if(fmtss3.size()!=sz)
+ return AggregateHelperFMTS<Int64>(fmtss3,dts);
throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::Aggregate : not implemented yet !");
}
*
* \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
* By default (true) the globals are deeply copied.
- * \return MEDFileIntFieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field.
+ * \return MEDFileInt32FieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field.
*/
-MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const
+MEDFileInt32FieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const
{
- MCAuto<MEDFileIntFieldMultiTS> ret;
+ MCAuto<MEDFileInt32FieldMultiTS> ret;
const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
if(content)
{
const MEDFileFieldMultiTSWithoutSDA *contc=dynamic_cast<const MEDFileFieldMultiTSWithoutSDA *>(content);
if(!contc)
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::convertToInt : the content inside this is not FLOAT64 ! This is incoherent !");
- MCAuto<MEDFileIntFieldMultiTSWithoutSDA> newc(contc->convertToInt());
- ret=static_cast<MEDFileIntFieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileIntFieldMultiTSWithoutSDA *)newc));
+ MCAuto<MEDFileInt32FieldMultiTSWithoutSDA> newc(contc->convertToInt());
+ ret=static_cast<MEDFileInt32FieldMultiTS *>(MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent((MEDFileInt32FieldMultiTSWithoutSDA *)newc));
}
else
- ret=MEDFileIntFieldMultiTS::New();
+ ret=MEDFileInt32FieldMultiTS::New();
if(isDeepCpyGlobs)
ret->deepCpyGlobs(*this);
else
return 0;
}
-//= MEDFileIntFieldMultiTS
+//= MEDFileInt32FieldMultiTS