return ReadFieldsOnSameMesh(ON_GAUSS_NE,fileName,meshName,meshDimRelToMax,fieldName,its);
}
+namespace MEDCoupling
+{
+ MEDCoupling::MEDCouplingFieldDouble *ReadFieldCellLike(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
+ {
+ MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
+ MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
+ MEDFileMesh *mPtr(mm);
+ MEDFileUMesh *muPtr=dynamic_cast<MEDFileUMesh *>(mPtr);
+ MCAuto<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(type,m));
+ if(muPtr)
+ {
+ const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
+ if(num)
+ ret->renumberCells(num->begin());
+ }
+ return ret.retn();
+ }
+}
+
MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
- MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
- MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
- MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
- MEDFileMesh *mPtr(mm);
- MEDFileUMesh *muPtr=dynamic_cast<MEDFileUMesh *>(mPtr);
- MCAuto<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_CELLS,m));
- if(muPtr)
- {
- const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
- if(num)
- ret->renumberCells(num->begin());
- }
- return ret.retn();
+ return ReadFieldCellLike(ON_CELLS,fileName,meshName,meshDimRelToMax,fieldName,iteration,order);
}
MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
- MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
- MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
- MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
- MEDFileMesh *mPtr(mm);
- MEDFileUMesh *muPtr=dynamic_cast<MEDFileUMesh *>(mPtr);
- MCAuto<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_PT,m));
- if(muPtr)
- {
- const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
- if(num)
- ret->renumberCells(num->begin());
- }
- return ret.retn();
+ return ReadFieldCellLike(ON_GAUSS_PT,fileName,meshName,meshDimRelToMax,fieldName,iteration,order);
}
MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
- MCAuto<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
- MCAuto<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
- MCAuto<MEDCouplingMesh> m(mm->getMeshAtLevel(meshDimRelToMax,false));
- MEDFileMesh *mPtr(mm);
- MEDFileUMesh *muPtr=dynamic_cast<MEDFileUMesh *>(mPtr);
- MCAuto<MEDCouplingFieldDouble> ret(ff->getFieldOnMeshAtLevel(ON_GAUSS_NE,m));
- if(muPtr)
- {
- const DataArrayInt *num(muPtr->getNumberFieldAtLevel(meshDimRelToMax));
- if(num)
- ret->renumberCells(num->begin());
- }
- return ret.retn();
+ return ReadFieldCellLike(ON_GAUSS_NE,fileName,meshName,meshDimRelToMax,fieldName,iteration,order);
}
void MEDCoupling::WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch)