From c8d33262ed6d2041da8512b02f8c8b4ffadf733d Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Wed, 20 Jan 2016 08:53:53 +0100 Subject: [PATCH] 6th step : Remove the additional MEDLoader level from MEDLoader. --- src/MEDLoader/MEDFileMesh.cxx | 12 +- src/MEDLoader/MEDLoader.cxx | 230 +++++----- src/MEDLoader/MEDLoader.hxx | 128 +++--- src/MEDLoader/Swig/MEDLoaderCommon.i | 433 +++++++++--------- .../Swig/MEDLoaderCouplingTrainingSession.py | 34 +- src/MEDLoader/Swig/MEDLoaderExamplesTest.py | 36 +- src/MEDLoader/Swig/MEDLoaderTest1.py | 266 +++++------ src/MEDLoader/Swig/MEDLoaderTest2.py | 128 +++--- src/MEDLoader/Swig/MEDLoaderTest3.py | 82 ++-- src/MEDLoader/Swig/MEDLoaderTest4.py | 34 +- src/MEDLoader/Swig/SauvLoaderTest.py | 2 +- src/MEDLoader/Test/MEDLoaderTest.cxx | 258 +++++------ .../MEDPARTITIONER_MeshCollection.cxx | 8 +- .../MEDPARTITIONER_MeshCollectionDriver.cxx | 8 +- ...RTITIONER_MeshCollectionMedAsciiDriver.cxx | 2 +- src/MEDPartitioner/MEDPARTITIONER_Utils.cxx | 8 +- .../Test/MEDPARTITIONERTest.cxx | 47 +- .../Test/MEDPARTITIONERTestPara.cxx | 8 +- src/ParaMEDLoader/ParaMEDFileMesh.cxx | 6 +- src/ParaMEDLoader/ParaMEDLoader.cxx | 2 +- .../ParaMEDMEMTest_InterpKernelDEC.cxx | 32 +- .../ParaMEDMEMTest_OverlapDEC.cxx | 16 +- ...ParaMEDMEMTest_StructuredCoincidentDEC.cxx | 4 +- src/ParaMEDMEMTest/test_perf.cxx | 4 +- src/ParaMEDMEM_Swig/test_InterpKernelDEC.py | 4 +- .../test_StructuredCoincidentDEC.py | 4 +- v8_work/ModifyNamespace.py | 23 + v8_work/TODO.txt | 2 +- 28 files changed, 929 insertions(+), 892 deletions(-) create mode 100644 v8_work/ModifyNamespace.py diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index 12a5d8fc3..6dd99c99f 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -76,7 +76,7 @@ std::vector MEDFileMesh::getDirectChildrenWithNull() co */ MEDFileMesh *MEDFileMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { - std::vector ms=MEDLoader::GetMeshNames(fileName); + std::vector ms=MEDCoupling::GetMeshNames(fileName); if(ms.empty()) { std::ostringstream oss; oss << "MEDFileMesh::New : no meshes in file \"" << fileName << "\" !"; @@ -2255,7 +2255,7 @@ MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, const std::string& */ MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { - std::vector ms=MEDLoader::GetMeshNames(fileName); + std::vector ms(MEDCoupling::GetMeshNames(fileName)); if(ms.empty()) { std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !"; @@ -5994,7 +5994,7 @@ MEDFileCMesh *MEDFileCMesh::New() */ MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { - std::vector ms=MEDLoader::GetMeshNames(fileName); + std::vector ms(MEDCoupling::GetMeshNames(fileName)); if(ms.empty()) { std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !"; @@ -6292,7 +6292,7 @@ MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New() MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs) { - std::vector ms=MEDLoader::GetMeshNames(fileName); + std::vector ms(MEDCoupling::GetMeshNames(fileName)); if(ms.empty()) { std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !"; @@ -6692,7 +6692,7 @@ MEDFileMeshMultiTS::MEDFileMeshMultiTS() MEDFileMeshMultiTS::MEDFileMeshMultiTS(const std::string& fileName) try { - std::vector ms=MEDLoader::GetMeshNames(fileName); + std::vector ms(MEDCoupling::GetMeshNames(fileName)); if(ms.empty()) { std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !"; @@ -6866,7 +6866,7 @@ void MEDFileMeshes::destroyMeshAtPos(int i) void MEDFileMeshes::loadFromFile(const std::string& fileName) { - std::vector ms=MEDLoader::GetMeshNames(fileName); + std::vector ms(MEDCoupling::GetMeshNames(fileName)); int i=0; _meshes.resize(ms.size()); for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++,i++) diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index d6252c6a4..f8211f58b 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -139,11 +139,11 @@ med_geometry_type typmai3[34] = { MED_POINT1,//0 MED_NONE//33 }; -double MEDLoader::_EPS_FOR_NODE_COMP=1.e-12; +double _EPS_FOR_NODE_COMP=1.e-12; -int MEDLoader::_COMP_FOR_CELL=0; +int _COMP_FOR_CELL=0; -int MEDLoader::_TOO_LONG_STR=0; +int _TOO_LONG_STR=0; using namespace MEDCoupling; @@ -294,12 +294,12 @@ void MEDLoaderNS::dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfEle /// @endcond -void MEDLoader::AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj) +void MEDCoupling::AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj) { obj.setTooLongStrPolicy(_TOO_LONG_STR); } -bool MEDLoader::HasXDR() +bool MEDCoupling::HasXDR() { #ifdef HAS_XDR return true; @@ -308,12 +308,12 @@ bool MEDLoader::HasXDR() #endif } -std::string MEDLoader::MEDFileVersionStr() +std::string MEDCoupling::MEDFileVersionStr() { return std::string(MED_VERSION_STR); } -void MEDLoader::MEDFileVersion(int& major, int& minor, int& release) +void MEDCoupling::MEDFileVersion(int& major, int& minor, int& release) { major=MED_NUM_MAJEUR; minor=MED_NUM_MINEUR; @@ -323,7 +323,7 @@ void MEDLoader::MEDFileVersion(int& major, int& minor, int& release) /*! * This method sets the epsilon value used for node comparison when trying to buid a profile for a field on node/cell on an already written mesh. */ -void MEDLoader::SetEpsilonForNodeComp(double val) +void MEDCoupling::SetEpsilonForNodeComp(double val) { _EPS_FOR_NODE_COMP=val; } @@ -331,7 +331,7 @@ void MEDLoader::SetEpsilonForNodeComp(double val) /*! * This method sets the policy comparison when trying to fit the already written mesh on a field. The semantic of the policy is specified in MEDCouplingUMesh::zipConnectivityTraducer. */ -void MEDLoader::SetCompPolicyForCell(int val) +void MEDCoupling::SetCompPolicyForCell(int val) { _COMP_FOR_CELL=val; } @@ -340,7 +340,7 @@ void MEDLoader::SetCompPolicyForCell(int val) * This method set the behaviour of MEDLoader when a too long string is seen in datastructure before copy it in MED file. * By default (0) an exception is thrown. If equal to 1 a warning is emitted in std_err but no exception is thrown. */ -void MEDLoader::SetTooLongStrPolicy(int val) +void MEDCoupling::SetTooLongStrPolicy(int val) { _TOO_LONG_STR=val; } @@ -353,7 +353,7 @@ void MEDLoader::SetTooLongStrPolicy(int val) * - the space dimension * - the number of nodes */ -std::vector< std::vector< std::pair > > MEDLoader::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes) +std::vector< std::vector< std::pair > > MEDCoupling::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes) { CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); @@ -373,13 +373,13 @@ std::vector< std::vector< std::pair > > M MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit)); if(type_maillage!=MED_UNSTRUCTURED_MESH) { - std::ostringstream oss; oss << "MEDLoader::GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName; + std::ostringstream oss; oss << "GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName; oss << "\" exists but it is not an unstructured mesh ! This method is not relevant for mesh types that are not unstructured !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } // limitation if(nstep!=1) - throw INTERP_KERNEL::Exception("MEDLoader::GetUMeshGlobalInfo : multisteps on mesh not managed !"); + throw INTERP_KERNEL::Exception("GetUMeshGlobalInfo : multisteps on mesh not managed !"); med_int numdt,numit; med_float dt; MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,nommaa,1,&numdt,&numit,&dt)); @@ -411,22 +411,22 @@ std::vector< std::vector< std::pair > > M return ret; } -void MEDLoader::CheckFileForRead(const std::string& fileName) +void MEDCoupling::CheckFileForRead(const std::string& fileName) { MEDFileUtilities::CheckFileForRead(fileName); } -std::vector MEDLoader::GetMeshNames(const std::string& fileName) +std::vector MEDCoupling::GetMeshNames(const std::string& fileName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); std::vector ret=MEDLoaderNS::getMeshNamesFid(fid); return ret; } -std::vector< std::pair > MEDLoader::GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) +std::vector< std::pair > MEDCoupling::GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields(MEDnField(fid)); std::vector fields(nbFields); @@ -454,15 +454,15 @@ std::vector< std::pair > MEDLoader::GetComponentsNamesO } fields[i]=curFieldName; } - std::ostringstream oss; oss << "MEDLoader::GetComponentsNamesOfField : no such field \"" << fieldName << "\" in file \"" << fileName << "\" !" << std::endl; + std::ostringstream oss; oss << "GetComponentsNamesOfField : no such field \"" << fieldName << "\" in file \"" << fileName << "\" !" << std::endl; oss << "Possible field names are : " << std::endl; std::copy(fields.begin(),fields.end(),std::ostream_iterator(oss," ")); throw INTERP_KERNEL::Exception(oss.str().c_str()); } -std::vector MEDLoader::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) +std::vector MEDCoupling::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::vector ret; // MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); @@ -489,9 +489,9 @@ std::vector MEDLoader::GetMeshNamesOnField(const std::string& fileN return ret; } -std::vector MEDLoader::GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) +std::vector MEDCoupling::GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret(nfam); @@ -513,9 +513,9 @@ std::vector MEDLoader::GetMeshFamiliesNames(const std::string& file } -std::vector MEDLoader::GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) +std::vector MEDCoupling::GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret; @@ -541,9 +541,9 @@ std::vector MEDLoader::GetMeshFamiliesNamesOnGroup(const std::strin return ret; } -std::vector MEDLoader::GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) +std::vector MEDCoupling::GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret; @@ -571,16 +571,16 @@ std::vector MEDLoader::GetMeshGroupsNamesOnFamily(const std::string if(!found) { std::ostringstream oss; - oss << "MEDLoader::GetMeshGroupsNamesOnFamily : no such family \"" << famName << "\" in file \"" << fileName << "\" in mesh \"" << meshName << "\" !"; + oss << "GetMeshGroupsNamesOnFamily : no such family \"" << famName << "\" in file \"" << fileName << "\" in mesh \"" << meshName << "\" !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } return ret; } -std::vector MEDLoader::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) +std::vector MEDCoupling::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nfam=MEDnFamily(fid,meshName.c_str()); std::vector ret; @@ -605,13 +605,13 @@ std::vector MEDLoader::GetMeshGroupsNames(const std::string& fileNa return ret; } -std::vector MEDLoader::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) +std::vector MEDCoupling::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { std::vector ret; MEDCouplingAutoRefCountObjectPtr fs(MEDFileAnyTypeFieldMultiTS::New(fileName,fieldName,false)); if(fs->getMeshName()!=meshName) { - std::ostringstream oss; oss << "MEDLoader::GetTypesOfField : The field \"" << fieldName << "\" in file \"" << fileName << "\" is not lying on mesh \"" << meshName << "\""; + std::ostringstream oss; oss << "GetTypesOfField : The field \"" << fieldName << "\" in file \"" << fileName << "\" is not lying on mesh \"" << meshName << "\""; oss << " The name of the mesh in file is \"" << fs->getMeshName() << "\"!"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } @@ -638,9 +638,9 @@ std::vector MEDLoader::GetTypesOfField(const std::stri return ret2; } -std::vector MEDLoader::GetAllFieldNames(const std::string& fileName) +std::vector MEDCoupling::GetAllFieldNames(const std::string& fileName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::vector ret; MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); @@ -661,9 +661,9 @@ std::vector MEDLoader::GetAllFieldNames(const std::string& fileName return ret; } -std::vector MEDLoader::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) +std::vector MEDCoupling::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::vector ret; MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); @@ -692,9 +692,9 @@ std::vector MEDLoader::GetAllFieldNamesOnMesh(const std::string& fi return ret; } -std::vector MEDLoader::GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName) +std::vector MEDCoupling::GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); switch(type) { case ON_CELLS: @@ -706,9 +706,9 @@ std::vector MEDLoader::GetFieldNamesOnMesh(MEDCoupling::TypeOfField } } -std::vector MEDLoader::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) +std::vector MEDCoupling::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::vector ret; MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); @@ -756,9 +756,9 @@ std::vector MEDLoader::GetCellFieldNamesOnMesh(const std::string& f return ret; } -std::vector MEDLoader::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) +std::vector MEDCoupling::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::vector ret; MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); @@ -797,9 +797,9 @@ std::vector MEDLoader::GetNodeFieldNamesOnMesh(const std::string& f return ret; } -std::vector< std::pair< std::pair, double> > MEDLoader::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) +std::vector< std::pair< std::pair, double> > MEDCoupling::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::vector< std::pair< std::pair, double > > ret; MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); @@ -812,7 +812,7 @@ std::vector< std::pair< std::pair, double> > MEDLoader::GetAllFieldIter INTERP_KERNEL::AutoPtr nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); med_bool localmesh; // - std::ostringstream oss; oss << "MEDLoader::GetAllFieldIterations : No field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : "; + std::ostringstream oss; oss << "GetAllFieldIterations : No field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : "; for(int i=0;i, double> > MEDLoader::GetAllFieldIter throw INTERP_KERNEL::Exception(oss.str().c_str()); } -double MEDLoader::GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) +double MEDCoupling::GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); med_int nbFields=MEDnField(fid); // @@ -888,9 +888,9 @@ double MEDLoader::GetTimeAttachedOnFieldIteration(const std::string& fileName, c return ret; } -std::vector< std::pair > MEDLoader::GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) +std::vector< std::pair > MEDCoupling::GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); switch(type) { case ON_CELLS: @@ -902,9 +902,9 @@ std::vector< std::pair > MEDLoader::GetFieldIterations(MEDCoupling::Typ } } -std::vector< std::pair > MEDLoader::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) +std::vector< std::pair > MEDCoupling::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::string meshNameCpp(meshName); std::vector< std::pair > ret; MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); @@ -920,7 +920,7 @@ std::vector< std::pair > MEDLoader::GetCellFieldIterations(const std::s INTERP_KERNEL::AutoPtr nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); med_bool localmesh; // - std::ostringstream oss; oss << "MEDLoader::GetCellFieldIterations : No cell Field field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : "; + std::ostringstream oss; oss << "GetCellFieldIterations : No cell Field field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : "; std::set s2; for(int i=0;i > MEDLoader::GetCellFieldIterations(const std::s return ret; } -std::vector< std::pair > MEDLoader::GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) +std::vector< std::pair > MEDCoupling::GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::string meshNameCpp(meshName); std::vector< std::pair > ret; MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY); @@ -992,7 +992,7 @@ std::vector< std::pair > MEDLoader::GetNodeFieldIterations(const std::s INTERP_KERNEL::AutoPtr nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); med_bool localmesh; // - std::ostringstream oss; oss << "MEDLoader::GetNodeFieldIterations : No node Field field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : "; + std::ostringstream oss; oss << "GetNodeFieldIterations : No node Field field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : "; std::set s2; for(int i=0;i > MEDLoader::GetNodeFieldIterations(const std::s return ret; } -MEDCoupling::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax) +MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); @@ -1059,13 +1059,13 @@ MEDCoupling::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fil const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef(); return const_cast(ret); } - std::ostringstream oss; oss << "MEDLoader::ReadMeshFromFile : The mesh \"" << meshName << "\" in file \"" << fileName << "\" has not a recognized type !"; + std::ostringstream oss; oss << "ReadMeshFromFile : The mesh \"" << meshName << "\" in file \"" << fileName << "\" has not a recognized type !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } -MEDCoupling::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax) +MEDCoupling::MEDCouplingMesh *MEDCoupling::ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); @@ -1083,76 +1083,76 @@ MEDCoupling::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fil const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef(); return const_cast(ret); } - std::ostringstream oss; oss << "MEDLoader::ReadMeshFromFile (2) : The first mesh \"" << mm->getName() << "\" in file \"" << fileName << "\" has not a recognized type !"; + std::ostringstream oss; oss << "ReadMeshFromFile (2) : The first mesh \"" << mm->getName() << "\" in file \"" << fileName << "\" has not a recognized type !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } -MEDCoupling::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax) +MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) { - std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName=\""<< meshName << "\" exists but it is not an unstructured mesh !"; + std::ostringstream oss; oss << "ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName=\""<< meshName << "\" exists but it is not an unstructured mesh !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } return mmuPtr->getMeshAtLevel(meshDimRelToMax,true); } -MEDCoupling::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax) +MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) { - std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; + std::ostringstream oss; oss << "ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } return mmuPtr->getMeshAtLevel(meshDimRelToMax,true); } -int MEDLoader::ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) +int MEDCoupling::ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::vector poss; return MEDLoaderNS::readUMeshDimFromFile(fileName,meshName,poss); } -MEDCoupling::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& fams) +MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& fams) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) { - std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFamilies : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; + std::ostringstream oss; oss << "ReadUMeshFromFamilies : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } return mmuPtr->getFamilies(meshDimRelToMax,fams,true); } -MEDCoupling::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& grps) +MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& grps) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); MEDCouplingAutoRefCountObjectPtr mm=MEDFileMesh::New(fileName,meshName); MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) { - std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromGroups : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; + std::ostringstream oss; oss << "ReadUMeshFromGroups : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } return mmuPtr->getGroups(meshDimRelToMax,grps,true); } -MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) +MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); switch(type) { case ON_CELLS: @@ -1168,12 +1168,12 @@ MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadField(MEDCoupling::TypeOfFie } } -std::vector MEDLoader::ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, - const std::vector >& its) +std::vector MEDCoupling::ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its) { if(its.empty()) return std::vector(); - CheckFileForRead(fileName); + MEDCoupling::CheckFileForRead(fileName); std::vector ret(its.size()); std::vector< MEDCouplingAutoRefCountObjectPtr > retSafe(its.size()); if(its.empty()) @@ -1183,7 +1183,7 @@ std::vector MEDLoader::ReadFieldsOnSameMe MEDFileMesh *mmPtr(mm); MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) - throw INTERP_KERNEL::Exception("MEDLoader::ReadFieldsOnSameMesh : only unstructured mesh is managed !"); + throw INTERP_KERNEL::Exception("ReadFieldsOnSameMesh : only unstructured mesh is managed !"); MEDCouplingAutoRefCountObjectPtr m=mmuPtr->getMeshAtLevel(meshDimRelToMax); const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax); MEDCouplingAutoRefCountObjectPtr m2(m->clone(true)); @@ -1205,31 +1205,31 @@ std::vector MEDLoader::ReadFieldsOnSameMe return ret; } -std::vector MEDLoader::ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, +std::vector MEDCoupling::ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) { return ReadFieldsOnSameMesh(ON_CELLS,fileName,meshName,meshDimRelToMax,fieldName,its); } -std::vector MEDLoader::ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, +std::vector MEDCoupling::ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) { return ReadFieldsOnSameMesh(ON_NODES,fileName,meshName,meshDimRelToMax,fieldName,its); } -std::vector MEDLoader::ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, +std::vector MEDCoupling::ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) { return ReadFieldsOnSameMesh(ON_GAUSS_PT,fileName,meshName,meshDimRelToMax,fieldName,its); } -std::vector MEDLoader::ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, +std::vector MEDCoupling::ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, const std::vector >& its) { return ReadFieldsOnSameMesh(ON_GAUSS_NE,fileName,meshName,meshDimRelToMax,fieldName,its); } -MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) +MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); @@ -1246,7 +1246,7 @@ MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const std::string& return ret.retn(); } -MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) +MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); @@ -1274,7 +1274,7 @@ MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const std::string& MEDCouplingAutoRefCountObjectPtr arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes())); MEDCouplingAutoRefCountObjectPtr pflSorted(pflSafe->deepCpy()); pflSorted->sort(true); if(!arr3->isEqualWithoutConsideringStr(*pflSorted)) - throw INTERP_KERNEL::Exception("MEDLoader::ReadFieldNode : not implemented yet !"); + throw INTERP_KERNEL::Exception("ReadFieldNode : not implemented yet !"); if(!arr3->isEqualWithoutConsideringStr(*pflSafe)) { MEDCouplingAutoRefCountObjectPtr o2n2(pflSafe->checkAndPreparePermutation()); @@ -1288,7 +1288,7 @@ MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const std::string& return ret.retn(); } -MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(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) { MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); @@ -1305,7 +1305,7 @@ MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const std::string return ret.retn(); } -MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) +MEDCoupling::MEDCouplingFieldDouble *MEDCoupling::ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) { MEDCouplingAutoRefCountObjectPtr ff(MEDFileField1TS::New(fileName,fieldName,iteration,order)); MEDCouplingAutoRefCountObjectPtr mm(MEDFileMesh::New(fileName,meshName)); @@ -1322,10 +1322,10 @@ MEDCoupling::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const std::stri return ret.retn(); } -void MEDLoader::WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch) +void MEDCoupling::WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch) { if(!mesh) - throw INTERP_KERNEL::Exception("MEDLoader::WriteMesh : input mesh is null !"); + throw INTERP_KERNEL::Exception("WriteMesh : input mesh is null !"); const MEDCouplingUMesh *um(dynamic_cast(mesh)); if(um) { @@ -1360,13 +1360,13 @@ void MEDLoader::WriteMesh(const std::string& fileName, const MEDCoupling::MEDCou mmc->write(fileName,mod); return ; } - throw INTERP_KERNEL::Exception("MEDLoader::WriteMesh : only MEDCouplingUMesh, MEDCoupling1GTUMesh, MEDCouplingCMesh, MEDCouplingCurveLinear are dealed in this API for the moment !"); + throw INTERP_KERNEL::Exception("WriteMesh : only MEDCouplingUMesh, MEDCoupling1GTUMesh, MEDCouplingCMesh, MEDCouplingCurveLinear are dealed in this API for the moment !"); } -void MEDLoader::WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch) +void MEDCoupling::WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch) { if(!mesh) - throw INTERP_KERNEL::Exception("MEDLoader::WriteUMesh : input mesh is null !"); + throw INTERP_KERNEL::Exception("WriteUMesh : input mesh is null !"); int mod=writeFromScratch?2:0; MEDCouplingAutoRefCountObjectPtr m(MEDFileUMesh::New()); AssignStaticWritePropertiesTo(*m); @@ -1375,12 +1375,12 @@ void MEDLoader::WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCo m->write(fileName,mod); } -void MEDLoader::WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch) +void MEDCoupling::WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch) { - MEDLoader::WriteUMesh(fileName,mesh,writeFromScratch); + WriteUMesh(fileName,mesh,writeFromScratch); } -void MEDLoader::WriteUMeshesPartition(const std::string& fileName, const std::string& meshNameC, const std::vector& meshes, bool writeFromScratch) +void MEDCoupling::WriteUMeshesPartition(const std::string& fileName, const std::string& meshNameC, const std::vector& meshes, bool writeFromScratch) { std::string meshName(meshNameC); if(meshName.empty()) @@ -1399,12 +1399,12 @@ void MEDLoader::WriteUMeshesPartition(const std::string& fileName, const std::st m->write(fileName,mod); } -void MEDLoader::WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshNameC, const std::vector& meshes, bool writeFromScratch) +void MEDCoupling::WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshNameC, const std::vector& meshes, bool writeFromScratch) { WriteUMeshesPartition(fileName,meshNameC,meshes,writeFromScratch); } -void MEDLoader::WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch) +void MEDCoupling::WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch) { int mod=writeFromScratch?2:0; MEDCouplingAutoRefCountObjectPtr m(MEDFileUMesh::New()); @@ -1416,7 +1416,7 @@ void MEDLoader::WriteUMeshes(const std::string& fileName, const std::vector ff(MEDFileField1TS::New()); - MEDLoader::AssignStaticWritePropertiesTo(*ff); + AssignStaticWritePropertiesTo(*ff); MEDCouplingAutoRefCountObjectPtr f2(f->deepCpy()); const MEDCouplingMesh *m(f2->getMesh()); const MEDCouplingUMesh *um(dynamic_cast(m)); @@ -1428,7 +1428,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri if(um) { MEDCouplingAutoRefCountObjectPtr mmu(MEDFileUMesh::New()); - MEDLoader::AssignStaticWritePropertiesTo(*mmu); + AssignStaticWritePropertiesTo(*mmu); MEDCouplingAutoRefCountObjectPtr o2n(um->getRenumArrForMEDFileFrmt()); MEDCouplingAutoRefCountObjectPtr n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples())); f2->renumberCells(o2n->begin(),false); @@ -1440,7 +1440,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri else if(um2) { MEDCouplingAutoRefCountObjectPtr mmu(MEDFileUMesh::New()); - MEDLoader::AssignStaticWritePropertiesTo(*mmu); + AssignStaticWritePropertiesTo(*mmu); mmu->setMeshAtLevel(0,const_cast(um2)); ff->setFieldNoProfileSBT(f2); mmu->write(fileName,mod); @@ -1448,7 +1448,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri else if(um3) { MEDCouplingAutoRefCountObjectPtr mmc(MEDFileCMesh::New()); - MEDLoader::AssignStaticWritePropertiesTo(*mmc); + AssignStaticWritePropertiesTo(*mmc); mmc->setMesh(const_cast(um3)); ff->setFieldNoProfileSBT(f2); mmc->write(fileName,mod); @@ -1456,7 +1456,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri else if(um4) { MEDCouplingAutoRefCountObjectPtr mmc(MEDFileCurveLinearMesh::New()); - MEDLoader::AssignStaticWritePropertiesTo(*mmc); + AssignStaticWritePropertiesTo(*mmc); mmc->setMesh(const_cast(um4)); ff->setFieldNoProfileSBT(f2); mmc->write(fileName,mod); @@ -1466,10 +1466,10 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::stri ff->write(fileName,0); } -void MEDLoader::WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch) +void MEDCoupling::WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch) { if(!f) - throw INTERP_KERNEL::Exception("MEDLoader::WriteField : input field is NULL !"); + throw INTERP_KERNEL::Exception("WriteField : input field is NULL !"); f->checkCoherency(); int status=MEDLoaderBase::getStatusOfFile(fileName); if(status!=MEDLoaderBase::EXIST_RW && status!=MEDLoaderBase::NOT_EXIST) @@ -1485,7 +1485,7 @@ void MEDLoader::WriteField(const std::string& fileName, const MEDCoupling::MEDCo { std::vector meshNames=GetMeshNames(fileName); if(!f->getMesh()) - throw INTERP_KERNEL::Exception("MEDLoader::WriteField : trying to write a field with no mesh !"); + throw INTERP_KERNEL::Exception("WriteField : trying to write a field with no mesh !"); std::string fileNameCpp(f->getMesh()->getName()); if(std::find(meshNames.begin(),meshNames.end(),fileNameCpp)==meshNames.end()) MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(fileName,f,false); @@ -1496,11 +1496,11 @@ void MEDLoader::WriteField(const std::string& fileName, const MEDCoupling::MEDCo const MEDFileMesh *mmPtr(mm); const MEDFileUMesh *mmuPtr=dynamic_cast(mmPtr); if(!mmuPtr) - throw INTERP_KERNEL::Exception("MEDLoader::WriteField : only umeshes are supported now !"); + throw INTERP_KERNEL::Exception("WriteField : only umeshes are supported now !"); MEDCouplingAutoRefCountObjectPtr f2(f->deepCpy()); MEDCouplingUMesh *m=dynamic_cast(const_cast(f2->getMesh())); if(!m) - throw INTERP_KERNEL::Exception("MEDLoader::WriteField : only umesh in input field supported !"); + throw INTERP_KERNEL::Exception("WriteField : only umesh in input field supported !"); MEDCouplingAutoRefCountObjectPtr o2n=m->getRenumArrForMEDFileFrmt(); f2->renumberCells(o2n->begin(),false); m=static_cast(const_cast(f2->getMesh())); @@ -1513,7 +1513,7 @@ void MEDLoader::WriteField(const std::string& fileName, const MEDCoupling::MEDCo MEDCouplingAutoRefCountObjectPtr partSafe(part); if(!b) { - std::ostringstream oss; oss << "MEDLoader::WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !"; + std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } MEDCouplingAutoRefCountObjectPtr f1ts(MEDFileField1TS::New()); @@ -1535,7 +1535,7 @@ void MEDLoader::WriteField(const std::string& fileName, const MEDCoupling::MEDCo MEDCouplingAutoRefCountObjectPtr partSafe(part); if(!b) { - std::ostringstream oss; oss << "MEDLoader::WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !"; + std::ostringstream oss; oss << "WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } MEDCouplingAutoRefCountObjectPtr f1ts(MEDFileField1TS::New()); @@ -1553,15 +1553,15 @@ void MEDLoader::WriteField(const std::string& fileName, const MEDCoupling::MEDCo } } -void MEDLoader::WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch) +void MEDCoupling::WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch) { WriteField(fileName,f,writeFromScratch); } -void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f) +void MEDCoupling::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f) { if(!f) - throw INTERP_KERNEL::Exception("MEDLoader::WriteFieldUsingAlreadyWrittenMesh : input field is null !"); + throw INTERP_KERNEL::Exception("WriteFieldUsingAlreadyWrittenMesh : input field is null !"); f->checkCoherency(); int status=MEDLoaderBase::getStatusOfFile(fileName); if(status!=MEDLoaderBase::EXIST_RW) diff --git a/src/MEDLoader/MEDLoader.hxx b/src/MEDLoader/MEDLoader.hxx index fc0b9716d..6a91a4683 100644 --- a/src/MEDLoader/MEDLoader.hxx +++ b/src/MEDLoader/MEDLoader.hxx @@ -36,76 +36,66 @@ namespace MEDCoupling class MEDCouplingUMesh; class MEDCouplingFieldDouble; class MEDFileWritable; -} -class MEDLOADER_EXPORT MEDLoader -{ -public: - static void SetEpsilonForNodeComp(double val); - static void SetCompPolicyForCell(int val); - static void SetTooLongStrPolicy(int val); - static bool HasXDR(); - static std::string MEDFileVersionStr(); - static void MEDFileVersion(int& major, int& minor, int& release); - static void CheckFileForRead(const std::string& fileName); - static std::vector GetMeshNames(const std::string& fileName); - static std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes); - static std::vector< std::pair > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName); - static std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName); - static std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName); - static std::vector GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName); - static std::vector GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName); - static std::vector GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName); - static std::vector GetAllFieldNames(const std::string& fileName); - static std::vector GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); - static std::vector GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName); - static std::vector GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName); - static std::vector GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); - static std::vector GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); - static std::vector< std::pair > GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName); - static std::vector< std::pair > GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName); - static std::vector< std::pair > GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName); - static std::vector< std::pair< std::pair, double> > GetAllFieldIterations(const std::string& fileName, const std::string& fieldName); - static double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order); - static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& fams); - static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& grps); - static MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0); - static MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0); - static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0); - static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0); - static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName); - static MEDCoupling::MEDCouplingFieldDouble *ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); - static std::vector ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, - const std::vector >& its); - static std::vector ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, - const std::vector >& its); - static std::vector ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, - const std::vector >& its); - static std::vector ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, - const std::vector >& its); - static std::vector ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, - const std::vector >& its); - static MEDCoupling::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); - static MEDCoupling::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); - static MEDCoupling::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); - static MEDCoupling::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); - static void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch); - static void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch); - static void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch); - static void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, const std::vector& meshes, bool writeFromScratch); - static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, const std::vector& meshes, bool writeFromScratch); - static void WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch); - static void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch); - static void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch); - static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f); -public: - static void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj); -private: - MEDLoader(); -public: - static double _EPS_FOR_NODE_COMP; - static int _COMP_FOR_CELL; - static int _TOO_LONG_STR; + MEDLOADER_EXPORT void SetEpsilonForNodeComp(double val); + MEDLOADER_EXPORT void SetCompPolicyForCell(int val); + MEDLOADER_EXPORT void SetTooLongStrPolicy(int val); + MEDLOADER_EXPORT bool HasXDR(); + MEDLOADER_EXPORT std::string MEDFileVersionStr(); + MEDLOADER_EXPORT void MEDFileVersion(int& major, int& minor, int& release); + MEDLOADER_EXPORT void CheckFileForRead(const std::string& fileName); + MEDLOADER_EXPORT std::vector GetMeshNames(const std::string& fileName); + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes); + MEDLOADER_EXPORT std::vector< std::pair > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName); + MEDLOADER_EXPORT std::vector GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName); + MEDLOADER_EXPORT std::vector GetAllFieldNames(const std::string& fileName); + MEDLOADER_EXPORT std::vector GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector< std::pair > GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector< std::pair > GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector< std::pair > GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector< std::pair< std::pair, double> > GetAllFieldIterations(const std::string& fileName, const std::string& fieldName); + MEDLOADER_EXPORT double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& fams); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& grps); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0); + MEDLOADER_EXPORT int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT std::vector ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT std::vector ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT std::vector ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT std::vector ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT std::vector ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, const std::vector& meshes, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, const std::vector& meshes, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch); + MEDLOADER_EXPORT void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch); + MEDLOADER_EXPORT void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch); + MEDLOADER_EXPORT void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f); + + MEDLOADER_EXPORT void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj); }; #endif diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 6448ff88c..e8c429754 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -75,15 +75,15 @@ using namespace MEDCoupling; $result=convertMEDMeshMultiLev($1,$owner); } -%newobject MEDLoader::ReadUMeshFromFamilies; -%newobject MEDLoader::ReadUMeshFromGroups; -%newobject MEDLoader::ReadUMeshFromFile; -%newobject MEDLoader::ReadMeshFromFile; -%newobject MEDLoader::ReadField; -%newobject MEDLoader::ReadFieldCell; -%newobject MEDLoader::ReadFieldNode; -%newobject MEDLoader::ReadFieldGauss; -%newobject MEDLoader::ReadFieldGaussNE; +%newobject ReadUMeshFromFamiliesSwig; +%newobject ReadUMeshFromGroupsSwig; +%newobject MEDCoupling::ReadUMeshFromFile; +%newobject MEDCoupling::ReadMeshFromFile; +%newobject MEDCoupling::ReadField; +%newobject MEDCoupling::ReadFieldCell; +%newobject MEDCoupling::ReadFieldNode; +%newobject MEDCoupling::ReadFieldGauss; +%newobject MEDCoupling::ReadFieldGaussNE; %newobject MEDCoupling::MEDFileMesh::New; %newobject MEDCoupling::MEDFileMesh::createNewEmpty; %newobject MEDCoupling::MEDFileMesh::deepCpy; @@ -271,205 +271,230 @@ using namespace MEDCoupling; %feature("unref") MEDCurveLinearMeshMultiLev "$this->decrRef();" %feature("unref") MEDFileMeshStruct "$this->decrRef();" -class MEDLoader +namespace MEDCoupling { -public: - static bool HasXDR(); - static std::string MEDFileVersionStr(); - static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception); - static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception); - static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception); - static void CheckFileForRead(const std::string& fileName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshNames(const std::string& fileName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) throw(INTERP_KERNEL::Exception); - static std::vector GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetAllFieldNames(const std::string& fileName) throw(INTERP_KERNEL::Exception); - static std::vector GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - static double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj) throw(INTERP_KERNEL::Exception); - %extend - { - static PyObject *MEDFileVersion() - { - int major,minor,release; - MEDLoader::MEDFileVersion(major,minor,release); - PyObject *ret(PyTuple_New(3)); - PyTuple_SetItem(ret,0,SWIG_From_int(major)); - PyTuple_SetItem(ret,1,SWIG_From_int(minor)); - PyTuple_SetItem(ret,2,SWIG_From_int(release)); - return ret; - } + bool HasXDR(); + std::string MEDFileVersionStr(); + void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception); + void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception); + void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception); + void CheckFileForRead(const std::string& fileName) throw(INTERP_KERNEL::Exception); + std::vector GetMeshNames(const std::string& fileName) throw(INTERP_KERNEL::Exception); + std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception); + std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + std::vector GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + std::vector GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) throw(INTERP_KERNEL::Exception); + std::vector GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) throw(INTERP_KERNEL::Exception); + std::vector GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + std::vector GetAllFieldNames(const std::string& fileName) throw(INTERP_KERNEL::Exception); + std::vector GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + std::vector GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + std::vector GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); + int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingFieldDouble *ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + MEDCoupling::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); + void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); + void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception); +} - static PyObject *GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) - { - std::vector< std::pair > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName); - PyObject *ret=PyList_New(res.size()); - int rk=0; - for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) - { - PyObject *elt=PyTuple_New(2); - PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first)); - PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second)); - PyList_SetItem(ret,rk,elt); - } - return ret; - } +%rename (MEDFileVersion) MEDFileVersionSwig; +%rename (GetFieldIterations) GetFieldIterationsSwig; +%rename (GetAllFieldIterations) GetAllFieldIterationsSwig; +%rename (GetCellFieldIterations) GetCellFieldIterationsSwig; +%rename (GetNodeFieldIterations) GetNodeFieldIterationsSwig; +%rename (GetComponentsNamesOfField) GetComponentsNamesOfFieldSwig; +%rename (GetUMeshGlobalInfo) GetUMeshGlobalInfoSwig; +%rename (ReadFieldsOnSameMesh) ReadFieldsOnSameMeshSwig; +%rename (WriteUMeshesPartition) WriteUMeshesPartitionSwig; +%rename (WriteUMeshesPartitionDep) WriteUMeshesPartitionDepSwig; +%rename (WriteUMeshes) WriteUMeshesSwig; +%rename (GetTypesOfField) GetTypesOfFieldSwig; +%rename (ReadUMeshFromGroups) ReadUMeshFromGroupsSwig; +%rename (ReadUMeshFromFamilies) ReadUMeshFromFamiliesSwig; + +%inline +{ + PyObject *MEDFileVersionSwig() + { + int major,minor,release; + MEDCoupling::MEDFileVersion(major,minor,release); + PyObject *ret(PyTuple_New(3)); + PyTuple_SetItem(ret,0,SWIG_From_int(major)); + PyTuple_SetItem(ret,1,SWIG_From_int(minor)); + PyTuple_SetItem(ret,2,SWIG_From_int(release)); + return ret; + } + + PyObject *GetFieldIterationsSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) + { + std::vector< std::pair > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName); + PyObject *ret=PyList_New(res.size()); + int rk=0; + for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) + { + PyObject *elt=PyTuple_New(2); + PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first)); + PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second)); + PyList_SetItem(ret,rk,elt); + } + return ret; + } + + PyObject *GetAllFieldIterationsSwig(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair< std::pair, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName); + PyObject *ret=PyList_New(res.size()); + int rk=0; + for(std::vector< std::pair< std::pair, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) + { + PyObject *elt=PyTuple_New(3); + PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first)); + PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second)); + PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second)); + PyList_SetItem(ret,rk,elt); + } + return ret; + } + + PyObject *GetCellFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName); + PyObject *ret=PyList_New(res.size()); + int rk=0; + for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) + { + PyObject *elt=PyTuple_New(2); + PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first)); + PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second)); + PyList_SetItem(ret,rk,elt); + } + return ret; + } - static PyObject *GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) - { - std::vector< std::pair< std::pair, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName); - PyObject *ret=PyList_New(res.size()); - int rk=0; - for(std::vector< std::pair< std::pair, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) - { - PyObject *elt=PyTuple_New(3); - PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first)); - PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second)); - PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second)); - PyList_SetItem(ret,rk,elt); - } - return ret; - } + PyObject *GetNodeFieldIterationsSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName); + PyObject *ret=PyList_New(res.size()); + int rk=0; + for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) + { + PyObject *elt=PyTuple_New(2); + PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first)); + PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second)); + PyList_SetItem(ret,rk,elt); + } + return ret; + } - static PyObject *GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) - { - std::vector< std::pair > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName); - PyObject *ret=PyList_New(res.size()); - int rk=0; - for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) - { - PyObject *elt=PyTuple_New(2); - PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first)); - PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second)); - PyList_SetItem(ret,rk,elt); - } - return ret; - } - static PyObject *GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) - { - std::vector< std::pair > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName); - PyObject *ret=PyList_New(res.size()); - int rk=0; - for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) - { - PyObject *elt=PyTuple_New(2); - PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first)); - PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second)); - PyList_SetItem(ret,rk,elt); - } - return ret; - } - static PyObject *GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) - { - std::vector< std::pair > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName); - PyObject *ret=PyList_New(res.size()); - int rk=0; - for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) - { - PyObject *elt=PyTuple_New(2); - PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str())); - PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str())); - PyList_SetItem(ret,rk,elt); - } - return ret; - } - static PyObject *GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception) - { - int meshDim,spaceDim,numberOfNodes; - std::vector< std::vector< std::pair > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes); - PyObject *ret=PyTuple_New(4); - PyObject *elt0=PyList_New(res.size()); - int i=0; - for(std::vector< std::vector< std::pair > >::const_iterator it=res.begin();it!=res.end();it++,i++) - { - const std::vector< std::pair >&obj2=(*it); - int j=0; - PyObject *elt1=PyList_New(obj2.size()); - for(std::vector< std::pair >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++) - { - PyObject *elt2=PyTuple_New(2); - PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first)); - PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second)); - PyList_SetItem(elt1,j,elt2); - } - PyList_SetItem(elt0,i,elt1); - } - PyTuple_SetItem(ret,0,elt0); - PyTuple_SetItem(ret,1,SWIG_From_int(meshDim)); - PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim)); - PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes)); - return ret; - } - static PyObject *ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, - const std::string& fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception) - { - std::vector > its=convertTimePairIdsFromPy(liIts); - std::vector res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its); - return convertFieldDoubleVecToPy(res); - } - static void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) - { - std::vector v; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); - MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch); - } - static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) - { - std::vector v; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); - MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch); - } - static void WriteUMeshes(const std::string& fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) - { - std::vector v; - convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); - MEDLoader::WriteUMeshes(fileName,v,writeFromScratch); - } - static PyObject *GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) - { - std::vector< MEDCoupling::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName); - int size=v.size(); - PyObject *ret=PyList_New(size); - for(int i=0;i grps; - converPyListToVecString(li,grps); - return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps); - } - static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception) - { - std::vector fams; - converPyListToVecString(li,fams); - return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams); - } - } - static MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception); - static MEDCoupling::MEDCouplingFieldDouble *ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static MEDCoupling::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static MEDCoupling::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static MEDCoupling::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static MEDCoupling::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception); -}; + PyObject *GetComponentsNamesOfFieldSwig(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName); + PyObject *ret=PyList_New(res.size()); + int rk=0; + for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) + { + PyObject *elt=PyTuple_New(2); + PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str())); + PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str())); + PyList_SetItem(ret,rk,elt); + } + return ret; + } + + PyObject *GetUMeshGlobalInfoSwig(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception) + { + int meshDim,spaceDim,numberOfNodes; + std::vector< std::vector< std::pair > > res=MEDCoupling::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes); + PyObject *ret=PyTuple_New(4); + PyObject *elt0=PyList_New(res.size()); + int i=0; + for(std::vector< std::vector< std::pair > >::const_iterator it=res.begin();it!=res.end();it++,i++) + { + const std::vector< std::pair >&obj2=(*it); + int j=0; + PyObject *elt1=PyList_New(obj2.size()); + for(std::vector< std::pair >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++) + { + PyObject *elt2=PyTuple_New(2); + PyTuple_SetItem(elt2,0,SWIG_From_int((int)(*it2).first)); + PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second)); + PyList_SetItem(elt1,j,elt2); + } + PyList_SetItem(elt0,i,elt1); + } + PyTuple_SetItem(ret,0,elt0); + PyTuple_SetItem(ret,1,SWIG_From_int(meshDim)); + PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim)); + PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes)); + return ret; + } + + PyObject *ReadFieldsOnSameMeshSwig(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, + const std::string& fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception) + { + std::vector > its=convertTimePairIdsFromPy(liIts); + std::vector res=MEDCoupling::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its); + return convertFieldDoubleVecToPy(res); + } + + void WriteUMeshesPartitionSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) + { + std::vector v; + convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); + MEDCoupling::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch); + } + + void WriteUMeshesPartitionDepSwig(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) + { + std::vector v; + convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); + MEDCoupling::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch); + } + + void WriteUMeshesSwig(const std::string& fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception) + { + std::vector v; + convertFromPyObjVectorOfObj(li,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh",v); + MEDCoupling::WriteUMeshes(fileName,v,writeFromScratch); + } + + PyObject *GetTypesOfFieldSwig(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception) + { + std::vector< MEDCoupling::TypeOfField > v=MEDCoupling::GetTypesOfField(fileName,meshName,fieldName); + int size=v.size(); + PyObject *ret=PyList_New(size); + for(int i=0;i grps; + converPyListToVecString(li,grps); + return MEDCoupling::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps); + } + + MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamiliesSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception) + { + std::vector fams; + converPyListToVecString(li,fams); + return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams); + } +} namespace MEDCoupling { diff --git a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py index 730772680..db6549772 100644 --- a/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py +++ b/src/MEDLoader/Swig/MEDLoaderCouplingTrainingSession.py @@ -226,9 +226,9 @@ myCoords=DataArrayDouble.New(targetCoords,9,2); myCoords.setInfoOnComponents(["X [km]","YY [mm]"]) targetMesh.setCoords(myCoords); # -MEDLoader.WriteUMesh("TargetMesh.med",targetMesh,True) +WriteUMesh("TargetMesh.med",targetMesh,True) # -meshRead=MEDLoader.ReadUMeshFromFile("TargetMesh.med",targetMesh.getName(),0) +meshRead=ReadUMeshFromFile("TargetMesh.med",targetMesh.getName(),0) print "Is the mesh read in file equals targetMesh ? %s"%(meshRead.isEqual(targetMesh,1e-12)) ; assert meshRead.isEqual(targetMesh,1e-12) # f=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME) @@ -236,22 +236,22 @@ f.setTime(5.6,7,8) f.setArray(targetMesh.getBarycenterAndOwner()) f.setMesh(targetMesh) f.setName("AFieldName") -MEDLoader.WriteField("MyFirstField.med",f,True) +WriteField("MyFirstField.med",f,True) # -f2=MEDLoader.ReadFieldCell("MyFirstField.med",f.getMesh().getName(),0,f.getName(),7,8) +f2=ReadFieldCell("MyFirstField.med",f.getMesh().getName(),0,f.getName(),7,8) print "Is the field read in file equals f ? %s"%(f2.isEqual(f,1e-12,1e-12)) ; assert f2.isEqual(f,1e-12,1e-12) # -MEDLoader.WriteUMesh("MySecondField.med",f.getMesh(),True) -MEDLoader.WriteFieldUsingAlreadyWrittenMesh("MySecondField.med",f) +WriteUMesh("MySecondField.med",f.getMesh(),True) +WriteFieldUsingAlreadyWrittenMesh("MySecondField.med",f) # f2=f.clone(True) f2.getArray()[:]*=2.0 f2.setTime(7.8,9,10) -MEDLoader.WriteFieldUsingAlreadyWrittenMesh("MySecondField.med",f2) +WriteFieldUsingAlreadyWrittenMesh("MySecondField.med",f2) # -f3=MEDLoader.ReadFieldCell("MySecondField.med",f.getMesh().getName(),0,f.getName(),7,8) +f3=ReadFieldCell("MySecondField.med",f.getMesh().getName(),0,f.getName(),7,8) print "Is the field read in file equals f ? %s"%(f.isEqual(f3,1e-12,1e-12)) ; assert f.isEqual(f3,1e-12,1e-12) -f4=MEDLoader.ReadFieldCell("MySecondField.med",f.getMesh().getName(),0,f.getName(),9,10) +f4=ReadFieldCell("MySecondField.med",f.getMesh().getName(),0,f.getName(),9,10) print "Is the field read in file equals f ? %s"%(f2.isEqual(f4,1e-12,1e-12)) ; assert f2.isEqual(f4,1e-12,1e-12) ##### @@ -358,22 +358,22 @@ NodeField0=NodeField[proc0] ; NodeField0.getMesh().setName(m0.getName()) ; CellF NodeField1=NodeField[proc1] ; NodeField1.getMesh().setName(m0.getName()) ; CellField1=CellField[proc1] ; CellField1.setMesh(NodeField1.getMesh()) # proc0_fname="proc0.med" -MEDLoader.WriteField(proc0_fname,NodeField0,True) -MEDLoader.WriteFieldUsingAlreadyWrittenMesh(proc0_fname,CellField0) +WriteField(proc0_fname,NodeField0,True) +WriteFieldUsingAlreadyWrittenMesh(proc0_fname,CellField0) proc1_fname="proc1.med" -MEDLoader.WriteField(proc1_fname,NodeField1,True) -MEDLoader.WriteFieldUsingAlreadyWrittenMesh(proc1_fname,CellField1) +WriteField(proc1_fname,NodeField1,True) +WriteFieldUsingAlreadyWrittenMesh(proc1_fname,CellField1) # -CellField0_read=MEDLoader.ReadFieldCell("proc0.med","mesh",0,"CellField",5,6) -CellField1_read=MEDLoader.ReadFieldCell("proc1.med","mesh",0,"CellField",5,6) +CellField0_read=ReadFieldCell("proc0.med","mesh",0,"CellField",5,6) +CellField1_read=ReadFieldCell("proc1.med","mesh",0,"CellField",5,6) CellField_read=MEDCouplingFieldDouble.MergeFields([CellField0_read,CellField1_read]) CellFieldCpy=CellField.deepCpy() CellFieldCpy.substractInPlaceDM(CellField_read,10,1e-12) CellFieldCpy.getArray().abs() print CellFieldCpy.getArray().isUniform(0.,1e-12) # -NodeField0_read=MEDLoader.ReadFieldNode("proc0.med","mesh",0,"NodeField",5,6) -NodeField1_read=MEDLoader.ReadFieldNode("proc1.med","mesh",0,"NodeField",5,6) +NodeField0_read=ReadFieldNode("proc0.med","mesh",0,"NodeField",5,6) +NodeField1_read=ReadFieldNode("proc1.med","mesh",0,"NodeField",5,6) NodeField_read=MEDCouplingFieldDouble.MergeFields([NodeField0_read,NodeField1_read]) NodeField_read.mergeNodes(1e-10) NodeFieldCpy=NodeField.deepCpy() diff --git a/src/MEDLoader/Swig/MEDLoaderExamplesTest.py b/src/MEDLoader/Swig/MEDLoaderExamplesTest.py index d7b6aa4cb..ddabb286a 100644 --- a/src/MEDLoader/Swig/MEDLoaderExamplesTest.py +++ b/src/MEDLoader/Swig/MEDLoaderExamplesTest.py @@ -163,31 +163,31 @@ class MEDLoaderBasicsTest(unittest.TestCase): #! [PySnippetMeshAdvAPI1_1] self.assertTrue(isinstance(myMesh,MEDCouplingUMesh)) myMesh.setName(meshName) - MEDLoader.WriteUMesh("wFile1.med",myMesh,True) + WriteUMesh("wFile1.med",myMesh,True) #! [PySnippetMeshAdvAPI1_1] os.remove("wFile1.med") #! [PySnippetMeshAdvAPI1_2] self.assertTrue(isinstance(myMesh,MEDCouplingUMesh)) myMesh.setName(meshName) - MEDLoader.WriteUMesh("wFile1.med",myMesh,False) + WriteUMesh("wFile1.med",myMesh,False) #! [PySnippetMeshAdvAPI1_2] f=myMesh.getMeasureField(ON_CELLS) f=f.buildNewTimeReprFromThis(ONE_TIME,False) f.setName("myField") #! [PySnippetMeshAdvAPI1_3] - MEDLoader.WriteUMesh("file3.med",f.getMesh(),True) + WriteUMesh("file3.med",f.getMesh(),True) f.setTime(1.2,1,0) fileNameMultiTimeStep="file3.med" - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileNameMultiTimeStep,f) + WriteFieldUsingAlreadyWrittenMesh(fileNameMultiTimeStep,f) f.setTime(1.3,2,0) f.applyFunc("sqrt(x)"); #Writing second time step with iteration==2 and order==0 - MEDLoader.WriteFieldUsingAlreadyWrittenMesh("file3.med",f); + WriteFieldUsingAlreadyWrittenMesh("file3.med",f); #! [PySnippetMeshAdvAPI1_3] #! [PySnippetMeshAdvAPI1_11] - timeStepsIds=MEDLoader.GetCellFieldIterations("file3.med","Example2","myField") + timeStepsIds=GetCellFieldIterations("file3.med","Example2","myField") self.assertEqual([(1, 0),(2, 0)],timeStepsIds) - fs=MEDLoader.ReadFieldsOnSameMesh(ON_CELLS,"file3.med","Example2",0,"myField",timeStepsIds); + fs=ReadFieldsOnSameMesh(ON_CELLS,"file3.med","Example2",0,"myField",timeStepsIds); #! [PySnippetMeshAdvAPI1_11] ### myMesh0=myMesh[:] ; myMesh0.setName("Example2") @@ -205,32 +205,32 @@ class MEDLoaderBasicsTest(unittest.TestCase): F1Cell.setArray(myMesh0.getCoords()[:myMesh0.getNumberOfCells()]) F1Cell.setTime(1000.,2,3) F1Cell.setName("F1Cell") - MEDLoader.WriteFieldUsingAlreadyWrittenMesh("file2.med",F1Cell) + WriteFieldUsingAlreadyWrittenMesh("file2.med",F1Cell) F1Cell1=F1Cell.deepCpy() F1Cell1.setMesh(myMesh1) F1Cell1.setArray(myMesh1.getBarycenterAndOwner()) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh("file2.med",F1Cell1) + WriteFieldUsingAlreadyWrittenMesh("file2.med",F1Cell1) #! [PySnippetMeshAdvAPI1_12] - f1Cell_3D=MEDLoader.ReadFieldCell("file2.med","Example2",0,"F1Cell",2,3) + f1Cell_3D=ReadFieldCell("file2.med","Example2",0,"F1Cell",2,3) #! [PySnippetMeshAdvAPI1_12] #! [PySnippetMeshAdvAPI1_13] - f1Cell_2D=MEDLoader.ReadFieldCell("file2.med","Example2",-1,"F1Cell",2,3) + f1Cell_2D=ReadFieldCell("file2.med","Example2",-1,"F1Cell",2,3) #! [PySnippetMeshAdvAPI1_13] self.assertTrue(F1Cell.isEqual(f1Cell_3D,1e-12,1e-12)) #! [PySnippetMeshAdvAPI1_8] - self.assertEqual(3,MEDLoader.ReadUMeshDimFromFile("file2.med","Example2")) + self.assertEqual(3,ReadUMeshDimFromFile("file2.med","Example2")) #! [PySnippetMeshAdvAPI1_8] #! [PySnippetMeshAdvAPI1_7] - m2D=MEDLoader.ReadUMeshFromFile("file2.med","Example2",0) + m2D=ReadUMeshFromFile("file2.med","Example2",0) #! [PySnippetMeshAdvAPI1_7] #! [PySnippetMeshAdvAPI1_4] - m2D=MEDLoader.ReadUMeshFromFile("file2.med","Example2",-1) + m2D=ReadUMeshFromFile("file2.med","Example2",-1) #! [PySnippetMeshAdvAPI1_4] #! [PySnippetMeshAdvAPI1_5] - m1D=MEDLoader.ReadUMeshFromFile("file2.med","Example2",-2) + m1D=ReadUMeshFromFile("file2.med","Example2",-2) #! [PySnippetMeshAdvAPI1_5] #! [PySnippetMeshAdvAPI1_6] - m0D=MEDLoader.ReadUMeshFromFile("file2.med","Example2",-3) + m0D=ReadUMeshFromFile("file2.med","Example2",-3) #! [PySnippetMeshAdvAPI1_6] for i in xrange(4): mm.removeMeshAtLevel(-i) @@ -240,10 +240,10 @@ class MEDLoaderBasicsTest(unittest.TestCase): mm.setName("MyMesh") mm.write("file1.med",2) #! [PySnippetMeshAdvAPI1_9] - m2D=MEDLoader.ReadUMeshFromFile("file1.med","MyMesh",0) + m2D=ReadUMeshFromFile("file1.med","MyMesh",0) #! [PySnippetMeshAdvAPI1_9] #! [PySnippetMeshAdvAPI1_10] - m1D=MEDLoader.ReadUMeshFromFile("file1.med","MyMesh",-1) + m1D=ReadUMeshFromFile("file1.med","MyMesh",-1) #! [PySnippetMeshAdvAPI1_10] pass diff --git a/src/MEDLoader/Swig/MEDLoaderTest1.py b/src/MEDLoader/Swig/MEDLoaderTest1.py index 404e45ed3..3d2e8927a 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest1.py +++ b/src/MEDLoader/Swig/MEDLoaderTest1.py @@ -28,54 +28,54 @@ class MEDLoaderTest(unittest.TestCase): def testMesh1DRW(self): mesh=MEDLoaderDataForTest.build1DMesh_1(); mesh.checkCoherency(); - MEDLoader.MEDLoader.WriteUMesh("Pyfile1.med",mesh,True); - mesh_rw=MEDLoader.MEDLoader.ReadUMeshFromFile("Pyfile1.med",mesh.getName(),0); + MEDLoader.WriteUMesh("Pyfile1.med",mesh,True); + mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile1.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testMesh2DCurveRW(self): mesh=MEDLoaderDataForTest.build2DCurveMesh_1(); mesh.checkCoherency(); - MEDLoader.MEDLoader.WriteUMesh("Pyfile2.med",mesh,True); - mesh_rw=MEDLoader.MEDLoader.ReadUMeshFromFile("Pyfile2.med",mesh.getName(),0); + MEDLoader.WriteUMesh("Pyfile2.med",mesh,True); + mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile2.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testMesh2DRW(self): mesh=MEDLoaderDataForTest.build2DMesh_1(); mesh.checkCoherency(); - MEDLoader.MEDLoader.WriteUMesh("Pyfile3.med",mesh,True); - mesh_rw=MEDLoader.MEDLoader.ReadUMeshFromFile("Pyfile3.med",mesh.getName(),0); + MEDLoader.WriteUMesh("Pyfile3.med",mesh,True); + mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile3.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testMesh3DSurfRW(self): mesh=MEDLoaderDataForTest.build3DSurfMesh_1(); mesh.checkCoherency(); - MEDLoader.MEDLoader.WriteUMesh("Pyfile4.med",mesh,True); - mesh_rw=MEDLoader.MEDLoader.ReadUMeshFromFile("Pyfile4.med",mesh.getName(),0); + MEDLoader.WriteUMesh("Pyfile4.med",mesh,True); + mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile4.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testMesh3DRW(self): mesh=MEDLoaderDataForTest.build3DMesh_1(); mesh.checkCoherency(); - MEDLoader.MEDLoader.WriteUMesh("Pyfile5.med",mesh,True); - mesh_rw=MEDLoader.MEDLoader.ReadUMeshFromFile("Pyfile5.med",mesh.getName(),0); + MEDLoader.WriteUMesh("Pyfile5.med",mesh,True); + mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile5.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testFieldRW1(self): f1=MEDLoaderDataForTest.buildVecFieldOnCells_1(); - MEDLoader.MEDLoader.WriteField("Pyfile6.med",f1,True); - f2=MEDLoader.MEDLoader.ReadFieldCell("Pyfile6.med",f1.getMesh().getName(),0,f1.getName(),0,1); + MEDLoader.WriteField("Pyfile6.med",f1,True); + f2=MEDLoader.ReadFieldCell("Pyfile6.med",f1.getMesh().getName(),0,f1.getName(),0,1); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); # f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1(); - MEDLoader.MEDLoader.WriteField("Pyfile7.med",f1,True); - f2=MEDLoader.MEDLoader.ReadFieldNode("Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3); + MEDLoader.WriteField("Pyfile7.med",f1,True); + f2=MEDLoader.ReadFieldNode("Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); - self.assertRaises(Exception,MEDLoader.MEDLoader.ReadFieldCell,"Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3); + self.assertRaises(Exception,MEDLoader.ReadFieldCell,"Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3); pass def testFieldRW2(self): @@ -83,46 +83,46 @@ class MEDLoaderTest(unittest.TestCase): VAL1=12345.67890314; VAL2=-1111111111111.; f1=MEDLoaderDataForTest.buildVecFieldOnCells_1(); - MEDLoader.MEDLoader.WriteField(fileName,f1,True); + MEDLoader.WriteField(fileName,f1,True); f1.setTime(10.,8,9); f1.getArray().setIJ(0,0,VAL1); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(10.14,18,19); f1.getArray().setIJ(0,0,VAL2); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); #retrieving time steps... - f2=MEDLoader.MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),8,9); + f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),8,9); f1.setTime(10.,8,9); f1.getArray().setIJ(0,0,VAL1); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); - f2=MEDLoader.MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),0,1); + f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),0,1); f3=MEDLoaderDataForTest.buildVecFieldOnCells_1(); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); - f2=MEDLoader.MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),18,19); + f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),18,19); f1.setTime(10.14,18,19); f1.getArray().setIJ(0,0,VAL2); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); #test of throw on invalid (dt,it) - self.assertRaises(Exception,MEDLoader.MEDLoader.ReadFieldCell,fileName,f1.getMesh().getName(),0,f1.getName(),28,19); + self.assertRaises(Exception,MEDLoader.ReadFieldCell,fileName,f1.getMesh().getName(),0,f1.getName(),28,19); #ON NODES f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1(); fileName2="Pyfile9.med"; - MEDLoader.MEDLoader.WriteField(fileName2,f1,True); + MEDLoader.WriteField(fileName2,f1,True); f1.setTime(110.,108,109); tmp=f1.getArray().getPointer(); f1.getArray().setIJ(0,3,VAL1); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); f1.setTime(210.,208,209); f1.getArray().setIJ(0,3,VAL2); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); - f2=MEDLoader.MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),108,109); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); + f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),108,109); f1.setTime(110.,108,109); f1.getArray().setIJ(0,3,VAL1); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); - f2=MEDLoader.MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),2,3); + f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),2,3); f3=MEDLoaderDataForTest.buildVecFieldOnNodes_1(); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); - f2=MEDLoader.MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),208,209); + f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),208,209); f1.setTime(210.,208,209); f1.getArray().setIJ(0,3,VAL2); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); @@ -143,65 +143,65 @@ class MEDLoaderTest(unittest.TestCase): f1.setTime(10.,8,9); tmp=f1.getArray().getPointer(); f1.getArray().setIJ(0,0,VAL1); - MEDLoader.MEDLoader.WriteField(fileName,f1,True); + MEDLoader.WriteField(fileName,f1,True); f1.setTime(10.14,18,19); f1.getArray().setIJ(0,0,VAL2); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.getMesh().setName(name3); f1.setTime(10.55,28,29); f1.getArray().setIJ(0,0,3*VAL1); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); - vec=MEDLoader.MEDLoader.GetMeshNamesOnField(fileName,name1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + vec=MEDLoader.GetMeshNamesOnField(fileName,name1); f1.setTime(10.66,38,39); f1.getArray().setIJ(0,0,3*VAL2); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(10.77,48,49); f1.getArray().setIJ(0,0,4*VAL2); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); #ON NODES f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1(); f1.setName(name1); f1.getMesh().setName(name3); f1.setTime(110.,8,9); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(110.,108,109); tmp=f1.getArray().getPointer(); f1.getArray().setIJ(0,3,VAL1); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(210.,208,209); f1.getArray().setIJ(0,3,VAL2); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); # - it1=MEDLoader.MEDLoader.GetCellFieldIterations(fileName,name3,name1); + it1=MEDLoader.GetCellFieldIterations(fileName,name3,name1); self.assertEqual(5,len(it1)); self.assertEqual(8,it1[0][0]); self.assertEqual(9,it1[0][1]); self.assertEqual(18,it1[1][0]); self.assertEqual(19,it1[1][1]); self.assertEqual(28,it1[2][0]); self.assertEqual(29,it1[2][1]); self.assertEqual(38,it1[3][0]); self.assertEqual(39,it1[3][1]); self.assertEqual(48,it1[4][0]); self.assertEqual(49,it1[4][1]); - it3=MEDLoader.MEDLoader.GetNodeFieldIterations(fileName,name3,name1); + it3=MEDLoader.GetNodeFieldIterations(fileName,name3,name1); self.assertEqual(3,len(it3)); self.assertEqual(8,it3[0][0]); self.assertEqual(9,it3[0][1]); self.assertEqual(108,it3[1][0]); self.assertEqual(109,it3[1][1]); self.assertEqual(208,it3[2][0]); self.assertEqual(209,it3[2][1]); # # - f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,8,9); + f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,8,9); self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,0),13); - f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,18,19); + f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,18,19); self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,0),13); - f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,28,29); + f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,28,29); self.assertAlmostEqual(3*VAL1,f1.getArray().getIJ(0,0),13); - f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,38,39); + f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,38,39); self.assertAlmostEqual(3*VAL2,f1.getArray().getIJ(0,0),13); - f1=MEDLoader.MEDLoader.ReadFieldCell(fileName,name3,0,name1,48,49); + f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,48,49); self.assertAlmostEqual(4*VAL2,f1.getArray().getIJ(0,0),13); # - f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name3,0,name1,8,9); + f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,8,9); self.assertAlmostEqual(71.,f1.getArray().getIJ(0,3),13); - f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name3,0,name1,108,109); + f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,108,109); self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,3),13); - f1=MEDLoader.MEDLoader.ReadFieldNode(fileName,name3,0,name1,208,209); + f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,208,209); self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,3),13); pass @@ -224,15 +224,15 @@ class MEDLoaderTest(unittest.TestCase): mesh4.setCoords(mesh1.getCoords()); meshes=[mesh1,mesh2,mesh3,mesh4] mnane="3DToto"; - MEDLoader.MEDLoader.WriteUMeshesPartition(fileName,mnane,meshes,True); + MEDLoader.WriteUMeshesPartition(fileName,mnane,meshes,True); # - mesh5=MEDLoader.MEDLoader.ReadUMeshFromFile(fileName,mnane); + mesh5=MEDLoader.ReadUMeshFromFile(fileName,mnane); mesh1.setName(mnane); part3=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] mesh6=mesh5.buildPartOfMySelf(part3,True); mesh6.setName(mnane); self.assertTrue(mesh6.isEqual(mesh1,1e-12)); - grps=MEDLoader.MEDLoader.GetMeshGroupsNames(fileName,mnane); + grps=MEDLoader.GetMeshGroupsNames(fileName,mnane); self.assertEqual(4,len(grps)); grps.index("mesh2"); grps.index("mesh3"); @@ -240,25 +240,25 @@ class MEDLoaderTest(unittest.TestCase): grps.index("3DMesh_1"); # vec=("mesh2",); - mesh2_2=MEDLoader.MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); + mesh2_2=MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); self.assertTrue(mesh2_2.isEqual(mesh2,1e-12)); vec=["mesh3"]; - mesh3_2=MEDLoader.MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); + mesh3_2=MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); self.assertTrue(mesh3_2.isEqual(mesh3,1e-12)); vec=["mesh4"]; - mesh4_2=MEDLoader.MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); + mesh4_2=MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); self.assertTrue(mesh4_2.isEqual(mesh4,1e-12)); vec="3DMesh_1"; - mesh1_2=MEDLoader.MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); + mesh1_2=MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); mesh1.setName("3DMesh_1"); self.assertTrue(mesh1_2.isEqual(mesh1,1e-12)); # vec=["Family_-3","Family_-5"]; - mesh2_2=MEDLoader.MEDLoader.ReadUMeshFromFamilies(fileName,mnane,0,vec); + mesh2_2=MEDLoader.ReadUMeshFromFamilies(fileName,mnane,0,vec); mesh2_2.setName("mesh2"); self.assertTrue(mesh2_2.isEqual(mesh2,1e-12)); # - ret=MEDLoader.MEDLoader.GetMeshFamiliesNamesOnGroup(fileName,"3DToto","3DMesh_1"); + ret=MEDLoader.GetMeshFamiliesNamesOnGroup(fileName,"3DToto","3DMesh_1"); self.assertEqual(4,len(ret)); ref=['Family_-3','Family_-4','Family_-2','Family_-5'] self.assertIn(ref[0],ret); @@ -266,7 +266,7 @@ class MEDLoaderTest(unittest.TestCase): self.assertIn(ref[2],ret); self.assertIn(ref[3],ret); # - ret1=MEDLoader.MEDLoader.GetMeshGroupsNamesOnFamily(fileName,"3DToto","Family_-3"); + ret1=MEDLoader.GetMeshGroupsNamesOnFamily(fileName,"3DToto","Family_-3"); self.assertEqual(2,len(ret1)); self.assertEqual(ret1[0],"3DMesh_1"); self.assertEqual(ret1[1],"mesh2"); @@ -276,7 +276,7 @@ class MEDLoaderTest(unittest.TestCase): fileName="Pyfile12.med"; mesh1=MEDLoaderDataForTest.build3DMesh_1(); da,b,newNbOfNodes=mesh1.mergeNodes(1e-12); - MEDLoader.MEDLoader.WriteUMesh(fileName,mesh1,True); + MEDLoader.WriteUMesh(fileName,mesh1,True); part1=[1,2,4,13,15] mesh2=mesh1.buildPartOfMySelf(part1,True); mesh2.setName(mesh1.getName());#<- important for the test @@ -294,10 +294,10 @@ class MEDLoaderTest(unittest.TestCase): f1.setTime(3.14,2,7); f1.checkCoherency(); # - MEDLoader.MEDLoader.WriteField(fileName,f1,False);#<- False important for the test + MEDLoader.WriteField(fileName,f1,False);#<- False important for the test # - f2=MEDLoader.MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); - tt=MEDLoader.MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName()); + f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); + tt=MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName()); self.assertEqual(tt,[MEDLoader.ON_CELLS]); f2.checkCoherency(); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); @@ -307,17 +307,17 @@ class MEDLoaderTest(unittest.TestCase): def testFieldGaussRW1(self): fileName="Pyfile13.med"; f1=MEDLoaderDataForTest.buildVecFieldOnGauss_1(); - MEDLoader.MEDLoader.WriteField(fileName,f1,True); - f2=MEDLoader.MEDLoader.ReadField(MEDLoader.ON_GAUSS_PT,fileName,f1.getMesh().getName(),0,f1.getName(),1,5); + MEDLoader.WriteField(fileName,f1,True); + f2=MEDLoader.ReadField(MEDLoader.ON_GAUSS_PT,fileName,f1.getMesh().getName(),0,f1.getName(),1,5); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); pass def testFieldGaussNERW1(self): fileName="Pyfile14.med"; f1=MEDLoaderDataForTest.buildVecFieldOnGaussNE_1(); - MEDLoader.MEDLoader.WriteField(fileName,f1,True); - self.assertEqual([MEDLoader.ON_GAUSS_NE],MEDLoader.MEDLoader.GetTypesOfField(fileName,'2DMesh_2','MyFieldOnGaussNE')) #Bug 22/5/2014 - f2=MEDLoader.MEDLoader.ReadField(MEDLoader.ON_GAUSS_NE,fileName,f1.getMesh().getName(),0,f1.getName(),1,5); + MEDLoader.WriteField(fileName,f1,True); + self.assertEqual([MEDLoader.ON_GAUSS_NE],MEDLoader.GetTypesOfField(fileName,'2DMesh_2','MyFieldOnGaussNE')) #Bug 22/5/2014 + f2=MEDLoader.ReadField(MEDLoader.ON_GAUSS_NE,fileName,f1.getMesh().getName(),0,f1.getName(),1,5); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); pass @@ -327,8 +327,8 @@ class MEDLoaderTest(unittest.TestCase): renumber1=[2,5,1,0,3,4] mesh.renumberCells(renumber1,False); mesh.checkCoherency(); - MEDLoader.MEDLoader.WriteUMesh(fileName,mesh,True); - mesh_rw=MEDLoader.MEDLoader.ReadUMeshFromFile(fileName,mesh.getName(),0); + MEDLoader.WriteUMesh(fileName,mesh,True); + mesh_rw=MEDLoader.ReadUMeshFromFile(fileName,mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass @@ -343,23 +343,23 @@ class MEDLoaderTest(unittest.TestCase): m.renumberCells(renum,False); m.orientCorrectlyPolyhedrons(); # Writing - MEDLoader.MEDLoader.WriteUMesh(fileName,m,True); + MEDLoader.WriteUMesh(fileName,m,True); f1Tmp=m.getMeasureField(False); f1=f1Tmp.buildNewTimeReprFromThis(MEDLoader.ONE_TIME,False); f1.setTime(0.,1,2); f_1=f1.cloneWithMesh(True); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.applyFunc("2*x"); f1.setTime(0.01,3,4); f_2=f1.cloneWithMesh(True); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.applyFunc("2*x/3"); f1.setTime(0.02,5,6); f_3=f1.cloneWithMesh(True); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); # Reading its=[(1,2),(3,4),(5,6)]; - fs=MEDLoader.MEDLoader.ReadFieldsOnSameMesh(MEDLoader.ON_CELLS,fileName,f_1.getMesh().getName(),0,f_1.getName(),its); + fs=MEDLoader.ReadFieldsOnSameMesh(MEDLoader.ON_CELLS,fileName,f_1.getMesh().getName(),0,f_1.getName(),its); self.assertEqual(3,len(fs)); self.assertTrue(fs[0].isEqual(f_1,1e-12,1e-12)); self.assertTrue(fs[1].isEqual(f_2,1e-12,1e-12)); @@ -377,12 +377,12 @@ class MEDLoaderTest(unittest.TestCase): m2d.renumberCells(renumber,False); m2d.setName("ExampleOfMultiDimW"); meshes=[m2d,m3d] - MEDLoader.MEDLoader.WriteUMeshes(fileName,meshes,True); - m3d_bis=MEDLoader.MEDLoader.ReadUMeshFromFile(fileName,m2d.getName(),0); + MEDLoader.WriteUMeshes(fileName,meshes,True); + m3d_bis=MEDLoader.ReadUMeshFromFile(fileName,m2d.getName(),0); self.assertTrue(not m3d_bis.isEqual(m3d,1e-12)); m3d_bis.setName(m3d.getName()); self.assertTrue(m3d_bis.isEqual(m3d,1e-12)); - m2d_bis=MEDLoader.MEDLoader.ReadUMeshFromFile(fileName,m2d.getName(),-1);#-1 for faces + m2d_bis=MEDLoader.ReadUMeshFromFile(fileName,m2d.getName(),-1);#-1 for faces self.assertTrue(m2d_bis.isEqual(m2d,1e-12)); # Creation of a field on faces. f1=MEDLoader.MEDCouplingFieldDouble.New(MEDLoader.ON_CELLS,MEDLoader.ONE_TIME); @@ -397,8 +397,8 @@ class MEDLoaderTest(unittest.TestCase): tmp=array.setValues(arr1,m2d.getNumberOfCells(),2); f1.setTime(3.14,2,7); f1.checkCoherency(); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); - f2=MEDLoader.MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),-1,f1.getName(),2,7); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),-1,f1.getName(),2,7); self.assertTrue(f2.isEqual(f1,1e-12,1e-12)); pass @@ -407,7 +407,7 @@ class MEDLoaderTest(unittest.TestCase): fileName2="Pyfile20.med"; m=MEDLoaderDataForTest.build2DMesh_1(); nbOfNodes=m.getNumberOfNodes(); - MEDLoader.MEDLoader.WriteUMesh(fileName,m,True); + MEDLoader.WriteUMesh(fileName,m,True); f1=MEDLoader.MEDCouplingFieldDouble.New(MEDLoader.ON_NODES,MEDLoader.ONE_TIME); f1.setName("VFieldOnNodes"); f1.setMesh(m); @@ -422,17 +422,17 @@ class MEDLoaderTest(unittest.TestCase): arr2=[1,4] f2=f1.buildSubPart(arr2); f2.getMesh().setName(f1.getMesh().getName()); - MEDLoader.MEDLoader.WriteField(fileName,f2,False);#<- False important for the test + MEDLoader.WriteField(fileName,f2,False);#<- False important for the test # - f3=MEDLoader.MEDLoader.ReadFieldNode(fileName,f2.getMesh().getName(),0,f2.getName(),2,7); + f3=MEDLoader.ReadFieldNode(fileName,f2.getMesh().getName(),0,f2.getName(),2,7); f3.checkCoherency(); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); # arr3=[1,3,0,5,2,4] f2.renumberNodes(arr3); - MEDLoader.MEDLoader.WriteUMesh(fileName2,m,True); - MEDLoader.MEDLoader.WriteField(fileName2,f2,False);#<- False important for the test - f3=MEDLoader.MEDLoader.ReadFieldNode(fileName2,f2.getMesh().getName(),0,f2.getName(),2,7); + MEDLoader.WriteUMesh(fileName2,m,True); + MEDLoader.WriteField(fileName2,f2,False);#<- False important for the test + f3=MEDLoader.ReadFieldNode(fileName2,f2.getMesh().getName(),0,f2.getName(),2,7); f3.checkCoherency(); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); # @@ -441,7 +441,7 @@ class MEDLoaderTest(unittest.TestCase): def testFieldNodeProfilRW2(self): fileName="Pyfile23.med"; mesh=MEDLoaderDataForTest.build3DSurfMesh_1(); - MEDLoader.MEDLoader.WriteUMesh(fileName,mesh,True); + MEDLoader.WriteUMesh(fileName,mesh,True); # f1=MEDLoader.MEDCouplingFieldDouble.New(MEDLoader.ON_NODES,MEDLoader.ONE_TIME); f1.setName("FieldMix"); @@ -459,8 +459,8 @@ class MEDLoaderTest(unittest.TestCase): renumArr=[3,7,2,1,5,11,10,0,9,6,8,4] f1.renumberNodes(renumArr); f1.checkCoherency(); - MEDLoader.MEDLoader.WriteField(fileName,f1,False);#<- False important for the test - f2=MEDLoader.MEDLoader.ReadFieldNode(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); + MEDLoader.WriteField(fileName,f1,False);#<- False important for the test + f2=MEDLoader.ReadFieldNode(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); self.assertTrue(f2.isEqual(f1,1e-12,1e-12)); # pass @@ -493,26 +493,26 @@ class MEDLoaderTest(unittest.TestCase): f2.setTime(3.14,2,7); f2.checkCoherency(); # - MEDLoader.MEDLoader.WriteField(fileName,f1,True); - ts=MEDLoader.MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName()); + MEDLoader.WriteField(fileName,f1,True); + ts=MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName()); self.assertEqual(1,len(ts)); self.assertEqual(MEDLoader.ON_CELLS,ts[0]); - fs=MEDLoader.MEDLoader.GetAllFieldNamesOnMesh(fileName,f1.getMesh().getName()); + fs=MEDLoader.GetAllFieldNamesOnMesh(fileName,f1.getMesh().getName()); self.assertEqual(1,len(fs)); self.assertTrue(fs[0]=="FieldMix"); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f2); - fs=MEDLoader.MEDLoader.GetAllFieldNamesOnMesh(fileName,f1.getMesh().getName()); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f2); + fs=MEDLoader.GetAllFieldNamesOnMesh(fileName,f1.getMesh().getName()); self.assertEqual(1,len(fs)); self.assertTrue(fs[0]=="FieldMix"); # - ts=MEDLoader.MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName()); + ts=MEDLoader.GetTypesOfField(fileName,f1.getMesh().getName(),f1.getName()); self.assertEqual(2,len(ts)); self.assertEqual(MEDLoader.ON_NODES,ts[0]); self.assertEqual(MEDLoader.ON_CELLS,ts[1]); # - f3=MEDLoader.MEDLoader.ReadFieldNode(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); + f3=MEDLoader.ReadFieldNode(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); - f3=MEDLoader.MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); + f3=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),2,7); self.assertTrue(f3.isEqual(f1,1e-12,1e-12)); # pass @@ -525,22 +525,22 @@ class MEDLoaderTest(unittest.TestCase): f1.setTime(3.44,5,6); f1.setMesh(mesh); f1.fillFromAnalytic(2,"x+y"); - MEDLoader.MEDLoader.WriteField(fileName,f1,True); + MEDLoader.WriteField(fileName,f1,True); f1.setTime(1002.3,7,8); f1.fillFromAnalytic(2,"x+77.*y"); - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setName("Field2"); - MEDLoader.MEDLoader.WriteField(fileName,f1,False); + MEDLoader.WriteField(fileName,f1,False); f1.setName("Field3"); mesh.setName("2DMesh_2Bis"); - MEDLoader.MEDLoader.WriteField(fileName,f1,False); + MEDLoader.WriteField(fileName,f1,False); f1=MEDLoader.MEDCouplingFieldDouble.New(MEDLoader.ON_CELLS,MEDLoader.ONE_TIME); f1.setName("Field8"); f1.setTime(8.99,7,9); f1.setMesh(mesh); f1.fillFromAnalytic(3,"3*x+y"); - MEDLoader.MEDLoader.WriteField(fileName,f1,False); - fs=MEDLoader.MEDLoader.GetAllFieldNames(fileName); + MEDLoader.WriteField(fileName,f1,False); + fs=MEDLoader.GetAllFieldNames(fileName); self.assertEqual(4,len(fs)); self.assertTrue(fs[0]=="Field1"); self.assertTrue(fs[1]=="Field2"); @@ -559,8 +559,8 @@ class MEDLoaderTest(unittest.TestCase): arr.setInfoOnComponents(["c%i"%(i) for i in xrange(nbOfCompo)]) f.setArray(arr) f.setName("FieldBigCompo") - MEDLoader.MEDLoader.WriteField(fileName,f,True) - f2=MEDLoader.MEDLoader.ReadFieldCell(fileName,m.getName(),0,f.getName(),-1,-1) + MEDLoader.WriteField(fileName,f,True) + f2=MEDLoader.ReadFieldCell(fileName,m.getName(),0,f.getName(),-1,-1) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) pass @@ -577,18 +577,18 @@ class MEDLoaderTest(unittest.TestCase): # m0=MEDLoader.MEDCoupling1SGTUMesh.Merge1SGTUMeshes(ms) f=m0.getMeasureField(False) ; f.getArray().setInfoOnComponents(["ABC [defg]"]) - MEDLoader.MEDLoader.WriteField(fname,f,True) + MEDLoader.WriteField(fname,f,True) # - fRead=MEDLoader.MEDLoader.ReadFieldCell(fname,"merge",0,f.getName(),-1,-1) + fRead=MEDLoader.ReadFieldCell(fname,"merge",0,f.getName(),-1,-1) fRead.setMesh(MEDLoader.MEDCoupling1SGTUMesh(fRead.getMesh())) self.assertTrue(f.isEqual(fRead,1e-12,1e-12)) # m0=m0.buildUnstructured() ; m0.convertAllToPoly() m0=MEDLoader.MEDCoupling1DGTUMesh(m0) f=m0.getMeasureField(False) ; f.getArray().setInfoOnComponents(["ABC [defg]"]) - MEDLoader.MEDLoader.WriteField(fname,f,True) + MEDLoader.WriteField(fname,f,True) # - fRead=MEDLoader.MEDLoader.ReadFieldCell(fname,"merge",0,f.getName(),-1,-1) + fRead=MEDLoader.ReadFieldCell(fname,"merge",0,f.getName(),-1,-1) fRead.setMesh(MEDLoader.MEDCoupling1DGTUMesh(fRead.getMesh())) self.assertTrue(f.isEqual(fRead,1e-12,1e-12)) # @@ -597,9 +597,9 @@ class MEDLoaderTest(unittest.TestCase): m0.setCoords(arr,arr) m0.setName("mesh") f=m0.getMeasureField(False) ; f.getArray().setInfoOnComponents(["ABC [defg]"]) - MEDLoader.MEDLoader.WriteField(fname,f,True) + MEDLoader.WriteField(fname,f,True) # - fRead=MEDLoader.MEDLoader.ReadFieldCell(fname,"mesh",0,f.getName(),-1,-1) + fRead=MEDLoader.ReadFieldCell(fname,"mesh",0,f.getName(),-1,-1) self.assertTrue(f.isEqual(fRead,1e-12,1e-12)) # c=m0.buildUnstructured().getCoords() @@ -607,9 +607,9 @@ class MEDLoaderTest(unittest.TestCase): m0.setNodeGridStructure([4,4]) m0.setCoords(c) f=m0.getMeasureField(False) ; f.getArray().setInfoOnComponents(["ABC [defg]"]) - MEDLoader.MEDLoader.WriteField(fname,f,True) + MEDLoader.WriteField(fname,f,True) # - fRead=MEDLoader.MEDLoader.ReadFieldCell(fname,"mesh",0,f.getName(),-1,-1) + fRead=MEDLoader.ReadFieldCell(fname,"mesh",0,f.getName(),-1,-1) self.assertTrue(f.isEqual(fRead,1e-12,1e-12)) pass @@ -624,18 +624,18 @@ class MEDLoaderTest(unittest.TestCase): elt.translate([float(i)*1.5,0.]) pass m0=MEDLoader.MEDCoupling1SGTUMesh.Merge1SGTUMeshes(ms) - MEDLoader.MEDLoader.WriteMesh(fname,m0,True) + MEDLoader.WriteMesh(fname,m0,True) # - mRead=MEDLoader.MEDLoader.ReadMeshFromFile(fname,"merge",0) + mRead=MEDLoader.ReadMeshFromFile(fname,"merge",0) self.assertTrue(isinstance(mRead,MEDLoader.MEDCouplingUMesh)) mRead=MEDLoader.MEDCoupling1SGTUMesh(mRead) self.assertTrue(m0.isEqual(mRead,1e-12)) # m0=m0.buildUnstructured() ; m0.convertAllToPoly() m0=MEDLoader.MEDCoupling1DGTUMesh(m0) - MEDLoader.MEDLoader.WriteMesh(fname,m0,True) + MEDLoader.WriteMesh(fname,m0,True) # - mRead=MEDLoader.MEDLoader.ReadMeshFromFile(fname,"merge",0) + mRead=MEDLoader.ReadMeshFromFile(fname,"merge",0) mRead=MEDLoader.MEDCoupling1DGTUMesh(mRead) self.assertTrue(m0.isEqual(mRead,1e-12)) # @@ -643,9 +643,9 @@ class MEDLoaderTest(unittest.TestCase): arr=MEDLoader.DataArrayDouble(4) ; arr.iota() m0.setCoords(arr,arr) m0.setName("mesh") - MEDLoader.MEDLoader.WriteMesh(fname,m0,True) + MEDLoader.WriteMesh(fname,m0,True) # - mRead=MEDLoader.MEDLoader.ReadMeshFromFile(fname,0) + mRead=MEDLoader.ReadMeshFromFile(fname,0) self.assertTrue(isinstance(mRead,MEDLoader.MEDCouplingCMesh)) self.assertTrue(m0.isEqual(mRead,1e-12)) # @@ -653,9 +653,9 @@ class MEDLoaderTest(unittest.TestCase): m0=MEDLoader.MEDCouplingCurveLinearMesh("mesh") m0.setNodeGridStructure([4,4]) m0.setCoords(c) - MEDLoader.MEDLoader.WriteMesh(fname,m0,True) + MEDLoader.WriteMesh(fname,m0,True) # - mRead=MEDLoader.MEDLoader.ReadMeshFromFile(fname,0) + mRead=MEDLoader.ReadMeshFromFile(fname,0) self.assertTrue(isinstance(mRead,MEDLoader.MEDCouplingCurveLinearMesh)) self.assertTrue(m0.isEqual(mRead,1e-12)) pass @@ -698,18 +698,18 @@ class MEDLoaderTest(unittest.TestCase): f.setName("field") # mm=MEDLoader.MEDFileUMesh() - MEDLoader.MEDLoader.SetTooLongStrPolicy(2) - MEDLoader.MEDLoader.AssignStaticWritePropertiesTo(mm) + MEDLoader.SetTooLongStrPolicy(2) + MEDLoader.AssignStaticWritePropertiesTo(mm) self.assertEqual(2,mm.getTooLongStrPolicy()) - MEDLoader.MEDLoader.SetTooLongStrPolicy(0) - MEDLoader.MEDLoader.AssignStaticWritePropertiesTo(mm) + MEDLoader.SetTooLongStrPolicy(0) + MEDLoader.AssignStaticWritePropertiesTo(mm) self.assertEqual(0,mm.getTooLongStrPolicy()) del mm # - MEDLoader.MEDLoader.SetTooLongStrPolicy(2) - self.assertRaises(MEDLoader.InterpKernelException,MEDLoader.MEDLoader.WriteField,fname,f,True)# the component name is too long + policy 2 -> throw + MEDLoader.SetTooLongStrPolicy(2) + self.assertRaises(MEDLoader.InterpKernelException,MEDLoader.WriteField,fname,f,True)# the component name is too long + policy 2 -> throw f.getArray().setInfoOnComponent(0,'I129') - MEDLoader.MEDLoader.WriteField(fname,f,True) + MEDLoader.WriteField(fname,f,True) pass def testUsingAlreadyWrittenMesh2(self): @@ -736,18 +736,18 @@ class MEDLoaderTest(unittest.TestCase): # f11=f1.deepCpy() ; (f11.getArray())[:]*=4 ; f11.setTime(1.1,5,6) # - MEDLoader.MEDLoader.WriteMesh(fname,f1.getMesh(),True) - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f1) - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f2) - MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f11) + MEDLoader.WriteMesh(fname,f1.getMesh(),True) + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f1) + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f2) + MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f11) ## - f1r=MEDLoader.MEDLoader.ReadFieldNode(fname,"mesh",0,"f1",-1,-1); + f1r=MEDLoader.ReadFieldNode(fname,"mesh",0,"f1",-1,-1); self.assertTrue(f1.isEqual(f1r,1e-12,1e-12)) self.assertTrue(f1r.getArray().isEqual(MEDLoader.DataArrayDouble([0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.]),1e-12)) - f2r=MEDLoader.MEDLoader.ReadFieldNode(fname,"mesh",0,"f2",-1,-1); + f2r=MEDLoader.ReadFieldNode(fname,"mesh",0,"f2",-1,-1); self.assertTrue(f2.isEqual(f2r,1e-12,1e-12)) self.assertTrue(f2r.getArray().isEqual(MEDLoader.DataArrayDouble([0.,3.,6.,9.,12.,15.,18.,21.,24.,27.,30.,33.,36.,39.,42.,45.,48.,51.,54.,57.]),1e-12)) - f3r=MEDLoader.MEDLoader.ReadFieldNode(fname,"mesh",0,"f1",5,6); + f3r=MEDLoader.ReadFieldNode(fname,"mesh",0,"f1",5,6); self.assertTrue(f11.isEqual(f3r,1e-12,1e-12)) self.assertTrue(f3r.getArray().isEqual(MEDLoader.DataArrayDouble([0.,4.,8.,12.,16.,20.,24.,28.,32.,36.,40.,44.,48.,52.,56.,60.,64.,68.,72.,76.]),1e-12)) pass diff --git a/src/MEDLoader/Swig/MEDLoaderTest2.py b/src/MEDLoader/Swig/MEDLoaderTest2.py index 06cc645d0..cce9f07e0 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest2.py +++ b/src/MEDLoader/Swig/MEDLoaderTest2.py @@ -28,52 +28,52 @@ class MEDLoaderTest(unittest.TestCase): def testMesh1DRW(self): mesh=MEDLoaderDataForTest.build1DMesh_1(); mesh.checkCoherency(); - MEDLoader.WriteUMeshDep("Pyfile1.med",mesh,False); - mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile1.med",mesh.getName(),0); + WriteUMeshDep("Pyfile1.med",mesh,False); + mesh_rw=ReadUMeshFromFile("Pyfile1.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testMesh2DCurveRW(self): mesh=MEDLoaderDataForTest.build2DCurveMesh_1(); mesh.checkCoherency(); - MEDLoader.WriteUMeshDep("Pyfile2.med",mesh,False); - mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile2.med",mesh.getName(),0); + WriteUMeshDep("Pyfile2.med",mesh,False); + mesh_rw=ReadUMeshFromFile("Pyfile2.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testMesh2DRW(self): mesh=MEDLoaderDataForTest.build2DMesh_1(); mesh.checkCoherency(); - MEDLoader.WriteUMeshDep("Pyfile3.med",mesh,False); - mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile3.med",mesh.getName(),0); + WriteUMeshDep("Pyfile3.med",mesh,False); + mesh_rw=ReadUMeshFromFile("Pyfile3.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testMesh3DSurfRW(self): mesh=MEDLoaderDataForTest.build3DSurfMesh_1(); mesh.checkCoherency(); - MEDLoader.WriteUMeshDep("Pyfile4.med",mesh,False); - mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile4.med",mesh.getName(),0); + WriteUMeshDep("Pyfile4.med",mesh,False); + mesh_rw=ReadUMeshFromFile("Pyfile4.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testMesh3DRW(self): mesh=MEDLoaderDataForTest.build3DMesh_1(); mesh.checkCoherency(); - MEDLoader.WriteUMeshDep("Pyfile5.med",mesh,False); - mesh_rw=MEDLoader.ReadUMeshFromFile("Pyfile5.med",mesh.getName(),0); + WriteUMeshDep("Pyfile5.med",mesh,False); + mesh_rw=ReadUMeshFromFile("Pyfile5.med",mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass def testFieldRW1(self): f1=MEDLoaderDataForTest.buildVecFieldOnCells_1(); - MEDLoader.WriteFieldDep("Pyfile6.med",f1,False); - f2=MEDLoader.ReadFieldCell("Pyfile6.med",f1.getMesh().getName(),0,f1.getName(),0,1); + WriteFieldDep("Pyfile6.med",f1,False); + f2=ReadFieldCell("Pyfile6.med",f1.getMesh().getName(),0,f1.getName(),0,1); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); # f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1(); - MEDLoader.WriteFieldDep("Pyfile7.med",f1,False); - f2=MEDLoader.ReadFieldNode("Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3); + WriteFieldDep("Pyfile7.med",f1,False); + f2=ReadFieldNode("Pyfile7.med",f1.getMesh().getName(),0,f1.getName(),2,3); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); pass @@ -82,44 +82,44 @@ class MEDLoaderTest(unittest.TestCase): VAL1=12345.67890314; VAL2=-1111111111111.; f1=MEDLoaderDataForTest.buildVecFieldOnCells_1(); - MEDLoader.WriteFieldDep(fileName,f1,False); + WriteFieldDep(fileName,f1,False); f1.setTime(10.,8,9); f1.getArray().setIJ(0,0,VAL1); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(10.14,18,19); f1.getArray().setIJ(0,0,VAL2); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); #retrieving time steps... - f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),8,9); + f2=ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),8,9); f1.setTime(10.,8,9); f1.getArray().setIJ(0,0,VAL1); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); - f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),0,1); + f2=ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),0,1); f3=MEDLoaderDataForTest.buildVecFieldOnCells_1(); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); - f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),18,19); + f2=ReadFieldCell(fileName,f1.getMesh().getName(),0,f1.getName(),18,19); f1.setTime(10.14,18,19); f1.getArray().setIJ(0,0,VAL2); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); #ON NODES f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1(); fileName2="Pyfile9.med"; - MEDLoader.WriteFieldDep(fileName2,f1,False); + WriteFieldDep(fileName2,f1,False); f1.setTime(110.,108,109); tmp=f1.getArray().getPointer(); f1.getArray().setIJ(0,3,VAL1); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); f1.setTime(210.,208,209); f1.getArray().setIJ(0,3,VAL2); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); - f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),108,109); + WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); + f2=ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),108,109); f1.setTime(110.,108,109); f1.getArray().setIJ(0,3,VAL1); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); - f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),2,3); + f2=ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),2,3); f3=MEDLoaderDataForTest.buildVecFieldOnNodes_1(); self.assertTrue(f3.isEqual(f2,1e-12,1e-12)); - f2=MEDLoader.ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),208,209); + f2=ReadFieldNode(fileName2,f1.getMesh().getName(),0,f1.getName(),208,209); f1.setTime(210.,208,209); f1.getArray().setIJ(0,3,VAL2); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)); @@ -140,64 +140,64 @@ class MEDLoaderTest(unittest.TestCase): f1.setTime(10.,8,9); tmp=f1.getArray().getPointer(); f1.getArray().setIJ(0,0,VAL1); - MEDLoader.WriteFieldDep(fileName,f1,False); + WriteFieldDep(fileName,f1,False); f1.setTime(10.14,18,19); f1.getArray().setIJ(0,0,VAL2); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.getMesh().setName(name3); f1.setTime(10.55,28,29); f1.getArray().setIJ(0,0,3*VAL1); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(10.66,38,39); f1.getArray().setIJ(0,0,3*VAL2); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(10.77,48,49); f1.getArray().setIJ(0,0,4*VAL2); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); #ON NODES f1=MEDLoaderDataForTest.buildVecFieldOnNodes_1(); f1.setName(name1); f1.getMesh().setName(name3); f1.setTime(110.,8,9); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(110.,108,109); tmp=f1.getArray().getPointer(); f1.getArray().setIJ(0,3,VAL1); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.setTime(210.,208,209); f1.getArray().setIJ(0,3,VAL2); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); # - it1=MEDLoader.GetCellFieldIterations(fileName,name3,name1); + it1=GetCellFieldIterations(fileName,name3,name1); self.assertEqual(5,len(it1)); self.assertEqual(8,it1[0][0]); self.assertEqual(9,it1[0][1]); self.assertEqual(18,it1[1][0]); self.assertEqual(19,it1[1][1]); self.assertEqual(28,it1[2][0]); self.assertEqual(29,it1[2][1]); self.assertEqual(38,it1[3][0]); self.assertEqual(39,it1[3][1]); self.assertEqual(48,it1[4][0]); self.assertEqual(49,it1[4][1]); - it3=MEDLoader.GetNodeFieldIterations(fileName,name3,name1); + it3=GetNodeFieldIterations(fileName,name3,name1); self.assertEqual(3,len(it3)); self.assertEqual(8,it3[0][0]); self.assertEqual(9,it3[0][1]); self.assertEqual(108,it3[1][0]); self.assertEqual(109,it3[1][1]); self.assertEqual(208,it3[2][0]); self.assertEqual(209,it3[2][1]); # # - f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,8,9); + f1=ReadFieldCell(fileName,name3,0,name1,8,9); self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,0),13); - f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,18,19); + f1=ReadFieldCell(fileName,name3,0,name1,18,19); self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,0),13); - f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,28,29); + f1=ReadFieldCell(fileName,name3,0,name1,28,29); self.assertAlmostEqual(3*VAL1,f1.getArray().getIJ(0,0),13); - f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,38,39); + f1=ReadFieldCell(fileName,name3,0,name1,38,39); self.assertAlmostEqual(3*VAL2,f1.getArray().getIJ(0,0),13); - f1=MEDLoader.ReadFieldCell(fileName,name3,0,name1,48,49); + f1=ReadFieldCell(fileName,name3,0,name1,48,49); self.assertAlmostEqual(4*VAL2,f1.getArray().getIJ(0,0),13); # - f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,8,9); + f1=ReadFieldNode(fileName,name3,0,name1,8,9); self.assertAlmostEqual(71.,f1.getArray().getIJ(0,3),13); - f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,108,109); + f1=ReadFieldNode(fileName,name3,0,name1,108,109); self.assertAlmostEqual(VAL1,f1.getArray().getIJ(0,3),13); - f1=MEDLoader.ReadFieldNode(fileName,name3,0,name1,208,209); + f1=ReadFieldNode(fileName,name3,0,name1,208,209); self.assertAlmostEqual(VAL2,f1.getArray().getIJ(0,3),13); pass @@ -220,15 +220,15 @@ class MEDLoaderTest(unittest.TestCase): mesh4.setCoords(mesh1.getCoords()); meshes=[mesh1,mesh2,mesh3,mesh4] mnane="3DToto"; - MEDLoader.WriteUMeshesPartitionDep(fileName,mnane,meshes,False); + WriteUMeshesPartitionDep(fileName,mnane,meshes,False); # - mesh5=MEDLoader.ReadUMeshFromFile(fileName,mnane); + mesh5=ReadUMeshFromFile(fileName,mnane); mesh1.setName(mnane); part3=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17] mesh6=mesh5.buildPartOfMySelf(part3,True); mesh6.setName(mnane); self.assertTrue(mesh6.isEqual(mesh1,1e-12)); - grps=MEDLoader.GetMeshGroupsNames(fileName,mnane); + grps=GetMeshGroupsNames(fileName,mnane); self.assertEqual(4,len(grps)); grps.index("mesh2"); grps.index("mesh3"); @@ -236,21 +236,21 @@ class MEDLoaderTest(unittest.TestCase): grps.index("3DMesh_1"); # vec=["mesh2"]; - mesh2_2=MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); + mesh2_2=ReadUMeshFromGroups(fileName,mnane,0,vec); self.assertTrue(mesh2_2.isEqual(mesh2,1e-12)); vec=["mesh3"]; - mesh3_2=MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); + mesh3_2=ReadUMeshFromGroups(fileName,mnane,0,vec); self.assertTrue(mesh3_2.isEqual(mesh3,1e-12)); vec=["mesh4"]; - mesh4_2=MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); + mesh4_2=ReadUMeshFromGroups(fileName,mnane,0,vec); self.assertTrue(mesh4_2.isEqual(mesh4,1e-12)); vec=["3DMesh_1"]; - mesh1_2=MEDLoader.ReadUMeshFromGroups(fileName,mnane,0,vec); + mesh1_2=ReadUMeshFromGroups(fileName,mnane,0,vec); mesh1.setName("3DMesh_1"); self.assertTrue(mesh1_2.isEqual(mesh1,1e-12)); # vec=["Family_-5","Family_-3"]; - mesh2_2=MEDLoader.ReadUMeshFromFamilies(fileName,mnane,0,vec); + mesh2_2=ReadUMeshFromFamilies(fileName,mnane,0,vec); mesh2_2.setName("mesh2"); self.assertTrue(mesh2_2.isEqual(mesh2,1e-12)); pass @@ -261,8 +261,8 @@ class MEDLoaderTest(unittest.TestCase): renumber1=[2,5,1,0,3,4] mesh.renumberCells(renumber1,False); mesh.checkCoherency(); - MEDLoader.WriteUMeshDep(fileName,mesh,False); - mesh_rw=MEDLoader.ReadUMeshFromFile(fileName,mesh.getName(),0); + WriteUMeshDep(fileName,mesh,False); + mesh_rw=ReadUMeshFromFile(fileName,mesh.getName(),0); self.assertTrue(mesh.isEqual(mesh_rw,1e-12)); pass @@ -277,23 +277,23 @@ class MEDLoaderTest(unittest.TestCase): m.renumberCells(renum,False); m.orientCorrectlyPolyhedrons(); # Writing - MEDLoader.WriteUMeshDep(fileName,m,False); + WriteUMeshDep(fileName,m,False); f1Tmp=m.getMeasureField(False); f1=f1Tmp.buildNewTimeReprFromThis(ONE_TIME,False); f1.setTime(0.,1,2); f_1=f1.cloneWithMesh(True); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.applyFunc("2*x"); f1.setTime(0.01,3,4); f_2=f1.cloneWithMesh(True); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1.applyFunc("2*x/3"); f1.setTime(0.02,5,6); f_3=f1.cloneWithMesh(True); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); # Reading its=[(1,2),(3,4),(5,6)]; - fs=MEDLoader.ReadFieldsOnSameMesh(ON_CELLS,fileName,f_1.getMesh().getName(),0,f_1.getName(),its); + fs=ReadFieldsOnSameMesh(ON_CELLS,fileName,f_1.getMesh().getName(),0,f_1.getName(),its); self.assertEqual(3,len(fs)); self.assertTrue(fs[0].isEqual(f_1,1e-12,1e-12)); self.assertTrue(fs[1].isEqual(f_2,1e-12,1e-12)); @@ -311,12 +311,12 @@ class MEDLoaderTest(unittest.TestCase): m2d.renumberCells(renumber,False); m2d.setName("ExampleOfMultiDimW"); meshes=[m2d,m3d] - MEDLoader.WriteUMeshes(fileName,meshes,False); - m3d_bis=MEDLoader.ReadUMeshFromFile(fileName,m2d.getName(),0); + WriteUMeshes(fileName,meshes,False); + m3d_bis=ReadUMeshFromFile(fileName,m2d.getName(),0); self.assertTrue(not m3d_bis.isEqual(m3d,1e-12)); m3d_bis.setName(m3d.getName()); self.assertTrue(m3d_bis.isEqual(m3d,1e-12)); - m2d_bis=MEDLoader.ReadUMeshFromFile(fileName,m2d.getName(),-1);#-1 for faces + m2d_bis=ReadUMeshFromFile(fileName,m2d.getName(),-1);#-1 for faces self.assertTrue(m2d_bis.isEqual(m2d,1e-12)); # Creation of a field on faces. f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME); @@ -331,8 +331,8 @@ class MEDLoaderTest(unittest.TestCase): tmp=array.setValues(arr1,m2d.getNumberOfCells(),2); f1.setTime(3.14,2,7); f1.checkCoherency(); - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1); - f2=MEDLoader.ReadFieldCell(fileName,f1.getMesh().getName(),-1,f1.getName(),2,7); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + f2=ReadFieldCell(fileName,f1.getMesh().getName(),-1,f1.getName(),2,7); self.assertTrue(f2.isEqual(f1,1e-12,1e-12)); pass pass diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 66dd108a2..fd3522c33 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -33,10 +33,10 @@ class MEDLoaderTest(unittest.TestCase): self.assertRaises(InterpKernelException,MEDFileMesh.New,fileName,"") self.assertEqual((0,-1),medmesh.getNonEmptyLevels()) m1_0=medmesh.getLevel0Mesh(True) - m1_1=MEDLoader.ReadUMeshFromFile(fileName,mname,0) + m1_1=ReadUMeshFromFile(fileName,mname,0) self.assertTrue(m1_0.isEqual(m1_1,1e-12)); m2_0=medmesh.getLevelM1Mesh(True) - m2_1=MEDLoader.ReadUMeshFromFile(fileName,mname,-1) + m2_1=ReadUMeshFromFile(fileName,mname,-1) self.assertTrue(m2_0.isEqual(m2_1,1e-12)); pass @@ -47,23 +47,23 @@ class MEDLoaderTest(unittest.TestCase): medmesh=MEDFileUMesh.New(fileName,mname) self.assertEqual((0,),medmesh.getNonEmptyLevels()) m1_0=medmesh.getLevel0Mesh(True) - m1_1=MEDLoader.ReadUMeshFromFile(fileName,mname,0) + m1_1=ReadUMeshFromFile(fileName,mname,0) self.assertTrue(m1_0.isEqual(m1_1,1e-12)); g1_0=medmesh.getGroup(0,"mesh2",True) - g1_1=MEDLoader.ReadUMeshFromGroups(fileName,mname,0,["mesh2"]); + g1_1=ReadUMeshFromGroups(fileName,mname,0,["mesh2"]); self.assertTrue(g1_0.isEqual(g1_1,1e-12)); g1_0=medmesh.getGroup(0,"mesh3",True) - g1_1=MEDLoader.ReadUMeshFromGroups(fileName,mname,0,["mesh3"]); + g1_1=ReadUMeshFromGroups(fileName,mname,0,["mesh3"]); self.assertTrue(g1_0.isEqual(g1_1,1e-12)); g1_0=medmesh.getGroups(0,["mesh3","mesh2"]) - g1_1=MEDLoader.ReadUMeshFromGroups(fileName,mname,0,["mesh3","mesh2"]); + g1_1=ReadUMeshFromGroups(fileName,mname,0,["mesh3","mesh2"]); g1_1.setName(g1_0.getName()) self.assertTrue(g1_0.isEqual(g1_1,1e-12)); g1_0=medmesh.getFamily(0,"Family_-3",True) - g1_1=MEDLoader.ReadUMeshFromFamilies(fileName,mname,0,["Family_-3"]); + g1_1=ReadUMeshFromFamilies(fileName,mname,0,["Family_-3"]); self.assertTrue(g1_0.isEqual(g1_1,1e-12)); g1_0=medmesh.getFamilies(0,["Family_-3","Family_-5"],True) - g1_1=MEDLoader.ReadUMeshFromFamilies(fileName,mname,0,["Family_-3","Family_-5"]); + g1_1=ReadUMeshFromFamilies(fileName,mname,0,["Family_-3","Family_-5"]); g1_1.setName(g1_0.getName()) self.assertTrue(g1_0.isEqual(g1_1,1e-12)); self.assertTrue(g1_0.isEqual(g1_1,1e-12)); @@ -194,7 +194,7 @@ class MEDLoaderTest(unittest.TestCase): m.setName(mm.getName()) ; m.setDescription(mm.getDescription()) self.assertTrue(m.isEqual(mbis,1e-12)); # - self.assertEqual(([[(3, 2), (4, 1), (5, 8)], [(1, 2), (2, 1)], [(0, 4)]], 2, 2, 9),MEDLoader.GetUMeshGlobalInfo(outFileName,"MyFirstMEDCouplingMEDmesh")) + self.assertEqual(([[(3, 2), (4, 1), (5, 8)], [(1, 2), (2, 1)], [(0, 4)]], 2, 2, 9),GetUMeshGlobalInfo(outFileName,"MyFirstMEDCouplingMEDmesh")) pass # this test is the testMEDMesh3 except that permutation is dealed here @@ -439,7 +439,7 @@ class MEDLoaderTest(unittest.TestCase): mm.write("Pyfile19_bis.med",2) ff=MEDFileFieldMultiTS.New("Pyfile19.med") ff.write("Pyfile19_bis.med",0) - self.assertEqual([('tyty','mm'),('uiop','MW')],MEDLoader.GetComponentsNamesOfField("Pyfile19_bis.med","VFieldOnNodes")) + self.assertEqual([('tyty','mm'),('uiop','MW')],GetComponentsNamesOfField("Pyfile19_bis.med","VFieldOnNodes")) pass #gauss points @@ -450,7 +450,7 @@ class MEDLoaderTest(unittest.TestCase): ff.write("Pyfile13_bis.med",0) ff=MEDFileField1TS.New("Pyfile13.med","MyFirstFieldOnGaussPoint",1,5) f=ff.getFieldAtLevel(ON_GAUSS_PT,0) - f2=MEDLoader.ReadFieldGauss("Pyfile13.med",'2DMesh_2',0,'MyFirstFieldOnGaussPoint',1,5) + f2=ReadFieldGauss("Pyfile13.med",'2DMesh_2',0,'MyFirstFieldOnGaussPoint',1,5) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) ff3=MEDFileField1TS.New("Pyfile13.med","MyFirstFieldOnGaussPoint") f3=ff3.getFieldAtLevel(ON_GAUSS_PT,0) @@ -468,7 +468,7 @@ class MEDLoaderTest(unittest.TestCase): ff.write("Pyfile14_bis.med",0) ff=MEDFileField1TS.New("Pyfile14.med","MyFieldOnGaussNE",1,5) f=ff.getFieldAtLevel(ON_GAUSS_NE,0) - f2=MEDLoader.ReadFieldGaussNE("Pyfile14.med",'2DMesh_2',0,"MyFieldOnGaussNE",1,5) + f2=ReadFieldGaussNE("Pyfile14.med",'2DMesh_2',0,"MyFieldOnGaussNE",1,5) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) pass @@ -476,14 +476,14 @@ class MEDLoaderTest(unittest.TestCase): def testMEDField5(self): ff=MEDFileField1TS.New("Pyfile17.med","MeasureOfMesh_Extruded",1,2) f=ff.getFieldAtLevel(ON_CELLS,0) - f2=MEDLoader.ReadFieldCell("Pyfile17.med","Extruded",0,"MeasureOfMesh_Extruded",1,2) + f2=ReadFieldCell("Pyfile17.med","Extruded",0,"MeasureOfMesh_Extruded",1,2) self.assertTrue(f.getMesh().getCoords().isEqual(f2.getMesh().getCoords(),1e-12)) f.getMesh().tryToShareSameCoords(f2.getMesh(),1e-12) f.changeUnderlyingMesh(f2.getMesh(),22,1e-12) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) # no with renumbering f=ff.getFieldAtLevel(ON_CELLS,0,1) - f2=MEDLoader.ReadFieldCell("Pyfile17.med","Extruded",0,"MeasureOfMesh_Extruded",1,2) + f2=ReadFieldCell("Pyfile17.med","Extruded",0,"MeasureOfMesh_Extruded",1,2) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) f=ff.getFieldAtLevel(ON_CELLS,0,3) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) @@ -499,12 +499,12 @@ class MEDLoaderTest(unittest.TestCase): its=ff.getIterations() self.assertRaises(InterpKernelException,ff.getFieldAtLevel,ON_CELLS,its[0][0],its[0][1],0)# request on cell and it is not on cells f=ff.getFieldAtLevel(ON_NODES,its[0][0],its[0][1],0) - f2=MEDLoader.ReadFieldNode("Pyfile7.med",'3DSurfMesh_1',0,"VectorFieldOnNodes",its[0][0],its[0][1]) + f2=ReadFieldNode("Pyfile7.med",'3DSurfMesh_1',0,"VectorFieldOnNodes",its[0][0],its[0][1]) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) ff=MEDFileFieldMultiTS.New("Pyfile19.med","VFieldOnNodes") its=ff.getIterations() f=ff.getFieldAtLevel(ON_NODES,its[0][0],its[0][1],0) - f2=MEDLoader.ReadFieldNode("Pyfile19.med",'2DMesh_1',0,"VFieldOnNodes",its[0][0],its[0][1]) + f2=ReadFieldNode("Pyfile19.med",'2DMesh_1',0,"VFieldOnNodes",its[0][0],its[0][1]) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) self.assertRaises(InterpKernelException,ff.getFieldAtLevel,ON_CELLS,its[0][0],its[0][1],0)# request on cell and it is not on cells self.assertRaises(InterpKernelException,ff.getFieldAtLevel,ON_NODES,its[0][0],its[0][1],0,1)#request renumber following mesh : it is on profile ! @@ -515,7 +515,7 @@ class MEDLoaderTest(unittest.TestCase): ff=MEDFileFieldMultiTS.New("Pyfile12.med","VectorFieldOnCells") its=ff.getIterations() f=ff.getFieldAtLevel(ON_CELLS,its[0][0],its[0][1],0) - f2=MEDLoader.ReadFieldCell("Pyfile12.med",'3DMesh_1',0,"VectorFieldOnCells",its[0][0],its[0][1]) + f2=ReadFieldCell("Pyfile12.med",'3DMesh_1',0,"VectorFieldOnCells",its[0][0],its[0][1]) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) pass @@ -532,7 +532,7 @@ class MEDLoaderTest(unittest.TestCase): ff1=MEDFileField1TS.New() ff1.setFieldNoProfileSBT(f1) ff1.write(fname,0) - f2=MEDLoader.ReadFieldCell(fname,f1.getMesh().getName(),0,f1.getName(),f1.getTime()[1],f1.getTime()[2]); + f2=ReadFieldCell(fname,f1.getMesh().getName(),0,f1.getName(),f1.getTime()[1],f1.getTime()[2]); itt,orr,ti=ff1.getTime() self.assertEqual(0,itt); self.assertEqual(1,orr); self.assertAlmostEqual(2.,ti,14); self.assertTrue(f1.isEqual(f2,1e-12,1e-12)) @@ -557,7 +557,7 @@ class MEDLoaderTest(unittest.TestCase): nv=1456. da=ff1.getUndergroundDataArray().setIJ(0,0,nv) ff1.write(fname,0) - f2=MEDLoader.ReadFieldNode(fname,f1.getMesh().getName(),0,f1.getName(),f1.getTime()[1],f1.getTime()[2]) + f2=ReadFieldNode(fname,f1.getMesh().getName(),0,f1.getName(),f1.getTime()[1],f1.getTime()[2]) self.assertTrue(not f1.isEqual(f2,1e-12,1e-12)) f1.getArray().setIJ(0,0,nv) self.assertTrue(f1.isEqual(f2,1e-12,1e-12)) @@ -573,7 +573,7 @@ class MEDLoaderTest(unittest.TestCase): ff1=MEDFileField1TS.New() ff1.setFieldNoProfileSBT(f1) ff1.write(fname,0) - f2=MEDLoader.ReadFieldGaussNE(fname,f1.getMesh().getName(),0,f1.getName(),f1.getTime()[1],f1.getTime()[2]) + f2=ReadFieldGaussNE(fname,f1.getMesh().getName(),0,f1.getName(),f1.getTime()[1],f1.getTime()[2]) self.assertTrue(f1.isEqual(f2,1e-12,1e-12)) da,infos=ff1.getUndergroundDataArrayExt() f2.getArray().setName(da.getName())#da has the same name than f2 @@ -1070,9 +1070,9 @@ class MEDLoaderTest(unittest.TestCase): ff2.setFieldNoProfileSBT(f2) ff2.write(fname,0) # - f3=MEDLoader.ReadFieldCell(fname,"3DSurfMesh_1",0,"VectorFieldOnCells",0,1) + f3=ReadFieldCell(fname,"3DSurfMesh_1",0,"VectorFieldOnCells",0,1) self.assertTrue(f3.isEqual(f1,1e-12,1e-12)) - f4=MEDLoader.ReadFieldCell(fname,"3DSurfMesh_2",0,"VectorFieldOnCells2",0,1) + f4=ReadFieldCell(fname,"3DSurfMesh_2",0,"VectorFieldOnCells2",0,1) self.assertTrue(f4.isEqual(f2,1e-12,1e-12)) pass @@ -1592,12 +1592,12 @@ class MEDLoaderTest(unittest.TestCase): f1tsRead.getFieldOnMeshAtLevel(ON_GAUSS_PT,0,mRead) f2=f1tsRead.getFieldOnMeshAtLevel(ON_GAUSS_PT,0,mRead) self.assertTrue(f.isEqual(f2,1e-12,1e-12)) - f2_bis=MEDLoader.ReadFieldGauss(fname,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) + f2_bis=ReadFieldGauss(fname,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) f2_bis.checkCoherency() self.assertTrue(f.isEqual(f2_bis,1e-12,1e-12)) # - MEDLoader.WriteField(fname2,f,True) - f2_ter=MEDLoader.ReadFieldGauss(fname2,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) + WriteField(fname2,f,True) + f2_ter=ReadFieldGauss(fname2,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) self.assertTrue(f.isEqual(f2_ter,1e-12,1e-12)) ## Use case 2 : Pfl on part tri3 with 2 disc and on part quad8 with 1 disc f=MEDCouplingFieldDouble.New(ON_GAUSS_PT,ONE_TIME) @@ -1630,12 +1630,12 @@ class MEDLoaderTest(unittest.TestCase): f3=f1tsRead.getFieldOnMeshAtLevel(ON_GAUSS_PT,0,mRead) f3.renumberCells([0,1,3,2,4,5,6,7,8,9]) self.assertTrue(f.isEqual(f3,1e-12,1e-12)) - f3_bis=MEDLoader.ReadFieldGauss(fname,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) + f3_bis=ReadFieldGauss(fname,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) f3_bis.renumberCells([0,1,3,2,4,5,6,7,8,9]) self.assertTrue(f.isEqual(f3_bis,1e-12,1e-12)) # - MEDLoader.WriteField(fname2,f,True) - f3_ter=MEDLoader.ReadFieldGauss(fname2,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) + WriteField(fname2,f,True) + f3_ter=ReadFieldGauss(fname2,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) f3_ter.renumberCells([0,1,3,2,4,5,6,7,8,9]) self.assertTrue(f.isEqual(f3_ter,1e-12,1e-12)) ## Use case 3 : no pfl but creation of pfls due to gauss pts @@ -1669,12 +1669,12 @@ class MEDLoaderTest(unittest.TestCase): f3=f1tsRead.getFieldOnMeshAtLevel(ON_GAUSS_PT,0,mRead) f3.renumberCells([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,16,19]) self.assertTrue(f.isEqual(f3,1e-12,1e-12)) - f3_bis=MEDLoader.ReadFieldGauss(fname,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) + f3_bis=ReadFieldGauss(fname,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) f3_bis.renumberCells([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,16,19]) self.assertTrue(f.isEqual(f3_bis,1e-12,1e-12)) # - MEDLoader.WriteField(fname2,f,True) - f3_ter=MEDLoader.ReadFieldGauss(fname2,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) + WriteField(fname2,f,True) + f3_ter=ReadFieldGauss(fname2,m.getName(),0,f.getName(),f.getTime()[1],f.getTime()[2]) f3_ter.renumberCells([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,16,19]) self.assertTrue(f.isEqual(f3_ter,1e-12,1e-12)) pass @@ -1740,7 +1740,7 @@ class MEDLoaderTest(unittest.TestCase): ff0_3=f0.getFieldOnMeshAtLevel(ON_NODES,0,m) ff0_3.checkCoherency() self.assertTrue(ff0_3.isEqual(fieldNode0,1e-12,1e-12)) - ff0_4=MEDLoader.ReadFieldNode(fname,m.getName(),0,fieldNode0.getName(),dt,it) + ff0_4=ReadFieldNode(fname,m.getName(),0,fieldNode0.getName(),dt,it) ff0_4.checkCoherency() self.assertTrue(ff0_4.isEqual(fieldNode0,1e-12,1e-12)) f1=MEDFileField1TS.New(fname,fieldNode1.getName(),dt,it) @@ -1756,7 +1756,7 @@ class MEDLoaderTest(unittest.TestCase): ff1_3=f1.getFieldOnMeshAtLevel(ON_NODES,-1,m) ff1_3.checkCoherency() self.assertTrue(ff1_3.isEqual(fieldNode1,1e-12,1e-12)) - ff1_4=MEDLoader.ReadFieldNode(fname,m.getName(),-1,fieldNode1.getName(),dt,it) + ff1_4=ReadFieldNode(fname,m.getName(),-1,fieldNode1.getName(),dt,it) ff1_4.checkCoherency() self.assertTrue(ff1_4.getMesh().isEqual(m10,1e-12)) self.assertRaises(InterpKernelException,f1.getFieldOnMeshAtLevel,ON_NODES,m0) # error because impossible to build a sub mesh at level 0 lying on nodes [0,1,2,3,4,5,6] @@ -1830,7 +1830,7 @@ class MEDLoaderTest(unittest.TestCase): ff0_3=f0.getFieldOnMeshAtLevel(ON_CELLS,0,m) ff0_3.checkCoherency() self.assertTrue(ff0_3.isEqual(fieldCell0,1e-12,1e-12)) - ff0_4=MEDLoader.ReadFieldCell(fname,m.getName(),0,fieldCell0.getName(),dt,it) + ff0_4=ReadFieldCell(fname,m.getName(),0,fieldCell0.getName(),dt,it) ff0_4.checkCoherency() self.assertTrue(ff0_4.isEqual(fieldCell0,1e-12,1e-12)) f1=MEDFileField1TS.New(fname,fieldCell1.getName(),dt,it) @@ -1846,7 +1846,7 @@ class MEDLoaderTest(unittest.TestCase): ff1_3=f1.getFieldOnMeshAtLevel(ON_CELLS,-1,m) ff1_3.checkCoherency() self.assertTrue(ff1_3.isEqual(fieldCell1,1e-12,1e-12)) - ff1_4=MEDLoader.ReadFieldCell(fname,m.getName(),-1,fieldCell1.getName(),dt,it) + ff1_4=ReadFieldCell(fname,m.getName(),-1,fieldCell1.getName(),dt,it) ff1_4.checkCoherency() self.assertTrue(ff1_4.getMesh().isEqual(m10,1e-12)) self.assertRaises(InterpKernelException,f1.getFieldOnMeshAtLevel,ON_CELLS,m0) # error because impossible to build a sub mesh at level 0 lying on cells [0,1,2,3,4,5,6] @@ -2444,7 +2444,7 @@ class MEDLoaderTest(unittest.TestCase): # mm0=MEDFileMesh.New(fileName) mm1=MEDFileMesh.New(fileName) - groupNamesIni=MEDLoader.GetMeshGroupsNames(fileName,"ma") + groupNamesIni=GetMeshGroupsNames(fileName,"ma") for name in groupNamesIni: mm1.changeGroupName(name,name+'N') pass @@ -3794,7 +3794,7 @@ class MEDLoaderTest(unittest.TestCase): arr[:,0]=range(25) arr[:,1]=range(100,125) f.setArray(arr) - MEDLoader.WriteField(fileName,f,2) + WriteField(fileName,f,2) f=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; f.setMesh(m) f.setName("FieldNode") arr=DataArrayDouble(36,2) ; arr.setInfoOnComponents(compos) @@ -3802,7 +3802,7 @@ class MEDLoaderTest(unittest.TestCase): arr[:,1]=range(300,336) f.setArray(arr) f.checkCoherency() - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f) + WriteFieldUsingAlreadyWrittenMesh(fileName,f) # ms=MEDFileMeshes() mm=MEDFileUMesh.LoadPartOf(fileName,meshName,[NORM_QUAD4],[0,6,1]) @@ -3859,7 +3859,7 @@ class MEDLoaderTest(unittest.TestCase): arr[:,0]=range(25) arr[:,1]=range(100,125) f.setArray(arr) - MEDLoader.WriteField(fileName,f,2) + WriteField(fileName,f,2) f=MEDCouplingFieldDouble(ON_NODES,ONE_TIME) ; f.setMesh(m) f.setName("FieldNode") arr=DataArrayDouble(36,2) ; arr.setInfoOnComponents(compos) @@ -3867,7 +3867,7 @@ class MEDLoaderTest(unittest.TestCase): arr[:,1]=range(300,336) f.setArray(arr) f.checkCoherency() - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f) + WriteFieldUsingAlreadyWrittenMesh(fileName,f) # ms=MEDFileMeshes() mm=MEDFileUMesh.LoadPartOf(fileName,meshName,[NORM_QUAD4],[4,6,1]) @@ -4196,7 +4196,7 @@ class MEDLoaderTest(unittest.TestCase): d[key]=[val] pass import re - allFields=MEDLoader.GetAllFieldNames(fileName) + allFields=GetAllFieldNames(fileName) allFieldsDict={} pat=re.compile("([\d]+)([\s\S]+)$") for st in allFields: diff --git a/src/MEDLoader/Swig/MEDLoaderTest4.py b/src/MEDLoader/Swig/MEDLoaderTest4.py index 58932a087..b3f28e316 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest4.py +++ b/src/MEDLoader/Swig/MEDLoaderTest4.py @@ -2649,30 +2649,30 @@ class MEDLoaderTest4(unittest.TestCase): f.setArray(DataArrayDouble([3.,5.,7.,6.,2.,3.,11.,8.])) f.setName(fieldName1) f.checkCoherency() - MEDLoader.WriteField(fname,f,True) + WriteField(fname,f,True) f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(*t) ; f2.setMesh(m) f2.setArray(DataArrayDouble([7.,11.],2,1)) f2.setName(fieldName2) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f2) + WriteFieldUsingAlreadyWrittenMesh(fname,f2) f3=MEDCouplingFieldDouble(ON_NODES) ; f3.setTime(*t) ; f3.setMesh(m) f3.setArray(DataArrayDouble([1.,2.,4.,1.,2.,4.],6,1)) f3.setName(fieldName3) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f3) + WriteFieldUsingAlreadyWrittenMesh(fname,f3) # t=(2.1,1,-1) f=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f.setTime(*t) ; f.setMesh(m) f.setArray(DataArrayDouble([7.,6.,3.,5.,11.,8.,2.,3.])) f.setName(fieldName1) f.checkCoherency() - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f) + WriteFieldUsingAlreadyWrittenMesh(fname,f) f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(*t) ; f2.setMesh(m) f2.setArray(DataArrayDouble([11.,7.],2,1)) f2.setName(fieldName2) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f2) + WriteFieldUsingAlreadyWrittenMesh(fname,f2) f3=MEDCouplingFieldDouble(ON_NODES) ; f3.setTime(*t) ; f3.setMesh(m) f3.setArray(DataArrayDouble([4.,2.,1.,4.,2.,1.],6,1)) f3.setName(fieldName3) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f3) + WriteFieldUsingAlreadyWrittenMesh(fname,f3) ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() fields=MEDFileFields(fname,False) @@ -2764,15 +2764,15 @@ class MEDLoaderTest4(unittest.TestCase): f.setArray(DataArrayDouble([3.,5.,4.,6.])) ; f.getArray().setInfoOnComponents(["Smth"]) f.setName(fieldName1) f.checkCoherency() - MEDLoader.WriteField(fname,f,True) + WriteField(fname,f,True) f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(*t) ; f2.setMesh(m) f2.setArray(DataArrayDouble([7.,11.],2,1)) f2.setName(fieldName2) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f2) + WriteFieldUsingAlreadyWrittenMesh(fname,f2) f3=MEDCouplingFieldDouble(ON_NODES) ; f3.setTime(*t) ; f3.setMesh(m) f3.setArray(DataArrayDouble([1.,2.,4.,1.,2.,4.],6,1)) f3.setName(fieldName3) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f3) + WriteFieldUsingAlreadyWrittenMesh(fname,f3) # t=(2.1,1,-1) f=MEDCouplingFieldDouble(ON_GAUSS_PT) ; f.setTime(*t) ; f.setMesh(m) @@ -2780,15 +2780,15 @@ class MEDLoaderTest4(unittest.TestCase): f.setArray(DataArrayDouble([5.,3.,6.,4.])) ; f.getArray().setInfoOnComponents(["Smth"]) f.setName(fieldName1) f.checkCoherency() - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f) + WriteFieldUsingAlreadyWrittenMesh(fname,f) f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setTime(*t) ; f2.setMesh(m) f2.setArray(DataArrayDouble([11.,7.],2,1)) f2.setName(fieldName2) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f2) + WriteFieldUsingAlreadyWrittenMesh(fname,f2) f3=MEDCouplingFieldDouble(ON_NODES) ; f3.setTime(*t) ; f3.setMesh(m) f3.setArray(DataArrayDouble([4.,2.,1.,4.,2.,1.],6,1)) f3.setName(fieldName3) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f3) + WriteFieldUsingAlreadyWrittenMesh(fname,f3) ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() fields=MEDFileFields(fname,False) @@ -4276,7 +4276,7 @@ class MEDLoaderTest4(unittest.TestCase): fCell=MEDCouplingFieldDouble(ON_CELLS) ; fCell.setName("fCell") arrCell=DataArrayDouble([7.]) ; arrCell.setInfoOnComponent(0,"smth") ; fCell.setArray(arrCell) fCell.setMesh(m) - MEDLoader.WriteField(fname,fCell,True) + WriteField(fname,fCell,True) refCoo=[-1.,-1.,-1.,-1.,1.,-1.,1.,1.,-1.,1.,-1.,-1.,-1.,-1.,1.,-1.,1.,1.,1.,1.,1.,1.,-1.,1.,-1.,0.,-1.,0.,1.,-1.,1.,0.,-1.,0.,-1.,-1.,-1.,0.,1.,0.,1.,1.,1.,0.,1.,0.,-1.,1.,-1.,-1.,0.,-1.,1.,0.,1.,1.,0.,1.,-1.,0.,0.,0.,-1.,-1.,0.,0.,0.,1.,0.,1.,0.,0.,0.,-1.,0.,0.,0.,1.,0.,0.,0.] weights=[0.1714677640603571,0.27434842249657115,0.1714677640603571,0.27434842249657115,0.43895747599451346,0.27434842249657115,0.1714677640603571,0.27434842249657115,0.1714677640603571,0.27434842249657115,0.43895747599451346,0.27434842249657115,0.43895747599451346,0.7023319615912209,0.43895747599451346,0.27434842249657115,0.43895747599451346,0.27434842249657115,0.1714677640603571,0.27434842249657115,0.1714677640603571,0.27434842249657115,0.43895747599451346,0.27434842249657115,0.1714677640603571,0.27434842249657115,0.1714677640603571] gCoords=[-0.774596669241483,-0.774596669241483,-0.774596669241483,-0.774596669241483,-0.774596669241483,0.0,-0.774596669241483,-0.774596669241483,0.774596669241483,-0.774596669241483,0.0,-0.774596669241483,-0.774596669241483,0.0,0.0,-0.774596669241483,0.0,0.774596669241483,-0.774596669241483,0.774596669241483,-0.774596669241483,-0.774596669241483,0.774596669241483,0.0,-0.774596669241483,0.774596669241483,0.774596669241483,0.0,-0.774596669241483,-0.774596669241483,0.0,-0.774596669241483,0.0,0.0,-0.774596669241483,0.774596669241483,0.0,0.0,-0.774596669241483,0.0,0.0,0.0,0.0,0.0,0.774596669241483,0.0,0.774596669241483,-0.774596669241483,0.0,0.774596669241483,0.0,0.0,0.774596669241483,0.774596669241483,0.774596669241483,-0.774596669241483,-0.774596669241483,0.774596669241483,-0.774596669241483,0.0,0.774596669241483,-0.774596669241483,0.774596669241483,0.774596669241483,0.0,-0.774596669241483,0.774596669241483,0.0,0.0,0.774596669241483,0.0,0.774596669241483,0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.774596669241483,0.0,0.774596669241483,0.774596669241483,0.774596669241483] @@ -4285,7 +4285,7 @@ class MEDLoaderTest4(unittest.TestCase): fGauss.setGaussLocalizationOnType(NORM_HEXA27,refCoo,gCoords,weights) arrGauss=DataArrayDouble(fGauss.getNumberOfTuplesExpected()) ; arrGauss.setInfoOnComponent(0,"gaussc") ; arrGauss.iota() fGauss.setArray(arrGauss) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,fGauss) + WriteFieldUsingAlreadyWrittenMesh(fname,fGauss) ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() fields=MEDFileFields(fname,False) @@ -4706,7 +4706,7 @@ class MEDLoaderTest4(unittest.TestCase): arr=DataArrayDouble(m.getNumberOfCells()) ; arr.iota(0) ; arr[i%10]=100. fCell0.setArray(arr) ; arr.setInfoOnComponents(["Comp1 [m]"]) fCell0.checkCoherency() - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,fCell0) + WriteFieldUsingAlreadyWrittenMesh(fname,fCell0) pass ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes(fname) ; ms.cartesianizeMe() @@ -4912,8 +4912,8 @@ class MEDLoaderTest4(unittest.TestCase): arrY=DataArrayDouble([0.,1.]) m=MEDCouplingCMesh() ; m.setCoords(arrX,arrY) ; m=m.buildUnstructured() ; m=m[[0,5,1,4,2,3]] ; m.changeSpaceDimension(3,0.) ; m.setName("Mesh") f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) ; f.setName("Field") ; f.setArray(DataArrayDouble([(0.1,1.1),(2.1,3.1),(4.1,5.1),(6.1,7.1),(8.1,9.1),(10.1,11.1)])) ; f.getArray().setInfoOnComponents(["aa","bbb"]) - MEDLoader.WriteUMesh(fname,m,True) - MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f) + WriteUMesh(fname,m,True) + WriteFieldUsingAlreadyWrittenMesh(fname,f) ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values ms=MEDFileMeshes() # here we reproduce what is done by ParaMEDFileMeshes.ParaNew ms.pushMesh(MEDFileUMesh.LoadPartOf(fname,"Mesh",[NORM_QUAD4],[0,2,1],-1,-1)); diff --git a/src/MEDLoader/Swig/SauvLoaderTest.py b/src/MEDLoader/Swig/SauvLoaderTest.py index 06756dd34..259af09a1 100644 --- a/src/MEDLoader/Swig/SauvLoaderTest.py +++ b/src/MEDLoader/Swig/SauvLoaderTest.py @@ -247,7 +247,7 @@ class SauvLoaderTest(unittest.TestCase): os.remove(sauvFile) pass - @unittest.skipUnless(MEDLoader.HasXDR(),"requires XDR") + @unittest.skipUnless(HasXDR(),"requires XDR") def testMissingGroups(self): """test for issue 0021749: [CEA 601] Some missing groups in mesh after reading a SAUV file with SauvReader.""" sauvFile = os.path.join(self.__getResourcesDirectory(),"BDC-714.sauv") diff --git a/src/MEDLoader/Test/MEDLoaderTest.cxx b/src/MEDLoader/Test/MEDLoaderTest.cxx index 050bb6583..849fc2977 100644 --- a/src/MEDLoader/Test/MEDLoaderTest.cxx +++ b/src/MEDLoader/Test/MEDLoaderTest.cxx @@ -35,8 +35,8 @@ void MEDLoaderTest::testMesh1DRW() { MEDCouplingUMesh *mesh=build1DMesh_1(); mesh->checkCoherency(); - MEDLoader::WriteUMesh("file1.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file1.med",mesh->getName().c_str(),0); + WriteUMesh("file1.med",mesh,true); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file1.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -46,8 +46,8 @@ void MEDLoaderTest::testMesh2DCurveRW() { MEDCouplingUMesh *mesh=build2DCurveMesh_1(); mesh->checkCoherency(); - MEDLoader::WriteUMesh("file2.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file2.med",mesh->getName().c_str(),0); + WriteUMesh("file2.med",mesh,true); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file2.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -57,8 +57,8 @@ void MEDLoaderTest::testMesh2DRW() { MEDCouplingUMesh *mesh=build2DMesh_1(); mesh->checkCoherency(); - MEDLoader::WriteUMesh("file3.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file3.med",mesh->getName().c_str(),0); + WriteUMesh("file3.med",mesh,true); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file3.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -68,8 +68,8 @@ void MEDLoaderTest::testMesh3DSurfRW() { MEDCouplingUMesh *mesh=build3DSurfMesh_1(); mesh->checkCoherency(); - MEDLoader::WriteUMesh("file4.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file4.med",mesh->getName().c_str(),0); + WriteUMesh("file4.med",mesh,true); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file4.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -79,8 +79,8 @@ void MEDLoaderTest::testMesh3DRW() { MEDCouplingUMesh *mesh=build3DMesh_1(); mesh->checkCoherency(); - MEDLoader::WriteUMesh("file5.med",mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile("file5.med",mesh->getName().c_str(),0); + WriteUMesh("file5.med",mesh,true); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile("file5.med",mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -92,18 +92,18 @@ void MEDLoaderTest::testMesh3DRW() void MEDLoaderTest::testFieldRW1() { MEDCouplingFieldDouble *f1=buildVecFieldOnCells_1(); - MEDLoader::WriteField("file6.med",f1,true); - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell("file6.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + WriteField("file6.med",f1,true); + MEDCouplingFieldDouble *f2=ReadFieldCell("file6.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f1->decrRef(); f2->decrRef(); // f1=buildVecFieldOnNodes_1(); - MEDLoader::WriteField("file7.med",f1,true); - f2=MEDLoader::ReadFieldNode("file7.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3); + WriteField("file7.med",f1,true); + f2=ReadFieldNode("file7.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); // testing kind message on error of field type. - CPPUNIT_ASSERT_THROW(MEDLoader::ReadFieldCell("file7.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(ReadFieldCell("file7.med",f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3),INTERP_KERNEL::Exception); // f1->decrRef(); f2->decrRef(); @@ -118,55 +118,55 @@ void MEDLoaderTest::testFieldRW2() static const double VAL1=12345.67890314; static const double VAL2=-1111111111111.; MEDCouplingFieldDouble *f1=buildVecFieldOnCells_1(); - MEDLoader::WriteField(fileName,f1,true); + WriteField(fileName,f1,true); f1->setTime(10.,8,9); double *tmp=f1->getArray()->getPointer(); tmp[0]=VAL1; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->setTime(10.14,18,19); tmp[0]=VAL2; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); //retrieving time steps... - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),8,9); + MEDCouplingFieldDouble *f2=ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),8,9); f1->setTime(10.,8,9); tmp[0]=VAL1; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f2->decrRef(); - f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + f2=ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); MEDCouplingFieldDouble *f3=buildVecFieldOnCells_1(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); f2->decrRef(); - f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),18,19); + f2=ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),18,19); f1->setTime(10.14,18,19); tmp[0]=VAL2; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); //test of throw on invalid (dt,it) - CPPUNIT_ASSERT_THROW(MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),28,19),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),28,19),INTERP_KERNEL::Exception); f2->decrRef(); f1->decrRef(); //ON NODES f1=buildVecFieldOnNodes_1(); const char fileName2[]="file9.med"; - MEDLoader::WriteField(fileName2,f1,true); + WriteField(fileName2,f1,true); f1->setTime(110.,108,109); tmp=f1->getArray()->getPointer(); tmp[3]=VAL1; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); f1->setTime(210.,208,209); tmp[3]=VAL2; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); - f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),108,109); + WriteFieldUsingAlreadyWrittenMesh(fileName2,f1); + f2=ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),108,109); f1->setTime(110.,108,109); tmp[3]=VAL1; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f2->decrRef(); - f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3); + f2=ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,3); f3=buildVecFieldOnNodes_1(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); f2->decrRef(); - f2=MEDLoader::ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),208,209); + f2=ReadFieldNode(fileName2,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),208,209); f1->setTime(210.,208,209); tmp[3]=VAL2; CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); @@ -190,42 +190,42 @@ void MEDLoaderTest::testFieldRW3() f1->setTime(10.,8,9); double *tmp=f1->getArray()->getPointer(); tmp[0]=VAL1; - MEDLoader::WriteField(fileName,f1,true); + WriteField(fileName,f1,true); f1->setTime(10.14,18,19); tmp[0]=VAL2; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->setTime(10.55,28,29); tmp[0]=3*VAL1; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->setTime(10.66,38,39); tmp[0]=3*VAL2; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->setTime(10.77,48,49); tmp[0]=4*VAL2; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); //ON NODES f1->decrRef(); f1=buildVecFieldOnNodes_1(); f1->setName(name1); (const_cast(f1->getMesh()))->setName(name3); f1->setTime(110.,8,9); - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->setTime(110.,108,109); tmp=f1->getArray()->getPointer(); tmp[3]=VAL1; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->setTime(210.,208,209); tmp[3]=VAL2; - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); // - std::vector< std::pair > it1=MEDLoader::GetCellFieldIterations(fileName,name3,name1); + std::vector< std::pair > it1=GetCellFieldIterations(fileName,name3,name1); CPPUNIT_ASSERT_EQUAL(5,(int)it1.size()); CPPUNIT_ASSERT_EQUAL(8,it1[0].first); CPPUNIT_ASSERT_EQUAL(9,it1[0].second); CPPUNIT_ASSERT_EQUAL(18,it1[1].first); CPPUNIT_ASSERT_EQUAL(19,it1[1].second); CPPUNIT_ASSERT_EQUAL(28,it1[2].first); CPPUNIT_ASSERT_EQUAL(29,it1[2].second); CPPUNIT_ASSERT_EQUAL(38,it1[3].first); CPPUNIT_ASSERT_EQUAL(39,it1[3].second); CPPUNIT_ASSERT_EQUAL(48,it1[4].first); CPPUNIT_ASSERT_EQUAL(49,it1[4].second); - std::vector< std::pair > it3=MEDLoader::GetNodeFieldIterations(fileName,name3,name1); + std::vector< std::pair > it3=GetNodeFieldIterations(fileName,name3,name1); CPPUNIT_ASSERT_EQUAL(3,(int)it3.size()); CPPUNIT_ASSERT_EQUAL(8,it3[0].first); CPPUNIT_ASSERT_EQUAL(9,it3[0].second); CPPUNIT_ASSERT_EQUAL(108,it3[1].first); CPPUNIT_ASSERT_EQUAL(109,it3[1].second); @@ -233,29 +233,29 @@ void MEDLoaderTest::testFieldRW3() // f1->decrRef(); // - f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,8,9); + f1=ReadFieldCell(fileName,name3,0,name1,8,9); CPPUNIT_ASSERT_DOUBLES_EQUAL(VAL1,f1->getArray()->getConstPointer()[0],1e-13); f1->decrRef(); - f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,18,19); + f1=ReadFieldCell(fileName,name3,0,name1,18,19); CPPUNIT_ASSERT_DOUBLES_EQUAL(VAL2,f1->getArray()->getConstPointer()[0],1e-13); f1->decrRef(); - f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,28,29); + f1=ReadFieldCell(fileName,name3,0,name1,28,29); CPPUNIT_ASSERT_DOUBLES_EQUAL(3*VAL1,f1->getArray()->getConstPointer()[0],1e-13); f1->decrRef(); - f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,38,39); + f1=ReadFieldCell(fileName,name3,0,name1,38,39); CPPUNIT_ASSERT_DOUBLES_EQUAL(3*VAL2,f1->getArray()->getConstPointer()[0],1e-13); f1->decrRef(); - f1=MEDLoader::ReadFieldCell(fileName,name3,0,name1,48,49); + f1=ReadFieldCell(fileName,name3,0,name1,48,49); CPPUNIT_ASSERT_DOUBLES_EQUAL(4*VAL2,f1->getArray()->getConstPointer()[0],1e-13); f1->decrRef(); // - f1=MEDLoader::ReadFieldNode(fileName,name3,0,name1,8,9); + f1=ReadFieldNode(fileName,name3,0,name1,8,9); CPPUNIT_ASSERT_DOUBLES_EQUAL(71.,f1->getArray()->getConstPointer()[3],1e-13); f1->decrRef(); - f1=MEDLoader::ReadFieldNode(fileName,name3,0,name1,108,109); + f1=ReadFieldNode(fileName,name3,0,name1,108,109); CPPUNIT_ASSERT_DOUBLES_EQUAL(VAL1,f1->getArray()->getConstPointer()[3],1e-13); f1->decrRef(); - f1=MEDLoader::ReadFieldNode(fileName,name3,0,name1,208,209); + f1=ReadFieldNode(fileName,name3,0,name1,208,209); CPPUNIT_ASSERT_DOUBLES_EQUAL(VAL2,f1->getArray()->getConstPointer()[3],1e-13); f1->decrRef(); } @@ -284,9 +284,9 @@ void MEDLoaderTest::testMultiMeshRW1() meshes.push_back(mesh3); meshes.push_back(mesh4); const char mnane[]="3DToto"; - MEDLoader::WriteUMeshesPartition(fileName,mnane,meshes,true); + WriteUMeshesPartition(fileName,mnane,meshes,true); // - MEDCouplingUMesh *mesh5=MEDLoader::ReadUMeshFromFile(fileName,mnane); + MEDCouplingUMesh *mesh5=ReadUMeshFromFile(fileName,mnane); mesh1->setName(mnane); const int part3[18]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}; MEDCouplingUMesh *mesh6=(MEDCouplingUMesh *)mesh5->buildPartOfMySelf(part3,part3+18,true); @@ -294,7 +294,7 @@ void MEDLoaderTest::testMultiMeshRW1() mesh5->decrRef(); CPPUNIT_ASSERT(mesh6->isEqual(mesh1,1e-12)); mesh6->decrRef(); - std::vector grps=MEDLoader::GetMeshGroupsNames(fileName,mnane); + std::vector grps=GetMeshGroupsNames(fileName,mnane); CPPUNIT_ASSERT_EQUAL(4,(int)grps.size()); CPPUNIT_ASSERT(std::find(grps.begin(),grps.end(),std::string("mesh2"))!=grps.end()); CPPUNIT_ASSERT(std::find(grps.begin(),grps.end(),std::string("mesh3"))!=grps.end()); @@ -303,30 +303,30 @@ void MEDLoaderTest::testMultiMeshRW1() // std::vector vec; vec.push_back(std::string("mesh2")); - MEDCouplingUMesh *mesh2_2=MEDLoader::ReadUMeshFromGroups(fileName,mnane,0,vec); + MEDCouplingUMesh *mesh2_2=ReadUMeshFromGroups(fileName,mnane,0,vec); CPPUNIT_ASSERT(mesh2_2->isEqual(mesh2,1e-12)); mesh2_2->decrRef(); vec.clear(); vec.push_back(std::string("mesh3")); - MEDCouplingUMesh *mesh3_2=MEDLoader::ReadUMeshFromGroups(fileName,mnane,0,vec); + MEDCouplingUMesh *mesh3_2=ReadUMeshFromGroups(fileName,mnane,0,vec); CPPUNIT_ASSERT(mesh3_2->isEqual(mesh3,1e-12)); mesh3_2->decrRef(); vec.clear(); vec.push_back(std::string("mesh4")); - MEDCouplingUMesh *mesh4_2=MEDLoader::ReadUMeshFromGroups(fileName,mnane,0,vec); + MEDCouplingUMesh *mesh4_2=ReadUMeshFromGroups(fileName,mnane,0,vec); CPPUNIT_ASSERT(mesh4_2->isEqual(mesh4,1e-12)); mesh4_2->decrRef(); vec.clear(); vec.push_back(std::string("3DMesh_1")); - MEDCouplingUMesh *mesh1_2=MEDLoader::ReadUMeshFromGroups(fileName,mnane,0,vec); + MEDCouplingUMesh *mesh1_2=ReadUMeshFromGroups(fileName,mnane,0,vec); mesh1->setName("3DMesh_1"); CPPUNIT_ASSERT(mesh1_2->isEqual(mesh1,1e-12)); mesh1_2->decrRef(); // vec.clear(); vec.push_back(std::string("Family_-3")); vec.push_back(std::string("Family_-5")); - mesh2_2=MEDLoader::ReadUMeshFromFamilies(fileName,mnane,0,vec); + mesh2_2=ReadUMeshFromFamilies(fileName,mnane,0,vec); mesh2_2->setName("mesh2"); CPPUNIT_ASSERT(mesh2_2->isEqual(mesh2,1e-12)); mesh2_2->decrRef(); // - std::vector ret(MEDLoader::GetMeshFamiliesNamesOnGroup(fileName,"3DToto","3DMesh_1")); + std::vector ret(GetMeshFamiliesNamesOnGroup(fileName,"3DToto","3DMesh_1")); std::set s(ret.begin(),ret.end()); std::set ref_s; ref_s.insert("Family_-2"); @@ -336,7 +336,7 @@ void MEDLoaderTest::testMultiMeshRW1() CPPUNIT_ASSERT_EQUAL(4,(int)ret.size()); CPPUNIT_ASSERT(s==ref_s); // - std::vector ret1=MEDLoader::GetMeshGroupsNamesOnFamily(fileName,"3DToto","Family_-3"); + std::vector ret1=GetMeshGroupsNamesOnFamily(fileName,"3DToto","Family_-3"); CPPUNIT_ASSERT_EQUAL(2,(int)ret1.size()); CPPUNIT_ASSERT(ret1[0]=="3DMesh_1"); CPPUNIT_ASSERT(ret1[1]=="mesh2"); @@ -355,7 +355,7 @@ void MEDLoaderTest::testFieldProfilRW1() int newNbOfNodes; DataArrayInt *da=mesh1->mergeNodes(1e-12,b,newNbOfNodes); da->decrRef(); - MEDLoader::WriteUMesh(fileName,mesh1,true); + WriteUMesh(fileName,mesh1,true); const int part1[5]={1,2,4,13,15}; MEDCouplingUMesh *mesh2=(MEDCouplingUMesh *)mesh1->buildPartOfMySelf(part1,part1+5,true); mesh2->setName(mesh1->getName().c_str());//<- important for the test @@ -375,10 +375,10 @@ void MEDLoaderTest::testFieldProfilRW1() f1->setTime(3.14,2,7); f1->checkCoherency(); // - MEDLoader::WriteField(fileName,f1,false);//<- false important for the test + WriteField(fileName,f1,false);//<- false important for the test // - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); - std::vector types=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); + MEDCouplingFieldDouble *f2=ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); + std::vector types=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)types.size()); CPPUNIT_ASSERT(types[0]==ON_CELLS); f2->checkCoherency(); @@ -399,7 +399,7 @@ void MEDLoaderTest::testFieldNodeProfilRW1() const char fileName2[]="file20.med"; MEDCouplingUMesh *m=build2DMesh_1(); int nbOfNodes=m->getNumberOfNodes(); - MEDLoader::WriteUMesh(fileName,m,true); + WriteUMesh(fileName,m,true); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VFieldOnNodes"); f1->setMesh(m); @@ -416,18 +416,18 @@ void MEDLoaderTest::testFieldNodeProfilRW1() const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7 MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2); (const_cast(f2->getMesh()))->setName(f1->getMesh()->getName().c_str()); - MEDLoader::WriteField(fileName,f2,false);//<- false important for the test + WriteField(fileName,f2,false);//<- false important for the test // - MEDCouplingFieldDouble *f3=MEDLoader::ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7); + MEDCouplingFieldDouble *f3=ReadFieldNode(fileName,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7); f3->checkCoherency(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); // const int arr3[6]={1,3,0,5,2,4}; f2->renumberNodes(arr3); - MEDLoader::WriteUMesh(fileName2,m,true); - MEDLoader::WriteField(fileName2,f2,false);//<- false important for the test - f3=MEDLoader::ReadFieldNode(fileName2,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7); + WriteUMesh(fileName2,m,true); + WriteField(fileName2,f2,false);//<- false important for the test + f3=ReadFieldNode(fileName2,f2->getMesh()->getName().c_str(),0,f2->getName().c_str(),2,7); f3->checkCoherency(); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); @@ -441,7 +441,7 @@ void MEDLoaderTest::testFieldNodeProfilRW2() { const char fileName[]="file23.med"; MEDCouplingUMesh *mesh=build3DSurfMesh_1(); - MEDLoader::WriteUMesh(fileName,mesh,true); + WriteUMesh(fileName,mesh,true); // MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("FieldMix"); @@ -463,8 +463,8 @@ void MEDLoaderTest::testFieldNodeProfilRW2() const int renumArr[12]={3,7,2,1,5,11,10,0,9,6,8,4}; f1->renumberNodes(renumArr); f1->checkCoherency(); - MEDLoader::WriteField(fileName,f1,false);//<- false important for the test - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); + WriteField(fileName,f1,false);//<- false important for the test + MEDCouplingFieldDouble *f2=ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); // f2->decrRef(); @@ -476,8 +476,8 @@ void MEDLoaderTest::testFieldGaussRW1() { const char fileName[]="file13.med"; MEDCouplingFieldDouble *f1=buildVecFieldOnGauss_1(); - MEDLoader::WriteField(fileName,f1,true); - MEDCouplingFieldDouble *f2=MEDLoader::ReadField(ON_GAUSS_PT,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5); + WriteField(fileName,f1,true); + MEDCouplingFieldDouble *f2=ReadField(ON_GAUSS_PT,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f2->decrRef(); f1->decrRef(); @@ -487,11 +487,11 @@ void MEDLoaderTest::testFieldGaussNERW1() { const char fileName[]="file14.med"; MEDCouplingFieldDouble *f1=buildVecFieldOnGaussNE_1(); - MEDLoader::WriteField(fileName,f1,true); - std::vector tof(MEDLoader::GetTypesOfField(fileName,"2DMesh_2","MyFieldOnGaussNE")); + WriteField(fileName,f1,true); + std::vector tof(GetTypesOfField(fileName,"2DMesh_2","MyFieldOnGaussNE")); CPPUNIT_ASSERT_EQUAL(1,(int)tof.size()); CPPUNIT_ASSERT(ON_GAUSS_NE==tof[0]); - MEDCouplingFieldDouble *f2=MEDLoader::ReadField(ON_GAUSS_NE,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5); + MEDCouplingFieldDouble *f2=ReadField(ON_GAUSS_NE,fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),1,5); CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); f2->decrRef(); f1->decrRef(); @@ -535,8 +535,8 @@ void MEDLoaderTest::testMesh3DSurfShuffleRW() const int renumber1[6]={2,5,1,0,3,4}; mesh->renumberCells(renumber1,false); mesh->checkCoherency(); - MEDLoader::WriteUMesh(fileName,mesh,true); - MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(fileName,mesh->getName().c_str(),0); + WriteUMesh(fileName,mesh,true); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(fileName,mesh->getName().c_str(),0); CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); mesh->decrRef(); @@ -561,8 +561,8 @@ void MEDLoaderTest::testFieldShuffleRW1() // const int renumber1[6]={2,1,5,0,3,4}; f1->renumberCells(renumber1,false); - MEDLoader::WriteField(fileName,f1,true); - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7); + WriteField(fileName,f1,true); + MEDCouplingFieldDouble *f2=ReadFieldCell(fileName,mesh->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); f2->decrRef(); // @@ -586,28 +586,28 @@ void MEDLoaderTest::testMultiFieldShuffleRW1() m->renumberCells(renum,false); m->orientCorrectlyPolyhedrons(); // Writing - MEDLoader::WriteUMesh(fileName,m,true); + WriteUMesh(fileName,m,true); MEDCouplingFieldDouble *f1Tmp=m->getMeasureField(false); MEDCouplingFieldDouble *f1=f1Tmp->buildNewTimeReprFromThis(ONE_TIME,false); f1Tmp->decrRef(); f1->setTime(0.,1,2); MEDCouplingFieldDouble *f_1=f1->cloneWithMesh(true); - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->applyFunc("2*x"); f1->setTime(0.01,3,4); MEDCouplingFieldDouble *f_2=f1->cloneWithMesh(true); - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->applyFunc("2*x/3"); f1->setTime(0.02,5,6); MEDCouplingFieldDouble *f_3=f1->cloneWithMesh(true); - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->decrRef(); // Reading std::vector > its; its.push_back(std::pair(1,2)); its.push_back(std::pair(3,4)); its.push_back(std::pair(5,6)); - std::vector fs=MEDLoader::ReadFieldsOnSameMesh(ON_CELLS,fileName,f_1->getMesh()->getName().c_str(),0,f_1->getName().c_str(),its); + std::vector fs=ReadFieldsOnSameMesh(ON_CELLS,fileName,f_1->getMesh()->getName().c_str(),0,f_1->getName().c_str(),its); CPPUNIT_ASSERT_EQUAL(3,(int)fs.size()); const MEDCouplingMesh *mm=fs[0]->getMesh(); CPPUNIT_ASSERT(fs[0]->isEqual(f_1,1e-12,1e-12)); @@ -640,12 +640,12 @@ void MEDLoaderTest::testWriteUMeshesRW1() std::vector meshes; meshes.push_back(m2d); meshes.push_back(m3d); - MEDLoader::WriteUMeshes(fileName,meshes,true); - MEDCouplingUMesh *m3d_bis=MEDLoader::ReadUMeshFromFile(fileName,m2d->getName().c_str(),0); + WriteUMeshes(fileName,meshes,true); + MEDCouplingUMesh *m3d_bis=ReadUMeshFromFile(fileName,m2d->getName().c_str(),0); CPPUNIT_ASSERT(!m3d_bis->isEqual(m3d,1e-12)); m3d_bis->setName(m3d->getName().c_str()); CPPUNIT_ASSERT(m3d_bis->isEqual(m3d,1e-12)); - MEDCouplingUMesh *m2d_bis=MEDLoader::ReadUMeshFromFile(fileName,m2d->getName().c_str(),-1);//-1 for faces + MEDCouplingUMesh *m2d_bis=ReadUMeshFromFile(fileName,m2d->getName().c_str(),-1);//-1 for faces CPPUNIT_ASSERT(m2d_bis->isEqual(m2d,1e-12)); // Creation of a field on faces. MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); @@ -662,8 +662,8 @@ void MEDLoaderTest::testWriteUMeshesRW1() std::copy(arr1,arr1+10,tmp); f1->setTime(3.14,2,7); f1->checkCoherency(); - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); - MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + MEDCouplingFieldDouble *f2=ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),-1,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f2->isEqual(f1,1e-12,1e-12)); f1->decrRef(); f2->decrRef(); @@ -711,27 +711,27 @@ void MEDLoaderTest::testMixCellAndNodesFieldRW1() f2->setTime(3.14,2,7); f2->checkCoherency(); // - MEDLoader::WriteField(fileName,f1,true); - std::vector ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); + WriteField(fileName,f1,true); + std::vector ts=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)ts.size()); CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[0]); - std::vector fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName().c_str()); + std::vector fs=GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)fs.size()); CPPUNIT_ASSERT(fs[0]=="FieldMix"); - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f2); - fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName().c_str()); + WriteFieldUsingAlreadyWrittenMesh(fileName,f2); + fs=GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName().c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)fs.size()); CPPUNIT_ASSERT(fs[0]=="FieldMix"); // - ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); + ts=GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str()); CPPUNIT_ASSERT_EQUAL(2,(int)ts.size()); CPPUNIT_ASSERT_EQUAL(ON_NODES,ts[0]); CPPUNIT_ASSERT_EQUAL(ON_CELLS,ts[1]); // - MEDCouplingFieldDouble *f3=MEDLoader::ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); + MEDCouplingFieldDouble *f3=ReadFieldNode(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f3->isEqual(f2,1e-12,1e-12)); f3->decrRef(); - f3=MEDLoader::ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); + f3=ReadFieldCell(fileName,f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),2,7); CPPUNIT_ASSERT(f3->isEqual(f1,1e-12,1e-12)); f3->decrRef(); // @@ -749,24 +749,24 @@ void MEDLoaderTest::testGetAllFieldNamesRW1() f1->setTime(3.44,5,6); f1->setMesh(mesh); f1->fillFromAnalytic(2,"x+y"); - MEDLoader::WriteField(fileName,f1,true); + WriteField(fileName,f1,true); f1->setTime(1002.3,7,8); f1->fillFromAnalytic(2,"x+77.*y"); - MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1); + WriteFieldUsingAlreadyWrittenMesh(fileName,f1); f1->setName("Field2"); - MEDLoader::WriteField(fileName,f1,false); + WriteField(fileName,f1,false); f1->setName("Field3"); mesh->setName("2DMesh_2Bis"); - MEDLoader::WriteField(fileName,f1,false); + WriteField(fileName,f1,false); f1->decrRef(); f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("Field8"); f1->setTime(8.99,7,9); f1->setMesh(mesh); f1->fillFromAnalytic(3,"3*x+y"); - MEDLoader::WriteField(fileName,f1,false); + WriteField(fileName,f1,false); f1->decrRef(); - std::vector fs=MEDLoader::GetAllFieldNames(fileName); + std::vector fs=GetAllFieldNames(fileName); CPPUNIT_ASSERT_EQUAL(4,(int)fs.size()); CPPUNIT_ASSERT(fs[0]=="Field1"); CPPUNIT_ASSERT(fs[1]=="Field2"); @@ -782,9 +782,9 @@ void MEDLoaderTest::testMEDLoaderRead1() using namespace INTERP_KERNEL; string fileName= INTERP_TEST::getResourceFile("pointe.med", 3); - vector meshNames=MEDLoader::GetMeshNames(fileName.c_str()); + vector meshNames=GetMeshNames(fileName.c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size()); - MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); + MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(16,mesh->getNumberOfCells()); @@ -802,13 +802,13 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); mesh->decrRef(); // - vector families=MEDLoader::GetMeshFamiliesNames(fileName.c_str(),meshNames[0].c_str()); + vector families=GetMeshFamiliesNames(fileName.c_str(),meshNames[0].c_str()); CPPUNIT_ASSERT_EQUAL(8,(int)families.size()); CPPUNIT_ASSERT(families[2]=="FAMILLE_ELEMENT_3"); // vector families2; families2.push_back(families[2]); - mesh=MEDLoader::ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),0,families2); + mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),0,families2); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getNumberOfCells()); @@ -822,7 +822,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); mesh->decrRef(); // - vector groups=MEDLoader::GetMeshGroupsNames(fileName.c_str(),meshNames[0].c_str()); + vector groups=GetMeshGroupsNames(fileName.c_str(),meshNames[0].c_str()); CPPUNIT_ASSERT_EQUAL(5,(int)groups.size()); CPPUNIT_ASSERT(groups[0]=="groupe1"); CPPUNIT_ASSERT(groups[1]=="groupe2"); @@ -831,7 +831,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT(groups[4]=="groupe5"); vector groups2; groups2.push_back(groups[0]); - mesh=MEDLoader::ReadUMeshFromGroups(fileName.c_str(),meshNames[0].c_str(),0,groups2); + mesh=ReadUMeshFromGroups(fileName.c_str(),meshNames[0].c_str(),0,groups2); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); CPPUNIT_ASSERT_EQUAL(7,mesh->getNumberOfCells()); @@ -846,20 +846,20 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12); mesh->decrRef(); // - std::vector fieldsName=MEDLoader::GetCellFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str()); + std::vector fieldsName=GetCellFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str()); CPPUNIT_ASSERT_EQUAL(2,(int)fieldsName.size()); CPPUNIT_ASSERT(fieldsName[0]=="fieldcelldoublescalar"); CPPUNIT_ASSERT(fieldsName[1]=="fieldcelldoublevector"); - std::vector > its0=MEDLoader::GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str()); + std::vector > its0=GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)its0.size()); CPPUNIT_ASSERT_EQUAL(-1,its0[0].first); CPPUNIT_ASSERT_EQUAL(-1,its0[0].second); - std::vector > its1=MEDLoader::GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[1].c_str()); + std::vector > its1=GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[1].c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)its1.size()); CPPUNIT_ASSERT_EQUAL(-1,its1[0].first); CPPUNIT_ASSERT_EQUAL(-1,its1[0].second); // - MEDCouplingFieldDouble *field0=MEDLoader::ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second); + MEDCouplingFieldDouble *field0=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second); field0->checkCoherency(); CPPUNIT_ASSERT(field0->getName()==fieldsName[0]); CPPUNIT_ASSERT_EQUAL(1,field0->getNumberOfComponents()); @@ -888,7 +888,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); field0->decrRef(); // - MEDCouplingFieldDouble *field1=MEDLoader::ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[1].c_str(),its1[0].first,its1[0].second); + MEDCouplingFieldDouble *field1=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[1].c_str(),its1[0].first,its1[0].second); field1->checkCoherency(); CPPUNIT_ASSERT(field1->getName()==fieldsName[1]); CPPUNIT_ASSERT_EQUAL(3,field1->getNumberOfComponents()); @@ -917,11 +917,11 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); field1->decrRef(); //fields on nodes - std::vector fieldsNameNode=MEDLoader::GetNodeFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str()); + std::vector fieldsNameNode=GetNodeFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str()); CPPUNIT_ASSERT_EQUAL(2,(int)fieldsNameNode.size()); CPPUNIT_ASSERT(fieldsNameNode[0]=="fieldnodedouble"); CPPUNIT_ASSERT(fieldsNameNode[1]=="fieldnodeint"); - std::vector > its0Node=MEDLoader::GetNodeFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsNameNode[0].c_str()); + std::vector > its0Node=GetNodeFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsNameNode[0].c_str()); CPPUNIT_ASSERT_EQUAL(3,(int)its0Node.size()); CPPUNIT_ASSERT_EQUAL(-1,its0Node[0].first); CPPUNIT_ASSERT_EQUAL(-1,its0Node[0].second); @@ -929,7 +929,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_EQUAL(-1,its0Node[1].second); CPPUNIT_ASSERT_EQUAL(2,its0Node[2].first); CPPUNIT_ASSERT_EQUAL(-1,its0Node[2].second); - MEDCouplingFieldDouble *field0Nodes=MEDLoader::ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second); + MEDCouplingFieldDouble *field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second); field0Nodes->checkCoherency(); CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]); CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents()); @@ -943,7 +943,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT(constMesh); field0Nodes->decrRef(); // - field0Nodes=MEDLoader::ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[2].first,its0Node[2].second); + field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[2].first,its0Node[2].second); field0Nodes->checkCoherency(); CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]); CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents()); @@ -971,7 +971,7 @@ void MEDLoaderTest::testMEDLoaderRead1() CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12); field0Nodes->decrRef(); // - field0Nodes=MEDLoader::ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second); + field0Nodes=ReadFieldNode(fileName.c_str(),meshNames[0].c_str(),0,fieldsNameNode[0].c_str(),its0Node[0].first,its0Node[0].second); field0Nodes->checkCoherency(); CPPUNIT_ASSERT(field0Nodes->getName()==fieldsNameNode[0]); CPPUNIT_ASSERT_EQUAL(1,field0Nodes->getNumberOfComponents()); @@ -1006,10 +1006,10 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() using namespace INTERP_KERNEL; string fileName=INTERP_TEST::getResourceFile("polygones.med", 3); - vector meshNames=MEDLoader::GetMeshNames(fileName.c_str()); + vector meshNames=GetMeshNames(fileName.c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size()); CPPUNIT_ASSERT(meshNames[0]=="Bord"); - MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); + MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); mesh->checkCoherency(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); @@ -1031,14 +1031,14 @@ void MEDLoaderTest::testMEDLoaderPolygonRead() CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+539,0)); mesh->decrRef(); // - std::vector fieldsName=MEDLoader::GetCellFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str()); + std::vector fieldsName=GetCellFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str()); CPPUNIT_ASSERT_EQUAL(3,(int)fieldsName.size()); CPPUNIT_ASSERT(fieldsName[0]=="bord_:_distorsion"); CPPUNIT_ASSERT(fieldsName[1]=="bord_:_familles"); CPPUNIT_ASSERT(fieldsName[2]=="bord_:_non-ortho"); - std::vector > its0=MEDLoader::GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str()); + std::vector > its0=GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)its0.size()); - MEDCouplingFieldDouble *field=MEDLoader::ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second); + MEDCouplingFieldDouble *field=ReadFieldCell(fileName.c_str(),meshNames[0].c_str(),0,fieldsName[0].c_str(),its0[0].first,its0[0].second); field->checkCoherency(); CPPUNIT_ASSERT(field->getName()==fieldsName[0]); CPPUNIT_ASSERT_EQUAL(1,field->getNumberOfComponents()); @@ -1072,10 +1072,10 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() using namespace INTERP_KERNEL; string fileName=INTERP_TEST::getResourceFile("poly3D.med", 3); - vector meshNames=MEDLoader::GetMeshNames(fileName.c_str()); + vector meshNames=GetMeshNames(fileName.c_str()); CPPUNIT_ASSERT_EQUAL(1,(int)meshNames.size()); CPPUNIT_ASSERT(meshNames[0]=="poly3D"); - MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); + MEDCouplingUMesh *mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),0); mesh->checkCoherency(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(3,mesh->getMeshDimension()); @@ -1091,7 +1091,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(155,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+4,0)); mesh->decrRef(); // - mesh=MEDLoader::ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),-1); + mesh=ReadUMeshFromFile(fileName.c_str(),meshNames[0].c_str(),-1); mesh->checkCoherency(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); @@ -1120,7 +1120,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(619,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+83,0)); mesh->decrRef(); // - vector families=MEDLoader::GetMeshFamiliesNames(fileName.c_str(),meshNames[0].c_str()); + vector families=GetMeshFamiliesNames(fileName.c_str(),meshNames[0].c_str()); CPPUNIT_ASSERT_EQUAL(4,(int)families.size()); CPPUNIT_ASSERT(families[0]=="FAMILLE_FACE_POLYGONS3"); CPPUNIT_ASSERT(families[1]=="FAMILLE_FACE_QUAD41"); @@ -1128,7 +1128,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT(families[3]=="FAMILLE_ZERO"); vector families2; families2.push_back(families[0]); - mesh=MEDLoader::ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),-1,families2); + mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),-1,families2); mesh->checkCoherency(); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(2,mesh->getMeshDimension()); @@ -1141,7 +1141,7 @@ void MEDLoaderTest::testMEDLoaderPolyhedronRead() CPPUNIT_ASSERT_EQUAL(117,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+19,0)); mesh->decrRef(); // - mesh=MEDLoader::ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),0,families2); + mesh=ReadUMeshFromFamilies(fileName.c_str(),meshNames[0].c_str(),0,families2); CPPUNIT_ASSERT_EQUAL(3,mesh->getSpaceDimension()); CPPUNIT_ASSERT_EQUAL(0,mesh->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(19,mesh->getNumberOfNodes()); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index ebf0ecceb..e2f4487bf 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -1605,7 +1605,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, Para \n \ \n \ \n"; - std::vector meshNames=MEDLoader::GetMeshNames(myfile); + std::vector meshNames=GetMeshNames(myfile); xml.replace(xml.find("$fileName"),9,myfile); xml.replace(xml.find("$meshName"),9,meshNames[0]); xml.replace(xml.find("$meshName"),9,meshNames[0]); @@ -2252,7 +2252,7 @@ void MEDPARTITIONER::MeshCollection::setDomainNames(const std::string& name) MEDCoupling::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::string descriptionField, int iold) //getField look for and read it if not done, and assume decrRef() in ~MeshCollection; -//something like MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name,f1->getMesh()->getName(),0,f1->getName(),0,1); +//something like MEDCouplingFieldDouble *f2=ReadFieldCell(name,f1->getMesh()->getName(),0,f1->getName(),0,1); { int rank=MyGlobals::_Rank; std::string tag="ioldFieldDouble="+IntToStr(iold); @@ -2274,8 +2274,8 @@ MEDCoupling::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::stri FieldShortDescriptionToData(descriptionIold, fieldName, typeField, entity, DT, IT); meshName=MyGlobals::_Mesh_Names[iold]; - MEDCoupling::MEDCouplingFieldDouble* f2=MEDLoader::ReadField((MEDCoupling::TypeOfField) typeField, - fileName, meshName, 0, fieldName, DT, IT); + MEDCoupling::MEDCouplingFieldDouble* f2=ReadField((MEDCoupling::TypeOfField) typeField, + fileName, meshName, 0, fieldName, DT, IT); MEDCoupling::DataArrayDouble* res=f2->getArray(); //to know names of components diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx index 7f1b1fffe..516deff4e 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx @@ -243,7 +243,7 @@ MEDCoupling::MEDFileMesh* MeshCollectionDriver::getMesh(int idomain) const // if (boundaryMesh!=0) // { // //doing that testMesh becomes second mesh sorted by alphabetical order of name - // MEDLoader::WriteUMesh(distfilename, boundaryMesh, false); + // WriteUMesh(distfilename, boundaryMesh, false); // boundaryMesh->decrRef(); // } @@ -403,7 +403,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile nbfFieldFound++; try { - MEDLoader::WriteField(distfilename,field,false); + WriteField(distfilename,field,false); } catch(INTERP_KERNEL::Exception& e) { @@ -413,8 +413,8 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile fieldName=field->getName(); tmp+="_"+fieldName+"_"+IntToStr(nbfFieldFound)+".med"; newName.replace(newName.find(".med"),4,tmp); - std::cout << "WARNING : writeMedFile : create a new file name with only one field because MEDLoader::WriteField throw:" << newName << std::endl; - MEDLoader::WriteField(newName,field,true); + std::cout << "WARNING : writeMedFile : create a new file name with only one field because WriteField throw:" << newName << std::endl; + WriteField(newName,field,true); } } mfm->decrRef(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx index 48144dc76..c67d6b968 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx @@ -183,7 +183,7 @@ void MeshCollectionMedAsciiDriver::write(const char* filename, ParaDomainSelecto if ( !domainSelector || domainSelector->isMyDomain( idomain ) ) { if ( !_collection->getMesh()[idomain]->getNumberOfCells()==0 ) continue;//empty domain - MEDLoader::WriteUMesh(distfilename.c_str(),(_collection->getMesh())[idomain],true); + WriteUMesh(distfilename.c_str(),(_collection->getMesh())[idomain],true); //writeSubdomain(idomain, nbdomains, distfilename.c_str(), domainSelector); } } diff --git a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx index d1688a444..51543f52f 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Utils.cxx @@ -560,20 +560,20 @@ std::vector MEDPARTITIONER::BrowseFieldDouble(const MEDCoupling::ME std::vector MEDPARTITIONER::BrowseAllFields(const std::string& myfile) { std::vector res; - std::vector meshNames=MEDLoader::GetMeshNames(myfile); + std::vector meshNames=MEDCoupling::GetMeshNames(myfile); for (std::size_t i=0; i fieldNames= - MEDLoader::GetAllFieldNamesOnMesh(myfile,meshNames[i]); + MEDCoupling::GetAllFieldNamesOnMesh(myfile,meshNames[i]); for (std::size_t j = 0; j < fieldNames.size(); j++) { std::vector< MEDCoupling::TypeOfField > typeFields= - MEDLoader::GetTypesOfField(myfile, meshNames[i], fieldNames[j]); + MEDCoupling::GetTypesOfField(myfile, meshNames[i], fieldNames[j]); for (std::size_t k = 0; k < typeFields.size(); k++) { std::vector< std::pair< int, int > > its= - MEDLoader::GetFieldIterations(typeFields[k], myfile, meshNames[i], fieldNames[j]); + GetFieldIterations(typeFields[k], myfile, meshNames[i], fieldNames[j]); if (MyGlobals::_Is0verbose>100) std::cout<< "fieldName " << fieldNames[j] << " typeField " << typeFields[k] << " its.size() " << its.size() << std::endl; for (std::size_t m = 0; m < its.size(); m++) diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index 145867be8..c6d95a674 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -388,7 +388,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnCells(string myfileN field.push_back(k+.3); } - MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0); + MEDCouplingUMesh *mesh=ReadUMeshFromFile(myfileName.c_str(),_mesh_name.c_str(),0); int nbOfCells=mesh->getNumberOfCells(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME); f1->setName("VectorFieldOnCells"); @@ -421,7 +421,7 @@ MEDCouplingFieldDouble * MEDPARTITIONERTest::buildVecFieldOnNodes() field.push_back(k+.3); } - MEDCouplingUMesh *mesh=MEDLoader::ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0); + MEDCouplingUMesh *mesh=ReadUMeshFromFile(_file_name.c_str(),_mesh_name.c_str(),0); int nbOfNodes=mesh->getNumberOfNodes(); MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_NODES,ONE_TIME); f1->setName("VectorFieldOnNodes"); @@ -446,11 +446,11 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() { { MEDCouplingUMesh * mesh = buildCUBE3DMesh(); - MEDLoader::WriteUMesh(_file_name.c_str(),mesh,true); + WriteUMesh(_file_name.c_str(),mesh,true); if (_verbose) cout<getName().c_str(),0); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(_file_name.c_str(),mesh->getName().c_str(),0); if (_verbose) cout<<_file_name<<" reread"<isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); @@ -469,7 +469,7 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() mesh1->checkCoherency(); meshes.push_back(mesh1); meshes.push_back(mesh2); - MEDLoader::WriteUMeshes(_file_name_with_faces.c_str(), meshes, true); + WriteUMeshes(_file_name_with_faces.c_str(), meshes, true); MEDCoupling::MEDFileUMesh* mfm=MEDCoupling::MEDFileUMesh::New(_file_name_with_faces.c_str(), mesh1->getName().c_str()); DataArrayInt* FacesFam=DataArrayInt::New(); @@ -504,7 +504,7 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() if (_verbose) cout<getName().c_str(),0); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(_file_name_with_faces.c_str(),mesh1->getName().c_str(),0); if (_verbose) cout<<_file_name_with_faces<<" reread"<isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); @@ -516,9 +516,9 @@ void MEDPARTITIONERTest::createTestMeshWithoutField() { MEDCouplingUMesh * mesh = buildCARRE3DMesh(); - MEDLoader::WriteUMesh(_file_name2.c_str(),mesh,true); + WriteUMesh(_file_name2.c_str(),mesh,true); if (_verbose) cout<getName().c_str(),0); + MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(_file_name2.c_str(),mesh->getName().c_str(),0); if (_verbose) cout<<_file_name2<<" reread"<isEqual(mesh_rw,1e-12)); mesh_rw->decrRef(); @@ -604,7 +604,7 @@ void MEDPARTITIONERTest::createHugeTestMesh(int ni, int nj, int nk, int nbx, int *ptr=(*ptrini)+dz; ptr++; ptrini++; } - MEDLoader::WriteUMesh(fileName.c_str(),mesh,true); + WriteUMesh(fileName.c_str(),mesh,true); tagSubfiles+=tagSubfile; tagSubfiles.replace(tagSubfiles.find("$xyz"),4,sxyz); @@ -642,14 +642,14 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() string name=_file_name; MEDCouplingFieldDouble *f1=buildVecFieldOnCells(name); name.replace(name.find(".med"),4,"_WithVecFieldOnCells.med"); - MEDLoader::WriteField(name.c_str(),f1,true); + WriteField(name.c_str(),f1,true); f1->setTime(3.,1,1); //time,it,order f1->applyFunc("x/2."); - MEDLoader::WriteField(name.c_str(),f1,false); + WriteField(name.c_str(),f1,false); if (_verbose) cout<getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + MEDCouplingFieldDouble *f2=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); //DataArrayDouble *res=f2->getArray(); if (_verbose) cout<isEqual(f2,1e-12,1e-12)); @@ -701,14 +701,13 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() f3->setTime(4.,5,6); f3->setArray(array); array->decrRef(); - MEDLoader::WriteField(name.c_str(),f3,true); + WriteField(name.c_str(),f3,true); if (_verbose) cout<checkCoherency(); f1->decrRef(); if (_ntot<1000000) //too long { - MEDCouplingFieldDouble* f4=MEDLoader::ReadField(ON_GAUSS_NE, - name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6); + MEDCouplingFieldDouble* f4=ReadField(ON_GAUSS_NE, name.c_str(), f3->getMesh()->getName().c_str(), 0, "MyFieldOnGaussNE", 5, 6); if (_verbose) cout<<"MyFieldOnGaussNE reread"<decrRef(); } @@ -718,11 +717,11 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnCells() string name=_file_name_with_faces; MEDCouplingFieldDouble *f1=buildVecFieldOnCells(name); name.replace(name.find(".med"),4,"_WithVecFieldOnCells.med"); - MEDLoader::WriteField(name.c_str(),f1,true); + WriteField(name.c_str(),f1,true); if (_verbose) cout<getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + MEDCouplingFieldDouble *f2=ReadFieldCell(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); if (_verbose) cout<isEqual(f2,1e-12,1e-12)); assertion failed!! f2->decrRef(); @@ -736,11 +735,11 @@ void MEDPARTITIONERTest::createTestMeshWithVecFieldOnNodes() MEDCouplingFieldDouble *f1=buildVecFieldOnNodes(); string name=_file_name; name.replace(name.find(".med"),4,"_WithVecFieldOnNodes.med"); - MEDLoader::WriteField(name.c_str(),f1,true); + WriteField(name.c_str(),f1,true); if (_verbose) cout<getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); + MEDCouplingFieldDouble *f2=ReadFieldNode(name.c_str(),f1->getMesh()->getName().c_str(),0,f1->getName().c_str(),0,1); if (_verbose) cout<isEqual(f2,1e-12,1e-12)); assertion failed!! f2->decrRef(); @@ -752,7 +751,7 @@ void MEDPARTITIONERTest::verifyTestMeshWithVecFieldOnNodes() { string name=_file_name; name.replace(name.find(".med"),4,"_WithVecFieldOnNodes.med"); - MEDCouplingUMesh * m=MEDLoader::ReadUMeshFromFile(name.c_str(),_mesh_name.c_str(),0); + MEDCouplingUMesh * m=ReadUMeshFromFile(name.c_str(),_mesh_name.c_str(),0); std::set types(m->getAllGeoTypes()); if (_verbose) { @@ -1184,8 +1183,8 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnC MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - MEDCouplingFieldDouble* field1=MEDLoader::ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); - MEDCouplingFieldDouble* field2=MEDLoader::ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); + MEDCouplingFieldDouble* field1=ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); + MEDCouplingFieldDouble* field2=ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); int nbcells=corr[1]->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); @@ -1273,8 +1272,8 @@ void MEDPARTITIONERTest::verifyMetisOrScotchMedpartitionerOnSmallSizeForFieldOnG MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - MEDCouplingFieldDouble* field1=MEDLoader::ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); - MEDCouplingFieldDouble* field2=MEDLoader::ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); + MEDCouplingFieldDouble* field1=ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); + MEDCouplingFieldDouble* field2=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); int nbcells=corr[1]->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx index e66b26c49..6fe8f1d37 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx @@ -212,8 +212,8 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - MEDCouplingFieldDouble* field1=MEDLoader::ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); - MEDCouplingFieldDouble* field2=MEDLoader::ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); + MEDCouplingFieldDouble* field1=ReadFieldCell(fileName.c_str(),initialMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); + MEDCouplingFieldDouble* field2=ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"VectorFieldOnCells",0,1); int nbcells=corr[1]->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); @@ -299,8 +299,8 @@ void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - MEDCouplingFieldDouble* field1=MEDLoader::ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); - MEDCouplingFieldDouble* field2=MEDLoader::ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); + MEDCouplingFieldDouble* field1=ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); + MEDCouplingFieldDouble* field2=ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName().c_str(),0,"MyFieldOnGaussNE",5,6); int nbcells=corr[1]->getNumberOfTuples(); CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); diff --git a/src/ParaMEDLoader/ParaMEDFileMesh.cxx b/src/ParaMEDLoader/ParaMEDFileMesh.cxx index 947d9f2e0..6851b764b 100644 --- a/src/ParaMEDLoader/ParaMEDFileMesh.cxx +++ b/src/ParaMEDLoader/ParaMEDFileMesh.cxx @@ -89,7 +89,7 @@ MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, int iPart, int nbOfParts { MEDCouplingAutoRefCountObjectPtr ret; int meshDim, spaceDim, numberOfNodes; - std::vector< std::vector< std::pair > > typesDistrib(MEDLoader::GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes)); + std::vector< std::vector< std::pair > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes)); std::vector types; std::vector distrib; for(std::vector< std::vector< std::pair > >::const_iterator it0=typesDistrib.begin();it0!=typesDistrib.end();it0++) @@ -107,7 +107,7 @@ MEDFileUMesh *ParaMEDFileUMesh::NewPrivate(med_idt fid, int iPart, int nbOfParts MEDFileMeshes *ParaMEDFileMeshes::New(int iPart, int nbOfParts, const std::string& fileName) { - std::vector ms(MEDLoader::GetMeshNames(fileName)); + std::vector ms(GetMeshNames(fileName)); MEDCouplingAutoRefCountObjectPtr ret(MEDFileMeshes::New()); for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) { @@ -119,7 +119,7 @@ MEDFileMeshes *ParaMEDFileMeshes::New(int iPart, int nbOfParts, const std::strin MEDFileMeshes *ParaMEDFileMeshes::ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName) { - std::vector ms(MEDLoader::GetMeshNames(fileName)); + std::vector ms(GetMeshNames(fileName)); MEDCouplingAutoRefCountObjectPtr ret(MEDFileMeshes::New()); for(std::vector::const_iterator it=ms.begin();it!=ms.end();it++) { diff --git a/src/ParaMEDLoader/ParaMEDLoader.cxx b/src/ParaMEDLoader/ParaMEDLoader.cxx index c8f205732..ebb6f379c 100644 --- a/src/ParaMEDLoader/ParaMEDLoader.cxx +++ b/src/ParaMEDLoader/ParaMEDLoader.cxx @@ -47,7 +47,7 @@ void ParaMEDLoader::WriteParaMesh(const char *fileName, MEDCoupling::ParaMESH *m } if(myRank==0) WriteMasterFile(fileName,fileNames,mesh->getCellMesh()->getName().c_str()); - MEDLoader::WriteUMesh(fileNames[myRank].c_str(),dynamic_cast(mesh->getCellMesh()),true); + WriteUMesh(fileNames[myRank].c_str(),dynamic_cast(mesh->getCellMesh()),true); } /*! diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx index 0f75367f1..e7668b546 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_InterpKernelDEC.cxx @@ -516,7 +516,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta ostringstream meshname ; meshname<< "Mesh_2_"<< rank+1; - mesh=MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0); + mesh=ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0); paramesh=new ParaMESH (mesh,*source_group,"source mesh"); @@ -555,7 +555,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta string fName = INTERP_TEST::getResourceFile(strstream.str()); ostringstream meshname ; meshname<< "Mesh_3_"<myRank()+1; aRemover.Register(filename.str().c_str()); - //MEDLoader::WriteField("./sourcesquareb",parafield->getField()); + //WriteField("./sourcesquareb",parafield->getField()); dec.recvData(); cout <<"writing"<myRank()==0) aRemover.Register("./sourcesquare"); - //MEDLoader::WriteField("./sourcesquare",parafield->getField()); + //WriteField("./sourcesquare",parafield->getField()); filename<<"./sourcesquare_"<myRank()+1; @@ -631,7 +631,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta dec.recvData(); ParaMEDLoader::WriteParaMesh("./targetsquareb",paramesh); - //MEDLoader::WriteField("./targetsquareb",parafield->getField()); + //WriteField("./targetsquareb",parafield->getField()); if (target_group->myRank()==0) aRemover.Register("./targetsquareb"); ostringstream filename; @@ -639,7 +639,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_2D_(const char *srcMeth, const char *ta aRemover.Register(filename.str().c_str()); dec.sendData(); ParaMEDLoader::WriteParaMesh("./targetsquare",paramesh); - //MEDLoader::WriteField("./targetsquare",parafield->getField()); + //WriteField("./targetsquare",parafield->getField()); if (target_group->myRank()==0) aRemover.Register("./targetsquareb"); @@ -720,7 +720,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2_2D_(const char *srcMeth, const char *t ostringstream meshname ; meshname<< "Mesh_2_"<< rank+1; - mesh=MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0); + mesh=ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0); MEDCoupling::ComponentTopology comptopo; if(srcM=="P0") { @@ -763,7 +763,7 @@ void ParaMEDMEMTest::testInterpKernelDEC2_2D_(const char *srcMeth, const char *t string fName = INTERP_TEST::getResourceFile(strstream.str()); ostringstream meshname ; meshname<< "Mesh_3_"<myRank()+1; aRemover.Register(filename.str().c_str()); - //MEDLoader::WriteField("./sourcesquareb",parafield->getField()); + //WriteField("./sourcesquareb",parafield->getField()); dec.recvData(); cout <<"writing"<myRank()==0) aRemover.Register("./sourcesquare"); - //MEDLoader::WriteField("./sourcesquare",parafield->getField()); + //WriteField("./sourcesquare",parafield->getField()); filename<<"./sourcesquare_"<myRank()+1; @@ -998,7 +998,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta dec.recvData(); ParaMEDLoader::WriteParaMesh("./targetsquareb",paramesh); - //MEDLoader::WriteField("./targetsquareb",parafield->getField()); + //WriteField("./targetsquareb",parafield->getField()); if (target_group->myRank()==0) aRemover.Register("./targetsquareb"); ostringstream filename; @@ -1006,7 +1006,7 @@ void ParaMEDMEMTest::testInterpKernelDEC_3D_(const char *srcMeth, const char *ta aRemover.Register(filename.str().c_str()); dec.sendData(); ParaMEDLoader::WriteParaMesh("./targetsquare",paramesh); - //MEDLoader::WriteField("./targetsquare",parafield->getField()); + //WriteField("./targetsquare",parafield->getField()); if (target_group->myRank()==0) aRemover.Register("./targetsquareb"); @@ -2148,7 +2148,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA ostringstream meshname ; meshname<< "Mesh_2_"<< rank+1; - mesh=MEDLoader::ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0); + mesh=ReadUMeshFromFile(fName.c_str(),meshname.str().c_str(),0); paramesh=new ParaMESH (mesh,*source_group,"source mesh"); @@ -2190,7 +2190,7 @@ void ParaMEDMEMTest::testAsynchronousInterpKernelDEC_2D(double dtA, double tmaxA ostringstream meshname ; meshname<< "Mesh_3_"< DADouble; // string tgt_mesh_nam(rep + string("T_SC_Trio_dst.med")); //// string src_mesh_nam(rep + string("h_TH_Trio_src.med")); //// string tgt_mesh_nam(rep + string("h_TH_Trio_dst.med")); -// MUMesh src_mesh=MEDLoader::ReadUMeshFromFile(src_mesh_nam,"SupportOf_",0); -// MUMesh tgt_mesh=MEDLoader::ReadUMeshFromFile(tgt_mesh_nam,"SupportOf_T_SC_Trio",0); -//// MUMesh tgt_mesh=MEDLoader::ReadUMeshFromFile(tgt_mesh_nam,"SupportOf_h_TH_Trio",0); +// MUMesh src_mesh=ReadUMeshFromFile(src_mesh_nam,"SupportOf_",0); +// MUMesh tgt_mesh=ReadUMeshFromFile(tgt_mesh_nam,"SupportOf_T_SC_Trio",0); +//// MUMesh tgt_mesh=ReadUMeshFromFile(tgt_mesh_nam,"SupportOf_h_TH_Trio",0); // // MFDouble srcField = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME); // srcField->setMesh(src_mesh); @@ -76,7 +76,7 @@ typedef MEDCouplingAutoRefCountObjectPtr DADouble; // MFDouble tgtField = remap.transferField(srcField, 1.0e+300); // tgtField->setName("result"); // string out_nam(rep + string("adrien.med")); -// MEDLoader::WriteField(out_nam,tgtField, true); +// WriteField(out_nam,tgtField, true); // cout << "wrote: " << out_nam << "\n"; // double integ1 = 0.0, integ2 = 0.0; // srcField->integral(true, &integ1); @@ -128,9 +128,9 @@ typedef MEDCouplingAutoRefCountObjectPtr DADouble; // { // // string src_mesh_nam(rep + string("h_TH_Trio_src.med")); // // string tgt_mesh_nam(rep + string("h_TH_Trio_dst.med")); -// MUMesh src_mesh=MEDLoader::ReadUMeshFromFile(src_mesh_nam,"SupportOf_",0); -// MUMesh tgt_mesh=MEDLoader::ReadUMeshFromFile(tgt_mesh_nam,"SupportOf_T_SC_Trio",0); -// // MUMesh tgt_mesh=MEDLoader::ReadUMeshFromFile(tgt_mesh_nam,"SupportOf_h_TH_Trio",0); +// MUMesh src_mesh=ReadUMeshFromFile(src_mesh_nam,"SupportOf_",0); +// MUMesh tgt_mesh=ReadUMeshFromFile(tgt_mesh_nam,"SupportOf_T_SC_Trio",0); +// // MUMesh tgt_mesh=ReadUMeshFromFile(tgt_mesh_nam,"SupportOf_h_TH_Trio",0); // // // **** SOURCE // srcField = MEDCouplingFieldDouble::New(ON_CELLS, ONE_TIME); @@ -170,7 +170,7 @@ typedef MEDCouplingAutoRefCountObjectPtr DADouble; // tgtField->integral(true, &integ2); // tgtField->setName("result"); // string out_nam(rep + string("adrien_para.med")); -// MEDLoader::WriteField(out_nam,tgtField, true); +// WriteField(out_nam,tgtField, true); // cout << "wrote: " << out_nam << "\n"; // CPPUNIT_ASSERT_DOUBLES_EQUAL(integ1,integ2,1e-8); // } diff --git a/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx b/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx index b32f3b3b9..b0226968b 100644 --- a/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx +++ b/src/ParaMEDMEMTest/ParaMEDMEMTest_StructuredCoincidentDEC.cxx @@ -97,7 +97,7 @@ void ParaMEDMEMTest::testStructuredCoincidentDEC() { ostringstream meshname; meshname<< "Mesh_2_"<< rank+1; - mesh=MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0); + mesh=ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0); paramesh=new ParaMESH (mesh,source_group,"source mesh"); @@ -125,7 +125,7 @@ void ParaMEDMEMTest::testStructuredCoincidentDEC() { if (target_group.containsMyRank()) { string meshname2("Mesh_2"); - mesh = MEDLoader::ReadUMeshFromFile(filename_2.c_str(),meshname2.c_str(),0); + mesh = ReadUMeshFromFile(filename_2.c_str(),meshname2.c_str(),0); paramesh=new ParaMESH (mesh,self_group,"target mesh"); MEDCoupling::ComponentTopology comptopo(6, &target_group); diff --git a/src/ParaMEDMEMTest/test_perf.cxx b/src/ParaMEDMEMTest/test_perf.cxx index 66a78d005..beca413d8 100644 --- a/src/ParaMEDMEMTest/test_perf.cxx +++ b/src/ParaMEDMEMTest/test_perf.cxx @@ -171,7 +171,7 @@ void testInterpKernelDEC_2D(const string& filename_xml1, const string& meshname1 meshname<< meshname1<<"_"<< rank+1; get_time( &telps, &tcpu_u, &tcpu_s, &tcpu ); - mesh=MEDLoader::ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0); + mesh=ReadUMeshFromFile(strstream.str().c_str(),meshname.str().c_str(),0); get_time( &telps, &tcpu_u, &tcpu_s, &tcpu ); if( rank == 0 ) cout << "IO : Telapse = " << telps << " TuserCPU = " << tcpu_u << " TsysCPU = " << tcpu_s << " TCPU = " << tcpu << endl; @@ -207,7 +207,7 @@ void testInterpKernelDEC_2D(const string& filename_xml1, const string& meshname1 meshname<< meshname2<<"_"<incrRef(); diff --git a/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py b/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py index 27e4551de..a15b6f662 100755 --- a/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py +++ b/src/ParaMEDMEM_Swig/test_InterpKernelDEC.py @@ -60,7 +60,7 @@ class ParaMEDMEMBasicsTest(unittest.TestCase): if source_group.containsMyRank(): filename = filename_xml1 + str(rank+1) + ".med" meshname = "Mesh_2_" + str(rank+1) - mesh=MEDLoader.ReadUMeshFromFile(filename,meshname,0) + mesh=ReadUMeshFromFile(filename,meshname,0) paramesh=ParaMESH(mesh,source_group,"source mesh") comptopo = ComponentTopology() parafield = ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo) @@ -75,7 +75,7 @@ class ParaMEDMEMBasicsTest(unittest.TestCase): else: filename = filename_xml2 + str(rank - nproc_source + 1) + ".med" meshname = "Mesh_3_" + str(rank - nproc_source + 1) - mesh=MEDLoader.ReadUMeshFromFile(filename,meshname,0) + mesh=ReadUMeshFromFile(filename,meshname,0) paramesh=ParaMESH(mesh,target_group,"target mesh") comptopo = ComponentTopology() parafield = ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo) diff --git a/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py b/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py index 1ab8fac21..171c25fed 100755 --- a/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py +++ b/src/ParaMEDMEM_Swig/test_StructuredCoincidentDEC.py @@ -63,7 +63,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): if source_group.containsMyRank(): filename = filename_xml1 + str(rank+1) + ".med" meshname = "Mesh_2_" + str(rank+1) - mesh=MEDLoader.ReadUMeshFromFile(filename,meshname,0) + mesh=ReadUMeshFromFile(filename,meshname,0) paramesh=ParaMESH(mesh,source_group,"source mesh") comptopo=ComponentTopology(6) parafield=ParaFIELD(ON_CELLS,NO_TIME,paramesh,comptopo) @@ -86,7 +86,7 @@ class ParaMEDMEMBasicsTest2(unittest.TestCase): if target_group.containsMyRank(): meshname2 = "Mesh_2" - mesh=MEDLoader.ReadUMeshFromFile(filename_2, meshname2,0) + mesh=ReadUMeshFromFile(filename_2, meshname2,0) paramesh=ParaMESH(mesh, self_group, "target mesh") comptopo=ComponentTopology(6,target_group) parafield=ParaFIELD(ON_CELLS,NO_TIME,paramesh, comptopo) diff --git a/v8_work/ModifyNamespace.py b/v8_work/ModifyNamespace.py new file mode 100644 index 000000000..439a4acc4 --- /dev/null +++ b/v8_work/ModifyNamespace.py @@ -0,0 +1,23 @@ +import os +#rep=("namespace ParaMEDMEM","namespace MEDCoupling") +#rep=("ParaMEDMEM::","MEDCoupling::") +#rep=("ParaMEDMEMImpl::","MEDCouplingImpl::") + +#rep=("_ParaMEDMEM__","_MEDCoupling__") +#rep=("ParaMEDMEM_","MEDCoupling_") +#rep=("ParaMEDMEMData","MEDCouplingData") +dirs=["MEDCoupling","MEDCoupling/Test","MEDLoader","MEDLoader/Swig","MEDLoader/Test","MEDPartitioner","MEDPartitioner/Test","MEDPartitioner_Swig","RENUMBER","RENUMBER_Swig","INTERP_KERNELTest","ParaMEDMEM","ParaMEDLoader","ParaMEDMEMTest","ParaMEDMEM_Swig"] +dirname=dirs[-1] +i=0 +for fi in os.listdir(dirname): + fi2=os.path.join(dirname,fi) + if not os.path.isfile(fi2): + continue + f=file(fi2) ; lines=f.readlines() ; del f + lines2=[line.replace(*rep) for line in lines] + if lines2!=lines: + i+=1 + f=file(fi2,"w") ; f.writelines(lines2) ; f.flush() + pass + +print i diff --git a/v8_work/TODO.txt b/v8_work/TODO.txt index 651f52503..b12d49006 100644 --- a/v8_work/TODO.txt +++ b/v8_work/TODO.txt @@ -31,7 +31,7 @@ Inheritance fix (OK but at the end of process) =============== + move up in all classes deepCpy(), shallowCpy(), clone() -Namespace changes +Namespace changes [DONE] ================= + MEDCoupling for all + MEDLoader static methods moved at namespace level -- 2.39.2