_volumes.insert(std::make_pair(key, vol));
}
- template<class MyMeshType>
+ template<class MyMeshTypeT, class MyMeshTypeS=MyMeshTypeT>
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<MyMeshType>* >& tetra);
- void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshType>* >& tetra);
- void sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshType>* >& tetra);
- void calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshType>* >& tetra);
- void calculateGeneral48Tetra(typename std::vector< SplitterTetra<MyMeshType>* >& 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<MyMeshTypeS>* >& tetra);
+ void fiveSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
+ void sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
+ void calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra);
+ void calculateGeneral48Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& 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<int n>
- 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<const double*> _nodes;
- std::vector<typename MyMeshType::MyConnType> _node_ids;
+ std::vector<typename MyMeshTypeT::MyConnType> _node_ids;
};
/**
* @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<class MyMeshType>
+ template<class MyMeshTypeT, class MyMeshTypeS>
template<int n>
- inline void SplitterTetra2<MyMeshType>::calcBarycenter(double* barycenter, const typename MyMeshType::MyConnType* pts)
+ inline void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calcBarycenter(double* barycenter, const typename MyMeshTypeT::MyConnType* pts)
{
barycenter[0] = barycenter[1] = barycenter[2] = 0.0;
for(int i = 0; i < n ; ++i)
* @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<class MyMeshType>
- inline const double* SplitterTetra2<MyMeshType>::getCoordsOfSubNode(typename MyMeshType::MyConnType node)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ inline const double* SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::getCoordsOfSubNode(typename MyMeshTypeT::MyConnType node)
{
// replace "at()" with [] for unsafe but faster access
return _nodes.at(node);
* @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<class MyMeshType>
- const double* SplitterTetra2<MyMeshType>::getCoordsOfSubNode2(typename MyMeshType::MyConnType node, typename MyMeshType::MyConnType& nodeId)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ const double* SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::getCoordsOfSubNode2(typename MyMeshTypeT::MyConnType node, typename MyMeshTypeT::MyConnType& nodeId)
{
const double *ret=_nodes.at(node);
if(node<8)
////////////////////////////////////////////////////////
- template<class MyMeshType>
- SplitterTetra2<MyMeshType>::SplitterTetra2(const MyMeshType& targetMesh, const MyMeshType& srcMesh, SplittingPolicy policy):_target_mesh(targetMesh),_src_mesh(srcMesh),
- _splitting_pol(policy)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::SplitterTetra2(const MyMeshTypeT& targetMesh, const MyMeshTypeS& srcMesh, SplittingPolicy policy)
+ :_target_mesh(targetMesh),_src_mesh(srcMesh),_splitting_pol(policy)
{
}
- template<class MyMeshType>
- SplitterTetra2<MyMeshType>::~SplitterTetra2()
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::~SplitterTetra2()
{
releaseArrays();
}
- template<class MyMeshType>
- void SplitterTetra2<MyMeshType>::releaseArrays()
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::releaseArrays()
{
// free potential sub-mesh nodes that have been allocated
if(_nodes.size()>=8)
* @param targetCell in C mode.
* @param tetra is the output result tetra containers.
*/
- template<class MyMeshType>
- void SplitterTetra2<MyMeshType>::splitTargetCell(typename MyMeshType::MyConnType targetCell, typename MyMeshType::MyConnType nbOfNodesT,
- typename std::vector< SplitterTetra<MyMeshType>* >& tetra)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::splitTargetCell(typename MyMeshTypeT::MyConnType targetCell,
+ typename MyMeshTypeT::MyConnType nbOfNodesT,
+ typename std::vector< SplitterTetra<MyMeshTypeS>* >& 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<int>(_splitting_pol);
if(nbOfNodesT==4)
{
nodes[node]=getCoordsOfNode2(node, OTT<ConnType,numPol>::indFC(targetCell),_target_mesh,conn[node]);
}
std::copy(conn,conn+4,_node_ids.begin());
- SplitterTetra<MyMeshType>* t = new SplitterTetra<MyMeshType>(_src_mesh, nodes,conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
return ;
}
* @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<class MyMeshType>
- void SplitterTetra2<MyMeshType>::fiveSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshType>* >& tetra)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::fiveSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
{
// Schema according to which the splitting is performed.
// Each line represents one tetrahedron. The numbering is as follows :
{
nodes[j] = getCoordsOfSubNode2(subZone[ SPLIT_NODES_5[4*i+j] ],conn[j]);
}
- SplitterTetra<MyMeshType>* t = new SplitterTetra<MyMeshType>(_src_mesh, nodes,conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
}
}
* @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<class MyMeshType>
- void SplitterTetra2<MyMeshType>::sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshType>* >& tetra)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::sixSplit(const int* const subZone, typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
{
// Schema according to which the splitting is performed.
// Each line represents one tetrahedron. The numbering is as follows :
{
nodes[j] = getCoordsOfSubNode2(subZone[ SPLIT_NODES_6[4*i+j] ],conn[j]);
}
- SplitterTetra<MyMeshType>* t = new SplitterTetra<MyMeshType>(_src_mesh, nodes,conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes,conn);
tetra.push_back(t);
}
}
* The submesh nodes introduced are the barycenters of the faces and the barycenter of the cell.
*
*/
- template<class MyMeshType>
- void SplitterTetra2<MyMeshType>::calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshType>* >& tetra)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calculateGeneral24Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& tetra)
{
// The two nodes of the original mesh cell used in each tetrahedron.
// The tetrahedra all have nodes (cellCenter, faceCenter, edgeNode1, edgeNode2)
nodes[2] = getCoordsOfSubNode2(TETRA_EDGES[2*row],conn[2]);
nodes[3] = getCoordsOfSubNode2(TETRA_EDGES[2*row + 1],conn[3]);
- SplitterTetra<MyMeshType>* t = new SplitterTetra<MyMeshType>(_src_mesh, nodes, conn);
+ SplitterTetra<MyMeshTypeS>* t = new SplitterTetra<MyMeshTypeS>(_src_mesh, nodes, conn);
tetra.push_back(t);
}
}
* is done by calling sixSplit().
*
*/
- template<class MyMeshType>
- void SplitterTetra2<MyMeshType>::calculateGeneral48Tetra(typename std::vector< SplitterTetra<MyMeshType>* >& tetra)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calculateGeneral48Tetra(typename std::vector< SplitterTetra<MyMeshTypeS>* >& 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
* @param policy the splitting policy of the object
*
*/
- template<class MyMeshType>
- void SplitterTetra2<MyMeshType>::calculateSubNodes(const MyMeshType& targetMesh, typename MyMeshType::MyConnType targetCell)
+ template<class MyMeshTypeT, class MyMeshTypeS>
+ void SplitterTetra2<MyMeshTypeT, MyMeshTypeS>::calculateSubNodes(const MyMeshTypeT& targetMesh, typename MyMeshTypeT::MyConnType targetCell)
{
// retrieve real mesh nodes
_node_ids.resize(8);