X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDLoader%2FMEDLoader.hxx;h=a8c5eafed4021b8bca3f5d9b0505a8093aba63ef;hb=b7e277ad50223814bc479c5bd64cf12abe8fc959;hp=dcd3c0e618fa39b5e6ca4dd4c37bd1d526954889;hpb=f67dc0817fad8a24d547e09fdab9c36e280cd378;p=tools%2Fmedcoupling.git diff --git a/src/MEDLoader/MEDLoader.hxx b/src/MEDLoader/MEDLoader.hxx index dcd3c0e61..a8c5eafed 100644 --- a/src/MEDLoader/MEDLoader.hxx +++ b/src/MEDLoader/MEDLoader.hxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,120 +29,74 @@ #include #include -namespace ParaMEDMEM +namespace MEDCoupling { class DataArrayInt; + class MEDCouplingMesh; class MEDCouplingUMesh; class MEDCouplingFieldDouble; -} + class MEDFileWritable; -class MEDLOADER_EXPORT MEDLoader -{ - public: -/// @cond INTERNAL - class MEDConnOfOneElemType - { - public: - MEDConnOfOneElemType(INTERP_KERNEL::NormalizedCellType type, int *conn, int *index, int *fam, int lgth, int connLgth); - INTERP_KERNEL::NormalizedCellType getType() const { return _type; } - int getLength() const { return _lgth; } - int getConnLength() const { return _conn_lgth; } - int *getArray() const { return _conn; } - int *getIndex() const { return _index; } - int *getFam() const { return _fam; } - void setGlobal(int *global); - const int *getGlobal() const { return _global; } - void releaseArray(); - private: - int _lgth; - int *_fam; - int *_conn; - int *_index; - int *_global; - int _conn_lgth; - INTERP_KERNEL::NormalizedCellType _type; - }; + 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 std::string MEDFileVersionOfFileStr(const std::string& fileName); + MEDLOADER_EXPORT void MEDFileVersion(int& major, int& minor, int& release); + MEDLOADER_EXPORT void CheckFileForRead(const std::string& fileName); + MEDLOADER_EXPORT std::vector GetMeshNames(const std::string& fileName); + MEDLOADER_EXPORT std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes); + MEDLOADER_EXPORT std::vector< std::pair > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector GetMeshGroupsNames(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName); + MEDLOADER_EXPORT std::vector GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName); + MEDLOADER_EXPORT std::vector GetAllFieldNames(const std::string& fileName); + MEDLOADER_EXPORT std::vector GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector GetFieldNamesOnMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT std::vector< std::pair > GetFieldIterations(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector< std::pair > GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector< std::pair > GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName); + MEDLOADER_EXPORT std::vector< std::pair< std::pair, double> > GetAllFieldIterations(const std::string& fileName, const std::string& fieldName); + MEDLOADER_EXPORT double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& fams); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector& grps); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0); + MEDLOADER_EXPORT int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadField(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT std::vector ReadFieldsOnSameMesh(MEDCoupling::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT std::vector ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT std::vector ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT std::vector ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT std::vector ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, + const std::vector >& its); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT MEDCoupling::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order); + MEDLOADER_EXPORT void WriteMesh(const std::string& fileName, const MEDCoupling::MEDCouplingMesh *mesh, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMesh(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMeshDep(const std::string& fileName, const MEDCoupling::MEDCouplingUMesh *mesh, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, const std::vector& meshes, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, const std::vector& meshes, bool writeFromScratch); + MEDLOADER_EXPORT void WriteUMeshes(const std::string& fileName, const std::vector& meshes, bool writeFromScratch); + MEDLOADER_EXPORT void WriteField(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch); + MEDLOADER_EXPORT void WriteFieldDep(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f, bool writeFromScratch); + MEDLOADER_EXPORT void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const MEDCoupling::MEDCouplingFieldDouble *f); - class MEDFieldDoublePerCellType - { - public: - MEDFieldDoublePerCellType(INTERP_KERNEL::NormalizedCellType type, double *values, int ncomp, int nGeoElt, int nbi, const int *cellIdPerType, const char *locName); - INTERP_KERNEL::NormalizedCellType getType() const { return _type; } - int getNbComp() const { return _ncomp; } - int getNbOfGeoElt() const { return _ngeo_elt; } - int getNbOfTuple() const { return _nbi*_ngeo_elt; } - int getNbOfValues() const { return _ncomp*_nbi*_ngeo_elt; } - double *getArray() const { return _values; } - const std::string& getLocName() const { return _loc_name; } - const std::vector& getCellIdPerType() const { return _cell_id_per_type; } - void releaseArray(); - private: - int _ngeo_elt; - int _nbi; - int _ncomp; - double *_values; - std::string _loc_name; - std::vector _cell_id_per_type; - INTERP_KERNEL::NormalizedCellType _type; - }; -/// @endcond - 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 char *fileName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception); - static std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes) throw(INTERP_KERNEL::Exception); - static std::vector< std::pair > GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception); - static std::vector GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception); - static std::vector GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception); - static std::vector GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception); - static std::vector GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static std::vector< std::pair > GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception); - static std::vector< std::pair > GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception); - static std::vector< std::pair > GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception); - static std::vector< std::pair< std::pair, double> > GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception); - static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector& fams) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector& grps) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception); - static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, - const std::vector >& its) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsCellOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, - const std::vector >& its) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsNodeOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, - const std::vector >& its) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsGaussOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, - const std::vector >& its) throw(INTERP_KERNEL::Exception); - static std::vector ReadFieldsGaussNEOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, - const std::vector >& its) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception); - static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMeshesPartition(const char *fileName, const char *meshName, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteUMeshes(const char *fileName, const std::vector& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception); - static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception); - private: - MEDLoader(); - public: - static double _EPS_FOR_NODE_COMP; - static int _COMP_FOR_CELL; - static int _TOO_LONG_STR; + MEDLOADER_EXPORT void AssignStaticWritePropertiesTo(MEDCoupling::MEDFileWritable& obj); }; #endif