1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __MEDFILEFIELDOVERVIEW_HXX__
22 #define __MEDFILEFIELDOVERVIEW_HXX__
24 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
25 #include "MEDCouplingRefCountObject.hxx"
27 #include "NormalizedUnstructuredMesh.hxx"
28 #include "InterpKernelException.hxx"
35 class MEDCouplingMesh;
37 class MEDFileFieldGlobs;
38 class MEDFileFieldGlobsReal;
39 class MEDFileAnyTypeField1TS;
40 class MEDFileAnyTypeFieldMultiTS;
42 class MEDFileMeshStruct : public RefCountObject
45 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
46 std::size_t getHeapMemorySize() const;
47 const MEDFileMesh *getTheMesh() const { return _mesh; }
48 int getNumberOfNodes() const { return _nb_nodes; }
49 int getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const throw(INTERP_KERNEL::Exception);
50 int getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const throw(INTERP_KERNEL::Exception);
51 int getNumberOfLevs() const;
52 int getNumberOfGeoTypesInLev(int relativeLev) const throw(INTERP_KERNEL::Exception);
54 MEDFileMeshStruct(const MEDFileMesh *mesh);
56 const MEDFileMesh *_mesh;
59 std::vector< std::vector<int> > _geo_types_distrib;
62 class MEDFileField1TSStructItem2 : public RefCountObject
65 MEDFileField1TSStructItem2();
66 MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<int,int>& b, const std::string& pfl, const std::string& loc);
67 void checkWithMeshStructForCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
68 void checkWithMeshStructForGaussNE(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
69 void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
71 std::size_t getHeapMemorySize() const;
73 INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; }
74 std::string getPflName() const;
75 //! warning this method also set _nb_of_entity attribute !
76 void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
77 bool operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception);
78 bool isCellSupportEqual(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception);
79 static MEDFileField1TSStructItem2 BuildAggregationOf(const std::vector<const MEDFileField1TSStructItem2 *>& objs, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
81 INTERP_KERNEL::NormalizedCellType _geo_type;
82 std::pair<int,int> _start_end;
83 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _pfl;
88 class MEDFileField1TSStructItem : public RefCountObject
91 MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b);
92 void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
93 bool operator==(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception);
94 std::size_t getHeapMemorySize() const;
95 bool isEntityCell() const;
96 bool isComputed() const { return _computed; }
97 TypeOfField getType() const { return _type; }
98 std::size_t getNumberOfItems() const { return _items.size(); }
99 const MEDFileField1TSStructItem2& operator[](std::size_t i) const throw(INTERP_KERNEL::Exception);
101 bool isCellSupportEqual(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception);
102 MEDFileField1TSStructItem simplifyMeOnCellEntity(const MEDFileFieldGlobs *globs) const throw(INTERP_KERNEL::Exception);
103 bool isCompatibleWithNodesDiscr(const MEDFileField1TSStructItem& other, const MEDFileMeshStruct *meshSt, const MEDFileFieldGlobs *globs) const throw(INTERP_KERNEL::Exception);
104 bool isFullyOnOneLev(const MEDFileMeshStruct *meshSt, int& theFirstLevFull) const throw(INTERP_KERNEL::Exception);
105 MEDCouplingMesh *buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
109 std::vector< MEDFileField1TSStructItem2 > _items;
112 class MEDFileField1TSStruct : public RefCountObject
115 static MEDFileField1TSStruct *New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst) throw(INTERP_KERNEL::Exception);
116 void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
117 std::size_t getHeapMemorySize() const;
118 bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const throw(INTERP_KERNEL::Exception);
119 bool isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception);
120 bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception);
121 MEDCouplingMesh *buildFromScratchDataSetSupport(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
123 MEDFileField1TSStruct(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst);
124 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
125 bool presenceOfCellDiscr(int& pos) const throw(INTERP_KERNEL::Exception);
126 bool presenceOfPartialNodeDiscr(int& pos) const throw(INTERP_KERNEL::Exception);
128 std::vector<MEDFileField1TSStructItem> _already_checked;
131 class MEDFileFastCellSupportComparator : public RefCountObject
134 static MEDFileFastCellSupportComparator *New(const MEDFileMesh *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception);
135 MEDCouplingMesh *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
136 bool isDataSetSupportEqualToThePreviousOne(int timeStepId) const throw(INTERP_KERNEL::Exception);
137 bool isEqual(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception);
138 bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception);
139 std::size_t getHeapMemorySize() const;
141 MEDFileFastCellSupportComparator(const MEDFileMesh *m, const MEDFileAnyTypeFieldMultiTS *ref);
143 MEDCouplingAutoRefCountObjectPtr<MEDFileMeshStruct> _mesh_comp;
144 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct> > _f1ts_cmps;