mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-24 03:40:34 +05:00
counting num vertices in parallel
This commit is contained in:
parent
f1162b6cc3
commit
472073c22b
@ -628,7 +628,7 @@ namespace ngcore
|
|||||||
FlatArray<T> View (FlatArray<T> fa) { return fa; }
|
FlatArray<T> View (FlatArray<T> fa) { return fa; }
|
||||||
|
|
||||||
template <typename T, typename TI>
|
template <typename T, typename TI>
|
||||||
auto Max (FlatArray<T,TI> array, T max = std::numeric_limits<T>::min()) -> T
|
auto Max (FlatArray<T,TI> array, typename std::remove_const<T>::type max = std::numeric_limits<T>::min()) -> T
|
||||||
{
|
{
|
||||||
for (auto & v : array)
|
for (auto & v : array)
|
||||||
if (v > max) max = v;
|
if (v > max) max = v;
|
||||||
@ -636,7 +636,7 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename TI>
|
template <typename T, typename TI>
|
||||||
auto Min (FlatArray<T,TI> array, T min = std::numeric_limits<T>::max()) -> T
|
auto Min (FlatArray<T,TI> array, typename std::remove_const<T>::type min = std::numeric_limits<T>::max()) -> T
|
||||||
{
|
{
|
||||||
for (auto & v : array)
|
for (auto & v : array)
|
||||||
if (v < min) min = v;
|
if (v < min) min = v;
|
||||||
|
@ -6810,8 +6810,9 @@ namespace netgen
|
|||||||
|
|
||||||
void Mesh :: ComputeNVertices ()
|
void Mesh :: ComputeNVertices ()
|
||||||
{
|
{
|
||||||
numvertices = 0;
|
|
||||||
|
|
||||||
|
numvertices = 0;
|
||||||
|
/*
|
||||||
for (const Element & el : VolumeElements())
|
for (const Element & el : VolumeElements())
|
||||||
for (PointIndex v : el.Vertices())
|
for (PointIndex v : el.Vertices())
|
||||||
if (v > numvertices) numvertices = v;
|
if (v > numvertices) numvertices = v;
|
||||||
@ -6821,6 +6822,25 @@ namespace netgen
|
|||||||
if (v > numvertices) numvertices = v;
|
if (v > numvertices) numvertices = v;
|
||||||
|
|
||||||
numvertices += 1-PointIndex::BASE;
|
numvertices += 1-PointIndex::BASE;
|
||||||
|
*/
|
||||||
|
numvertices = 0;
|
||||||
|
numvertices =
|
||||||
|
ParallelReduce (VolumeElements().Size(),
|
||||||
|
[&](size_t nr)
|
||||||
|
{
|
||||||
|
return int(Max(VolumeElements()[nr].Vertices()));
|
||||||
|
},
|
||||||
|
[](auto a, auto b) { return a > b ? a : b; },
|
||||||
|
numvertices);
|
||||||
|
numvertices =
|
||||||
|
ParallelReduce (SurfaceElements().Size(),
|
||||||
|
[&](size_t nr)
|
||||||
|
{
|
||||||
|
return int(Max(SurfaceElements()[nr].Vertices()));
|
||||||
|
},
|
||||||
|
[](auto a, auto b) { return a > b ? a : b; },
|
||||||
|
numvertices);
|
||||||
|
numvertices += 1-PointIndex::BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Mesh :: GetNV () const
|
int Mesh :: GetNV () const
|
||||||
|
Loading…
Reference in New Issue
Block a user