Back to index

salome-med  6.5.0
CellModel.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 __CELLMODEL_INTERP_KERNEL_HXX__
00021 #define __CELLMODEL_INTERP_KERNEL_HXX__
00022 
00023 #include "INTERPKERNELDefines.hxx"
00024 
00025 #include "NormalizedUnstructuredMesh.hxx"
00026 
00027 #include <map>
00028 
00029 namespace INTERP_KERNEL
00030 {
00034   class CellModel
00035   {
00036   public:
00037     static const unsigned MAX_NB_OF_SONS=8;
00038     static const unsigned MAX_NB_OF_NODES_PER_ELEM=30;
00039   private:
00040     CellModel(NormalizedCellType type);
00041     static void buildUniqueInstance();
00042   public:
00043     INTERPKERNEL_EXPORT static const CellModel& GetCellModel(NormalizedCellType type);
00044     INTERPKERNEL_EXPORT const char *getRepr() const;
00045     INTERPKERNEL_EXPORT bool isExtruded() const { return _is_extruded; }
00046     INTERPKERNEL_EXPORT bool isDynamic() const { return _dyn; }
00047     INTERPKERNEL_EXPORT bool isQuadratic() const { return _quadratic; }
00048     INTERPKERNEL_EXPORT unsigned getDimension() const { return _dim; }
00049     INTERPKERNEL_EXPORT bool isCompatibleWith(NormalizedCellType type) const;
00050     INTERPKERNEL_EXPORT bool isSimplex() const { return _is_simplex; }
00052     INTERPKERNEL_EXPORT const unsigned *getNodesConstituentTheSon(unsigned sonId) const { return _sons_con[sonId]; }
00053     INTERPKERNEL_EXPORT bool getOrientationStatus(unsigned lgth, const int *conn1, const int *conn2) const;
00054     INTERPKERNEL_EXPORT unsigned getNumberOfNodes() const { return _nb_of_pts; }
00055     INTERPKERNEL_EXPORT unsigned getNumberOfSons() const { return _nb_of_sons; }
00056     INTERPKERNEL_EXPORT unsigned getNumberOfSons2(const int *conn, int lgth) const;
00057     INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nb_of_sons_con[sonId]; }
00058     INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const int *nodalConn, int lgth) const;
00059     INTERPKERNEL_EXPORT NormalizedCellType getExtrudedType() const { return _extruded_type; }
00060     INTERPKERNEL_EXPORT NormalizedCellType getLinearType() const { return _linear_type; }
00061     INTERPKERNEL_EXPORT NormalizedCellType getQuadraticType() const { return _quadratic_type; }
00062     INTERPKERNEL_EXPORT NormalizedCellType getSonType(unsigned sonId) const { return _sons_type[sonId]; }
00063     INTERPKERNEL_EXPORT NormalizedCellType getSonType2(unsigned sonId) const;
00064     INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const;
00065     INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const;
00066   private:
00067     bool _dyn;
00068     bool _quadratic;
00069     bool _is_simplex;
00070     bool _is_extruded;
00071     unsigned _dim;
00072     unsigned _nb_of_pts;
00073     unsigned _nb_of_sons;
00074     NormalizedCellType _type;
00075     NormalizedCellType _extruded_type;
00076     NormalizedCellType _linear_type;
00077     NormalizedCellType _quadratic_type;
00078     unsigned _sons_con[MAX_NB_OF_SONS][MAX_NB_OF_NODES_PER_ELEM];
00079     unsigned _nb_of_sons_con[MAX_NB_OF_SONS];
00080     NormalizedCellType _sons_type[MAX_NB_OF_SONS];
00081     static std::map<NormalizedCellType,CellModel> _map_of_unique_instance;
00082     static const char *CELL_TYPES_REPR[];
00083   };
00084 }
00085 
00086 #endif