netgen/libsrc/csg/splinesurface.hpp

86 lines
3.2 KiB
C++
Raw Normal View History

2016-10-04 22:30:57 +05:00
#ifndef FILE_SPLINESURFACE
#define FILE_SPLINESURFACE
namespace netgen
{
2016-10-27 18:41:08 +05:00
class SplineSurface : public OneSurfacePrimitive
2016-10-04 22:30:57 +05:00
{
protected:
2019-07-09 13:39:16 +05:00
NgArray<GeomPoint<3>> geompoints;
NgArray<shared_ptr<SplineSeg<3>>> splines;
NgArray<string> bcnames;
NgArray<double> maxh;
shared_ptr<OneSurfacePrimitive> baseprimitive;
2019-07-09 13:39:16 +05:00
shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> cuts;
shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> all_cuts;
2016-10-04 22:30:57 +05:00
public:
2019-07-09 13:39:16 +05:00
SplineSurface(shared_ptr<OneSurfacePrimitive> abaseprimitive, shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> acuts) :
2016-10-27 18:41:08 +05:00
OneSurfacePrimitive(), baseprimitive(abaseprimitive), cuts(acuts)
{ ; }
2018-12-13 18:39:13 +05:00
// default constructor for archive
SplineSurface() {}
2016-10-27 18:41:08 +05:00
virtual ~SplineSurface() { ; }
2016-10-04 22:30:57 +05:00
const auto & GetSplines() const { return splines; }
2017-02-27 15:32:42 +05:00
int GetNSplines() const { return splines.Size(); }
2019-07-09 13:39:16 +05:00
const NgArray<GeomPoint<3>>& GetPoints() const { return geompoints; }
2016-10-04 22:30:57 +05:00
string GetSplineType(const int i) const { return splines[i]->GetType(); }
SplineSeg<3> & GetSpline(const int i) { return *splines[i]; }
const SplineSeg<3> & GetSpline(const int i) const { return *splines[i]; }
2017-02-27 15:32:42 +05:00
int GetNP() const { return geompoints.Size(); }
2016-10-04 22:30:57 +05:00
const GeomPoint<3> & GetPoint(int i) const { return geompoints[i]; }
string GetBCName(int i) const { return bcnames[i]; }
string GetBCNameOf(Point<3> p1, Point<3> p2) const;
2016-10-04 22:30:57 +05:00
DLL_HEADER void AppendPoint(const Point<3> & p, const double reffac = 1., const bool hpref=false);
void AppendSegment(shared_ptr<SplineSeg<3>> spline, string & bcname, double amaxh = -1);
2016-10-27 18:41:08 +05:00
2019-07-09 13:39:16 +05:00
const shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> CreateCuttingSurfaces();
const shared_ptr<NgArray<shared_ptr<OneSurfacePrimitive>>> GetCuts() const { return all_cuts; }
const shared_ptr<OneSurfacePrimitive> GetBase() const { return baseprimitive; }
2016-10-27 18:41:08 +05:00
virtual void Project (Point<3> & p3d) const { baseprimitive->Project(p3d); }
virtual double CalcFunctionValue (const Point<3> & point) const
{ return baseprimitive->CalcFunctionValue (point); }
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const
{ baseprimitive->CalcGradient (point,grad); }
virtual double HesseNorm () const
{ return baseprimitive->HesseNorm(); }
virtual Point<3> GetSurfacePoint () const
{ return baseprimitive->GetSurfacePoint(); }
2019-07-09 13:39:16 +05:00
virtual void CalcSpecialPoints(NgArray<Point<3>> & pts) const
2016-10-27 18:41:08 +05:00
{ baseprimitive->CalcSpecialPoints(pts); }
virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const
{ return baseprimitive->BoxInSolid(box); }
2018-12-13 18:33:21 +05:00
virtual void DoArchive(Archive& ar)
{
ar & geompoints & splines & bcnames & maxh & baseprimitive & cuts & all_cuts;
}
2016-10-27 18:41:08 +05:00
/*
2016-10-11 17:10:36 +05:00
virtual void Project (Point<3> & p3d) const;
2016-10-04 22:30:57 +05:00
virtual double CalcFunctionValue (const Point<3> & point) const;
virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const;
virtual double HesseNorm () const;
virtual Point<3> GetSurfacePoint () const;
2019-07-09 13:39:16 +05:00
virtual void CalcSpecialPoints(NgArray<Point<3>> & pts) const;
2016-10-04 22:30:57 +05:00
virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const;
2016-10-11 17:10:36 +05:00
2016-10-27 18:41:08 +05:00
*/
2016-10-04 22:30:57 +05:00
virtual void Print (ostream & str) const;
};
2016-10-27 18:41:08 +05:00
2016-10-04 22:30:57 +05:00
}
#endif