goReadZeValuesInFile(fid,fieldName,nbOfCompo,iteration,order,menti,mgeoti,reinterpret_cast<unsigned char*>(startFeeding));
return ;
}
- throw INTERP_KERNEL::Exception("Error on array reading ! Unrecognized type of field ! Should be in FLOAT64 FLOAT32 or INT32 !");
+ throw INTERP_KERNEL::Exception("Error on array reading ! Unrecognized type of field ! Should be in FLOAT64 FLOAT32 INT32 or INT64 !");
}
/*!
template class MEDCoupling::MEDFileNDTemplateFieldMultiTS<float>;
extern INTERP_KERNEL::NormalizedCellType ConvertGeometryType(med_geometry_type geotype);
-
+
//= MEDFileAnyTypeFieldMultiTSWithoutSDA
MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA()
int MEDFileAnyTypeFieldMultiTSWithoutSDA::getPosOfTimeStep(int iteration, int order) const
{
int ret=0;
- std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : ";
+ std::ostringstream oss; oss << "MEDFileFieldMultiTSWithoutSDA::getPosOfTimeStep : No such time step (" << iteration << "," << order << ") !\nPossibilities are : ";
for(std::vector< MCAuto<MEDFileAnyTypeField1TSWithoutSDA> >::const_iterator it=_time_steps.begin();it!=_time_steps.end();it++,ret++)
{
const MEDFileAnyTypeField1TSWithoutSDA *tmp(*it);
/*!
* This method has 3 inputs 'iteration' 'order' 'mname'. 'mname' can be null if the user is the general case where there is only one meshName lying on 'this'
* This method returns two things.
- * - The absolute dimension of 'this' in first parameter.
+ * - The absolute dimension of 'this' in first parameter.
* - The available ext levels relative to the absolute dimension returned in first parameter. These relative levels are relative
* to the first output parameter. The values in 'levs' will be returned in decreasing order.
*
*
* This method is useful to make the link between meshDimension of the underlying mesh in 'this' and the levels on 'this'.
* It is possible (even if it is not common) that the highest level in 'this' were not equal to the meshDimension of the underlying mesh in 'this'.
- *
+ *
* Let's consider the typical following case :
* - a mesh 'm1' has a meshDimension 3 and has the following non empty levels
* [0,-1,-2] for example 'm1' lies on TETRA4, HEXA8 TRI3 and SEG2
* - 'f2' lies on 'm1' too and is defined on 2D and 1D cells for example TRI3 and SEG2
*
* In this case f1->getNonEmptyLevelsExt will return (3,[0,-2]) and f2->getNonEmptyLevelsExt will return (2,[0,-1])
- *
+ *
* To retrieve the highest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+0);//absDim-meshDim+relativeLev
* To retrieve the lowest level of f1 it should be done, f1->getFieldAtLevel(ON_CELLS,3-3+(-2));//absDim-meshDim+relativeLev
* To retrieve the highest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+0);//absDim-meshDim+relativeLev
const MEDFileAnyTypeField1TSWithoutSDA *timeStep(_time_steps[i]);
if(!timeStep)
{
- std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : time step #" << i << " is null !";
+ std::ostringstream oss; oss << "MEDFileAnyTypeFieldMultiTSWithoutSDA::splitDiscretizations : time step #" << i << " is null !";
throw INTERP_KERNEL::Exception(oss.str());
}
- items[i]=timeStep->splitDiscretizations();
+ items[i]=timeStep->splitDiscretizations();
}
//
std::vector< MCAuto<MEDFileAnyTypeFieldMultiTSWithoutSDA> > ret;
ret->_content=c; c->incrRef();
return ret.retn();
}
- throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 FLOAT32 and INT32 has been built but not intercepted !");
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 FLOAT32 INT32 and INT64 has been built but not intercepted !");
}
MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, med_idt fid)
* This method alloc the arrays and load potentially huge arrays contained in this field.
* This method should be called when a MEDFileAnyTypeFieldMultiTS::New constructor has been with false as the last parameter.
* This method can be also called to refresh or reinit values from a file.
- *
+ *
* \throw If the fileName is not set or points to a non readable MED file.
*/
void MEDFileAnyTypeFieldMultiTS::loadArrays()
/*!
* This method behaves as MEDFileAnyTypeFieldMultiTS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
* But once data loaded once, this method does nothing.
- *
+ *
* \throw If the fileName is not set or points to a non readable MED file.
* \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::unloadArrays
*/
* This method releases potentially big data arrays and so returns to the same heap memory than status loaded with 'loadAll' parameter set to false.
* \b WARNING, this method does release arrays even if \a this does not come from a load of a MED file.
* So this method can lead to a loss of data. If you want to unload arrays safely call MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss instead.
- *
+ *
* \sa MEDFileAnyTypeFieldMultiTS::loadArrays, MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary, MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss
*/
void MEDFileAnyTypeFieldMultiTS::unloadArrays()
* This method potentially releases big data arrays if \a this is coming from a file. If \a this has been built from scratch this method will have no effect.
* This method is the symmetrical method of MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary.
* This method is useful to reduce \b safely amount of heap memory necessary for \a this by using MED file as database.
- *
+ *
* \sa MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary
*/
void MEDFileAnyTypeFieldMultiTS::unloadArraysWithoutDataLoss()
}
}
-MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator()
+MEDFileAnyTypeFieldMultiTSIterator::~MEDFileAnyTypeFieldMultiTSIterator()
{
}
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldFloat.hxx"
#include "MEDCouplingFieldInt32.hxx"
+#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingGaussLocalization.hxx"
#include "MEDCouplingTraits.hxx"
#include "MCAuto.hxx"
if(nstep!=1)
{
throw INTERP_KERNEL::Exception("multisteps on mesh not managed yet !");
- }
+ }
med_int numdt,numit;
med_float dt;
MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,nommaa,1,&numdt,&numit,&dt));
return MEDCoupling::DynamicCast<MEDCouplingFieldInt32,MEDCouplingField>(ret);
}
}
+ {
+ MCAuto<MEDFileInt64Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt64Field1TS>(f));
+ if(f1.isNotNull())
+ {
+ MCAuto<MEDCoupling::MEDCouplingFieldInt64> ret(f1->field(mesh));
+ return MEDCoupling::DynamicCast<MEDCouplingFieldInt64,MEDCouplingField>(ret);
+ }
+ }
{
MCAuto<MEDFileFloatField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileFloatField1TS>(f));
if(f1.isNotNull())
return MEDCoupling::DynamicCast<MEDCouplingFieldFloat,MEDCouplingField>(ret);
}
}
- throw INTERP_KERNEL::Exception("MEDCoupling::ReadField : only FLOAT32, FLOAT64 and INT32 supported for the moment !");
+
+ throw INTERP_KERNEL::Exception("MEDCoupling::ReadField : only FLOAT32, FLOAT64, INT32 and INT64 supported for the moment !");
}
MCAuto<MEDCoupling::MEDCouplingField> MEDCoupling::ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
return ret.retn();
}
}
+ {
+ MCAuto<MEDFileInt64Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt64Field1TS>(f));
+ if(f1.isNotNull())
+ {
+ MCAuto<MEDCoupling::MEDCouplingFieldInt64> ret(ReadFieldCellLikeT<Int64>(f1,type,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
+ return ret.retn();
+ }
+ }
{
MCAuto<MEDFileFloatField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileFloatField1TS>(f));
if(f1.isNotNull())
return ret.retn();
}
}
- throw INTERP_KERNEL::Exception("MEDCoupling::ReadFieldCell : only FLOAT32, FLOAT64 and INT32 supported for the moment !");
+ throw INTERP_KERNEL::Exception("MEDCoupling::ReadFieldCell : only FLOAT32, FLOAT64, INT32 and INT64 supported for the moment !");
}
template<class T>
return ret.retn();
}
}
+ {
+ MCAuto<MEDFileInt64Field1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileInt64Field1TS>(f));
+ if(f1.isNotNull())
+ {
+ MCAuto<MEDCoupling::MEDCouplingFieldInt64> ret(ReadFieldNodeT<Int64>(f1,fileName,meshName,meshDimRelToMax,fieldName,iteration,order));
+ return ret.retn();
+ }
+ }
{
MCAuto<MEDFileFloatField1TS> f1(MEDCoupling::DynamicCast<MEDFileAnyTypeField1TS,MEDFileFloatField1TS>(f));
if(f1.isNotNull())
return ret.retn();
}
}
- throw INTERP_KERNEL::Exception("MEDCoupling::ReadFieldNode : only FLOAT32, FLOAT64 and INT32 supported for the moment !");
+ throw INTERP_KERNEL::Exception("MEDCoupling::ReadFieldNode : only FLOAT32, FLOAT64, INT32 and INT64 supported for the moment !");
}
MEDCoupling::MEDCouplingField *MEDCoupling::ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
return ;
}
}
+ {
+ const MEDCoupling::MEDCouplingFieldInt64 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt64 *>(f));
+ if(f1)
+ {
+ WriteFieldT<Int64>(fileName,f1,writeFromScratch);
+ return ;
+ }
+ }
+
{
const MEDCoupling::MEDCouplingFieldFloat *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldFloat *>(f));
if(f1)
return ;
}
}
- throw INTERP_KERNEL::Exception("WriteField : input field is not in FLOAT32, FLOAT64, INT32 !");
+ throw INTERP_KERNEL::Exception("WriteField : input field is not in FLOAT32, FLOAT64, INT32 and INT64!");
}
void MEDCoupling::WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingField *f, bool writeFromScratch)
return ;
}
}
+ {
+ const MEDCoupling::MEDCouplingFieldInt64 *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldInt64 *>(f));
+ if(f1)
+ {
+ WriteFieldUsingAlreadyWrittenMeshT<Int64>(fileName,f1);
+ return ;
+ }
+ }
{
const MEDCoupling::MEDCouplingFieldFloat *f1(dynamic_cast<const MEDCoupling::MEDCouplingFieldFloat *>(f));
if(f1)
return ;
}
}
- throw INTERP_KERNEL::Exception("WriteFieldUsingAlreadyWrittenMesh : input field is not in FLOAT32, FLOAT64, INT32 !");
+ throw INTERP_KERNEL::Exception("WriteFieldUsingAlreadyWrittenMesh : input field is not in FLOAT32, FLOAT64, INT32 and INT64 !");
}
#include "MEDCouplingUMesh.hxx"
#include "MEDCouplingFieldDouble.hxx"
#include "MEDCouplingFieldFloat.hxx"
+#include "MEDCouplingFieldInt64.hxx"
#include "MEDCouplingMemArray.hxx"
#include "TestInterpKernelUtils.hxx" // getResourceFile()
MEDCouplingFieldDouble *f1=buildVecFieldOnCells_1();
MEDCouplingFieldInt *f1_int=buildIntVecFieldOnCells_1();
MEDCouplingFieldFloat *f1_fl=buildFloatVecFieldOnCells_1();
+ MEDCouplingFieldInt64 *f1_int64=buildInt64VecFieldOnCells_1();
WriteField(fileName,f1,true);
f1->setTime(10.,8,9);
f1_int->setTime(10.,8,9);
f1_fl->setTime(10.,8,9);
+ f1_int64->setTime(10.,8,9);
double *tmp=f1->getArray()->getPointer();
tmp[0]=VAL1;
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
// Write int and float fields:
WriteFieldUsingAlreadyWrittenMesh(fileName,f1_int);
+ WriteFieldUsingAlreadyWrittenMesh(fileName,f1_int64);
WriteFieldUsingAlreadyWrittenMesh(fileName,f1_fl);
//retrieving time steps...
MEDCouplingFieldDouble *f2=dynamic_cast<MEDCouplingFieldDouble *>(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),8,9));
CPPUNIT_ASSERT(f1_int->isEqual(f2_int,1e-12,0)); // exact equality for int values
f2_int->decrRef();
f1_int->decrRef();
+ MEDCouplingFieldInt64 *f2_int64=dynamic_cast<MEDCouplingFieldInt64 *>(ReadFieldCell(fileName,f1_int64->getMesh()->getName().c_str(),0,f1_int64->getName().c_str(),8,9));
+ CPPUNIT_ASSERT(f1_int64->isEqual(f2_int64,1e-12,0)); // exact equality for int values
+ f2_int64->decrRef();
+ f1_int64->decrRef();
MEDCouplingFieldFloat *f2_fl=dynamic_cast<MEDCouplingFieldFloat *>(ReadFieldCell(fileName,f1_fl->getMesh()->getName().c_str(),0,f1_fl->getName().c_str(),8,9));
CPPUNIT_ASSERT(f1_fl->isEqual(f2_fl,1e-12,1e-07f)); // float comparison
f2_fl->decrRef();
return f1;
}
+MEDCouplingFieldInt64 *MEDLoaderTest::buildInt64VecFieldOnCells_1()
+{
+ MEDCouplingUMesh *mesh=build3DSurfMesh_1();
+ mcIdType nbOfCells=mesh->getNumberOfCells();
+ MEDCouplingFieldInt64 *f1=MEDCouplingFieldInt64::New(ON_CELLS,ONE_TIME);
+ f1->setName("Int64VectorFieldOnCells");
+ f1->setMesh(mesh);
+ DataArrayInt64 *array=DataArrayInt64::New();
+ array->alloc(nbOfCells,3);
+ array->setInfoOnComponent(0,"val1 [MW/m^3]");
+ array->setInfoOnComponent(1,"va2 [g/cm^3]");
+ array->setInfoOnComponent(2,"val3 [K]");
+ f1->setArray(array);
+ array->decrRef();
+ int64_t *tmp=array->getPointer();
+ const int64_t arr1[18]={0,10,20,1,11,21,2,12,22,3,13,23,4,14,24,5,15,25};
+ std::copy(arr1,arr1+18,tmp);
+ f1->setTime(2.,0,1);
+ f1->checkConsistencyLight();
+ mesh->decrRef();
+ return f1;
+}
+
MEDCouplingFieldFloat *MEDLoaderTest::buildFloatVecFieldOnCells_1()
{
MEDCouplingUMesh *mesh=build3DSurfMesh_1();
MEDCouplingUMesh *build3DMesh_2();
MEDCouplingFieldDouble *buildVecFieldOnCells_1();
MEDCouplingFieldInt *buildIntVecFieldOnCells_1();
+ MEDCouplingFieldInt64 *buildInt64VecFieldOnCells_1();
MEDCouplingFieldFloat *buildFloatVecFieldOnCells_1();
MEDCouplingFieldDouble *buildVecFieldOnNodes_1();
MEDCouplingFieldDouble *buildVecFieldOnGauss_1();