void PolyhedronIntersectorP0P1<MyMeshType,MyMatrix>::intersectCells(ConnType targetCell, const std::vector<ConnType>& srcCells, MyMatrix& res)
{
SplitterTetra<MyMeshType>* subTetras[24];
- int nbOfNodesT=Intersector3D<MyMeshType,MyMatrix>::_target_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(targetCell));
releaseArrays();
- _split.splitTargetCell(targetCell,nbOfNodesT,_tetra);
+ _split.splitTargetCell2(targetCell,_tetra);
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
for(typename std::vector<SplitterTetra<MyMeshType>*>::iterator iter = _tetra.begin(); iter != _tetra.end(); ++iter)
double volume = tmp->intersectSourceCell(*iterCellS);
if(volume!=0.)
{
- typename MyMatrix::value_type& resRow=res[tmp->getId(0)];
+ int targetNodeId(tmp->getId(0));
+ if(targetNodeId<0)
+ {
+ std::ostringstream oss; oss << "PolyhedronIntersectorP0P1::intersectCells : On target cell #" << targetCell << " the splitting into tetra4 leads to the creation of an additional point that interacts with source cell Id #" << *iterCellS << " !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ typename MyMatrix::value_type& resRow=res[targetNodeId];
typename MyMatrix::value_type::const_iterator iterRes=resRow.find(OTT<ConnType,numPol>::indFC(*iterCellS));
if(iterRes==resRow.end())
resRow.insert(std::make_pair(OTT<ConnType,numPol>::indFC(*iterCellS),volume));
SplitterTetra(const MyMeshType& srcMesh, const double** tetraCorners, const typename MyMeshType::MyConnType *nodesId);
- SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12]);
+ SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn = 0);
~SplitterTetra();
void clearVolumesCache();
private:
- inline void checkIsOutside(const double* pt, bool* isOutside, const double errTol = DEFAULT_ABS_TOL) const;
- inline void checkIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol = DEFAULT_ABS_TOL) const;
+ inline static void CheckIsOutside(const double* pt, bool* isOutside, const double errTol = DEFAULT_ABS_TOL);
+ inline static void CheckIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol = DEFAULT_ABS_TOL);
inline void calculateNode(typename MyMeshType::MyConnType globalNodeNum);
inline void calculateNode2(typename MyMeshType::MyConnType globalNodeNum, const double* node);
inline void calculateVolume(TransformedTriangle& tri, const TriangleFaceKey& key);
* @param isOutside bool[8] which indicate the results of earlier checks.
*/
template<class MyMeshType>
- inline void SplitterTetra<MyMeshType>::checkIsOutside(const double* pt, bool* isOutside, const double errTol) const
+ inline void SplitterTetra<MyMeshType>::CheckIsOutside(const double* pt, bool* isOutside, const double errTol)
{
isOutside[0] = isOutside[0] && (pt[0] < errTol);
isOutside[1] = isOutside[1] && (pt[0] > (1.0-errTol) );
}
template<class MyMeshType>
- inline void SplitterTetra<MyMeshType>::checkIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol) const
+ inline void SplitterTetra<MyMeshType>::CheckIsStrictlyOutside(const double* pt, bool* isStrictlyOutside, const double errTol)
{
isStrictlyOutside[0] = isStrictlyOutside[0] && (pt[0] < -errTol);
isStrictlyOutside[1] = isStrictlyOutside[1] && (pt[0] > (1.0 + errTol));
* \param [in] tetraCorners array 4*3 doubles containing corners of input tetrahedron (P0X,P0Y,P0Y,P1X,P1Y,P1Z,P2X,P2Y,P2Z,P3X,P3Y,P3Z).
*/
template<class MyMeshType>
- SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12]): _t(0),_src_mesh(srcMesh)
+ SplitterTetra<MyMeshType>::SplitterTetra(const MyMeshType& srcMesh, const double tetraCorners[12], const int *conn): _t(0),_src_mesh(srcMesh)
{
- _conn[0]=0; _conn[1]=1; _conn[2]=2; _conn[3]=3;
+ if(!conn)
+ { _conn[0]=0; _conn[1]=1; _conn[2]=2; _conn[3]=3; }
+ else
+ { _conn[0]=conn[0]; _conn[1]=conn[1]; _conn[2]=conn[2]; _conn[3]=conn[3]; }
_coords[0]=tetraCorners[0]; _coords[1]=tetraCorners[1]; _coords[2]=tetraCorners[2]; _coords[3]=tetraCorners[3]; _coords[4]=tetraCorners[4]; _coords[5]=tetraCorners[5];
_coords[6]=tetraCorners[6]; _coords[7]=tetraCorners[7]; _coords[8]=tetraCorners[8]; _coords[9]=tetraCorners[9]; _coords[10]=tetraCorners[10]; _coords[11]=tetraCorners[11];
// create the affine transform
//std::cout << std::endl << "*** " << globalNodeNum << std::endl;
calculateNode(globalNodeNum);
}
-
- checkIsOutside(_nodes[globalNodeNum], isOutside);
+ CheckIsOutside(_nodes[globalNodeNum], isOutside);
}
// halfspace filtering check
calculateNode2(globalNodeNum, polyCoords[i]);
}
- checkIsStrictlyOutside(_nodes[globalNodeNum], isStrictlyOutside, precision);
- checkIsOutside(_nodes[globalNodeNum], isOutside, precision);
+ CheckIsStrictlyOutside(_nodes[globalNodeNum], isStrictlyOutside, precision);
+ CheckIsOutside(_nodes[globalNodeNum], isOutside, precision);
}
// halfspace filtering check
for(int i = 0;i<(int)nbOfNodes4Type;++i)
{
_t->apply(nodes[i], tetraCorners[i]);
- checkIsOutside(nodes[i], isOutside);
+ CheckIsOutside(nodes[i], isOutside);
}
// halfspace filtering check
SplitIntoTetras(_splitting_pol,gt,cellConn,refConn+_target_mesh.getConnectivityIndexPtr()[targetCell+1],coords,tetrasNodalConn,addCoords);
std::size_t nbTetras(tetrasNodalConn.size()/4); tetra.resize(nbTetras);
double tmp[12];
+ int tmp2[4];
for(std::size_t i=0;i<nbTetras;i++)
{
for(int j=0;j<4;j++)
{
int cellId(tetrasNodalConn[4*i+j]);
+ tmp2[j]=cellId;
if(cellId>=0)
{
tmp[j*3+0]=coords[3*cellId+0];
tmp[j*3+2]=addCoords[3*(-cellId-1)+2];
}
}
- tetra[i]=new SplitterTetra<MyMeshTypeS>(_src_mesh,tmp);
+ tetra[i]=new SplitterTetra<MyMeshTypeS>(_src_mesh,tmp,tmp2);
}
}