Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nektar
Nektar
Commits
c83d04c9
Commit
c83d04c9
authored
Oct 03, 2016
by
Michael Turner
Browse files
pick files
parent
051b5baa
Changes
3
Hide whitespace changes
Inline
Side-by-side
library/NekMeshUtils/CADSystem/CADCurve.cpp
View file @
c83d04c9
...
...
@@ -48,6 +48,7 @@ CADCurve::CADCurve(int i, TopoDS_Shape in)
gp_Pnt
ori
(
0.0
,
0.0
,
0.0
);
transform
.
SetScale
(
ori
,
1.0
/
1000.0
);
TopLoc_Location
mv
(
transform
);
TopoDS_Shape
cp
=
in
;
in
.
Move
(
mv
);
m_occEdge
=
TopoDS
::
Edge
(
in
);
...
...
@@ -57,6 +58,9 @@ CADCurve::CADCurve(int i, TopoDS_Shape in)
BRepGProp
::
LinearProperties
(
m_occEdge
,
System
);
m_length
=
System
.
Mass
();
Array
<
OneD
,
NekDouble
>
b
=
Bounds
();
m_c
=
BRep_Tool
::
Curve
(
TopoDS
::
Edge
(
cp
),
b
[
0
],
b
[
1
]);
m_id
=
i
;
m_type
=
curve
;
}
...
...
@@ -87,7 +91,6 @@ NekDouble CADCurve::tAtArcLength(NekDouble s)
NekDouble
CADCurve
::
Length
(
NekDouble
ti
,
NekDouble
tf
)
{
Array
<
OneD
,
NekDouble
>
b
=
Bounds
();
Handle
(
Geom_Curve
)
m_c
=
BRep_Tool
::
Curve
(
m_occEdge
,
b
[
0
],
b
[
1
]);
Handle
(
Geom_Curve
)
NewCurve
=
new
Geom_TrimmedCurve
(
m_c
,
ti
,
tf
);
TopoDS_Edge
NewEdge
=
BRepBuilderAPI_MakeEdge
(
NewCurve
);
GProp_GProps
System
;
...
...
@@ -95,6 +98,37 @@ NekDouble CADCurve::Length(NekDouble ti, NekDouble tf)
return
System
.
Mass
()
/
1000.0
;
}
NekDouble
CADCurve
::
loct
(
Array
<
OneD
,
NekDouble
>
xyz
)
{
NekDouble
t
=
0.0
;
Array
<
OneD
,
NekDouble
>
b
=
Bounds
();
gp_Pnt
loc
(
xyz
[
0
]
*
1000.0
,
xyz
[
1
]
*
1000.0
,
xyz
[
2
]
*
1000.0
);
/*GeomAPI_ProjectPointOnCurve projection(
loc,m_c,b[0],b[1]);
if (projection.NbPoints() == 0)
{
ASSERTL0(false,"failed");
}
else
{
t = projection.Parameter(1);
if(projection.Distance(1) > 1e-6)
{
cout << "large curve projection: " << projection.Distance(1) << endl;
}
}*/
ShapeAnalysis_Curve
sac
;
gp_Pnt
p
;
NekDouble
d
=
sac
.
Project
(
m_c
,
loc
,
1e-7
,
p
,
t
);
ASSERTL0
(
p
.
Distance
(
loc
)
<
1e-6
,
"large loct distance sac"
);
return
t
;
}
Array
<
OneD
,
NekDouble
>
CADCurve
::
P
(
NekDouble
t
)
{
Array
<
OneD
,
NekDouble
>
location
(
3
);
...
...
@@ -107,6 +141,22 @@ Array<OneD, NekDouble> CADCurve::P(NekDouble t)
return
location
;
}
Array
<
OneD
,
NekDouble
>
CADCurve
::
D1
(
NekDouble
t
)
{
Array
<
OneD
,
NekDouble
>
out
(
6
);
gp_Pnt
loc
;
gp_Vec
d1
;
m_occCurve
.
D1
(
t
,
loc
,
d1
);
out
[
0
]
=
loc
.
X
();
out
[
1
]
=
loc
.
Y
();
out
[
2
]
=
loc
.
Z
();
out
[
3
]
=
d1
.
X
();
out
[
4
]
=
d1
.
Y
();
out
[
5
]
=
d1
.
Z
();
return
out
;
}
Array
<
OneD
,
NekDouble
>
CADCurve
::
D2
(
NekDouble
t
)
{
Array
<
OneD
,
NekDouble
>
out
(
9
);
...
...
library/NekMeshUtils/CADSystem/CADCurve.h
View file @
c83d04c9
...
...
@@ -96,6 +96,8 @@ public:
*/
Array
<
OneD
,
NekDouble
>
P
(
NekDouble
t
);
Array
<
OneD
,
NekDouble
>
D1
(
NekDouble
t
);
/**
* @brief Gets the second derivatives at t
*/
...
...
@@ -152,11 +154,15 @@ public:
return
m_mainVerts
;
}
NekDouble
loct
(
Array
<
OneD
,
NekDouble
>
xyz
);
private:
/// OpenCascade object of the curve.
BRepAdaptor_Curve
m_occCurve
;
/// OpenCascade edge
TopoDS_Edge
m_occEdge
;
/// Alternate object used for reverse lookups
Handle
(
Geom_Curve
)
m_c
;
/// Length of edge
NekDouble
m_length
;
/// List of surfaces which this curve belongs to.
...
...
library/NekMeshUtils/CADSystem/OpenCascade.h
View file @
c83d04c9
...
...
@@ -48,6 +48,7 @@
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAbs_SurfaceType.hxx>
#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
...
...
@@ -67,6 +68,7 @@
#include <ShapeAnalysis_Wire.hxx>
#include <TopoDS_Wire.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <ShapeAnalysis_Curve.hxx>
#include <Standard_Macro.hxx>
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment