Merge remote-tracking branch 'origin/master' into ngcore

This commit is contained in:
Matthias Hochsteger 2019-01-14 11:13:11 +01:00
commit 69363e7ff2
4 changed files with 41 additions and 4 deletions

View File

@ -469,6 +469,17 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails!
self.AddSplineSurface(surf);
}),
py::arg("SplineSurface"))
.def("SingularFace", [] (CSGeometry & self, shared_ptr<SPSolid> sol, shared_ptr<SPSolid> surfaces, double factor)
{
int tlonum = -1;
for (int i = 0; i < self.GetNTopLevelObjects(); i++)
if (self.GetTopLevelObject(i)->GetSolid() == sol->GetSolid())
tlonum = i;
if (tlonum == -1) throw NgException("not a top-level-object");
if (!surfaces) surfaces = sol;
auto singface = new SingularFace(tlonum, surfaces->GetSolid(), factor);
self.singfaces.Append(singface);
}, py::arg("solid"), py::arg("surfaces")=nullptr, py::arg("factor")=0.25)
.def("SingularEdge", [] (CSGeometry & self, shared_ptr<SPSolid> s1,shared_ptr<SPSolid> s2, double factor)
{
auto singedge = new SingularEdge(1, -1, self, s1->GetSolid(), s2->GetSolid(), factor);

View File

@ -44,6 +44,19 @@ namespace netgen
size_t Size() const { return s; }
T * Release() { T * hd = data; data = nullptr; return hd; }
};
template <typename T, int S>
class Ng_BufferMS
{
size_t s;
T data[S];
public:
Ng_BufferMS (size_t as) : s(as) { ; }
size_t Size() const { return s; }
T & operator[] (size_t i) { return data[i]; }
T operator[] (size_t i) const { return data[i]; }
};
class Ng_Element
{
@ -185,6 +198,7 @@ namespace netgen
int operator[] (size_t i) const { return ptr[i]-POINTINDEX_BASE; }
};
/*
class Ng_Edges
{
public:
@ -194,11 +208,11 @@ namespace netgen
size_t Size() const { return ned; }
int operator[] (size_t i) const { return ptr[i]-1; }
};
*/
public:
Ng_Vertices vertices;
Ng_Edges edges;
// Ng_Edges edges;
int surface_el; // -1 if face not on surface
};
@ -282,7 +296,8 @@ namespace netgen
template <int DIM>
const Ng_Node<DIM> GetNode (int nr) const;
Ng_BufferMS<int,4> GetFaceEdges (int fnr) const;
template <int DIM>
int GetNNodes ();

View File

@ -717,6 +717,16 @@ namespace netgen
return mesh->GetIdentifications().GetType(idnr+1);
}
Ng_BufferMS<int,4> Ngx_Mesh::GetFaceEdges (int fnr) const
{
const MeshTopology & topology = mesh->GetTopology();
ArrayMem<int,4> ia;
topology.GetFaceEdges (fnr+1, ia);
Ng_BufferMS<int,4> res(ia.Size());
for (size_t i = 0; i < ia.Size(); i++)
res[i] = ia[i]-1;
return res;
}

View File

@ -3398,6 +3398,7 @@ namespace netgen
size_t nsel = mtris.Size();
NgProfiler::StartTimer (timer_bisecttrig);
(*opt.tracer)("Bisect trigs", false);
for (size_t i = 0; i < nsel; i++)
if (mtris[i].marked)
{
@ -3440,7 +3441,7 @@ namespace netgen
}
NgProfiler::StopTimer (timer_bisecttrig);
(*opt.tracer)("Bisect trigs", true);
int nquad = mquads.Size();
for (int i = 1; i <= nquad; i++)