Back to index

salome-med  6.5.0
MEDCouplingUMeshDesc.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_MEDCOUPLINGUMESHDESC_HXX__
00021 #define __PARAMEDMEM_MEDCOUPLINGUMESHDESC_HXX__
00022 
00023 #include "MEDCouplingPointSet.hxx"
00024 #include "MEDCoupling.hxx"
00025 #include "NormalizedUnstructuredMesh.hxx"
00026 
00027 #include <set>
00028 
00029 namespace ParaMEDMEM
00030 {
00031   class MEDCouplingUMeshDesc : public MEDCouplingPointSet
00032   {
00033   public:
00034     MEDCOUPLING_EXPORT static MEDCouplingUMeshDesc *New();
00035     MEDCOUPLING_EXPORT static MEDCouplingUMeshDesc *New(const char *meshName, int meshDim);
00036     MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const;
00037     MEDCOUPLING_EXPORT void checkCoherency() const throw(INTERP_KERNEL::Exception);
00038     MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
00039     MEDCOUPLING_EXPORT void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception);
00040     MEDCOUPLING_EXPORT void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
00041                                                  DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception);
00042     MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
00043                                                             DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception);
00044     MEDCOUPLING_EXPORT void setMeshDimension(unsigned meshDim);
00045     MEDCOUPLING_EXPORT int getNumberOfCells() const;
00046     MEDCOUPLING_EXPORT int getNumberOfFaces() const;
00047     MEDCOUPLING_EXPORT int getCellMeshLength() const;
00048     MEDCOUPLING_EXPORT int getFaceMeshLength() const;
00049     MEDCOUPLING_EXPORT int getMeshDimension() const { return _mesh_dim; }
00050     MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
00051     MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
00052     MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
00053     MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
00054     MEDCOUPLING_EXPORT std::string simpleRepr() const;
00055     MEDCOUPLING_EXPORT std::string advancedRepr() const;
00056     MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED_DESC; }
00057     MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *descConn, DataArrayInt *descConnIndex, DataArrayInt *nodalFaceConn, DataArrayInt *nodalFaceConnIndx);
00058     //tools to overload
00059     MEDCOUPLING_EXPORT std::vector<int> getDistributionOfTypes() const throw(INTERP_KERNEL::Exception);
00060     MEDCOUPLING_EXPORT DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
00061     MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& idsInPflPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
00062     MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
00063     MEDCOUPLING_EXPORT bool isEmptyMesh(const std::vector<int>& tinyInfo) const;
00064     MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
00065     MEDCOUPLING_EXPORT void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const;
00066     MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings);
00067     MEDCOUPLING_EXPORT void getCellsInBoundingBox(const double *bbox, double eps, std::vector<int>& elems) const;
00068     MEDCOUPLING_EXPORT void getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox &bbox, double eps, std::vector<int>& elems);
00069     MEDCOUPLING_EXPORT DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes);
00070     MEDCOUPLING_EXPORT DataArrayInt *mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes);
00071     MEDCOUPLING_EXPORT void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
00072     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelf(const int *start, const int *end, bool keepCoords) const;
00073     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildPartOfMySelfNode(const int *start, const int *end, bool fullyIn) const;
00074     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const;
00075     MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
00076     MEDCOUPLING_EXPORT void findBoundaryNodes(std::vector<int>& nodes) const;
00077     MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const;
00078     MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
00079     MEDCOUPLING_EXPORT void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
00080     MEDCOUPLING_EXPORT void renumberNodes(const int *newNodeNumbers, int newNbOfNodes);
00081     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureField(bool isAbs) const;
00082     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const;
00083     MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
00084     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
00085     MEDCOUPLING_EXPORT DataArrayInt *zipCoordsTraducer();
00086     MEDCOUPLING_EXPORT MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const;
00087     MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const;
00088   private:
00089     MEDCouplingUMeshDesc();
00090     ~MEDCouplingUMeshDesc();
00091     void computeTypes();
00092     void checkFullyDefined() const throw(INTERP_KERNEL::Exception);
00093     void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData) const throw(INTERP_KERNEL::Exception);
00094     std::string getVTKDataSetType() const throw(INTERP_KERNEL::Exception);
00095   private:
00096     int _mesh_dim;
00097     DataArrayInt *_desc_connec;
00098     DataArrayInt *_desc_connec_index;
00099     DataArrayInt *_nodal_connec_face;
00100     DataArrayInt *_nodal_connec_face_index;
00101     std::set<INTERP_KERNEL::NormalizedCellType> _types;
00102   };
00103 }
00104 
00105 #endif