Commit 5b6cc5a6 authored by Lionel Untereiner's avatar Lionel Untereiner

centroid on volume meshes

parent 02b8e252
......@@ -149,6 +149,28 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
const FunctorSelect& select = allDarts, unsigned int nbth = 0) ;
}
namespace Volumes
{
template <typename PFP, typename EMBV, typename EMB>
typename PFP::VEC3 vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs);
template <typename PFP>
typename PFP::VEC3 vertexNeighborhoodCentroid(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3>& position)
{
return Algo::Geometry::Volumes::vertexNeighborhoodCentroidGen<PFP, VertexAttribute<typename PFP::VEC3>, typename PFP::VEC3>(map, d, position);
}
template <typename PFP>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid,
const FunctorSelect& select = allDarts, unsigned int thread = 0) ;
}
} // namespace Geometry
} // namespace Algo
......
......@@ -196,13 +196,33 @@ void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
}
namespace Volumes
{
template <typename PFP, typename EMBV, typename EMB>
EMB vertexNeighborhoodCentroidGen(typename PFP::MAP& map, Dart d, const EMBV& attributs)
{
EMB center = AttribOps::zero<EMB,PFP>();
unsigned int count = 0 ;
Traversor3VVaE<typename PFP::MAP> t(map, d) ;
for(Dart it = t.begin(); it != t.end(); it = t.next())
{
center += attributs[it];
++count ;
}
center /= count ;
return center ;
}
template <typename PFP>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, VertexAttribute<typename PFP::VEC3>& vertex_centroid, const FunctorSelect& select, unsigned int thread)
{
TraversorV<typename PFP::MAP> t(map, select, thread) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
vertex_centroid[d] = Algo::Geometry::Volumes::vertexNeighborhoodCentroid<PFP>(map, d, position) ;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment