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
10755bf0
Commit
10755bf0
authored
Mar 25, 2015
by
Franjo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Utility for unit conversion of surface meshes
parent
8058b73b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
76 deletions
+24
-76
utilities/scaleSurfaceMesh/scaleSurfaceMesh.C
utilities/scaleSurfaceMesh/scaleSurfaceMesh.C
+24
-76
No files found.
utilities/scaleSurfaceMesh/scaleSurfaceMesh.C
View file @
10755bf0
...
...
@@ -22,7 +22,7 @@ License
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
Reads the specified surface and writes it in the fms format
.
Scales surface vertices by a precribed factor
.
\*---------------------------------------------------------------------------*/
...
...
@@ -32,10 +32,6 @@ Description
#include "triSurf.H"
#include "triSurfModifier.H"
#include "helperFunctions.H"
#include "demandDrivenData.H"
#include "coordinateModifier.H"
#include "checkMeshDict.H"
#include "surfaceMeshGeometryModification.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
...
...
@@ -43,79 +39,31 @@ using namespace Foam;
int
main
(
int
argc
,
char
*
argv
[])
{
# include "setRootCase.H"
# include "createTime.H"
IOdictionary
meshDict
(
IOobject
(
"meshDict"
,
runTime
.
system
(),
runTime
,
IOobject
::
MUST_READ
,
IOobject
::
NO_WRITE
)
);
checkMeshDict
cmd
(
meshDict
);
fileName
surfaceFile
=
meshDict
.
lookup
(
"surfaceFile"
);
if
(
Pstream
::
parRun
()
)
surfaceFile
=
".."
/
surfaceFile
;
triSurf
surface
(
runTime
.
path
()
/
surfaceFile
);
surfaceMeshGeometryModification
gMod
(
surface
,
meshDict
);
//- modify points
const
triSurf
*
modSurfPtr
=
gMod
.
modifyGeometry
();
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
]
<<
" 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
;
::
exit
(
0
);
argList
::
noParallel
();
argList
::
validArgs
.
clear
();
argList
::
validArgs
.
append
(
"input surface file"
);
argList
::
validArgs
.
append
(
"output surface file"
);
argList
::
validArgs
.
append
(
"scalingFactor"
);
argList
args
(
argc
,
argv
);
const
fileName
inFileName
(
args
.
args
()[
1
]);
const
fileName
outFileName
(
args
.
args
()[
2
]);
const
scalar
scalingFactor
(
help
::
textToScalar
(
args
.
args
()[
3
]));
//- read the surface mesh
triSurf
surface
(
inFileName
);
triSurfModifier
sMod
(
surface
);
pointField
&
pts
=
sMod
.
pointsAccess
();
//- scales the vertices
# ifdef USE_OMP
# pragma omp parallel for schedule(dynamic, 100)
# endif
forAll
(
pts
,
pointI
)
pts
[
pointI
]
*=
scalingFactor
;
surfaceMeshGeometryModification
bgMod
(
*
modSurfPtr
,
meshDict
);
const
triSurf
*
backModSurfPtr
=
bgMod
.
revertGeometryModification
();
Info
<<
"Writting backward transformed surface"
<<
endl
;
backModSurfPtr
->
writeSurface
(
"backwardModifiedSurf.stl"
);
# ifdef DEBUGScaling
forAll
(
backModSurfPtr
->
points
(),
pI
)
if
(
mag
(
backModSurfPtr
->
points
()[
pI
]
-
surface
.
points
()[
pI
])
>
1e-14
)
Warning
<<
"Point "
<<
pI
<<
" is different "
<<
backModSurfPtr
->
points
()[
pI
]
<<
" from original "
<<
surface
.
points
()[
pI
]
<<
endl
;
# endif
deleteDemandDrivenData
(
modSurfPtr
);
deleteDemandDrivenData
(
backModSurfPtr
);
//- write the mesh back on disk
surface
.
writeSurface
(
outFileName
);
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