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 __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__
22 #define __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__
24 #include "MEDCoupling.hxx"
25 #include "MEDCouplingStructuredMesh.hxx"
29 class DataArrayDouble;
30 class MEDCouplingUMesh;
32 class MEDCOUPLING_EXPORT MEDCouplingCMesh : public MEDCouplingStructuredMesh
35 static MEDCouplingCMesh *New();
36 static MEDCouplingCMesh *New(const char *meshName);
37 MEDCouplingMesh *deepCpy() const;
38 MEDCouplingCMesh *clone(bool recDeepCpy) const;
39 void updateTime() const;
40 std::size_t getHeapMemorySize() const;
41 MEDCouplingMeshType getType() const { return CARTESIAN; }
42 void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
43 bool isEqualIfNotWhy(const MEDCouplingMesh *other, double prec, std::string& reason) const throw(INTERP_KERNEL::Exception);
44 bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
45 void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
46 DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception);
47 void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
48 DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception);
49 void checkCoherency() const throw(INTERP_KERNEL::Exception);
50 void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
51 void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
52 int getNumberOfCells() const;
53 int getNumberOfNodes() const;
54 int getSpaceDimension() const;
55 int getMeshDimension() const;
56 void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception);
57 std::string simpleRepr() const;
58 std::string advancedRepr() const;
59 const DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception);
60 DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception);
61 void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
62 void setCoords(const DataArrayDouble *coordsX,
63 const DataArrayDouble *coordsY=0,
64 const DataArrayDouble *coordsZ=0);
66 void getBoundingBox(double *bbox) const;
67 MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
68 MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
69 int getCellContainingPoint(const double *pos, double eps) const;
70 void rotate(const double *center, const double *vector, double angle);
71 void translate(const double *vector);
72 void scale(const double *point, double factor);
73 MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
74 DataArrayDouble *getCoordinatesAndOwner() const;
75 DataArrayDouble *getBarycenterAndOwner() const;
76 DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
77 void renumberCells(const int *old2NewBg, bool check=true) throw(INTERP_KERNEL::Exception);
79 void getSplitCellValues(int *res) const;
80 void getSplitNodeValues(int *res) const;
81 void getNodeGridStructure(int *res) const;
82 std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
83 MEDCouplingStructuredMesh *buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const throw(INTERP_KERNEL::Exception);
84 //serialisation-unserialization
85 void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
86 void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
87 void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
88 void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
89 const std::vector<std::string>& littleStrings);
90 void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception);
93 MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy);
95 void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception);
96 std::string getVTKDataSetType() const throw(INTERP_KERNEL::Exception);
98 DataArrayDouble *_x_array;
99 DataArrayDouble *_y_array;
100 DataArrayDouble *_z_array;