make Element default constructable/movable

This commit is contained in:
Joachim Schöberl 2017-04-13 10:40:47 +02:00
parent 7027df2f73
commit ec20b74722
7 changed files with 56 additions and 38 deletions

View File

@ -1663,16 +1663,25 @@ namespace netgen
int MarkHangingTets (T_MTETS & mtets, int MarkHangingTets (T_MTETS & mtets,
const INDEX_2_CLOSED_HASHTABLE<PointIndex> & cutedges) const INDEX_2_CLOSED_HASHTABLE<PointIndex> & cutedges,
TaskManager tm)
{ {
static int timer = NgProfiler::CreateTimer ("MarkHangingTets");
NgProfiler::RegionTimer reg (timer);
int hanging = 0; int hanging = 0;
for (int i = 1; i <= mtets.Size(); i++) // for (int i = 1; i <= mtets.Size(); i++)
ParallelForRange
(tm, mtets.Size(), [&] (size_t begin, size_t end)
{ {
MarkedTet & teti = mtets.Elem(i); bool my_hanging = false;
for (size_t i = begin; i < end; i++)
{
MarkedTet & teti = mtets[i];
if (teti.marked) if (teti.marked)
{ {
hanging = 1; my_hanging = true;
continue; continue;
} }
@ -1685,10 +1694,12 @@ namespace netgen
if (cutedges.Used (edge)) if (cutedges.Used (edge))
{ {
teti.marked = 1; teti.marked = 1;
hanging = 1; my_hanging = true;
} }
} }
} }
if (my_hanging) hanging = true;
});
return hanging; return hanging;
} }
@ -3336,7 +3347,7 @@ namespace netgen
hangingvol = hangingvol =
MarkHangingTets (mtets, cutedges) + MarkHangingTets (mtets, cutedges, opt.task_manager) +
MarkHangingPrisms (mprisms, cutedges) + MarkHangingPrisms (mprisms, cutedges) +
MarkHangingIdentifications (mids, cutedges); MarkHangingIdentifications (mids, cutedges);

View File

@ -926,7 +926,7 @@ namespace netgen
PrintMessage (3, n, " volume elements"); PrintMessage (3, n, " volume elements");
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
Element el; Element el(TET);
int hi, nep; int hi, nep;
infile >> hi; infile >> hi;
if (hi == 0) hi = 1; if (hi == 0) hi = 1;
@ -1423,7 +1423,7 @@ namespace netgen
PrintMessage (3, n, " volume elements"); PrintMessage (3, n, " volume elements");
for (i = 1; i <= n; i++) for (i = 1; i <= n; i++)
{ {
Element el; Element el(TET);
int hi, nep; int hi, nep;
infile >> hi; infile >> hi;
if (hi == 0) hi = 1; if (hi == 0) hi = 1;
@ -1960,7 +1960,7 @@ namespace netgen
{ {
for (int j = 1; j <= el.GetNFaces(); j++) for (int j = 1; j <= el.GetNFaces(); j++)
{ {
Element2d hel; Element2d hel(TRIG);
el.GetFace (j, hel); el.GetFace (j, hel);
hel.Invert(); hel.Invert();
hel.NormalizeNumbering(); hel.NormalizeNumbering();

View File

@ -390,7 +390,7 @@ GenerateMesh (Mesh & mesh, const MeshingParameters & mp)
delfaces.SetSize (0); delfaces.SetSize (0);
INDEX npi; INDEX npi;
Element newel; Element newel(TET);
npi = mesh.AddPoint (inp); npi = mesh.AddPoint (inp);
newel.SetNP(4); newel.SetNP(4);

View File

@ -967,7 +967,7 @@ namespace netgen
return s; return s;
} }
/*
Element :: Element () Element :: Element ()
{ {
typ = TET; typ = TET;
@ -990,9 +990,8 @@ namespace netgen
#ifdef PARALLEL #ifdef PARALLEL
partitionNumber = -1; partitionNumber = -1;
#endif #endif
} }
*/
Element :: Element (int anp) Element :: Element (int anp)
{ {
@ -1061,12 +1060,15 @@ namespace netgen
flags.fixed = 0; flags.fixed = 0;
orderx = ordery = orderz = 1; orderx = ordery = orderz = 1;
is_curved = typ != TET; // false; is_curved = typ != TET; // false;
#ifdef PARALLEL
partitionNumber = -1;
#endif
} }
/*
Element & Element :: operator= (const Element & el2) Element & Element :: operator= (const Element & el2)
{ {
typ = el2.typ; typ = el2.typ;
@ -1083,7 +1085,7 @@ namespace netgen
is_curved = el2.is_curved; is_curved = el2.is_curved;
return *this; return *this;
} }
*/
void Element :: SetNP (int anp) void Element :: SetNP (int anp)

View File

@ -660,13 +660,18 @@ namespace netgen
flagstruct flags; flagstruct flags;
/// ///
DLL_HEADER Element (); DLL_HEADER Element () = default;
Element (const Element &) = default;
Element (Element &&) = default;
Element & operator= (const Element &) = default;
Element & operator= (Element &&) = default;
/// ///
Element (int anp); Element (int anp);
/// ///
Element (ELEMENT_TYPE type); Element (ELEMENT_TYPE type);
/// ///
Element & operator= (const Element & el2); // Element & operator= (const Element & el2);
/// ///
void SetNP (int anp); void SetNP (int anp);

View File

@ -436,7 +436,7 @@ namespace netgen
int ind = el.GetIndex(); int ind = el.GetIndex();
for (int j = 0; j < 8; j++) for (int j = 0; j < 8; j++)
{ {
Element nel; Element nel(TET);
for (int k = 1; k <= 4; k++) for (int k = 1; k <= 4; k++)
nel.PNum(k) = pnums.Get(reftab[j][k-1]); nel.PNum(k) = pnums.Get(reftab[j][k-1]);
nel.SetIndex(ind); nel.SetIndex(ind);

View File

@ -204,7 +204,7 @@ namespace netgen
const Element & el = mesh.VolumeElement(i); const Element & el = mesh.VolumeElement(i);
int onp = 0; int onp = 0;
Element newel; Element newel(TET);
newel.SetIndex (el.GetIndex()); newel.SetIndex (el.GetIndex());
static int betw_tet[6][3] = static int betw_tet[6][3] =