Back to index

salome-med  6.5.0
MEDCouplingField.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_MEDCOUPLINGFIELD_HXX__
00021 #define __PARAMEDMEM_MEDCOUPLINGFIELD_HXX__
00022 
00023 #include "MEDCoupling.hxx"
00024 #include "MEDCouplingTimeLabel.hxx"
00025 #include "MEDCouplingNatureOfField.hxx"
00026 #include "MEDCouplingRefCountObject.hxx"
00027 #include "NormalizedUnstructuredMesh.hxx"
00028 #include "InterpKernelException.hxx"
00029 
00030 #include <string>
00031 #include <vector>
00032 
00033 namespace ParaMEDMEM
00034 {
00035   class DataArrayInt;
00036   class DataArrayDouble;
00037   class MEDCouplingMesh;
00038   class MEDCouplingFieldDouble;
00039   class MEDCouplingFieldDiscretization;
00040   class MEDCouplingGaussLocalization;
00041 
00042   class MEDCOUPLING_EXPORT MEDCouplingField : public RefCountObject, public TimeLabel
00043   {
00044   public:
00045     virtual void checkCoherency() const throw(INTERP_KERNEL::Exception) = 0;
00046     virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
00047     virtual bool areStrictlyCompatible(const MEDCouplingField *other) const;
00048     virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
00049     virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
00050     void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh);
00051     const ParaMEDMEM::MEDCouplingMesh *getMesh() const { return _mesh; }
00052     void setName(const char *name) { _name=name; }
00053     const char *getDescription() const { return _desc.c_str(); }
00054     void setDescription(const char *desc) { _desc=desc; }
00055     const char *getName() const { return _name.c_str(); }
00056     TypeOfField getTypeOfField() const;
00057     NatureOfField getNature() const;
00058     virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
00059     DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
00060     MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
00061     MEDCouplingMesh *buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const;
00062     MEDCouplingFieldDiscretization *getDiscretization() const { return _type; }
00063     int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
00064     int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
00065     // Gauss point specific methods
00066     void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
00067                                     const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
00068     void setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector<double>& refCoo,
00069                                      const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
00070     void clearGaussLocalizations();
00071     MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
00072     int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
00073     int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
00074     int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
00075     void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const throw(INTERP_KERNEL::Exception);
00076     const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
00077   protected:
00078     void updateTime() const;
00079   protected:
00080     MEDCouplingField(TypeOfField type);
00081     MEDCouplingField(const MEDCouplingField& other);
00082     MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature=NoNature);
00083     virtual ~MEDCouplingField();
00084   protected:
00085     std::string _name;
00086     std::string _desc;
00087     NatureOfField _nature;
00088     const MEDCouplingMesh *_mesh;
00089     MEDCouplingFieldDiscretization *_type;
00090   };
00091 }
00092 
00093 #endif