mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 06:00:33 +05:00
use ngscore::Array for surface elements
This commit is contained in:
parent
a95185a714
commit
e8960ebae1
@ -427,7 +427,7 @@ void WriteSTLExtFormat (const Mesh & mesh,
|
|||||||
|
|
||||||
for(int faceNr = 1;faceNr <= faceBCMapping.EntrySize(bcInd); faceNr++)
|
for(int faceNr = 1;faceNr <= faceBCMapping.EntrySize(bcInd); faceNr++)
|
||||||
{
|
{
|
||||||
NgArray<SurfaceElementIndex> faceSei;
|
Array<SurfaceElementIndex> faceSei;
|
||||||
mesh.GetSurfaceElementsOfFace(faceBCMapping.Get(bcInd,faceNr),faceSei);
|
mesh.GetSurfaceElementsOfFace(faceBCMapping.Get(bcInd,faceNr),faceSei);
|
||||||
|
|
||||||
for (int i = 0; i < faceSei.Size(); i++)
|
for (int i = 0; i < faceSei.Size(); i++)
|
||||||
|
@ -341,8 +341,8 @@ namespace netgen
|
|||||||
// Extract the number of surface elements having a given colour
|
// Extract the number of surface elements having a given colour
|
||||||
// And save this number into an array for later sorting
|
// And save this number into an array for later sorting
|
||||||
for(int face_index = 1; face_index <= nfd; face_index++)
|
for(int face_index = 1; face_index <= nfd; face_index++)
|
||||||
{
|
{
|
||||||
NgArray<SurfaceElementIndex> se_face;
|
Array<SurfaceElementIndex> se_face;
|
||||||
|
|
||||||
mesh.GetSurfaceElementsOfFace(face_index, se_face);
|
mesh.GetSurfaceElementsOfFace(face_index, se_face);
|
||||||
|
|
||||||
|
@ -74,15 +74,23 @@ namespace netgen
|
|||||||
NgProfiler::StartTimer (timerstart);
|
NgProfiler::StartTimer (timerstart);
|
||||||
|
|
||||||
|
|
||||||
NgArray<SurfaceElementIndex> seia;
|
Array<SurfaceElementIndex> seia;
|
||||||
mesh.GetSurfaceElementsOfFace (faceindex, seia);
|
mesh.GetSurfaceElementsOfFace (faceindex, seia);
|
||||||
|
|
||||||
|
/*
|
||||||
for (int i = 0; i < seia.Size(); i++)
|
for (int i = 0; i < seia.Size(); i++)
|
||||||
if (mesh[seia[i]].GetNP() != 3)
|
if (mesh[seia[i]].GetNP() != 3)
|
||||||
{
|
{
|
||||||
GenericImprove (mesh);
|
GenericImprove (mesh);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
for (SurfaceElementIndex sei : seia)
|
||||||
|
if (mesh[sei].GetNP() != 3)
|
||||||
|
{
|
||||||
|
GenericImprove (mesh);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
|
int surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
|
||||||
|
|
||||||
@ -356,8 +364,8 @@ namespace netgen
|
|||||||
Element2d sw2 (pi3, pi4, pi2);
|
Element2d sw2 (pi3, pi4, pi2);
|
||||||
|
|
||||||
int legal1 =
|
int legal1 =
|
||||||
mesh.LegalTrig (mesh.SurfaceElement (t1)) +
|
mesh.LegalTrig (mesh[t1]) +
|
||||||
mesh.LegalTrig (mesh.SurfaceElement (t2));
|
mesh.LegalTrig (mesh[t2]);
|
||||||
int legal2 =
|
int legal2 =
|
||||||
mesh.LegalTrig (sw1) + mesh.LegalTrig (sw2);
|
mesh.LegalTrig (sw1) + mesh.LegalTrig (sw2);
|
||||||
|
|
||||||
@ -439,34 +447,23 @@ namespace netgen
|
|||||||
NgProfiler::StartTimer (timerstart1);
|
NgProfiler::StartTimer (timerstart1);
|
||||||
|
|
||||||
|
|
||||||
|
Array<SurfaceElementIndex> seia;
|
||||||
// int i, j, k, l;
|
|
||||||
// PointIndex pi;
|
|
||||||
// SurfaceElementIndex sei;
|
|
||||||
|
|
||||||
|
|
||||||
NgArray<SurfaceElementIndex> seia;
|
|
||||||
mesh.GetSurfaceElementsOfFace (faceindex, seia);
|
mesh.GetSurfaceElementsOfFace (faceindex, seia);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < seia.Size(); i++)
|
for (SurfaceElementIndex sei : seia)
|
||||||
if (mesh[seia[i]].GetNP() != 3)
|
if (mesh[sei].GetNP() != 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int surfnr = 0;
|
int surfnr = 0;
|
||||||
if (faceindex)
|
if (faceindex)
|
||||||
surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
|
surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
|
||||||
|
|
||||||
|
|
||||||
// PointIndex pi1, pi2;
|
|
||||||
// MeshPoint p1, p2, pnew;
|
|
||||||
double bad1, bad2;
|
|
||||||
Vec<3> nv;
|
Vec<3> nv;
|
||||||
|
|
||||||
int np = mesh.GetNP();
|
int np = mesh.GetNP();
|
||||||
//int nse = mesh.GetNSE();
|
|
||||||
|
|
||||||
TABLE<SurfaceElementIndex,PointIndex::BASE> elementsonnode(np);
|
TABLE<SurfaceElementIndex,PointIndex::BASE> elementsonnode(np);
|
||||||
NgArray<SurfaceElementIndex> hasonepi, hasbothpi;
|
NgArray<SurfaceElementIndex> hasonepi, hasbothpi;
|
||||||
@ -639,8 +636,9 @@ namespace netgen
|
|||||||
hasonepi.Append (elementsonnode[pi2][k]);
|
hasonepi.Append (elementsonnode[pi2][k]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bad1 = 0;
|
double bad1 = 0;
|
||||||
int illegal1 = 0, illegal2 = 0;
|
int illegal1 = 0, illegal2 = 0;
|
||||||
|
|
||||||
for (int k = 0; k < hasonepi.Size(); k++)
|
for (int k = 0; k < hasonepi.Size(); k++)
|
||||||
{
|
{
|
||||||
const Element2d & el = mesh[hasonepi[k]];
|
const Element2d & el = mesh[hasonepi[k]];
|
||||||
@ -665,7 +663,7 @@ namespace netgen
|
|||||||
mesh[pi1] = pnew;
|
mesh[pi1] = pnew;
|
||||||
mesh[pi2] = pnew;
|
mesh[pi2] = pnew;
|
||||||
|
|
||||||
bad2 = 0;
|
double bad2 = 0;
|
||||||
for (int k = 0; k < hasonepi.Size(); k++)
|
for (int k = 0; k < hasonepi.Size(); k++)
|
||||||
{
|
{
|
||||||
Element2d & el = mesh[hasonepi[k]];
|
Element2d & el = mesh[hasonepi[k]];
|
||||||
@ -753,24 +751,17 @@ namespace netgen
|
|||||||
for (SurfaceElementIndex sei2 : elementsonnode[pi2])
|
for (SurfaceElementIndex sei2 : elementsonnode[pi2])
|
||||||
{
|
{
|
||||||
Element2d & el = mesh[sei2];
|
Element2d & el = mesh[sei2];
|
||||||
if(el.IsDeleted()) continue;
|
if (el.IsDeleted()) continue;
|
||||||
elementsonnode.Add (pi1, sei2);
|
|
||||||
|
|
||||||
/*
|
|
||||||
bool haspi1 = 0;
|
|
||||||
for (int l = 0; l < el.GetNP(); l++)
|
|
||||||
if (el[l] == pi1)
|
|
||||||
haspi1 = true;
|
|
||||||
if (haspi1) continue;
|
|
||||||
*/
|
|
||||||
if (el.PNums().Contains(pi1)) continue;
|
if (el.PNums().Contains(pi1)) continue;
|
||||||
|
|
||||||
for (int l = 0; l < el.GetNP(); l++)
|
elementsonnode.Add (pi1, sei2);
|
||||||
|
|
||||||
|
for (auto l : Range(el.GetNP()))
|
||||||
{
|
{
|
||||||
if (el[l] == pi2)
|
if (el[l] == pi2)
|
||||||
{
|
{
|
||||||
el[l] = pi1;
|
el[l] = pi1;
|
||||||
el.GeomInfoPi (l+1) = gi;
|
el.GeomInfo()[l] = gi;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixed[el[l]] = true;
|
fixed[el[l]] = true;
|
||||||
|
@ -430,7 +430,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < rule.oldels.Size(); j++)
|
for (int j = 0; j < rule.oldels.Size(); j++)
|
||||||
mesh.DeleteSurfaceElement ( elmap[j] );
|
mesh.Delete (elmap[j]);
|
||||||
|
|
||||||
for (int j = 1; j <= pmap.Size(); j++)
|
for (int j = 1; j <= pmap.Size(); j++)
|
||||||
nelonnode[pmap.Get(j)] += rule.incelsonnode.Get(j);
|
nelonnode[pmap.Get(j)] += rule.incelsonnode.Get(j);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
extern double CalcTotalBad (const Mesh::T_POINTS & points,
|
extern double CalcTotalBad (const Mesh::T_POINTS & points,
|
||||||
const Mesh::T_VOLELEMENTS & elements,
|
const NgArray<Element> & elements,
|
||||||
const MeshingParameters & mp);
|
const MeshingParameters & mp);
|
||||||
|
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
double CalcTotalBad (const Mesh::T_POINTS & points,
|
double CalcTotalBad (const Mesh::T_POINTS & points,
|
||||||
const Mesh::T_VOLELEMENTS & elements)
|
const NgArray<Element> & elements)
|
||||||
{
|
{
|
||||||
return netgen::CalcTotalBad (points, elements, mp);
|
return netgen::CalcTotalBad (points, elements, mp);
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ class JacobianPointFunction : public MinFunction
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Mesh::T_POINTS & points;
|
Mesh::T_POINTS & points;
|
||||||
const Mesh::T_VOLELEMENTS & elements;
|
const NgArray<Element> & elements;
|
||||||
TABLE<INDEX> elementsonpoint;
|
TABLE<INDEX> elementsonpoint;
|
||||||
PointIndex actpind;
|
PointIndex actpind;
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
JacobianPointFunction (Mesh::T_POINTS & apoints,
|
JacobianPointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Mesh::T_VOLELEMENTS & aelements);
|
const NgArray<Element> & aelements);
|
||||||
virtual ~JacobianPointFunction () { ; }
|
virtual ~JacobianPointFunction () { ; }
|
||||||
virtual void SetPointIndex (PointIndex aactpind);
|
virtual void SetPointIndex (PointIndex aactpind);
|
||||||
virtual double Func (const Vector & x) const;
|
virtual double Func (const Vector & x) const;
|
||||||
|
@ -2467,7 +2467,7 @@ namespace netgen
|
|||||||
|
|
||||||
for (int i = 1; i <= GetNSE(); i++)
|
for (int i = 1; i <= GetNSE(); i++)
|
||||||
{
|
{
|
||||||
Element2d & sel = surfelements.Elem(i);
|
Element2d & sel = surfelements[i-1];
|
||||||
bool remove = false;
|
bool remove = false;
|
||||||
for (int j = 1; j <= sel.GetNP(); j++)
|
for (int j = 1; j <= sel.GetNP(); j++)
|
||||||
if (frontpoints.Test(sel.PNum(j)))
|
if (frontpoints.Test(sel.PNum(j)))
|
||||||
@ -2478,9 +2478,9 @@ namespace netgen
|
|||||||
|
|
||||||
for (int i = surfelements.Size(); i >= 1; i--)
|
for (int i = surfelements.Size(); i >= 1; i--)
|
||||||
{
|
{
|
||||||
if (!surfelements.Elem(i).PNum(1).IsValid())
|
if (!surfelements[i-1].PNum(1).IsValid())
|
||||||
{
|
{
|
||||||
surfelements.Elem(i) = surfelements.Last();
|
surfelements[i-1] = surfelements.Last();
|
||||||
surfelements.DeleteLast();
|
surfelements.DeleteLast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3270,8 +3270,12 @@ namespace netgen
|
|||||||
for (int i = 0; i < surfelements.Size(); i++)
|
for (int i = 0; i < surfelements.Size(); i++)
|
||||||
if (surfelements[i].IsDeleted())
|
if (surfelements[i].IsDeleted())
|
||||||
{
|
{
|
||||||
|
surfelements[i] = surfelements.Last();
|
||||||
|
surfelements.DeleteLast();
|
||||||
|
/*
|
||||||
surfelements.Delete(i);
|
surfelements.Delete(i);
|
||||||
i--;
|
i--;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < segments.Size(); i++)
|
for (int i = 0; i < segments.Size(); i++)
|
||||||
@ -3907,7 +3911,7 @@ namespace netgen
|
|||||||
for (i = 1; i <= nse; i++)
|
for (i = 1; i <= nse; i++)
|
||||||
if (!used.Test(i))
|
if (!used.Test(i))
|
||||||
{
|
{
|
||||||
Element2d & el = surfelements.Elem(i);
|
Element2d & el = surfelements[i-1];
|
||||||
int found = 0, foundrev = 0;
|
int found = 0, foundrev = 0;
|
||||||
for (j = 1; j <= 3; j++)
|
for (j = 1; j <= 3; j++)
|
||||||
{
|
{
|
||||||
@ -5372,7 +5376,7 @@ namespace netgen
|
|||||||
int np = GetNP();
|
int np = GetNP();
|
||||||
|
|
||||||
BitArray usedp(np);
|
BitArray usedp(np);
|
||||||
NgArray<SurfaceElementIndex> els_of_face;
|
Array<SurfaceElementIndex> els_of_face;
|
||||||
|
|
||||||
fdi = 1;
|
fdi = 1;
|
||||||
while (fdi <= GetNFD())
|
while (fdi <= GetNFD())
|
||||||
@ -5546,7 +5550,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh :: GetSurfaceElementsOfFace (int facenr, NgArray<SurfaceElementIndex> & sei) const
|
void Mesh :: GetSurfaceElementsOfFace (int facenr, Array<SurfaceElementIndex> & sei) const
|
||||||
{
|
{
|
||||||
static int timer = NgProfiler::CreateTimer ("GetSurfaceElementsOfFace");
|
static int timer = NgProfiler::CreateTimer ("GetSurfaceElementsOfFace");
|
||||||
NgProfiler::RegionTimer reg (timer);
|
NgProfiler::RegionTimer reg (timer);
|
||||||
|
@ -24,9 +24,9 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef ::netgen::T_POINTS T_POINTS;
|
typedef ::netgen::T_POINTS T_POINTS;
|
||||||
typedef NgArray<Element, 0, size_t> T_VOLELEMENTS;
|
// typedef NgArray<Element, 0, size_t> T_VOLELEMENTS;
|
||||||
// typedef NgArray<Element2d, 0, SurfaceElementIndex> T_SURFELEMENTS;
|
// typedef NgArray<Element2d, 0, SurfaceElementIndex> T_SURFELEMENTS;
|
||||||
typedef NgArray<Element2d, 0, size_t> T_SURFELEMENTS;
|
// typedef NgArray<Element2d, 0, size_t> T_SURFELEMENTS;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// point coordinates
|
/// point coordinates
|
||||||
@ -38,9 +38,9 @@ namespace netgen
|
|||||||
/// line-segments at edges
|
/// line-segments at edges
|
||||||
NgArray<Segment, 0, size_t> segments;
|
NgArray<Segment, 0, size_t> segments;
|
||||||
/// surface elements, 2d-inner elements
|
/// surface elements, 2d-inner elements
|
||||||
T_SURFELEMENTS surfelements;
|
Array<Element2d> surfelements;
|
||||||
/// volume elements
|
/// volume elements
|
||||||
T_VOLELEMENTS volelements;
|
NgArray<Element> volelements;
|
||||||
/// points will be fixed forever
|
/// points will be fixed forever
|
||||||
NgArray<PointIndex> lockedpoints;
|
NgArray<PointIndex> lockedpoints;
|
||||||
|
|
||||||
@ -263,10 +263,6 @@ namespace netgen
|
|||||||
const Segment & operator[] (SegmentIndex si) const { return segments[si]; }
|
const Segment & operator[] (SegmentIndex si) const { return segments[si]; }
|
||||||
Segment & operator[] (SegmentIndex si) { return segments[si]; }
|
Segment & operator[] (SegmentIndex si) { return segments[si]; }
|
||||||
|
|
||||||
/*
|
|
||||||
const NgArray<Segment> & LineSegments() const { return segments; }
|
|
||||||
NgArray<Segment> & LineSegments() { return segments; }
|
|
||||||
*/
|
|
||||||
const auto & LineSegments() const { return segments; }
|
const auto & LineSegments() const { return segments; }
|
||||||
auto & LineSegments() { return segments; }
|
auto & LineSegments() { return segments; }
|
||||||
|
|
||||||
@ -276,16 +272,23 @@ namespace netgen
|
|||||||
// write to pre-allocated container, thread-safe
|
// write to pre-allocated container, thread-safe
|
||||||
DLL_HEADER void SetSurfaceElement (SurfaceElementIndex sei, const Element2d & el);
|
DLL_HEADER void SetSurfaceElement (SurfaceElementIndex sei, const Element2d & el);
|
||||||
|
|
||||||
// [[deprecated("Use DeleteSurfaceElement(SurfaceElementIndex) instead of int !")]]
|
[[deprecated("Use Delete(SurfaceElementIndex) instead of int !")]]
|
||||||
void DeleteSurfaceElement (int eli)
|
void DeleteSurfaceElement (int eli)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
surfelements.Elem(eli).Delete();
|
surfelements.Elem(eli).Delete();
|
||||||
surfelements.Elem(eli).PNum(1).Invalidate();
|
surfelements.Elem(eli).PNum(1).Invalidate();
|
||||||
surfelements.Elem(eli).PNum(2).Invalidate();
|
surfelements.Elem(eli).PNum(2).Invalidate();
|
||||||
surfelements.Elem(eli).PNum(3).Invalidate();
|
surfelements.Elem(eli).PNum(3).Invalidate();
|
||||||
|
*/
|
||||||
|
surfelements[eli-1].Delete();
|
||||||
|
surfelements[eli-1].PNum(1).Invalidate();
|
||||||
|
surfelements[eli-1].PNum(2).Invalidate();
|
||||||
|
surfelements[eli-1].PNum(3).Invalidate();
|
||||||
timestamp = NextTimeStamp();
|
timestamp = NextTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[deprecated("Use Delete(SurfaceElementIndex) instead !")]]
|
||||||
void DeleteSurfaceElement (SurfaceElementIndex eli)
|
void DeleteSurfaceElement (SurfaceElementIndex eli)
|
||||||
{
|
{
|
||||||
for (auto & p : surfelements[eli].PNums()) p.Invalidate();
|
for (auto & p : surfelements[eli].PNums()) p.Invalidate();
|
||||||
@ -293,13 +296,22 @@ namespace netgen
|
|||||||
timestamp = NextTimeStamp();
|
timestamp = NextTimeStamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Delete (SurfaceElementIndex eli)
|
||||||
|
{
|
||||||
|
for (auto & p : surfelements[eli].PNums()) p.Invalidate();
|
||||||
|
surfelements[eli].Delete();
|
||||||
|
timestamp = NextTimeStamp();
|
||||||
|
}
|
||||||
|
|
||||||
auto GetNSE () const { return surfelements.Size(); }
|
auto GetNSE () const { return surfelements.Size(); }
|
||||||
|
|
||||||
// [[deprecated("Use SurfaceElement(SurfaceElementIndex) instead of int !")]]
|
// [[deprecated("Use SurfaceElement(SurfaceElementIndex) instead of int !")]]
|
||||||
Element2d & SurfaceElement(int i) { return surfelements.Elem(i); }
|
Element2d & SurfaceElement(int i) { return surfelements[i-1]; }
|
||||||
// [[deprecated("Use SurfaceElement(SurfaceElementIndex) instead of int !")]]
|
// [[deprecated("Use SurfaceElement(SurfaceElementIndex) instead of int !")]]
|
||||||
const Element2d & SurfaceElement(int i) const { return surfelements.Get(i); }
|
const Element2d & SurfaceElement(int i) const { return surfelements[i-1]; }
|
||||||
|
[[deprecated("Use mesh[](SurfaceElementIndex) instead !")]]
|
||||||
Element2d & SurfaceElement(SurfaceElementIndex i) { return surfelements[i]; }
|
Element2d & SurfaceElement(SurfaceElementIndex i) { return surfelements[i]; }
|
||||||
|
[[deprecated("Use mesh[](SurfaceElementIndex) instead !")]]
|
||||||
const Element2d & SurfaceElement(SurfaceElementIndex i) const { return surfelements[i]; }
|
const Element2d & SurfaceElement(SurfaceElementIndex i) const { return surfelements[i]; }
|
||||||
|
|
||||||
const Element2d & operator[] (SurfaceElementIndex ei) const
|
const Element2d & operator[] (SurfaceElementIndex ei) const
|
||||||
@ -307,12 +319,12 @@ namespace netgen
|
|||||||
Element2d & operator[] (SurfaceElementIndex ei)
|
Element2d & operator[] (SurfaceElementIndex ei)
|
||||||
{ return surfelements[ei]; }
|
{ return surfelements[ei]; }
|
||||||
|
|
||||||
const T_SURFELEMENTS & SurfaceElements() const { return surfelements; }
|
const auto & SurfaceElements() const { return surfelements; }
|
||||||
T_SURFELEMENTS & SurfaceElements() { return surfelements; }
|
auto & SurfaceElements() { return surfelements; }
|
||||||
|
|
||||||
|
|
||||||
DLL_HEADER void RebuildSurfaceElementLists ();
|
DLL_HEADER void RebuildSurfaceElementLists ();
|
||||||
DLL_HEADER void GetSurfaceElementsOfFace (int facenr, NgArray<SurfaceElementIndex> & sei) const;
|
DLL_HEADER void GetSurfaceElementsOfFace (int facenr, Array<SurfaceElementIndex> & sei) const;
|
||||||
|
|
||||||
DLL_HEADER ElementIndex AddVolumeElement (const Element & el);
|
DLL_HEADER ElementIndex AddVolumeElement (const Element & el);
|
||||||
// write to pre-allocated container, thread-safe
|
// write to pre-allocated container, thread-safe
|
||||||
@ -324,15 +336,13 @@ namespace netgen
|
|||||||
Element & VolumeElement(int i) { return volelements.Elem(i); }
|
Element & VolumeElement(int i) { return volelements.Elem(i); }
|
||||||
// [[deprecated("Use VolumeElement(ElementIndex) instead of int !")]]
|
// [[deprecated("Use VolumeElement(ElementIndex) instead of int !")]]
|
||||||
const Element & VolumeElement(int i) const { return volelements.Get(i); }
|
const Element & VolumeElement(int i) const { return volelements.Get(i); }
|
||||||
|
[[deprecated("Use mesh[](VolumeElementIndex) instead !")]]
|
||||||
Element & VolumeElement(ElementIndex i) { return volelements[i]; }
|
Element & VolumeElement(ElementIndex i) { return volelements[i]; }
|
||||||
|
[[deprecated("Use mesh[](VolumeElementIndex) instead !")]]
|
||||||
const Element & VolumeElement(ElementIndex i) const { return volelements[i]; }
|
const Element & VolumeElement(ElementIndex i) const { return volelements[i]; }
|
||||||
|
|
||||||
const Element & operator[] (ElementIndex ei) const
|
const Element & operator[] (ElementIndex ei) const { return volelements[ei]; }
|
||||||
{ return volelements[ei]; }
|
Element & operator[] (ElementIndex ei) { return volelements[ei]; }
|
||||||
Element & operator[] (ElementIndex ei)
|
|
||||||
{ return volelements[ei]; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ELEMENTTYPE ElementType (ElementIndex i) const
|
ELEMENTTYPE ElementType (ElementIndex i) const
|
||||||
{ return (volelements[i].flags.fixed) ? FIXEDELEMENT : FREEELEMENT; }
|
{ return (volelements[i].flags.fixed) ? FIXEDELEMENT : FREEELEMENT; }
|
||||||
|
@ -305,7 +305,7 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
NgArray<SurfaceElementIndex> seia;
|
Array<SurfaceElementIndex> seia;
|
||||||
mesh.GetSurfaceElementsOfFace (facenr, seia);
|
mesh.GetSurfaceElementsOfFace (facenr, seia);
|
||||||
for (int i = 0; i < seia.Size(); i++)
|
for (int i = 0; i < seia.Size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -749,9 +749,9 @@ namespace netgen
|
|||||||
|
|
||||||
auto & self = const_cast<Mesh&>(*this);
|
auto & self = const_cast<Mesh&>(*this);
|
||||||
self.points = T_POINTS(0);
|
self.points = T_POINTS(0);
|
||||||
self.surfelements = T_SURFELEMENTS(0);
|
self.surfelements = Array<Element2d>(0);
|
||||||
self.volelements = T_VOLELEMENTS(0);
|
self.volelements = NgArray<Element>(0);
|
||||||
self.segments = NgArray<Segment, 0, size_t>(0);
|
self.segments = NgArray<Segment>(0);
|
||||||
self.lockedpoints = NgArray<PointIndex>(0);
|
self.lockedpoints = NgArray<PointIndex>(0);
|
||||||
auto cleanup_ptr = [](auto & ptr) {
|
auto cleanup_ptr = [](auto & ptr) {
|
||||||
if (ptr != nullptr) {
|
if (ptr != nullptr) {
|
||||||
|
@ -740,11 +740,11 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
.def_property("dim", &Mesh::GetDimension, &Mesh::SetDimension)
|
.def_property("dim", &Mesh::GetDimension, &Mesh::SetDimension)
|
||||||
|
|
||||||
.def("Elements3D",
|
.def("Elements3D",
|
||||||
static_cast<NgArray<Element,0,size_t>&(Mesh::*)()> (&Mesh::VolumeElements),
|
static_cast<NgArray<Element>&(Mesh::*)()> (&Mesh::VolumeElements),
|
||||||
py::return_value_policy::reference)
|
py::return_value_policy::reference)
|
||||||
|
|
||||||
.def("Elements2D",
|
.def("Elements2D",
|
||||||
static_cast<NgArray<Element2d,0,size_t>&(Mesh::*)()> (&Mesh::SurfaceElements),
|
static_cast<Array<Element2d>&(Mesh::*)()> (&Mesh::SurfaceElements),
|
||||||
py::return_value_policy::reference)
|
py::return_value_policy::reference)
|
||||||
|
|
||||||
.def("Elements1D",
|
.def("Elements1D",
|
||||||
@ -813,7 +813,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
.def ("DeleteSurfaceElement",
|
.def ("DeleteSurfaceElement",
|
||||||
FunctionPointer ([](Mesh & self, SurfaceElementIndex i)
|
FunctionPointer ([](Mesh & self, SurfaceElementIndex i)
|
||||||
{
|
{
|
||||||
return self.DeleteSurfaceElement (i);
|
return self.Delete(i);
|
||||||
}))
|
}))
|
||||||
|
|
||||||
.def ("Compress", FunctionPointer ([](Mesh & self)
|
.def ("Compress", FunctionPointer ([](Mesh & self)
|
||||||
|
@ -51,7 +51,7 @@ namespace netgen
|
|||||||
int i, j, k;
|
int i, j, k;
|
||||||
SurfaceElementIndex sei;
|
SurfaceElementIndex sei;
|
||||||
|
|
||||||
NgArray<SurfaceElementIndex> seia;
|
Array<SurfaceElementIndex> seia;
|
||||||
mesh.GetSurfaceElementsOfFace (faceindex, seia);
|
mesh.GetSurfaceElementsOfFace (faceindex, seia);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -741,13 +741,13 @@ namespace netgen
|
|||||||
Opti2dLocalData ld;
|
Opti2dLocalData ld;
|
||||||
|
|
||||||
|
|
||||||
NgArray<SurfaceElementIndex> seia;
|
Array<SurfaceElementIndex> seia;
|
||||||
mesh.GetSurfaceElementsOfFace (faceindex, seia);
|
mesh.GetSurfaceElementsOfFace (faceindex, seia);
|
||||||
bool mixed = 0;
|
bool mixed = 0;
|
||||||
for (int i = 0; i < seia.Size(); i++)
|
for (auto sei : seia)
|
||||||
if (mesh[seia[i]].GetNP() != 3)
|
if (mesh[sei].GetNP() != 3)
|
||||||
{
|
{
|
||||||
mixed = 1;
|
mixed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Mesh::T_POINTS & points;
|
Mesh::T_POINTS & points;
|
||||||
const Mesh::T_VOLELEMENTS & elements;
|
const NgArray<Element> & elements;
|
||||||
TABLE<int,PointIndex::BASE> elementsonpoint;
|
TABLE<int,PointIndex::BASE> elementsonpoint;
|
||||||
const MeshingParameters & mp;
|
const MeshingParameters & mp;
|
||||||
PointIndex actpind;
|
PointIndex actpind;
|
||||||
@ -308,7 +308,7 @@ namespace netgen
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PointFunction (Mesh::T_POINTS & apoints,
|
PointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Mesh::T_VOLELEMENTS & aelements,
|
const NgArray<Element> & aelements,
|
||||||
const MeshingParameters & amp);
|
const MeshingParameters & amp);
|
||||||
virtual ~PointFunction () { ; }
|
virtual ~PointFunction () { ; }
|
||||||
virtual void SetPointIndex (PointIndex aactpind);
|
virtual void SetPointIndex (PointIndex aactpind);
|
||||||
@ -323,7 +323,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
PointFunction :: PointFunction (Mesh::T_POINTS & apoints,
|
PointFunction :: PointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Mesh::T_VOLELEMENTS & aelements,
|
const NgArray<Element> & aelements,
|
||||||
const MeshingParameters & amp)
|
const MeshingParameters & amp)
|
||||||
: points(apoints), elements(aelements), elementsonpoint(apoints.Size()), mp(amp)
|
: points(apoints), elements(aelements), elementsonpoint(apoints.Size()), mp(amp)
|
||||||
{
|
{
|
||||||
@ -477,7 +477,7 @@ namespace netgen
|
|||||||
DenseMatrix m;
|
DenseMatrix m;
|
||||||
public:
|
public:
|
||||||
CheapPointFunction (Mesh::T_POINTS & apoints,
|
CheapPointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Mesh::T_VOLELEMENTS & aelements,
|
const NgArray<Element> & aelements,
|
||||||
const MeshingParameters & amp);
|
const MeshingParameters & amp);
|
||||||
virtual void SetPointIndex (PointIndex aactpind);
|
virtual void SetPointIndex (PointIndex aactpind);
|
||||||
virtual double PointFunctionValue (const Point<3> & pp) const;
|
virtual double PointFunctionValue (const Point<3> & pp) const;
|
||||||
@ -486,7 +486,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
CheapPointFunction :: CheapPointFunction (Mesh::T_POINTS & apoints,
|
CheapPointFunction :: CheapPointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Mesh::T_VOLELEMENTS & aelements,
|
const NgArray<Element> & aelements,
|
||||||
const MeshingParameters & amp)
|
const MeshingParameters & amp)
|
||||||
: PointFunction (apoints, aelements, amp)
|
: PointFunction (apoints, aelements, amp)
|
||||||
{
|
{
|
||||||
@ -920,7 +920,7 @@ double Opti3EdgeMinFunction :: FuncGrad (const Vector & x, Vector & grad) const
|
|||||||
|
|
||||||
|
|
||||||
double CalcTotalBad (const Mesh::T_POINTS & points,
|
double CalcTotalBad (const Mesh::T_POINTS & points,
|
||||||
const Mesh::T_VOLELEMENTS & elements,
|
const NgArray<Element> & elements,
|
||||||
const MeshingParameters & mp)
|
const MeshingParameters & mp)
|
||||||
{
|
{
|
||||||
static Timer t("CalcTotalBad"); RegionTimer reg(t);
|
static Timer t("CalcTotalBad"); RegionTimer reg(t);
|
||||||
@ -985,13 +985,13 @@ int WrongOrientation (const Mesh::T_POINTS & points, const Element & el)
|
|||||||
// {
|
// {
|
||||||
// public:
|
// public:
|
||||||
// Mesh::T_POINTS & points;
|
// Mesh::T_POINTS & points;
|
||||||
// const Mesh::T_VOLELEMENTS & elements;
|
// const NgArray<Element> & elements;
|
||||||
// TABLE<INDEX> elementsonpoint;
|
// TABLE<INDEX> elementsonpoint;
|
||||||
// PointIndex actpind;
|
// PointIndex actpind;
|
||||||
|
|
||||||
// public:
|
// public:
|
||||||
// JacobianPointFunction (Mesh::T_POINTS & apoints,
|
// JacobianPointFunction (Mesh::T_POINTS & apoints,
|
||||||
// const Mesh::T_VOLELEMENTS & aelements);
|
// const NgArray<Element> & aelements);
|
||||||
|
|
||||||
// virtual void SetPointIndex (PointIndex aactpind);
|
// virtual void SetPointIndex (PointIndex aactpind);
|
||||||
// virtual double Func (const Vector & x) const;
|
// virtual double Func (const Vector & x) const;
|
||||||
@ -1002,7 +1002,7 @@ int WrongOrientation (const Mesh::T_POINTS & points, const Element & el)
|
|||||||
|
|
||||||
JacobianPointFunction ::
|
JacobianPointFunction ::
|
||||||
JacobianPointFunction (Mesh::T_POINTS & apoints,
|
JacobianPointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Mesh::T_VOLELEMENTS & aelements)
|
const NgArray<Element> & aelements)
|
||||||
: points(apoints), elements(aelements), elementsonpoint(apoints.Size())
|
: points(apoints), elements(aelements), elementsonpoint(apoints.Size())
|
||||||
{
|
{
|
||||||
INDEX i;
|
INDEX i;
|
||||||
|
@ -219,7 +219,7 @@ namespace netgen
|
|||||||
|
|
||||||
for (SurfaceElementIndex elnr : top.GetVertexSurfaceElements(v))
|
for (SurfaceElementIndex elnr : top.GetVertexSurfaceElements(v))
|
||||||
{
|
{
|
||||||
const Element2d & el = mesh.SurfaceElement (elnr);
|
const Element2d & el = mesh[elnr];
|
||||||
|
|
||||||
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces1 (el.GetType());
|
const ELEMENT_FACE * elfaces = MeshTopology::GetFaces1 (el.GetType());
|
||||||
|
|
||||||
|
@ -831,8 +831,8 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
if (notrys == 1)
|
if (notrys == 1)
|
||||||
{
|
{
|
||||||
for (int i = noldsurfel+1; i <= mesh.GetNSE(); i++)
|
for (SurfaceElementIndex sei = noldsurfel; sei < mesh.GetNSE(); sei++)
|
||||||
mesh.DeleteSurfaceElement (i);
|
mesh.Delete(sei);
|
||||||
|
|
||||||
mesh.Compress();
|
mesh.Compress();
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ namespace netgen
|
|||||||
|
|
||||||
for(int i = 1; i <= mesh->GetNFD(); i++)
|
for(int i = 1; i <= mesh->GetNFD(); i++)
|
||||||
{
|
{
|
||||||
NgArray<SurfaceElementIndex> surfElems;
|
Array<SurfaceElementIndex> surfElems;
|
||||||
mesh->GetSurfaceElementsOfFace(i,surfElems);
|
mesh->GetSurfaceElementsOfFace(i,surfElems);
|
||||||
|
|
||||||
if(ColourMatch(face_colours[colourind],mesh->GetFaceDescriptor(i).SurfColour()))
|
if(ColourMatch(face_colours[colourind],mesh->GetFaceDescriptor(i).SurfColour()))
|
||||||
@ -735,7 +735,7 @@ namespace netgen
|
|||||||
|
|
||||||
for(int i = 1; i <= mesh->GetNFD(); i++)
|
for(int i = 1; i <= mesh->GetNFD(); i++)
|
||||||
{
|
{
|
||||||
NgArray<SurfaceElementIndex> surfElems;
|
Array<SurfaceElementIndex> surfElems;
|
||||||
mesh->GetSurfaceElementsOfFace(i,surfElems);
|
mesh->GetSurfaceElementsOfFace(i,surfElems);
|
||||||
|
|
||||||
if(ColourMatch(face_colours[colourind],mesh->GetFaceDescriptor(i).SurfColour()))
|
if(ColourMatch(face_colours[colourind],mesh->GetFaceDescriptor(i).SurfColour()))
|
||||||
@ -759,7 +759,7 @@ namespace netgen
|
|||||||
|
|
||||||
for(int i = 1; i <= mesh->GetNFD(); i++)
|
for(int i = 1; i <= mesh->GetNFD(); i++)
|
||||||
{
|
{
|
||||||
NgArray<SurfaceElementIndex> surfElems;
|
Array<SurfaceElementIndex> surfElems;
|
||||||
mesh->GetSurfaceElementsOfFace(i,surfElems);
|
mesh->GetSurfaceElementsOfFace(i,surfElems);
|
||||||
|
|
||||||
if(ColourMatch(face_colours[colourind],mesh->GetFaceDescriptor(i).SurfColour()))
|
if(ColourMatch(face_colours[colourind],mesh->GetFaceDescriptor(i).SurfColour()))
|
||||||
@ -783,14 +783,14 @@ namespace netgen
|
|||||||
|
|
||||||
if(strcmp(argv[1], "hideonly") == 0)
|
if(strcmp(argv[1], "hideonly") == 0)
|
||||||
{
|
{
|
||||||
NgArray<Vec3d> face_colours;
|
NgArray<Vec3d> face_colours;
|
||||||
GetFaceColours(*mesh,face_colours);
|
GetFaceColours(*mesh,face_colours);
|
||||||
|
|
||||||
int colourind = atoi (argv[2]);
|
int colourind = atoi (argv[2]);
|
||||||
|
|
||||||
for(int i = 1; i <= mesh->GetNFD(); i++)
|
for(int i = 1; i <= mesh->GetNFD(); i++)
|
||||||
{
|
{
|
||||||
NgArray<SurfaceElementIndex> surfElems;
|
Array<SurfaceElementIndex> surfElems;
|
||||||
mesh->GetSurfaceElementsOfFace(i,surfElems);
|
mesh->GetSurfaceElementsOfFace(i,surfElems);
|
||||||
|
|
||||||
if(ColourMatch(face_colours[colourind],mesh->GetFaceDescriptor(i).SurfColour()))
|
if(ColourMatch(face_colours[colourind],mesh->GetFaceDescriptor(i).SurfColour()))
|
||||||
|
@ -576,7 +576,7 @@ namespace netgen
|
|||||||
shared_ptr<Mesh> mesh = GetMesh();
|
shared_ptr<Mesh> mesh = GetMesh();
|
||||||
if (!mesh) return;
|
if (!mesh) return;
|
||||||
|
|
||||||
NgArray<SurfaceElementIndex> elements_2d;
|
Array<SurfaceElementIndex> elements_2d;
|
||||||
|
|
||||||
//cout << "fieldlines_startface " << fieldlines_startface << endl;
|
//cout << "fieldlines_startface " << fieldlines_startface << endl;
|
||||||
mesh->GetSurfaceElementsOfFace(fieldlines_startface,elements_2d);
|
mesh->GetSurfaceElementsOfFace(fieldlines_startface,elements_2d);
|
||||||
@ -592,7 +592,7 @@ namespace netgen
|
|||||||
int i;
|
int i;
|
||||||
for(i=0; i<elements_2d.Size(); i++)
|
for(i=0; i<elements_2d.Size(); i++)
|
||||||
{
|
{
|
||||||
const Element2d & elem = mesh->SurfaceElement(elements_2d[i]);
|
const Element2d & elem = (*mesh)[elements_2d[i]];
|
||||||
|
|
||||||
v1 = mesh->Point(elem[1]) - mesh->Point(elem[0]);
|
v1 = mesh->Point(elem[1]) - mesh->Point(elem[0]);
|
||||||
v2 = mesh->Point(elem[2]) - mesh->Point(elem[0]);
|
v2 = mesh->Point(elem[2]) - mesh->Point(elem[0]);
|
||||||
@ -613,7 +613,7 @@ namespace netgen
|
|||||||
|
|
||||||
while(startpointsp < startpoints.Size())
|
while(startpointsp < startpoints.Size())
|
||||||
{
|
{
|
||||||
const Element2d & elem = mesh->SurfaceElement(elements_2d[i]);
|
const Element2d & elem = (*mesh)[elements_2d[i]];
|
||||||
|
|
||||||
int numtri = (elem.GetNV() == 3) ? 1 : 2;
|
int numtri = (elem.GetNV() == 3) ? 1 : 2;
|
||||||
|
|
||||||
|
@ -1005,7 +1005,7 @@ namespace netgen
|
|||||||
|
|
||||||
int hoplotn = 1 << vispar.subdivisions;
|
int hoplotn = 1 << vispar.subdivisions;
|
||||||
|
|
||||||
NgArray<SurfaceElementIndex> seia;
|
Array<SurfaceElementIndex> seia;
|
||||||
|
|
||||||
|
|
||||||
for (int faceindex = 1; faceindex <= mesh->GetNFD(); faceindex++)
|
for (int faceindex = 1; faceindex <= mesh->GetNFD(); faceindex++)
|
||||||
|
Loading…
Reference in New Issue
Block a user