X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingField.hxx;h=86ac44a114414374262a5776483a49c5929e037a;hb=8f2a28585bcf231a8f976f36b7fb1d2eed8801c2;hp=c8e880a7765e9b7cb9e9045a77412a94be5663a5;hpb=48782c06022ca2caa36f849cb5a29ea4fe2aaa83;p=tools%2Fmedcoupling.git diff --git a/src/MEDCoupling/MEDCouplingField.hxx b/src/MEDCoupling/MEDCouplingField.hxx index c8e880a77..86ac44a11 100644 --- a/src/MEDCoupling/MEDCouplingField.hxx +++ b/src/MEDCoupling/MEDCouplingField.hxx @@ -1,60 +1,106 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// Copyright (C) 2007-2020 CEA/DEN, EDF R&D // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// Author : Anthony Geay (CEA/DEN) + #ifndef __PARAMEDMEM_MEDCOUPLINGFIELD_HXX__ #define __PARAMEDMEM_MEDCOUPLINGFIELD_HXX__ -#include "RefCountObject.hxx" +#include "MEDCoupling.hxx" +#include "MEDCouplingTimeLabel.hxx" +#include "MEDCouplingNatureOfField.hxx" +#include "MEDCouplingRefCountObject.hxx" +#include "NormalizedUnstructuredMesh.hxx" +#include "MCAuto.hxx" +#include "MEDCouplingFieldDiscretization.hxx" #include "InterpKernelException.hxx" #include +#include -namespace ParaMEDMEM +namespace MEDCoupling { + class DataArrayIdType; + class DataArrayDouble; class MEDCouplingMesh; + class MEDCouplingFieldDouble; + class MEDCouplingGaussLocalization; - class MEDCouplingField : public RefCountObject + class MEDCouplingField : public RefCountObject, public TimeLabel { public: - virtual void checkCoherency() const throw(INTERP_KERNEL::Exception) = 0; - void setMesh(MEDCouplingMesh *mesh); - void setTime(double val) { _time=val; } - double getTime() const { return _time; } - void setDtIt(int dt, int it) { _dt=dt; _it=it; } - void getDtIt(int& dt, int& it) { dt=_dt; it=_it; } - MEDCouplingMesh *getMesh() const { return _mesh; } - void setName(const char *name) { _name=name; } - void setDescription(const char *desc) { _desc=desc; } - const char *getName() const { return _name.c_str(); } - TypeOfField getEntity() const { return _type; } - protected: - void updateTime(); + MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const; + MEDCOUPLING_EXPORT virtual bool areCompatibleForMerge(const MEDCouplingField *other) const; + MEDCOUPLING_EXPORT virtual bool areStrictlyCompatible(const MEDCouplingField *other) const; + MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const; + MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingField *other); + MEDCOUPLING_EXPORT void setMesh(const MEDCoupling::MEDCouplingMesh *mesh); + MEDCOUPLING_EXPORT const MEDCoupling::MEDCouplingMesh *getMesh() const { return _mesh; } + MEDCOUPLING_EXPORT MEDCoupling::MEDCouplingMesh *getMesh() { return const_cast(_mesh); } + MEDCOUPLING_EXPORT void setName(const std::string& name) { _name=name; } + MEDCOUPLING_EXPORT std::string getDescription() const { return _desc; } + MEDCOUPLING_EXPORT void setDescription(const std::string& desc) { _desc=desc; } + MEDCOUPLING_EXPORT std::string getName() const { return _name; } + MEDCOUPLING_EXPORT TypeOfField getTypeOfField() const; + MEDCOUPLING_EXPORT NatureOfField getNature() const; + MEDCOUPLING_EXPORT virtual void setNature(NatureOfField nat); + MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscr() const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const mcIdType *startCellIds, const mcIdType *endCellIds) const; + MEDCOUPLING_EXPORT const MEDCouplingFieldDiscretization *getDiscretization() const { return _type; } + MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *getDiscretization() { return _type; } + MEDCOUPLING_EXPORT void setDiscretization(MEDCouplingFieldDiscretization *newDisc); + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpected() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlacesExpected() const; + // Gauss point specific methods + MEDCOUPLING_EXPORT void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector& refCoo, + const std::vector& gsCoo, const std::vector& wg); + MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const mcIdType *begin, const mcIdType *end, const std::vector& refCoo, + const std::vector& gsCoo, const std::vector& wg); + MEDCOUPLING_EXPORT void clearGaussLocalizations(); + MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(int locId); + MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT std::set getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const; + MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const; + MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector& cellIds) const; + MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const; + MEDCOUPLING_EXPORT void updateTime() const; + MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; + MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; + // for MED file RW + MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector& code, const std::vector& idsPerType) const; + MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0; protected: - MEDCouplingField(TypeOfField type):_time(0.),_dt(-1),_it(-1),_mesh(0),_type(type) { } - virtual ~MEDCouplingField(); + MEDCOUPLING_EXPORT MEDCouplingField(TypeOfField type); + MEDCOUPLING_EXPORT MEDCouplingField(const MEDCouplingField& other, bool deepCopy=true); + MEDCOUPLING_EXPORT MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature=NoNature); + MEDCOUPLING_EXPORT virtual ~MEDCouplingField(); + MEDCOUPLING_EXPORT bool isEqualIfNotWhyProtected(const MEDCouplingField *other, double meshPrec, std::string& reason) const; + MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrProtected(const MEDCouplingField *other, double meshPrec) const; protected: std::string _name; std::string _desc; - double _time; - int _dt; - int _it; - MEDCouplingMesh *_mesh; - const TypeOfField _type; + NatureOfField _nature; + const MEDCouplingMesh *_mesh; + MCAuto _type; }; }