}
}
else
- {
+ {// for HEXA and GENERAL_24 no need to use subsplitting into dual mesh
for(typename std::vector<ConnType>::const_iterator iterCellS=srcCells.begin();iterCellS!=srcCells.end();iterCellS++)
{
releaseArrays();
ConnType nbOfNodesS=Intersector3D<MyMeshType,MyMatrix>::_src_mesh.getNumberOfNodesOfElement(OTT<ConnType,numPol>::indFC(*iterCellS));
- _split.splitTargetCell(*iterCellS,nbOfNodesS,_tetra);
+ _split.splitTargetCell2(*iterCellS,_tetra);
for(typename std::vector<SplitterTetra<MyMeshType>*>::const_iterator iter = _tetra.cbegin(); iter != _tetra.cend(); ++iter)
{
double volume = std::abs( (*iter)->intersectSourceCell(targetCell) );
// node #0 is for internal node node #1 is for the node at the middle of the face
- ConnType sourceNode0( (*iter)->getId(2) ), sourceNode1( (*iter)->getId(3) );
+ ConnType sourceNode0( (*iter)->getId(0) ), sourceNode1( (*iter)->getId(1) );
AddContributionInRow(resRow,OTT<ConnType,numPol>::indFC(sourceNode0),volume/2.);
AddContributionInRow(resRow,OTT<ConnType,numPol>::indFC(sourceNode1),volume/2.);
}
void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
void sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
void calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
+ void calculateGeneral24TetraOld(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
void calculateGeneral48Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
void splitPyram5(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);//to suppress
void splitConvex(typename MyMeshTypeT::MyConnType targetCell,//to suppress
inline const double* getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId);//to suppress
//template<int n>
inline void calcBarycenter(typename MyMeshTypeT::MyConnType n, double* barycenter, const int* pts);//to suppress
+ private:
+ void sixSplitGen(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra, std::function<void(SplitterTetra2& , typename MyMeshTypeS::MyConnType&, const double*&)> func);
+ void calculateGeneral24TetraGen(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra, std::function<void(SplitterTetra2& , typename MyMeshTypeS::MyConnType[4], const double*[4])> func);
private:
const MyMeshTypeT& _target_mesh;
const MyMeshTypeS& _src_mesh;
case GENERAL_24:
{
- calculateGeneral24Tetra(tetra);
+ calculateGeneral24TetraOld(tetra);
}
break;
}
}
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
+ {
+ sixSplitGen(subZone,tetra,[](SplitterTetra2& obj, typename MyMeshTypeS::MyConnType& conn, const double *&coords)
+ {
+ typename MyMeshTypeS::MyConnType realConn;
+ coords = obj.getCoordsOfSubNode2(conn,realConn);
+ conn = realConn;
+ });
+ }
+
/**
* Splits the hexahedron into six tetrahedra.
* This method adds six SplitterTetra objects to the vector tetra.
* splitting to be reused on the subzones of the GENERAL_* types of splitting
*/
template<class MyMeshTypeT, class MyMeshTypeS>
- void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::sixSplitGen(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra, std::function<void(SplitterTetra2& , typename MyMeshTypeS::MyConnType&, const double*&)> func)
{
for(int i = 0; i < 6; ++i)
{
for(int j = 0; j < 4; ++j)
{
conn[j] = subZone[SPLIT_NODES_6[4*i+j]];
- typename MyMeshTypeS::MyConnType realConn;
- nodes[j] = getCoordsOfSubNode2(conn[j],realConn);
- conn[j] = realConn;
+ func(*this,conn[j],nodes[j]);
}
SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
}
}
+ /**
+ * Version of calculateGeneral24Tetra connectivity aware for P1P0 and P0P1
+ */
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
+ {
+ calculateGeneral24TetraGen(tetra,[](SplitterTetra2& obj, typename MyMeshTypeS::MyConnType conn[4], const double* nodes[4]) {
+ typename MyMeshTypeS::MyConnType realConn;
+ nodes[2] = obj.getCoordsOfSubNode2(conn[2],realConn); conn[2] = realConn;
+ nodes[3] = obj.getCoordsOfSubNode2(conn[3],realConn); conn[3] = realConn;
+ });
+ }
+
+ /*!
+ * Version for 3D2DP0P0
+ */
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calculateGeneral24TetraOld(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
+ {
+ calculateGeneral24TetraGen(tetra,[](SplitterTetra2& obj, typename MyMeshTypeS::MyConnType conn[4], const double* nodes[4]) {
+ nodes[2] = obj.getCoordsOfSubNode(conn[2]);
+ nodes[3] = obj.getCoordsOfSubNode(conn[3]);
+ });
+ }
+
/**
* Splits the hexahedron into 24 tetrahedra.
* The splitting is done by combining the barycenter of the tetrahedron, the barycenter of each face
* and the nodes of each edge of the face. This creates 6 faces * 4 edges / face = 24 tetrahedra.
* The submesh nodes introduced are the barycenters of the faces and the barycenter of the cell.
- *
*/
template<class MyMeshTypeT, class MyMeshTypeS>
- void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calculateGeneral24TetraGen(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra, std::function<void(SplitterTetra2& , typename MyMeshTypeS::MyConnType[4], const double*[4])> func)
{
// The two nodes of the original mesh cell used in each tetrahedron.
// The tetrahedra all have nodes (cellCenter, faceCenter, edgeNode1, edgeNode2)
typename MyMeshTypeS::MyConnType conn[4];
// get the cell center
conn[0] = 14;
- typename MyMeshTypeS::MyConnType realConn;
nodes[0] = getCoordsOfSubNode(conn[0]);
for(int faceCenterNode = 8; faceCenterNode < 14; ++faceCenterNode)
const int row = 4*(faceCenterNode - 8) + j;
conn[2] = TETRA_EDGES_GENERAL_24[2*row];
conn[3] = TETRA_EDGES_GENERAL_24[2*row + 1];
- nodes[2] = getCoordsOfSubNode2(conn[2],realConn); conn[2] = realConn;
- nodes[3] = getCoordsOfSubNode2(conn[3],realConn); conn[3] = realConn;
-
+ func(*this,conn,nodes);
SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes, conn);
tetra.push_back(t);
}
}
}
-
/**
* Splits the hexahedron into 48 tetrahedra.
* The splitting is done by introducing the midpoints of all the edges
{
for(int i = 0; i < 8; ++i)
{
- sixSplit(GENERAL_48_SUBZONES+8*i,tetra);
+ sixSplitGen(GENERAL_48_SUBZONES+8*i,tetra,[](SplitterTetra2& obj, typename MyMeshTypeS::MyConnType& conn, const double *&coords){
+ coords = obj.getCoordsOfSubNode(conn);
+ });
}
}
expectedMatrix0 = [{10: 503624.09065889206, 11: 100868.41855508549, 12: 503863.42469772906, 13: 100629.0845162416, 14: 100629.08451623631, 15: 503863.4246977626, 16: 100868.418555101, 17: 503624.0906588909}]
expectedMatrix1 = [{10: 604492.509213978, 11: 201736.8371101737, 12: 201736.83711016813, 13: 201497.50307132734, 14: 201258.16903247262, 15: 201497.50307133005, 16: 604492.5092140044, 17: 201258.16903247265}]
- expectedMatrix2 = [{10: 251707.3366874401, 11: 252036.42099087787, 12: 302440.7135135655, 13: 302051.7957004154, 14: 302081.71245527605, 15: 302410.79675872216, 16: 352815.0892814113, 17: 352426.17146825284}]
+ expectedMatrix2 = [{10: 302066.754077835, 11: 302425.7551361466, 12: 302425.7551361466, 13: 302066.754077835, 14: 302066.7540778395, 15: 302425.7551361595, 16: 302425.7551361595, 17: 302066.75407783955}]
for sp,expectedMatrix in [ (PLANAR_FACE_5,expectedMatrix0),(PLANAR_FACE_6,expectedMatrix1),(GENERAL_24,expectedMatrix2)]:
remap = MEDCouplingRemapper()
remap.setSplittingPolicy( sp )