/* 2d Spline curve for Mesh generator */ #include #include #include #include #include "splinegeometry.hpp" namespace netgen { template SplineGeometry :: ~SplineGeometry() { for(int i = 0; i < splines.Size(); i++) delete splines[i]; } template void SplineGeometry :: GetRawData (NgArray & raw_data) const { raw_data.Append(D); // raw_data.Append(elto0); raw_data.Append(splines.Size()); for(int i=0; iGetRawData(raw_data); } template int SplineGeometry :: Load (const NgArray & raw_data, const int startpos) { int pos = startpos; if(raw_data[pos] != D) throw NgException("wrong dimension of spline raw_data"); pos++; // elto0 = raw_data[pos]; pos++; splines.SetSize(int(raw_data[pos])); pos++; NgArray< Point > pts(3); for(int i=0; i(GeomPoint(pts[0],1), GeomPoint(pts[1],1)); } else if (type == 3) { splines[i] = new SplineSeg3(GeomPoint(pts[0],1), GeomPoint(pts[1],1), GeomPoint(pts[2],1)); } else throw NgException("something wrong with spline raw data"); } return pos; } template void SplineGeometry :: GetBoundingBox (Box & box) const { if (!splines.Size()) { Point auxp = 0.; box.Set (auxp); return; } NgArray > points; for (int i = 0; i < splines.Size(); i++) { splines[i]->GetPoints (20, points); if (i == 0) box.Set(points[0]); for (int j = 0; j < points.Size(); j++) box.Add (points[j]); } } /* template void SplineGeometry :: SetGrading (const double grading) { elto0 = grading; } */ template void SplineGeometry :: AppendPoint (const Point & p, const double reffac, const bool hpref) { geompoints.Append (GeomPoint(p, reffac)); geompoints.Last().hpref = hpref; } template class SplineGeometry<2>; template class SplineGeometry<3>; static RegisterClassForArchive> regsp2; static RegisterClassForArchive> regsp3; }