mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
simplify edge/face-id types (just an int)
This commit is contained in:
parent
6ae645ce33
commit
50398c18c4
@ -41,7 +41,8 @@ namespace netgen
|
|||||||
// extern DLL_HEADER NgMPI_Comm ng_comm;
|
// extern DLL_HEADER NgMPI_Comm ng_comm;
|
||||||
|
|
||||||
static constexpr int POINTINDEX_BASE = 1;
|
static constexpr int POINTINDEX_BASE = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
struct T_EDGE2
|
struct T_EDGE2
|
||||||
{
|
{
|
||||||
// int orient:1;
|
// int orient:1;
|
||||||
@ -54,6 +55,9 @@ namespace netgen
|
|||||||
// int nr:29; // 0-based
|
// int nr:29; // 0-based
|
||||||
int nr; // 0-based
|
int nr; // 0-based
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
typedef int T_EDGE2;
|
||||||
|
typedef int T_FACE2;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Ng_Buffer
|
class Ng_Buffer
|
||||||
@ -114,7 +118,7 @@ namespace netgen
|
|||||||
const T_EDGE2 * ptr;
|
const T_EDGE2 * ptr;
|
||||||
|
|
||||||
size_t Size() const { return num; }
|
size_t Size() const { return num; }
|
||||||
int operator[] (size_t i) const { return ptr[i].nr; }
|
int operator[] (size_t i) const { return ptr[i]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Ng_Faces
|
class Ng_Faces
|
||||||
@ -124,7 +128,7 @@ namespace netgen
|
|||||||
const T_FACE2 * ptr;
|
const T_FACE2 * ptr;
|
||||||
|
|
||||||
size_t Size() const { return num; }
|
size_t Size() const { return num; }
|
||||||
int operator[] (size_t i) const { return ptr[i].nr; }
|
int operator[] (size_t i) const { return ptr[i]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Ng_Facets
|
class Ng_Facets
|
||||||
|
@ -28,8 +28,10 @@ NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<1> (size_t nr) const
|
|||||||
template <>
|
template <>
|
||||||
NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<2> (size_t nr) const
|
NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<2> (size_t nr) const
|
||||||
{
|
{
|
||||||
int ind = (*mesh)[SurfaceElementIndex(nr)].GetIndex();
|
// int ind = (*mesh)[SurfaceElementIndex(nr)].GetIndex();
|
||||||
return mesh->GetFaceDescriptor(ind).BCProperty();
|
// return mesh->GetFaceDescriptor(ind).BCProperty();
|
||||||
|
const Element2d & el = (*mesh)[SurfaceElementIndex(nr)];
|
||||||
|
return mesh->GetFaceDescriptor(el).BCProperty();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
@ -106,7 +108,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
|
|||||||
ret.vertices.ptr = (int*)&(el[0]);
|
ret.vertices.ptr = (int*)&(el[0]);
|
||||||
|
|
||||||
ret.edges.num = 1;
|
ret.edges.num = 1;
|
||||||
ret.edges.ptr = (T_EDGE2*)mesh->GetTopology().GetSegmentElementEdgesPtr (nr);
|
ret.edges.ptr = mesh->GetTopology().GetSegmentElementEdgesPtr (nr);
|
||||||
|
|
||||||
ret.faces.num = 0;
|
ret.faces.num = 0;
|
||||||
ret.faces.ptr = NULL;
|
ret.faces.ptr = NULL;
|
||||||
@ -121,7 +123,7 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
|
|||||||
{
|
{
|
||||||
ret.facets.num = 1;
|
ret.facets.num = 1;
|
||||||
ret.facets.base = 0;
|
ret.facets.base = 0;
|
||||||
ret.facets.ptr = (int*)ret.edges.ptr;
|
ret.facets.ptr = ret.edges.ptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -139,12 +141,11 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<1> (size_t nr) const
|
|||||||
template <>
|
template <>
|
||||||
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (size_t nr) const
|
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (size_t nr) const
|
||||||
{
|
{
|
||||||
// const Element2d & el = mesh->SurfaceElement (SurfaceElementIndex (nr));
|
|
||||||
const Element2d & el = mesh->SurfaceElements()[nr];
|
const Element2d & el = mesh->SurfaceElements()[nr];
|
||||||
|
|
||||||
Ng_Element ret;
|
Ng_Element ret;
|
||||||
ret.type = NG_ELEMENT_TYPE(el.GetType());
|
ret.type = NG_ELEMENT_TYPE(el.GetType());
|
||||||
const FaceDescriptor & fd = mesh->GetFaceDescriptor(el.GetIndex());
|
const FaceDescriptor & fd = mesh->GetFaceDescriptor(el); // .GetIndex());
|
||||||
ret.index = fd.BCProperty();
|
ret.index = fd.BCProperty();
|
||||||
if (mesh->GetDimension() == 3)
|
if (mesh->GetDimension() == 3)
|
||||||
ret.mat = &fd.GetBCName();
|
ret.mat = &fd.GetBCName();
|
||||||
@ -157,22 +158,22 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (size_t nr) const
|
|||||||
ret.vertices.ptr = (int*)&(el[0]);
|
ret.vertices.ptr = (int*)&(el[0]);
|
||||||
|
|
||||||
ret.edges.num = MeshTopology::GetNEdges (el.GetType());
|
ret.edges.num = MeshTopology::GetNEdges (el.GetType());
|
||||||
ret.edges.ptr = (T_EDGE2*)mesh->GetTopology().GetSurfaceElementEdgesPtr (nr);
|
ret.edges.ptr = mesh->GetTopology().GetSurfaceElementEdgesPtr (nr);
|
||||||
|
|
||||||
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
|
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
|
||||||
ret.faces.ptr = (T_FACE2*)mesh->GetTopology().GetSurfaceElementFacesPtr (nr);
|
ret.faces.ptr = mesh->GetTopology().GetSurfaceElementFacesPtr (nr);
|
||||||
|
|
||||||
if (mesh->GetDimension() == 3)
|
if (mesh->GetDimension() == 3)
|
||||||
{
|
{
|
||||||
ret.facets.num = ret.faces.num;
|
ret.facets.num = ret.faces.num;
|
||||||
ret.facets.base = 0;
|
ret.facets.base = 0;
|
||||||
ret.facets.ptr = (int*)ret.faces.ptr;
|
ret.facets.ptr = ret.faces.ptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret.facets.num = ret.edges.num;
|
ret.facets.num = ret.edges.num;
|
||||||
ret.facets.base = 0;
|
ret.facets.base = 0;
|
||||||
ret.facets.ptr = (int*)ret.edges.ptr;
|
ret.facets.ptr = ret.edges.ptr;
|
||||||
}
|
}
|
||||||
ret.is_curved = el.IsCurved();
|
ret.is_curved = el.IsCurved();
|
||||||
return ret;
|
return ret;
|
||||||
@ -181,7 +182,6 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<2> (size_t nr) const
|
|||||||
template <>
|
template <>
|
||||||
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (size_t nr) const
|
NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (size_t nr) const
|
||||||
{
|
{
|
||||||
// const Element & el = mesh->VolumeElement (ElementIndex (nr));
|
|
||||||
const Element & el = mesh->VolumeElements()[nr];
|
const Element & el = mesh->VolumeElements()[nr];
|
||||||
|
|
||||||
Ng_Element ret;
|
Ng_Element ret;
|
||||||
@ -195,14 +195,14 @@ NGX_INLINE DLL_HEADER Ng_Element Ngx_Mesh :: GetElement<3> (size_t nr) const
|
|||||||
ret.vertices.ptr = (int*)&(el[0]);
|
ret.vertices.ptr = (int*)&(el[0]);
|
||||||
|
|
||||||
ret.edges.num = MeshTopology::GetNEdges (el.GetType());
|
ret.edges.num = MeshTopology::GetNEdges (el.GetType());
|
||||||
ret.edges.ptr = (T_EDGE2*)mesh->GetTopology().GetElementEdgesPtr (nr);
|
ret.edges.ptr = mesh->GetTopology().GetElementEdgesPtr (nr);
|
||||||
|
|
||||||
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
|
ret.faces.num = MeshTopology::GetNFaces (el.GetType());
|
||||||
ret.faces.ptr = (T_FACE2*)mesh->GetTopology().GetElementFacesPtr (nr);
|
ret.faces.ptr = mesh->GetTopology().GetElementFacesPtr (nr);
|
||||||
|
|
||||||
ret.facets.num = ret.faces.num;
|
ret.facets.num = ret.faces.num;
|
||||||
ret.facets.base = 0;
|
ret.facets.base = 0;
|
||||||
ret.facets.ptr = (int*)ret.faces.ptr;
|
ret.facets.ptr = ret.faces.ptr;
|
||||||
|
|
||||||
ret.is_curved = el.IsCurved();
|
ret.is_curved = el.IsCurved();
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
extern double CalcTotalBad (const Mesh::T_POINTS & points,
|
extern double CalcTotalBad (const Mesh::T_POINTS & points,
|
||||||
const Array<Element> & elements,
|
const Array<Element, ElementIndex> & elements,
|
||||||
const MeshingParameters & mp);
|
const MeshingParameters & mp);
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
double CalcTotalBad (const Mesh::T_POINTS & points,
|
double CalcTotalBad (const Mesh::T_POINTS & points,
|
||||||
const Array<Element> & elements)
|
const Array<Element, ElementIndex> & elements)
|
||||||
{
|
{
|
||||||
return netgen::CalcTotalBad (points, elements, mp);
|
return netgen::CalcTotalBad (points, elements, mp);
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ class JacobianPointFunction : public MinFunction
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Mesh::T_POINTS & points;
|
Mesh::T_POINTS & points;
|
||||||
const Array<Element> & elements;
|
const Array<Element, ElementIndex> & elements;
|
||||||
TABLE<INDEX> elementsonpoint;
|
TABLE<INDEX> elementsonpoint;
|
||||||
PointIndex actpind;
|
PointIndex actpind;
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
JacobianPointFunction (Mesh::T_POINTS & apoints,
|
JacobianPointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Array<Element> & aelements);
|
const Array<Element, ElementIndex> & 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;
|
||||||
|
@ -25,10 +25,8 @@ namespace netgen
|
|||||||
class Mesh
|
class Mesh
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef ::netgen::T_POINTS T_POINTS;
|
// typedef Array<MeshPoint, PointIndex> T_POINTS;
|
||||||
// typedef NgArray<Element, 0, size_t> T_VOLELEMENTS;
|
typedef netgen::T_POINTS T_POINTS;
|
||||||
// typedef NgArray<Element2d, 0, SurfaceElementIndex> T_SURFELEMENTS;
|
|
||||||
// typedef NgArray<Element2d, 0, size_t> T_SURFELEMENTS;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// point coordinates
|
/// point coordinates
|
||||||
@ -42,7 +40,7 @@ namespace netgen
|
|||||||
/// surface elements, 2d-inner elements
|
/// surface elements, 2d-inner elements
|
||||||
Array<Element2d, SurfaceElementIndex> surfelements;
|
Array<Element2d, SurfaceElementIndex> surfelements;
|
||||||
/// volume elements
|
/// volume elements
|
||||||
Array<Element> volelements;
|
Array<Element, ElementIndex> volelements;
|
||||||
/// points will be fixed forever
|
/// points will be fixed forever
|
||||||
Array<PointIndex> lockedpoints;
|
Array<PointIndex> lockedpoints;
|
||||||
|
|
||||||
@ -711,6 +709,9 @@ namespace netgen
|
|||||||
int GetNFD () const
|
int GetNFD () const
|
||||||
{ return facedecoding.Size(); }
|
{ return facedecoding.Size(); }
|
||||||
|
|
||||||
|
const FaceDescriptor & GetFaceDescriptor (const Element2d & el) const
|
||||||
|
{ return facedecoding[el.GetIndex()-1]; }
|
||||||
|
|
||||||
const FaceDescriptor & GetFaceDescriptor (int i) const
|
const FaceDescriptor & GetFaceDescriptor (int i) const
|
||||||
{ return facedecoding[i-1]; }
|
{ return facedecoding[i-1]; }
|
||||||
// { return facedecoding.Get(i); }
|
// { return facedecoding.Get(i); }
|
||||||
|
@ -245,7 +245,7 @@ namespace netgen
|
|||||||
constexpr ElementIndex (int ai) : i(ai) { ; }
|
constexpr ElementIndex (int ai) : i(ai) { ; }
|
||||||
ElementIndex & operator= (const ElementIndex & ai) { i = ai.i; return *this; }
|
ElementIndex & operator= (const ElementIndex & ai) { i = ai.i; return *this; }
|
||||||
ElementIndex & operator= (int ai) { i = ai; return *this; }
|
ElementIndex & operator= (int ai) { i = ai; return *this; }
|
||||||
operator int () const { return i; }
|
constexpr operator int () const { return i; }
|
||||||
ElementIndex operator++ (int) { return ElementIndex(i++); }
|
ElementIndex operator++ (int) { return ElementIndex(i++); }
|
||||||
ElementIndex operator-- (int) { return ElementIndex(i--); }
|
ElementIndex operator-- (int) { return ElementIndex(i--); }
|
||||||
ElementIndex & operator++ () { ++i; return *this; }
|
ElementIndex & operator++ () { ++i; return *this; }
|
||||||
|
@ -602,7 +602,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ExportArray<Element,size_t>(m);
|
ExportArray<Element,ElementIndex>(m);
|
||||||
ExportArray<Element2d,SurfaceElementIndex>(m);
|
ExportArray<Element2d,SurfaceElementIndex>(m);
|
||||||
ExportArray<Segment,SegmentIndex>(m);
|
ExportArray<Segment,SegmentIndex>(m);
|
||||||
ExportArray<Element0d>(m);
|
ExportArray<Element0d>(m);
|
||||||
@ -825,7 +825,7 @@ 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<Array<Element>&(Mesh::*)()> (&Mesh::VolumeElements),
|
static_cast<Array<Element,ElementIndex>&(Mesh::*)()> (&Mesh::VolumeElements),
|
||||||
py::return_value_policy::reference)
|
py::return_value_policy::reference)
|
||||||
|
|
||||||
.def("Elements2D",
|
.def("Elements2D",
|
||||||
|
@ -303,7 +303,7 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Mesh::T_POINTS & points;
|
Mesh::T_POINTS & points;
|
||||||
const Array<Element> & elements;
|
const Array<Element, ElementIndex> & elements;
|
||||||
Table<int, PointIndex> &elementsonpoint;
|
Table<int, PointIndex> &elementsonpoint;
|
||||||
bool own_elementsonpoint;
|
bool own_elementsonpoint;
|
||||||
const MeshingParameters & mp;
|
const MeshingParameters & mp;
|
||||||
@ -312,7 +312,7 @@ namespace netgen
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
PointFunction (Mesh::T_POINTS & apoints,
|
PointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Array<Element> & aelements,
|
const Array<Element, ElementIndex> & aelements,
|
||||||
const MeshingParameters & amp);
|
const MeshingParameters & amp);
|
||||||
PointFunction (const PointFunction & pf);
|
PointFunction (const PointFunction & pf);
|
||||||
virtual ~PointFunction () { if(own_elementsonpoint) delete &elementsonpoint; }
|
virtual ~PointFunction () { if(own_elementsonpoint) delete &elementsonpoint; }
|
||||||
@ -333,7 +333,7 @@ namespace netgen
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
PointFunction :: PointFunction (Mesh::T_POINTS & apoints,
|
PointFunction :: PointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Array<Element> & aelements,
|
const Array<Element, ElementIndex> & aelements,
|
||||||
const MeshingParameters & amp)
|
const MeshingParameters & amp)
|
||||||
: points(apoints), elements(aelements), elementsonpoint(* new Table<int,PointIndex>()), own_elementsonpoint(true), mp(amp)
|
: points(apoints), elements(aelements), elementsonpoint(* new Table<int,PointIndex>()), own_elementsonpoint(true), mp(amp)
|
||||||
{
|
{
|
||||||
@ -494,7 +494,7 @@ namespace netgen
|
|||||||
DenseMatrix m;
|
DenseMatrix m;
|
||||||
public:
|
public:
|
||||||
CheapPointFunction (Mesh::T_POINTS & apoints,
|
CheapPointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Array<Element> & aelements,
|
const Array<Element, ElementIndex> & 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;
|
||||||
@ -503,7 +503,7 @@ namespace netgen
|
|||||||
|
|
||||||
|
|
||||||
CheapPointFunction :: CheapPointFunction (Mesh::T_POINTS & apoints,
|
CheapPointFunction :: CheapPointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Array<Element> & aelements,
|
const Array<Element, ElementIndex> & aelements,
|
||||||
const MeshingParameters & amp)
|
const MeshingParameters & amp)
|
||||||
: PointFunction (apoints, aelements, amp)
|
: PointFunction (apoints, aelements, amp)
|
||||||
{
|
{
|
||||||
@ -990,7 +990,7 @@ int WrongOrientation (const Mesh::T_POINTS & points, const Element & el)
|
|||||||
|
|
||||||
JacobianPointFunction ::
|
JacobianPointFunction ::
|
||||||
JacobianPointFunction (Mesh::T_POINTS & apoints,
|
JacobianPointFunction (Mesh::T_POINTS & apoints,
|
||||||
const Array<Element> & aelements)
|
const Array<Element, ElementIndex> & aelements)
|
||||||
: points(apoints), elements(aelements), elementsonpoint(apoints.Size())
|
: points(apoints), elements(aelements), elementsonpoint(apoints.Size())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < elements.Size(); i++)
|
for (int i = 0; i < elements.Size(); i++)
|
||||||
|
@ -462,12 +462,12 @@ namespace netgen
|
|||||||
ParallelFor (ne, [this](auto i)
|
ParallelFor (ne, [this](auto i)
|
||||||
{
|
{
|
||||||
for (auto & e : edges[i])
|
for (auto & e : edges[i])
|
||||||
e.nr = -1;
|
e = -1;
|
||||||
});
|
});
|
||||||
ParallelFor (nse, [this](auto i)
|
ParallelFor (nse, [this](auto i)
|
||||||
{
|
{
|
||||||
for (auto & e : surfedges[i])
|
for (auto & e : surfedges[i])
|
||||||
e.nr = -1;
|
e = -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -621,15 +621,15 @@ namespace netgen
|
|||||||
switch (element_dim)
|
switch (element_dim)
|
||||||
{
|
{
|
||||||
case 3:
|
case 3:
|
||||||
edges[elnr][loc_edge].nr = edgenum;
|
edges[elnr][loc_edge] = edgenum;
|
||||||
// edges[elnr][loc_edge].orient = edgedir;
|
// edges[elnr][loc_edge].orient = edgedir;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
surfedges[elnr][loc_edge].nr = edgenum;
|
surfedges[elnr][loc_edge] = edgenum;
|
||||||
// surfedges[elnr][loc_edge].orient = edgedir;
|
// surfedges[elnr][loc_edge].orient = edgedir;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
segedges[elnr].nr = edgenum;
|
segedges[elnr] = edgenum;
|
||||||
edge2segment[edgenum] = elnr;
|
edge2segment[edgenum] = elnr;
|
||||||
// segedges[elnr].orient = edgedir;
|
// segedges[elnr].orient = edgedir;
|
||||||
break;
|
break;
|
||||||
@ -992,7 +992,7 @@ namespace netgen
|
|||||||
|
|
||||||
for (int elnr = 0; elnr < ne; elnr++)
|
for (int elnr = 0; elnr < ne; elnr++)
|
||||||
for (int j = 0; j < 6; j++)
|
for (int j = 0; j < 6; j++)
|
||||||
faces[elnr][j].fnr = -1;
|
faces[elnr][j] = -1;
|
||||||
|
|
||||||
|
|
||||||
int max_face_on_vertex = 0;
|
int max_face_on_vertex = 0;
|
||||||
@ -1158,12 +1158,12 @@ namespace netgen
|
|||||||
int facenum = vert2face.Get(face);
|
int facenum = vert2face.Get(face);
|
||||||
if (volume)
|
if (volume)
|
||||||
{
|
{
|
||||||
faces[elnr][j].fnr = facenum;
|
faces[elnr][j] = facenum;
|
||||||
// faces[elnr][j].forient = facedir;
|
// faces[elnr][j].forient = facedir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
surffaces[elnr].fnr = facenum;
|
surffaces[elnr] = facenum;
|
||||||
// surffaces[elnr].forient = facedir;
|
// surffaces[elnr].forient = facedir;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1454,7 +1454,7 @@ namespace netgen
|
|||||||
for (int j = 0; j < 6; j++)
|
for (int j = 0; j < 6; j++)
|
||||||
{
|
{
|
||||||
// int fnum = (faces.Get(i)[j]+7) / 8;
|
// int fnum = (faces.Get(i)[j]+7) / 8;
|
||||||
int fnum = faces[i][j].fnr+1;
|
int fnum = faces[i][j]+1;
|
||||||
if (fnum > 0 && face2surfel.Elem(fnum))
|
if (fnum > 0 && face2surfel.Elem(fnum))
|
||||||
{
|
{
|
||||||
int sel = face2surfel.Elem(fnum);
|
int sel = face2surfel.Elem(fnum);
|
||||||
@ -2005,7 +2005,7 @@ namespace netgen
|
|||||||
int ned = GetNEdges (mesh->VolumeElement(elnr).GetType());
|
int ned = GetNEdges (mesh->VolumeElement(elnr).GetType());
|
||||||
eledges.SetSize (ned);
|
eledges.SetSize (ned);
|
||||||
for (int i = 0; i < ned; i++)
|
for (int i = 0; i < ned; i++)
|
||||||
eledges[i] = edges.Get(elnr)[i].nr+1;
|
eledges[i] = edges.Get(elnr)[i]+1;
|
||||||
// eledges[i] = abs (edges.Get(elnr)[i]);
|
// eledges[i] = abs (edges.Get(elnr)[i]);
|
||||||
}
|
}
|
||||||
void MeshTopology :: GetElementFaces (int elnr, NgArray<int> & elfaces, bool withorientation) const
|
void MeshTopology :: GetElementFaces (int elnr, NgArray<int> & elfaces, bool withorientation) const
|
||||||
@ -2014,7 +2014,7 @@ namespace netgen
|
|||||||
elfaces.SetSize (nfa);
|
elfaces.SetSize (nfa);
|
||||||
|
|
||||||
for (auto i : Range(nfa))
|
for (auto i : Range(nfa))
|
||||||
elfaces[i] = faces.Get(elnr)[i].fnr+1;
|
elfaces[i] = faces.Get(elnr)[i]+1;
|
||||||
|
|
||||||
if(withorientation)
|
if(withorientation)
|
||||||
{
|
{
|
||||||
@ -2072,8 +2072,8 @@ namespace netgen
|
|||||||
eledges[i] = abs (edges.Get(elnr)[i]);
|
eledges[i] = abs (edges.Get(elnr)[i]);
|
||||||
orient[i] = (edges.Get(elnr)[i] > 0 ) ? 1 : -1;
|
orient[i] = (edges.Get(elnr)[i] > 0 ) ? 1 : -1;
|
||||||
*/
|
*/
|
||||||
if (edges.Get(elnr)[i].nr == -1) return i;
|
if (edges.Get(elnr)[i] == -1) return i;
|
||||||
eledges[i] = edges.Get(elnr)[i].nr+1;
|
eledges[i] = edges.Get(elnr)[i]+1;
|
||||||
// orient[i] = edges.Get(elnr)[i].orient ? -1 : 1;
|
// orient[i] = edges.Get(elnr)[i].orient ? -1 : 1;
|
||||||
orient[i] = GetElementEdgeOrientation(elnr, i) ? -1 : 1;
|
orient[i] = GetElementEdgeOrientation(elnr, i) ? -1 : 1;
|
||||||
}
|
}
|
||||||
@ -2084,8 +2084,8 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
// if (!edges.Get(elnr)[i]) return i;
|
// if (!edges.Get(elnr)[i]) return i;
|
||||||
// eledges[i] = abs (edges.Get(elnr)[i]);
|
// eledges[i] = abs (edges.Get(elnr)[i]);
|
||||||
if (edges.Get(elnr)[i].nr == -1) return i;
|
if (edges.Get(elnr)[i] == -1) return i;
|
||||||
eledges[i] = edges.Get(elnr)[i].nr+1;
|
eledges[i] = edges.Get(elnr)[i]+1;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2128,8 +2128,8 @@ namespace netgen
|
|||||||
elfaces[i] = (faces.Get(elnr)[i]-1) / 8 + 1;
|
elfaces[i] = (faces.Get(elnr)[i]-1) / 8 + 1;
|
||||||
orient[i] = (faces.Get(elnr)[i]-1) % 8;
|
orient[i] = (faces.Get(elnr)[i]-1) % 8;
|
||||||
*/
|
*/
|
||||||
if (faces.Get(elnr)[i].fnr == -1) return i;
|
if (faces.Get(elnr)[i] == -1) return i;
|
||||||
elfaces[i] = faces.Get(elnr)[i].fnr+1;
|
elfaces[i] = faces.Get(elnr)[i]+1;
|
||||||
// orient[i] = faces.Get(elnr)[i].forient;
|
// orient[i] = faces.Get(elnr)[i].forient;
|
||||||
orient[i] = GetElementFaceOrientation (elnr, i);
|
orient[i] = GetElementFaceOrientation (elnr, i);
|
||||||
}
|
}
|
||||||
@ -2140,8 +2140,8 @@ namespace netgen
|
|||||||
{
|
{
|
||||||
// if (!faces.Get(elnr)[i]) return i;
|
// if (!faces.Get(elnr)[i]) return i;
|
||||||
// elfaces[i] = (faces.Get(elnr)[i]-1) / 8 + 1;
|
// elfaces[i] = (faces.Get(elnr)[i]-1) / 8 + 1;
|
||||||
if (faces.Get(elnr)[i].fnr == -1) return i;
|
if (faces.Get(elnr)[i] == -1) return i;
|
||||||
elfaces[i] = faces.Get(elnr)[i].fnr+1;
|
elfaces[i] = faces.Get(elnr)[i]+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 6;
|
return 6;
|
||||||
@ -2153,7 +2153,7 @@ namespace netgen
|
|||||||
eledges.SetSize (ned);
|
eledges.SetSize (ned);
|
||||||
for (int i = 0; i < ned; i++)
|
for (int i = 0; i < ned; i++)
|
||||||
// eledges[i] = abs (surfedges.Get(elnr)[i]);
|
// eledges[i] = abs (surfedges.Get(elnr)[i]);
|
||||||
eledges[i] = surfedges.Get(elnr)[i].nr+1;
|
eledges[i] = surfedges.Get(elnr)[i]+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshTopology :: GetEdges (SurfaceElementIndex elnr, NgArray<int> & eledges) const
|
void MeshTopology :: GetEdges (SurfaceElementIndex elnr, NgArray<int> & eledges) const
|
||||||
@ -2162,12 +2162,12 @@ namespace netgen
|
|||||||
eledges.SetSize (ned);
|
eledges.SetSize (ned);
|
||||||
for (int i = 0; i < ned; i++)
|
for (int i = 0; i < ned; i++)
|
||||||
// eledges[i] = abs (surfedges[elnr][i])-1;
|
// eledges[i] = abs (surfedges[elnr][i])-1;
|
||||||
eledges[i] = surfedges[elnr][i].nr;
|
eledges[i] = surfedges[elnr][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
int MeshTopology :: GetSurfaceElementFace (int elnr) const
|
int MeshTopology :: GetSurfaceElementFace (int elnr) const
|
||||||
{
|
{
|
||||||
return surffaces.Get(elnr).fnr+1;
|
return surffaces.Get(elnr)+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2210,8 +2210,8 @@ namespace netgen
|
|||||||
eledges[i] = abs (surfedges.Get(elnr)[i]);
|
eledges[i] = abs (surfedges.Get(elnr)[i]);
|
||||||
orient[i] = (surfedges.Get(elnr)[i] > 0 ) ? 1 : -1;
|
orient[i] = (surfedges.Get(elnr)[i] > 0 ) ? 1 : -1;
|
||||||
*/
|
*/
|
||||||
if (surfedges.Get(elnr)[i].nr == -1) return i;
|
if (surfedges.Get(elnr)[i] == -1) return i;
|
||||||
eledges[i] = surfedges.Get(elnr)[i].nr+1;
|
eledges[i] = surfedges.Get(elnr)[i]+1;
|
||||||
// orient[i] = (surfedges.Get(elnr)[i].orient) ? -1 : 1;
|
// orient[i] = (surfedges.Get(elnr)[i].orient) ? -1 : 1;
|
||||||
orient[i] = GetSurfaceElementEdgeOrientation(elnr, i) ? -1 : 1;
|
orient[i] = GetSurfaceElementEdgeOrientation(elnr, i) ? -1 : 1;
|
||||||
|
|
||||||
@ -2225,8 +2225,8 @@ namespace netgen
|
|||||||
if (!surfedges.Get(elnr)[i]) return i;
|
if (!surfedges.Get(elnr)[i]) return i;
|
||||||
eledges[i] = abs (surfedges.Get(elnr)[i]);
|
eledges[i] = abs (surfedges.Get(elnr)[i]);
|
||||||
*/
|
*/
|
||||||
if (surfedges.Get(elnr)[i].nr == -1) return i;
|
if (surfedges.Get(elnr)[i] == -1) return i;
|
||||||
eledges[i] = surfedges.Get(elnr)[i].nr+1;
|
eledges[i] = surfedges.Get(elnr)[i]+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 4;
|
return 4;
|
||||||
@ -2238,7 +2238,7 @@ namespace netgen
|
|||||||
if (orient)
|
if (orient)
|
||||||
orient[0] = segedges.Get(elnr) > 0 ? 1 : -1;
|
orient[0] = segedges.Get(elnr) > 0 ? 1 : -1;
|
||||||
*/
|
*/
|
||||||
eledges[0] = segedges.Get(elnr).nr+1;
|
eledges[0] = segedges.Get(elnr)+1;
|
||||||
if (orient)
|
if (orient)
|
||||||
// orient[0] = segedges.Get(elnr).orient ? -1 : 1;
|
// orient[0] = segedges.Get(elnr).orient ? -1 : 1;
|
||||||
orient[0] = GetSegmentEdgeOrientation(elnr) ? -1 : 1;
|
orient[0] = GetSegmentEdgeOrientation(elnr) ? -1 : 1;
|
||||||
|
@ -15,17 +15,23 @@
|
|||||||
namespace netgen
|
namespace netgen
|
||||||
{
|
{
|
||||||
|
|
||||||
struct T_EDGE
|
/*
|
||||||
{
|
struct T_EDGE
|
||||||
// int orient:1;
|
{
|
||||||
int nr; // 0-based
|
// int orient:1;
|
||||||
};
|
int nr; // 0-based
|
||||||
|
};
|
||||||
struct T_FACE
|
|
||||||
{
|
struct T_FACE
|
||||||
// int forient:3;
|
{
|
||||||
int fnr; // 0-based
|
// int forient:3;
|
||||||
};
|
int fnr; // 0-based
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef int T_EDGE;
|
||||||
|
typedef int T_FACE;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
template <typename T, int S>
|
template <typename T, int S>
|
||||||
@ -111,12 +117,12 @@ public:
|
|||||||
inline static const ELEMENT_FACE * GetFaces1 (ELEMENT_TYPE et);
|
inline static const ELEMENT_FACE * GetFaces1 (ELEMENT_TYPE et);
|
||||||
inline static const ELEMENT_FACE * GetFaces0 (ELEMENT_TYPE et);
|
inline static const ELEMENT_FACE * GetFaces0 (ELEMENT_TYPE et);
|
||||||
|
|
||||||
int GetSegmentEdge (int segnr) const { return segedges[segnr-1].nr+1; }
|
int GetSegmentEdge (int segnr) const { return segedges[segnr-1]+1; }
|
||||||
int GetEdge (SegmentIndex segnr) const { return segedges[segnr].nr; }
|
int GetEdge (SegmentIndex segnr) const { return segedges[segnr]; }
|
||||||
|
|
||||||
void GetSegmentEdge (int segnr, int & enr, int & orient) const
|
void GetSegmentEdge (int segnr, int & enr, int & orient) const
|
||||||
{
|
{
|
||||||
enr = segedges.Get(segnr).nr+1;
|
enr = segedges.Get(segnr)+1;
|
||||||
// orient = segedges.Get(segnr).orient;
|
// orient = segedges.Get(segnr).orient;
|
||||||
orient = GetSegmentEdgeOrientation(segnr);
|
orient = GetSegmentEdgeOrientation(segnr);
|
||||||
}
|
}
|
||||||
@ -153,7 +159,7 @@ public:
|
|||||||
int GetSurfaceElementFaceOrientation (int elnr) const;
|
int GetSurfaceElementFaceOrientation (int elnr) const;
|
||||||
void GetEdges (SurfaceElementIndex elnr, NgArray<int> & edges) const;
|
void GetEdges (SurfaceElementIndex elnr, NgArray<int> & edges) const;
|
||||||
int GetFace (SurfaceElementIndex elnr) const
|
int GetFace (SurfaceElementIndex elnr) const
|
||||||
{ return surffaces[elnr].fnr; }
|
{ return surffaces[elnr]; }
|
||||||
|
|
||||||
int GetSurfaceElementEdges (int elnr, int * edges, int * orient) const;
|
int GetSurfaceElementEdges (int elnr, int * edges, int * orient) const;
|
||||||
|
|
||||||
|
@ -181,29 +181,29 @@ namespace netgen
|
|||||||
|
|
||||||
(*testout) << endl;
|
(*testout) << endl;
|
||||||
|
|
||||||
cout << "Highest entry in topology hierarchy: " << endl;
|
cout << IM(3) << "Highest entry in topology hierarchy: " << endl;
|
||||||
if (count)
|
if (count)
|
||||||
cout << count << " composite solid(s)" << endl;
|
cout << IM(3) << count << " composite solid(s)" << endl;
|
||||||
else
|
else
|
||||||
if (geom->somap.Extent())
|
if (geom->somap.Extent())
|
||||||
cout << geom->somap.Extent() << " solid(s)" << endl;
|
cout << IM(3) << geom->somap.Extent() << " solid(s)" << endl;
|
||||||
else
|
else
|
||||||
if (geom->shmap.Extent())
|
if (geom->shmap.Extent())
|
||||||
cout << geom->shmap.Extent() << " shells(s)" << endl;
|
cout << IM(3) << geom->shmap.Extent() << " shells(s)" << endl;
|
||||||
else
|
else
|
||||||
if (geom->fmap.Extent())
|
if (geom->fmap.Extent())
|
||||||
cout << geom->fmap.Extent() << " face(s)" << endl;
|
cout << IM(3) << geom->fmap.Extent() << " face(s)" << endl;
|
||||||
else
|
else
|
||||||
if (geom->wmap.Extent())
|
if (geom->wmap.Extent())
|
||||||
cout << geom->wmap.Extent() << " wire(s)" << endl;
|
cout << IM(3) << geom->wmap.Extent() << " wire(s)" << endl;
|
||||||
else
|
else
|
||||||
if (geom->emap.Extent())
|
if (geom->emap.Extent())
|
||||||
cout << geom->emap.Extent() << " edge(s)" << endl;
|
cout << IM(3) << geom->emap.Extent() << " edge(s)" << endl;
|
||||||
else
|
else
|
||||||
if (geom->vmap.Extent())
|
if (geom->vmap.Extent())
|
||||||
cout << geom->vmap.Extent() << " vertices(s)" << endl;
|
cout << IM(3) << geom->vmap.Extent() << " vertices(s)" << endl;
|
||||||
else
|
else
|
||||||
cout << "no entities" << endl;
|
cout << IM(3) << "no entities" << endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user