*/
MEDFileMesh *MEDFileMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
{
- std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
+ std::vector<std::string> ms=MEDCoupling::GetMeshNames(fileName);
if(ms.empty())
{
std::ostringstream oss; oss << "MEDFileMesh::New : no meshes in file \"" << fileName << "\" !";
*/
MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
{
- std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
+ std::vector<std::string> ms(MEDCoupling::GetMeshNames(fileName));
if(ms.empty())
{
std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !";
*/
MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
{
- std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
+ std::vector<std::string> ms(MEDCoupling::GetMeshNames(fileName));
if(ms.empty())
{
std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !";
MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
{
- std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
+ std::vector<std::string> ms(MEDCoupling::GetMeshNames(fileName));
if(ms.empty())
{
std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !";
MEDFileMeshMultiTS::MEDFileMeshMultiTS(const std::string& fileName)
try
{
- std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
+ std::vector<std::string> ms(MEDCoupling::GetMeshNames(fileName));
if(ms.empty())
{
std::ostringstream oss; oss << "MEDFileUMesh::New : no meshes in file \"" << fileName << "\" !";
void MEDFileMeshes::loadFromFile(const std::string& fileName)
{
- std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
+ std::vector<std::string> ms(MEDCoupling::GetMeshNames(fileName));
int i=0;
_meshes.resize(ms.size());
for(std::vector<std::string>::const_iterator it=ms.begin();it!=ms.end();it++,i++)
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;
/// @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;
#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;
/*!
* 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;
}
/*!
* 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;
}
* 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;
}
* - the space dimension
* - the number of nodes
*/
-std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDLoader::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes)
+std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > 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);
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));
return ret;
}
-void MEDLoader::CheckFileForRead(const std::string& fileName)
+void MEDCoupling::CheckFileForRead(const std::string& fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
}
-std::vector<std::string> MEDLoader::GetMeshNames(const std::string& fileName)
+std::vector<std::string> MEDCoupling::GetMeshNames(const std::string& fileName)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
std::vector<std::string> ret=MEDLoaderNS::getMeshNamesFid(fid);
return ret;
}
-std::vector< std::pair<std::string,std::string> > MEDLoader::GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName)
+std::vector< std::pair<std::string,std::string> > 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<std::string> fields(nbFields);
}
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<std::string>(oss," "));
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-std::vector<std::string> MEDLoader::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName)
+std::vector<std::string> MEDCoupling::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
std::vector<std::string> ret;
//
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
return ret;
}
-std::vector<std::string> MEDLoader::GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName)
+std::vector<std::string> 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<std::string> ret(nfam);
}
-std::vector<std::string> MEDLoader::GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName)
+std::vector<std::string> 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<std::string> ret;
return ret;
}
-std::vector<std::string> MEDLoader::GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName)
+std::vector<std::string> 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<std::string> ret;
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<std::string> MEDLoader::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName)
+std::vector<std::string> 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<std::string> ret;
return ret;
}
-std::vector<MEDCoupling::TypeOfField> MEDLoader::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
+std::vector<MEDCoupling::TypeOfField> MEDCoupling::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
std::vector<MEDCoupling::TypeOfField> ret;
MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> 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());
}
return ret2;
}
-std::vector<std::string> MEDLoader::GetAllFieldNames(const std::string& fileName)
+std::vector<std::string> MEDCoupling::GetAllFieldNames(const std::string& fileName)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
std::vector<std::string> ret;
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
return ret;
}
-std::vector<std::string> MEDLoader::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
+std::vector<std::string> MEDCoupling::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
std::vector<std::string> ret;
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
return ret;
}
-std::vector<std::string> MEDLoader::GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName)
+std::vector<std::string> MEDCoupling::GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
switch(type)
{
case ON_CELLS:
}
}
-std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
+std::vector<std::string> MEDCoupling::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
std::vector<std::string> ret;
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
return ret;
}
-std::vector<std::string> MEDLoader::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
+std::vector<std::string> MEDCoupling::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
std::vector<std::string> ret;
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
return ret;
}
-std::vector< std::pair< std::pair<int,int>, double> > MEDLoader::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName)
+std::vector< std::pair< std::pair<int,int>, double> > MEDCoupling::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
std::vector< std::pair< std::pair<int,int>, double > > ret;
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
INTERP_KERNEL::AutoPtr<char> 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<nbFields;i++)
{
med_int ncomp(MEDfieldnComponent(fid,i+1));
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);
//
return ret;
}
-std::vector< std::pair<int,int> > MEDLoader::GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
+std::vector< std::pair<int,int> > 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:
}
}
-std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
+std::vector< std::pair<int,int> > 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<int,int> > ret;
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
INTERP_KERNEL::AutoPtr<char> 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<std::string> s2;
for(int i=0;i<nbFields;i++)
{
return ret;
}
-std::vector< std::pair<int,int> > MEDLoader::GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
+std::vector< std::pair<int,int> > 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<int,int> > ret;
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
INTERP_KERNEL::AutoPtr<char> 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<std::string> s2;
for(int i=0;i<nbFields;i++)
{
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<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef();
return const_cast<MEDCouplingCurveLinearMesh *>(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<MEDFileMesh> mm(MEDFileMesh::New(fileName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef();
return const_cast<MEDCouplingCurveLinearMesh *>(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<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(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<MEDFileMesh> mm(MEDFileMesh::New(fileName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(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<int> poss;
return MEDLoaderNS::readUMeshDimFromFile(fileName,meshName,poss);
}
-MEDCoupling::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& fams)
+MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& fams)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(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<std::string>& grps)
+MEDCoupling::MEDCouplingUMesh *MEDCoupling::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& grps)
{
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(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:
}
}
-std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its)
+std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDCoupling::ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+ const std::vector<std::pair<int,int> >& its)
{
if(its.empty())
return std::vector<MEDCoupling::MEDCouplingFieldDouble *>();
- CheckFileForRead(fileName);
+ MEDCoupling::CheckFileForRead(fileName);
std::vector<MEDCoupling::MEDCouplingFieldDouble *> ret(its.size());
std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> > retSafe(its.size());
if(its.empty())
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(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<MEDCouplingUMesh> m=mmuPtr->getMeshAtLevel(meshDimRelToMax);
const DataArrayInt *o2n=mmuPtr->getNumberFieldAtLevel(meshDimRelToMax);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m2(m->clone(true));
return ret;
}
-std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDCoupling::ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& its)
{
return ReadFieldsOnSameMesh(ON_CELLS,fileName,meshName,meshDimRelToMax,fieldName,its);
}
-std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDCoupling::ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& its)
{
return ReadFieldsOnSameMesh(ON_NODES,fileName,meshName,meshDimRelToMax,fieldName,its);
}
-std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDCoupling::ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& its)
{
return ReadFieldsOnSameMesh(ON_GAUSS_PT,fileName,meshName,meshDimRelToMax,fieldName,its);
}
-std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+std::vector<MEDCoupling::MEDCouplingFieldDouble *> MEDCoupling::ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& 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<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
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<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr3(arr2->invertArrayO2N2N2O(mzip->getNumberOfNodes()));
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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<DataArrayInt> o2n2(pflSafe->checkAndPreparePermutation());
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<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
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<MEDFileField1TS> ff(MEDFileField1TS::New(fileName,fieldName,iteration,order));
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
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<const MEDCouplingUMesh *>(mesh));
if(um)
{
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<MEDFileUMesh> m(MEDFileUMesh::New());
AssignStaticWritePropertiesTo(*m);
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<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
+void MEDCoupling::WriteUMeshesPartition(const std::string& fileName, const std::string& meshNameC, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
std::string meshName(meshNameC);
if(meshName.empty())
m->write(fileName,mod);
}
-void MEDLoader::WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshNameC, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
+void MEDCoupling::WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshNameC, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
WriteUMeshesPartition(fileName,meshNameC,meshes,writeFromScratch);
}
-void MEDLoader::WriteUMeshes(const std::string& fileName, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
+void MEDCoupling::WriteUMeshes(const std::string& fileName, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
int mod=writeFromScratch?2:0;
MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m(MEDFileUMesh::New());
void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff(MEDFileField1TS::New());
- MEDLoader::AssignStaticWritePropertiesTo(*ff);
+ AssignStaticWritePropertiesTo(*ff);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
const MEDCouplingMesh *m(f2->getMesh());
const MEDCouplingUMesh *um(dynamic_cast<const MEDCouplingUMesh *>(m));
if(um)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu(MEDFileUMesh::New());
- MEDLoader::AssignStaticWritePropertiesTo(*mmu);
+ AssignStaticWritePropertiesTo(*mmu);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(um->getRenumArrForMEDFileFrmt());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
f2->renumberCells(o2n->begin(),false);
else if(um2)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu(MEDFileUMesh::New());
- MEDLoader::AssignStaticWritePropertiesTo(*mmu);
+ AssignStaticWritePropertiesTo(*mmu);
mmu->setMeshAtLevel(0,const_cast<MEDCoupling1GTUMesh *>(um2));
ff->setFieldNoProfileSBT(f2);
mmu->write(fileName,mod);
else if(um3)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> mmc(MEDFileCMesh::New());
- MEDLoader::AssignStaticWritePropertiesTo(*mmc);
+ AssignStaticWritePropertiesTo(*mmc);
mmc->setMesh(const_cast<MEDCouplingCMesh *>(um3));
ff->setFieldNoProfileSBT(f2);
mmc->write(fileName,mod);
else if(um4)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> mmc(MEDFileCurveLinearMesh::New());
- MEDLoader::AssignStaticWritePropertiesTo(*mmc);
+ AssignStaticWritePropertiesTo(*mmc);
mmc->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(um4));
ff->setFieldNoProfileSBT(f2);
mmc->write(fileName,mod);
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)
{
std::vector<std::string> 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);
const MEDFileMesh *mmPtr(mm);
const MEDFileUMesh *mmuPtr=dynamic_cast<const MEDFileUMesh *>(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<MEDCouplingFieldDouble> f2(f->deepCpy());
MEDCouplingUMesh *m=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(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<DataArrayInt> o2n=m->getRenumArrForMEDFileFrmt();
f2->renumberCells(o2n->begin(),false);
m=static_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f2->getMesh()));
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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<MEDFileField1TS> f1ts(MEDFileField1TS::New());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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<MEDFileField1TS> f1ts(MEDFileField1TS::New());
}
}
-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)
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<std::string> GetMeshNames(const std::string& fileName);
- static std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes);
- static std::vector< std::pair<std::string,std::string> > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName);
- static std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
- static std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
- static std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
- static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
- static std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
- static std::vector<std::string> GetAllFieldNames(const std::string& fileName);
- static std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
- static std::vector<MEDCoupling::TypeOfField> GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
- static std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
- static std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
- static std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
- static std::vector< std::pair<int,int> > GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName);
- static std::vector< std::pair<int,int> > GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
- static std::vector< std::pair<int,int> > GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
- static std::vector< std::pair< std::pair<int,int>, 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<std::string>& fams);
- static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& 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<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its);
- static std::vector<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its);
- static std::vector<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its);
- static std::vector<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& its);
- static std::vector<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
- const std::vector<std::pair<int,int> >& 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<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
- static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
- static void WriteUMeshes(const std::string& fileName, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& 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<std::string> GetMeshNames(const std::string& fileName);
+ MEDLOADER_EXPORT std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes);
+ MEDLOADER_EXPORT std::vector< std::pair<std::string,std::string> > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName);
+ MEDLOADER_EXPORT std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
+ MEDLOADER_EXPORT std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
+ MEDLOADER_EXPORT std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
+ MEDLOADER_EXPORT std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
+ MEDLOADER_EXPORT std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
+ MEDLOADER_EXPORT std::vector<std::string> GetAllFieldNames(const std::string& fileName);
+ MEDLOADER_EXPORT std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
+ MEDLOADER_EXPORT std::vector<MEDCoupling::TypeOfField> GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
+ MEDLOADER_EXPORT std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName);
+ MEDLOADER_EXPORT std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
+ MEDLOADER_EXPORT std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
+ MEDLOADER_EXPORT std::vector< std::pair<int,int> > GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName);
+ MEDLOADER_EXPORT std::vector< std::pair<int,int> > GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
+ MEDLOADER_EXPORT std::vector< std::pair<int,int> > GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
+ MEDLOADER_EXPORT std::vector< std::pair< std::pair<int,int>, 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<std::string>& fams);
+ MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& 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<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+ const std::vector<std::pair<int,int> >& its);
+ MEDLOADER_EXPORT std::vector<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+ const std::vector<std::pair<int,int> >& its);
+ MEDLOADER_EXPORT std::vector<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+ const std::vector<std::pair<int,int> >& its);
+ MEDLOADER_EXPORT std::vector<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+ const std::vector<std::pair<int,int> >& its);
+ MEDLOADER_EXPORT std::vector<MEDCoupling::MEDCouplingFieldDouble *> ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
+ const std::vector<std::pair<int,int> >& 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<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
+ MEDLOADER_EXPORT void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
+ MEDLOADER_EXPORT void WriteUMeshes(const std::string& fileName, const std::vector<const MEDCoupling::MEDCouplingUMesh *>& 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
$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;
%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<std::string> GetMeshNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetAllFieldNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
- static std::vector<std::string> 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<std::string> GetMeshNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetAllFieldNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> 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<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
- PyObject *ret=PyList_New(res.size());
- int rk=0;
- for(std::vector< std::pair<int,int> >::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<int,int> > res=MEDCoupling::GetFieldIterations(type,fileName,meshName,fieldName);
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair<int,int> >::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<int,int>, double> > res=MEDCoupling::GetAllFieldIterations(fileName,fieldName);
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair< std::pair<int,int>, 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<int,int> > res=MEDCoupling::GetCellFieldIterations(fileName,meshName,fieldName);
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair<int,int> >::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<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
- PyObject *ret=PyList_New(res.size());
- int rk=0;
- for(std::vector< std::pair< std::pair<int,int>, 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<int,int> > res=MEDCoupling::GetNodeFieldIterations(fileName,meshName,fieldName);
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair<int,int> >::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<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
- PyObject *ret=PyList_New(res.size());
- int rk=0;
- for(std::vector< std::pair<int,int> >::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<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
- PyObject *ret=PyList_New(res.size());
- int rk=0;
- for(std::vector< std::pair<int,int> >::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<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
- PyObject *ret=PyList_New(res.size());
- int rk=0;
- for(std::vector< std::pair<std::string,std::string> >::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<INTERP_KERNEL::NormalizedCellType,int> > > 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<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
- {
- const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
- int j=0;
- PyObject *elt1=PyList_New(obj2.size());
- for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::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<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
- std::vector<MEDCoupling::MEDCouplingFieldDouble *> 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<const MEDCoupling::MEDCouplingUMesh *> v;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(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<const MEDCoupling::MEDCouplingUMesh *> v;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(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<const MEDCoupling::MEDCouplingUMesh *> v;
- convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(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<size;i++)
- PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
- return ret;
- }
- static MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector<std::string> 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<std::string> 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<std::string,std::string> > res=MEDCoupling::GetComponentsNamesOfField(fileName,fieldName);
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair<std::string,std::string> >::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<INTERP_KERNEL::NormalizedCellType,int> > > 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<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it=res.begin();it!=res.end();it++,i++)
+ {
+ const std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >&obj2=(*it);
+ int j=0;
+ PyObject *elt1=PyList_New(obj2.size());
+ for(std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> >::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<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
+ std::vector<MEDCoupling::MEDCouplingFieldDouble *> 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<const MEDCoupling::MEDCouplingUMesh *> v;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(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<const MEDCoupling::MEDCouplingUMesh *> v;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(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<const MEDCoupling::MEDCouplingUMesh *> v;
+ convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(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<size;i++)
+ PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
+ return ret;
+ }
+
+ MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroupsSwig(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<std::string> 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<std::string> fams;
+ converPyListToVecString(li,fams);
+ return MEDCoupling::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
+ }
+}
namespace MEDCoupling
{
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)
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)
#####
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()
#! [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")
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)
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
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):
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));
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
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");
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);
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");
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
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));
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
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
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));
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);
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
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);
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));
#
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");
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
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
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");
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
#
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))
#
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()
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
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))
#
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))
#
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
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):
#
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
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
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));
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
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");
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
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
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));
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);
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
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
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));
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
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
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)
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
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))
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 !
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
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))
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))
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
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
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)
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
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
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)
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]
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)
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]
#
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
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)
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])
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)
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])
d[key]=[val]
pass
import re
- allFields=MEDLoader.GetAllFieldNames(fileName)
+ allFields=GetAllFieldNames(fileName)
allFieldsDict={}
pat=re.compile("([\d]+)([\s\S]+)$")
for st in allFields:
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)
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)
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)
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]
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)
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()
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));
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")
{
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();
{
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();
{
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();
{
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();
{
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();
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();
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));
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<MEDCouplingMesh *>(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<int,int> > it1=MEDLoader::GetCellFieldIterations(fileName,name3,name1);
+ std::vector< std::pair<int,int> > 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<int,int> > it3=MEDLoader::GetNodeFieldIterations(fileName,name3,name1);
+ std::vector< std::pair<int,int> > 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);
//
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();
}
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);
mesh5->decrRef();
CPPUNIT_ASSERT(mesh6->isEqual(mesh1,1e-12));
mesh6->decrRef();
- std::vector<std::string> grps=MEDLoader::GetMeshGroupsNames(fileName,mnane);
+ std::vector<std::string> 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());
//
std::vector<std::string> 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<std::string> ret(MEDLoader::GetMeshFamiliesNamesOnGroup(fileName,"3DToto","3DMesh_1"));
+ std::vector<std::string> ret(GetMeshFamiliesNamesOnGroup(fileName,"3DToto","3DMesh_1"));
std::set<std::string> s(ret.begin(),ret.end());
std::set<std::string> ref_s;
ref_s.insert("Family_-2");
CPPUNIT_ASSERT_EQUAL(4,(int)ret.size());
CPPUNIT_ASSERT(s==ref_s);
//
- std::vector<std::string> ret1=MEDLoader::GetMeshGroupsNamesOnFamily(fileName,"3DToto","Family_-3");
+ std::vector<std::string> ret1=GetMeshGroupsNamesOnFamily(fileName,"3DToto","Family_-3");
CPPUNIT_ASSERT_EQUAL(2,(int)ret1.size());
CPPUNIT_ASSERT(ret1[0]=="3DMesh_1");
CPPUNIT_ASSERT(ret1[1]=="mesh2");
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
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<MEDCoupling::TypeOfField> 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<MEDCoupling::TypeOfField> 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();
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);
const int arr2[2]={1,4};//node ids are 2,4,5,3,6,7
MEDCouplingFieldDouble *f2=f1->buildSubPart(arr2,arr2+2);
(const_cast<MEDCouplingMesh *>(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();
{
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");
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();
{
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();
{
const char fileName[]="file14.med";
MEDCouplingFieldDouble *f1=buildVecFieldOnGaussNE_1();
- MEDLoader::WriteField(fileName,f1,true);
- std::vector<MEDCoupling::TypeOfField> tof(MEDLoader::GetTypesOfField(fileName,"2DMesh_2","MyFieldOnGaussNE"));
+ WriteField(fileName,f1,true);
+ std::vector<MEDCoupling::TypeOfField> 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();
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();
//
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();
//
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<std::pair<int,int> > its;
its.push_back(std::pair<int,int>(1,2));
its.push_back(std::pair<int,int>(3,4));
its.push_back(std::pair<int,int>(5,6));
- std::vector<MEDCouplingFieldDouble *> fs=MEDLoader::ReadFieldsOnSameMesh(ON_CELLS,fileName,f_1->getMesh()->getName().c_str(),0,f_1->getName().c_str(),its);
+ std::vector<MEDCouplingFieldDouble *> 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));
std::vector<const MEDCouplingUMesh *> 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);
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();
f2->setTime(3.14,2,7);
f2->checkCoherency();
//
- MEDLoader::WriteField(fileName,f1,true);
- std::vector<MEDCoupling::TypeOfField> ts=MEDLoader::GetTypesOfField(fileName,f1->getMesh()->getName().c_str(),f1->getName().c_str());
+ WriteField(fileName,f1,true);
+ std::vector<MEDCoupling::TypeOfField> 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<std::string> fs=MEDLoader::GetAllFieldNamesOnMesh(fileName,f1->getMesh()->getName().c_str());
+ std::vector<std::string> 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();
//
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<std::string> fs=MEDLoader::GetAllFieldNames(fileName);
+ std::vector<std::string> fs=GetAllFieldNames(fileName);
CPPUNIT_ASSERT_EQUAL(4,(int)fs.size());
CPPUNIT_ASSERT(fs[0]=="Field1");
CPPUNIT_ASSERT(fs[1]=="Field2");
using namespace INTERP_KERNEL;
string fileName= INTERP_TEST::getResourceFile("pointe.med", 3);
- vector<string> meshNames=MEDLoader::GetMeshNames(fileName.c_str());
+ vector<string> 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());
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
mesh->decrRef();
//
- vector<string> families=MEDLoader::GetMeshFamiliesNames(fileName.c_str(),meshNames[0].c_str());
+ vector<string> families=GetMeshFamiliesNames(fileName.c_str(),meshNames[0].c_str());
CPPUNIT_ASSERT_EQUAL(8,(int)families.size());
CPPUNIT_ASSERT(families[2]=="FAMILLE_ELEMENT_3");
//
vector<string> 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());
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
mesh->decrRef();
//
- vector<string> groups=MEDLoader::GetMeshGroupsNames(fileName.c_str(),meshNames[0].c_str());
+ vector<string> 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");
CPPUNIT_ASSERT(groups[4]=="groupe5");
vector<string> 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());
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(mesh->getCoords()->getPointer(),mesh->getCoords()->getPointer()+57,0),1e-12);
mesh->decrRef();
//
- std::vector<std::string> fieldsName=MEDLoader::GetCellFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str());
+ std::vector<std::string> 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<std::pair<int,int> > its0=MEDLoader::GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str());
+ std::vector<std::pair<int,int> > 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<std::pair<int,int> > its1=MEDLoader::GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[1].c_str());
+ std::vector<std::pair<int,int> > 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());
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());
CPPUNIT_ASSERT_DOUBLES_EQUAL(46.,std::accumulate(constMesh->getCoords()->getConstPointer(),constMesh->getCoords()->getConstPointer()+57,0),1e-12);
field1->decrRef();
//fields on nodes
- std::vector<std::string> fieldsNameNode=MEDLoader::GetNodeFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str());
+ std::vector<std::string> 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<std::pair<int,int> > its0Node=MEDLoader::GetNodeFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsNameNode[0].c_str());
+ std::vector<std::pair<int,int> > 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);
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());
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());
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());
using namespace INTERP_KERNEL;
string fileName=INTERP_TEST::getResourceFile("polygones.med", 3);
- vector<string> meshNames=MEDLoader::GetMeshNames(fileName.c_str());
+ vector<string> 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());
CPPUNIT_ASSERT_EQUAL(725943,std::accumulate(mesh->getNodalConnectivityIndex()->getPointer(),mesh->getNodalConnectivityIndex()->getPointer()+539,0));
mesh->decrRef();
//
- std::vector<std::string> fieldsName=MEDLoader::GetCellFieldNamesOnMesh(fileName.c_str(),meshNames[0].c_str());
+ std::vector<std::string> 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<std::pair<int,int> > its0=MEDLoader::GetCellFieldIterations(fileName.c_str(),meshNames[0].c_str(),fieldsName[0].c_str());
+ std::vector<std::pair<int,int> > 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());
using namespace INTERP_KERNEL;
string fileName=INTERP_TEST::getResourceFile("poly3D.med", 3);
- vector<string> meshNames=MEDLoader::GetMeshNames(fileName.c_str());
+ vector<string> 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());
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());
CPPUNIT_ASSERT_EQUAL(619,std::accumulate(mesh->getNodalConnectivity()->getPointer(),mesh->getNodalConnectivity()->getPointer()+83,0));
mesh->decrRef();
//
- vector<string> families=MEDLoader::GetMeshFamiliesNames(fileName.c_str(),meshNames[0].c_str());
+ vector<string> 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");
CPPUNIT_ASSERT(families[3]=="FAMILLE_ZERO");
vector<string> 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());
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());
</mesh>\n \
</mapping>\n \
</root>\n";
- std::vector<std::string> meshNames=MEDLoader::GetMeshNames(myfile);
+ std::vector<std::string> 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]);
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);
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
// 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();
// }
nbfFieldFound++;
try
{
- MEDLoader::WriteField(distfilename,field,false);
+ WriteField(distfilename,field,false);
}
catch(INTERP_KERNEL::Exception& e)
{
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();
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);
}
}
std::vector<std::string> MEDPARTITIONER::BrowseAllFields(const std::string& myfile)
{
std::vector<std::string> res;
- std::vector<std::string> meshNames=MEDLoader::GetMeshNames(myfile);
+ std::vector<std::string> meshNames=MEDCoupling::GetMeshNames(myfile);
for (std::size_t i=0; i<meshNames.size(); i++)
{
std::vector<std::string> 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++)
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");
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");
{
{
MEDCouplingUMesh * mesh = buildCUBE3DMesh();
- MEDLoader::WriteUMesh(_file_name.c_str(),mesh,true);
+ WriteUMesh(_file_name.c_str(),mesh,true);
if (_verbose) cout<<endl<<_file_name<<" created"<<endl;
if (_ntot<1000000) //too long
{
- MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_file_name.c_str(),mesh->getName().c_str(),0);
+ MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(_file_name.c_str(),mesh->getName().c_str(),0);
if (_verbose) cout<<_file_name<<" reread"<<endl;
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
mesh_rw->decrRef();
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();
if (_verbose) cout<<endl<<_file_name_with_faces<<" created"<<endl;
if (_ntot<1000000) //too long
{
- MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_file_name_with_faces.c_str(),mesh1->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"<<endl;
CPPUNIT_ASSERT(mesh1->isEqual(mesh_rw,1e-12));
mesh_rw->decrRef();
{
MEDCouplingUMesh * mesh = buildCARRE3DMesh();
- MEDLoader::WriteUMesh(_file_name2.c_str(),mesh,true);
+ WriteUMesh(_file_name2.c_str(),mesh,true);
if (_verbose) cout<<endl<<_file_name2<<" created"<<endl;
- MEDCouplingUMesh *mesh_rw=MEDLoader::ReadUMeshFromFile(_file_name2.c_str(),mesh->getName().c_str(),0);
+ MEDCouplingUMesh *mesh_rw=ReadUMeshFromFile(_file_name2.c_str(),mesh->getName().c_str(),0);
if (_verbose) cout<<_file_name2<<" reread"<<endl;
CPPUNIT_ASSERT(mesh->isEqual(mesh_rw,1e-12));
mesh_rw->decrRef();
*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);
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<<endl<<name<<" created"<<endl;
if (_ntot<1000000) //too long
{
- MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name.c_str(),f1->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<<name<<" reread"<<endl;
//CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12));
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<<endl<<name<<" created"<<endl;
f3->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"<<endl;
f4->decrRef();
}
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<<endl<<name<<" created"<<endl;
if (_ntot<1000000) //too long
{
- MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name.c_str(),f1->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<<name<<" reread"<<endl;
//CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); assertion failed!!
f2->decrRef();
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<<endl<<name<<" created"<<endl;
if (_ntot<1000000) //too long
{
- MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldNode(name.c_str(),f1->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<<name<<" reread"<<endl;
//CPPUNIT_ASSERT(f1->isEqual(f2,1e-12,1e-12)); assertion failed!!
f2->decrRef();
{
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<INTERP_KERNEL::NormalizedCellType> types(m->getAllGeoTypes());
if (_verbose)
{
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);
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);
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);
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);
{
MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret;
int meshDim, spaceDim, numberOfNodes;
- std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > typesDistrib(MEDLoader::GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes));
+ std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > typesDistrib(GetUMeshGlobalInfo(fileName,mName,meshDim,spaceDim,numberOfNodes));
std::vector<INTERP_KERNEL::NormalizedCellType> types;
std::vector<int> distrib;
for(std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > >::const_iterator it0=typesDistrib.begin();it0!=typesDistrib.end();it0++)
MEDFileMeshes *ParaMEDFileMeshes::New(int iPart, int nbOfParts, const std::string& fileName)
{
- std::vector<std::string> ms(MEDLoader::GetMeshNames(fileName));
+ std::vector<std::string> ms(GetMeshNames(fileName));
MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> ret(MEDFileMeshes::New());
for(std::vector<std::string>::const_iterator it=ms.begin();it!=ms.end();it++)
{
MEDFileMeshes *ParaMEDFileMeshes::ParaNew(int iPart, int nbOfParts, const MPI_Comm& com, const MPI_Info& nfo, const std::string& fileName)
{
- std::vector<std::string> ms(MEDLoader::GetMeshNames(fileName));
+ std::vector<std::string> ms(GetMeshNames(fileName));
MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> ret(MEDFileMeshes::New());
for(std::vector<std::string>::const_iterator it=ms.begin();it!=ms.end();it++)
{
}
if(myRank==0)
WriteMasterFile(fileName,fileNames,mesh->getCellMesh()->getName().c_str());
- MEDLoader::WriteUMesh(fileNames[myRank].c_str(),dynamic_cast<MEDCouplingUMesh *>(mesh->getCellMesh()),true);
+ WriteUMesh(fileNames[myRank].c_str(),dynamic_cast<MEDCouplingUMesh *>(mesh->getCellMesh()),true);
}
/*!
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");
string fName = INTERP_TEST::getResourceFile(strstream.str());
ostringstream meshname ;
meshname<< "Mesh_3_"<<rank-nproc_source+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,*target_group,"target mesh");
// MEDCoupling::ParaSUPPORT* parasupport=new UnstructuredParaSUPPORT(support,*target_group);
ostringstream filename;
filename<<"./sourcesquareb_"<<source_group->myRank()+1;
aRemover.Register(filename.str().c_str());
- //MEDLoader::WriteField("./sourcesquareb",parafield->getField());
+ //WriteField("./sourcesquareb",parafield->getField());
dec.recvData();
cout <<"writing"<<endl;
ParaMEDLoader::WriteParaMesh("./sourcesquare",paramesh);
if (source_group->myRank()==0)
aRemover.Register("./sourcesquare");
- //MEDLoader::WriteField("./sourcesquare",parafield->getField());
+ //WriteField("./sourcesquare",parafield->getField());
filename<<"./sourcesquare_"<<source_group->myRank()+1;
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;
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");
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")
{
string fName = INTERP_TEST::getResourceFile(strstream.str());
ostringstream meshname ;
meshname<< "Mesh_3_"<<rank-nproc_source+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(targetM=="P0")
{
ostringstream meshname ;
meshname<< "Mesh_3_"<< 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");
std::string fName = INTERP_TEST::getResourceFile(strstream.str());
ostringstream meshname ;
meshname<< "Mesh_6";
- 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,*target_group,"target mesh");
// MEDCoupling::ParaSUPPORT* parasupport=new UnstructuredParaSUPPORT(support,*target_group);
ostringstream filename;
filename<<"./sourcesquareb_"<<source_group->myRank()+1;
aRemover.Register(filename.str().c_str());
- //MEDLoader::WriteField("./sourcesquareb",parafield->getField());
+ //WriteField("./sourcesquareb",parafield->getField());
dec.recvData();
cout <<"writing"<<endl;
ParaMEDLoader::WriteParaMesh("./sourcesquare",paramesh);
if (source_group->myRank()==0)
aRemover.Register("./sourcesquare");
- //MEDLoader::WriteField("./sourcesquare",parafield->getField());
+ //WriteField("./sourcesquare",parafield->getField());
filename<<"./sourcesquare_"<<source_group->myRank()+1;
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;
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");
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");
ostringstream meshname ;
meshname<< "Mesh_3_"<<rank-nproc_source+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,*target_group,"target mesh");
// MEDCoupling::ParaSUPPORT* parasupport=new UnstructuredParaSUPPORT(support,*target_group);
// 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);
// 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);
// {
// // 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);
// 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);
// }
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");
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);
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;
meshname<< meshname2<<"_"<<rank-nproc_source+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 );
mesh->incrRef();
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)
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)
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)
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)
--- /dev/null
+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
===============
+ move up in all classes deepCpy(), shallowCpy(), clone()
-Namespace changes
+Namespace changes [DONE]
=================
+ MEDCoupling for all
+ MEDLoader static methods moved at namespace level