default constructors assignment operators, cheaper Array-Resize

This commit is contained in:
Joachim Schöberl 2017-04-11 21:06:30 +02:00
parent 5e320a5556
commit c50bd79beb
9 changed files with 40 additions and 20 deletions

View File

@ -178,6 +178,12 @@ namespace netgen
class MarkedTri
{
public:
MarkedTri () = default;
MarkedTri (const MarkedTri&) = default;
MarkedTri (MarkedTri &&) = default;
MarkedTri & operator= (const MarkedTri&) = default;
MarkedTri & operator= (MarkedTri&&) = default;
/// three point numbers
PointIndex pnums[3];
/// three geominfos

View File

@ -455,7 +455,7 @@ void MeshOptimize3d :: SplitImprove (Mesh & mesh,
if (el[l] == pi1 || el[l] == pi2)
{
INDEX_3 i3;
Element2d face;
Element2d face(TRIG);
el.GetFace (l+1, face);
for (int kk = 1; kk <= 3; kk++)
i3.I(kk) = face.PNum(kk);

View File

@ -1901,7 +1901,7 @@ namespace netgen
int ii;
PointIndex pi;
SurfaceElementIndex sei;
Element2d hel;
// Element2d hel;
INDEX_3_CLOSED_HASHTABLE<INDEX_2> faceht(100);
@ -1915,7 +1915,7 @@ namespace netgen
FlatArray<SurfaceElementIndex> row = selsonpoint[pi];
for (ii = 0; ii < row.Size(); ii++)
{
hel = SurfaceElement(row[ii]);
Element2d hel = SurfaceElement(row[ii]);
if (hel.GetType() == TRIG6) hel.SetType(TRIG);
int ind = hel.GetIndex();
@ -1960,6 +1960,7 @@ namespace netgen
{
for (int j = 1; j <= el.GetNFaces(); j++)
{
Element2d hel;
el.GetFace (j, hel);
hel.Invert();
hel.NormalizeNumbering();
@ -2014,8 +2015,9 @@ namespace netgen
faceht.GetData (i, i3, i2);
if (i2.I1() != PointIndex::BASE-1)
{
Element2d tri;
tri.SetType ( (i2.I2() == PointIndex::BASE-1) ? TRIG : QUAD);
// Element2d tri;
// tri.SetType ( (i2.I2() == PointIndex::BASE-1) ? TRIG : QUAD);
Element2d tri ( (i2.I2() == PointIndex::BASE-1) ? TRIG : QUAD);
for (int l = 0; l < 3; l++)
tri[l] = i3.I(l+1);
tri.PNum(4) = i2.I2();
@ -5361,7 +5363,7 @@ namespace netgen
// angles in faces
for (j = 1; j <= 4; j++)
{
Element2d face;
Element2d face(TRIG);
el.GetFace (j, face);
for (lpi1 = 1; lpi1 <= 3; lpi1++)
{

View File

@ -157,10 +157,9 @@ namespace netgen
<< " si = " << seg.si << ", edgenr = " << seg.edgenr;
return s;
}
/*
Element2d :: Element2d ()
{
{
for (int i = 0; i < ELEMENT2D_MAXPOINTS; i++)
{
pnum[i] = 0;
@ -177,8 +176,7 @@ namespace netgen
strongrefflag = false;
is_curved = false;
}
*/
Element2d :: Element2d (int anp)
{
for (int i = 0; i < ELEMENT2D_MAXPOINTS; i++)

View File

@ -76,8 +76,13 @@ namespace netgen
int trignum; // for STL Meshing
double u, v; // for OCC Meshing
PointGeomInfo ()
: trignum(-1), u(0), v(0) { ; }
PointGeomInfo () = default;
// : trignum(-1), u(0), v(0) { ; }
PointGeomInfo (const PointGeomInfo&) = default;
PointGeomInfo (PointGeomInfo &&) = default;
PointGeomInfo & operator= (const PointGeomInfo&) = default;
PointGeomInfo & operator= (PointGeomInfo&&) = default;
};
inline ostream & operator<< (ostream & ost, const PointGeomInfo & gi)
@ -145,9 +150,14 @@ namespace netgen
{
int i;
public:
PointIndex () { ; }
PointIndex () = default;
PointIndex (const PointIndex&) = default;
PointIndex (PointIndex &&) = default;
PointIndex & operator= (const PointIndex&) = default;
PointIndex & operator= (PointIndex&&) = default;
PointIndex (int ai) : i(ai) { ; }
PointIndex & operator= (const PointIndex &ai) { i = ai.i; return *this; }
// PointIndex & operator= (const PointIndex &ai) { i = ai.i; return *this; }
operator int () const { return i; }
PointIndex operator++ (int) { PointIndex hi(*this); i++; return hi; }
PointIndex operator-- (int) { PointIndex hi(*this); i--; return hi; }
@ -364,7 +374,11 @@ namespace netgen
public:
///
Element2d ();
Element2d () = default;
Element2d (const Element2d &) = default;
Element2d (Element2d &&) = default;
Element2d & operator= (const Element2d &) = default;
Element2d & operator= (Element2d &&) = default;
///
Element2d (int anp);
///

View File

@ -329,7 +329,7 @@ void netrule :: LoadRule (istream & ist)
while (ch == '(')
{
elements.Append (Element2d());
elements.Append (Element2d(TRIG));
ist >> elements.Last().PNum(1);
ist >> ch; // ','

View File

@ -84,7 +84,7 @@ void vnetrule :: LoadRule (istream & ist)
char buf[256];
char ch, ok;
Point3d p;
Element2d face;
Element2d face(TRIG);
int i, j, i1, i2, i3, fs, ii, ii1, ii2, ii3;
twoint edge;
DenseMatrix tempoldutonewu(30, 20),

View File

@ -112,7 +112,7 @@ namespace netgen
int onp(0);
Element2d newel;
Element2d newel(TRIG);
newel.SetIndex (el.GetIndex());
static int betw_trig[3][3] =

View File

@ -432,7 +432,7 @@ namespace netgen
for (int k = 1; k <= 4; k++)
if (el.PNum(k) == actpind)
{
Element2d face;
Element2d face(TRIG);
el.GetFace (k, face);
Swap (face.PNum(2), face.PNum(3));
faces.Append (face);