mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-26 12:50:34 +05:00
89fe31b550
commit fa556baaa222ba349d534027f7203588dcda6ad8 Author: Christopher Lackner <christopher.lackner@tuwien.ac.at> Date: Thu Feb 23 15:56:47 2017 +0100 add python path to docker template commit 54eb7eedc77ad8c86952c347536e7e1a854b62ed Author: Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at> Date: Thu Feb 23 14:59:45 2017 +0100 install pytest in docker images commit 3c1c755891e8372762130a6ed8c39cf056430264 Author: Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at> Date: Thu Feb 23 14:52:32 2017 +0100 enable CTest properly, add pytest commit 4c4cf229ab8e7fd6057f535fb05c3079a9278f80 Author: Christopher Lackner <christopher.lackner@tuwien.ac.at> Date: Thu Feb 23 14:02:13 2017 +0100 fix write splinesurface to savemesh commit 069fbdbc529c9dd91644663f3f365e08be5af70e Author: Christopher Lackner <christopher.lackner@tuwien.ac.at> Date: Thu Feb 23 09:03:26 2017 +0100 fix lifetime of SplineSurface
76 lines
2.0 KiB
C++
76 lines
2.0 KiB
C++
|
|
#include <csg.hpp>
|
|
|
|
namespace netgen
|
|
{
|
|
void SplineSurface :: AppendPoint(const Point<3> & p, const double reffac, const bool hpref)
|
|
{
|
|
auto pp = Point<3>(p);
|
|
geompoints.push_back(GeomPoint<3>(pp,reffac));
|
|
geompoints.back().hpref = hpref;
|
|
}
|
|
|
|
void SplineSurface :: AppendSegment(shared_ptr<SplineSeg<3>> sp, string & bcname, double amaxh)
|
|
{
|
|
splines.push_back(sp);
|
|
bcnames.push_back(bcname);
|
|
maxh.Append(amaxh);
|
|
}
|
|
|
|
string SplineSurface :: GetBCNameOf (Point<3> p1, Point<3> p2) const
|
|
{
|
|
|
|
double eps = 1e-5;
|
|
for(int i=0; i<splines.size(); i++)
|
|
{
|
|
auto pp1 = Point<3>(splines[i]->GetPoint(0));
|
|
Project(pp1);
|
|
auto pp2 = Point<3>(splines[i]->GetPoint(1));
|
|
Project(pp2);
|
|
if (((pp1-p1).Length()<eps && (pp2-p2).Length() < eps) || ((pp1-p2).Length() < eps && (pp2-p1).Length() < eps))
|
|
{
|
|
return bcnames[i];
|
|
}
|
|
}
|
|
return "default";
|
|
}
|
|
|
|
const shared_ptr<std::vector<shared_ptr<OneSurfacePrimitive>>> SplineSurface :: CreateCuttingSurfaces()
|
|
{
|
|
if(all_cuts)
|
|
return all_cuts;
|
|
auto cuttings = make_shared<std::vector<shared_ptr<OneSurfacePrimitive>>>();
|
|
for (auto cut : *cuts)
|
|
cuttings->push_back(cut);
|
|
for(int i = 0; i<splines.size(); i++)
|
|
{
|
|
auto spline = splines[i];
|
|
auto lineseg = dynamic_cast<LineSeg<3>*>(spline.get());
|
|
if(lineseg)
|
|
{
|
|
auto p1 = Point<3>(spline->GetPoint(0));
|
|
Project(p1);
|
|
auto p2 = Point<3>(spline->GetPoint(1));
|
|
Project(p2);
|
|
auto vec = Vec<3>(p2)-Vec<3>(p1);
|
|
auto plane = make_shared<Plane>(p1,-Cross(vec,baseprimitive->GetNormalVector(p1)));
|
|
if(maxh[i]>0)
|
|
{
|
|
plane->SetMaxH(maxh[i]);
|
|
}
|
|
cuttings->push_back(plane);
|
|
}
|
|
else
|
|
throw NgException("Spline type not implemented for SplineSurface!");
|
|
}
|
|
all_cuts = cuttings;
|
|
return cuttings;
|
|
}
|
|
|
|
void SplineSurface :: Print(ostream & str) const
|
|
{
|
|
str << "SplineSurface with base " << *baseprimitive << endl;
|
|
}
|
|
|
|
}
|