Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
integration-cfmesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Community
integration-cfmesh
Commits
2aba8cff
Commit
2aba8cff
authored
Jul 24, 2014
by
Franjo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial implementation of the whole methodology
parent
ace1d529
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
18 deletions
+127
-18
meshLibrary/utilities/smoothers/geometry/meshOptimizer/symmetryPlaneOptimisation/symmetryPlaneOptimisation.C
...zer/symmetryPlaneOptimisation/symmetryPlaneOptimisation.C
+124
-17
meshLibrary/utilities/smoothers/geometry/meshOptimizer/symmetryPlaneOptimisation/symmetryPlaneOptimisation.H
...zer/symmetryPlaneOptimisation/symmetryPlaneOptimisation.H
+1
-1
utilities/improveSymmetryPlanes/improveSymmetryPlanes.C
utilities/improveSymmetryPlanes/improveSymmetryPlanes.C
+2
-0
No files found.
meshLibrary/utilities/smoothers/geometry/meshOptimizer/symmetryPlaneOptimisation/symmetryPlaneOptimisation.C
View file @
2aba8cff
...
...
@@ -27,20 +27,10 @@ Description
#include "demandDrivenData.H"
#include "symmetryPlaneOptimisation.H"
#include "partTetMesh.H"
#include "meshSurfaceEngine.H"
#include "meshSurfaceEngineModifier.H"
#include "partTetMeshSimplex.H"
#include "meshUntangler.H"
#include "volumeOptimizer.H"
#include "knuppMetric.H"
#include <map>
# ifdef USE_OMP
#include <omp.h>
# endif
#include "polyMeshGenAddressing.H"
#include "helperFunctions.H"
#include "polyMeshGenChecks.H"
#include "meshOptimizer.H"
// #define DEBUGSearch
...
...
@@ -64,6 +54,7 @@ void symmetryPlaneOptimisation::detectSymmetryPlanes()
forAll
(
boundaries
,
patchI
)
{
Info
<<
"Patch "
<<
patchI
<<
" is of type "
<<
boundaries
[
patchI
].
type
()
<<
endl
;
if
(
boundaries
[
patchI
].
type
()
==
"symmetryPlane"
)
{
std
::
pair
<
vector
,
label
>&
cs
=
centreSum
[
patchI
];
...
...
@@ -108,14 +99,82 @@ void symmetryPlaneOptimisation::detectSymmetryPlanes()
const
std
::
pair
<
vector
,
label
>&
ns
=
normalSum
[
it
->
first
];
const
point
n
=
ns
.
first
/
ns
.
second
;
const
word
pName
=
boundaries
[
it
->
first
].
patchName
();
symmetryPlanes_
.
insert
(
std
::
make_pair
(
pName
,
plane
(
c
,
n
)));
symmetryPlanes_
.
insert
(
std
::
make_pair
(
it
->
first
,
plane
(
c
,
n
)));
}
}
void
symmetryPlaneOptimisation
::
pointInPlanes
(
VRWGraph
&
)
const
void
symmetryPlaneOptimisation
::
pointInPlanes
(
VRWGraph
&
pointInPlanes
)
const
{
const
PtrList
<
boundaryPatch
>&
boundaries
=
mesh_
.
boundaries
();
const
pointFieldPMG
&
points
=
mesh_
.
points
();
const
faceListPMG
&
faces
=
mesh_
.
faces
();
pointInPlanes
.
clear
();
pointInPlanes
.
setSize
(
points
.
size
());
forAll
(
boundaries
,
patchI
)
{
if
(
boundaries
[
patchI
].
type
()
==
"symmetryPlane"
)
{
const
label
start
=
boundaries
[
patchI
].
patchStart
();
const
label
end
=
start
+
boundaries
[
patchI
].
patchSize
();
for
(
label
faceI
=
start
;
faceI
<
end
;
++
faceI
)
{
const
face
&
f
=
faces
[
faceI
];
forAll
(
f
,
pI
)
pointInPlanes
.
appendIfNotIn
(
f
[
pI
],
patchI
);
}
}
}
if
(
Pstream
::
parRun
()
)
{
const
Map
<
label
>&
globalToLocal
=
mesh_
.
addressingData
().
globalToLocalPointAddressing
();
const
VRWGraph
&
pointAtProcs
=
mesh_
.
addressingData
().
pointAtProcs
();
const
DynList
<
label
>&
neiProcs
=
mesh_
.
addressingData
().
pointNeiProcs
();
std
::
map
<
label
,
labelLongList
>
exchangeData
;
forAll
(
neiProcs
,
i
)
exchangeData
[
neiProcs
[
i
]].
clear
();
forAllConstIter
(
Map
<
label
>
,
globalToLocal
,
it
)
{
const
label
pointI
=
it
();
if
(
pointInPlanes
.
sizeOfRow
(
pointI
)
==
0
)
continue
;
forAllRow
(
pointAtProcs
,
pointI
,
i
)
{
const
label
neiProc
=
pointAtProcs
(
pointI
,
i
);
if
(
neiProc
==
Pstream
::
myProcNo
()
)
continue
;
labelLongList
&
dataToSend
=
exchangeData
[
neiProc
];
dataToSend
.
append
(
it
.
key
());
dataToSend
.
append
(
pointInPlanes
.
sizeOfRow
(
pointI
));
forAllRow
(
pointInPlanes
,
pointI
,
pipI
)
dataToSend
.
append
(
pointInPlanes
(
pointI
,
pipI
));
}
}
labelLongList
receivedData
;
help
::
exchangeMap
(
exchangeData
,
receivedData
);
for
(
label
counter
=
0
;
counter
<
receivedData
.
size
();)
{
const
label
pointI
=
globalToLocal
[
receivedData
[
counter
++
]];
const
label
size
=
receivedData
[
counter
++
];
for
(
label
i
=
0
;
i
<
size
;
++
i
)
pointInPlanes
.
appendIfNotIn
(
pointI
,
receivedData
[
counter
++
]);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
...
...
@@ -137,7 +196,55 @@ symmetryPlaneOptimisation::~symmetryPlaneOptimisation()
void
symmetryPlaneOptimisation
::
optimizeSymmetryPlanes
()
{
pointFieldPMG
&
points
=
mesh_
.
points
();
Info
<<
"Detected "
<<
label
(
symmetryPlanes_
.
size
())
<<
" symmetry planes in the mesh"
<<
endl
;
VRWGraph
pointInPlane
;
pointInPlanes
(
pointInPlane
);
forAll
(
pointInPlane
,
pointI
)
{
const
label
nPlanes
=
pointInPlane
.
sizeOfRow
(
pointI
);
if
(
nPlanes
>
3
)
{
WarningIn
(
"void symmetryPlaneOptimisation::optimizeSymmetryPlanes()"
)
<<
"Point "
<<
pointI
<<
" is in more than three symmetry"
<<
" planes. Cannot move it"
<<
endl
;
}
point
&
p
=
points
[
pointI
];
vector
disp
(
vector
::
zero
);
for
(
label
plI
=
0
;
plI
<
nPlanes
;
++
plI
)
{
//- point is in a plane
std
::
map
<
label
,
plane
>::
const_iterator
it
=
symmetryPlanes_
.
find
(
pointInPlane
(
pointI
,
0
));
const
point
newP
=
it
->
second
.
nearestPoint
(
points
[
pointI
]);
disp
+=
newP
-
p
;
}
p
+=
disp
;
}
labelHashSet
badFaces
;
polyMeshGenChecks
::
checkFacePyramids
(
mesh_
,
false
,
VSMALL
,
&
badFaces
);
if
(
badFaces
.
size
()
)
{
WarningIn
(
"void symmetryPlaneOptimisation::optimizeSymmetryPlanes()"
)
<<
"Bad quality or inverted faces found in the mesh"
<<
endl
;
const
label
badFacesId
=
mesh_
.
addFaceSubset
(
"invalidFaces"
);
forAllConstIter
(
labelHashSet
,
badFaces
,
it
)
mesh_
.
addFaceToSubset
(
badFacesId
,
it
.
key
());
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...
...
meshLibrary/utilities/smoothers/geometry/meshOptimizer/symmetryPlaneOptimisation/symmetryPlaneOptimisation.H
View file @
2aba8cff
...
...
@@ -61,7 +61,7 @@ class symmetryPlaneOptimisation
polyMeshGen
&
mesh_
;
//- symmetry planes in the mesh
std
::
map
<
word
,
plane
>
symmetryPlanes_
;
std
::
map
<
label
,
plane
>
symmetryPlanes_
;
// Private member functions
//- detect symmetry planes
...
...
utilities/improveSymmetryPlanes/improveSymmetryPlanes.C
View file @
2aba8cff
...
...
@@ -44,8 +44,10 @@ int main(int argc, char *argv[])
polyMeshGen
pmg
(
runTime
);
pmg
.
read
();
Info
<<
"Starting optimisation of symmetry planes"
<<
endl
;
symmetryPlaneOptimisation
(
pmg
).
optimizeSymmetryPlanes
();
Info
<<
"Writing mesh"
<<
endl
;
pmg
.
write
();
Info
<<
"End
\n
"
<<
endl
;
...
...
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