Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
9f188bce
"README.txt" did not exist on "f3674f843a7c23b0c434ca7d7c46463ce1883f7f"
Commit
9f188bce
authored
15 years ago
by
Boris Sedji
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
96cb7e2b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/arc/ImportLSImage.cpp
+92
-0
92 additions, 0 deletions
contrib/arc/ImportLSImage.cpp
with
92 additions
and
0 deletions
contrib/arc/ImportLSImage.cpp
0 → 100644
+
92
−
0
View file @
9f188bce
//
// Description:
//
//
// Author: <Boris Sedji>, 12/2009
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef _ITK_H_
#include
"itkImage.h"
#include
"itkImageFileReader.h"
#include
"itkImageFileWriter.h"
#define _ITK_H_
#endif
#include
"Octree.h"
#include
<stdio.h>
#include
"Gmsh.h"
#include
"GModel.h"
#include
"MElement.h"
#include
"gmshLevelset.h"
#include
"OctreeLSImage/OctreeLSImage.cpp"
int
main
(
int
argc
,
char
*
argv
[]
)
{
if
(
argc
<
4
)
{
std
::
cerr
<<
"Missing Parameters "
<<
std
::
endl
;
std
::
cerr
<<
"Usage: "
<<
argv
[
0
];
std
::
cerr
<<
" inputLevelSetImage MeshSizeMax MeshSizeMin"
<<
std
::
endl
;
return
1
;
}
typedef
float
PixelTypeFloat
;
const
unsigned
int
Dimension
=
3
;
typedef
itk
::
Image
<
PixelTypeFloat
,
Dimension
>
ImageTypeFloat
;
typedef
itk
::
ImageFileReader
<
ImageTypeFloat
>
ImageReaderTypeFloat
;
ImageReaderTypeFloat
::
Pointer
reader
=
ImageReaderTypeFloat
::
New
();
reader
->
SetFileName
(
argv
[
1
]);
ImageTypeFloat
::
Pointer
image
=
reader
->
GetOutput
();
image
->
Update
();
ImageTypeFloat
::
RegionType
region
;
region
=
image
->
GetLargestPossibleRegion
();
std
::
cout
<<
"
\n
Image dimensions : "
<<
region
.
GetSize
(
0
)
<<
" x "
<<
region
.
GetSize
(
1
)
<<
" x "
<<
region
.
GetSize
(
2
);
OctreeLSImage
octree
(
image
);
int
sizemax
=
atoi
(
argv
[
2
]);
int
sizemin
=
atoi
(
argv
[
3
]);
// Mesh with conditions on mesh size
octree
.
Mesh
(
sizemax
,
sizemin
);
// Smoothing mesh to avoid too much generation between adjacent elements
bool
statut
=
false
;
int
k
=
0
;
std
::
cout
<<
"
\n
Leaf Number : "
<<
(
octree
.
GetLeafNumber
())
<<
"
\n
"
;
while
((
!
statut
)
&
(
k
<
20
)){
statut
=
octree
.
Smooth
();
std
::
cout
<<
"
\n
k : "
<<
k
;
std
::
cout
<<
"
\n
smoothed : "
<<
(
int
)
statut
;
std
::
cout
<<
"
\n
Leaf Number : "
<<
(
octree
.
GetLeafNumber
())
<<
"
\n
"
;
k
++
;
}
// Create GModel with the octree mesh
GModel
*
m
=
octree
.
CreateGModel
();
// Write a .msh file with the mesh
std
::
string
ModelName
=
"OctreeMesh.msh"
;
m
->
writeMSH
(
ModelName
,
2.1
,
false
,
false
);
// Write a .msh file with the level set values as postview data
PView
*
pv
=
octree
.
CreateLSPView
(
m
);
bool
useadapt
=
true
;
pv
->
getData
(
useadapt
)
->
writeMSH
(
"LSPView.msh"
,
false
);
std
::
cout
<<
"
\n
"
;
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment