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"
36 class MEDFileFieldGlobs;
37 class MEDFileAnyTypeField1TS;
38 class MEDFileAnyTypeFieldMultiTS;
40 class MEDFileMeshStruct : public RefCountObject
43 static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
44 std::size_t getHeapMemorySize() const;
45 const MEDFileMesh *getTheMesh() const { return _mesh; }
46 int getNumberOfNodes() const { return _nb_nodes; }
47 int getNumberOfElemsOfGeoType(INTERP_KERNEL::NormalizedCellType t) const throw(INTERP_KERNEL::Exception);
48 int getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const throw(INTERP_KERNEL::Exception);
49 int getNumberOfLevs() const;
50 int getNumberOfGeoTypesInLev(int relativeLev) const throw(INTERP_KERNEL::Exception);
52 MEDFileMeshStruct(const MEDFileMesh *mesh);
54 const MEDFileMesh *_mesh;
57 std::vector< std::vector<int> > _geo_types_distrib;
60 class MEDFileField1TSStructItem2
63 MEDFileField1TSStructItem2();
64 MEDFileField1TSStructItem2(INTERP_KERNEL::NormalizedCellType a, const std::pair<int,int>& b, const std::string& pfl, const std::string& loc);
65 void checkWithMeshStructForCells(MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
66 void checkWithMeshStructForGaussNE(MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
67 void checkWithMeshStructForGaussPT(MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
69 INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; }
70 std::string getPflName() const;
71 //! warning this method also set _nb_of_entity attribute !
72 void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
73 bool operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception);
74 bool isCellSupportEqual(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception);
75 static MEDFileField1TSStructItem2 BuildAggregationOf(const std::vector<const MEDFileField1TSStructItem2 *>& objs, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
77 INTERP_KERNEL::NormalizedCellType _geo_type;
78 std::pair<int,int> _start_end;
79 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _pfl;
84 class MEDFileField1TSStructItem
87 MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b);
88 void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
89 bool operator==(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception);
90 bool isEntityCell() const;
91 bool isComputed() const { return _computed; }
92 std::size_t getNumberOfItems() const { return _items.size(); }
93 const MEDFileField1TSStructItem2& operator[](std::size_t i) const throw(INTERP_KERNEL::Exception);
95 bool isCellSupportEqual(const MEDFileField1TSStructItem& other) const throw(INTERP_KERNEL::Exception);
96 MEDFileField1TSStructItem simplifyMeOnCellEntity(const MEDFileFieldGlobs *globs) const throw(INTERP_KERNEL::Exception);
97 bool isCompatibleWithNodesDiscr(const MEDFileField1TSStructItem& other, const MEDFileMeshStruct *meshSt, const MEDFileFieldGlobs *globs) const throw(INTERP_KERNEL::Exception);
98 bool isFullyOnExactlyOneLev(const MEDFileMeshStruct *meshSt, int& theFirstLevFull) const throw(INTERP_KERNEL::Exception);
102 std::vector< MEDFileField1TSStructItem2 > _items;
105 class MEDFileField1TSStruct : public RefCountObject
108 static MEDFileField1TSStruct *New(const MEDFileAnyTypeField1TS *ref) throw(INTERP_KERNEL::Exception);
109 void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobs *globs) throw(INTERP_KERNEL::Exception);
110 std::size_t getHeapMemorySize() const;
111 bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other) const throw(INTERP_KERNEL::Exception);
112 bool isSupportSameAs(const MEDFileAnyTypeField1TS *other) throw(INTERP_KERNEL::Exception);
113 bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt) throw(INTERP_KERNEL::Exception);
115 MEDFileField1TSStruct(const MEDFileAnyTypeField1TS *ref);
116 static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref);
118 std::vector<MEDFileField1TSStructItem> _already_checked;
121 class MEDFileFastCellSupportComparator : public RefCountObject
124 static MEDFileFastCellSupportComparator *New(const MEDFileMesh *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception);
125 bool isEqual(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception);
126 bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other) throw(INTERP_KERNEL::Exception);
127 std::size_t getHeapMemorySize() const;
129 MEDFileFastCellSupportComparator(const MEDFileMesh *m, const MEDFileAnyTypeFieldMultiTS *ref);
131 MEDCouplingAutoRefCountObjectPtr<MEDFileMeshStruct> _mesh_comp;
132 std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct> > _f1ts_cmps;