00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PARAMEDMEM_MEDCOUPLINGMESH_HXX__
00021 #define __PARAMEDMEM_MEDCOUPLINGMESH_HXX__
00022
00023 #include "MEDCoupling.hxx"
00024 #include "MEDCouplingTimeLabel.hxx"
00025 #include "MEDCouplingRefCountObject.hxx"
00026 #include "NormalizedUnstructuredMesh.hxx"
00027 #include "InterpKernelException.hxx"
00028
00029 #include <set>
00030 #include <vector>
00031
00032 namespace ParaMEDMEM
00033 {
00034 typedef enum
00035 {
00036 UNSTRUCTURED = 5,
00037 UNSTRUCTURED_DESC = 6,
00038 CARTESIAN = 7,
00039 EXTRUDED = 8
00040 } MEDCouplingMeshType;
00041
00042 class DataArrayInt;
00043 class DataArrayDouble;
00044 class MEDCouplingUMesh;
00045 class MEDCouplingFieldDouble;
00046
00047 class MEDCOUPLING_EXPORT MEDCouplingMesh : public RefCountObject, public TimeLabel
00048 {
00049 public:
00050 void setName(const char *name) { _name=name; }
00051 const char *getName() const { return _name.c_str(); }
00052 void setDescription(const char *descr) { _description=descr; }
00053 const char *getDescription() const { return _description.c_str(); }
00054 double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; }
00055 void setTime(double val, int iteration, int order) { _time=val; _iteration=iteration; _order=order; }
00056 void setTimeUnit(const char *unit) { _time_unit=unit; }
00057 const char *getTimeUnit() const { return _time_unit.c_str(); }
00058 virtual MEDCouplingMesh *deepCpy() const = 0;
00059 virtual MEDCouplingMeshType getType() const = 0;
00060 bool isStructured() const;
00061 virtual void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
00062 virtual void copyTinyInfoFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
00063
00064 virtual bool isEqual(const MEDCouplingMesh *other, double prec) const;
00065 virtual bool isEqualWithoutConsideringStr(const MEDCouplingMesh *other, double prec) const = 0;
00066 virtual void checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
00067 DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception) = 0;
00068 virtual void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
00069 DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception) = 0;
00070 virtual void checkFastEquivalWith(const MEDCouplingMesh *other, double prec) const throw(INTERP_KERNEL::Exception);
00071 void checkGeoEquivalWith(const MEDCouplingMesh *other, int levOfCheck, double prec,
00072 DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const throw(INTERP_KERNEL::Exception);
00073
00074 virtual void checkCoherency() const throw(INTERP_KERNEL::Exception) = 0;
00075 virtual void checkCoherency1(double eps=1e-12) const throw(INTERP_KERNEL::Exception) = 0;
00076 virtual void checkCoherency2(double eps=1e-12) const throw(INTERP_KERNEL::Exception) = 0;
00077 virtual int getNumberOfCells() const = 0;
00078 virtual int getNumberOfNodes() const = 0;
00079 virtual int getSpaceDimension() const = 0;
00080 virtual int getMeshDimension() const = 0;
00081 virtual DataArrayDouble *getCoordinatesAndOwner() const = 0;
00082 virtual DataArrayDouble *getBarycenterAndOwner() const = 0;
00083 virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
00084 virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0;
00085 virtual std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const = 0;
00086 virtual void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const = 0;
00087 virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const;
00088 virtual void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const = 0;
00089 virtual std::string simpleRepr() const = 0;
00090 virtual std::string advancedRepr() const = 0;
00091
00092 virtual DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception) = 0;
00093 virtual void splitProfilePerType(const DataArrayInt *profile, std::vector<int>& code, std::vector<DataArrayInt *>& globIdsPerType, std::vector<DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception) = 0;
00094 virtual void getBoundingBox(double *bbox) const = 0;
00095 virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const = 0;
00096 virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0;
00097 virtual int getCellContainingPoint(const double *pos, double eps) const = 0;
00098 virtual void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
00099 virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, std::vector<int>& elts, std::vector<int>& eltsIndex) const;
00100 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const;
00101 virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const;
00102 virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const;
00103 virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const;
00104 virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0;
00105 virtual void rotate(const double *center, const double *vector, double angle) = 0;
00106 virtual void translate(const double *vector) = 0;
00107 virtual void scale(const double *point, double factor) = 0;
00108 virtual void renumberCells(const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception) = 0;
00109 virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const = 0;
00110 virtual MEDCouplingMesh *buildPart(const int *start, const int *end) const = 0;
00111 virtual MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const = 0;
00112 virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception) = 0;
00113 virtual DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception) = 0;
00114 virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
00115 static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
00116
00117 virtual void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const = 0;
00118 virtual void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const = 0;
00119 virtual void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const = 0;
00120 virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
00121 const std::vector<std::string>& littleStrings) = 0;
00122 protected:
00123 MEDCouplingMesh();
00124 MEDCouplingMesh(const MEDCouplingMesh& other);
00125 virtual ~MEDCouplingMesh() { }
00126 private:
00127 std::string _name;
00128 std::string _description;
00129 double _time;
00130 int _iteration;
00131 int _order;
00132 std::string _time_unit;
00133 };
00134 }
00135
00136 #endif