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
cac5a4dc
Commit
cac5a4dc
authored
Feb 25, 2017
by
Michael Turner
Browse files
think 2d is fixed
parent
9d2e8367
Changes
3
Hide whitespace changes
Inline
Side-by-side
library/NekMeshUtils/2DGenerator/2DGenerator.cpp
View file @
cac5a4dc
...
...
@@ -217,8 +217,12 @@ void Generator2D::MakeBL(int faceid)
swap
(
p1
,
p2
);
}
Array
<
OneD
,
NekDouble
>
n
(
2
);
n
[
0
]
=
p2
[
1
]
-
p1
[
1
];
n
[
1
]
=
p1
[
0
]
-
p2
[
0
];
n
[
0
]
=
p1
[
1
]
-
p2
[
1
];
n
[
1
]
=
p2
[
0
]
-
p1
[
0
];
if
(
m_mesh
->
m_cad
->
GetSurf
(
faceid
)
->
IsReversedNormal
())
{
n
[
0
]
*=
-
1.0
;
n
[
1
]
*=
-
1.0
;
}
NekDouble
mag
=
sqrt
(
n
[
0
]
*
n
[
0
]
+
n
[
1
]
*
n
[
1
]);
n
[
0
]
/=
mag
;
n
[
1
]
/=
mag
;
...
...
library/NekMeshUtils/CADSystem/OCE/CADSurfOCE.cpp
View file @
cac5a4dc
...
...
@@ -52,11 +52,11 @@ void CADSurfOCE::Initialise(int i, TopoDS_Shape in)
m_s
=
BRep_Tool
::
Surface
(
TopoDS
::
Face
(
in
));
//reverse the face
/*
if(in.Orientation() ==
0
)
if
(
in
.
Orientation
()
==
1
)
{
SetReverseNomral
();
}
*/
}
gp_Trsf
transform
;
gp_Pnt
ori
(
0.0
,
0.0
,
0.0
);
...
...
@@ -71,16 +71,6 @@ void CADSurfOCE::Initialise(int i, TopoDS_Shape in)
Array
<
OneD
,
NekDouble
>
uv
(
2
);
uv
[
0
]
=
GetBounds
()[
0
];
uv
[
1
]
=
GetBounds
()[
2
];
BRepLProp_SLProps
slp
(
m_occSurface
,
2
,
1e-6
);
slp
.
SetParameters
(
uv
[
0
],
uv
[
1
]);
gp_Dir
d
=
slp
.
Normal
();
cout
<<
d
.
X
()
<<
" "
<<
d
.
Y
()
<<
" "
<<
d
.
Z
()
<<
endl
;
Array
<
OneD
,
NekDouble
>
n
=
N
(
uv
);
cout
<<
n
[
0
]
<<
" "
<<
n
[
1
]
<<
" "
<<
n
[
2
]
<<
endl
;
exit
(
-
1
);
}
Array
<
OneD
,
NekDouble
>
CADSurfOCE
::
GetBounds
()
...
...
@@ -273,32 +263,27 @@ Array<OneD, NekDouble> CADSurfOCE::N(Array<OneD, NekDouble> uv)
Test
(
uv
);
#endif
Array
<
OneD
,
NekDouble
>
normal
(
3
);
gp_Pnt
Loc
;
gp_Vec
D1U
,
D1V
;
m_occSurface
.
D1
(
uv
[
0
],
uv
[
1
],
Loc
,
D1U
,
D1V
);
gp_Vec
n
=
D1U
.
Crossed
(
D1V
);
BRepLProp_SLProps
slp
(
m_occSurface
,
2
,
1e-6
);
slp
.
SetParameters
(
uv
[
0
],
uv
[
1
]);
if
(
!
m_correctNormal
)
if
(
!
slp
.
IsNormalDefined
()
)
{
n
.
Reverse
(
);
return
Array
<
OneD
,
NekDouble
>
(
3
,
0.0
);
}
if
(
n
.
X
()
==
0
&&
n
.
Y
()
==
0
&&
n
.
Z
()
==
0
)
{
// Return bad normal
normal
[
0
]
=
0.0
;
normal
[
1
]
=
0.0
;
normal
[
2
]
=
0.0
;
}
else
gp_Dir
d
=
slp
.
Normal
();
Array
<
OneD
,
NekDouble
>
normal
(
3
);
if
(
!
m_correctNormal
)
{
n
.
Normalize
();
normal
[
0
]
=
n
.
X
();
normal
[
1
]
=
n
.
Y
();
normal
[
2
]
=
n
.
Z
();
d
.
Reverse
();
}
normal
[
0
]
=
d
.
X
();
normal
[
1
]
=
d
.
Y
();
normal
[
2
]
=
d
.
Z
();
return
normal
;
}
...
...
library/NekMeshUtils/CADSystem/OCE/CADSystemOCE.cpp
View file @
cac5a4dc
...
...
@@ -106,7 +106,7 @@ bool CADSystemOCE::LoadCAD()
for
(
explr
.
Init
(
shape
,
TopAbs_FACE
);
explr
.
More
();
explr
.
Next
())
{
TopoDS_Shape
f
=
explr
.
Current
()
.
Oriented
(
TopAbs_FORWARD
)
;
TopoDS_Shape
f
=
explr
.
Current
();
ASSERTL0
(
!
mapOfFaces
.
Contains
(
f
),
"duplicated faces"
);
int
i
=
mapOfFaces
.
Add
(
f
);
...
...
@@ -116,7 +116,7 @@ bool CADSystemOCE::LoadCAD()
// attempts to identify properties of the vertex on the degen edge
for
(
int
i
=
1
;
i
<=
mapOfFaces
.
Extent
();
i
++
)
{
TopoDS_Shape
face
=
mapOfFaces
.
FindKey
(
i
);
TopoDS_Shape
face
=
mapOfFaces
.
FindKey
(
i
)
.
Oriented
(
TopAbs_FORWARD
)
;
TopTools_IndexedMapOfShape
localEdges
;
TopExp
::
MapShapes
(
face
,
TopAbs_EDGE
,
localEdges
);
...
...
@@ -183,8 +183,10 @@ void CADSystemOCE::AddSurf(int i, TopoDS_Shape in)
CADSurfSharedPtr
newSurf
=
GetCADSurfFactory
().
CreateInstance
(
key
);
boost
::
static_pointer_cast
<
CADSurfOCE
>
(
newSurf
)
->
Initialise
(
i
,
in
);
//do the exploration on forward oriented
TopoDS_Shape
face
=
in
.
Oriented
(
TopAbs_FORWARD
);
TopTools_IndexedMapOfShape
mapOfWires
;
TopExp
::
MapShapes
(
in
,
TopAbs_WIRE
,
mapOfWires
);
TopExp
::
MapShapes
(
face
,
TopAbs_WIRE
,
mapOfWires
);
vector
<
EdgeLoopSharedPtr
>
edgeloops
;
// now we acutally analyse the loops for cad building
for
(
int
j
=
1
;
j
<=
mapOfWires
.
Extent
();
j
++
)
...
...
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