Salome HOME
79eb6e45f6b8992f8f962d9f91b6db78a73a2b81
[tools/medcoupling.git] / src / MEDLoader / MEDFileBlowStrEltUp.hxx
1 // Copyright (C) 2007-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (EDF R&D)
20
21 #ifndef __MEDFILEBLOWSTRELTUP_HXX__
22 #define __MEDFILEBLOWSTRELTUP_HXX__
23
24 #include "MEDLoaderDefines.hxx"
25 #include "MEDFileUtilities.txx"
26 #include "MEDFileMesh.hxx"
27 #include "MEDFileField.hxx"
28 #include "MEDFileStructureElement.hxx"
29
30 #include "MEDCouplingRefCountObject.hxx"
31
32 namespace MEDCoupling
33
34   class MEDFileBlowStrEltUp
35   {
36   public:
37     MEDFileBlowStrEltUp(const MEDFileFields *fsOnlyOnSE, const MEDFileMeshes *ms, const MEDFileStructureElements *ses);
38     void generate(MEDFileMeshes *msOut, MEDFileFields *allZeOutFields);
39     static void DealWithSE(MEDFileFields *fs, MEDFileMeshes *ms, const MEDFileStructureElements *ses);
40   private:
41     MCAuto<MEDFileFields> splitFieldsPerLoc(const MEDFileFields *fields, const MEDFileUMesh *mesh, MEDFileMeshes *msOut, MEDFileFields *allZeOutFields);
42     MCAuto<MEDFileEltStruct4Mesh> dealWithSEInMesh(const std::string& seName, MEDFileUMesh *mesh, MCAuto<MEDFileUMesh>& mOut, MCAuto<MEDFileFields>& fsOut) const;
43     MCAuto<MEDFileEltStruct4Mesh> dealWithMEDBALLInMesh(const MEDFileUMesh *mesh, MCAuto<MEDFileUMesh>& mOut, MCAuto<MEDFileFields>& fsOut) const;
44     void dealWithSEInFields(const std::string& seName, const MEDFileFields *fs, const MEDFileEltStruct4Mesh *zeStr, const MEDFileFields *varAtt, MEDFileFields *zeOutputs) const;
45     void dealWithMEDBALLSInFields(const MEDFileFields *fs, const MEDFileEltStruct4Mesh *zeStr, const MEDFileFields *varAtt, MEDFileFields *zeOutputs) const;
46     static std::string BuildNewMeshName(const std::string& meshName, const std::string& seName);
47     static std::string BuildVarAttName(std::size_t iPart, std::size_t totINbParts, std::size_t jPart, std::size_t totJNbParts, const std::string& name);
48     static void DealWithConflictNames(MEDFileAnyTypeFieldMultiTS *fmtsToAdd, const MEDFileFields *fs);
49   public:
50     static const char MED_BALL_STR[];
51   private:
52     std::vector< MCAuto<MEDFileFields> > _elts;// split by pair(meshName,SEName)
53     MCConstAuto<MEDFileMeshes> _ms;
54     MCConstAuto<MEDFileStructureElements> _ses;
55   };
56 }
57
58 #endif