mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-27 21:30:35 +05:00
surfelement - indextype
This commit is contained in:
parent
e89550ec9c
commit
7f6f846eb1
@ -356,14 +356,14 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T, typename INDEX_ARRAY>
|
template <typename T, typename TI, typename INDEX_ARRAY>
|
||||||
class IndirectArray : public BaseArrayObject<IndirectArray<T, INDEX_ARRAY> >
|
class IndirectArray : public BaseArrayObject<IndirectArray<T, TI, INDEX_ARRAY> >
|
||||||
{
|
{
|
||||||
FlatArray<T> ba;
|
FlatArray<T,TI> ba;
|
||||||
const INDEX_ARRAY & ia;
|
const INDEX_ARRAY & ia;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NETGEN_INLINE IndirectArray (FlatArray<T> aba,
|
NETGEN_INLINE IndirectArray (FlatArray<T,TI> aba,
|
||||||
const INDEX_ARRAY & aia)
|
const INDEX_ARRAY & aia)
|
||||||
: ba(aba), ia(aia) { ; }
|
: ba(aba), ia(aia) { ; }
|
||||||
|
|
||||||
@ -552,10 +552,9 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename TI1>
|
template <typename TI1>
|
||||||
IndirectArray<T, BaseArrayObject<TI1> >
|
auto operator[] (const BaseArrayObject<TI1> & ind_array) const
|
||||||
operator[] (const BaseArrayObject<TI1> & ind_array) const
|
|
||||||
{
|
{
|
||||||
return IndirectArray<T, BaseArrayObject<TI1> > (*this, ind_array);
|
return IndirectArray<T, IndexType, BaseArrayObject<TI1> > (*this, ind_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// first position of element elem, returns -1 if element not contained in array
|
/// first position of element elem, returns -1 if element not contained in array
|
||||||
|
@ -3,11 +3,6 @@
|
|||||||
#include "meshing.hpp"
|
#include "meshing.hpp"
|
||||||
#include <opti.hpp>
|
#include <opti.hpp>
|
||||||
|
|
||||||
#ifndef SMALLLIB
|
|
||||||
//#ifndef NOTCL
|
|
||||||
//#include <visual.hpp>
|
|
||||||
//#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
@ -33,11 +28,11 @@ namespace netgen
|
|||||||
class trionedge
|
class trionedge
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int tnr;
|
SurfaceElementIndex tnr;
|
||||||
int sidenr;
|
int sidenr;
|
||||||
|
|
||||||
trionedge () { tnr = 0; sidenr = 0; }
|
trionedge () { tnr = 0; sidenr = 0; }
|
||||||
trionedge (int atnr, int asidenr)
|
trionedge (SurfaceElementIndex atnr, int asidenr)
|
||||||
{ tnr = atnr; sidenr = asidenr; }
|
{ tnr = atnr; sidenr = asidenr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,7 +90,7 @@ namespace netgen
|
|||||||
int surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
|
int surfnr = mesh.GetFaceDescriptor (faceindex).SurfNr();
|
||||||
|
|
||||||
Array<Neighbour> neighbors(mesh.GetNSE());
|
Array<Neighbour> neighbors(mesh.GetNSE());
|
||||||
INDEX_2_HASHTABLE<trionedge> other(seia.Size() + 2);
|
INDEX_2_HASHTABLE<trionedge> other(2*seia.Size() + 2);
|
||||||
|
|
||||||
|
|
||||||
Array<bool> swapped(mesh.GetNSE());
|
Array<bool> swapped(mesh.GetNSE());
|
||||||
@ -190,9 +185,15 @@ namespace netgen
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
for (int i = 0; i < seia.Size(); i++)
|
for (int i = 0; i < seia.Size(); i++)
|
||||||
{
|
{
|
||||||
const Element2d & sel = mesh[seia[i]];
|
const Element2d & sel = mesh[seia[i]];
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (SurfaceElementIndex sei : seia)
|
||||||
|
{
|
||||||
|
const Element2d & sel = mesh[sei];
|
||||||
|
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
@ -201,8 +202,8 @@ namespace netgen
|
|||||||
|
|
||||||
// double loch = mesh.GetH(mesh[pi1]);
|
// double loch = mesh.GetH(mesh[pi1]);
|
||||||
|
|
||||||
INDEX_2 edge(pi1, pi2);
|
// INDEX_2 edge(pi1, pi2);
|
||||||
edge.Sort();
|
// edge.Sort();
|
||||||
|
|
||||||
if (mesh.IsSegment (pi1, pi2))
|
if (mesh.IsSegment (pi1, pi2))
|
||||||
continue;
|
continue;
|
||||||
@ -217,17 +218,22 @@ namespace netgen
|
|||||||
// INDEX_2 i2s(ii2);
|
// INDEX_2 i2s(ii2);
|
||||||
// i2s.Sort();
|
// i2s.Sort();
|
||||||
|
|
||||||
|
/*
|
||||||
int i2 = other.Get(ii2).tnr;
|
int i2 = other.Get(ii2).tnr;
|
||||||
int j2 = other.Get(ii2).sidenr;
|
int j2 = other.Get(ii2).sidenr;
|
||||||
|
*/
|
||||||
|
auto othertrig = other.Get(ii2);
|
||||||
|
SurfaceElementIndex i2 = othertrig.tnr;
|
||||||
|
int j2 = othertrig.sidenr;
|
||||||
|
|
||||||
neighbors[seia[i]].SetNr (j, i2);
|
neighbors[sei].SetNr (j, i2);
|
||||||
neighbors[seia[i]].SetOrientation (j, j2);
|
neighbors[sei].SetOrientation (j, j2);
|
||||||
neighbors[i2].SetNr (j2, seia[i]);
|
neighbors[i2].SetNr (j2, sei);
|
||||||
neighbors[i2].SetOrientation (j2, j);
|
neighbors[i2].SetOrientation (j2, j);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
other.Set (INDEX_2 (pi2, pi1), trionedge (seia[i], j));
|
other.Set (INDEX_2 (pi2, pi1), trionedge (sei, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ namespace netgen
|
|||||||
/// line-segments at edges
|
/// line-segments at edges
|
||||||
Array<Segment> segments;
|
Array<Segment> segments;
|
||||||
/// surface elements, 2d-inner elements
|
/// surface elements, 2d-inner elements
|
||||||
Array<Element2d> surfelements;
|
Array<Element2d, SurfaceElementIndex> surfelements;
|
||||||
/// volume elements
|
/// volume elements
|
||||||
Array<Element> volelements;
|
Array<Element> volelements;
|
||||||
/// points will be fixed forever
|
/// points will be fixed forever
|
||||||
@ -788,8 +788,12 @@ namespace netgen
|
|||||||
void ReCalc ()
|
void ReCalc ()
|
||||||
{
|
{
|
||||||
area = 0;
|
area = 0;
|
||||||
|
/*
|
||||||
for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++)
|
for (SurfaceElementIndex sei = 0; sei < mesh.GetNSE(); sei++)
|
||||||
Add (mesh[sei]);
|
Add (mesh[sei]);
|
||||||
|
*/
|
||||||
|
for (const Element2d & el : mesh.SurfaceElements())
|
||||||
|
Add (el);
|
||||||
valid = true;
|
valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,6 @@ namespace netgen
|
|||||||
SurfaceElementIndex & operator++ () { ++i; return *this; }
|
SurfaceElementIndex & operator++ () { ++i; return *this; }
|
||||||
SurfaceElementIndex & operator-- () { --i; return *this; }
|
SurfaceElementIndex & operator-- () { --i; return *this; }
|
||||||
SurfaceElementIndex & operator+= (int inc) { i+=inc; return *this; }
|
SurfaceElementIndex & operator+= (int inc) { i+=inc; return *this; }
|
||||||
|
|
||||||
void DoArchive (Archive & ar) { ar & i; }
|
void DoArchive (Archive & ar) { ar & i; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
py::return_value_policy::reference)
|
py::return_value_policy::reference)
|
||||||
|
|
||||||
.def("Elements2D",
|
.def("Elements2D",
|
||||||
static_cast<Array<Element2d>&(Mesh::*)()> (&Mesh::SurfaceElements),
|
static_cast<Array<Element2d,SurfaceElementIndex>&(Mesh::*)()> (&Mesh::SurfaceElements),
|
||||||
py::return_value_policy::reference)
|
py::return_value_policy::reference)
|
||||||
|
|
||||||
.def("Elements1D",
|
.def("Elements1D",
|
||||||
|
Loading…
Reference in New Issue
Block a user