13 #include <IGESControl_Reader.hxx>
14 #include <IGESControl_Controller.hxx>
15 #include <IGESControl_Writer.hxx>
19 #include <GC_MakeCircle.hxx>
20 #include <BRepBuilderAPI_MakeEdge.hxx>
21 #include <BRepBuilderAPI_MakeFace.hxx>
22 #include <BRepBuilderAPI_MakeWire.hxx>
24 #include <TopoDS_Wire.hxx>
25 #include <TopoDS_Edge.hxx>
26 #include <TopoDS_Face.hxx>
27 #include <GeomConvert_CompCurveToBSplineCurve.hxx>
28 #include <Geom_BoundedCurve.hxx>
29 #include <Geom_TrimmedCurve.hxx>
30 #include <Geom_BSplineCurve.hxx>
31 #include <GeomLib_Tool.hxx>
32 #include <GeomAdaptor_Curve.hxx>
33 #include <GCPnts_AbscissaPoint.hxx>
34 #include <GC_MakeArcOfCircle.hxx>
35 #include <ShapeAnalysis_Curve.hxx>
36 #include <GeomAPI_IntCS.hxx>
37 #include <BRepAdaptor_Curve.hxx>
58 Handle(Geom_Curve) ref_curve,
59 TopLoc_Location *curr_loc,
61 const vector<bool> &smoothing_dofs,
62 const unsigned int b_point_id,
63 const unsigned int d_point_id,
64 const double tolerance) :
65 euler_vector(euler_vector),
67 curr_location(curr_loc),
69 projection(BRepBuilderAPI_MakeEdge(ref_curve)),
71 smoothing_dofs(smoothing_dofs),
94 TopoDS_Edge
edge = BRepBuilderAPI_MakeEdge(ref_curve);
96 BRepAdaptor_Curve AC(edge);
110 ShapeAnalysis_Curve curve_analysis;
124 for (
unsigned int i=0; i<dh.n_dofs()/3; ++i)
130 off = curve_analysis.Project(AC, P,
tolerance, proj, t, Standard_True);
133 double dist = GCPnts_AbscissaPoint::Length(AC,t,
occ_base_t);
141 ref_L = endmap->first.second;
148 unsigned int count = 0;
167 for (
unsigned int i=0; i<3; ++i)
171 if (maintain_on_original_curve ==
true)
185 Handle(Geom_Plane) horPlane =
new Geom_Plane(0.,0.,1.,-dP0(2));
186 horPlane->Transform(L_inv.Transformation());
187 GeomAPI_IntCS Intersector(ref_curve, horPlane);
188 int npoints = Intersector.NbPoints();
189 AssertThrow((npoints != 0),
ExcMessage(
"Reference curve is not intersecting with horizontal plane!"));
190 double minDistance=1e7;
191 for (
int i=0; i<npoints; ++i)
193 gp_Pnt inters_point = Intersector.Point(i+1);
196 if (dP0.
distance(inters) < minDistance)
209 std::vector<Point<3> > current_points;
213 unsigned int id=it->second;
215 for (
unsigned int d=0; d<3; ++d)
217 current_points.push_back(p);
225 for (
unsigned int i=0; i<3; ++i)
227 gp_Pnt occ_driving_point =
Pnt(dP);
230 ShapeAnalysis_Curve curve_analysis;
247 TopoDS_Edge
edge = BRepBuilderAPI_MakeEdge(curve);
249 BRepAdaptor_Curve AC(edge);
254 ShapeAnalysis_Curve curve_analysis;
264 unsigned int counter = 0;
267 unsigned int i=it->second;
268 double dist=it->first.second;
270 for (
unsigned int d=0; d<3; ++d)
277 off = curve_analysis.Project(AC,
Pnt(p),
tolerance, proj, old_t, Standard_True);
285 GCPnts_AbscissaPoint AP(AC, new_dist,
occ_base_t);
286 double new_t = AP.Parameter();
291 for (
unsigned int j=0; j<3; ++j)
303 void LineSmoothing::get_curve_tangent_vectors_at_smoothing_dofs(
Vector<double> &tangents)
308 TopoDS_Edge
edge = BRepBuilderAPI_MakeEdge(curve);
310 BRepAdaptor_Curve AC(edge);
314 unsigned int i=it->second;
315 double t=it->first.first;
320 tangents[3*i] = V1.X();
321 tangents[3*i+1] = V1.Y();
322 tangents[3*i+2] = V1.Z();
330 ExcMessage(
"Length ratios vector has wrong size"));
333 TopoDS_Edge
edge = BRepBuilderAPI_MakeEdge(curve);
335 BRepAdaptor_Curve AC(edge);
341 unsigned int i=it->second;
342 double dist = it->first.second;
344 for (
unsigned int j=0; j<3; ++j)
345 length_ratios(3*i+j) = dist/L;
std::vector< unsigned int > node_indices
void get_curve_length_ratios_at_smoothing_dofs(Vector< double > &length_ratios)
TopLoc_Location ref_location
Handle_Geom_Curve interpolation_curve(std::vector< Point< 3 > > &curve_points)
Vector< double > lengths_after_smoothing
void smooth(bool maintain_on_original_curve=true)
Perform the actual smoothing.
Vector< double > & euler_vector
numbers::NumberTraits< double >::real_type distance(const Point< dim, double > &p) const
#define AssertThrow(cond, exc)
void update_reference(unsigned int base_point_id, unsigned int driving_point_id)
Handle(Geom_Curve) get_curve()
std::map< std::pair< double, double >, unsigned int, comp_points_on_curve > smoothing_list
static::ExceptionBase & ExcMessage(std::string arg1)
types::global_dof_index n_dofs() const
std::vector< Point< 3 > > support_points
Vector< double > fixed_length_ratios
std::map< std::pair< double, double >, unsigned int, comp_points_on_curve >::iterator iterator
const DoFHandler< 2, 3 > & dh
TopLoc_Location * curr_location
const std::vector< bool > & smoothing_dofs
Vector< double > lengths_before_smoothing
dealii::Point< 3 > Pnt(const gp_Pnt &p)
Convert OpenCascade point into.
TopLoc_Location used_location
virtual void reinit(const size_type N, const bool omit_zeroing_entries=false)
unsigned int driving_point_id
We collect in this namespace all utilities which operate on OpenCascade entities which don't need cla...
Handle(Geom_Curve) NumericalTowingTank
unsigned int base_point_id
static::ExceptionBase & ExcInternalError()