Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nektar
Nektar
Commits
a964cfd5
Commit
a964cfd5
authored
Feb 08, 2017
by
Michael Turner
Browse files
physicalyly flip reversed surfaces rather than hack it
parent
8d610a03
Changes
4
Hide whitespace changes
Inline
Side-by-side
library/NekMeshUtils/CADSystem/CADSurf.h
View file @
a964cfd5
...
...
@@ -142,16 +142,6 @@ public:
*/
virtual
NekDouble
Curvature
(
Array
<
OneD
,
NekDouble
>
uv
)
=
0
;
/**
* @brief sets the flag to reverse the normal for this suface,
* this is determined in cadsystem and ensures all surface normals,
* point internaly
*/
void
SetReverseNomral
()
{
m_correctNormal
=
false
;
}
/**
* @brief query reversed normal
*/
...
...
@@ -161,6 +151,17 @@ public:
}
protected:
/**
* @brief sets the flag to reverse the normal for this suface,
* this is determined in cadsystem and ensures all surface normals,
* point internaly
*/
void
SetReverseNomral
()
{
m_correctNormal
=
false
;
}
/// normal
bool
m_correctNormal
;
/// List of bounding edges in loops with orientation.
...
...
library/NekMeshUtils/CADSystem/OCE/CADSurfOCE.cpp
View file @
a964cfd5
...
...
@@ -50,12 +50,25 @@ void CADSurfOCE::Initialise(int i, TopoDS_Shape in,
{
// this bit of code changes the units of the cad from mm opencascade
// defualt to m
m_s
=
BRep_Tool
::
Surface
(
TopoDS
::
Face
(
in
));
//reverse the face
if
(
in
.
Orientation
()
==
0
)
{
BRepBuilderAPI_MakeFace
nf
;
m_s
->
VReverse
();
nf
.
Init
(
m_s
,
true
,
1e-6
);
in
=
nf
.
Face
();
SetReverseNomral
();
}
m_edges
=
ein
;
gp_Trsf
transform
;
gp_Pnt
ori
(
0.0
,
0.0
,
0.0
);
transform
.
SetScale
(
ori
,
1.0
/
1000.0
);
TopLoc_Location
mv
(
transform
);
m_s
=
BRep_Tool
::
Surface
(
TopoDS
::
Face
(
in
));
in
.
Move
(
mv
);
m_occSurface
=
BRepAdaptor_Surface
(
TopoDS
::
Face
(
in
));
m_correctNormal
=
true
;
...
...
library/NekMeshUtils/CADSystem/OCE/CADSystemOCE.cpp
View file @
a964cfd5
...
...
@@ -317,11 +317,6 @@ void CADSystemOCE::AddSurf(int i, TopoDS_Shape in,
boost
::
static_pointer_cast
<
CADSurfOCE
>
(
newSurf
)
->
Initialise
(
i
,
in
,
ein
);
m_surfs
[
i
]
=
newSurf
;
if
(
in
.
Orientation
()
==
0
)
{
m_surfs
[
i
]
->
SetReverseNomral
();
}
int
tote
=
0
;
for
(
int
i
=
0
;
i
<
ein
.
size
();
i
++
)
{
...
...
library/NekMeshUtils/SurfaceMeshing/FaceMesh.cpp
View file @
a964cfd5
...
...
@@ -183,13 +183,14 @@ void FaceMesh::Mesh()
pplanemesh
->
Mesh
();
pplanemesh
->
Extract
(
m_connec
);
meshcounter
++
;
break
;
}
// build a local version of the mesh (one set of triangles). this is done
// so edge connectivity infomration can be used for optimisation
BuildLocalMesh
();
OptimiseLocalMesh
();
//
OptimiseLocalMesh();
// make new elements and add to list from list of nodes and connectivity
// from triangle removing unnesercary infomration from the elements
...
...
@@ -913,52 +914,65 @@ bool FaceMesh::Validate()
NekDouble
d2
=
m_mesh
->
m_octree
->
Query
(
m_connec
[
i
][
1
]
->
GetLoc
());
NekDouble
d3
=
m_mesh
->
m_octree
->
Query
(
m_connec
[
i
][
2
]
->
GetLoc
());
Array
<
OneD
,
NekDouble
>
ainfo
,
binfo
,
cinfo
;
ainfo
=
m_connec
[
i
][
0
]
->
GetCADSurfInfo
(
m_id
);
binfo
=
m_connec
[
i
][
1
]
->
GetCADSurfInfo
(
m_id
);
cinfo
=
m_connec
[
i
][
2
]
->
GetCADSurfInfo
(
m_id
);
vector
<
Array
<
OneD
,
NekDouble
>
>
info
;
for
(
int
j
=
0
;
j
<
3
;
j
++
)
{
info
.
push_back
(
m_connec
[
i
][
j
]
->
GetCADSurfInfo
(
m_id
));
}
Array
<
OneD
,
NekDouble
>
uvc
(
2
);
uvc
[
0
]
=
(
a
info
[
0
]
+
b
info
[
0
]
+
c
info
[
0
])
/
3.0
;
uvc
[
1
]
=
(
a
info
[
1
]
+
b
info
[
1
]
+
c
info
[
1
])
/
3.0
;
uvc
[
0
]
=
(
info
[
0
]
[
0
]
+
info
[
1
][
0
]
+
info
[
2
][
0
])
/
3.0
;
uvc
[
1
]
=
(
info
[
0
][
1
]
+
info
[
1
]
[
1
]
+
info
[
2
][
1
])
/
3.0
;
Array
<
OneD
,
NekDouble
>
locc
=
m_cadsurf
->
P
(
uvc
);
NekDouble
d4
=
m_mesh
->
m_octree
->
Query
(
locc
);
NekDouble
d
=
(
d1
+
d2
+
d3
+
d4
)
/
4.0
;
int
numValid
=
0
;
vector
<
bool
>
valid
(
3
);
valid
[
0
]
=
r
[
0
]
<
d
*
1.41
;
valid
[
1
]
=
r
[
1
]
<
d
*
1.41
;
valid
[
2
]
=
r
[
2
]
<
d
*
1.41
;
if
(
r
[
0
]
<
d
*
1.41
)
int
numValid
=
0
;
for
(
int
j
=
0
;
j
<
3
;
j
++
)
{
numValid
++
;
if
(
valid
[
j
])
numValid
++
;
}
if
(
r
[
1
]
<
d
*
1.41
)
{
numValid
++
;
}
cout
<<
numValid
<<
endl
;
if
(
r
[
2
]
<
d
*
1.41
)
//if numvalid is zero no work to be done
/*if (numValid != 3)
{
numValid
++
;
}
NekDouble
rmin
=
min
(
r
[
0
],
r
[
1
]);
rmin
=
min
(
rmin
,
r
[
2
]);
NekDouble
rmax
=
max
(
r
[
0
],
r
[
1
]);
rmax
=
max
(
rmax
,
r
[
2
]);
AddNewPoint(uvc);
}*/
if
(
numValid
!=
3
||
rmax
/
rmin
>
1.05
)
if
(
numValid
!=
3
)
{
Array
<
OneD
,
NekDouble
>
ainfo
,
binfo
,
cinfo
;
ainfo
=
m_connec
[
i
][
0
]
->
GetCADSurfInfo
(
m_id
);
binfo
=
m_connec
[
i
][
1
]
->
GetCADSurfInfo
(
m_id
);
cinfo
=
m_connec
[
i
][
2
]
->
GetCADSurfInfo
(
m_id
);
Array
<
OneD
,
NekDouble
>
uvc
(
2
);
uvc
[
0
]
=
(
ainfo
[
0
]
+
binfo
[
0
]
+
cinfo
[
0
])
/
3.0
;
uvc
[
1
]
=
(
ainfo
[
1
]
+
binfo
[
1
]
+
cinfo
[
1
])
/
3.0
;
//break the bad edge
int
a
=
0
,
b
=
0
;
if
(
!
valid
[
0
])
{
a
=
0
;
b
=
1
;
}
else
if
(
!
valid
[
1
])
{
a
=
1
;
b
=
2
;
}
else
if
(
!
valid
[
2
])
{
a
=
2
;
b
=
0
;
}
Array
<
OneD
,
NekDouble
>
uvn
(
2
);
uvn
[
0
]
=
(
info
[
a
][
0
]
+
info
[
b
][
0
])
/
2.0
;
uvn
[
1
]
=
(
info
[
a
][
1
]
+
info
[
b
][
1
])
/
2.0
;
AddNewPoint
(
uvc
);
}
}
...
...
@@ -1084,11 +1098,6 @@ void FaceMesh::OrientateCurves()
area
+=
(
info
[
0
][
0
]
-
info
[
info
.
size
()
-
1
][
0
])
*
(
info
[
info
.
size
()
-
1
][
1
]
+
info
[
0
][
1
])
/
2.0
;
m_edgeloops
[
i
]
->
area
=
area
;
if
(
m_cadsurf
->
IsReversedNormal
())
{
m_edgeloops
[
i
]
->
area
*=-
1.0
;
}
}
int
ct
=
0
;
...
...
Write
Preview
Markdown
is supported
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