Commit b4b3e7c8 authored by Sylvain Thery's avatar Sylvain Thery

simplification of gen version of algo, only one parameter

parent 0b6795ab
......@@ -44,134 +44,69 @@ namespace Geometry
* Pre: closed volume & embedded vertices
* Template param:
* PFP: as usual
* EMBV: attributes vector type or cell type (VertexCell, FaceCell, ...)
* EMB: type of attribute (Geom::Vec3f) or cell type (VertexCell, FaceCell, ...)
* V_ATT: attributes vector type or cell type (VertexCell, FaceCell, ...)
* @param map the map
* @param d a dart of the face
* @param attributs the vector of attribute or cell
*/
template <typename PFP, typename EMBV, typename EMB>
EMB volumeCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs, unsigned int thread = 0);
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE volumeCentroid(typename PFP::MAP& map, Dart d, const V_ATT& attributs, unsigned int thread = 0);
/**
* Compute volume centroid weighted by edge length (generic version)
* Pre: closed volume & embedded vertices
* Template param:
* PFP: as usual
* EMBV: attributes vector type or cell type (VertexCell, FaceCell, ...)
* EMB: type of attribute (Geom::Vec3f) or cell type (VertexCell, FaceCell, ...)
* V_ATT: attributes vector type or cell type (VertexCell, FaceCell, ...)
* @param map the map
* @param d a dart of the face
* @param attributs the vector of attribute or cell
*/
template <typename PFP, typename EMBV, typename EMB>
EMB volumeCentroidELWGen(typename PFP::MAP& map, Dart d, const EMBV& attributs, unsigned int thread = 0);
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE volumeCentroidELW(typename PFP::MAP& map, Dart d, const V_ATT& attributs, unsigned int thread = 0);
/**
* Compute volume centroid
* Pre: closed volume & embedded vertices
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute
*/
template <typename PFP>
inline typename PFP::VEC3 volumeCentroid(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, unsigned int thread = 0)
{
return volumeCentroidGen<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, d, position, thread);
}
/**
* Compute volume centroid weighted by edge length
* Pre: closed volume & embedded vertices
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute
*/
template <typename PFP>
inline typename PFP::VEC3 volumeCentroidELW(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position, unsigned int thread = 0)
{
return volumeCentroidELWGen<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, d, position, thread);
}
/**
* Compute face centroid (generic version)
* Template param:
* PFP: as usual
* EMBV: attributes vector type or cell type (VertexCell, FaceCell, ...)
* EMB: type of attribute (Geom::Vec3f) or cell type (VertexCell, FaceCell, ...)
* V_ATT: attributes vector type or cell type (VertexCell, FaceCell, ...)
* @param map the map
* @param d a dart of the face
* @param attributs the vector of attribute or cell
*/
template <typename PFP, typename EMBV, typename EMB>
EMB faceCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs);
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Dart d, const V_ATT& attributs);
/**
* Compute face centroid weighted by edge length (generic version)
* Template param:
* PFP: as usual
* EMBV: attributes vector type or cell type (VertexCell, FaceCell, ...)
* EMB: type of attribute (Geom::Vec3f) or cell type (VertexCell, FaceCell, ...)
* V_ATT: attributes vector type or cell type (VertexCell, FaceCell, ...)
* @param map the map
* @param d a dart of the face
* @param attributs the vector of attribute or cell
*/
template <typename PFP, typename EMBV, typename EMB>
EMB faceCentroidELWGen(typename PFP::MAP& map, Dart d, const EMBV& attributs);
/**
* Compute face centroid
* Pre: closed face & embedded vertices
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute
*/
template <typename PFP>
typename PFP::VEC3 faceCentroid(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
{
return faceCentroidGen<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, d, position);
}
/**
* Compute face centroid weighted by edge length
* Pre: closed face & embedded vertices
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute
*/
template <typename PFP>
typename PFP::VEC3 faceCentroidELW(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
{
return faceCentroidELWGen<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, d, position);
}
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Dart d, const V_ATT& attributs);
/**
* Compute vertex neighbours centroid (generic version)
* Template param:
* PFP: as usual
* EMBV: attributes vector type or cell type (VertexCell, FaceCell, ...)
* EMB: type of attribute (Geom::Vec3f) or cell type (VertexCell, FaceCell, ...)
* V_ATT: attributes vector type or cell type (VertexCell, FaceCell, ...)
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute or cell
*/
template <typename PFP, typename EMBV, typename EMB>
EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs);
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, const V_ATT& attributs);
/**
* Compute vertex neighbours centroid
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute
*/
template <typename PFP>
typename PFP::VEC3 vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
{
return vertexNeighborhoodCentroidGen<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, d, position);
}
/**
* Compute centroid of all faces
......@@ -180,10 +115,8 @@ typename PFP::VEC3 vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, co
* @param face_centroid centroid face attribute
* @param thread the thread id (default 0)
*/
template <typename PFP>
void computeCentroidFaces(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& face_centroid,
unsigned int thread = 0) ;
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread = 0);
/**
* Compute centroid of all faces (Edge Length Weighted)
......@@ -192,11 +125,9 @@ void computeCentroidFaces(typename PFP::MAP& map,
* @param face_centroid centroid face attribute
* @param thread the thread id (default 0)
*/
template <typename PFP>
void computeCentroidELWFaces(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& face_centroid,
unsigned int thread = 0) ;
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidELWFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread = 0) ;
/**
* Compute neighborhood centroid of all vertices
......@@ -205,10 +136,9 @@ void computeCentroidELWFaces(typename PFP::MAP& map,
* @param vertex_centroid centroid vertex attribute
* @param thread the thread id (default 0)
*/
template <typename PFP>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid,
unsigned int thread = 0) ;
template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT& vertex_centroid, unsigned int thread = 0) ;
namespace Parallel
......@@ -220,9 +150,9 @@ namespace Parallel
* @param face_centroid centroid face attribute
* @param nbth the number of threads
*/
template <typename PFP>
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidFaces(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& face_centroid,
const V_ATT& position, F_ATT& face_centroid,
unsigned int nbth = 0) ;
/**
......@@ -232,9 +162,9 @@ void computeCentroidFaces(typename PFP::MAP& map,
* @param face_centroid centroid face attribute
* @param nbth the number of threads
*/
template <typename PFP>
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidELWFaces(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& face_centroid,
const V_ATT& position, F_ATT& face_centroid,
unsigned int nbth = 0) ;
/**
......@@ -244,9 +174,9 @@ void computeCentroidELWFaces(typename PFP::MAP& map,
* @param vertex_centroid centroid vertex attribute
* @param nbth the number of threads
*/
template <typename PFP>
template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid,
const V_ATT& position, V_ATT& vertex_centroid,
unsigned int nbth = 0) ;
}
} // namespace Geometry
......@@ -260,26 +190,14 @@ namespace Geometry
* Compute vertex neighbours centroid in map of dimension 3(generic version)
* Template param:
* PFP: as usual
* EMBV: attributes vector type or cell type (VertexCell, FaceCell, ...)
* EMB: type of attribute (Geom::Vec3f) or cell type (VertexCell, FaceCell, ...)
* V_ATT: attributes vector type or cell type (VertexCell, FaceCell, ...)
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute or cell
*/
template <typename PFP, typename EMBV, typename EMB>
EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs);
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, const V_ATT& attributs);
/**
* Compute vertex neighbours centroid in map of dimension 3
* @param map the map
* @param d a dart of the face
* @param position the vector of attribute
*/
template <typename PFP>
typename PFP::VEC3 vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
{
return vertexNeighborhoodCentroidGen<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, d, position);
}
/**
* compute centroid of all volumes
......@@ -287,15 +205,13 @@ typename PFP::VEC3 vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, co
* @param position vertex attribute of position
* @param vol_centroid volume attribute where to store the centroids
*/
template <typename PFP>
void computeCentroidVolumes(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VolumeAttribute<typename PFP::VEC3>& vol_centroid,
unsigned int thread = 0) ;
template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT& vol_centroid, unsigned int thread = 0);
template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidELWVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT& vol_centroid, unsigned int thread = 0);
template <typename PFP>
void computeCentroidELWVolumes(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VolumeAttribute<typename PFP::VEC3>& vol_centroid,
unsigned int thread = 0) ;
/**
* compute centroid of all vertices
......@@ -303,35 +219,28 @@ void computeCentroidELWVolumes(typename PFP::MAP& map,
* @param position vertex attribute of position
* @param vertex_centroid vertex attribute to store the centroids
*/
template <typename PFP>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid,
unsigned int thread = 0) ;
template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT& vertex_centroid, unsigned int thread = 0) ;
namespace Parallel
{
template <typename PFP>
template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidVolumes(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VolumeAttribute<typename PFP::VEC3>& vol_centroid,
unsigned int nbth = 0) ;
template <typename PFP>
void computeCentroidELWVolumes(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VolumeAttribute<typename PFP::VEC3>& vol_centroid,
const V_ATT& position, W_ATT& vol_centroid,
unsigned int nbth = 0) ;
template <typename PFP, typename EMBV, typename EMB>
void computeCentroidELWVolumesGen(typename PFP::MAP& map,
const EMBV& position, VolumeAttribute<typename PFP::VEC3>& vol_centroid,
template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidELWVolumes(typename PFP::MAP& map,
const V_ATT& position, W_ATT& vol_centroid,
unsigned int nbth = 0) ;
template <typename PFP>
template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid,
const V_ATT& position, V_ATT& vertex_centroid,
unsigned int nbth = 0) ;
}
} // namespace Geometry
......
......@@ -42,14 +42,11 @@ namespace Surface
namespace Geometry
{
template <typename PFP, typename EMBV, typename EMB>
EMB volumeCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs, unsigned int thread)
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE volumeCentroid(typename PFP::MAP& map, Dart d, const V_ATT& attributs, unsigned int thread)
{
// EMB center = AttribOps::zero<EMB,PFP>() ;
EMB center(0.0);
typename V_ATT::DATA_TYPE center(0.0);
unsigned int count = 0 ;
Traversor3WV<typename PFP::MAP> tra(map,d,false,thread);
for (Dart d = tra.begin(); d != tra.end(); d = tra.next())
{
......@@ -61,11 +58,13 @@ EMB volumeCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs, uns
return center ;
}
template <typename PFP, typename EMBV, typename EMB>
EMB volumeCentroidELWGen(typename PFP::MAP& map, Dart d, const EMBV& attributs, unsigned int thread)
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE volumeCentroidELW(typename PFP::MAP& map, Dart d, const V_ATT& attributs, unsigned int thread)
{
// EMB center = AttribOps::zero<EMB,PFP>();
typedef typename V_ATT::DATA_TYPE EMB;
EMB center(0.0);
double count=0.0;
Traversor3WE<typename PFP::MAP> t(map, d,false,thread) ;
for(Dart it = t.begin(); it != t.end();it = t.next())
......@@ -81,11 +80,10 @@ EMB volumeCentroidELWGen(typename PFP::MAP& map, Dart d, const EMBV& attributs,
}
template <typename PFP, typename EMBV, typename EMB>
EMB faceCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Dart d, const V_ATT& attributs)
{
// EMB center = AttribOps::zero<EMB,PFP>();
EMB center(0.0);
typename V_ATT::DATA_TYPE center(0.0);
unsigned int count = 0 ;
Traversor2FV<typename PFP::MAP> t(map, d) ;
for(Dart it = t.begin(); it != t.end(); it = t.next())
......@@ -98,10 +96,12 @@ EMB faceCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
}
template <typename PFP, typename EMBV, typename EMB>
EMB faceCentroidELWGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Dart d, const V_ATT& attributs)
{
// EMB center = AttribOps::zero<EMB,PFP>();
typedef typename V_ATT::DATA_TYPE EMB;
EMB center(0.0);
double count=0.0;
Traversor2FE<typename PFP::MAP> t(map, d) ;
......@@ -118,11 +118,11 @@ EMB faceCentroidELWGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
}
template <typename PFP, typename EMBV, typename EMB>
EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, const V_ATT& attributs)
{
// EMB center = AttribOps::zero<EMB,PFP>();
EMB center(0.0);
typename V_ATT::DATA_TYPE center(0.0);
unsigned int count = 0 ;
Traversor2VVaE<typename PFP::MAP> t(map, d) ;
for(Dart it = t.begin(); it != t.end(); it = t.next())
......@@ -135,58 +135,64 @@ EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& at
}
template <typename PFP>
void computeCentroidFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& face_centroid, unsigned int thread)
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread)
{
TraversorF<typename PFP::MAP> t(map,thread) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
face_centroid[d] = faceCentroid<PFP>(map, d, position) ;
face_centroid[d] = faceCentroid<PFP,V_ATT>(map, d, position) ;
}
template <typename PFP>
void computeCentroidELWFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& face_centroid, unsigned int thread)
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidELWFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread)
{
TraversorF<typename PFP::MAP> t(map,thread) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
face_centroid[d] = faceCentroidELW<PFP>(map, d, position) ;
face_centroid[d] = faceCentroidELW<PFP,V_ATT>(map, d, position) ;
}
template <typename PFP>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid, unsigned int thread)
template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT& vertex_centroid, unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map, thread) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
vertex_centroid[d] = vertexNeighborhoodCentroid<PFP>(map, d, position) ;
vertex_centroid[d] = vertexNeighborhoodCentroid<PFP,V_ATT>(map, d, position) ;
}
namespace Parallel
{
template <typename PFP>
template <typename PFP, typename V_ATT, typename F_ATT>
class FunctorComputeCentroidFaces: public FunctorMapThreaded<typename PFP::MAP >
{
const VertexAttribute<typename PFP::VEC3>& m_position;
FaceAttribute<typename PFP::VEC3>& m_fcentroid;
const V_ATT& m_position;
F_ATT& m_fcentroid;
public:
FunctorComputeCentroidFaces<PFP>( typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& fcentroid):
FunctorComputeCentroidFaces<PFP,V_ATT,F_ATT>( typename PFP::MAP& map, const V_ATT& position, F_ATT& fcentroid):
FunctorMapThreaded<typename PFP::MAP>(map), m_position(position), m_fcentroid(fcentroid)
{ }
void run(Dart d, unsigned int threadID)
void run(Dart d, unsigned int /*threadID*/)
{
m_fcentroid[d] = faceCentroid<PFP>(this->m_map, d, m_position) ;
}
};
template <typename PFP>
template <typename PFP, typename V_ATT, typename F_ATT>
class FunctorComputeCentroidELWFaces: public FunctorMapThreaded<typename PFP::MAP >
{
const VertexAttribute<typename PFP::VEC3>& m_position;
FaceAttribute<typename PFP::VEC3>& m_fcentroid;
const V_ATT& m_position;
F_ATT& m_fcentroid;
public:
FunctorComputeCentroidELWFaces<PFP>( typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& fcentroid):
FunctorComputeCentroidELWFaces<PFP,V_ATT,F_ATT>( typename PFP::MAP& map, const V_ATT& position, F_ATT& fcentroid):
FunctorMapThreaded<typename PFP::MAP>(map), m_position(position), m_fcentroid(fcentroid)
{ }
......@@ -196,50 +202,48 @@ public:
}
};
template <typename PFP, typename V_ATT>
class FunctorComputeNeighborhoodCentroidVertices: public FunctorMapThreaded<typename PFP::MAP >
{
const V_ATT& m_position;
V_ATT& m_vcentroid;
public:
FunctorComputeNeighborhoodCentroidVertices<PFP,V_ATT>( typename PFP::MAP& map, const V_ATT& position, V_ATT& vcentroid):
FunctorMapThreaded<typename PFP::MAP>(map), m_position(position), m_vcentroid(vcentroid)
{ }
void run(Dart d, unsigned int /*threadID*/)
{
m_vcentroid[d] = vertexNeighborhoodCentroid<PFP>(this->m_map, d, m_position) ;
}
};
template <typename PFP>
void computeCentroidFaces(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& face_centroid,
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid,
unsigned int nbth, unsigned int current_thread)
{
FunctorComputeCentroidFaces<PFP> funct(map,position,face_centroid);
FunctorComputeCentroidFaces<PFP,V_ATT,F_ATT> funct(map,position,face_centroid);
Algo::Parallel::foreach_cell<typename PFP::MAP,FACE>(map, funct, nbth, false, current_thread);
}
template <typename PFP>
void computeCentroidELWFaces(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, FaceAttribute<typename PFP::VEC3>& face_centroid,
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidELWFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid,
unsigned int nbth, unsigned int current_thread)
{
FunctorComputeCentroidELWFaces<PFP> funct(map,position,face_centroid);
FunctorComputeCentroidELWFaces<PFP,V_ATT,F_ATT> funct(map,position,face_centroid);
Algo::Parallel::foreach_cell<typename PFP::MAP,FACE>(map, funct, nbth, false, current_thread);
}
template <typename PFP>
class FunctorComputeNeighborhoodCentroidVertices: public FunctorMapThreaded<typename PFP::MAP >
{
const VertexAttribute<typename PFP::VEC3>& m_position;
VertexAttribute<typename PFP::VEC3>& m_vcentroid;
public:
FunctorComputeNeighborhoodCentroidVertices<PFP>( typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vcentroid):
FunctorMapThreaded<typename PFP::MAP>(map), m_position(position), m_vcentroid(vcentroid)
{ }
void run(Dart d, unsigned int threadID)
{
m_vcentroid[d] = vertexNeighborhoodCentroid<PFP>(this->m_map, d, m_position) ;
}
};
template <typename PFP>
template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid,
const V_ATT& position, V_ATT& vertex_centroid,
unsigned int nbth, unsigned int current_thread)
{
FunctorComputeNeighborhoodCentroidVertices<PFP> funct(map,position,vertex_centroid);
Algo::Parallel::foreach_cell<typename PFP::MAP,VERTEX>(map, funct, nbth, false, current_thread);
FunctorComputeNeighborhoodCentroidVertices<PFP,V_ATT> funct(map,position,vertex_centroid);
Algo::Parallel::foreach_cell<typename PFP::MAP,VERTEX>(map, funct, nbth, false);
}
}
......@@ -251,11 +255,10 @@ namespace Volume
namespace Geometry
{
template <typename PFP, typename EMBV, typename EMB>
EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
template <typename PFP, typename V_ATT>
typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, const V_ATT& attributs)
{
// EMB center = AttribOps::zero<EMB,PFP>();
EMB center(0.0);
typename V_ATT::DATA_TYPE center(0.0);
unsigned int count = 0 ;
Traversor3VVaE<typename PFP::MAP> t(map, d) ;
for(Dart it = t.begin(); it != t.end(); it = t.next())
......@@ -267,138 +270,120 @@ EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& at
return center ;
}
template <typename PFP>
void computeCentroidVolumes(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, VolumeAttribute<typename PFP::VEC3>& vol_centroid, unsigned int thread)
template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT& vol_centroid, unsigned int thread)
{
TraversorW<typename PFP::MAP> t(map, thread) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
vol_centroid[d] = Surface::Geometry::volumeCentroid<PFP>(map, d, position,thread) ;
vol_centroid[d] = Surface::Geometry::volumeCentroid<PFP,V_ATT>(map, d, position,thread) ;
}
template <typename PFP>
void computeCentroidELWVolumes(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, VolumeAttribute<typename PFP::VEC3>& vol_centroid, unsigned int thread)
template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidELWVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT& vol_centroid, unsigned int thread)