some changes

This commit is contained in:
Christopher Lackner 2016-10-11 14:10:36 +02:00
parent 6134717796
commit b8bf194fcf
10 changed files with 60 additions and 42 deletions

View File

@ -53,6 +53,7 @@ namespace netgen
/// A Plane (i.e., the plane and everything behind it). /// A Plane (i.e., the plane and everything behind it).
class Plane : public QuadraticSurface class Plane : public QuadraticSurface
{ {
protected:
/// a point in the plane /// a point in the plane
Point<3> p; Point<3> p;
/// outward normal vector /// outward normal vector

View File

@ -486,15 +486,13 @@ namespace netgen
mesh); mesh);
} }
(*testout) << "refedges size: " << refedges.Size() << endl;
for(int i=0; i<refedges.Size(); i++) for(int i=0; i<refedges.Size(); i++)
{ {
(*testout) << "edgenr: " << refedges[i].edgenr << endl;
auto splinesurface = dynamic_cast<const SplineSurface*>(geometry.GetSurface(refedges[i].surfnr1)); auto splinesurface = dynamic_cast<const SplineSurface*>(geometry.GetSurface(refedges[i].surfnr1));
if(splinesurface) if(splinesurface)
{ {
auto name = splinesurface->GetBCNameOf(specpoints[startpoints.Get(refedges[i].edgenr)].p,specpoints[endpoints.Get(refedges[i].edgenr)].p); auto name = splinesurface->GetBCNameOf(specpoints[startpoints.Get(refedges[i].edgenr)].p,specpoints[endpoints.Get(refedges[i].edgenr)].p);
mesh.SetCD2Name(refedges[i].edgenr-1,*name); mesh.SetCD2Name(refedges[i].edgenr,*name);
} }
} }
@ -1168,7 +1166,23 @@ namespace netgen
refedges.Elem(hi).domout = i; refedges.Elem(hi).domout = i;
} }
else else
{
refedges.Elem(hi).tlosurf = i; refedges.Elem(hi).tlosurf = i;
for(int kk = 0; kk < geometry.GetNTopLevelObjects(); kk++)
{
auto othersolid = geometry.GetTopLevelObject(kk)->GetSolid();
auto othersurf = geometry.GetTopLevelObject(kk)->GetSurface();
if(!othersurf)
{
if(othersolid->IsIn(edgepoints[0]) &&
othersolid->IsIn(edgepoints[edgepoints.Size()-1]))
{
refedges.Elem(hi).domin = kk;
refedges.Elem(hi).domout = kk;
}
}
}
}
if(pre_ok[k-1]) if(pre_ok[k-1])
edges_priority[hi-1] = 1; edges_priority[hi-1] = 1;
@ -1386,6 +1400,7 @@ namespace netgen
seg.surfnr2 = refedges.Get(k).surfnr2; seg.surfnr2 = refedges.Get(k).surfnr2;
seg.seginfo = 0; seg.seginfo = 0;
if (k == 1) seg.seginfo = (refedgesinv.Get(k)) ? 2 : 1; if (k == 1) seg.seginfo = (refedgesinv.Get(k)) ? 2 : 1;
*testout << "add segment at 3" << endl;
mesh.AddSegment (seg); mesh.AddSegment (seg);
//(*testout) << "add seg " << mesh[seg.p1] << "-" << mesh[seg.p2] << endl; //(*testout) << "add seg " << mesh[seg.p1] << "-" << mesh[seg.p2] << endl;
//(*testout) << "refedge " << k << " surf1 " << seg.surfnr1 << " surf2 " << seg.surfnr2 << " inv " << refedgesinv.Get(k) << endl; //(*testout) << "refedge " << k << " surf1 " << seg.surfnr1 << " surf2 " << seg.surfnr2 << " inv " << refedgesinv.Get(k) << endl;
@ -1554,6 +1569,7 @@ namespace netgen
seg.surfnr2 = refedges.Get(k).surfnr2; seg.surfnr2 = refedges.Get(k).surfnr2;
seg.seginfo = 0; seg.seginfo = 0;
if (k == 1) seg.seginfo = (refedgesinv.Get(k)) ? 2 : 1; if (k == 1) seg.seginfo = (refedgesinv.Get(k)) ? 2 : 1;
*testout << "add segment at 1" << endl;
mesh.AddSegment (seg); mesh.AddSegment (seg);
// (*testout) << "add seg " << seg[0] << "-" << seg[1] << endl; // (*testout) << "add seg " << seg[0] << "-" << seg[1] << endl;
} }
@ -1685,6 +1701,7 @@ namespace netgen
seg.surfnr2 = refedges.Get(k).surfnr2; seg.surfnr2 = refedges.Get(k).surfnr2;
seg.seginfo = 0; seg.seginfo = 0;
if (k == 1) seg.seginfo = refedgesinv.Get(k) ? 2 : 1; if (k == 1) seg.seginfo = refedgesinv.Get(k) ? 2 : 1;
*testout << "add segment at 2" << endl;
mesh.AddSegment (seg); mesh.AddSegment (seg);
// (*testout) << "copy seg " << seg[0] << "-" << seg[1] << endl; // (*testout) << "copy seg " << seg[0] << "-" << seg[1] << endl;
#ifdef DEVELOP #ifdef DEVELOP

View File

@ -98,6 +98,12 @@ namespace netgen
//(*testout) << " to " << mesh.LineSegment(i).si << endl; //(*testout) << " to " << mesh.LineSegment(i).si << endl;
} }
for(int k = 1; k<=mesh.GetNFD(); k++)
{
*testout << "face: " << k << endl
<< "FD: " << mesh.GetFaceDescriptor(k) << endl;
}
if (geom.identifications.Size()) if (geom.identifications.Size())
{ {
PrintMessage (3, "Find Identifications"); PrintMessage (3, "Find Identifications");

View File

@ -3,7 +3,7 @@
namespace netgen namespace netgen
{ {
SplineSurface :: SplineSurface() : OneSurfacePrimitive() SplineSurface :: SplineSurface() : OneSurfacePrimitive()
{ ; } { ; }
SplineSurface :: ~SplineSurface() { ; } SplineSurface :: ~SplineSurface() { ; }
@ -35,6 +35,29 @@ void SplineSurface :: AppendPoint(const Point<3> & p, const double reffac, const
return new string("default"); return new string("default");
} }
Array<Plane*>* SplineSurface :: CreatePlanes() const
{
auto planes = new Array<Plane*>();
auto sol = new Solid(new Plane(splines[0]->GetPoint(0),Cross(splines[0]->GetTangent(0),GetNormalVector(splines[0]->GetPoint(0)))));
for(auto spline : splines)
{
planes->Append(new Plane(spline->GetPoint(0),-spline->GetTangent(0)));
}
return planes;
}
void SplineSurface :: Print(ostream & str) const
{
str << "SplineSurface " << endl;
}
void SplineSurface :: Project(Point<3> & p3d) const
{
double val = CalcFunctionValue(p3d);
p3d -= val * GetNormalVector(p3d);
}
double SplineSurface :: CalcFunctionValue (const Point<3> & point) const double SplineSurface :: CalcFunctionValue (const Point<3> & point) const
{ {
auto v1 = splines[0]->GetTangent(0); auto v1 = splines[0]->GetTangent(0);
@ -73,23 +96,8 @@ void SplineSurface :: CalcGradient (const Point<3> & point, Vec<3> & grad) const
} }
} }
Array<Plane*>* SplineSurface :: CreatePlanes() const
{
auto planes = new Array<Plane*>();
auto sol = new Solid(new Plane(splines[0]->GetPoint(0),-(splines[0]->GetTangent(0))));
for(auto spline : splines)
{
planes->Append(new Plane(spline->GetPoint(0),-spline->GetTangent(0)));
}
return planes;
}
void SplineSurface :: Print(ostream & str) const
{
str << "SplineSurface " << endl;
}
INSOLID_TYPE SplineSurface :: BoxInSolid(const BoxSphere<3> & box) const INSOLID_TYPE SplineSurface :: BoxInSolid(const BoxSphere<3> & box) const
{ {
@ -127,4 +135,5 @@ INSOLID_TYPE SplineSurface :: BoxInSolid(const BoxSphere<3> & box) const
return IS_INSIDE; return IS_INSIDE;
} }
} }
} }

View File

@ -4,7 +4,7 @@
namespace netgen namespace netgen
{ {
class SplineSurface : public OneSurfacePrimitive class SplineSurface : public OneSurfacePrimitive
{ {
protected: protected:
Array<GeomPoint<3>> geompoints; Array<GeomPoint<3>> geompoints;
@ -29,6 +29,7 @@ namespace netgen
void AppendSegment(SplineSeg<3>* spline, string* bcname); void AppendSegment(SplineSeg<3>* spline, string* bcname);
Array<Plane*>* CreatePlanes() const; Array<Plane*>* CreatePlanes() const;
virtual void Project (Point<3> & p3d) const;
virtual double CalcFunctionValue (const Point<3> & point) const; virtual double CalcFunctionValue (const Point<3> & point) const;
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const; virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual double HesseNorm () const; virtual double HesseNorm () const;
@ -38,6 +39,7 @@ namespace netgen
virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const; virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const;
virtual void Print (ostream & str) const; virtual void Print (ostream & str) const;

View File

@ -14,7 +14,7 @@ template <>
NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<1> (int nr) const NGX_INLINE DLL_HEADER int Ngx_Mesh :: GetElementIndex<1> (int nr) const
{ {
if(mesh->GetDimension()==3) if(mesh->GetDimension()==3)
return (*mesh)[SegmentIndex(nr)].cd2i; return (*mesh)[SegmentIndex(nr)].edgenr;
else else
return (*mesh)[SegmentIndex(nr)].si; return (*mesh)[SegmentIndex(nr)].si;
} }

View File

@ -5773,6 +5773,7 @@ namespace netgen
void Mesh :: SetCD2Name ( int cd2nr, const string & abcname ) void Mesh :: SetCD2Name ( int cd2nr, const string & abcname )
{ {
cd2nr++;
(*testout) << "setCD2Name on edge " << cd2nr << " to " << abcname << endl; (*testout) << "setCD2Name on edge " << cd2nr << " to " << abcname << endl;
if (cd2nr >= cd2names.Size()) if (cd2nr >= cd2names.Size())
{ {

View File

@ -2418,18 +2418,6 @@ namespace netgen
return s; return s;
} }
string EdgeDescriptor :: default_bcname = "default";
void EdgeDescriptor :: SetBCName (string * bcn)
{
if(bcn)
bcname = bcn;
else
bcn = &default_bcname;
}
Identifications :: Identifications (Mesh & amesh) Identifications :: Identifications (Mesh & amesh)
: mesh(amesh) : mesh(amesh)

View File

@ -1005,9 +1005,6 @@ namespace netgen
{ {
int tlosurf; int tlosurf;
int surfnr[2]; int surfnr[2];
int bcprop;
static string default_bcname;
string* bcname = &default_bcname;
public: public:
EdgeDescriptor () EdgeDescriptor ()
: tlosurf(-1) : tlosurf(-1)
@ -1018,9 +1015,6 @@ namespace netgen
int TLOSurface() const { return tlosurf; } int TLOSurface() const { return tlosurf; }
void SetTLOSurface (int nr) { tlosurf = nr; } void SetTLOSurface (int nr) { tlosurf = nr; }
int BCProperty() const { return bcprop; }
void SetBCProperty (int bc) { bcprop = bc; }
void SetBCName (string* bcn);
}; };