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
aa8f5626
Commit
aa8f5626
authored
Mar 14, 2015
by
Franjo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial version of surface checks
parent
7035d077
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
99 deletions
+140
-99
meshLibrary/utilities/triSurfaceTools/triSurfaceChecks/triSurfaceChecks.C
...ities/triSurfaceTools/triSurfaceChecks/triSurfaceChecks.C
+44
-26
meshLibrary/utilities/triSurfaceTools/triSurfaceChecks/triSurfaceChecks.H
...ities/triSurfaceTools/triSurfaceChecks/triSurfaceChecks.H
+1
-1
utilities/checkSurfaceMesh/checkSurfaceMesh.C
utilities/checkSurfaceMesh/checkSurfaceMesh.C
+95
-72
No files found.
meshLibrary/utilities/triSurfaceTools/triSurfaceChecks/triSurfaceChecks.C
View file @
aa8f5626
...
@@ -281,13 +281,13 @@ label checkForHoles(const triSurf& surf, labelLongList& badTriangles)
...
@@ -281,13 +281,13 @@ label checkForHoles(const triSurf& surf, labelLongList& badTriangles)
return
badTriangles
.
size
();
return
badTriangles
.
size
();
}
}
label
checkForHoles
(
triSurf
&
surf
,
const
word
subset
Prefix
)
label
checkForHoles
(
triSurf
&
surf
,
const
word
subset
Name
)
{
{
labelLongList
trianglesNearHoles
;
labelLongList
trianglesNearHoles
;
if
(
checkForHoles
(
surf
,
trianglesNearHoles
)
)
if
(
checkForHoles
(
surf
,
trianglesNearHoles
)
)
{
{
const
label
setId
=
surf
.
addFacetSubset
(
subset
Prefix
);
const
label
setId
=
surf
.
addFacetSubset
(
subset
Name
);
forAll
(
trianglesNearHoles
,
i
)
forAll
(
trianglesNearHoles
,
i
)
surf
.
addFacetToSubset
(
setId
,
trianglesNearHoles
[
i
]);
surf
.
addFacetToSubset
(
setId
,
trianglesNearHoles
[
i
]);
...
@@ -623,6 +623,13 @@ label checkSelfIntersections
...
@@ -623,6 +623,13 @@ label checkSelfIntersections
{
{
const
labelledTri
&
tri
=
surf
[
tI
];
const
labelledTri
&
tri
=
surf
[
tI
];
const
triangle
<
point
,
point
>
currTri
(
pts
[
tri
[
0
]],
pts
[
tri
[
1
]],
pts
[
tri
[
2
]]
);
boundBox
bb
(
pts
[
tri
[
0
]],
pts
[
tri
[
0
]]);
boundBox
bb
(
pts
[
tri
[
0
]],
pts
[
tri
[
0
]]);
for
(
label
i
=
1
;
i
<
3
;
++
i
)
for
(
label
i
=
1
;
i
<
3
;
++
i
)
{
{
...
@@ -649,21 +656,23 @@ label checkSelfIntersections
...
@@ -649,21 +656,23 @@ label checkSelfIntersections
if
(
tI
>=
triJ
)
if
(
tI
>=
triJ
)
continue
;
continue
;
point
int0
,
int1
;
const
triangle
<
point
,
point
>
neiTri
(
pts
[
nt
[
0
]],
pts
[
nt
[
1
]],
pts
[
nt
[
2
]]
);
FixedList
<
point
,
2
>
intersectionEdge
;
const
bool
intersect
=
const
bool
intersect
=
triangleFuncs
::
i
ntersect
help
::
doTrianglesI
ntersect
(
(
pts
[
tri
[
0
]],
currTri
,
pts
[
tri
[
1
]],
neiTri
,
pts
[
tri
[
2
]],
intersectionEdge
,
tol
,
pts
[
nt
[
0
]],
Foam
::
cos
(
5
.
0
*
M_PI
/
180
.
0
)
pts
[
nt
[
1
]],
pts
[
nt
[
2
]],
int0
,
int1
);
);
if
(
intersect
)
if
(
intersect
)
...
@@ -728,6 +737,13 @@ label checkOverlaps
...
@@ -728,6 +737,13 @@ label checkOverlaps
{
{
const
labelledTri
&
tri
=
surf
[
tI
];
const
labelledTri
&
tri
=
surf
[
tI
];
const
triangle
<
point
,
point
>
currTri
(
pts
[
tri
[
0
]],
pts
[
tri
[
1
]],
pts
[
tri
[
2
]]
);
boundBox
bb
(
pts
[
tri
[
0
]],
pts
[
tri
[
0
]]);
boundBox
bb
(
pts
[
tri
[
0
]],
pts
[
tri
[
0
]]);
for
(
label
i
=
1
;
i
<
3
;
++
i
)
for
(
label
i
=
1
;
i
<
3
;
++
i
)
{
{
...
@@ -754,21 +770,23 @@ label checkOverlaps
...
@@ -754,21 +770,23 @@ label checkOverlaps
if
(
tI
>=
triJ
)
if
(
tI
>=
triJ
)
continue
;
continue
;
point
int0
,
int1
;
const
triangle
<
point
,
point
>
neiTri
(
pts
[
nt
[
0
]],
pts
[
nt
[
1
]],
pts
[
nt
[
2
]]
);
DynList
<
point
>
intersectionPolygon
;
const
bool
intersect
=
const
bool
intersect
=
triangleFuncs
::
intersect
help
::
doTrianglesOverlap
(
(
pts
[
tri
[
0
]],
currTri
,
pts
[
tri
[
1
]],
neiTri
,
pts
[
tri
[
2
]],
intersectionPolygon
,
tol
,
pts
[
nt
[
0
]],
Foam
::
cos
(
angleTol
*
M_PI
/
180
.
0
)
pts
[
nt
[
1
]],
pts
[
nt
[
2
]],
int0
,
int1
);
);
if
(
intersect
)
if
(
intersect
)
...
...
meshLibrary/utilities/triSurfaceTools/triSurfaceChecks/triSurfaceChecks.H
View file @
aa8f5626
...
@@ -74,7 +74,7 @@ label checkSurfaceManifolds(triSurf&, const word subsetPrefix="manifold_");
...
@@ -74,7 +74,7 @@ label checkSurfaceManifolds(triSurf&, const word subsetPrefix="manifold_");
//- check for existence of holes in the surface mesh
//- check for existence of holes in the surface mesh
label
checkForHoles
(
const
triSurf
&
,
labelLongList
&
);
label
checkForHoles
(
const
triSurf
&
,
labelLongList
&
);
label
checkForHoles
(
triSurf
&
,
const
word
subset
Prefix
=
"hole_
"
);
label
checkForHoles
(
triSurf
&
,
const
word
subset
Name
=
"holes
"
);
//- check for existence of non-manifold edges
//- check for existence of non-manifold edges
label
checkForNonManifoldEdges
(
const
triSurf
&
,
labelLongList
&
);
label
checkForNonManifoldEdges
(
const
triSurf
&
,
labelLongList
&
);
...
...
utilities/checkSurfaceMesh/checkSurfaceMesh.C
View file @
aa8f5626
...
@@ -30,12 +30,8 @@ Description
...
@@ -30,12 +30,8 @@ Description
#include "IFstream.H"
#include "IFstream.H"
#include "fileName.H"
#include "fileName.H"
#include "triSurf.H"
#include "triSurf.H"
#include "triSurfModifier.H"
#include "triSurfaceChecks.H"
#include "helperFunctions.H"
#include "boundBox.H"
#include "demandDrivenData.H"
#include "coordinateModifier.H"
#include "checkMeshDict.H"
#include "surfaceMeshGeometryModification.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
// Main program:
...
@@ -43,79 +39,106 @@ using namespace Foam;
...
@@ -43,79 +39,106 @@ using namespace Foam;
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
# include "setRootCase.H"
argList
::
noParallel
();
# include "createTime.H"
argList
::
validArgs
.
clear
();
argList
::
validArgs
.
append
(
"input surface file"
);
IOdictionary
meshDict
argList
args
(
argc
,
argv
);
(
IOobject
fileName
inFileName
(
args
.
args
()[
1
]);
(
"meshDict"
,
triSurf
surf
(
inFileName
);
runTime
.
system
(),
runTime
,
label
nFailed
(
0
);
IOobject
::
MUST_READ
,
IOobject
::
NO_WRITE
boundBox
bb
;
)
triSurfaceChecks
::
calculateBoundingBox
(
surf
,
bb
);
);
Info
<<
"Surface bounding box is "
<<
bb
<<
endl
;
checkMeshDict
cmd
(
meshDict
);
//- calculate manifolds
const
label
nManifolds
=
triSurfaceChecks
::
checkSurfaceManifolds
(
surf
);
fileName
surfaceFile
=
meshDict
.
lookup
(
"surfaceFile"
);
if
(
nManifolds
>
1
)
if
(
Pstream
::
parRun
()
)
{
surfaceFile
=
".."
/
surfaceFile
;
++
nFailed
;
triSurf
surface
(
runTime
.
path
()
/
surfaceFile
);
Info
<<
"Surface mesh consists of "
<<
nManifolds
<<
" manifolds."
<<
endl
;
surfaceMeshGeometryModification
gMod
(
surface
,
meshDict
);
Warning
<<
"You cannot mesh geometries consisting of more than"
<<
" one domain, and it must not contain baffles."
<<
endl
;
//- modify points
}
const
triSurf
*
modSurfPtr
=
gMod
.
modifyGeometry
();
else
Info
<<
"Writting modified surface"
<<
endl
;
modSurfPtr
->
writeSurface
(
"modifiedSurf.stl"
);
# ifdef DEBUGScaling
//- apply backward modification
Info
<<
"Here"
<<
endl
;
coordinateModifier
cMod
(
meshDict
.
subDict
(
"anisotropicSources"
));
Info
<<
"Starting modifications"
<<
endl
;
forAll
(
surface
.
points
(),
i
)
{
{
Info
<<
"
\n
Orig point "
<<
i
<<
" coordinates "
<<
surface
.
points
()[
i
]
Info
<<
"Surface mesh consists of a single manifold."
<<
endl
;
<<
" modified point "
<<
modSurfPtr
->
points
()[
i
]
<<
endl
;
const
point
p
=
cMod
.
backwardModifiedPoint
(
modSurfPtr
->
points
()[
i
]);
if
(
mag
(
p
-
surface
.
points
()[
i
])
>
1e-14
)
{
Warning
<<
"Point "
<<
i
<<
" is different "
<<
p
<<
" from original "
<<
surface
.
points
()[
i
]
<<
" modified point "
<<
cMod
.
modifiedPoint
(
surface
.
points
()[
i
])
<<
endl
;
::
exit
(
0
);
}
}
}
Info
<<
"Backscaling Ok"
<<
endl
;
//- find open boundary edges
::
exit
(
0
);
if
(
triSurfaceChecks
::
checkForHoles
(
surf
)
)
# endif
{
++
nFailed
;
surfaceMeshGeometryModification
bgMod
(
*
modSurfPtr
,
meshDict
);
Info
<<
"Surface mesh has open boundaries!!"
<<
endl
;
const
triSurf
*
backModSurfPtr
=
bgMod
.
revertGeometryModification
();
Warning
<<
"This indicates that there may be some holes in the surface"
<<
" mesh. Holes in the mesh must be smaller than the specified"
<<
" cell size at this location. In addition, please avoid"
<<
" using automatic refinement (minCellSize)."
<<
endl
;
}
else
{
Info
<<
"No holes found in the surface mesh."
<<
endl
;
}
Info
<<
"Writting backward transformed surface"
<<
endl
;
//- find non-manifold edges
backModSurfPtr
->
writeSurface
(
"backwardModifiedSurf.stl"
);
if
(
triSurfaceChecks
::
checkForNonManifoldEdges
(
surf
)
)
{
++
nFailed
;
# ifdef DEBUGScaling
Info
<<
"Surface mesh has non-manifold edges!!"
<<
endl
;
forAll
(
backModSurfPtr
->
points
(),
pI
)
Warning
<<
"This indicates that the surface mesh consists of multiple"
if
(
mag
(
backModSurfPtr
->
points
()[
pI
]
-
surface
.
points
()[
pI
])
>
1e-14
)
<<
" domains and/or baffles. Please make sure that they are not"
Warning
<<
"Point "
<<
pI
<<
" is different "
<<
" in the domain which shall be meshed."
<<
endl
;
<<
backModSurfPtr
->
points
()[
pI
]
}
<<
" from original "
<<
surface
.
points
()[
pI
]
<<
endl
;
else
# endif
{
Info
<<
"Surface does not have any non-manifold edges."
<<
endl
;
}
deleteDemandDrivenData
(
modSurfPtr
);
//- check the number of disconnected parts
deleteDemandDrivenData
(
backModSurfPtr
);
if
(
triSurfaceChecks
::
checkDisconnectedParts
(
surf
)
>
1
)
{
++
nFailed
;
Info
<<
"Surface mesh consists of disconnected parts."
<<
endl
;
Warning
<<
"This is not a problem if there exists a region surrounding"
<<
" the other ones! In other case, the mesher will generate"
<<
" the mesh in the domains with most cells."
<<
endl
;
}
else
{
Info
<<
"Surface mesh consists of a single region."
<<
endl
;
}
//- find triangles with small angles
if
(
triSurfaceChecks
::
checkAngles
(
surf
,
"smallAngles"
,
1
.
0
)
)
{
++
nFailed
;
Info
<<
"Surface mesh has some bad-quality triangles."
<<
endl
;
Warning
<<
"This may cause problems to the automatic refinement"
<<
" procedure (minCellSize). "
<<
endl
;
}
else
{
Info
<<
"No sliver triangles found."
<<
endl
;
}
if
(
nFailed
)
{
Warning
<<
"Found "
<<
nFailed
<<
" checks indicating potential problems."
<<
endl
;
Warning
<<
"This does not mean that you cannot generate"
<<
" a valid mesh. "
<<
endl
;
surf
.
writeSurface
(
inFileName
);
}
Info
<<
"End
\n
"
<<
endl
;
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