--- /dev/null
+#include "CellModel.hxx"
+
+#include "InterpolationUtils.hxx"
+
+#include <sstream>
+
+using namespace std;
+
+namespace INTERP_KERNEL
+{
+ std::map<NormalizedCellType,CellModel> CellModel::_mapOfUniqueInstance;
+
+ const CellModel& CellModel::getCellModel(NormalizedCellType type)
+ {
+ if(_mapOfUniqueInstance.empty())
+ buildUniqueInstance();
+ const map<NormalizedCellType,CellModel>::iterator iter=_mapOfUniqueInstance.find(type);
+ if(iter==_mapOfUniqueInstance.end())
+ {
+ ostringstream stream; stream << "no cellmodel for normalized type " << type;
+ throw Exception(stream.str().c_str());
+ }
+ return (*iter).second;
+ }
+
+ void CellModel::buildUniqueInstance()
+ {
+ _mapOfUniqueInstance.insert(make_pair(NORM_TRI3,CellModel(NORM_TRI3)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_QUAD4,CellModel(NORM_QUAD4)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_TRI6,CellModel(NORM_TRI6)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_QUAD8,CellModel(NORM_QUAD8)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_TETRA4,CellModel(NORM_TETRA4)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_HEXA8,CellModel(NORM_HEXA8)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_PYRA5,CellModel(NORM_PYRA5)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_PENTA6,CellModel(NORM_PENTA6)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_TETRA10,CellModel(NORM_TETRA10)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_PYRA13,CellModel(NORM_PYRA13)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_PENTA15,CellModel(NORM_PENTA15)));
+ _mapOfUniqueInstance.insert(make_pair(NORM_HEXA20,CellModel(NORM_HEXA20)));
+ }
+
+ CellModel::CellModel(NormalizedCellType type)
+ {
+ switch(type)
+ {
+ case NORM_TETRA4:
+ {
+ _nbOfPts=4; _nbOfSons=4; _dim=3;
+ _sonsType[0]=NORM_TRI3; _sonsType[1]=NORM_TRI3; _sonsType[2]=NORM_TRI3; _sonsType[3]=NORM_TRI3;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _nbOfSonsCon[0]=3;
+ _sonsCon[1][0]=0; _sonsCon[1][1]=3; _sonsCon[1][2]=1; _nbOfSonsCon[1]=3;
+ _sonsCon[2][0]=1; _sonsCon[2][1]=3; _sonsCon[2][2]=2; _nbOfSonsCon[2]=3;
+ _sonsCon[3][0]=2; _sonsCon[3][1]=3; _sonsCon[3][2]=0; _nbOfSonsCon[3]=3;
+ }
+ break;
+ case NORM_HEXA8:
+ {
+ _nbOfPts=8; _nbOfSons=6; _dim=3;
+ _sonsType[0]=NORM_QUAD4; _sonsType[1]=NORM_QUAD4; _sonsType[2]=NORM_QUAD4; _sonsType[3]=NORM_QUAD4; _sonsType[4]=NORM_QUAD4; _sonsType[5]=NORM_QUAD4;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=3; _nbOfSonsCon[0]=4;
+ _sonsCon[1][0]=4; _sonsCon[1][1]=7; _sonsCon[1][2]=6; _sonsCon[1][3]=5; _nbOfSonsCon[1]=4;
+ _sonsCon[2][0]=0; _sonsCon[2][1]=4; _sonsCon[2][2]=5; _sonsCon[2][3]=1; _nbOfSonsCon[2]=4;
+ _sonsCon[3][0]=1; _sonsCon[3][1]=5; _sonsCon[3][2]=6; _sonsCon[3][3]=2; _nbOfSonsCon[3]=4;
+ _sonsCon[4][0]=2; _sonsCon[4][1]=6; _sonsCon[4][2]=7; _sonsCon[4][3]=3; _nbOfSonsCon[4]=4;
+ _sonsCon[5][0]=3; _sonsCon[5][1]=7; _sonsCon[5][2]=4; _sonsCon[5][3]=0; _nbOfSonsCon[5]=4;
+ }
+ break;
+ case NORM_QUAD4:
+ {
+ _nbOfPts=4; _nbOfSons=4; _dim=2;
+ _sonsType[0]=NORM_SEG2; _sonsType[1]=NORM_SEG2; _sonsType[2]=NORM_SEG2; _sonsType[3]=NORM_SEG2;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _nbOfSonsCon[0]=2;
+ _sonsCon[1][0]=1; _sonsCon[1][1]=2; _nbOfSonsCon[1]=2;
+ _sonsCon[2][0]=2; _sonsCon[2][1]=3; _nbOfSonsCon[2]=2;
+ _sonsCon[3][0]=3; _sonsCon[3][1]=0; _nbOfSonsCon[3]=2;
+ }
+ break;
+ case NORM_TRI3:
+ {
+ _nbOfPts=3; _nbOfSons=3; _dim=2;
+ _sonsType[0]=NORM_SEG2; _sonsType[1]=NORM_SEG2; _sonsType[2]=NORM_SEG2;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _nbOfSonsCon[0]=2;
+ _sonsCon[1][0]=1; _sonsCon[1][1]=2; _nbOfSonsCon[1]=2;
+ _sonsCon[2][0]=2; _sonsCon[2][1]=0; _nbOfSonsCon[2]=2;
+ }
+ break;
+ case NORM_TRI6:
+ {
+ _nbOfPts=6; _nbOfSons=3; _dim=2;
+ _sonsType[0]=NORM_SEG3; _sonsType[1]=NORM_SEG3; _sonsType[2]=NORM_SEG3;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=3; _nbOfSonsCon[0]=3;
+ _sonsCon[1][0]=1; _sonsCon[1][1]=2; _sonsCon[1][2]=4; _nbOfSonsCon[1]=3;
+ _sonsCon[2][0]=2; _sonsCon[2][1]=0; _sonsCon[2][2]=5; _nbOfSonsCon[2]=3;
+ }
+ break;
+ case NORM_QUAD8:
+ {
+ _nbOfPts=8; _nbOfSons=4; _dim=2;
+ _sonsType[0]=NORM_SEG3; _sonsType[1]=NORM_SEG3; _sonsType[2]=NORM_SEG3; _sonsType[3]=NORM_SEG3;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=4; _nbOfSonsCon[0]=3;
+ _sonsCon[1][0]=1; _sonsCon[1][1]=2; _sonsCon[1][2]=5; _nbOfSonsCon[1]=3;
+ _sonsCon[2][0]=2; _sonsCon[2][1]=3; _sonsCon[2][2]=6; _nbOfSonsCon[2]=3;
+ _sonsCon[3][0]=3; _sonsCon[3][1]=0; _sonsCon[3][2]=7; _nbOfSonsCon[3]=3;
+ }
+ break;
+ case NORM_PYRA5:
+ {
+ _nbOfPts=5; _nbOfSons=5; _dim=3;
+ _sonsType[0]=NORM_QUAD4; _sonsType[1]=NORM_TRI3; _sonsType[2]=NORM_TRI3; _sonsType[3]=NORM_TRI3; _sonsType[4]=NORM_TRI3;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=3; _nbOfSonsCon[0]=4;
+ _sonsCon[1][0]=0; _sonsCon[1][1]=4; _sonsCon[1][2]=1; _nbOfSonsCon[1]=3;
+ _sonsCon[2][0]=1; _sonsCon[2][1]=4; _sonsCon[2][2]=2; _nbOfSonsCon[2]=3;
+ _sonsCon[3][0]=2; _sonsCon[3][1]=4; _sonsCon[3][2]=3; _nbOfSonsCon[3]=3;
+ _sonsCon[4][0]=3; _sonsCon[4][1]=4; _sonsCon[4][2]=0; _nbOfSonsCon[4]=3;
+ }
+ break;
+ case NORM_PENTA6:
+ {
+ _nbOfPts=6; _nbOfSons=5; _dim=3;
+ _sonsType[0]=NORM_TRI3; _sonsType[1]=NORM_TRI3; _sonsType[2]=NORM_QUAD4; _sonsType[3]=NORM_QUAD4; _sonsType[4]=NORM_QUAD4;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _nbOfSonsCon[0]=3;
+ _sonsCon[1][0]=3; _sonsCon[1][1]=5; _sonsCon[1][2]=4; _nbOfSonsCon[1]=3;
+ _sonsCon[2][0]=0; _sonsCon[2][1]=3; _sonsCon[2][2]=4; _sonsCon[2][3]=1; _nbOfSonsCon[2]=4;
+ _sonsCon[3][0]=1; _sonsCon[3][1]=4; _sonsCon[3][2]=5; _sonsCon[3][3]=2; _nbOfSonsCon[3]=4;
+ _sonsCon[4][0]=2; _sonsCon[4][1]=4; _sonsCon[4][2]=5; _sonsCon[4][3]=0; _nbOfSonsCon[4]=4;
+ }
+ break;
+ case NORM_TETRA10:
+ {
+ _nbOfPts=10; _nbOfSons=4; _dim=3;
+ _sonsType[0]=NORM_TRI6; _sonsType[1]=NORM_TRI6; _sonsType[2]=NORM_TRI6; _sonsType[3]=NORM_TRI6;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=4; _sonsCon[0][4]=5; _sonsCon[0][5]=6; _nbOfSonsCon[0]=6;
+ _sonsCon[1][0]=0; _sonsCon[1][1]=3; _sonsCon[1][2]=1; _sonsCon[1][3]=7; _sonsCon[1][4]=8; _sonsCon[1][5]=4; _nbOfSonsCon[1]=6;
+ _sonsCon[2][0]=1; _sonsCon[2][1]=3; _sonsCon[2][2]=2; _sonsCon[2][3]=8; _sonsCon[2][4]=9; _sonsCon[2][5]=5; _nbOfSonsCon[2]=6;
+ _sonsCon[3][0]=2; _sonsCon[3][1]=3; _sonsCon[3][2]=0; _sonsCon[3][3]=9; _sonsCon[3][4]=7; _sonsCon[3][5]=6; _nbOfSonsCon[3]=6;
+ }
+ break;
+ case NORM_PYRA13:
+ {
+ _nbOfPts=13; _nbOfSons=5; _dim=3;
+ _sonsType[0]=NORM_QUAD8; _sonsType[1]=NORM_TRI6; _sonsType[2]=NORM_TRI6; _sonsType[3]=NORM_TRI6; _sonsType[4]=NORM_TRI6;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=3; _sonsCon[0][4]=5; _sonsCon[0][5]=6; _sonsCon[0][6]=7; _sonsCon[0][7]=8; _nbOfSonsCon[0]=8;
+ _sonsCon[1][0]=0; _sonsCon[1][1]=4; _sonsCon[1][2]=1; _sonsCon[1][3]=9; _sonsCon[1][4]=10; _sonsCon[1][5]=5; _nbOfSonsCon[1]=6;
+ _sonsCon[2][0]=1; _sonsCon[2][1]=4; _sonsCon[2][2]=2; _sonsCon[2][3]=10; _sonsCon[2][4]=11; _sonsCon[2][5]=6; _nbOfSonsCon[2]=6;
+ _sonsCon[3][0]=2; _sonsCon[3][1]=4; _sonsCon[3][2]=3; _sonsCon[3][3]=11; _sonsCon[3][4]=12; _sonsCon[3][5]=7; _nbOfSonsCon[3]=6;
+ _sonsCon[4][0]=3; _sonsCon[4][1]=4; _sonsCon[4][2]=0; _sonsCon[4][3]=12; _sonsCon[4][4]=9; _sonsCon[4][5]=8; _nbOfSonsCon[4]=6;
+ }
+ break;
+ case NORM_PENTA15:
+ {
+ _nbOfPts=15; _nbOfSons=5; _dim=3;
+ _sonsType[0]=NORM_TRI6; _sonsType[1]=NORM_TRI6; _sonsType[2]=NORM_QUAD8; _sonsType[3]=NORM_QUAD8; _sonsType[4]=NORM_QUAD8;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=6; _sonsCon[0][4]=7; _sonsCon[0][5]=8; _nbOfSonsCon[0]=6;
+ _sonsCon[1][0]=3; _sonsCon[1][1]=5; _sonsCon[1][2]=4; _sonsCon[1][3]=11; _sonsCon[1][4]=10; _sonsCon[1][5]=9; _nbOfSonsCon[1]=6;
+ _sonsCon[2][0]=0; _sonsCon[2][1]=3; _sonsCon[2][2]=4; _sonsCon[2][3]=1; _sonsCon[2][4]=12; _sonsCon[2][5]=9; _sonsCon[2][6]=13; _sonsCon[2][7]=6; _nbOfSonsCon[2]=8;
+ _sonsCon[3][0]=1; _sonsCon[3][1]=4; _sonsCon[3][2]=5; _sonsCon[3][3]=2; _sonsCon[3][4]=13; _sonsCon[3][5]=10; _sonsCon[3][6]=14; _sonsCon[3][7]=7; _nbOfSonsCon[3]=8;
+ _sonsCon[4][0]=2; _sonsCon[4][1]=4; _sonsCon[4][2]=5; _sonsCon[4][3]=0; _sonsCon[4][4]=14; _sonsCon[4][5]=11; _sonsCon[4][6]=12; _sonsCon[4][7]=8; _nbOfSonsCon[4]=8;
+ }
+ break;
+ case NORM_HEXA20:
+ {
+ _nbOfPts=20; _nbOfSons=6; _dim=3;
+ _sonsType[0]=NORM_QUAD8; _sonsType[1]=NORM_QUAD8; _sonsType[2]=NORM_QUAD8; _sonsType[3]=NORM_QUAD8; _sonsType[4]=NORM_QUAD8; _sonsType[5]=NORM_QUAD8;
+ _sonsCon[0][0]=0; _sonsCon[0][1]=1; _sonsCon[0][2]=2; _sonsCon[0][3]=3; _sonsCon[0][4]=8; _sonsCon[0][5]=9; _sonsCon[0][6]=10; _sonsCon[0][7]=11; _nbOfSonsCon[0]=8;
+ _sonsCon[1][0]=4; _sonsCon[1][1]=7; _sonsCon[1][2]=6; _sonsCon[1][3]=5; _sonsCon[1][4]=15; _sonsCon[1][5]=14; _sonsCon[1][6]=13; _sonsCon[1][7]=12; _nbOfSonsCon[1]=8;
+ _sonsCon[2][0]=0; _sonsCon[2][1]=4; _sonsCon[2][2]=5; _sonsCon[2][3]=1; _sonsCon[2][4]=16; _sonsCon[2][5]=12; _sonsCon[2][6]=17; _sonsCon[2][7]=8; _nbOfSonsCon[2]=8;
+ _sonsCon[3][0]=1; _sonsCon[3][1]=5; _sonsCon[3][3]=6; _sonsCon[3][3]=2; _sonsCon[3][4]=17; _sonsCon[3][5]=13; _sonsCon[3][6]=18; _sonsCon[3][7]=9;_nbOfSonsCon[3]=8;
+ _sonsCon[4][0]=2; _sonsCon[4][1]=6; _sonsCon[4][3]=7; _sonsCon[4][3]=3; _sonsCon[4][4]=18; _sonsCon[4][5]=14; _sonsCon[4][6]=19; _sonsCon[4][7]=10; _nbOfSonsCon[4]=8;
+ _sonsCon[5][0]=3; _sonsCon[5][1]=7; _sonsCon[5][3]=4; _sonsCon[5][3]=0; _sonsCon[5][4]=19; _sonsCon[5][5]=15; _sonsCon[5][6]=16; _sonsCon[5][7]=11; _nbOfSonsCon[5]=8;
+ }
+ break;
+ }
+ }
+
+ void CellModel::fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const
+ {
+ unsigned nbOfTurnLoop=_nbOfSonsCon[sonId];
+ const unsigned *sonConn=_sonsCon[sonId];
+ for(unsigned i=0;i<nbOfTurnLoop;i++)
+ sonNodalConn[i]=nodalConn[sonConn[i]];
+ }
+}
--- /dev/null
+#ifndef __CELLMODEL_INTERP_KERNEL_HXX__
+#define __CELLMODEL_INTERP_KERNEL_HXX__
+
+#include "NormalizedUnstructuredMesh.hxx"
+
+#include <map>
+
+namespace INTERP_KERNEL
+{
+ /*!
+ * This class descibes all static elements (different from polygons and polyhedron) 3D, 2D and 1D.
+ */
+ class CellModel
+ {
+ public:
+ static const unsigned MAX_NB_OF_SONS=6;
+ static const unsigned MAX_NB_OF_NODES_PER_ELEM=30;
+ private:
+ CellModel(NormalizedCellType type);
+ static void buildUniqueInstance();
+ public:
+ static const CellModel& getCellModel(NormalizedCellType type);
+ //! sonId is in C format.
+ unsigned getDimension() const { return _dim; }
+ const unsigned *getNodesConstituentTheSon(unsigned sonId) const { return _sonsCon[sonId]; }
+ unsigned getNumberOfNodes() const { return _nbOfPts; }
+ unsigned getNumberOfSons() const { return _nbOfSons; }
+ unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nbOfSonsCon[sonId]; }
+ NormalizedCellType getSonType(unsigned sonId) const { return _sonsType[sonId]; }
+ void fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const;
+ private:
+ unsigned _dim;
+ unsigned _nbOfPts;
+ unsigned _nbOfSons;
+ unsigned _sonsCon[MAX_NB_OF_SONS][MAX_NB_OF_NODES_PER_ELEM];
+ unsigned _nbOfSonsCon[MAX_NB_OF_SONS];
+ NormalizedCellType _sonsType[MAX_NB_OF_SONS];
+ static std::map<NormalizedCellType,CellModel> _mapOfUniqueInstance;
+ };
+}
+
+#endif
// Continue until the source region contains only one element, at which point the intersection volumes are
// calculated with all the remaining target mesh elements and stored in the matrix if they are non-zero.
- stack< RegionNode<ConnType>* > nodes;
+ std::stack< RegionNode<ConnType>* > nodes;
nodes.push(firstNode);
while(!nodes.empty())
- for(typename vector< MeshElement<ConnType>* >::const_iterator iter = currNode->getSrcRegion().getBeginElements() ;
+ for(typename std::vector< MeshElement<ConnType>* >::const_iterator iter = currNode->getSrcRegion().getBeginElements() ;
iter != currNode->getSrcRegion().getEndElements() ; ++iter)
{
LOG(5, " -- Adding source elements");
int numLeftElements = 0;
int numRightElements = 0;
- for(typename vector<MeshElement<ConnType>*>::const_iterator iter = currNode->getSrcRegion().getBeginElements() ;
+ for(typename std::vector<MeshElement<ConnType>*>::const_iterator iter = currNode->getSrcRegion().getBeginElements() ;
iter != currNode->getSrcRegion().getEndElements() ; ++iter)
{
LOG(6, " --- New target node");
/// pointers to the IntersectorTetra objects representing the tetrahedra
/// that result from the splitting of the hexahedron
- vector< IntersectorTetra<MyMeshType>* > _tetra;
+ std::vector< IntersectorTetra<MyMeshType>* > _tetra;
/// vector of pointers to double[3] containing the coordinates of the
/// (sub) - nodes
- vector<const double*> _nodes;
+ std::vector<const double*> _nodes;
};
#include "IntersectorTetra.hxx"
-using namespace MED_EN;
-using namespace MEDMEM;
-
namespace INTERP_KERNEL
{
template<class MyMeshType>
IntersectorHexa<MyMeshType>::~IntersectorHexa()
{
- for(typename vector< IntersectorTetra<MyMeshType>* >::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
+ for(typename std::vector< IntersectorTetra<MyMeshType>* >::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
delete *iter;
// free potential sub-mesh nodes that have been allocated
- vector<const double*>::iterator iter = _nodes.begin() + 8;
+ std::vector<const double*>::iterator iter = _nodes.begin() + 8;
while(iter != _nodes.end())
{
delete[] *iter;
double IntersectorHexa<MyMeshType>::intersectSourceCell(typename MyMeshType::MyConnType srcCell)
{
double volume = 0.0;
- for(typename vector<IntersectorTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
+ for(typename std::vector<IntersectorTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
volume += (*iter)->intersectSourceCell(srcCell);
return volume;
}
#include <map>
#include <ext/hash_map>
-#include "MEDMEM_define.hxx"
-#include "MEDMEM_CellModel.hxx"
-
using __gnu_cxx::hash_map;
namespace INTERP_KERNEL
#include "TransformedTriangle.hxx"
#include "MeshUtils.hxx"
#include "VectorUtils.hxx"
+#include "CellModel.hxx"
#include "Log.hxx"
#include <cmath>
#include <string>
#include <sstream>
-using namespace MEDMEM;
-using namespace MED_EN;
-
/// Smallest volume of the intersecting elements in the transformed space that will be returned as non-zero.
/// Since the scale is always the same in the transformed space (the target tetrahedron is unitary), this number is independent of the scale of the meshes.
#define SPARSE_TRUNCATION_LIMIT 1.0e-14
}
// get type of cell
- unsigned char nbOfNodes4Type = _srcMesh.getNumberOfNodesOfElement(element);
- // hack tony for the moment
-
- medGeometryElement type;
- if(nbOfNodes4Type==4)
- type=MED_EN::MED_TETRA4;
- else if(nbOfNodes4Type==8)
- type=MED_EN::MED_HEXA8;
- else
- std::cerr << "ca merde sec" << std::endl;
- ////const medGeometryElement type = _srcMesh.getNumberOfNodesOfElement(element);
-
- // get cell model for the element
- const CELLMODEL& cellModel= CELLMODEL_Map::retrieveCellModel(type);
-
+ NormalizedCellType normCellType=_srcMesh.getTypeOfElement(element);
+ const CellModel& cellModelCell=CellModel::getCellModel(normCellType);
+ unsigned nbOfNodes4Type=cellModelCell.getNumberOfNodes();
// halfspace filtering
bool isOutside[8] = {true, true, true, true, true, true, true, true};
bool isTargetOutside = false;
// calculate the coordinates of the nodes
+ int *cellNodes=new int[nbOfNodes4Type];
for(int i = 0;i<nbOfNodes4Type;++i)
{
// we could store mapping local -> global numbers too, but not sure it is worth it
const int globalNodeNum = getGlobalNumberOfNode(i, element, _srcMesh);
+ cellNodes[i]=globalNodeNum;
if(_nodes.find(globalNodeNum) == _nodes.end())
{
calculateNode(globalNodeNum);
if(!isTargetOutside)
{
- for(int i = 1 ; i <= cellModel.getNumberOfConstituents(1) ; ++i)
+ for(unsigned ii = 0 ; ii < cellModelCell.getNumberOfSons() ; ++ii)
{
- const medGeometryElement faceType = cellModel.getConstituentType(1, i);
- const CELLMODEL& faceModel= CELLMODEL_Map::retrieveCellModel(faceType);
-
+ NormalizedCellType faceType = cellModelCell.getSonType(ii);
+ const CellModel& faceModel=CellModel::getCellModel(faceType);
assert(faceModel.getDimension() == 2);
-
- int faceNodes[faceModel.getNumberOfNodes()];
-
- // get the nodes of the face
- for(int j = 1; j <= faceModel.getNumberOfNodes(); ++j)
- {
- const int locNodeNum = cellModel.getNodeConstituent(1, i, j);
- assert(locNodeNum >= 1);
- assert(locNodeNum <= cellModel.getNumberOfNodes());
-
- faceNodes[j-1] = getGlobalNumberOfNode(locNodeNum-1, element, _srcMesh);
- }
-
+ int *faceNodes=new int[faceModel.getNumberOfNodes()];
+ cellModelCell.fillSonCellNodalConnectivity(ii,cellNodes,faceNodes);
switch(faceType)
{
- case MED_EN::MED_TRIA3:
+ case NORM_TRI3:
{
// create the face key
TriangleFaceKey key = TriangleFaceKey(faceNodes[0], faceNodes[1], faceNodes[2]);
}
break;
- case MED_EN::MED_QUAD4:
+ case NORM_QUAD4:
// simple triangulation of faces along a diagonal :
//
std::cout << "+++ Error : Only elements with triangular and quadratilateral faces are supported at the moment." << std::endl;
assert(false);
}
+ delete [] faceNodes;
}
}
-
+ delete [] cellNodes;
// reset if it is very small to keep the matrix sparse
// is this a good idea?
if(epsilonEqual(totalVolume, 0.0, SPARSE_TRUNCATION_LIMIT))
TransformedTriangle_math.cxx\
BoundingBox.cxx\
TetraAffineTransform.cxx\
+CellModel.cxx \
Remapper.cxx \
PointLocator.cxx
* Returns the global number of the node of an element.
* (1 <= node <= no. nodes of element)
*
- * @param node the node for which the global number is sought (in numPol policy)
+ * @param node the node for which the global number is sought (ALWAYS in C mode)
* @param element an element of the mesh (in numPol policy)
* @param mesh a mesh
* @return the node's global number so that (its coordinates in the coordinates array are at [SPACEDIM*globalNumber, SPACEDIM*globalNumber + 2]
typedef enum
{
+ NORM_SEG2 = 1,
+ NORM_SEG3 = 2,
NORM_TRI3 = 3,
NORM_QUAD4 = 4,
NORM_POLYGON = 5,
NORM_TETRA4 = 14,
NORM_PYRA5 = 15,
NORM_PENTA6 = 16,
- NORM_HEXA8 = 18
+ NORM_HEXA8 = 18,
+ NORM_TETRA10 = 20,
+ NORM_PYRA13 = 23,
+ NORM_PENTA15 = 25,
+ NORM_HEXA20 = 30,
+ NORM_POLYHED = 31
} NormalizedCellType;
class GenericMesh
#ifndef _POINT_LOCATOR_ALGOS_TXX_
#define _POINT_LOCATOR_ALGOS_TXX_
-#include "MEDMEM_Exception.hxx"
#include "InterpolationUtils.hxx"
-#include "MEDMEM_CellModel.hxx"
+#include "CellModel.hxx"
#include "BBTree.txx"
#include <list>
{
typedef typename MyMeshType::MyConnType ConnType;
const NumberingPolicy numPol=MyMeshType::My_numPol;
- vector<ConnType> candidates;
+ std::vector<ConnType> candidates;
_tree->getElementsAroundPoint(x,candidates);
- list<ConnType> retlist;
- for (int i=0; i< candidates.size(); i++)
+ std::list<ConnType> retlist;
+ for(int i=0; i< candidates.size(); i++)
{
int ielem=candidates[i];
if (elementContainsPoint(ielem,x))
const ConnType* conn=_mesh.getConnectivityPtr();
const ConnType* conn_index= _mesh.getConnectivityIndexPtr();
const ConnType* conn_elem=conn+OTT<ConnType,numPol>::ind2C(conn_index[i]);
+ NormalizedCellType type=_mesh.getTypeOfElement(OTT<ConnType,numPol>::indFC(i));
+ const CellModel& cmType=CellModel::getCellModel(type);
-
- int nbnodes = conn_index[i+1]-conn_index[i];
+ int nbnodes = cmType.getNumberOfNodes();//conn_index[i+1]-conn_index[i];
// with dimension 2, it suffices to check all the edges
// and see if the sign of double products from the point
if (SPACEDIM==3)
{
- MED_EN::medGeometryElement elem_type;
- switch (nbnodes) {
- case 4 :
- elem_type=MED_EN::MED_TETRA4;
- break;
- case 5:
- elem_type=MED_EN::MED_PYRA5;
- break;
- case 6 :
- elem_type=MED_EN::MED_PENTA6;
- break;
- case 8:
- elem_type=MED_EN::MED_HEXA8;
- break;
- default:
- throw MEDMEM::MEDEXCEPTION("PointLocatorAlgos : bad number of nodes in 3D locator");
- }
- const MEDMEM::CELLMODEL& model=MEDMEM::CELLMODEL_Map::retrieveCellModel(elem_type);
- int nbfaces = model.getNumberOfConstituents(1);
+ int nbfaces = cmType.getNumberOfSons();
int sign[nbfaces];
for (int iface=0; iface<nbfaces; iface++)
{
- int* connface=model.getNodesConstituent(1,iface+1);
- const double* AA=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[0]-1]));
- const double* BB=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[1]-1]));
- const double* CC=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[2]-1]));
+ const unsigned* connface=cmType.getNodesConstituentTheSon(iface);
+ const double* AA=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[0]]));
+ const double* BB=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[1]]));
+ const double* CC=coords+SPACEDIM*(OTT<ConnType,numPol>::ind2C(conn_elem[connface[2]]));
double Vol=triple_product(AA,BB,CC,x);
if (Vol<-1e-12)
else
sign[iface]=0;
}
- return decide_from_sign(sign, nbfaces);
+ return decide_from_sign(sign, nbfaces);
}
}
min_sign=(sign[i]<min_sign)?sign[i]:min_sign;
max_sign=(sign[i]>max_sign)?sign[i]:max_sign;
}
- if (min_sign==-1 && max_sign==1)
- return false;
- else
- return true;
+ return (min_sign!=-1 || max_sign!=1);
}
};
}
#include <map>
#include <iostream>
-using namespace std;
-
namespace INTERP_KERNEL
{
template<int DIM>