more ngcore::Array in topology, include headers

This commit is contained in:
Joachim Schoeberl 2025-01-05 12:14:08 +01:00
parent 63cb566b8d
commit 1ebc6a0e81
18 changed files with 106 additions and 72 deletions

View File

@ -140,7 +140,8 @@ namespace netgen
operator const T* () const { return x; }
void DoArchive(Archive& archive)
template <typename ARCHIVE>
void DoArchive(ARCHIVE& archive)
{
for(int i=0; i<D; i++)
archive & x[i];
@ -294,7 +295,8 @@ namespace netgen
sol = inv * rhs;
}
void DoArchive(Archive & ar)
template <typename ARCHIVE>
void DoArchive(ARCHIVE & ar)
{
ar.Do(x, H*W);
}
@ -440,7 +442,8 @@ namespace netgen
pmax = center + factor*(pmax-center);
}
void DoArchive(Archive& archive)
template <typename ARCHIVE>
void DoArchive(ARCHIVE & archive)
{ archive & pmin & pmax; }
};

View File

@ -1,9 +1,12 @@
#include <mystdlib.h>
#include <core/array.hpp>
#include "meshclass.hpp"
#include "bisect.hpp"
#include "validate.hpp"
#include "paralleltop.hpp"
#include "meshing.hpp" // quickfix for parallel
// #include "meshing.hpp" // quickfix for parallel
#define noDEBUG

View File

@ -1,7 +1,6 @@
#include <mystdlib.h>
#include "meshing.hpp"
// #include "../general/autodiff.hpp"
@ -1667,12 +1666,21 @@ namespace netgen
if (info.order > 1)
{
const MeshTopology & top = mesh.GetTopology();
/*
top.GetSurfaceElementEdges (elnr+1, info.edgenrs);
for (int i = 0; i < info.edgenrs.Size(); i++)
info.edgenrs[i]--;
*/
/*
auto edgs = top.GetEdges(SurfaceElementIndex(elnr));
info.edgenrs.SetSize(edgs.Size());
for (auto [i,nr] : Enumerate(edgs))
info.edgenrs[i] = nr;
*/
info.SetEdges (top.GetEdges(SurfaceElementIndex(elnr)));
info.facenr = top.GetSurfaceElementFace (elnr+1)-1;
for (int i = 0; i < info.edgenrs.Size(); i++)
info.ndof += edgecoeffsindex[info.edgenrs[i]+1] - edgecoeffsindex[info.edgenrs[i]];
info.ndof += facecoeffsindex[info.facenr+1] - facecoeffsindex[info.facenr];
@ -1748,10 +1756,13 @@ namespace netgen
if (info.order > 1)
{
const MeshTopology & top = mesh.GetTopology();
/*
top.GetSurfaceElementEdges (elnr+1, info.edgenrs);
for (int i = 0; i < info.edgenrs.Size(); i++)
info.edgenrs[i]--;
*/
info.SetEdges(top.GetEdges(SurfaceElementIndex(elnr)));
info.facenr = top.GetSurfaceElementFace (elnr+1)-1;
@ -4193,10 +4204,13 @@ namespace netgen
if (info.order > 1)
{
const MeshTopology & top = mesh.GetTopology();
/*
top.GetSurfaceElementEdges (elnr+1, info.edgenrs);
for (int i = 0; i < info.edgenrs.Size(); i++)
info.edgenrs[i]--;
*/
info.SetEdges(top.GetEdges(elnr));
info.facenr = top.GetSurfaceElementFace (elnr+1)-1;
@ -4355,7 +4369,7 @@ namespace netgen
const double * xi, size_t sxi,
double * x, size_t sx,
double * dxdxi, size_t sdxdxi);
template void CurvedElements ::
CalcMultiPointSurfaceTransformation<2> (SurfaceElementIndex elnr, int npts,

View File

@ -13,6 +13,7 @@
#include <gprim/geomobjects.hpp>
#include "meshtype.hpp"
#include "meshclass.hpp"
namespace netgen
{
@ -248,6 +249,14 @@ private:
int ndof;
NgArrayMem<int,4> edgenrs;
int facenr;
void SetEdges (FlatArray<int> edges)
{
edgenrs.SetSize(edges.Size());
for (int i = 0; i < edges.Size(); i++)
edgenrs[i] = edges[i];
}
};
template <typename T>

View File

@ -19,6 +19,7 @@
#include "meshtype.hpp"
#include "localh.hpp"
#include "topology.hpp"
#include "paralleltop.hpp"
namespace netgen
{

View File

@ -1,8 +1,6 @@
#ifndef FILE_MESHING
#define FILE_MESHING
#include "../include/myadt.hpp"
#include "../include/gprim.hpp"
#include "../include/linalg.hpp"
@ -19,12 +17,12 @@ namespace netgen
}
#include "msghandler.hpp"
#include "meshtype.hpp"
#include "localh.hpp"
#include "topology.hpp"
#include "meshclass.hpp"
#include "global.hpp"
// #include "msghandler.hpp"
// #include "meshtype.hpp"
// #include "localh.hpp"
// #include "topology.hpp"
// #include "meshclass.hpp"
// #include "global.hpp"
#include "meshtool.hpp"

View File

@ -1,5 +1,7 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include "meshing2.hpp"
#include "visual_interface.hpp"
namespace netgen

View File

@ -7,6 +7,11 @@
/* Date: 01. Okt. 95 */
/**************************************************************************/
#include "adfront2.hpp"
#include "ruler2.hpp"
#include "basegeom.hpp"
namespace netgen
{

View File

@ -1,5 +1,8 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include "meshing3.hpp"
#include "findip.hpp"
#include "findip2.hpp"
namespace netgen
{

View File

@ -1,6 +1,7 @@
#ifndef FILE_MESHING3
#define FILE_MESHING3
#include "meshclass.hpp"
#include "adfront3.hpp"
#include "ruler3.hpp"

View File

@ -4,8 +4,9 @@
// #include "../general/ngarray.hpp"
// #include "../gprim/geom3d.hpp"
// #include "../gprim/geomobjects.hpp"
// #include "meshtype.hpp"
// #include "meshclass.hpp"
#include "meshtype.hpp"
#include "meshclass.hpp"
namespace netgen {
///

View File

@ -1,5 +1,7 @@
#include <mystdlib.h>
#include "meshing.hpp"
#include "meshclass.hpp"
#include "bisect.hpp"
#include "paralleltop.hpp"
namespace netgen

View File

@ -1229,7 +1229,7 @@ namespace netgen
face2surfel.SetSize (nfa);
face2surfel = 0;
for (int i = 1; i <= nse; i++)
face2surfel.Elem(GetSurfaceElementFace(i)) = i;
face2surfel[GetSurfaceElementFace(i)-1] = i;
/*
cout << "build table complete" << endl;
@ -1243,11 +1243,8 @@ namespace netgen
surf2volelement.SetSize (nse);
for (int i = 1; i <= nse; i++)
{
surf2volelement.Elem(i)[0] = 0;
surf2volelement.Elem(i)[1] = 0;
}
surf2volelement = INDEX_2(0,0);
(*tracer) ("Topology::Update build surf2vol", false);
// for (int i = 0; i < ne; i++)
ParallelFor (ne, [this](auto i)
@ -1256,12 +1253,12 @@ namespace netgen
{
// int fnum = (faces.Get(i)[j]+7) / 8;
int fnum = faces[i][j]+1;
if (fnum > 0 && face2surfel.Elem(fnum))
if (fnum > 0 && face2surfel[fnum-1])
{
int sel = face2surfel.Elem(fnum);
surf2volelement.Elem(sel)[1] =
surf2volelement.Elem(sel)[0];
surf2volelement.Elem(sel)[0] = i+1;
int sel = face2surfel[fnum-1];
surf2volelement[sel-1][1] =
surf2volelement[sel-1][0];
surf2volelement[sel-1][0] = i+1;
}
}});
(*tracer) ("Topology::Update build surf2vol", true);
@ -2024,7 +2021,7 @@ namespace netgen
int MeshTopology :: GetSurfaceElementFace (int elnr) const
{
return surffaces.Get(elnr)+1;
return surffaces[elnr-1]+1;
}
/*
@ -2101,7 +2098,7 @@ namespace netgen
if (orient)
orient[0] = segedges.Get(elnr) > 0 ? 1 : -1;
*/
eledges[0] = segedges.Get(elnr)+1;
eledges[0] = segedges[elnr-1]+1;
if (orient)
// orient[0] = segedges.Get(elnr).orient ? -1 : 1;
// orient[0] = GetSegmentEdgeOrientation(elnr) ? -1 : 1;
@ -2249,7 +2246,7 @@ namespace netgen
void MeshTopology :: GetSegmentEdge (int segnr, int & enr, int & orient) const
{
enr = segedges.Get(segnr)+1;
enr = segedges[segnr-1]+1;
orient = GetSegmentEdgeOrientation(segnr);
}

View File

@ -12,6 +12,8 @@
(Elements, Faces, Edges, Vertices
*/
#include "meshtype.hpp"
namespace netgen
{
@ -36,10 +38,11 @@ class MeshTopology
Array<std::array<T_FACE,6>, ElementIndex> faces;
Array<std::array<T_EDGE,4>, SurfaceElementIndex> surfedges;
NgArray<T_EDGE> segedges;
NgArray<T_FACE> surffaces;
NgArray<INDEX_2> surf2volelement;
NgArray<int> face2surfel;
Array<T_EDGE> segedges;
Array<T_FACE> surffaces;
Array<INDEX_2, SurfaceElementIndex> surf2volelement;
Array<int> face2surfel;
Array<SegmentIndex> edge2segment;
Table<ElementIndex, PointIndex> vert2element;
Table<SurfaceElementIndex, PointIndex> vert2surfelement;
@ -47,8 +50,6 @@ class MeshTopology
Table<int,PointIndex> vert2pointelement;
int timestamp;
public:
int GetNSurfedges() const {return surfedges.Size();}
MeshTopology () = default;
MeshTopology (MeshTopology && top) = default;
DLL_HEADER MeshTopology (const Mesh & amesh);
@ -72,8 +73,8 @@ public:
bool NeedsUpdate() const;
int GetNEdges () const { return edge2vert.Size(); }
int GetNFaces () const { return face2vert.Size(); }
size_t GetNEdges () const { return edge2vert.Size(); }
size_t GetNFaces () const { return face2vert.Size(); }
static inline short int GetNVertices (ELEMENT_TYPE et);
static inline short int GetNPoints (ELEMENT_TYPE et);
@ -88,19 +89,12 @@ public:
inline static const ELEMENT_FACE * GetFaces0 (ELEMENT_TYPE et);
[[deprecated("use GetEdge(SegmentIndex) instead")]]
int GetSegmentEdge (int segnr) const { return segedges[segnr-1]+1; }
T_EDGE GetSegmentEdge (int segnr) const { return segedges[segnr-1]+1; }
int GetEdge (SegmentIndex segnr) const { return segedges[segnr]; }
T_EDGE GetEdge (SegmentIndex segnr) const { return segedges[segnr]; }
[[deprecated("use GetEdge(SegmentIndex) instead")]]
void GetSegmentEdge (int segnr, int & enr, int & orient) const;
/*
{
enr = segedges.Get(segnr)+1;
// orient = segedges.Get(segnr).orient;
orient = GetSegmentEdgeOrientation(segnr);
}
*/
[[deprecated("use GetEdges (ElementIndex) -> FlatArray")]]
void GetElementEdges (int elnr, NgArray<int> & edges) const;
@ -143,15 +137,15 @@ public:
DLL_HEADER void GetEdgeVertices (int enr, int & v1, int & v2) const;
[[deprecated("use GetEdgeVertices -> tupe(v0,v1) instead")]]
DLL_HEADER void GetEdgeVertices (int enr, PointIndex & v1, PointIndex & v2) const;
auto GetEdgeVertices (int enr) const { return tuple(edge2vert[enr][0], edge2vert[enr][1]); }
auto GetEdgeVertices (int enr) const { return std::array{edge2vert[enr][0], edge2vert[enr][1]}; }
auto GetEdgeVerticesPtr (int enr) const { return &edge2vert[enr][0]; }
auto GetFaceVerticesPtr (int fnr) const { return &face2vert[fnr][0]; }
DLL_HEADER void GetFaceEdges (int fnr, NgArray<int> & edges, bool withorientation = false) const;
ELEMENT_TYPE GetFaceType (int fnr) const
// { return (face2vert.Get(fnr)[3] == 0) ? TRIG : QUAD; }
{ return (!face2vert[fnr-1][3].IsValid()) ? TRIG : QUAD; }
[[deprecated("use GetEdges (SurfaceElementIndex) -> FlatArray")]]
void GetSurfaceElementEdges (int elnr, NgArray<int> & edges) const;
int GetSurfaceElementFace (int elnr) const;
[[deprecated("orientation is outdated")]]
@ -170,6 +164,7 @@ public:
int GetSurfaceElementEdges (int elnr, int * edges, int * orient) const;
int GetNSurfedges() const {return surfedges.Size();}
[[deprecated("use GetEdges(ElementIndex) instead")]]
const T_EDGE * GetElementEdgesPtr (int elnr) const { return &edges[IndexBASE<ElementIndex>()+elnr][0]; }
const T_EDGE * GetSurfaceElementEdgesPtr (int selnr) const { return &surfedges[selnr][0]; }
@ -181,14 +176,14 @@ public:
void GetSurface2VolumeElement (int selnr, int & elnr1, int & elnr2) const
{
elnr1 = surf2volelement.Get(selnr)[0];
elnr2 = surf2volelement.Get(selnr)[1];
elnr1 = surf2volelement[selnr-1][0];
elnr2 = surf2volelement[selnr-1][1];
}
std::array<ElementIndex,2> GetSurface2VolumeElement (SurfaceElementIndex sei)
{
return { ElementIndex( surf2volelement.Get(sei+1)[0] - 1),
ElementIndex( surf2volelement.Get(sei+1)[1] - 1) };
return { ElementIndex( surf2volelement[sei][0] - 1),
ElementIndex( surf2volelement[sei][1] - 1) };
}

View File

@ -2,8 +2,8 @@
#define FILE_OCC_EDGE_INCLUDED
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// #pragma clang diagnostic push
// #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <GProp_GProps.hxx>
#include <TopoDS.hxx>
@ -12,7 +12,7 @@
#include <BRep_TEdge.hxx>
#include <BRep_Tool.hxx>
#pragma clang diagnostic pop
// #pragma clang diagnostic pop
#include "occ_vertex.hpp"
#include "meshing.hpp"

View File

@ -1,15 +1,15 @@
#ifndef FILE_OCC_FACE_INCLUDED
#define FILE_OCC_FACE_INCLUDED
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// #pragma clang diagnostic push
// #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <GProp_GProps.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <ShapeAnalysis_Surface.hxx>
#pragma clang diagnostic pop
// #pragma clang diagnostic pop
#include "occ_vertex.hpp"
#include "meshing.hpp"

View File

@ -3,8 +3,8 @@
#include <variant>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// #pragma clang diagnostic push
// #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <BRepGProp.hxx>
#include <BRep_Tool.hxx>
@ -17,7 +17,7 @@
#include <gp_Trsf.hxx>
#include <gp_GTrsf.hxx>
#pragma clang diagnostic pop
// #pragma clang diagnostic pop
#include "meshing.hpp"

View File

@ -1,13 +1,13 @@
#ifndef FILE_OCC_VERTEX_INCLUDED
#define FILE_OCC_VERTEX_INCLUDED
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// #pragma clang diagnostic push
// #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include <TopoDS.hxx>
#include <BRep_TVertex.hxx>
#pragma clang diagnostic pop
// #pragma clang diagnostic pop
#include "meshing.hpp"
#include "occ_utils.hpp"