From: eap Date: Tue, 29 Dec 2009 14:33:04 +0000 (+0000) Subject: (EHPOC) Interpolators X-Git-Tag: V5_1_main_FINAL~262 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=00e3e3ad649132d916586211e02f4a9f6e135f2a;p=tools%2Fmedcoupling.git (EHPOC) Interpolators enable SplitterTetra2 to work with meshes of different natures - template + template class SplitterTetra2 --- diff --git a/src/INTERP_KERNEL/SplitterTetra.hxx b/src/INTERP_KERNEL/SplitterTetra.hxx index 2f731076c..23d52f886 100644 --- a/src/INTERP_KERNEL/SplitterTetra.hxx +++ b/src/INTERP_KERNEL/SplitterTetra.hxx @@ -323,32 +323,32 @@ namespace INTERP_KERNEL _volumes.insert(std::make_pair(key, vol)); } - template + template class SplitterTetra2 { public: - SplitterTetra2(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy); + SplitterTetra2(const MyMeshTypeT& targetMesh, const MyMeshTypeS& srcMesh, SplittingPolicy policy); ~SplitterTetra2(); void releaseArrays(); - void splitTargetCell(typename MyMeshType::MyConnType targetCell, typename MyMeshType::MyConnType nbOfNodesT, - typename std::vector< SplitterTetra* >& tetra); - void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra); - void sixSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra); - void calculateGeneral24Tetra(typename std::vector< SplitterTetra* >& tetra); - void calculateGeneral48Tetra(typename std::vector< SplitterTetra* >& tetra); - void calculateSubNodes(const MyMeshType& targetMesh, typename MyMeshType::MyConnType targetCell); - inline const double* getCoordsOfSubNode(typename MyMeshType::MyConnType node); - inline const double* getCoordsOfSubNode2(typename MyMeshType::MyConnType node, typename MyMeshType::MyConnType& nodeId); + void splitTargetCell(typename MyMeshTypeT::MyConnType targetCell, typename MyMeshTypeT::MyConnType nbOfNodesT, + typename std::vector< SplitterTetra* >& tetra); + void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra); + void sixSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra); + void calculateGeneral24Tetra(typename std::vector< SplitterTetra* >& tetra); + void calculateGeneral48Tetra(typename std::vector< SplitterTetra* >& tetra); + void calculateSubNodes(const MyMeshTypeT& targetMesh, typename MyMeshTypeT::MyConnType targetCell); + inline const double* getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node); + inline const double* getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId); template - inline void calcBarycenter(double* barycenter, const typename MyMeshType::MyConnType* pts); + inline void calcBarycenter(double* barycenter, const typename MyMeshTypeT::MyConnType* pts); private: - const MyMeshType& _target_mesh; - const MyMeshType& _src_mesh; + const MyMeshTypeT& _target_mesh; + const MyMeshTypeS& _src_mesh; SplittingPolicy _splitting_pol; /// vector of pointers to double[3] containing the coordinates of the /// (sub) - nodes of split target cell std::vector _nodes; - std::vector _node_ids; + std::vector _node_ids; }; /** @@ -358,9 +358,9 @@ namespace INTERP_KERNEL * @param barycenter pointer to double[3] array in which to store the result * @param pts pointer to int[n] array containing the (sub)-nodes for which to calculate the barycenter */ - template + template template - inline void SplitterTetra2::calcBarycenter(double* barycenter, const typename MyMeshType::MyConnType* pts) + inline void SplitterTetra2::calcBarycenter(double* barycenter, const typename MyMeshTypeT::MyConnType* pts) { barycenter[0] = barycenter[1] = barycenter[2] = 0.0; for(int i = 0; i < n ; ++i) @@ -382,8 +382,8 @@ namespace INTERP_KERNEL * @param node local number of the (sub)-node 0,..,7 are the elements nodes, sub-nodes are numbered from 8,.. * @return pointer to double[3] containing the coordinates of the nodes */ - template - inline const double* SplitterTetra2::getCoordsOfSubNode(typename MyMeshType::MyConnType node) + template + inline const double* SplitterTetra2::getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node) { // replace "at()" with [] for unsafe but faster access return _nodes.at(node); @@ -396,8 +396,8 @@ namespace INTERP_KERNEL * @param nodeId is an output that is node id in target whole mesh in C mode. * @return pointer to double[3] containing the coordinates of the nodes */ - template - const double* SplitterTetra2::getCoordsOfSubNode2(typename MyMeshType::MyConnType node, typename MyMeshType::MyConnType& nodeId) + template + const double* SplitterTetra2::getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId) { const double *ret=_nodes.at(node); if(node<8) diff --git a/src/INTERP_KERNEL/SplitterTetra.txx b/src/INTERP_KERNEL/SplitterTetra.txx index 18569a411..8b64a415b 100644 --- a/src/INTERP_KERNEL/SplitterTetra.txx +++ b/src/INTERP_KERNEL/SplitterTetra.txx @@ -403,20 +403,20 @@ namespace INTERP_KERNEL //////////////////////////////////////////////////////// - template - SplitterTetra2::SplitterTetra2(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy):_target_mesh(targetMesh),_src_mesh(srcMesh), - _splitting_pol(policy) + template + SplitterTetra2::SplitterTetra2(const MyMeshTypeT& targetMesh, const MyMeshTypeS& srcMesh, SplittingPolicy policy) + :_target_mesh(targetMesh),_src_mesh(srcMesh),_splitting_pol(policy) { } - template - SplitterTetra2::~SplitterTetra2() + template + SplitterTetra2::~SplitterTetra2() { releaseArrays(); } - template - void SplitterTetra2::releaseArrays() + template + void SplitterTetra2::releaseArrays() { // free potential sub-mesh nodes that have been allocated if(_nodes.size()>=8) @@ -435,12 +435,13 @@ namespace INTERP_KERNEL * @param targetCell in C mode. * @param tetra is the output result tetra containers. */ - template - void SplitterTetra2::splitTargetCell(typename MyMeshType::MyConnType targetCell, typename MyMeshType::MyConnType nbOfNodesT, - typename std::vector< SplitterTetra* >& tetra) + template + void SplitterTetra2::splitTargetCell(typename MyMeshTypeT::MyConnType targetCell, + typename MyMeshTypeT::MyConnType nbOfNodesT, + typename std::vector< SplitterTetra* >& tetra) { - typedef typename MyMeshType::MyConnType ConnType; - const NumberingPolicy numPol=MyMeshType::My_numPol; + typedef typename MyMeshTypeT::MyConnType ConnType; + const NumberingPolicy numPol=MyMeshTypeT::My_numPol; const int numTetra = static_cast(_splitting_pol); if(nbOfNodesT==4) { @@ -454,7 +455,7 @@ namespace INTERP_KERNEL nodes[node]=getCoordsOfNode2(node, OTT::indFC(targetCell),_target_mesh,conn[node]); } std::copy(conn,conn+4,_node_ids.begin()); - SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); tetra.push_back(t); return ; } @@ -504,8 +505,8 @@ namespace INTERP_KERNEL * @param subZone the local node numbers corresponding to the hexahedron corners - these are mapped onto {0,..,7}. Providing this allows the * splitting to be reused on the subzones of the GENERAL_* types of splitting */ - template - void SplitterTetra2::fiveSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra) + template + void SplitterTetra2::fiveSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra) { // Schema according to which the splitting is performed. // Each line represents one tetrahedron. The numbering is as follows : @@ -539,7 +540,7 @@ namespace INTERP_KERNEL { nodes[j] = getCoordsOfSubNode2(subZone[ SPLIT_NODES_5[4*i+j] ],conn[j]); } - SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); tetra.push_back(t); } } @@ -551,8 +552,8 @@ namespace INTERP_KERNEL * @param subZone the local node numbers corresponding to the hexahedron corners - these are mapped onto {0,..,7}. Providing this allows the * splitting to be reused on the subzones of the GENERAL_* types of splitting */ - template - void SplitterTetra2::sixSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra) + template + void SplitterTetra2::sixSplit(const int* const subZone, typename std::vector< SplitterTetra* >& tetra) { // Schema according to which the splitting is performed. // Each line represents one tetrahedron. The numbering is as follows : @@ -585,7 +586,7 @@ namespace INTERP_KERNEL { nodes[j] = getCoordsOfSubNode2(subZone[ SPLIT_NODES_6[4*i+j] ],conn[j]); } - SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes,conn); tetra.push_back(t); } } @@ -597,8 +598,8 @@ namespace INTERP_KERNEL * The submesh nodes introduced are the barycenters of the faces and the barycenter of the cell. * */ - template - void SplitterTetra2::calculateGeneral24Tetra(typename std::vector< SplitterTetra* >& tetra) + template + void SplitterTetra2::calculateGeneral24Tetra(typename std::vector< SplitterTetra* >& tetra) { // The two nodes of the original mesh cell used in each tetrahedron. // The tetrahedra all have nodes (cellCenter, faceCenter, edgeNode1, edgeNode2) @@ -653,7 +654,7 @@ namespace INTERP_KERNEL nodes[2] = getCoordsOfSubNode2(TETRA_EDGES[2*row],conn[2]); nodes[3] = getCoordsOfSubNode2(TETRA_EDGES[2*row + 1],conn[3]); - SplitterTetra* t = new SplitterTetra(_src_mesh, nodes, conn); + SplitterTetra* t = new SplitterTetra(_src_mesh, nodes, conn); tetra.push_back(t); } } @@ -668,8 +669,8 @@ namespace INTERP_KERNEL * is done by calling sixSplit(). * */ - template - void SplitterTetra2::calculateGeneral48Tetra(typename std::vector< SplitterTetra* >& tetra) + template + void SplitterTetra2::calculateGeneral48Tetra(typename std::vector< SplitterTetra* >& tetra) { // Define 8 hexahedral subzones as in Grandy, p449 // the values correspond to the nodes that correspond to nodes 1,2,3,4,5,6,7,8 in the subcell @@ -703,8 +704,8 @@ namespace INTERP_KERNEL * @param policy the splitting policy of the object * */ - template - void SplitterTetra2::calculateSubNodes(const MyMeshType& targetMesh, typename MyMeshType::MyConnType targetCell) + template + void SplitterTetra2::calculateSubNodes(const MyMeshTypeT& targetMesh, typename MyMeshTypeT::MyConnType targetCell) { // retrieve real mesh nodes _node_ids.resize(8);