Back to index

salome-med  6.5.0
MEDCouplingCMesh.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__
00021 #define __PARAMEDMEM_MEDCOUPLINGCMESH_HXX__
00022 
00023 #include "MEDCoupling.hxx"
00024 #include "MEDCouplingMesh.hxx"
00025 
00026 namespace ParaMEDMEM
00027 {
00028   class DataArrayDouble;
00029   class MEDCouplingUMesh;
00030 
00031   class MEDCOUPLING_EXPORT MEDCouplingCMesh : public MEDCouplingMesh
00032   {
00033   public:
00034     static MEDCouplingCMesh *New();
00035     MEDCouplingMesh *deepCpy() const;
00036     MEDCouplingCMesh *clone(bool recDeepCpy) const;
00037     void updateTime() const;
00038     MEDCouplingMeshType getType() const { return CARTESIAN; }
00039     void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
00040     bool isEqual(const MEDCouplingMesh *other, double prec) const;
00041     bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const;
00042     void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
00043                               DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception);
00044     void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
00045                                          DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception);
00046     void checkCoherency() const throw(INTERP_KERNEL::Exception);
00047     void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
00048     void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
00049     int getNumberOfCells() const;
00050     int getNumberOfNodes() const;
00051     int getSpaceDimension() const;
00052     int getMeshDimension() const;
00053     int getCellIdFromPos(int i, int j, int k) const;
00054     int getNodeIdFromPos(int i, int j, int k) const;
00055     static void GetPosFromId(int nodeId, int spaceDim, const int *split, int *res);
00056     INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
00057     std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
00058     int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
00059     void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
00060     void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception);
00061     std::string simpleRepr() const;
00062     std::string advancedRepr() const;
00063     const DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception);
00064     DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception);
00065     void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
00066     void setCoords(const DataArrayDouble *coordsX,
00067                    const DataArrayDouble *coordsY=0,
00068                    const DataArrayDouble *coordsZ=0);
00069     // tools
00070     std::vector<int> getDistributionOfTypes() const throw(INTERP_KERNEL::Exception);
00071     DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
00072     void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
00073     MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
00074     MEDCouplingMesh *buildPart(const int *start, const int *end) const;
00075     MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const;
00076     DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
00077     void getBoundingBox(double *bbox) const;
00078     MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
00079     MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
00080     MEDCouplingFieldDouble *buildOrthogonalField() const;
00081     int getCellContainingPoint(const double *pos, double eps) const;
00082     void rotate(const double *center, const double *vector, double angle);
00083     void translate(const double *vector);
00084     void scale(const double *point, double factor);
00085     MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
00086     DataArrayDouble *getCoordinatesAndOwner() const;
00087     DataArrayDouble *getBarycenterAndOwner() const;
00088     void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
00089     void fill1DUnstructuredMesh(MEDCouplingUMesh *m) const;
00090     void fill2DUnstructuredMesh(MEDCouplingUMesh *m) const;
00091     void fill3DUnstructuredMesh(MEDCouplingUMesh *m) const;
00092     //some useful methods
00093     void getSplitCellValues(int *res) const;
00094     void getSplitNodeValues(int *res) const;
00095     //serialisation-unserialization
00096     void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
00097     void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
00098     void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
00099     void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
00100                          const std::vector<std::string>& littleStrings);
00101   private:
00102     MEDCouplingCMesh();
00103     MEDCouplingCMesh(const MEDCouplingCMesh& other, bool deepCpy);
00104     ~MEDCouplingCMesh();
00105     void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception);
00106     std::string getVTKDataSetType() const throw(INTERP_KERNEL::Exception);
00107   private:
00108     DataArrayDouble *_x_array;
00109     DataArrayDouble *_y_array;
00110     DataArrayDouble *_z_array;
00111   };
00112 }
00113 
00114 #endif