1 // Copyright (C) 2007-2024 CEA, EDF
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.
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)
23 #include "MEDCoupling.hxx"
24 #include "MEDCouplingPointSet.hxx"
25 #include "MEDCouplingMemArray.hxx"
27 #include "CellModel.hxx"
33 class MEDCouplingUMeshCellByTypeEntry;
34 class MEDCouplingUMeshCellIterator;
35 class MEDCoupling1SGTUMesh;
36 class MEDCoupling1GTUMesh;
37 class MEDCouplingSkyLineArray;
39 class MEDCouplingUMesh : public MEDCouplingPointSet
42 MEDCOUPLING_EXPORT static MEDCouplingUMesh *New();
43 MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const std::string& meshName, int meshDim);
44 MEDCOUPLING_EXPORT std::string getClassName() const override { return std::string("MEDCouplingUMesh"); }
46 MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopy() const;
47 MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const;
48 MEDCOUPLING_EXPORT MEDCouplingUMesh *deepCopyConnectivityOnly() const;
50 MEDCOUPLING_EXPORT void shallowCopyConnectivityFrom(const MEDCouplingPointSet *other);
51 MEDCOUPLING_EXPORT void updateTime() const;
52 MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
53 MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
54 MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED; }
55 MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const;
56 MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
57 MEDCOUPLING_EXPORT void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const;
58 MEDCOUPLING_EXPORT void checkConsistencyLight() const;
59 MEDCOUPLING_EXPORT void checkConsistency(double eps=1e-12) const;
60 MEDCOUPLING_EXPORT void checkGeomConsistency(double eps=1e-12) const;
61 MEDCOUPLING_EXPORT void setMeshDimension(int meshDim);
62 MEDCOUPLING_EXPORT void allocateCells(mcIdType nbOfCells=0);
63 MEDCOUPLING_EXPORT void insertNextCell(INTERP_KERNEL::NormalizedCellType type, mcIdType size, const mcIdType *nodalConnOfCell);
64 MEDCOUPLING_EXPORT void finishInsertingCells();
65 MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *cellIterator();
66 MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeEntry *cellsByType();
67 MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
68 MEDCOUPLING_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getAllGeoTypesSorted() const;
69 MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getTypesOfPart(const mcIdType *begin, const mcIdType *end) const;
70 MEDCOUPLING_EXPORT void setConnectivity(DataArrayIdType *conn, DataArrayIdType *connIndex, bool isComputingTypes=true);
71 MEDCOUPLING_EXPORT const DataArrayIdType *getNodalConnectivity() const { return _nodal_connec; }
72 MEDCOUPLING_EXPORT const DataArrayIdType *getNodalConnectivityIndex() const { return _nodal_connec_index; }
73 MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivity() { return _nodal_connec; }
74 MEDCOUPLING_EXPORT DataArrayIdType *getNodalConnectivityIndex() { return _nodal_connec_index; }
75 MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(mcIdType cellId) const;
76 MEDCOUPLING_EXPORT DataArrayIdType *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
77 MEDCOUPLING_EXPORT mcIdType getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
78 MEDCOUPLING_EXPORT void getNodeIdsOfCell(mcIdType cellId, std::vector<mcIdType>& conn) const;
79 MEDCOUPLING_EXPORT std::string simpleRepr() const;
80 MEDCOUPLING_EXPORT std::string advancedRepr() const;
81 MEDCOUPLING_EXPORT std::string cppRepr() const;
82 MEDCOUPLING_EXPORT std::string reprConnectivityOfThis() const;
83 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSetInstanceFromThis(std::size_t spaceDim) const;
84 MEDCOUPLING_EXPORT mcIdType getNumberOfNodesInCell(mcIdType cellId) const;
85 MEDCOUPLING_EXPORT mcIdType getNumberOfCells() const;
86 MEDCOUPLING_EXPORT int getMeshDimension() const;
87 MEDCOUPLING_EXPORT mcIdType getNodalConnectivityArrayLen() const;
88 MEDCOUPLING_EXPORT void computeTypes();
89 //! size of returned tinyInfo must be always the same.
90 MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<mcIdType>& tinyInfo, std::vector<std::string>& littleStrings) const;
91 MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<mcIdType>& tinyInfo) const;
92 MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<mcIdType>& tinyInfo, DataArrayIdType *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
93 MEDCOUPLING_EXPORT void serialize(DataArrayIdType *&a1, DataArrayDouble *&a2) const;
94 MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<mcIdType>& tinyInfo, const DataArrayIdType *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
95 MEDCOUPLING_EXPORT std::string getVTKDataSetType() const;
96 MEDCOUPLING_EXPORT std::string getVTKFileExtension() const;
97 MEDCOUPLING_EXPORT void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const;
98 MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
100 MEDCOUPLING_EXPORT static int AreCellsEqual(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2, int compType);
101 MEDCOUPLING_EXPORT static int AreCellsEqualPolicy0(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
102 MEDCOUPLING_EXPORT static int AreCellsEqualPolicy1(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
103 MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
104 MEDCOUPLING_EXPORT static int AreCellsEqualPolicy2NoType(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
105 MEDCOUPLING_EXPORT static int AreCellsEqualPolicy7(const mcIdType *conn, const mcIdType *connI, mcIdType cell1, mcIdType cell2);
106 MEDCOUPLING_EXPORT void convertToPolyTypes(const mcIdType *cellIdsToConvertBg, const mcIdType *cellIdsToConvertEnd);
107 MEDCOUPLING_EXPORT void convertAllToPoly();
108 MEDCOUPLING_EXPORT void convertExtrudedPolyhedra();
109 MEDCOUPLING_EXPORT bool unPolyze();
110 MEDCOUPLING_EXPORT void simplifyPolyhedra(double eps);
111 MEDCOUPLING_EXPORT void colinearizeEdges(double eps);
112 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSpreadZonesWithPoly() const;
113 MEDCOUPLING_EXPORT std::vector<DataArrayIdType *> partitionBySpreadZone() const;
114 MEDCOUPLING_EXPORT DataArrayIdType *computeFetchedNodeIds() const;
115 MEDCOUPLING_EXPORT DataArrayIdType *getNodeIdsInUse(mcIdType& nbrOfNodesInUse) const;
116 MEDCOUPLING_EXPORT void computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) const;
117 MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfNodesPerCell() const;
118 MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfFacesPerCell() const;
119 MEDCOUPLING_EXPORT DataArrayIdType *computeEffectiveNbOfNodesPerCell() const;
120 MEDCOUPLING_EXPORT DataArrayIdType *zipCoordsTraducer();
121 MEDCOUPLING_EXPORT void findCommonCells(int compType, mcIdType startCellId, DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr) const;
122 MEDCOUPLING_EXPORT bool areCellsIncludedIn(const MEDCouplingUMesh *other, int compType, DataArrayIdType *& arr) const;
123 MEDCOUPLING_EXPORT bool areCellsIncludedInPolicy7(const MEDCouplingUMesh *other, DataArrayIdType *& arr) const;
124 MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayIdType *revNodal, DataArrayIdType *revNodalIndx) const;
125 MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> explodeIntoEdges(MCAuto<DataArrayIdType>& desc, MCAuto<DataArrayIdType>& descIndex, MCAuto<DataArrayIdType>& revDesc, MCAuto<DataArrayIdType>& revDescIndx) const;
126 MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> explodeMeshTo(int targetDeltaLevel, MCAuto<DataArrayIdType>& desc, MCAuto<DataArrayIdType>& descIndx, MCAuto<DataArrayIdType>& revDesc, MCAuto<DataArrayIdType>& revDescIndx) const;
127 MEDCOUPLING_EXPORT MEDCouplingUMesh *explode3DMeshTo1D(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
128 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
129 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
130 MEDCOUPLING_EXPORT MEDCouplingUMesh *explodeMeshIntoMicroEdges(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx) const;
131 MEDCOUPLING_EXPORT void computeNeighborsOfCells(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const;
132 MEDCOUPLING_EXPORT void computeCellNeighborhoodFromNodesOne(const DataArrayIdType *nodeNeigh, const DataArrayIdType *nodeNeighI, MCAuto<DataArrayIdType>& cellNeigh, MCAuto<DataArrayIdType>& cellNeighIndex) const;
133 MEDCOUPLING_EXPORT static void ComputeNeighborsOfCellsAdv(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *revDesc, const DataArrayIdType *revDescI,
134 DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx);
135 MEDCOUPLING_EXPORT void computeNeighborsOfNodes(DataArrayIdType *&neighbors, DataArrayIdType *&neighborsIdx) const;
136 MEDCOUPLING_EXPORT void computeEnlargedNeighborsOfNodes(MCAuto<DataArrayIdType> &neighbors, MCAuto<DataArrayIdType>& neighborsIdx) const;
137 MEDCOUPLING_EXPORT MEDCouplingUMesh *mergeMyselfWithOnSameCoords(const MEDCouplingPointSet *other) const;
138 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelf(const mcIdType *begin, const mcIdType *end, bool keepCoords=true) const;
139 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, bool keepCoords=true) const;
140 MEDCOUPLING_EXPORT void setPartOfMySelf(const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
141 MEDCOUPLING_EXPORT void setPartOfMySelfSlice(mcIdType start, mcIdType end, mcIdType step, const MEDCouplingUMesh& otherOnSameCoordsThanThis);
142 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildFacePartOfMySelfNode(const mcIdType *begin, const mcIdType *end, bool fullyIn) const;
143 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const;
144 MEDCOUPLING_EXPORT DataArrayIdType *findBoundaryNodes() const;
145 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildBoundaryMesh(bool keepCoords) const;
146 MEDCOUPLING_EXPORT DataArrayIdType *findCellIdsOnBoundary() const;
147 MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayIdType *&cellIdsRk0, DataArrayIdType *&cellIdsRk1) const;
148 MEDCOUPLING_EXPORT MEDCouplingUMesh *computeSkin() const;
149 MEDCOUPLING_EXPORT DataArrayIdType *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const;
150 MEDCOUPLING_EXPORT void findCellsToRenumber(const MEDCouplingUMesh& otherDimM1OnSameCoords, const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd,
151 DataArrayIdType *& cellIdsNeededToBeRenum, DataArrayIdType *& cellIdsNotModified) const;
152 MEDCOUPLING_EXPORT void duplicateNodes(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd);
153 MEDCOUPLING_EXPORT void renumberNodesWithOffsetInConn(mcIdType offset);
154 MEDCOUPLING_EXPORT void renumberNodesInConn(const INTERP_KERNEL::HashMap<mcIdType,mcIdType>& newNodeNumbersO2N);
155 MEDCOUPLING_EXPORT void renumberNodesInConn(const mcIdType *newNodeNumbersO2N);
156 MEDCOUPLING_EXPORT void renumberNodesInConn(const std::map<mcIdType,mcIdType>& newNodeNumbersO2N) override;
157 MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(mcIdType delta);
158 MEDCOUPLING_EXPORT void duplicateNodesInConn(const mcIdType *nodeIdsToDuplicateBg, const mcIdType *nodeIdsToDuplicateEnd, mcIdType offset);
159 MEDCOUPLING_EXPORT void renumberCells(const mcIdType *old2NewBg, bool check=true);
160 MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const double *bbox, double eps) const;
161 MEDCOUPLING_EXPORT DataArrayIdType *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps);
162 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
163 MEDCOUPLING_EXPORT DataArrayDouble *getPartMeasureField(bool isAbs, const mcIdType *begin, const mcIdType *end) const;
164 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
165 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
166 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildPartOrthogonalField(const mcIdType *begin, const mcIdType *end) const;
167 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildDirectionVectorField() const;
168 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3D(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const;
169 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildSlice3DSurf(const double *origin, const double *vec, double eps, DataArrayIdType *&cellIds) const;
170 MEDCOUPLING_EXPORT MCAuto<MEDCouplingUMesh> clipSingle3DCellByPlane(const double origin[3], const double vec[3], double eps) const;
171 MEDCOUPLING_EXPORT DataArrayIdType *getCellIdsCrossingPlane(const double *origin, const double *vec, double eps) const;
172 MEDCOUPLING_EXPORT bool isContiguous1D() const;
173 MEDCOUPLING_EXPORT void project1D(const double *pt, const double *v, double eps, double *res) const;
174 MEDCOUPLING_EXPORT double distanceToPoint(const double *ptBg, const double *ptEnd, mcIdType& cellId) const;
175 MEDCOUPLING_EXPORT DataArrayDouble *distanceToPoints(const DataArrayDouble *pts, DataArrayIdType *& cellIds) const;
176 MEDCOUPLING_EXPORT mcIdType getCellContainingPoint(const double *pos, double eps) const;
177 MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<mcIdType>& elts) const;
178 MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const override;
179 MEDCOUPLING_EXPORT void getCellsContainingPointsLinearPartOnlyOnNonDynType(const double *pos, mcIdType nbOfPoints, double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex) const override;
180 MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<mcIdType>& cells, double eps=1e-12) const;
181 MEDCOUPLING_EXPORT DataArrayIdType *convexEnvelop2D();
182 MEDCOUPLING_EXPORT DataArrayIdType *findAndCorrectBadOriented3DExtrudedCells();
183 MEDCOUPLING_EXPORT DataArrayIdType *findAndCorrectBadOriented3DCells();
184 MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree(double arcDetEps=1e-12) const;
185 MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTreeFast() const;
186 MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const;
187 MEDCOUPLING_EXPORT DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const;
188 MEDCOUPLING_EXPORT MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);
189 MEDCOUPLING_EXPORT bool isFullyQuadratic() const;
190 MEDCOUPLING_EXPORT bool isPresenceOfQuadratic() const;
191 MEDCOUPLING_EXPORT void convertQuadraticCellsToLinear();
192 MEDCOUPLING_EXPORT DataArrayIdType *convertLinearCellsToQuadratic(int conversionType=0);
193 MEDCOUPLING_EXPORT void tessellate2D(double eps);
194 MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *tetrahedrize(int policy, DataArrayIdType *& n2oCells, mcIdType& nbOfAdditionalPoints) const;
195 MEDCOUPLING_EXPORT DataArrayIdType *simplexize(int policy);
196 MEDCOUPLING_EXPORT bool areOnlySimplexCells() const;
197 MEDCOUPLING_EXPORT void convertDegeneratedCells();
198 MEDCOUPLING_EXPORT DataArrayIdType *convertDegeneratedCellsAndRemoveFlatOnes();
199 MEDCOUPLING_EXPORT bool removeDegenerated1DCells();
200 MEDCOUPLING_EXPORT void are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector<mcIdType>& cells) const;
201 MEDCOUPLING_EXPORT void orientCorrectly2DCells(const double *vec, bool polyOnly);
202 MEDCOUPLING_EXPORT void orientCorrectly2DCells(const MEDCouplingUMesh* refFaces = nullptr);
203 MEDCOUPLING_EXPORT void changeOrientationOfCells();
204 MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector<mcIdType>& cells) const;
205 MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons();
206 MEDCOUPLING_EXPORT void invertOrientationOfAllCells();
207 MEDCOUPLING_EXPORT void getFastAveragePlaneOfThis(double *vec, double *pos) const;
208 MEDCOUPLING_EXPORT void attractSeg3MidPtsAroundNodes(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd);
210 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getEdgeRatioField() const;
211 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getAspectRatioField() const;
212 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getWarpField() const;
213 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getSkewField() const;
214 MEDCOUPLING_EXPORT MEDCouplingFieldDouble *computeDiameterField() const;
215 //utilities for MED File RW
216 MEDCOUPLING_EXPORT std::vector<mcIdType> getDistributionOfTypes() const;
217 MEDCOUPLING_EXPORT DataArrayIdType *checkTypeConsistencyAndContig(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
218 MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayIdType *profile, std::vector<mcIdType>& code, std::vector<DataArrayIdType *>& idsInPflPerType, std::vector<DataArrayIdType *>& idsPerType, bool smartPflKiller=true) const;
219 MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *&revDesc, DataArrayIdType *&revDescIndx, DataArrayIdType *& nM1LevMeshIds, DataArrayIdType *&meshnM1Old2New) const;
220 MEDCOUPLING_EXPORT DataArrayIdType *sortCellsInMEDFileFrmt();
221 MEDCOUPLING_EXPORT bool checkConsecutiveCellTypes() const;
222 MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesForMEDFileFrmt() const;
223 MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const;
224 MEDCOUPLING_EXPORT DataArrayIdType *getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayIdType *&nbPerType) const;
225 MEDCOUPLING_EXPORT DataArrayIdType *getRenumArrForMEDFileFrmt() const;
226 MEDCOUPLING_EXPORT DataArrayIdType *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const;
227 MEDCOUPLING_EXPORT DataArrayIdType *rearrange2ConsecutiveCellTypes();
228 MEDCOUPLING_EXPORT std::vector<MEDCouplingUMesh *> splitByType() const;
229 MEDCOUPLING_EXPORT MEDCoupling1GTUMesh *convertIntoSingleGeoTypeMesh() const;
230 MEDCOUPLING_EXPORT DataArrayIdType *convertNodalConnectivityToStaticGeoTypeMesh() const;
231 MEDCOUPLING_EXPORT void convertNodalConnectivityToDynamicGeoTypeMesh(DataArrayIdType *&nodalConn, DataArrayIdType *&nodalConnIndex) const;
232 MEDCOUPLING_EXPORT static MEDCouplingUMesh *AggregateSortedByTypeMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& ms,
233 DataArrayIdType *&szOfCellGrpOfSameType,
234 DataArrayIdType *&idInMsOfCellGrpOfSameType);
235 MEDCOUPLING_EXPORT DataArrayIdType *keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const mcIdType *begin, const mcIdType *end) const;
236 MEDCOUPLING_EXPORT DataArrayIdType *convertCellArrayPerGeoType(const DataArrayIdType *da) const;
237 MEDCOUPLING_EXPORT MEDCouplingUMesh *keepSpecifiedCells(INTERP_KERNEL::NormalizedCellType type, const mcIdType *idsPerGeoTypeBg, const mcIdType *idsPerGeoTypeEnd) const;
238 MEDCOUPLING_EXPORT std::vector<bool> getQuadraticStatus() const;
240 MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
241 MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMass() const;
242 MEDCOUPLING_EXPORT DataArrayDouble *computeCellCenterOfMassWithPrecision(double eps) const;
243 MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
244 MEDCOUPLING_EXPORT DataArrayDouble *getPartBarycenterAndOwner(const mcIdType *begin, const mcIdType *end) const;
245 MEDCOUPLING_EXPORT DataArrayDouble *computePlaneEquationOf3DFaces() const;
246 MEDCOUPLING_EXPORT DataArrayIdType *conformize2D(double eps);
247 MEDCOUPLING_EXPORT DataArrayIdType *colinearize2D(double eps);
248 MEDCOUPLING_EXPORT DataArrayIdType *colinearizeKeepingConform2D(double eps);
249 MEDCOUPLING_EXPORT DataArrayIdType *conformize3D(double eps);
250 MEDCOUPLING_EXPORT mcIdType split2DCells(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *midOpt=0, const DataArrayIdType *midOptI=0);
251 MEDCOUPLING_EXPORT static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da);
252 MEDCOUPLING_EXPORT static MCAuto<MEDCouplingUMesh> Build1DMeshFromCoords(DataArrayDouble *da);
253 MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
254 MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshes(const std::vector<const MEDCouplingUMesh *>& a);
255 MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2);
256 MEDCOUPLING_EXPORT static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes);
257 MEDCOUPLING_EXPORT static MEDCouplingUMesh *FuseUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes, int compType, std::vector<DataArrayIdType *>& corr);
258 MEDCOUPLING_EXPORT static void PutUMeshesOnSameAggregatedCoords(const std::vector<MEDCouplingUMesh *>& meshes);
259 MEDCOUPLING_EXPORT static void MergeNodesOnUMeshesSharingSameCoords(const std::vector<MEDCouplingUMesh *>& meshes, double eps);
260 MEDCOUPLING_EXPORT static bool IsPolygonWellOriented(bool isQuadratic, const double *vec, const mcIdType *begin, const mcIdType *end, const double *coords);
261 MEDCOUPLING_EXPORT static bool IsPolyhedronWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords);
262 MEDCOUPLING_EXPORT static bool Is3DExtrudedStaticCellWellOriented(const mcIdType *begin, const mcIdType *end, const double *coords);
263 MEDCOUPLING_EXPORT static void CorrectExtrudedStaticCell(mcIdType *begin, mcIdType *end);
264 MEDCOUPLING_EXPORT static bool IsTetra4WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords);
265 MEDCOUPLING_EXPORT static bool IsPyra5WellOriented(const mcIdType *begin, const mcIdType *end, const double *coords);
266 MEDCOUPLING_EXPORT static void SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, mcIdType index, DataArrayIdType *res, MEDCouplingUMesh *faces,
267 DataArrayIdType *E_Fi, DataArrayIdType *E_F, DataArrayIdType *F_Ei, DataArrayIdType *F_E);
268 MEDCOUPLING_EXPORT static void ComputeVecAndPtOfFace(double eps, const double *coords, const mcIdType *begin, const mcIdType *end, double *v, double *p);
269 MEDCOUPLING_EXPORT static void TryToCorrectPolyhedronOrientation(mcIdType *begin, mcIdType *end, const double *coords);
270 MEDCOUPLING_EXPORT static MEDCouplingUMesh *Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, DataArrayIdType *&cellNb1, DataArrayIdType *&cellNb2);
271 MEDCOUPLING_EXPORT static void Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, const MEDCouplingUMesh *mesh1D,
272 double eps, MEDCouplingUMesh *&splitMesh2D, MEDCouplingUMesh *&splitMesh1D, DataArrayIdType *&cellIdInMesh2D, DataArrayIdType *&cellIdInMesh1D);
273 MEDCOUPLING_EXPORT static bool BuildConvexEnvelopOf2DCellJarvis(const double *coords, const mcIdType *nodalConnBg, const mcIdType *nodalConnEnd, DataArrayIdType *nodalConnecOut);
274 MEDCOUPLING_EXPORT static std::vector<DataArrayIdType *> PartitionBySpreadZone(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
275 MEDCOUPLING_EXPORT static DataArrayIdType *ComputeSpreadZoneGradually(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn);
276 MEDCOUPLING_EXPORT static DataArrayIdType *ComputeSpreadZoneGraduallyFromSeed(const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed);
277 MEDCOUPLING_EXPORT static void FindCommonCellsAlg(int compType, mcIdType startCellId, const DataArrayIdType *nodal, const DataArrayIdType *nodalI, const DataArrayIdType *revNodal, const DataArrayIdType *revNodalI,
278 DataArrayIdType *& commonCellsArr, DataArrayIdType *& commonCellsIArr);
279 MEDCOUPLING_EXPORT DataArrayIdType *buildUnionOf2DMesh() const;
280 MEDCOUPLING_EXPORT DataArrayIdType *buildUnionOf3DMesh() const;
281 MEDCOUPLING_EXPORT DataArrayIdType *orderConsecutiveCells1D() const;
282 MEDCOUPLING_EXPORT MEDCouplingSkyLineArray* generateGraph() const;
283 private: // all private methods are impl in MEDCouplingUMesh_internal.cxx
286 MEDCouplingUMesh(const MEDCouplingUMesh& other, bool deepCpy);
288 void checkFullyDefined() const;
289 void checkConnectivityFullyDefined() const;
290 void reprConnectivityOfThisLL(std::ostringstream& stream) const;
292 DataArrayIdType *simplexizePol0();
293 DataArrayIdType *simplexizePol1();
294 DataArrayIdType *simplexizePlanarFace5();
295 DataArrayIdType *simplexizePlanarFace6();
296 void tessellate2DInternal(double eps);
297 void tessellate2DCurveInternal(double eps);
298 void subDivide2DMesh(const mcIdType *nodeSubdived, const mcIdType *nodeIndxSubdived, const mcIdType *desc, const mcIdType *descIndex);
299 void fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const mcIdType *end, bool fullyIn, DataArrayIdType *&cellIdsKeptArr) const;
300 void split3DCurveWithPlane(const double *origin, const double *vec, double eps, std::vector<mcIdType>& cut3DCurve);
301 MEDCouplingUMesh *buildExtrudedMeshFromThisLowLev(mcIdType nbOfNodesOf1Lev, bool isQuad) const;
302 DataArrayDouble *fillExtCoordsUsingTranslation(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
303 DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
304 DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation2D(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
305 DataArrayDouble *fillExtCoordsUsingTranslAndAutoRotation3D(const MEDCouplingUMesh *mesh1D, bool isQuad) const;
306 static bool AreCellsEqualInPool(const std::vector<mcIdType>& candidates, int compType, const mcIdType *conn, const mcIdType *connI, DataArrayIdType *result) ;
307 MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const mcIdType *begin, const mcIdType *end) const;
308 MEDCouplingUMesh *buildPartOfMySelfKeepCoordsSlice(mcIdType start, mcIdType end, mcIdType step) const;
309 DataArrayIdType *convertLinearCellsToQuadratic1D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
310 DataArrayIdType *convertLinearCellsToQuadratic2DAnd3D0(const MEDCouplingUMesh *m1D, const DataArrayIdType *desc, const DataArrayIdType *descI, DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
311 DataArrayIdType *convertLinearCellsToQuadratic2D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
312 DataArrayIdType *convertLinearCellsToQuadratic2D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
313 DataArrayIdType *convertLinearCellsToQuadratic3D0(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
314 DataArrayIdType *convertLinearCellsToQuadratic3D1(DataArrayIdType *&conn, DataArrayIdType *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const;
315 DataArrayIdType *buildUnionOf2DMeshLinear(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const;
316 DataArrayIdType *buildUnionOf2DMeshQuadratic(const MEDCouplingUMesh *skin, const DataArrayIdType *n2o) const;
317 template<int SPACEDIM>
318 void getCellsContainingPointsAlg(const double *coords, const double *pos, mcIdType nbOfPoints,
319 double eps, MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex, std::function<bool(INTERP_KERNEL::NormalizedCellType,int)> sensibilityTo2DQuadraticLinearCellsFunc) const;
320 void getCellsContainingPointsZeAlg(const double *pos, mcIdType nbOfPoints, double eps,
321 MCAuto<DataArrayIdType>& elts, MCAuto<DataArrayIdType>& eltsIndex,
322 std::function<bool(INTERP_KERNEL::NormalizedCellType,mcIdType)> sensibilityTo2DQuadraticLinearCellsFunc) const;
324 static void DeleteCellTypeInIndexedArray(const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, MCAuto<DataArrayIdType>& arrOut, MCAuto<DataArrayIdType>& arrIndxOut);
325 static MEDCouplingUMesh *MergeUMeshesLL(const std::vector<const MEDCouplingUMesh *>& a);
326 typedef mcIdType (*DimM1DescNbrer)(mcIdType id, mcIdType nb, const INTERP_KERNEL::CellModel& cm, bool compute, const mcIdType *conn1, const mcIdType *conn2);
327 template<class SonsGenerator>
328 MEDCouplingUMesh *buildDescendingConnectivityGen(DataArrayIdType *desc, DataArrayIdType *descIndx, DataArrayIdType *revDesc, DataArrayIdType *revDescIndx, DimM1DescNbrer nbrer) const;
329 static void DistanceToPoint3DSurfAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId);
330 static void DistanceToPoint2DCurveAlg(const double *pt, const mcIdType *cellIdsBg, const mcIdType *cellIdsEnd, const double *coords, const mcIdType *nc, const mcIdType *ncI, double& ret0, mcIdType& cellId);
331 static DataArrayIdType *ComputeSpreadZoneGraduallyFromSeedAlg(std::vector<bool>& fetched, const mcIdType *seedBg, const mcIdType *seedEnd, const DataArrayIdType *arrIn, const DataArrayIdType *arrIndxIn, mcIdType nbOfDepthPeeling, mcIdType& nbOfDepthPeelingPerformed);
332 static void FillInCompact3DMode(int spaceDim, mcIdType nbOfNodesInCell, const mcIdType *conn, const double *coo, double *zipFrmt);
333 static void AppendExtrudedCell(const mcIdType *connBg, const mcIdType *connEnd, mcIdType nbOfNodesPerLev, bool isQuad, std::vector<mcIdType>& ret);
334 static void Intersect1DMeshes(const MEDCouplingUMesh *m1Desc, const MEDCouplingUMesh *m2Desc, double eps, std::vector< std::vector<mcIdType> >& intersectEdge1, std::vector< std::vector<mcIdType> >& colinear2, std::vector< std::vector<mcIdType> >& subDiv2, std::vector<double>& addCoo, std::map<mcIdType,mcIdType>& mergedNodes);
335 static void IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps,
336 std::vector< std::vector<mcIdType> >& intersectEdge1, std::vector< std::vector<mcIdType> >& colinear2, std::vector< std::vector<mcIdType> >& subDiv2,
337 MEDCouplingUMesh *& m1Desc, DataArrayIdType *&desc1, DataArrayIdType *&descIndx1, DataArrayIdType *&revDesc1, DataArrayIdType *&revDescIndx1,
338 std::vector<double>& addCoo,
339 MEDCouplingUMesh *& m2Desc, DataArrayIdType *&desc2, DataArrayIdType *&descIndx2, DataArrayIdType *&revDesc2, DataArrayIdType *&revDescIndx2);
340 static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector<double>& addCoo, const std::vector< std::vector<mcIdType> >& subDiv, std::vector< std::vector<mcIdType> >& intersectEdge);
341 static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const mcIdType *desc1, const mcIdType *descIndx1, const std::vector<std::vector<mcIdType> >& intesctEdges1, const std::vector< std::vector<mcIdType> >& colinear2,
342 const MEDCouplingUMesh *m2, const mcIdType *desc2, const mcIdType *descIndx2, const std::vector<std::vector<mcIdType> >& intesctEdges2,
343 const std::vector<double>& addCoords,
344 std::vector<double>& addCoordsQuadratic, std::vector<mcIdType>& cr, std::vector<mcIdType>& crI, std::vector<mcIdType>& cNb1, std::vector<mcIdType>& cNb2);
345 static void AssemblyForSplitFrom3DCurve(const std::vector<mcIdType>& cut3DCurve, std::vector<mcIdType>& nodesOnPlane, const mcIdType *nodal3DSurf, const mcIdType *nodalIndx3DSurf,
346 const mcIdType *nodal3DCurve, const mcIdType *nodalIndx3DCurve,
347 const mcIdType *desc, const mcIdType *descIndx, std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf);
348 void assemblyForSplitFrom3DSurf(const std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf,
349 const mcIdType *desc, const mcIdType *descIndx, DataArrayIdType *nodalRes, DataArrayIdType *nodalResIndx, DataArrayIdType *cellIds) const;
350 void buildSubCellsFromCut(const std::vector< std::pair<mcIdType,mcIdType> >& cut3DSurf, const mcIdType *desc, const mcIdType *descIndx, const double *coords, double eps, std::vector<std::vector<mcIdType> >& res) const;
351 void split2DCellsLinear(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI);
352 mcIdType split2DCellsQuadratic(const DataArrayIdType *desc, const DataArrayIdType *descI, const DataArrayIdType *subNodesInSeg, const DataArrayIdType *subNodesInSegI, const DataArrayIdType *mid, const DataArrayIdType *midI);
353 static bool Colinearize2DCell(const double *coords, const mcIdType *connBg, const mcIdType *connEnd, mcIdType offset, const std::map<mcIdType, bool>& forbiddenPoints, DataArrayIdType *newConnOfCell, DataArrayDouble *appendedCoords);
354 static void ComputeAllTypesInternal(std::set<INTERP_KERNEL::NormalizedCellType>& types, const DataArrayIdType *nodalConnec, const DataArrayIdType *nodalConnecIndex);
355 static bool OrderPointsAlongLine(const double * coo, mcIdType startNode, mcIdType endNode,
356 const mcIdType * c, const mcIdType * cI, const mcIdType *idsBg, const mcIdType *endBg,
357 std::vector<mcIdType> & pointIds, std::vector<mcIdType> & hitSegs);
358 static void ReplaceEdgeInFace(const mcIdType * sIdxConn, const mcIdType * sIdxConnE, mcIdType startNode, mcIdType endNode,
359 const std::vector<mcIdType>& insidePoints, std::vector<mcIdType>& modifiedFace);
360 void attractSeg3MidPtsAroundNodesUnderground(double ratio, const mcIdType *nodeIdsBg, const mcIdType *nodeIdsEnd);
361 DataArrayIdType *internalColinearize2D(double eps, bool stayConform);
362 template<class MAPCLS>
363 void renumberNodesInConnT(const MAPCLS& newNodeNumbersO2N);
365 MEDCOUPLING_EXPORT static DataArrayIdType *ComputeRangesFromTypeDistribution(const std::vector<mcIdType>& code);
366 MEDCOUPLING_EXPORT static const int N_MEDMEM_ORDER=25;
367 MEDCOUPLING_EXPORT static const INTERP_KERNEL::NormalizedCellType MEDMEM_ORDER[N_MEDMEM_ORDER];
371 DataArrayIdType *_nodal_connec;
372 DataArrayIdType *_nodal_connec_index;
373 std::set<INTERP_KERNEL::NormalizedCellType> _types;
375 static double EPS_FOR_POLYH_ORIENTATION;
378 class MEDCouplingUMeshCell;
380 class MEDCouplingUMeshCellIterator
383 MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh);
384 MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator(MEDCouplingUMesh *mesh, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end);
385 MEDCOUPLING_EXPORT ~MEDCouplingUMeshCellIterator();
386 MEDCOUPLING_EXPORT MEDCouplingUMeshCell *nextt();
388 MEDCouplingUMesh *_mesh;
389 MEDCouplingUMeshCell *_cell;
395 class MEDCouplingUMeshCellByTypeIterator;
397 class MEDCouplingUMeshCellByTypeEntry
400 MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeEntry(MEDCouplingUMesh *mesh);
401 MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeIterator *iterator();
402 MEDCOUPLING_EXPORT ~MEDCouplingUMeshCellByTypeEntry();
404 MEDCouplingUMesh *_mesh;
407 class MEDCouplingUMeshCellEntry
410 MEDCOUPLING_EXPORT MEDCouplingUMeshCellEntry(MEDCouplingUMesh *mesh, INTERP_KERNEL::NormalizedCellType type, MEDCouplingUMeshCell *itc, mcIdType bg, mcIdType end);
411 MEDCOUPLING_EXPORT ~MEDCouplingUMeshCellEntry();
412 MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getType() const;
413 MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const;
414 MEDCOUPLING_EXPORT MEDCouplingUMeshCellIterator *iterator();
416 MEDCouplingUMesh *_mesh;
417 INTERP_KERNEL::NormalizedCellType _type;
418 MEDCouplingUMeshCell *_itc;
423 class MEDCouplingUMeshCellByTypeIterator
426 MEDCOUPLING_EXPORT MEDCouplingUMeshCellByTypeIterator(MEDCouplingUMesh *mesh);
427 MEDCOUPLING_EXPORT ~MEDCouplingUMeshCellByTypeIterator();
428 MEDCOUPLING_EXPORT MEDCouplingUMeshCellEntry *nextt();
430 MEDCouplingUMesh *_mesh;
431 MEDCouplingUMeshCell *_cell;
436 class MEDCouplingUMeshCell
439 MEDCOUPLING_EXPORT MEDCouplingUMeshCell(MEDCouplingUMesh *mesh);
440 MEDCOUPLING_EXPORT void next();
441 MEDCOUPLING_EXPORT std::string repr() const;
442 MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getType() const;
443 MEDCOUPLING_EXPORT const mcIdType *getAllConn(mcIdType& lgth) const;
446 mcIdType *_conn_indx;
448 static const int NOTICABLE_FIRST_VAL=-7;
451 template<typename T, typename TOUT>
452 class UMeshGenIterator : public std::iterator< std::input_iterator_tag, const TOUT *, mcIdType, const TOUT **, const TOUT *>
454 std::size_t _num = 0;
455 std::vector<const MEDCouplingUMesh *> *_data = nullptr;
456 using my_reference = typename std::iterator< std::input_iterator_tag, const TOUT *, mcIdType, const TOUT **, const TOUT *>::reference;
458 explicit UMeshGenIterator(std::size_t num , std::vector<const MEDCouplingUMesh *> *data) : _num(num),_data(data) {}
459 UMeshGenIterator<T,TOUT>& operator++() { ++_num; return *this; }
460 bool operator==(const UMeshGenIterator& other) const { return _num == other._num; }
461 bool operator!=(const UMeshGenIterator& other) const { return !(*this == other); }
462 my_reference operator*() const { T tt; return tt((*_data)[_num]); }
465 struct UMeshIndexConnectivityFunctor { const DataArrayIdType *operator()(const MEDCouplingUMesh *um) { return um->getNodalConnectivityIndex(); } };
467 using UMeshConnectivityIndexIterator = UMeshGenIterator<UMeshIndexConnectivityFunctor,DataArrayIdType>;
469 struct UMeshConnectivityFunctor { const DataArrayIdType *operator()(const MEDCouplingUMesh *um) { return um->getNodalConnectivity(); } };
471 using UMeshConnectivityIterator = UMeshGenIterator<UMeshConnectivityFunctor,DataArrayIdType>;
473 struct UMeshCoordsFunctor { const DataArrayDouble *operator()(const MEDCouplingUMesh *um) { return um->getCoords(); } };
475 using UMeshCoordsIterator = UMeshGenIterator<UMeshCoordsFunctor,DataArrayDouble>;