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
45da41b6
Commit
45da41b6
authored
10 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
move microstructure and computeBestSeeds stuff away from CommandLine.cpp
parent
130b324d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Common/CommandLine.cpp
+4
-328
4 additions, 328 deletions
Common/CommandLine.cpp
Mesh/periodical.cpp
+336
-0
336 additions, 0 deletions
Mesh/periodical.cpp
Mesh/periodical.h
+6
-0
6 additions, 0 deletions
Mesh/periodical.h
with
346 additions
and
328 deletions
Common/CommandLine.cpp
+
4
−
328
View file @
45da41b6
...
@@ -499,335 +499,11 @@ void GetOptions(int argc, char *argv[])
...
@@ -499,335 +499,11 @@ void GetOptions(int argc, char *argv[])
#if defined(HAVE_MESH)
#if defined(HAVE_MESH)
else
if
(
!
strcmp
(
argv
[
i
]
+
1
,
"microstructure"
))
{
else
if
(
!
strcmp
(
argv
[
i
]
+
1
,
"microstructure"
))
{
i
++
;
i
++
;
int
j
;
if
(
argv
[
i
])
microstructure
(
argv
[
i
++
]);
int
radical
;
double
max
;
double
xMax
;
double
yMax
;
double
zMax
;
std
::
vector
<
double
>
properties
;
if
(
argv
[
i
]){
std
::
ifstream
file
(
argv
[
i
++
]);
file
>>
max
;
file
>>
radical
;
file
>>
xMax
;
file
>>
yMax
;
file
>>
zMax
;
properties
.
clear
();
properties
.
resize
(
4
*
max
);
for
(
j
=
0
;
j
<
max
;
j
++
){
file
>>
properties
[
4
*
j
];
file
>>
properties
[
4
*
j
+
1
];
file
>>
properties
[
4
*
j
+
2
];
file
>>
properties
[
4
*
j
+
3
];
}
voroMetal3D
vm1
;
vm1
.
execute
(
properties
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
GModel
::
current
()
->
load
(
"MicrostructurePolycrystal3D.geo"
);
voroMetal3D
vm2
;
vm2
.
correspondance
(
0.00001
,
xMax
,
yMax
,
zMax
);
}
}
}
else
if
(
!
strcmp
(
argv
[
i
]
+
1
,
"computeBestSeeds"
))
{
else
if
(
!
strcmp
(
argv
[
i
]
+
1
,
"computeBestSeeds"
))
{
i
++
;
i
++
;
int
j
;
if
(
argv
[
i
])
computeBestSeeds
(
argv
[
i
++
]);
int
radical
;
double
max
;
double
xMax
;
double
yMax
;
double
zMax
;
std
::
vector
<
double
>
properties
;
std
::
cout
<<
"entree dans computeBestSeeds"
<<
std
::
endl
;
if
(
argv
[
i
]){
std
::
ifstream
file
(
argv
[
i
++
]);
file
>>
max
;
file
>>
radical
;
file
>>
xMax
;
file
>>
yMax
;
file
>>
zMax
;
properties
.
clear
();
properties
.
resize
(
4
*
max
);
for
(
j
=
0
;
j
<
max
;
j
++
){
file
>>
properties
[
4
*
j
];
file
>>
properties
[
4
*
j
+
1
];
file
>>
properties
[
4
*
j
+
2
];
file
>>
properties
[
4
*
j
+
3
];
}
std
::
cout
<<
"Before count"
<<
std
::
endl
;
std
::
vector
<
double
>
listDistances
;
listDistances
.
clear
();
int
nbOfCount
=
17
;
listDistances
.
resize
(
nbOfCount
);
for
(
int
Count
=
0
;
Count
<
nbOfCount
;
Count
++
){
std
::
cout
<<
"Count"
<<
Count
<<
std
::
endl
;
double
distMinGlobal
=
0.0
;
int
jMinGlobal
=
0
;
int
xORyORz
=
0
;
int
posORneg
=
0
;
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
]
+=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
1
;
posORneg
=
1
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
+
1
]
+=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
2
;
posORneg
=
1
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
+
2
]
+=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
3
;
posORneg
=
1
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
]
-=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
1
;
posORneg
=
2
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
+
1
]
-=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
2
;
posORneg
=
2
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
+
2
]
-=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
3
;
posORneg
=
2
;
}
delete
m
;
}
std
::
cout
<<
"distance minimale de "
<<
distMinGlobal
<<
std
::
endl
;
listDistances
[
Count
]
=
distMinGlobal
;
if
(
xORyORz
==
1
){
if
(
posORneg
==
1
){
properties
[
4
*
jMinGlobal
]
+=
0.01
;
}
else
if
(
posORneg
==
2
){
properties
[
4
*
jMinGlobal
]
-=
0.01
;
}
}
else
if
(
xORyORz
==
2
){
if
(
posORneg
==
1
){
properties
[
4
*
jMinGlobal
+
1
]
+=
0.01
;
}
else
if
(
posORneg
==
2
){
properties
[
4
*
jMinGlobal
+
1
]
-=
0.01
;
}
}
else
if
(
xORyORz
==
3
){
if
(
posORneg
==
1
){
properties
[
4
*
jMinGlobal
+
2
]
+=
0.01
;
}
else
if
(
posORneg
==
2
){
properties
[
4
*
jMinGlobal
+
2
]
-=
0.01
;
}
}
}
voroMetal3D
vm1
;
vm1
.
execute
(
properties
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
GModel
::
current
()
->
load
(
"MicrostructurePolycrystal3D.geo"
);
voroMetal3D
vm2
;
vm2
.
correspondance
(
0.00001
,
xMax
,
yMax
,
zMax
);
for
(
unsigned
int
iTmp
=
0
;
iTmp
<
listDistances
.
size
();
iTmp
++
){
std
::
cout
<<
"distMinGlobal "
<<
iTmp
<<
" egale a "
<<
listDistances
[
iTmp
]
<<
std
::
endl
;
}
std
::
cout
<<
"liste des nouveaux seeds :"
<<
std
::
endl
;
for
(
unsigned
int
iTmp
=
0
;
iTmp
<
max
;
iTmp
++
){
std
::
cout
<<
properties
[
4
*
iTmp
]
<<
" "
<<
properties
[
4
*
iTmp
+
1
]
<<
" "
<<
properties
[
4
*
iTmp
+
2
]
<<
" "
<<
properties
[
4
*
iTmp
+
3
]
<<
std
::
endl
;
}
}
}
}
#endif
#endif
else
if
(
!
strcmp
(
argv
[
i
]
+
1
,
"nopopup"
))
{
else
if
(
!
strcmp
(
argv
[
i
]
+
1
,
"nopopup"
))
{
...
...
This diff is collapsed.
Click to expand it.
Mesh/periodical.cpp
+
336
−
0
View file @
45da41b6
...
@@ -937,3 +937,339 @@ bool voroMetal3D::equal(double x,double y,double e){
...
@@ -937,3 +937,339 @@ bool voroMetal3D::equal(double x,double y,double e){
return
flag
;
return
flag
;
}
}
void
microstructure
(
const
char
*
filename
)
{
int
j
;
int
radical
;
double
max
;
double
xMax
;
double
yMax
;
double
zMax
;
std
::
vector
<
double
>
properties
;
if
(
filename
){
std
::
ifstream
file
(
filename
);
file
>>
max
;
file
>>
radical
;
file
>>
xMax
;
file
>>
yMax
;
file
>>
zMax
;
properties
.
clear
();
properties
.
resize
(
4
*
max
);
for
(
j
=
0
;
j
<
max
;
j
++
){
file
>>
properties
[
4
*
j
];
file
>>
properties
[
4
*
j
+
1
];
file
>>
properties
[
4
*
j
+
2
];
file
>>
properties
[
4
*
j
+
3
];
}
voroMetal3D
vm1
;
vm1
.
execute
(
properties
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
GModel
::
current
()
->
load
(
"MicrostructurePolycrystal3D.geo"
);
voroMetal3D
vm2
;
vm2
.
correspondance
(
0.00001
,
xMax
,
yMax
,
zMax
);
}
}
void
computeBestSeeds
(
const
char
*
filename
)
{
int
j
;
int
radical
;
double
max
;
double
xMax
;
double
yMax
;
double
zMax
;
std
::
vector
<
double
>
properties
;
std
::
cout
<<
"entree dans computeBestSeeds"
<<
std
::
endl
;
if
(
filename
){
std
::
ifstream
file
(
filename
);
file
>>
max
;
file
>>
radical
;
file
>>
xMax
;
file
>>
yMax
;
file
>>
zMax
;
properties
.
clear
();
properties
.
resize
(
4
*
max
);
for
(
j
=
0
;
j
<
max
;
j
++
){
file
>>
properties
[
4
*
j
];
file
>>
properties
[
4
*
j
+
1
];
file
>>
properties
[
4
*
j
+
2
];
file
>>
properties
[
4
*
j
+
3
];
}
std
::
cout
<<
"Before count"
<<
std
::
endl
;
std
::
vector
<
double
>
listDistances
;
listDistances
.
clear
();
int
nbOfCount
=
17
;
listDistances
.
resize
(
nbOfCount
);
for
(
int
Count
=
0
;
Count
<
nbOfCount
;
Count
++
){
std
::
cout
<<
"Count"
<<
Count
<<
std
::
endl
;
double
distMinGlobal
=
0.0
;
int
jMinGlobal
=
0
;
int
xORyORz
=
0
;
int
posORneg
=
0
;
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
]
+=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
1
;
posORneg
=
1
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
+
1
]
+=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
2
;
posORneg
=
1
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
+
2
]
+=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
3
;
posORneg
=
1
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
]
-=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
1
;
posORneg
=
2
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
+
1
]
-=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
2
;
posORneg
=
2
;
}
delete
m
;
}
for
(
j
=
0
;
j
<
max
;
j
++
){
std
::
cout
<<
"j "
<<
j
<<
std
::
endl
;
std
::
vector
<
double
>
propertiesModified
;
propertiesModified
.
clear
();
propertiesModified
.
resize
(
4
*
max
);
std
::
cout
<<
"before assign propModif"
<<
std
::
endl
;
for
(
unsigned
int
k
=
0
;
k
<
properties
.
size
();
k
++
){
propertiesModified
[
k
]
=
properties
[
k
];
}
std
::
cout
<<
"after assign propModif"
<<
std
::
endl
;
propertiesModified
[
4
*
j
+
2
]
-=
0.01
;
voroMetal3D
vm1
;
std
::
cout
<<
"before execute"
<<
std
::
endl
;
//std::remove("MicrostructurePolycrystal3D.geo");
vm1
.
execute
(
propertiesModified
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
//GModel::current()->destroy();
GModel
*
m
=
new
GModel
();
//GModel::current()->load("MicrostructurePolycrystal3D.geo");
m
->
load
(
"MicrostructurePolycrystal3D.geo"
);
double
distMinTmp
=
1000.0
;
//GModel *m = GModel::current();
for
(
GModel
::
eiter
ite
=
m
->
firstEdge
();
ite
!=
m
->
lastEdge
();
ite
++
){
GEdge
*
eTmp
=
(
*
ite
);
GVertex
*
vTmp1
=
eTmp
->
getBeginVertex
();
GVertex
*
vTmp2
=
eTmp
->
getEndVertex
();
double
distTmp
=
sqrt
((
vTmp1
->
x
()
-
vTmp2
->
x
())
*
(
vTmp1
->
x
()
-
vTmp2
->
x
())
+
(
vTmp1
->
y
()
-
vTmp2
->
y
())
*
(
vTmp1
->
y
()
-
vTmp2
->
y
())
+
(
vTmp1
->
z
()
-
vTmp2
->
z
())
*
(
vTmp1
->
z
()
-
vTmp2
->
z
()));
if
(
distTmp
<
distMinTmp
){
distMinTmp
=
distTmp
;
}
}
if
(
distMinTmp
>
distMinGlobal
){
distMinGlobal
=
distMinTmp
;
jMinGlobal
=
j
;
xORyORz
=
3
;
posORneg
=
2
;
}
delete
m
;
}
std
::
cout
<<
"distance minimale de "
<<
distMinGlobal
<<
std
::
endl
;
listDistances
[
Count
]
=
distMinGlobal
;
if
(
xORyORz
==
1
){
if
(
posORneg
==
1
){
properties
[
4
*
jMinGlobal
]
+=
0.01
;
}
else
if
(
posORneg
==
2
){
properties
[
4
*
jMinGlobal
]
-=
0.01
;
}
}
else
if
(
xORyORz
==
2
){
if
(
posORneg
==
1
){
properties
[
4
*
jMinGlobal
+
1
]
+=
0.01
;
}
else
if
(
posORneg
==
2
){
properties
[
4
*
jMinGlobal
+
1
]
-=
0.01
;
}
}
else
if
(
xORyORz
==
3
){
if
(
posORneg
==
1
){
properties
[
4
*
jMinGlobal
+
2
]
+=
0.01
;
}
else
if
(
posORneg
==
2
){
properties
[
4
*
jMinGlobal
+
2
]
-=
0.01
;
}
}
}
voroMetal3D
vm1
;
vm1
.
execute
(
properties
,
radical
,
0.1
,
xMax
,
yMax
,
zMax
);
GModel
::
current
()
->
load
(
"MicrostructurePolycrystal3D.geo"
);
voroMetal3D
vm2
;
vm2
.
correspondance
(
0.00001
,
xMax
,
yMax
,
zMax
);
for
(
unsigned
int
iTmp
=
0
;
iTmp
<
listDistances
.
size
();
iTmp
++
){
std
::
cout
<<
"distMinGlobal "
<<
iTmp
<<
" egale a "
<<
listDistances
[
iTmp
]
<<
std
::
endl
;
}
std
::
cout
<<
"liste des nouveaux seeds :"
<<
std
::
endl
;
for
(
unsigned
int
iTmp
=
0
;
iTmp
<
max
;
iTmp
++
){
std
::
cout
<<
properties
[
4
*
iTmp
]
<<
" "
<<
properties
[
4
*
iTmp
+
1
]
<<
" "
<<
properties
[
4
*
iTmp
+
2
]
<<
" "
<<
properties
[
4
*
iTmp
+
3
]
<<
std
::
endl
;
}
}
}
This diff is collapsed.
Click to expand it.
Mesh/periodical.h
+
6
−
0
View file @
45da41b6
...
@@ -35,3 +35,9 @@ class voroMetal3D{
...
@@ -35,3 +35,9 @@ class voroMetal3D{
void
correspondance
(
double
,
double
,
double
,
double
,
int
,
bool
&
,
double
,
double
,
double
);
void
correspondance
(
double
,
double
,
double
,
double
,
int
,
bool
&
,
double
,
double
,
double
);
bool
equal
(
double
,
double
,
double
);
bool
equal
(
double
,
double
,
double
);
};
};
void
microstructure
(
const
char
*
filename
);
void
computeBestSeeds
(
const
char
*
filename
);
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